comparison src/multi.c @ 4770:c4c28874ecd3

[gaim-migrate @ 5088] I want to go to sleep. This is drag-n-drop moving of buddies in the list. I think it works, but I didn't actually test it... I really should have though; I can't imagine it working fine as-is. ;) I'm holding off on the rest of my Edit Buddy List stuff for tomorrow... I love last minute things, don't I? Note: I created gaim_blist_members and gaim_blist_groups to reproduce the effects of the old groups GSList and the members GSList of the group struct that I removed. This is really sub-optimal and should be replaced to iterate the Buddy List directly. If someone wants to do that, please do. Even if you don't want to do that, just review the changes I made and make sure I didn't do anything stupid. It is past 6am and I'm a bit tired and prone to mistake making. Thanks. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 14 Mar 2003 11:38:21 +0000
parents 34fdf9e313d5
children 6fe8008d6560
comparison
equal deleted inserted replaced
4769:e0afac5f85bd 4770:c4c28874ecd3
152 gint active_count; 152 gint active_count;
153 } *meter_win = NULL; 153 } *meter_win = NULL;
154 154
155 void destroy_gaim_conn(struct gaim_connection *gc) 155 void destroy_gaim_conn(struct gaim_connection *gc)
156 { 156 {
157 GSList *g = groups; 157 GSList *g = gaim_blist_groups(), *g1 = g;
158 GSList *h; 158 GSList *h, *h1;
159 struct group *m; 159 struct group *m;
160 struct buddy *n; 160 struct buddy *n;
161 while (g) { 161 while (g1) {
162 m = (struct group *)g->data; 162 m = (struct group *)g1->data;
163 g = g_slist_next(g); 163 g1 = g_slist_next(g1);
164 h = m->members; 164 h1 = h = gaim_blist_members(m);
165 while (h) { 165 while (h1) {
166 n = (struct buddy *)h->data; 166 n = (struct buddy *)h1->data;
167 h = g_slist_next(h); 167 h1 = g_slist_next(h1);
168 if(n->account == gc->account) { 168 if(n->account == gc->account) {
169 n->present = 0; 169 n->present = 0;
170 } 170 }
171 } 171 }
172 } 172 g_slist_free(h);
173 }
174 g_slist_free(g);
173 g_free(gc->away); 175 g_free(gc->away);
174 g_free(gc->away_state); 176 g_free(gc->away_state);
175 g_free(gc); 177 g_free(gc);
176 178
177 if (!connections && mainwindow) 179 if (!connections && mainwindow)
1310 } 1312 }
1311 1313
1312 static void do_del_acct(struct gaim_account *account) 1314 static void do_del_acct(struct gaim_account *account)
1313 { 1315 {
1314 GtkTreeIter iter; 1316 GtkTreeIter iter;
1315 GSList *grps = groups, *buds; 1317 GSList *grps1, *grps, *buds;
1318 grps1 = grps = gaim_blist_groups();
1316 1319
1317 if (account->gc) { 1320 if (account->gc) {
1318 account->gc->wants_to_die = TRUE; 1321 account->gc->wants_to_die = TRUE;
1319 signoff(account->gc); 1322 signoff(account->gc);
1320 } 1323 }
1323 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); 1326 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
1324 } 1327 }
1325 1328
1326 1329
1327 /* remove the buddies for the account we just destroyed */ 1330 /* remove the buddies for the account we just destroyed */
1328 while(grps) { 1331 while(grps1) {
1329 struct group *g = grps->data; 1332 struct group *g = grps1->data;
1330 grps = grps->next; 1333 GSList *buds1, *buds = gaim_blist_members(g);
1331 buds = g->members; 1334 buds1 = buds;
1332 while(buds) { 1335 grps1 = grps1->next;
1333 struct buddy *b = buds->data; 1336 while(buds1) {
1334 buds = buds->next; 1337 struct buddy *b = buds1->data;
1338 buds1 = buds1->next;
1335 if(b->account == account) { 1339 if(b->account == account) {
1336 /* sigh, someday we'll get a central gaim_buddy_free() */ 1340 gaim_blist_remove_buddy(b);
1337 g->members = g_slist_remove(g->members, b);
1338 g_hash_table_destroy(b->settings);
1339 g_free(b);
1340 } 1341 }
1341 } 1342 }
1342 if(!g->members) { 1343 g_slist_free(buds);
1344 if(!((GaimBlistNode*)g)->child) {
1343 gaim_blist_remove_group(g); 1345 gaim_blist_remove_group(g);
1344 } 1346 }
1345 } 1347 }
1348 g_slist_free(grps);
1346 1349
1347 gaim_accounts = g_slist_remove(gaim_accounts, account); 1350 gaim_accounts = g_slist_remove(gaim_accounts, account);
1348 1351
1349 gaim_blist_save(); 1352 gaim_blist_save();
1350 1353
1517 void account_online(struct gaim_connection *gc) 1520 void account_online(struct gaim_connection *gc)
1518 { 1521 {
1519 struct signon_meter *meter = find_signon_meter(gc); 1522 struct signon_meter *meter = find_signon_meter(gc);
1520 GList *wins; 1523 GList *wins;
1521 GtkTreeIter iter; 1524 GtkTreeIter iter;
1522 GSList *grps, *buds; 1525 GSList *grps, *grps1, *buds, *buds1;
1523 GList *add_buds=NULL; 1526 GList *add_buds=NULL;
1524 GList *l; 1527 GList *l;
1525 1528
1526 /* Set the time the account came online */ 1529 /* Set the time the account came online */
1527 time(&gc->login_time); 1530 time(&gc->login_time);
1574 g_free(opt_away_arg); 1577 g_free(opt_away_arg);
1575 opt_away_arg = NULL; 1578 opt_away_arg = NULL;
1576 } 1579 }
1577 1580
1578 /* let the prpl know what buddies we pulled out of the local list */ 1581 /* let the prpl know what buddies we pulled out of the local list */
1579 1582 grps = gaim_blist_groups();
1580 for(grps = groups; grps; grps = grps->next) { 1583 for(grps1 = grps; grps1; grps1 = grps1->next) {
1581 struct group *g = grps->data; 1584 struct group *g = grps1->data;
1582 for(buds = g->members; buds; buds = buds->next) { 1585 buds = gaim_blist_members(g);
1583 struct buddy *b = buds->data; 1586 for(buds1 = buds; buds1; buds1 = buds1->next) {
1587 struct buddy *b = buds1->data;
1584 if(b->account == gc->account) { 1588 if(b->account == gc->account) {
1585 add_buds = g_list_append(add_buds, b->name); 1589 add_buds = g_list_append(add_buds, b->name);
1586 } 1590 }
1587 } 1591 }
1588 } 1592 g_slist_free(buds);
1593 }
1594 g_slist_free(grps);
1589 1595
1590 if(add_buds) { 1596 if(add_buds) {
1591 serv_add_buddies(gc, add_buds); 1597 serv_add_buddies(gc, add_buds);
1592 g_list_free(add_buds); 1598 g_list_free(add_buds);
1593 } 1599 }