Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_channel.c

    r0e788f5 r7d4ffc2  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2013 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2010 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    670670       
    671671        icc->account = acc;
    672         if( ( icc->type & IRC_CC_TYPE_MASK ) == IRC_CC_TYPE_ACCOUNT )
     672        if( icc->type == IRC_CC_TYPE_ACCOUNT )
    673673                bee_irc_channel_update( ic->irc, ic, NULL );
    674674       
     
    680680        struct irc_channel *ic = set->data;
    681681        struct irc_control_channel *icc = ic->data;
    682         char *s;
    683        
    684         icc->type &= ~( IRC_CC_TYPE_MASK | IRC_CC_TYPE_INVERT );
    685        
    686         s = value;
    687         if( s[0] == '!' )
    688         {
    689                 icc->type |= IRC_CC_TYPE_INVERT;
    690                 s ++;
    691         }
    692        
    693         if( strcmp( s, "all" ) == 0 )
    694                 icc->type |= IRC_CC_TYPE_DEFAULT;
    695         else if( strcmp( s, "rest" ) == 0 )
    696                 icc->type |= IRC_CC_TYPE_REST;
    697         else if( strcmp( s, "group" ) == 0 )
    698                 icc->type |= IRC_CC_TYPE_GROUP;
    699         else if( strcmp( s, "account" ) == 0 )
    700                 icc->type |= IRC_CC_TYPE_ACCOUNT;
    701         else if( strcmp( s, "protocol" ) == 0 )
    702                 icc->type |= IRC_CC_TYPE_PROTOCOL;
     682       
     683        if( strcmp( value, "all" ) == 0 )
     684                icc->type = IRC_CC_TYPE_DEFAULT;
     685        else if( strcmp( value, "rest" ) == 0 )
     686                icc->type = IRC_CC_TYPE_REST;
     687        else if( strcmp( value, "group" ) == 0 )
     688                icc->type = IRC_CC_TYPE_GROUP;
     689        else if( strcmp( value, "account" ) == 0 )
     690                icc->type = IRC_CC_TYPE_ACCOUNT;
     691        else if( strcmp( value, "protocol" ) == 0 )
     692                icc->type = IRC_CC_TYPE_PROTOCOL;
    703693        else
    704694                return SET_INVALID;
     
    714704       
    715705        icc->group = bee_group_by_name( ic->irc->b, value, TRUE );
    716         if( ( icc->type & IRC_CC_TYPE_MASK ) == IRC_CC_TYPE_GROUP )
     706        if( icc->type == IRC_CC_TYPE_GROUP )
    717707                bee_irc_channel_update( ic->irc, ic, NULL );
    718708       
     
    730720       
    731721        icc->protocol = prpl;
    732         if( ( icc->type & IRC_CC_TYPE_MASK ) == IRC_CC_TYPE_PROTOCOL )
     722        if( icc->type == IRC_CC_TYPE_PROTOCOL )
    733723                bee_irc_channel_update( ic->irc, ic, NULL );
    734724       
     
    786776{
    787777        struct irc_control_channel *icc = ic->data;
    788         gboolean ret = FALSE;
    789778       
    790779        if( iu->bu == NULL )
    791780                return FALSE;
    792781       
    793         switch( icc->type & IRC_CC_TYPE_MASK )
     782        switch( icc->type )
    794783        {
    795784        case IRC_CC_TYPE_GROUP:
    796                 ret = iu->bu->group == icc->group;
    797                 break;
     785                return iu->bu->group == icc->group;
    798786        case IRC_CC_TYPE_ACCOUNT:
    799                 ret = iu->bu->ic->acc == icc->account;
    800                 break;
     787                return iu->bu->ic->acc == icc->account;
    801788        case IRC_CC_TYPE_PROTOCOL:
    802                 ret = iu->bu->ic->acc->prpl == icc->protocol;
    803                 break;
     789                return iu->bu->ic->acc->prpl == icc->protocol;
    804790        case IRC_CC_TYPE_DEFAULT:
    805791        default:
    806                 ret = TRUE;
    807                 break;
    808         }
    809        
    810         if( icc->type & IRC_CC_TYPE_INVERT )
    811                 ret = !ret;
    812        
    813         return ret;
     792                return TRUE;
     793        }
    814794}
    815795
Note: See TracChangeset for help on using the changeset viewer.