From bdda9e9ae418e19bd8fa57a019267f567d537018 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 14 Jun 2007 00:32:56 +0100 Subject: Fixed irc_chat_by_channel() to not break if using multiple IM accounts where some of them are down. --- irc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/irc.c b/irc.c index eec0ce11..ee7288bf 100644 --- a/irc.c +++ b/irc.c @@ -1223,9 +1223,17 @@ struct groupchat *irc_chat_by_channel( irc_t *irc, char *channel ) /* 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; + if( a->ic == NULL ) + continue; + + c = a->ic->groupchats; + while( c ) + { + if( c->channel && g_strcasecmp( c->channel, channel ) == 0 ) + return c; + + c = c->next; + } } return NULL; -- cgit v1.2.3