Changeset 90cd6c4


Ignore:
Timestamp:
2010-03-14T18:22:43Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
21d48d9
Parents:
ceebeb1
Message:

Allow disabling certain IM protocols at runtime, patch from
misc@…, bug #381.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.conf

    rceebeb1 r90cd6c4  
    120120## Proxy = socks5://socksproxy.localnet.com
    121121
     122## Protocols offered by bitlbee
     123##
     124## As recompiling may be quite unpractical for some people, this option
     125## allows to remove the support of protocol, even if compiled in. If
     126## nothing is given, there are no restrictions.
     127##
     128## Protocols = jabber yahoo
     129
    122130
    123131[defaults]
  • conf.c

    rceebeb1 r90cd6c4  
    6363        conf->ping_timeout = 300;
    6464        conf->user = NULL;
     65        conf->protocols = NULL;
    6566        proxytype = 0;
    6667       
     
    307308                                conf->user = g_strdup( ini->value );
    308309                        }
     310                        else if( g_strcasecmp( ini->key, "protocols" ) == 0 )
     311                        {
     312                                g_strfreev( conf->protocols );
     313                                conf->protocols = g_strsplit_set( ini->value, " \t,;", -1 );
     314                        }
    309315                        else
    310316                        {
  • conf.h

    rceebeb1 r90cd6c4  
    5050        int ping_timeout;
    5151        char *user;
     52        char **protocols;
    5253} conf_t;
    5354
  • protocols/nogaim.c

    rceebeb1 r90cd6c4  
    9898void register_protocol (struct prpl *p)
    9999{
    100         protocols = g_list_append(protocols, p);
     100        int i;
     101        gboolean refused = global.conf->protocols != NULL;
     102 
     103        for (i = 0; global.conf->protocols && global.conf->protocols[i]; i++)
     104        {
     105                if (g_strcasecmp(p->name, global.conf->protocols[i]) == 0)
     106                        refused = FALSE;
     107        }
     108
     109        if (refused)
     110                log_message(LOGLVL_WARNING, "Protocol %s disabled\n", p->name);
     111        else
     112                protocols = g_list_append(protocols, p);
    101113}
    102114
Note: See TracChangeset for help on using the changeset viewer.