diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2012-09-16 19:08:15 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2012-09-16 19:08:15 +0100 |
commit | e9caacd00fc7f7682664d29567a5b7dcfbde7479 (patch) | |
tree | 926f6d6568c024158e8bed602ff9755fb68f0126 | |
parent | 79bb7e412d28e8afe734762e8bd3e4c488a53562 (diff) |
Don't accidentally create groupchats for 1:1 chats.
-rw-r--r-- | protocols/msn/sb.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index a1e07b73..9c015a9c 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -454,23 +454,31 @@ static int msn_sb_command( struct msn_handler_data *handler, char **cmd, int num { char buf[1024]; - if( num == 1 ) - { - g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session ); - sb->chat = imcb_chat_new( ic, buf ); - - g_free( sb->who ); - sb->who = NULL; - } - /* For as much as I understand this MPOP stuff now, a switchboard has two (or more) roster entries per participant. One "bare JID" and one JID;UUID. Ignore the latter. */ if( !strchr( cmd[4], ';' ) ) - imcb_chat_add_buddy( sb->chat, cmd[4] ); + { + /* HACK: Since even 1:1 chats now have >2 participants + (ourselves included) it gets hard to tell them apart + from rooms. Let's hope this is enough: */ + if( sb->chat == NULL && num != tot ) + { + g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session ); + sb->chat = imcb_chat_new( ic, buf ); + + g_free( sb->who ); + sb->who = NULL; + } + + if( sb->chat ) + imcb_chat_add_buddy( sb->chat, cmd[4] ); + } - if( num == tot ) + /* We have the full roster, start showing the channel to + the user. */ + if( num == tot && sb->chat ) { imcb_chat_add_buddy( sb->chat, ic->acc->user ); } |