Mercurial > pidgin
changeset 9622:3f0d8ccefd7f
[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 <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 31 Jul 2004 22:01:52 +0000 |
parents | de9c4dc072b5 |
children | a6351c2b1150 |
files | src/gtkconv.c |
diffstat | 1 files changed, 24 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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); }