Changeset 0e7ab64


Ignore:
Timestamp:
2007-04-23T02:58:44Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2d317bb
Parents:
43671b9
Message:

Got rid of one HORRIBLE stupidity called chat_by_channel(), which still
used the GLOBAL IM connections list, allowing user A to interfere with
user B's groupchats if running in daemon mode. I can't believe this was
still there...

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r43671b9 r0e7ab64  
    658658                }
    659659        }
    660         else if( ( c = chat_by_channel( channel ) ) )
     660        else if( ( c = irc_chat_by_channel( irc, channel ) ) )
    661661        {
    662662                GList *l;
     
    811811        else
    812812        {
    813                 struct groupchat *c = chat_by_channel( channel );
     813                struct groupchat *c = irc_chat_by_channel( irc, channel );
    814814               
    815815                if( c )
     
    949949        if( *nick == '#' || *nick == '&' )
    950950        {
    951                 if( !( c = chat_by_channel( nick ) ) )
     951                if( !( c = irc_chat_by_channel( irc, nick ) ) )
    952952                {
    953953                        irc_reply( irc, 403, "%s :Channel does not exist", nick );
     
    12151215        return TRUE;
    12161216}
     1217
     1218struct groupchat *irc_chat_by_channel( irc_t *irc, char *channel )
     1219{
     1220        struct groupchat *c;
     1221        account_t *a;
     1222       
     1223        /* This finds the connection which has a conversation which belongs to this channel */
     1224        for( a = irc->accounts; a; a = a->next )
     1225        {
     1226                for( c = a->ic->groupchats; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next );
     1227                if( c )
     1228                        return c;
     1229        }
     1230       
     1231        return NULL;
     1232}
  • irc.h

    r43671b9 r0e7ab64  
    140140
    141141void buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags );
     142struct groupchat *irc_chat_by_channel( irc_t *irc, char *channel );
    142143
    143144#endif
  • irc_commands.c

    r43671b9 r0e7ab64  
    144144                irc_join( irc, u, irc->channel );
    145145        }
    146         else if( ( c = chat_by_channel( cmd[1] ) ) )
     146        else if( ( c = irc_chat_by_channel( irc, cmd[1] ) ) )
    147147        {
    148148                user_t *u = user_find( irc, irc->nick );
     
    201201{
    202202        char *nick = cmd[1], *channel = cmd[2];
    203         struct groupchat *c = chat_by_channel( channel );
     203        struct groupchat *c = irc_chat_by_channel( irc, channel );
    204204        user_t *u = user_find( irc, nick );
    205205       
     
    287287                        u = u->next;
    288288                }
    289         else if( ( c = chat_by_channel( channel ) ) )
     289        else if( ( c = irc_chat_by_channel( irc, channel ) ) )
    290290                for( l = c->in_room; l; l = l->next )
    291291                {
  • protocols/jabber/conference.c

    r43671b9 r0e7ab64  
    102102
    103103/* Not really the same syntax as the normal pkt_ functions, but this isn't
    104    called by the xmltree parser exactly and this way I can add some extra
     104   called by the xmltree parser directly and this way I can add some extra
    105105   parameters so we won't have to repeat too many things done by the caller
    106106   already. */
     
    151151                if( s ) *s = '/';
    152152        }
    153         else if( type ) /* This only gets called if type=="unavailable" */
     153        else if( type ) /* This only gets called if type is NULL or "unavailable" */
    154154        {
    155155                /* Won't handle this for now. */
  • protocols/nogaim.c

    r43671b9 r0e7ab64  
    856856/* Misc. BitlBee stuff which shouldn't really be here */
    857857
    858 struct groupchat *chat_by_channel( char *channel )
    859 {
    860         struct im_connection *ic;
    861         struct groupchat *c;
    862         GSList *l;
    863        
    864         /* This finds the connection which has a conversation which belongs to this channel */
    865         for( l = connections; l; l = l->next )
    866         {
    867                 ic = l->data;
    868                 for( c = ic->groupchats; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next );
    869                 if( c )
    870                         return c;
    871         }
    872        
    873         return NULL;
    874 }
    875 
    876858char *set_eval_away_devoice( set_t *set, char *value )
    877859{
  • protocols/nogaim.h

    r43671b9 r0e7ab64  
    207207G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, char *who, char *msg, u_int32_t flags, time_t sent_at );
    208208G_MODULE_EXPORT void imcb_chat_free( struct groupchat *c );
    209 struct groupchat *chat_by_channel( char *channel );
    210209
    211210/* Actions, or whatever. */
  • root_commands.c

    r43671b9 r0e7ab64  
    918918                char *s;
    919919               
    920                 channel = g_strdup( chat );
     920                channel = g_strdup_printf( "&%s", chat );
    921921                if( ( s = strchr( channel, '@' ) ) )
    922922                        *s = 0;
     
    928928        if( cmd[3] && cmd[4] && cmd[5] )
    929929                password = cmd[5];
     930       
     931        if( channel[0] != '#' && channel[0] != '&' )
     932        {
     933                irc_usermsg( irc, "Invalid channel name: %s", channel );
     934                g_free( channel );
     935                return;
     936        }
     937        else if( g_strcasecmp( channel, irc->channel ) == 0 || irc_chat_by_channel( irc, channel ) )
     938        {
     939                irc_usermsg( irc, "Channel already exists: %s", channel );
     940                g_free( channel );
     941                return;
     942        }
    930943       
    931944        if( ( c = a->prpl->chat_join( ic, chat, nick, password ) ) )
Note: See TracChangeset for help on using the changeset viewer.