# HG changeset patch # User Mark Doliner # Date 1091311312 0 # Node ID 3f0d8ccefd7f15887e2e57a7caffad7e0807cc1b # Parent de9c4dc072b59d208c9f4a771f4d0592ac25cbaf [gaim-migrate @ 10466] Fixes bug 983610, and is an alternate change from the patch provided by patch 999827. Gaim would crash if you had a conv window with one and only one conv in it and you dragged that user's name from your blist to the conv window. committer: Tailor Script diff -r de9c4dc072b5 -r 3f0d8ccefd7f src/gtkconv.c --- a/src/gtkconv.c Sat Jul 31 21:48:21 2004 +0000 +++ b/src/gtkconv.c Sat Jul 31 22:01:52 2004 +0000 @@ -4354,6 +4354,8 @@ { GaimBlistNode *n = NULL; GaimBuddy *b; + unsigned int index; + memcpy(&n, sd->data, sizeof(n)); if (GAIM_BLIST_NODE_IS_CONTACT(n)) @@ -4363,9 +4365,28 @@ else return; - c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); - - gaim_conv_window_add_conversation(win, c); + /* + * If we already have an open conversation with this buddy, then + * just move the conv to this window. Otherwise, create a new + * conv and add it to this window. + */ + c = gaim_find_conversation(b->name); + if (c != NULL) { + GaimConvWindow *oldwin; + oldwin = gaim_conversation_get_window(c); + index = gaim_conversation_get_index(c); + if (oldwin != win) { + gaim_conv_window_remove_conversation(oldwin, index); + gaim_conv_window_add_conversation(win, c); + } + } else { + c = gaim_conversation_new(GAIM_CONV_IM, b->account, b->name); + gaim_conv_window_add_conversation(win, c); + } + + /* Make this conversation the active conversation */ + index = gaim_conversation_get_index(c); + gaim_conv_window_switch_conversation(win, index); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); }