diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-22 19:58:44 -0700 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-22 19:58:44 -0700 | 
| commit | 0e7ab64dfb66192a875c37322ca6f8a364ec5bc8 (patch) | |
| tree | 93e010a079632973a1e101ad0b85e4af67923643 /irc.c | |
| parent | 43671b964b636520a54e343542c5958b30e9f589 (diff) | |
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...
Diffstat (limited to 'irc.c')
| -rw-r--r-- | irc.c | 22 | 
1 files changed, 19 insertions, 3 deletions
| @@ -657,7 +657,7 @@ void irc_names( irc_t *irc, char *channel )  			strcat( namelist, " " );  		}  	} -	else if( ( c = chat_by_channel( channel ) ) ) +	else if( ( c = irc_chat_by_channel( irc, channel ) ) )  	{  		GList *l; @@ -810,7 +810,7 @@ void irc_topic( irc_t *irc, char *channel )  	}  	else  	{ -		struct groupchat *c = chat_by_channel( channel ); +		struct groupchat *c = irc_chat_by_channel( irc, channel );  		if( c )  			irc_reply( irc, 332, "%s :BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!", channel, c->title ); @@ -948,7 +948,7 @@ int irc_send( irc_t *irc, char *nick, char *s, int flags )  	if( *nick == '#' || *nick == '&' )  	{ -		if( !( c = chat_by_channel( nick ) ) ) +		if( !( c = irc_chat_by_channel( irc, nick ) ) )  		{  			irc_reply( irc, 403, "%s :Channel does not exist", nick );  			return( 0 ); @@ -1214,3 +1214,19 @@ static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond )  	return TRUE;  } + +struct groupchat *irc_chat_by_channel( irc_t *irc, char *channel ) +{ +	struct groupchat *c; +	account_t *a; +	 +	/* This finds the connection which has a conversation which belongs to this channel */ +	for( a = irc->accounts; a; a = a->next ) +	{ +		for( c = a->ic->groupchats; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next ); +		if( c ) +			return c; +	} +	 +	return NULL; +} | 
