aboutsummaryrefslogtreecommitdiffstats
path: root/irc_im.c
diff options
context:
space:
mode:
Diffstat (limited to 'irc_im.c')
-rw-r--r--irc_im.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/irc_im.c b/irc_im.c
index c5384fed..42186bc9 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -258,9 +258,20 @@ static gboolean bee_irc_chat_new( bee_t *bee, struct groupchat *c )
irc_t *irc = bee->ui_data;
irc_channel_t *ic;
char *topic;
+ GSList *l;
int i;
- for( i = 0; i <= 999; i ++ )
+ /* Try to find a channel that expects to receive a groupchat.
+ This flag is set by groupchat_stub_invite(). */
+ for( l = irc->channels; l; l = l->next )
+ {
+ ic = l->data;
+ if( ic->flags & IRC_CHANNEL_CHAT_PICKME )
+ break;
+ }
+
+ /* If we found none, just generate some stupid name. */
+ if( l == NULL ) for( i = 0; i <= 999; i ++ )
{
char name[16];
sprintf( name, "&chat_%03d", i );