diff src/multi.c @ 4359:5fb47ec9bfe4

[gaim-migrate @ 4625] Wow, okay, where to begin with this one ;) I rewrote the whole conversation backend. It is now core/UI split. Here's how it works.. Every conversation is represented by a gaim_conversation structure. This branches out into gaim_im and gaim_chat structures. Every conversation lives in (well, normally, but it doesn't have to) a gaim_window structure. This is a _CORE_ representation of a window. There can be multiple gaim_window structures around. The gaim_window and gaim_conversation structures have UI-specific operation structures associated with them. At the moment, the only UI is GTK+, and this will be for some time. Don't start thinking you can write a QT UI now. It's just not going to happen. Everything that is done on a conversation is done through the core API. This API does core processing and then calls the UI operations for the rendering and anything else. Now, what does this give the user? - Multiple windows. - Multiple tabs per window. - Draggable tabs. - Send As menu is moved to the menubar. - Menubar for chats. - Some very cool stuff in the future, like replacing, say, IRC chat windows with an X-Chat interface, or whatever. - Later on, customizable window/conversation positioning. For developers: - Fully documented API - Core/UI split - Variable checking and mostly sane handling of incorrect variables. - Logical structure to conversations, both core and UI. - Some very cool stuff in the future, like replacing, say, IRC chat windows with an X-Chat interface, or whatever. - Later on, customizable window/conversation positioning. - Oh yeah, and the beginning of a stock icon system. Now, there are things that aren't there yet. You will see tabs even if you have them turned off. This will be fixed in time. Also, the preferences will change to work with the new structure. I'm starting school in 2 days, so it may not be done immediately, but hopefully in the next week. Enjoy! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 20 Jan 2003 09:10:23 +0000
parents 0c68d402f59f
children bf6ac19d0d63
line wrap: on
line diff
--- a/src/multi.c	Mon Jan 20 07:00:10 2003 +0000
+++ b/src/multi.c	Mon Jan 20 09:10:23 2003 +0000
@@ -25,6 +25,7 @@
 #include "prpl.h"
 #include "multi.h"
 #include "gaim.h"
+#include "conversation.h"
 
 #include "pixmaps/cancel.xpm"
 #include "pixmaps/ok.xpm"
@@ -1332,9 +1333,11 @@
 void account_online(struct gaim_connection *gc)
 {
 	struct signon_meter *meter = find_signon_meter(gc);
+	GList *wins;
 	GtkTreeIter iter;
 	GSList *grps, *buds;
 	GList *add_buds=NULL;
+	GList *l;
 
 	/* Set the time the account came online */
 	time(&gc->login_time);
@@ -1355,7 +1358,17 @@
 	update_privacy_connections();
 	do_away_menu();
 	do_proto_menu();
-	redo_convo_menus();
+
+	/*
+	 * XXX This is a hack! Remove this and replace it with a better event
+	 *     notification system.
+	 */
+	for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
+		struct gaim_window *win = (struct gaim_window *)wins->data;
+		gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
+								 GAIM_CONV_ACCOUNT_ONLINE);
+	}
+
 	redo_buddy_list();
 	gaim_setup(gc);
 
@@ -1409,19 +1422,29 @@
 						   -1);
 	}
 
-	return;
+	/* Update the conversation windows that use this account. */
+	for (l = gaim_get_conversations(); l != NULL; l = l->next) {
+		struct gaim_conversation *conv = (struct gaim_conversation *)l->data;
+
+		if (gaim_conversation_get_user(conv) == gc->user) {
+			gaim_conversation_update(conv, GAIM_CONV_UPDATE_USER);
+		}
+	}
 }
 
 void account_offline(struct gaim_connection *gc)
 {
 	struct signon_meter *meter = find_signon_meter(gc);
 	GtkTreeIter iter;
+	GList *l;
 
 	if (meter) {
 		kill_meter(meter);
 		meters = g_slist_remove(meters, meter);
 		g_free(meter);
 	}
+	debug_printf("Disconnecting. user = %p, gc = %p (%p)\n",
+				 gc->user, gc->user->gc, gc);
 	gc->user->gc = NULL;	/* wasn't that awkward? */
 	if (!acctedit)
 		return;
@@ -1429,6 +1452,15 @@
 	if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->user, &iter)) {
 		gtk_list_store_set(model, &iter, COLUMN_ONLINE, FALSE, -1);
 	}
+
+	/* Update the conversation windows that use this account. */
+	for (l = gaim_get_conversations(); l != NULL; l = l->next) {
+		struct gaim_conversation *conv = (struct gaim_conversation *)l->data;
+
+		if (gaim_conversation_get_user(conv) == gc->user) {
+			gaim_conversation_update(conv, GAIM_CONV_UPDATE_USER);
+		}
+	}
 }
 
 void auto_login()
@@ -1671,9 +1703,13 @@
 
 void signoff(struct gaim_connection *gc)
 {
+	GList *wins;
+
 	/* UI stuff */
+	/* CONV XXX
 	convo_menu_remove(gc);
 	remove_icon_data(gc);
+	*/
 
 	/* core stuff */
 	/* remove this here so plugins get a sensible count of connections */
@@ -1695,7 +1731,17 @@
 	redo_buddy_list();
 	do_away_menu();
 	do_proto_menu();
-	redo_convo_menus();
+
+	/*
+	 * XXX This is a hack! Remove this and replace it with a better event
+	 *     notification system.
+	 */
+	for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
+		struct gaim_window *win = (struct gaim_window *)wins->data;
+		gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
+								 GAIM_CONV_ACCOUNT_OFFLINE);
+	}
+
 	update_privacy_connections();
 
 	/* in, out, shake it all about */