diff options
| -rw-r--r-- | bitlbee.conf | 8 | ||||
| -rw-r--r-- | conf.c | 6 | ||||
| -rw-r--r-- | conf.h | 1 | ||||
| -rw-r--r-- | protocols/nogaim.c | 14 | 
4 files changed, 28 insertions, 1 deletions
| diff --git a/bitlbee.conf b/bitlbee.conf index 4a3bbddf..c5dafd9f 100644 --- a/bitlbee.conf +++ b/bitlbee.conf @@ -119,6 +119,14 @@  ## Proxy = socks4://socksproxy.localnet.com  ## Proxy = socks5://socksproxy.localnet.com +## Protocols offered by bitlbee +##  +## As recompiling may be quite unpractical for some people, this option +## allows to remove the support of protocol, even if compiled in. If +## nothing is given, there are no restrictions. +##  +## Protocols = jabber yahoo +  [defaults] @@ -62,6 +62,7 @@ conf_t *conf_load( int argc, char *argv[] )  	conf->ping_interval = 180;  	conf->ping_timeout = 300;  	conf->user = NULL; +	conf->protocols = NULL;  	proxytype = 0;  	i = conf_loadini( conf, global.conf_file ); @@ -306,6 +307,11 @@ static int conf_loadini( conf_t *conf, char *file )  				g_free( conf->user );  				conf->user = g_strdup( ini->value );  			} +			else if( g_strcasecmp( ini->key, "protocols" ) == 0 ) +			{ +				g_strfreev( conf->protocols ); +				conf->protocols = g_strsplit_set( ini->value, " \t,;", -1 ); +			}  			else  			{  				fprintf( stderr, "Error: Unknown setting `%s` in configuration file (line %d).\n", ini->key, ini->line ); @@ -49,6 +49,7 @@ typedef struct conf  	int ping_interval;  	int ping_timeout;  	char *user; +	char **protocols;  } conf_t;  G_GNUC_MALLOC conf_t *conf_load( int argc, char *argv[] ); diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 75c2139b..9c6daeaf 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -97,7 +97,19 @@ GList *protocols = NULL;  void register_protocol (struct prpl *p)  { -	protocols = g_list_append(protocols, p); +	int i; +	gboolean refused = global.conf->protocols != NULL; +  +	for (i = 0; global.conf->protocols && global.conf->protocols[i]; i++) + 	{ + 		if (g_strcasecmp(p->name, global.conf->protocols[i]) == 0) +			refused = FALSE; + 	} + +	if (refused) +		log_message(LOGLVL_WARNING, "Protocol %s disabled\n", p->name); +	else +		protocols = g_list_append(protocols, p);  }  struct prpl *find_protocol(const char *name) | 
