changeset 10827:53e7884c549a

[gaim-migrate @ 12492] this should fix some problems with contact aware conversations, while possibly introducing new problems, and breaking some plugins. Someone needs to just remove GaimConvWindows all together. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Fri, 15 Apr 2005 22:32:00 +0000
parents 2a5fe8e67195
children 9cf14a87eedc
files src/connection.c src/conversation.c src/conversation.h src/gtkconv.c src/gtkconv.h src/gtkdialogs.c src/server.c
diffstat 7 files changed, 114 insertions(+), 222 deletions(-) [+]
line wrap: on
line diff
--- a/src/connection.c	Fri Apr 15 17:56:04 2005 +0000
+++ b/src/connection.c	Fri Apr 15 22:32:00 2005 +0000
@@ -199,6 +199,8 @@
 	if (gaim_presence_is_online(presence) == TRUE)
 		gaim_presence_set_status_active(presence, "offline", TRUE);
 
+#if 0
+/* see comment later in file on if 0'd same code	
 	/*
 	 * XXX This is a hack! Remove this and replace it with a better event
 	 *     notification system.
@@ -208,6 +210,7 @@
 		gaim_conversation_update(gaim_conv_window_get_conversation_at(win, 0),
 								 GAIM_CONV_ACCOUNT_OFFLINE);
 	}
+#endif
 
 	gaim_request_close_with_handle(gc);
 	gaim_notify_close_with_handle(gc);
@@ -293,12 +296,15 @@
 		 * XXX This is a hack! Remove this and replace it with a better event
 		 *     notification system.
 		 */
+#if 0
+		/* This looks like it was horribly broken before I got here... */
+		/* Why is it updating the first tab of each window? */
 		for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
 			GaimConvWindow *win = (GaimConvWindow *)wins->data;
 			gaim_conversation_update(gaim_conv_window_get_conversation_at(win, 0),
 									 GAIM_CONV_ACCOUNT_ONLINE);
 		}
-
+#endif
 		gaim_signal_emit(gaim_connections_get_handle(), "signed-on", gc);
 
 		/* let the prpl know what buddies we pulled out of the local list */
--- a/src/conversation.c	Fri Apr 15 17:56:04 2005 +0000
+++ b/src/conversation.c	Fri Apr 15 22:32:00 2005 +0000
@@ -260,22 +260,6 @@
 	g_free(sent);
 }
 
-static void
-update_conv_indexes(GaimConvWindow *win)
-{
-	GList *l;
-	int i;
-
-	for (l = gaim_conv_window_get_conversations(win), i = 0;
-		 l != NULL;
-		 l = l->next, i++) {
-
-		GaimConversation *conv = (GaimConversation *)l->data;
-
-		conv->conversation_pos = i;
-	}
-}
-
 GaimConvWindow *
 gaim_conv_window_new(void)
 {
@@ -476,8 +460,6 @@
 	win->conversations = g_list_append(win->conversations, conv);
 	win->conversation_count++;
 
-	conv->conversation_pos = win->conversation_count - 1;
-
 	if (ops != NULL) {
 		conv->window = win;
 
@@ -520,73 +502,10 @@
 
 	if (gaim_conv_window_get_conversation_count(win) == 0)
 		gaim_conv_window_destroy(win);
-	else {
-		/* Change all the indexes. */
-		update_conv_indexes(win);
-	}
 
 	return conv;
 }
 
-void
-gaim_conv_window_move_conversation(GaimConvWindow *win, unsigned int index,
-							  unsigned int new_index)
-{
-	GaimConvWindowUiOps *ops;
-	GaimConversation *conv;
-	GList *l;
-
-	g_return_if_fail(win != NULL);
-	g_return_if_fail(index < gaim_conv_window_get_conversation_count(win));
-	g_return_if_fail(index != new_index);
-
-	/* We can't move this past the last index. */
-	if (new_index > gaim_conv_window_get_conversation_count(win))
-		new_index = gaim_conv_window_get_conversation_count(win);
-
-	/* Get the list item for this conversation at its current index. */
-	l = g_list_nth(gaim_conv_window_get_conversations(win), index);
-
-	if (l == NULL) {
-		/* Should never happen. */
-		gaim_debug(GAIM_DEBUG_ERROR, "conversation",
-				   "Misordered conversations list in window %p\n", win);
-
-		return;
-	}
-
-	conv = (GaimConversation *)l->data;
-
-	/* Update the UI part of this. */
-	ops = gaim_conv_window_get_ui_ops(win);
-
-	if (ops != NULL && ops->move_conversation != NULL)
-		ops->move_conversation(win, conv, new_index);
-
-	if (new_index > index)
-		new_index--;
-
-	/* Remove the old one. */
-	win->conversations = g_list_delete_link(win->conversations, l);
-
-	/* Insert it where it should go. */
-	win->conversations = g_list_insert(win->conversations, conv, new_index);
-
-	update_conv_indexes(win);
-}
-
-GaimConversation *
-gaim_conv_window_get_conversation_at(const GaimConvWindow *win, unsigned int index)
-{
-	g_return_val_if_fail(win != NULL, NULL);
-	g_return_val_if_fail(index >= 0 &&
-						 index < gaim_conv_window_get_conversation_count(win),
-						 NULL);
-
-	return (GaimConversation *)g_list_nth_data(
-		gaim_conv_window_get_conversations(win), index);
-}
-
 size_t
 gaim_conv_window_get_conversation_count(const GaimConvWindow *win)
 {
@@ -596,17 +515,15 @@
 }
 
 void
-gaim_conv_window_switch_conversation(GaimConvWindow *win, unsigned int index)
+gaim_conv_window_switch_conversation(GaimConvWindow *win, GaimConversation *conv)
 {
 	GaimConvWindowUiOps *ops;
-	GaimConversation *old_conv, *conv;
+	GaimConversation *old_conv;
 
 	g_return_if_fail(win != NULL);
-	g_return_if_fail(index >= 0 &&
-					 index < gaim_conv_window_get_conversation_count(win));
+	g_return_if_fail(conv != NULL);
 
 	old_conv = gaim_conv_window_get_active_conversation(win);
-	conv = gaim_conv_window_get_conversation_at(win, index);
 
 	gaim_signal_emit(gaim_conversations_get_handle(),
 					 "conversation-switching", old_conv, conv);
@@ -614,7 +531,7 @@
 	ops = gaim_conv_window_get_ui_ops(win);
 
 	if (ops != NULL && ops->switch_conversation != NULL)
-		ops->switch_conversation(win, index);
+		ops->switch_conversation(win, conv);
 
 	gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE);
 
@@ -634,8 +551,8 @@
 
 	ops = gaim_conv_window_get_ui_ops(win);
 
-	if (ops != NULL && ops->get_active_index != NULL)
-		return gaim_conv_window_get_conversation_at(win, ops->get_active_index(win));
+	if (ops != NULL && ops->get_active_conversation != NULL)
+		return ops->get_active_conversation(win);
 
 	return NULL;
 }
@@ -1179,14 +1096,6 @@
 	gaim_conversation_set_title(conv, text);
 }
 
-int
-gaim_conversation_get_index(const GaimConversation *conv)
-{
-	g_return_val_if_fail(conv != NULL, 0);
-
-	return conv->conversation_pos;
-}
-
 void
 gaim_conversation_set_unseen(GaimConversation *conv, GaimUnseenState state)
 {
@@ -1734,7 +1643,7 @@
 	 * user is already using this window.
 	 */
 	if (!gaim_conv_window_has_focus(window))
-		gaim_conv_window_switch_conversation(window, gaim_conversation_get_index(conv));
+		gaim_conv_window_switch_conversation(window, conv);
 
 	gaim_conv_window_raise(window);
 
--- a/src/conversation.h	Fri Apr 15 17:56:04 2005 +0000
+++ b/src/conversation.h	Fri Apr 15 22:32:00 2005 +0000
@@ -162,13 +162,11 @@
 	void (*raise)(GaimConvWindow *win);
 	void (*flash)(GaimConvWindow *win);
 
-	void (*switch_conversation)(GaimConvWindow *win, unsigned int index);
+	void (*switch_conversation)(GaimConvWindow *win, GaimConversation *conv);
 	void (*add_conversation)(GaimConvWindow *win, GaimConversation *conv);
 	void (*remove_conversation)(GaimConvWindow *win, GaimConversation *conv);
-	void (*move_conversation)(GaimConvWindow *win, GaimConversation *conv,
-	                          unsigned int newIndex);
 
-	int (*get_active_index)(const GaimConvWindow *win);
+	GaimConversation *(*get_active_conversation)(const GaimConvWindow *win);
 	gboolean (*has_focus)(GaimConvWindow *win);
 };
 
@@ -377,7 +375,7 @@
  * @param ops The UI window operations structure.
  */
 void gaim_conv_window_set_ui_ops(GaimConvWindow *win,
-								 GaimConvWindowUiOps *ops);
+                                 GaimConvWindowUiOps *ops);
 
 /**
  * Returns the specified window's UI window operations structure.
@@ -399,7 +397,7 @@
  * @return The new index of the conversation in the window.
  */
 int gaim_conv_window_add_conversation(GaimConvWindow *win,
-									  GaimConversation *conv);
+                                      GaimConversation *conv);
 
 /**
  * Removes the conversation from the window.
@@ -411,31 +409,6 @@
  */
 GaimConversation *gaim_conv_window_remove_conversation(GaimConvWindow *win,
                                                        GaimConversation *conv);
-
-/**
- * Moves the conversation at the specified index in a window to a new index.
- *
- * @param win      The window.
- * @param index     The index of the conversation to move.
- * @param new_index The new index.
- */
-void gaim_conv_window_move_conversation(GaimConvWindow *win,
-										unsigned int index,
-										unsigned int new_index);
-
-/**
- * Returns the conversation in the window at the specified index.
- *
- * If the index is out of range, this returns @c NULL.
- *
- * @param win   The window.
- * @param index The index containing a conversation.
- *
- * @return The conversation at the specified index.
- */
-GaimConversation *gaim_conv_window_get_conversation_at(
-		const GaimConvWindow *win, unsigned int index);
-
 /**
  * Returns the number of conversations in the window.
  *
@@ -454,7 +427,7 @@
  * @param index The new index.
  */
 void gaim_conv_window_switch_conversation(GaimConvWindow *win,
-										  unsigned int index);
+                                          GaimConversation *conv);
 
 /**
  * Returns the active conversation in the window.
@@ -579,7 +552,7 @@
  * @param account The gaim_account.
  */
 void gaim_conversation_set_account(GaimConversation *conv,
-								   GaimAccount *account);
+                                   GaimAccount *account);
 
 /**
  * Returns the specified conversation's gaim_account.
@@ -632,22 +605,13 @@
 void gaim_conversation_autoset_title(GaimConversation *conv);
 
 /**
- * Returns the specified conversation's index in the parent window.
- *
- * @param conv The conversation.
- *
- * @return The current index in the parent window.
- */
-int gaim_conversation_get_index(const GaimConversation *conv);
-
-/**
  * Sets the conversation's unseen state.
  *
  * @param conv  The conversation.
  * @param state The new unseen state.
  */
 void gaim_conversation_set_unseen(GaimConversation *conv,
-								  GaimUnseenState state);
+                                  GaimUnseenState state);
 
 /**
  * Returns the conversation's unseen state.
--- a/src/gtkconv.c	Fri Apr 15 17:56:04 2005 +0000
+++ b/src/gtkconv.c	Fri Apr 15 22:32:00 2005 +0000
@@ -1575,60 +1575,46 @@
 }
 
 static void
-move_to_next_unread_tab(GaimConversation *conv)
+move_to_next_unread_tab(GaimGtkConversation *gtkconv)
 {
-	GaimConversation *next_conv = NULL;
+	GaimGtkConversation *next_gtkconv = NULL;
 	GaimConvWindow *win;
 	GList *l;
 	int index, i;
 
-	win   = gaim_conversation_get_window(conv);
-	index = gaim_conversation_get_index(conv);
+	win   = gaim_conversation_get_window(gtkconv->active_conv);
+	index = gtk_notebook_page_num(GTK_NOTEBOOK(GAIM_GTK_WINDOW(win)->notebook), gtkconv->tab_cont);
 
 	/* First check the tabs after this position. */
-	for (l = g_list_nth(gaim_conv_window_get_conversations(win), index);
-		 l != NULL;
-		 l = l->next) {
-
-		next_conv = (GaimConversation *)l->data;
-
-		if (gaim_conversation_get_unseen(next_conv) > 0)
-			break;
-
-		next_conv = NULL;
+	for (i = index; (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i++) {
+		for (l = next_gtkconv->convs; l; l = l->next) {
+			GaimConversation *c = l->data;
+			if (gaim_conversation_get_unseen(c) > 0)
+				break;
+		}
 	}
 
-	if (next_conv == NULL) {
+	if (next_gtkconv == NULL) {
 
 		/* Now check before this position. */
-		for (l = gaim_conv_window_get_conversations(win), i = 0;
-			 l != NULL && i < index;
-			 l = l->next) {
-
-			next_conv = (GaimConversation *)l->data;
-
-			if (gaim_conversation_get_unseen(next_conv) > 0)
-				break;
-
-			next_conv = NULL;
-		}
-
-		if (next_conv == NULL) {
-			/* Okay, just grab the next conversation tab. */
-			if (index == gaim_conv_window_get_conversation_count(win) - 1)
-				next_conv = gaim_conv_window_get_conversation_at(win, 0);
-			else
-			{
-				next_conv = gaim_conv_window_get_conversation_at(win,
-																 index + 1);
+		for (i = index; i >= 0 && (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i--) {
+			for (l = next_gtkconv->convs; l; l = l->next) {
+				GaimConversation *c = l->data;
+				if (gaim_conversation_get_unseen(c) > 0)
+					break;
 			}
 		}
+
+		if (next_gtkconv == NULL) {
+			/* Okay, just grab the next conversation tab. */
+			if (!(next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, index + 1)))
+				next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, index - 1);
+				
+		}
 	}
 
-	if (next_conv != NULL && next_conv != conv) {
-		gaim_conv_window_switch_conversation(win,
-			gaim_conversation_get_index(next_conv));
-	}
+	if (next_gtkconv != NULL && next_gtkconv != gtkconv)
+		gaim_conv_window_switch_conversation(win,next_gtkconv->active_conv);
 }
 
 static gboolean
@@ -1638,16 +1624,14 @@
 	GaimConversation *conv;
 	GaimGtkConversation *gtkconv;
 	GaimGtkWindow *gtkwin;
-	int numconvs;
 	int curconv;
 
 	gtkconv  = (GaimGtkConversation *)data;
 	conv     = gtkconv->active_conv;;
 	win      = gaim_conversation_get_window(conv);
 	gtkwin   = GAIM_GTK_WINDOW(win);
-	numconvs = gaim_conv_window_get_conversation_count(win);
-	curconv  = gaim_conversation_get_index(conv);
-
+	curconv = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook));
+	
 	/* If CTRL was held down... */
 	if (event->state & GDK_CONTROL_MASK) {
 		switch (event->keyval) {
@@ -1713,22 +1697,24 @@
 
 			case GDK_Page_Down:
 			case ']':
-				gaim_conv_window_switch_conversation(win,
-					(curconv + 1) % numconvs);
-
+				if (!gaim_gtk_get_gtkconv_at_index(win, curconv + 1))
+					gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0);
+				else
+					gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), curconv + 1);
 				return TRUE;
 				break;
 
 			case GDK_Page_Up:
 			case '[':
-				gaim_conv_window_switch_conversation(win,
-					(curconv + numconvs - 1) % numconvs);
-
+				if (!gaim_gtk_get_gtkconv_at_index(win, curconv - 1))
+					gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), -1);
+				else
+					gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), curconv - 1);
 				return TRUE;
 				break;
 
 			case GDK_Tab:
-				move_to_next_unread_tab(conv);
+				move_to_next_unread_tab(gtkconv);
 
 				return TRUE;
 				break;
@@ -1736,6 +1722,7 @@
 		} /* End of switch */
 	}
 
+#if 0
 	/* If ALT (or whatever) was held down... */
 	else if (event->state & GDK_MOD1_MASK)
 	{
@@ -1748,6 +1735,7 @@
 			return TRUE;
 		}
 	}
+#endif
 
 	/* If neither CTRL nor ALT were held down... */
 	else
@@ -2265,6 +2253,7 @@
 			gaim_conv_window_show(dest_win);
 		}
 	} else {
+		GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
 		dest_gtkwin = GAIM_GTK_WINDOW(dest_win);
 
 		/* Get the destination notebook. */
@@ -2275,20 +2264,15 @@
 								e->x_root, e->y_root);
 
 		if (win == dest_win) {
-			gaim_conv_window_move_conversation(win,
-				gaim_conversation_get_index(conv), dest_page_num);
+			gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook), gtkconv->tab_cont, dest_page_num);
 		}
 		else {
-			size_t pos;
+			GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
 
 			gaim_conv_window_remove_conversation(win, conv);
-
-			pos = gaim_conv_window_add_conversation(dest_win, conv);
-
-			if (pos != dest_page_num)
-				gaim_conv_window_move_conversation(dest_win, pos, dest_page_num);
-
-			gaim_conv_window_switch_conversation(dest_win, dest_page_num);
+			gaim_conv_window_add_conversation(dest_win, conv);
+			gtk_notebook_reorder_child(GTK_NOTEBOOK(GAIM_GTK_WINDOW(dest_win)->notebook), gtkconv->tab_cont, dest_page_num);
+			gaim_conv_window_switch_conversation(dest_win, gtkconv->active_conv);
 		}
 
 		gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry);
@@ -2858,12 +2842,12 @@
 	GaimGtkWindow *gtkwin;
 
 	win = (GaimConvWindow *)user_data;
-	conv = gaim_conv_window_get_conversation_at(win, page_num);
+	gtkconv = gaim_gtk_get_gtkconv_at_index(win, page_num);
+	conv = gtkconv->active_conv;
 
 	g_return_if_fail(conv != NULL);
 
 	gtkwin  = GAIM_GTK_WINDOW(win);
-	gtkconv = GAIM_GTK_CONVERSATION(conv);
 
 	gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE);
 
@@ -4098,7 +4082,6 @@
 	{
 		GaimBlistNode *n = NULL;
 		GaimBuddy *b;
-		unsigned int index;
 
 		memcpy(&n, sd->data, sizeof(n));
 
@@ -4128,8 +4111,7 @@
 		}
 
 		/* Make this conversation the active conversation */
-		index = gaim_conversation_get_index(c);
-		gaim_conv_window_switch_conversation(win, index);
+		gaim_conv_window_switch_conversation(win, c);
 
 		gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
 	}
@@ -4286,13 +4268,14 @@
 }
 
 static void
-gaim_gtk_switch_conversation(GaimConvWindow *win, unsigned int index)
+gaim_gtk_switch_conversation(GaimConvWindow *win, GaimConversation *conv)
 {
 	GaimGtkWindow *gtkwin;
+	GaimGtkConversation *gtkconv = conv->ui_data;
 
 	gtkwin = GAIM_GTK_WINDOW(win);
 
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), index);
+	gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), gtk_notebook_page_num(GTK_NOTEBOOK(gtkwin->notebook), gtkconv->tab_cont));
 }
 
 static const GtkTargetEntry te[] =
@@ -4418,6 +4401,7 @@
 
 		/* Setup the container for the tab. */
 		gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 6);
+		g_object_set_data(G_OBJECT(tab_cont), "GaimGtkConversation", gtkconv);
 		gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 6);
 		gtk_container_add(GTK_CONTAINER(tab_cont), pane);
 		gtk_widget_show(pane);
@@ -4553,10 +4537,9 @@
 	GaimConversationType conv_type;
 
 	conv_type = gaim_conversation_get_type(conv);
-	index = gaim_conversation_get_index(conv);
-
 	gtkwin  = GAIM_GTK_WINDOW(win);
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
+	index = gtk_notebook_page_num(GTK_NOTEBOOK(gtkwin->notebook), gtkconv->tab_cont);
 
 	g_object_ref(gtkconv->tab_cont);
 	gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont));
@@ -4580,7 +4563,7 @@
 
 static void
 gaim_gtk_move_conversation(GaimConvWindow *win, GaimConversation *conv,
-						   unsigned int new_index)
+                           unsigned int new_index)
 {
 	GaimGtkWindow *gtkwin;
 	GaimGtkConversation *gtkconv;
@@ -4588,15 +4571,12 @@
 	gtkwin  = GAIM_GTK_WINDOW(win);
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 
-	if (new_index > gaim_conversation_get_index(conv))
-		new_index--;
-
 	gtk_notebook_reorder_child(GTK_NOTEBOOK(gtkwin->notebook),
-							   gtkconv->tab_cont, new_index);
+	                           gtkconv->tab_cont, new_index);
 }
 
 static int
-gaim_gtk_get_active_index(const GaimConvWindow *win) /* FIXME: XXX: This is wrong due to contact aware convo changes */
+gaim_gtk_get_active_index(const GaimConvWindow *win)
 {
 	GaimGtkWindow *gtkwin;
 	int index;
@@ -4612,6 +4592,40 @@
 	return (index == -1 ? 0 : index);
 }
 
+GaimGtkConversation *
+gaim_gtk_get_gtkconv_at_index(const GaimConvWindow *win, int index)
+{
+	GaimGtkWindow *gtkwin;
+	GtkWidget *tab_cont;
+
+	gtkwin = GAIM_GTK_WINDOW(win);
+
+	if (index == -1)
+		index = 0;
+	tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gtkwin->notebook), index);
+	return g_object_get_data(G_OBJECT(tab_cont), "GaimGtkConversation");
+}
+
+static GaimConversation *
+gaim_gtk_get_active_conversation(const GaimConvWindow *win)
+{
+	GaimGtkWindow *gtkwin;
+	GaimGtkConversation *gtkconv;
+	int index;
+	GtkWidget *tab_cont;
+
+	gtkwin = GAIM_GTK_WINDOW(win);
+
+	index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook));
+	if (index == -1)
+		index = 0;
+	tab_cont = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gtkwin->notebook), index);
+	if (!tab_cont)
+		return NULL;
+	gtkconv = g_object_get_data(G_OBJECT(tab_cont), "GaimGtkConversation");
+	return gtkconv->active_conv;
+}
+
 static gboolean
 gaim_gtk_has_focus(GaimConvWindow *win)
 {
@@ -4636,8 +4650,7 @@
 	gaim_gtk_switch_conversation,
 	gaim_gtk_add_conversation,
 	gaim_gtk_remove_conversation,
-	gaim_gtk_move_conversation,
-	gaim_gtk_get_active_index,
+	gaim_gtk_get_active_conversation,
 	gaim_gtk_has_focus
 };
 
--- a/src/gtkconv.h	Fri Apr 15 17:56:04 2005 +0000
+++ b/src/gtkconv.h	Fri Apr 15 22:32:00 2005 +0000
@@ -292,6 +292,7 @@
  */
 int gaim_gtkconv_get_dest_tab_at_xy(GaimConvWindow *win, int x, int y);
 
+GaimGtkConversation *gaim_gtk_get_gtkconv_at_index(const GaimConvWindow *win, int index);
 /*@}*/
 
 /**************************************************************************/
--- a/src/gtkdialogs.c	Fri Apr 15 17:56:04 2005 +0000
+++ b/src/gtkdialogs.c	Fri Apr 15 22:32:00 2005 +0000
@@ -535,7 +535,7 @@
 	gtkwin = GAIM_GTK_WINDOW(win);
 
 	gtk_window_present(GTK_WINDOW(gtkwin->window));
-	gaim_conv_window_switch_conversation(win, gaim_conversation_get_index(conv));
+	gaim_conv_window_switch_conversation(win, conv);
 }
 
 static gboolean
--- a/src/server.c	Fri Apr 15 17:56:04 2005 +0000
+++ b/src/server.c	Fri Apr 15 22:32:00 2005 +0000
@@ -1094,8 +1094,7 @@
 	gaim_conv_chat_set_id(chat, id);
 
 	gaim_conv_window_show(gaim_conversation_get_window(conv));
-	gaim_conv_window_switch_conversation(gaim_conversation_get_window(conv),
-									gaim_conversation_get_index(conv));
+	gaim_conv_window_switch_conversation(gaim_conversation_get_window(conv), conv);
 
 	gaim_signal_emit(gaim_conversations_get_handle(), "chat-joined", conv);