Mercurial > pidgin.yaz
comparison src/multi.c @ 4349:0c68d402f59f
[gaim-migrate @ 4614]
XML Blist
Gaim stores all the buddy lists in one big happy file now. You can order
the buddies however you want, and they'll stay ordered that way.
We can also store some per-buddy information now, which will be cool.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 19 Jan 2003 22:16:52 +0000 |
parents | cc2f780c0505 |
children | 5fb47ec9bfe4 |
comparison
equal
deleted
inserted
replaced
4348:922b66840a51 | 4349:0c68d402f59f |
---|---|
84 g_snprintf(gc->username, sizeof(gc->username), "%s", user->username); | 84 g_snprintf(gc->username, sizeof(gc->username), "%s", user->username); |
85 g_snprintf(gc->password, sizeof(gc->password), "%s", user->password); | 85 g_snprintf(gc->password, sizeof(gc->password), "%s", user->password); |
86 gc->keepalive = 0; | 86 gc->keepalive = 0; |
87 gc->inpa = 0; | 87 gc->inpa = 0; |
88 gc->buddy_chats = NULL; | 88 gc->buddy_chats = NULL; |
89 gc->groups = NULL; | |
90 gc->permit = NULL; | |
91 gc->deny = NULL; | |
92 gc->away = NULL; | 89 gc->away = NULL; |
93 gc->away_state = NULL; | 90 gc->away_state = NULL; |
94 | 91 |
95 connections = g_slist_append(connections, gc); | 92 connections = g_slist_append(connections, gc); |
96 | 93 |
107 gint active_count; | 104 gint active_count; |
108 } *meter_win = NULL; | 105 } *meter_win = NULL; |
109 | 106 |
110 void destroy_gaim_conn(struct gaim_connection *gc) | 107 void destroy_gaim_conn(struct gaim_connection *gc) |
111 { | 108 { |
112 GSList *g = gc->groups; | 109 GSList *g = groups; |
113 GSList *h; | 110 GSList *h; |
114 struct group *m; | 111 struct group *m; |
115 struct buddy *n; | 112 struct buddy *n; |
116 while (g) { | 113 while (g) { |
117 m = (struct group *)g->data; | 114 m = (struct group *)g->data; |
118 g = g_slist_remove(g, m); | 115 g = g_slist_next(g); |
119 h = m->members; | 116 h = m->members; |
120 while (h) { | 117 while (h) { |
121 n = (struct buddy *)h->data; | 118 n = (struct buddy *)h->data; |
122 if (gc->prpl->buddy_free) | 119 h = g_slist_next(h); |
123 gc->prpl->buddy_free(n); | 120 if(n->user == gc->user) { |
124 h = g_slist_remove(h, n); | 121 n->present = 0; |
125 g_free(n); | 122 } |
126 } | 123 } |
127 g_free(m); | |
128 } | |
129 g = gc->permit; | |
130 while (g) { | |
131 g_free(g->data); | |
132 g = g_slist_remove(g, g->data); | |
133 } | |
134 g = gc->deny; | |
135 while (g) { | |
136 g_free(g->data); | |
137 g = g_slist_remove(g, g->data); | |
138 } | 124 } |
139 g_free(gc->away); | 125 g_free(gc->away); |
140 g_free(gc->away_state); | 126 g_free(gc->away_state); |
141 g_free(gc); | 127 g_free(gc); |
142 | 128 |
1110 } | 1096 } |
1111 | 1097 |
1112 static void do_del_acct(struct aim_user *u) | 1098 static void do_del_acct(struct aim_user *u) |
1113 { | 1099 { |
1114 GtkTreeIter iter; | 1100 GtkTreeIter iter; |
1101 GSList *grps = groups, *buds; | |
1115 | 1102 |
1116 if (u->gc) { | 1103 if (u->gc) { |
1117 u->gc->wants_to_die = TRUE; | 1104 u->gc->wants_to_die = TRUE; |
1118 signoff(u->gc); | 1105 signoff(u->gc); |
1119 } | 1106 } |
1120 | 1107 |
1121 if (get_iter_from_data(GTK_TREE_VIEW(treeview), u, &iter)) { | 1108 if (get_iter_from_data(GTK_TREE_VIEW(treeview), u, &iter)) { |
1122 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | 1109 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
1123 } | 1110 } |
1124 | 1111 |
1112 | |
1113 /* remove the buddies for the account we just destroyed */ | |
1114 while(grps) { | |
1115 struct group *g = grps->data; | |
1116 grps = grps->next; | |
1117 buds = g->members; | |
1118 while(buds) { | |
1119 struct buddy *b = buds->data; | |
1120 buds = buds->next; | |
1121 if(b->user == u) { | |
1122 /* sigh, someday we'll get a central gaim_buddy_free() */ | |
1123 g->members = g_slist_remove(g->members, b); | |
1124 g_hash_table_destroy(b->settings); | |
1125 g_free(b); | |
1126 } | |
1127 } | |
1128 if(!g->members) { | |
1129 ui_remove_group(g); | |
1130 groups = g_slist_remove(groups, g); | |
1131 g_free(g); | |
1132 } | |
1133 } | |
1134 | |
1125 aim_users = g_slist_remove(aim_users, u); | 1135 aim_users = g_slist_remove(aim_users, u); |
1136 | |
1137 gaim_blist_save(); | |
1138 | |
1126 save_prefs(); | 1139 save_prefs(); |
1127 } | 1140 } |
1128 | 1141 |
1129 static void del_acct_func(GtkTreeModel *model, GtkTreePath *path, | 1142 static void del_acct_func(GtkTreeModel *model, GtkTreePath *path, |
1130 GtkTreeIter *iter, gpointer data) | 1143 GtkTreeIter *iter, gpointer data) |
1318 | 1331 |
1319 void account_online(struct gaim_connection *gc) | 1332 void account_online(struct gaim_connection *gc) |
1320 { | 1333 { |
1321 struct signon_meter *meter = find_signon_meter(gc); | 1334 struct signon_meter *meter = find_signon_meter(gc); |
1322 GtkTreeIter iter; | 1335 GtkTreeIter iter; |
1336 GSList *grps, *buds; | |
1337 GList *add_buds=NULL; | |
1323 | 1338 |
1324 /* Set the time the account came online */ | 1339 /* Set the time the account came online */ |
1325 time(&gc->login_time); | 1340 time(&gc->login_time); |
1326 | 1341 |
1327 /* first we hide the login progress meter */ | 1342 /* first we hide the login progress meter */ |
1339 | 1354 |
1340 update_privacy_connections(); | 1355 update_privacy_connections(); |
1341 do_away_menu(); | 1356 do_away_menu(); |
1342 do_proto_menu(); | 1357 do_proto_menu(); |
1343 redo_convo_menus(); | 1358 redo_convo_menus(); |
1359 redo_buddy_list(); | |
1344 gaim_setup(gc); | 1360 gaim_setup(gc); |
1345 | 1361 |
1346 gc->user->connecting = FALSE; | 1362 gc->user->connecting = FALSE; |
1347 connecting_count--; | 1363 connecting_count--; |
1348 debug_printf("connecting_count: %d\n", connecting_count); | 1364 debug_printf("connecting_count: %d\n", connecting_count); |
1360 } | 1376 } |
1361 if (opt_away_arg != NULL) { | 1377 if (opt_away_arg != NULL) { |
1362 g_free(opt_away_arg); | 1378 g_free(opt_away_arg); |
1363 opt_away_arg = NULL; | 1379 opt_away_arg = NULL; |
1364 } | 1380 } |
1381 | |
1382 /* let the prpl know what buddies we pulled out of the local list */ | |
1383 | |
1384 for(grps = groups; grps; grps = grps->next) { | |
1385 struct group *g = grps->data; | |
1386 for(buds = g->members; buds; buds = buds->next) { | |
1387 struct buddy *b = buds->data; | |
1388 if(b->user->gc == gc) { | |
1389 add_buds = g_list_append(add_buds, b->name); | |
1390 } | |
1391 } | |
1392 } | |
1393 | |
1394 if(add_buds) { | |
1395 serv_add_buddies(gc, add_buds); | |
1396 g_list_free(add_buds); | |
1397 } | |
1398 | |
1399 serv_set_permit_deny(gc); | |
1365 | 1400 |
1366 /* everything for the account editor */ | 1401 /* everything for the account editor */ |
1367 if (!acctedit) | 1402 if (!acctedit) |
1368 return; | 1403 return; |
1369 | 1404 |
1656 debug_printf("connecting_count: %d\n", connecting_count); | 1691 debug_printf("connecting_count: %d\n", connecting_count); |
1657 serv_close(gc); | 1692 serv_close(gc); |
1658 | 1693 |
1659 /* more UI stuff */ | 1694 /* more UI stuff */ |
1660 redo_buddy_list(); | 1695 redo_buddy_list(); |
1661 build_edit_tree(); | |
1662 do_away_menu(); | 1696 do_away_menu(); |
1663 do_proto_menu(); | 1697 do_proto_menu(); |
1664 redo_convo_menus(); | 1698 redo_convo_menus(); |
1665 update_privacy_connections(); | 1699 update_privacy_connections(); |
1666 | 1700 |
1679 struct aim_user *u = g_new0(struct aim_user, 1); | 1713 struct aim_user *u = g_new0(struct aim_user, 1); |
1680 g_snprintf(u->username, sizeof(u->username), "%s", name); | 1714 g_snprintf(u->username, sizeof(u->username), "%s", name); |
1681 g_snprintf(u->user_info, sizeof(u->user_info), "%s", DEFAULT_INFO); | 1715 g_snprintf(u->user_info, sizeof(u->user_info), "%s", DEFAULT_INFO); |
1682 u->protocol = proto; | 1716 u->protocol = proto; |
1683 u->options = opts; | 1717 u->options = opts; |
1718 u->permit = NULL; | |
1719 u->deny = NULL; | |
1684 aim_users = g_slist_append(aim_users, u); | 1720 aim_users = g_slist_append(aim_users, u); |
1685 | 1721 |
1686 if (treeview) { | 1722 if (treeview) { |
1687 GtkTreeIter iter; | 1723 GtkTreeIter iter; |
1688 | 1724 |