aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-05-09 12:26:57 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-05-09 12:26:57 +0100
commite5abfd413a797b268db0b107d0748eb7e40da431 (patch)
tree21a690353186830332d145fce1748103b5f0af83
parentbd5eee34fd1495820fb8440d515cbc86e8d912b2 (diff)
Safety check for yesterday's fixes: Double-check that a groupchat struct
isn't claimed already.
-rw-r--r--protocols/msn/sb.c7
-rw-r--r--protocols/oscar/oscar.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index 626cc83e..bfdbfe64 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -232,13 +232,16 @@ int msn_sb_sendmessage( struct msn_switchboard *sb, char *text )
struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb )
{
struct im_connection *ic = sb->ic;
+ struct groupchat *c = NULL;
char buf[1024];
/* Create the groupchat structure. */
g_snprintf( buf, sizeof( buf ), "MSN groupchat session %d", sb->session );
if( sb->who )
- sb->chat = bee_chat_by_title( ic->bee, ic, sb->who );
- if( sb->chat == NULL )
+ c = bee_chat_by_title( ic->bee, ic, sb->who );
+ if( c && !msn_sb_by_chat( c ) )
+ sb->chat = c;
+ else
sb->chat = imcb_chat_new( ic, buf );
/* Populate the channel. */
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 2d07f912..94dd876e 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -786,6 +786,7 @@ static int gaim_parse_logout(aim_session_t *sess, aim_frame_t *fr, ...) {
static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
struct im_connection *ic = sess->aux_data;
struct chat_connection *chatcon;
+ struct groupchat *c = NULL;
static int id = 1;
aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0);
@@ -798,8 +799,11 @@ static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
chatcon = find_oscar_chat_by_conn(ic, fr->conn);
chatcon->id = id;
- chatcon->cnv = bee_chat_by_title(ic->bee, ic, chatcon->show);
- if (chatcon->cnv == NULL)
+
+ c = bee_chat_by_title(ic->bee, ic, chatcon->show);
+ if (c && !c->data)
+ chatcon->cnv = c;
+ else
chatcon->cnv = imcb_chat_new(ic, chatcon->show);
chatcon->cnv->data = chatcon;