finch/gntblist.c

changeset 41733
a9085b52de8b
parent 41681
52dbe7ad39ce
child 41840
fe350460fb1c
equal deleted inserted replaced
41732:a9223009939a 41733:a9085b52de8b
103 } StatusBoxItem; 103 } StatusBoxItem;
104 104
105 static FinchBuddyList *ggblist; 105 static FinchBuddyList *ggblist;
106 106
107 static void add_buddy(PurpleBuddy *buddy, FinchBuddyList *ggblist); 107 static void add_buddy(PurpleBuddy *buddy, FinchBuddyList *ggblist);
108 static void add_contact(PurpleContact *contact, FinchBuddyList *ggblist); 108 static void add_contact(PurpleMetaContact *contact, FinchBuddyList *ggblist);
109 static void add_group(PurpleGroup *group, FinchBuddyList *ggblist); 109 static void add_group(PurpleGroup *group, FinchBuddyList *ggblist);
110 static void add_chat(PurpleChat *chat, FinchBuddyList *ggblist); 110 static void add_chat(PurpleChat *chat, FinchBuddyList *ggblist);
111 static void add_node(PurpleBlistNode *node, FinchBuddyList *ggblist); 111 static void add_node(PurpleBlistNode *node, FinchBuddyList *ggblist);
112 static void node_update(PurpleBuddyList *list, PurpleBlistNode *node); 112 static void node_update(PurpleBuddyList *list, PurpleBlistNode *node);
113 static void draw_tooltip(FinchBuddyList *ggblist); 113 static void draw_tooltip(FinchBuddyList *ggblist);
159 return TRUE; /* We want to see offline buddies too */ 159 return TRUE; /* We want to see offline buddies too */
160 if (fnode && fnode->signed_timer) 160 if (fnode && fnode->signed_timer)
161 return TRUE; /* Show if the buddy just signed off */ 161 return TRUE; /* Show if the buddy just signed off */
162 if (purple_blist_node_get_bool(node, "show_offline")) 162 if (purple_blist_node_get_bool(node, "show_offline"))
163 return TRUE; 163 return TRUE;
164 } else if (PURPLE_IS_CONTACT(node)) { 164 } else if (PURPLE_IS_META_CONTACT(node)) {
165 PurpleBlistNode *child; 165 PurpleBlistNode *child;
166 for (child = purple_blist_node_get_first_child(node); 166 for (child = purple_blist_node_get_first_child(node);
167 child; child = purple_blist_node_get_sibling_next(child)) { 167 child; child = purple_blist_node_get_sibling_next(child)) {
168 if (default_can_add_node(child)) { 168 if (default_can_add_node(child)) {
169 return TRUE; 169 return TRUE;
195 195
196 static gpointer default_find_parent(PurpleBlistNode *node) 196 static gpointer default_find_parent(PurpleBlistNode *node)
197 { 197 {
198 gpointer ret = NULL; 198 gpointer ret = NULL;
199 199
200 if (PURPLE_IS_BUDDY(node) || PURPLE_IS_CONTACT(node) || PURPLE_IS_CHAT(node)) 200 if (PURPLE_IS_BUDDY(node) || PURPLE_IS_META_CONTACT(node) || PURPLE_IS_CHAT(node))
201 ret = purple_blist_node_get_parent(node); 201 ret = purple_blist_node_get_parent(node);
202 202
203 if (ret) 203 if (ret)
204 add_node(ret, ggblist); 204 add_node(ret, ggblist);
205 205
213 int lastseen = 0; 213 int lastseen = 0;
214 char *title; 214 char *title;
215 215
216 str = g_string_new(""); 216 str = g_string_new("");
217 217
218 if (PURPLE_IS_CONTACT(node)) { 218 if (PURPLE_IS_META_CONTACT(node)) {
219 PurpleBuddy *pr = purple_contact_get_priority_buddy((PurpleContact*)node); 219 PurpleBuddy *pr = purple_meta_contact_get_priority_buddy((PurpleMetaContact*)node);
220 gboolean offline = !PURPLE_BUDDY_IS_ONLINE(pr); 220 gboolean offline = !PURPLE_BUDDY_IS_ONLINE(pr);
221 gboolean showoffline = purple_prefs_get_bool(PREF_ROOT "/showoffline"); 221 gboolean showoffline = purple_prefs_get_bool(PREF_ROOT "/showoffline");
222 const char *name = purple_buddy_get_name(pr); 222 const char *name = purple_buddy_get_name(pr);
223 223
224 title = g_strdup(name); 224 title = g_strdup(name);
327 get_display_color(PurpleBlistNode *node) 327 get_display_color(PurpleBlistNode *node)
328 { 328 {
329 PurpleBuddy *buddy; 329 PurpleBuddy *buddy;
330 int color = 0; 330 int color = 0;
331 331
332 if (PURPLE_IS_CONTACT(node)) 332 if (PURPLE_IS_META_CONTACT(node))
333 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); 333 node = PURPLE_BLIST_NODE(purple_meta_contact_get_priority_buddy(PURPLE_META_CONTACT(node)));
334 if (!PURPLE_IS_BUDDY(node)) 334 if (!PURPLE_IS_BUDDY(node))
335 return 0; 335 return 0;
336 336
337 buddy = (PurpleBuddy*)node; 337 buddy = (PurpleBuddy*)node;
338 if (purple_presence_is_idle(purple_buddy_get_presence(buddy))) { 338 if (purple_presence_is_idle(purple_buddy_get_presence(buddy))) {
358 if (ggblist->tagged && g_list_find(ggblist->tagged, node)) 358 if (ggblist->tagged && g_list_find(ggblist->tagged, node))
359 flag |= GNT_TEXT_FLAG_BOLD; 359 flag |= GNT_TEXT_FLAG_BOLD;
360 360
361 if (fnode && fnode->signed_timer) 361 if (fnode && fnode->signed_timer)
362 flag |= GNT_TEXT_FLAG_BLINK; 362 flag |= GNT_TEXT_FLAG_BLINK;
363 else if (PURPLE_IS_CONTACT(node)) { 363 else if (PURPLE_IS_META_CONTACT(node)) {
364 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); 364 node = PURPLE_BLIST_NODE(purple_meta_contact_get_priority_buddy(PURPLE_META_CONTACT(node)));
365 fnode = g_object_get_data(G_OBJECT(node), UI_DATA); 365 fnode = g_object_get_data(G_OBJECT(node), UI_DATA);
366 if (fnode && fnode->signed_timer) 366 if (fnode && fnode->signed_timer)
367 flag |= GNT_TEXT_FLAG_BLINK; 367 flag |= GNT_TEXT_FLAG_BLINK;
368 } 368 }
369 369
394 return; 394 return;
395 } 395 }
396 396
397 if(PURPLE_IS_BUDDY(node)) { 397 if(PURPLE_IS_BUDDY(node)) {
398 add_buddy((PurpleBuddy*)node, ggblist); 398 add_buddy((PurpleBuddy*)node, ggblist);
399 } else if (PURPLE_IS_CONTACT(node)) { 399 } else if (PURPLE_IS_META_CONTACT(node)) {
400 add_contact((PurpleContact*)node, ggblist); 400 add_contact((PurpleMetaContact*)node, ggblist);
401 } else if (PURPLE_IS_GROUP(node)) { 401 } else if (PURPLE_IS_GROUP(node)) {
402 add_group((PurpleGroup*)node, ggblist); 402 add_group((PurpleGroup*)node, ggblist);
403 } else if (PURPLE_IS_CHAT(node)) { 403 } else if (PURPLE_IS_CHAT(node)) {
404 add_chat((PurpleChat *)node, ggblist); 404 add_chat((PurpleChat *)node, ggblist);
405 } 405 }
484 PurpleBuddy *buddy = (PurpleBuddy*)node; 484 PurpleBuddy *buddy = (PurpleBuddy*)node;
485 add_node((PurpleBlistNode *)buddy, FINCH_BUDDY_LIST(list)); 485 add_node((PurpleBlistNode *)buddy, FINCH_BUDDY_LIST(list));
486 node_update(list, purple_blist_node_get_parent(node)); 486 node_update(list, purple_blist_node_get_parent(node));
487 } else if (PURPLE_IS_CHAT(node)) { 487 } else if (PURPLE_IS_CHAT(node)) {
488 add_node(node, FINCH_BUDDY_LIST(list)); 488 add_node(node, FINCH_BUDDY_LIST(list));
489 } else if (PURPLE_IS_CONTACT(node)) { 489 } else if (PURPLE_IS_META_CONTACT(node)) {
490 if (g_object_get_data(G_OBJECT(node), UI_DATA) == NULL) { 490 if (g_object_get_data(G_OBJECT(node), UI_DATA) == NULL) {
491 /* The core seems to expect the UI to add the buddies. */ 491 /* The core seems to expect the UI to add the buddies. */
492 for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) 492 for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node))
493 add_node(node, FINCH_BUDDY_LIST(list)); 493 add_node(node, FINCH_BUDDY_LIST(list));
494 } 494 }
785 { 785 {
786 static char text[2096]; 786 static char text[2096];
787 char status[8] = " "; 787 char status[8] = " ";
788 const char *name = NULL; 788 const char *name = NULL;
789 789
790 if (PURPLE_IS_CONTACT(node)) 790 if (PURPLE_IS_META_CONTACT(node))
791 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); /* XXX: this can return NULL?! */ 791 node = PURPLE_BLIST_NODE(purple_meta_contact_get_priority_buddy(PURPLE_META_CONTACT(node))); /* XXX: this can return NULL?! */
792 792
793 if (node == NULL) 793 if (node == NULL)
794 return NULL; 794 return NULL;
795 795
796 if (PURPLE_IS_BUDDY(node)) 796 if (PURPLE_IS_BUDDY(node))
856 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), 856 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
857 parent, NULL)); 857 parent, NULL));
858 } 858 }
859 859
860 static void 860 static void
861 add_contact(PurpleContact *contact, FinchBuddyList *ggblist) 861 add_contact(PurpleMetaContact *contact, FinchBuddyList *ggblist)
862 { 862 {
863 gpointer parent; 863 gpointer parent;
864 PurpleBlistNode *node = (PurpleBlistNode*)contact; 864 PurpleBlistNode *node = (PurpleBlistNode*)contact;
865 const char *name; 865 const char *name;
866 866
884 static void 884 static void
885 add_buddy(PurpleBuddy *buddy, FinchBuddyList *ggblist) 885 add_buddy(PurpleBuddy *buddy, FinchBuddyList *ggblist)
886 { 886 {
887 gpointer parent; 887 gpointer parent;
888 PurpleBlistNode *node = (PurpleBlistNode *)buddy; 888 PurpleBlistNode *node = (PurpleBlistNode *)buddy;
889 PurpleContact *contact; 889 PurpleMetaContact *contact;
890 890
891 if(g_object_get_data(G_OBJECT(node), UI_DATA)) { 891 if(g_object_get_data(G_OBJECT(node), UI_DATA)) {
892 return; 892 return;
893 } 893 }
894 894
898 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, 898 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy,
899 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), 899 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
900 parent, NULL)); 900 parent, NULL));
901 901
902 blist_update_row_flags(ggblist, (PurpleBlistNode *)buddy); 902 blist_update_row_flags(ggblist, (PurpleBlistNode *)buddy);
903 if (buddy == purple_contact_get_priority_buddy(contact)) { 903 if (buddy == purple_meta_contact_get_priority_buddy(contact)) {
904 blist_update_row_flags(ggblist, (PurpleBlistNode *)contact); 904 blist_update_row_flags(ggblist, (PurpleBlistNode *)contact);
905 } 905 }
906 } 906 }
907 907
908 static void 908 static void
912 PurpleBlistNode *node = gnt_tree_get_selection_data(tree); 912 PurpleBlistNode *node = gnt_tree_get_selection_data(tree);
913 913
914 if (!node) 914 if (!node)
915 return; 915 return;
916 916
917 if (PURPLE_IS_CONTACT(node)) 917 if (PURPLE_IS_META_CONTACT(node))
918 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); 918 node = PURPLE_BLIST_NODE(purple_meta_contact_get_priority_buddy(PURPLE_META_CONTACT(node)));
919 919
920 if (PURPLE_IS_BUDDY(node)) 920 if (PURPLE_IS_BUDDY(node))
921 { 921 {
922 PurpleBuddy *buddy = (PurpleBuddy *)node; 922 PurpleBuddy *buddy = (PurpleBuddy *)node;
923 PurpleConversation *im; 923 PurpleConversation *im;
1208 } 1208 }
1209 } 1209 }
1210 1210
1211 /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */ 1211 /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */
1212 static void 1212 static void
1213 remove_contact(PurpleContact *contact) 1213 remove_contact(PurpleMetaContact *contact)
1214 { 1214 {
1215 PurpleBlistNode *bnode, *cnode; 1215 PurpleBlistNode *bnode, *cnode;
1216 PurpleGroup *group; 1216 PurpleGroup *group;
1217 1217
1218 cnode = (PurpleBlistNode *)contact; 1218 cnode = (PurpleBlistNode *)contact;
1231 { 1231 {
1232 const char *name = newname; 1232 const char *name = newname;
1233 if (name && !*name) 1233 if (name && !*name)
1234 name = NULL; 1234 name = NULL;
1235 1235
1236 if (PURPLE_IS_CONTACT(node)) { 1236 if (PURPLE_IS_META_CONTACT(node)) {
1237 PurpleContact *contact = (PurpleContact*)node; 1237 PurpleMetaContact *contact = (PurpleMetaContact*)node;
1238 PurpleBuddy *buddy = purple_contact_get_priority_buddy(contact); 1238 PurpleBuddy *buddy = purple_meta_contact_get_priority_buddy(contact);
1239 purple_contact_set_alias(contact, name); 1239 purple_meta_contact_set_alias(contact, name);
1240 purple_buddy_set_local_alias(buddy, name); 1240 purple_buddy_set_local_alias(buddy, name);
1241 purple_serv_alias_buddy(buddy); 1241 purple_serv_alias_buddy(buddy);
1242 } else if (PURPLE_IS_BUDDY(node)) { 1242 } else if (PURPLE_IS_BUDDY(node)) {
1243 purple_buddy_set_local_alias((PurpleBuddy*)node, name); 1243 purple_buddy_set_local_alias((PurpleBuddy*)node, name);
1244 purple_serv_alias_buddy((PurpleBuddy*)node); 1244 purple_serv_alias_buddy((PurpleBuddy*)node);
1255 { 1255 {
1256 const char *name = NULL; 1256 const char *name = NULL;
1257 char *prompt; 1257 char *prompt;
1258 const char *text; 1258 const char *text;
1259 1259
1260 if (PURPLE_IS_CONTACT(node)) 1260 if (PURPLE_IS_META_CONTACT(node))
1261 name = purple_contact_get_alias((PurpleContact*)node); 1261 name = purple_meta_contact_get_alias((PurpleMetaContact*)node);
1262 else if (PURPLE_IS_BUDDY(node)) 1262 else if (PURPLE_IS_BUDDY(node))
1263 name = purple_buddy_get_contact_alias((PurpleBuddy*)node); 1263 name = purple_buddy_get_contact_alias((PurpleBuddy*)node);
1264 else if (PURPLE_IS_CHAT(node)) 1264 else if (PURPLE_IS_CHAT(node))
1265 name = purple_chat_get_name((PurpleChat*)node); 1265 name = purple_chat_get_name((PurpleChat*)node);
1266 else if (PURPLE_IS_GROUP(node)) 1266 else if (PURPLE_IS_GROUP(node))
1286 PurpleBlistNode *cnode, *bnode; 1286 PurpleBlistNode *cnode, *bnode;
1287 1287
1288 cnode = purple_blist_node_get_first_child(((PurpleBlistNode*)group)); 1288 cnode = purple_blist_node_get_first_child(((PurpleBlistNode*)group));
1289 1289
1290 while (cnode) { 1290 while (cnode) {
1291 if (PURPLE_IS_CONTACT(cnode)) { 1291 if (PURPLE_IS_META_CONTACT(cnode)) {
1292 bnode = purple_blist_node_get_first_child(cnode); 1292 bnode = purple_blist_node_get_first_child(cnode);
1293 cnode = purple_blist_node_get_sibling_next(cnode); 1293 cnode = purple_blist_node_get_sibling_next(cnode);
1294 while (bnode) { 1294 while (bnode) {
1295 PurpleBuddy *buddy; 1295 PurpleBuddy *buddy;
1296 if (PURPLE_IS_BUDDY(bnode)) { 1296 if (PURPLE_IS_BUDDY(bnode)) {
1320 } 1320 }
1321 1321
1322 static void 1322 static void
1323 finch_blist_remove_node(PurpleBlistNode *node) 1323 finch_blist_remove_node(PurpleBlistNode *node)
1324 { 1324 {
1325 if (PURPLE_IS_CONTACT(node)) { 1325 if (PURPLE_IS_META_CONTACT(node)) {
1326 remove_contact((PurpleContact*)node); 1326 remove_contact((PurpleMetaContact*)node);
1327 } else if (PURPLE_IS_BUDDY(node)) { 1327 } else if (PURPLE_IS_BUDDY(node)) {
1328 PurpleBuddy *buddy = (PurpleBuddy*)node; 1328 PurpleBuddy *buddy = (PurpleBuddy*)node;
1329 PurpleGroup *group = purple_buddy_get_group(buddy); 1329 PurpleGroup *group = purple_buddy_get_group(buddy);
1330 purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group); 1330 purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group);
1331 purple_blist_remove_buddy(buddy); 1331 purple_blist_remove_buddy(buddy);
1341 { 1341 {
1342 PurpleAccount *account = NULL; 1342 PurpleAccount *account = NULL;
1343 char *primary; 1343 char *primary;
1344 const char *name, *sec = NULL; 1344 const char *name, *sec = NULL;
1345 1345
1346 if (PURPLE_IS_CONTACT(node)) { 1346 if (PURPLE_IS_META_CONTACT(node)) {
1347 PurpleContact *c = (PurpleContact*)node; 1347 PurpleMetaContact *c = (PurpleMetaContact*)node;
1348 name = purple_contact_get_alias(c); 1348 name = purple_meta_contact_get_alias(c);
1349 if (purple_counting_node_get_total_size(PURPLE_COUNTING_NODE(c)) > 1) 1349 if (purple_counting_node_get_total_size(PURPLE_COUNTING_NODE(c)) > 1)
1350 sec = _("Removing this contact will also remove all the buddies in the contact"); 1350 sec = _("Removing this contact will also remove all the buddies in the contact");
1351 } else if (PURPLE_IS_BUDDY(node)) { 1351 } else if (PURPLE_IS_BUDDY(node)) {
1352 name = purple_buddy_get_name((PurpleBuddy*)node); 1352 name = purple_buddy_get_name((PurpleBuddy*)node);
1353 account = purple_buddy_get_account((PurpleBuddy*)node); 1353 account = purple_buddy_get_account((PurpleBuddy*)node);
1382 if (ggblist->tagged && (iter = g_list_find(ggblist->tagged, node)) != NULL) { 1382 if (ggblist->tagged && (iter = g_list_find(ggblist->tagged, node)) != NULL) {
1383 ggblist->tagged = g_list_delete_link(ggblist->tagged, iter); 1383 ggblist->tagged = g_list_delete_link(ggblist->tagged, iter);
1384 } else { 1384 } else {
1385 ggblist->tagged = g_list_prepend(ggblist->tagged, node); 1385 ggblist->tagged = g_list_prepend(ggblist->tagged, node);
1386 } 1386 }
1387 if (PURPLE_IS_CONTACT(node)) 1387 if (PURPLE_IS_META_CONTACT(node))
1388 update_buddy_display(purple_contact_get_priority_buddy(PURPLE_CONTACT(node)), ggblist); 1388 update_buddy_display(purple_meta_contact_get_priority_buddy(PURPLE_META_CONTACT(node)), ggblist);
1389 else if (PURPLE_IS_BUDDY(node)) 1389 else if (PURPLE_IS_BUDDY(node))
1390 update_buddy_display((PurpleBuddy*)node, ggblist); 1390 update_buddy_display((PurpleBuddy*)node, ggblist);
1391 else 1391 else
1392 update_node_display(node, ggblist); 1392 update_node_display(node, ggblist);
1393 } 1393 }
1394 1394
1395 static void 1395 static void
1396 finch_blist_place_tagged(PurpleBlistNode *target) 1396 finch_blist_place_tagged(PurpleBlistNode *target)
1397 { 1397 {
1398 PurpleGroup *tg = NULL; 1398 PurpleGroup *tg = NULL;
1399 PurpleContact *tc = NULL; 1399 PurpleMetaContact *tc = NULL;
1400 1400
1401 if (PURPLE_IS_GROUP(target)) 1401 if (PURPLE_IS_GROUP(target))
1402 tg = (PurpleGroup*)target; 1402 tg = (PurpleGroup*)target;
1403 else if (PURPLE_IS_BUDDY(target)) { 1403 else if (PURPLE_IS_BUDDY(target)) {
1404 tc = (PurpleContact*)purple_blist_node_get_parent(target); 1404 tc = (PurpleMetaContact*)purple_blist_node_get_parent(target);
1405 tg = (PurpleGroup*)purple_blist_node_get_parent((PurpleBlistNode*)tc); 1405 tg = (PurpleGroup*)purple_blist_node_get_parent((PurpleBlistNode*)tc);
1406 } else if (PURPLE_IS_CONTACT(target)) { 1406 } else if (PURPLE_IS_META_CONTACT(target)) {
1407 tc = (PurpleContact *)target; 1407 tc = (PurpleMetaContact *)target;
1408 tg = (PurpleGroup *)purple_blist_node_get_parent(target); 1408 tg = (PurpleGroup *)purple_blist_node_get_parent(target);
1409 } else if (PURPLE_IS_CHAT(target)) { 1409 } else if (PURPLE_IS_CHAT(target)) {
1410 tg = (PurpleGroup*)purple_blist_node_get_parent(target); 1410 tg = (PurpleGroup*)purple_blist_node_get_parent(target);
1411 } else { 1411 } else {
1412 return; 1412 return;
1421 1421
1422 if (PURPLE_IS_GROUP(node)) { 1422 if (PURPLE_IS_GROUP(node)) {
1423 update_node_display(node, ggblist); 1423 update_node_display(node, ggblist);
1424 /* Add the group after the current group */ 1424 /* Add the group after the current group */
1425 purple_blist_add_group((PurpleGroup*)node, (PurpleBlistNode*)tg); 1425 purple_blist_add_group((PurpleGroup*)node, (PurpleBlistNode*)tg);
1426 } else if (PURPLE_IS_CONTACT(node)) { 1426 } else if (PURPLE_IS_META_CONTACT(node)) {
1427 update_buddy_display(purple_contact_get_priority_buddy((PurpleContact*)node), ggblist); 1427 update_buddy_display(purple_meta_contact_get_priority_buddy((PurpleMetaContact*)node), ggblist);
1428 if (PURPLE_BLIST_NODE(tg) == target) { 1428 if (PURPLE_BLIST_NODE(tg) == target) {
1429 /* The target is a group, just add the contact to the group. */ 1429 /* The target is a group, just add the contact to the group. */
1430 purple_blist_add_contact((PurpleContact*)node, tg, NULL); 1430 purple_blist_add_contact((PurpleMetaContact*)node, tg, NULL);
1431 } else if (tc) { 1431 } else if (tc) {
1432 /* The target is either a buddy, or a contact. Merge with that contact. */ 1432 /* The target is either a buddy, or a contact. Merge with that contact. */
1433 purple_contact_merge((PurpleContact*)node, (PurpleBlistNode*)tc); 1433 purple_meta_contact_merge((PurpleMetaContact*)node, (PurpleBlistNode*)tc);
1434 } else { 1434 } else {
1435 /* The target is a chat. Add the contact to the group after this chat. */ 1435 /* The target is a chat. Add the contact to the group after this chat. */
1436 purple_blist_add_contact((PurpleContact*)node, NULL, target); 1436 purple_blist_add_contact((PurpleMetaContact*)node, NULL, target);
1437 } 1437 }
1438 } else if (PURPLE_IS_BUDDY(node)) { 1438 } else if (PURPLE_IS_BUDDY(node)) {
1439 update_buddy_display((PurpleBuddy*)node, ggblist); 1439 update_buddy_display((PurpleBuddy*)node, ggblist);
1440 if (PURPLE_BLIST_NODE(tg) == target) { 1440 if (PURPLE_BLIST_NODE(tg) == target) {
1441 /* The target is a group. Add this buddy in a new contact under this group. */ 1441 /* The target is a group. Add this buddy in a new contact under this group. */
1442 purple_blist_add_buddy((PurpleBuddy*)node, NULL, tg, NULL); 1442 purple_blist_add_buddy((PurpleBuddy*)node, NULL, tg, NULL);
1443 } else if (PURPLE_IS_CONTACT(target)) { 1443 } else if (PURPLE_IS_META_CONTACT(target)) {
1444 /* Add to the contact. */ 1444 /* Add to the contact. */
1445 purple_blist_add_buddy((PurpleBuddy*)node, tc, NULL, NULL); 1445 purple_blist_add_buddy((PurpleBuddy*)node, tc, NULL, NULL);
1446 } else if (PURPLE_IS_BUDDY(target)) { 1446 } else if (PURPLE_IS_BUDDY(target)) {
1447 /* Add to the contact after the selected buddy. */ 1447 /* Add to the contact after the selected buddy. */
1448 purple_blist_add_buddy((PurpleBuddy*)node, NULL, NULL, target); 1448 purple_blist_add_buddy((PurpleBuddy*)node, NULL, NULL, target);
1480 return; 1480 return;
1481 1481
1482 tree = GNT_TREE(ggblist->tree); 1482 tree = GNT_TREE(ggblist->tree);
1483 1483
1484 node = gnt_tree_get_selection_data(tree); 1484 node = gnt_tree_get_selection_data(tree);
1485 if (node && !(PURPLE_IS_BUDDY(node) || PURPLE_IS_CONTACT(node) || 1485 if (node && !(PURPLE_IS_BUDDY(node) || PURPLE_IS_META_CONTACT(node) ||
1486 PURPLE_IS_GROUP(node) || PURPLE_IS_CHAT(node))) 1486 PURPLE_IS_GROUP(node) || PURPLE_IS_CHAT(node)))
1487 return; 1487 return;
1488 1488
1489 if (ggblist->tooltip) 1489 if (ggblist->tooltip)
1490 remove_tooltip(ggblist); 1490 remove_tooltip(ggblist);
1496 g_signal_connect(G_OBJECT(context), "hide", G_CALLBACK(gnt_widget_destroy), NULL); 1496 g_signal_connect(G_OBJECT(context), "hide", G_CALLBACK(gnt_widget_destroy), NULL);
1497 1497
1498 if (!node) { 1498 if (!node) {
1499 create_group_menu(GNT_MENU(context), NULL); 1499 create_group_menu(GNT_MENU(context), NULL);
1500 title = g_strdup(_("Buddy List")); 1500 title = g_strdup(_("Buddy List"));
1501 } else if (PURPLE_IS_CONTACT(node)) { 1501 } else if (PURPLE_IS_META_CONTACT(node)) {
1502 ggblist->cnode = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); 1502 ggblist->cnode = PURPLE_BLIST_NODE(purple_meta_contact_get_priority_buddy(PURPLE_META_CONTACT(node)));
1503 create_buddy_menu(GNT_MENU(context), (PurpleBuddy*)ggblist->cnode); 1503 create_buddy_menu(GNT_MENU(context), (PurpleBuddy*)ggblist->cnode);
1504 title = g_strdup(purple_contact_get_alias((PurpleContact*)node)); 1504 title = g_strdup(purple_meta_contact_get_alias((PurpleMetaContact*)node));
1505 } else if (PURPLE_IS_BUDDY(node)) { 1505 } else if (PURPLE_IS_BUDDY(node)) {
1506 PurpleBuddy *buddy = (PurpleBuddy *)node; 1506 PurpleBuddy *buddy = (PurpleBuddy *)node;
1507 create_buddy_menu(GNT_MENU(context), buddy); 1507 create_buddy_menu(GNT_MENU(context), buddy);
1508 title = g_strdup(purple_buddy_get_name(buddy)); 1508 title = g_strdup(purple_buddy_get_name(buddy));
1509 } else if (PURPLE_IS_CHAT(node)) { 1509 } else if (PURPLE_IS_CHAT(node)) {
1524 PURPLE_IS_GROUP(node) ? _("Rename") : _("Alias"), 1524 PURPLE_IS_GROUP(node) ? _("Rename") : _("Alias"),
1525 G_CALLBACK(finch_blist_rename_node_cb), node); 1525 G_CALLBACK(finch_blist_rename_node_cb), node);
1526 add_custom_action(GNT_MENU(context), _("Remove"), 1526 add_custom_action(GNT_MENU(context), _("Remove"),
1527 G_CALLBACK(finch_blist_remove_node_cb), node); 1527 G_CALLBACK(finch_blist_remove_node_cb), node);
1528 1528
1529 if (ggblist->tagged && (PURPLE_IS_CONTACT(node) 1529 if (ggblist->tagged && (PURPLE_IS_META_CONTACT(node)
1530 || PURPLE_IS_GROUP(node))) { 1530 || PURPLE_IS_GROUP(node))) {
1531 add_custom_action(GNT_MENU(context), _("Place tagged"), 1531 add_custom_action(GNT_MENU(context), _("Place tagged"),
1532 G_CALLBACK(finch_blist_place_tagged), node); 1532 G_CALLBACK(finch_blist_place_tagged), node);
1533 } 1533 }
1534 1534
1535 if (PURPLE_IS_BUDDY(node) || PURPLE_IS_CONTACT(node)) { 1535 if (PURPLE_IS_BUDDY(node) || PURPLE_IS_META_CONTACT(node)) {
1536 add_custom_action(GNT_MENU(context), _("Toggle Tag"), 1536 add_custom_action(GNT_MENU(context), _("Toggle Tag"),
1537 G_CALLBACK(finch_blist_toggle_tag_buddy), node); 1537 G_CALLBACK(finch_blist_toggle_tag_buddy), node);
1538 } 1538 }
1539 } 1539 }
1540 1540
1751 } 1751 }
1752 1752
1753 static void 1753 static void
1754 update_buddy_display(PurpleBuddy *buddy, FinchBuddyList *ggblist) 1754 update_buddy_display(PurpleBuddy *buddy, FinchBuddyList *ggblist)
1755 { 1755 {
1756 PurpleContact *contact; 1756 PurpleMetaContact *contact;
1757 1757
1758 contact = purple_buddy_get_contact(buddy); 1758 contact = purple_buddy_get_contact(buddy);
1759 1759
1760 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((PurpleBlistNode*)buddy)); 1760 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((PurpleBlistNode*)buddy));
1761 gnt_tree_change_text(GNT_TREE(ggblist->tree), contact, 0, get_display_name((PurpleBlistNode*)contact)); 1761 gnt_tree_change_text(GNT_TREE(ggblist->tree), contact, 0, get_display_name((PurpleBlistNode*)contact));
1762 1762
1763 blist_update_row_flags(ggblist, (PurpleBlistNode *)buddy); 1763 blist_update_row_flags(ggblist, (PurpleBlistNode *)buddy);
1764 if (buddy == purple_contact_get_priority_buddy(contact)) 1764 if (buddy == purple_meta_contact_get_priority_buddy(contact))
1765 blist_update_row_flags(ggblist, (PurpleBlistNode *)contact); 1765 blist_update_row_flags(ggblist, (PurpleBlistNode *)contact);
1766 1766
1767 if (ggblist->tnode == (PurpleBlistNode *)buddy) { 1767 if (ggblist->tnode == (PurpleBlistNode *)buddy) {
1768 draw_tooltip(ggblist); 1768 draw_tooltip(ggblist);
1769 } 1769 }
2177 s2 = purple_chat_get_name((PurpleChat*)n2); 2177 s2 = purple_chat_get_name((PurpleChat*)n2);
2178 } else if (PURPLE_IS_BUDDY(n1)) { 2178 } else if (PURPLE_IS_BUDDY(n1)) {
2179 return purple_buddy_presence_compare( 2179 return purple_buddy_presence_compare(
2180 PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(PURPLE_BUDDY(n1))), 2180 PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(PURPLE_BUDDY(n1))),
2181 PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(PURPLE_BUDDY(n2)))); 2181 PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(PURPLE_BUDDY(n2))));
2182 } else if (PURPLE_IS_CONTACT(n1)) { 2182 } else if (PURPLE_IS_META_CONTACT(n1)) {
2183 s1 = purple_contact_get_alias((PurpleContact*)n1); 2183 s1 = purple_meta_contact_get_alias((PurpleMetaContact*)n1);
2184 s2 = purple_contact_get_alias((PurpleContact*)n2); 2184 s2 = purple_meta_contact_get_alias((PurpleMetaContact*)n2);
2185 } else { 2185 } else {
2186 return blist_node_compare_position(n1, n2); 2186 return blist_node_compare_position(n1, n2);
2187 } 2187 }
2188 2188
2189 us1 = g_utf8_strup(s1, -1); 2189 us1 = g_utf8_strup(s1, -1);
2201 int ret; 2201 int ret;
2202 2202
2203 if (G_OBJECT_TYPE(n1) != G_OBJECT_TYPE(n2)) 2203 if (G_OBJECT_TYPE(n1) != G_OBJECT_TYPE(n2))
2204 return blist_node_compare_position(n1, n2); 2204 return blist_node_compare_position(n1, n2);
2205 2205
2206 if (PURPLE_IS_CONTACT(n1)) 2206 if (PURPLE_IS_META_CONTACT(n1))
2207 n1 = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(n1))); 2207 n1 = PURPLE_BLIST_NODE(purple_meta_contact_get_priority_buddy(PURPLE_META_CONTACT(n1)));
2208 if (PURPLE_IS_CONTACT(n2)) 2208 if (PURPLE_IS_META_CONTACT(n2))
2209 n2 = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(n2))); 2209 n2 = PURPLE_BLIST_NODE(purple_meta_contact_get_priority_buddy(PURPLE_META_CONTACT(n2)));
2210 2210
2211 if (PURPLE_IS_BUDDY(n1) && PURPLE_IS_BUDDY(n2)) { 2211 if (PURPLE_IS_BUDDY(n1) && PURPLE_IS_BUDDY(n2)) {
2212 ret = purple_buddy_presence_compare( 2212 ret = purple_buddy_presence_compare(
2213 PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(PURPLE_BUDDY(n1))), 2213 PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(PURPLE_BUDDY(n1))),
2214 PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(PURPLE_BUDDY(n2)))); 2214 PURPLE_BUDDY_PRESENCE(purple_buddy_get_presence(PURPLE_BUDDY(n2))));
2311 2311
2312 if (!ggblist->manager->can_add_node(node)) { 2312 if (!ggblist->manager->can_add_node(node)) {
2313 node_remove(purple_blist_get_default(), node); 2313 node_remove(purple_blist_get_default(), node);
2314 } else { 2314 } else {
2315 update_node_display(node, ggblist); 2315 update_node_display(node, ggblist);
2316 if (purple_blist_node_get_parent(node) && PURPLE_IS_CONTACT(purple_blist_node_get_parent(node))) 2316 if (purple_blist_node_get_parent(node) && PURPLE_IS_META_CONTACT(purple_blist_node_get_parent(node)))
2317 update_node_display(purple_blist_node_get_parent(node), ggblist); 2317 update_node_display(purple_blist_node_get_parent(node), ggblist);
2318 } 2318 }
2319 2319
2320 g_object_unref(node); 2320 g_object_unref(node);
2321 return FALSE; 2321 return FALSE;
2335 } 2335 }
2336 2336
2337 g_object_ref(node); 2337 g_object_ref(node);
2338 fnode->signed_timer = g_timeout_add_seconds(6, (GSourceFunc)buddy_recent_signed_on_off, data); 2338 fnode->signed_timer = g_timeout_add_seconds(6, (GSourceFunc)buddy_recent_signed_on_off, data);
2339 update_node_display(node, ggblist); 2339 update_node_display(node, ggblist);
2340 if (purple_blist_node_get_parent(node) && PURPLE_IS_CONTACT(purple_blist_node_get_parent(node))) 2340 if (purple_blist_node_get_parent(node) && PURPLE_IS_META_CONTACT(purple_blist_node_get_parent(node)))
2341 update_node_display(purple_blist_node_get_parent(node), ggblist); 2341 update_node_display(purple_blist_node_get_parent(node), ggblist);
2342 return FALSE; 2342 return FALSE;
2343 } 2343 }
2344 2344
2345 static void 2345 static void

mercurial