aboutsummaryrefslogtreecommitdiffstats
path: root/irc.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-06-14 00:32:56 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2007-06-14 00:32:56 +0100
commitbdda9e9ae418e19bd8fa57a019267f567d537018 (patch)
treeb67ceaa8e3b7e655d5a2b10810829e5c8b2b1aa6 /irc.c
parent998b1035a6c8349b3661861eeb5d9d1f4082ba0a (diff)
Fixed irc_chat_by_channel() to not break if using multiple IM accounts
where some of them are down.
Diffstat (limited to 'irc.c')
-rw-r--r--irc.c14
1 files 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;