comparison 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
comparison
equal deleted inserted replaced
4358:2b8abf7f9cc1 4359:5fb47ec9bfe4
23 #include <ctype.h> 23 #include <ctype.h>
24 #include <gtk/gtk.h> 24 #include <gtk/gtk.h>
25 #include "prpl.h" 25 #include "prpl.h"
26 #include "multi.h" 26 #include "multi.h"
27 #include "gaim.h" 27 #include "gaim.h"
28 #include "conversation.h"
28 29
29 #include "pixmaps/cancel.xpm" 30 #include "pixmaps/cancel.xpm"
30 #include "pixmaps/ok.xpm" 31 #include "pixmaps/ok.xpm"
31 /*#include "pixmaps/no_icon.xpm"*/ 32 /*#include "pixmaps/no_icon.xpm"*/
32 33
1330 } 1331 }
1331 1332
1332 void account_online(struct gaim_connection *gc) 1333 void account_online(struct gaim_connection *gc)
1333 { 1334 {
1334 struct signon_meter *meter = find_signon_meter(gc); 1335 struct signon_meter *meter = find_signon_meter(gc);
1336 GList *wins;
1335 GtkTreeIter iter; 1337 GtkTreeIter iter;
1336 GSList *grps, *buds; 1338 GSList *grps, *buds;
1337 GList *add_buds=NULL; 1339 GList *add_buds=NULL;
1340 GList *l;
1338 1341
1339 /* Set the time the account came online */ 1342 /* Set the time the account came online */
1340 time(&gc->login_time); 1343 time(&gc->login_time);
1341 1344
1342 /* first we hide the login progress meter */ 1345 /* first we hide the login progress meter */
1353 show_buddy_list(); 1356 show_buddy_list();
1354 1357
1355 update_privacy_connections(); 1358 update_privacy_connections();
1356 do_away_menu(); 1359 do_away_menu();
1357 do_proto_menu(); 1360 do_proto_menu();
1358 redo_convo_menus(); 1361
1362 /*
1363 * XXX This is a hack! Remove this and replace it with a better event
1364 * notification system.
1365 */
1366 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
1367 struct gaim_window *win = (struct gaim_window *)wins->data;
1368 gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
1369 GAIM_CONV_ACCOUNT_ONLINE);
1370 }
1371
1359 redo_buddy_list(); 1372 redo_buddy_list();
1360 gaim_setup(gc); 1373 gaim_setup(gc);
1361 1374
1362 gc->user->connecting = FALSE; 1375 gc->user->connecting = FALSE;
1363 connecting_count--; 1376 connecting_count--;
1407 COLUMN_ONLINE, TRUE, 1420 COLUMN_ONLINE, TRUE,
1408 COLUMN_PROTOCOL, gc->prpl->name, 1421 COLUMN_PROTOCOL, gc->prpl->name,
1409 -1); 1422 -1);
1410 } 1423 }
1411 1424
1412 return; 1425 /* Update the conversation windows that use this account. */
1426 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
1427 struct gaim_conversation *conv = (struct gaim_conversation *)l->data;
1428
1429 if (gaim_conversation_get_user(conv) == gc->user) {
1430 gaim_conversation_update(conv, GAIM_CONV_UPDATE_USER);
1431 }
1432 }
1413 } 1433 }
1414 1434
1415 void account_offline(struct gaim_connection *gc) 1435 void account_offline(struct gaim_connection *gc)
1416 { 1436 {
1417 struct signon_meter *meter = find_signon_meter(gc); 1437 struct signon_meter *meter = find_signon_meter(gc);
1418 GtkTreeIter iter; 1438 GtkTreeIter iter;
1439 GList *l;
1419 1440
1420 if (meter) { 1441 if (meter) {
1421 kill_meter(meter); 1442 kill_meter(meter);
1422 meters = g_slist_remove(meters, meter); 1443 meters = g_slist_remove(meters, meter);
1423 g_free(meter); 1444 g_free(meter);
1424 } 1445 }
1446 debug_printf("Disconnecting. user = %p, gc = %p (%p)\n",
1447 gc->user, gc->user->gc, gc);
1425 gc->user->gc = NULL; /* wasn't that awkward? */ 1448 gc->user->gc = NULL; /* wasn't that awkward? */
1426 if (!acctedit) 1449 if (!acctedit)
1427 return; 1450 return;
1428 1451
1429 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->user, &iter)) { 1452 if (get_iter_from_data(GTK_TREE_VIEW(treeview), gc->user, &iter)) {
1430 gtk_list_store_set(model, &iter, COLUMN_ONLINE, FALSE, -1); 1453 gtk_list_store_set(model, &iter, COLUMN_ONLINE, FALSE, -1);
1454 }
1455
1456 /* Update the conversation windows that use this account. */
1457 for (l = gaim_get_conversations(); l != NULL; l = l->next) {
1458 struct gaim_conversation *conv = (struct gaim_conversation *)l->data;
1459
1460 if (gaim_conversation_get_user(conv) == gc->user) {
1461 gaim_conversation_update(conv, GAIM_CONV_UPDATE_USER);
1462 }
1431 } 1463 }
1432 } 1464 }
1433 1465
1434 void auto_login() 1466 void auto_login()
1435 { 1467 {
1669 } 1701 }
1670 } 1702 }
1671 1703
1672 void signoff(struct gaim_connection *gc) 1704 void signoff(struct gaim_connection *gc)
1673 { 1705 {
1706 GList *wins;
1707
1674 /* UI stuff */ 1708 /* UI stuff */
1709 /* CONV XXX
1675 convo_menu_remove(gc); 1710 convo_menu_remove(gc);
1676 remove_icon_data(gc); 1711 remove_icon_data(gc);
1712 */
1677 1713
1678 /* core stuff */ 1714 /* core stuff */
1679 /* remove this here so plugins get a sensible count of connections */ 1715 /* remove this here so plugins get a sensible count of connections */
1680 connections = g_slist_remove(connections, gc); 1716 connections = g_slist_remove(connections, gc);
1681 debug_printf("date: %s\n", full_date()); 1717 debug_printf("date: %s\n", full_date());
1693 1729
1694 /* more UI stuff */ 1730 /* more UI stuff */
1695 redo_buddy_list(); 1731 redo_buddy_list();
1696 do_away_menu(); 1732 do_away_menu();
1697 do_proto_menu(); 1733 do_proto_menu();
1698 redo_convo_menus(); 1734
1735 /*
1736 * XXX This is a hack! Remove this and replace it with a better event
1737 * notification system.
1738 */
1739 for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
1740 struct gaim_window *win = (struct gaim_window *)wins->data;
1741 gaim_conversation_update(gaim_window_get_conversation_at(win, 0),
1742 GAIM_CONV_ACCOUNT_OFFLINE);
1743 }
1744
1699 update_privacy_connections(); 1745 update_privacy_connections();
1700 1746
1701 /* in, out, shake it all about */ 1747 /* in, out, shake it all about */
1702 if (connections) 1748 if (connections)
1703 return; 1749 return;