comparison src/blist.c @ 11067:2eca9ed49469

[gaim-migrate @ 13048] Modified configure.ac so that it rejects dbus builds with the dbus library older than 0.34 Added a simple object registration system to the dbus implementation so that it is possible to query object properties remotely (eg. give me property "name" of buddy with id = 5). committer: Tailor Script <tailor@pidgin.im>
author Piotr Zielinski <zielaj>
date Thu, 07 Jul 2005 15:43:48 +0000
parents 3428ad6f5049
children 8b346ce5cdb8
comparison
equal deleted inserted replaced
11066:2507d20c3d0b 11067:2eca9ed49469
21 * 21 *
22 */ 22 */
23 #include "internal.h" 23 #include "internal.h"
24 #include "blist.h" 24 #include "blist.h"
25 #include "conversation.h" 25 #include "conversation.h"
26 #include "dbus-maybe.h"
26 #include "debug.h" 27 #include "debug.h"
27 #include "notify.h" 28 #include "notify.h"
28 #include "prefs.h" 29 #include "prefs.h"
29 #include "privacy.h" 30 #include "privacy.h"
30 #include "prpl.h" 31 #include "prpl.h"
1051 ((GaimBlistNode *)chat)->type = GAIM_BLIST_CHAT_NODE; 1052 ((GaimBlistNode *)chat)->type = GAIM_BLIST_CHAT_NODE;
1052 1053
1053 if (ops != NULL && ops->new_node != NULL) 1054 if (ops != NULL && ops->new_node != NULL)
1054 ops->new_node((GaimBlistNode *)chat); 1055 ops->new_node((GaimBlistNode *)chat);
1055 1056
1057 GAIM_DBUS_REGISTER_POINTER(chat, DBUS_POINTER_CHAT);
1056 return chat; 1058 return chat;
1057 } 1059 }
1058 1060
1059 GaimBuddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias) 1061 GaimBuddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias)
1060 { 1062 {
1076 ((GaimBlistNode *)buddy)->type = GAIM_BLIST_BUDDY_NODE; 1078 ((GaimBlistNode *)buddy)->type = GAIM_BLIST_BUDDY_NODE;
1077 1079
1078 if (ops && ops->new_node) 1080 if (ops && ops->new_node)
1079 ops->new_node((GaimBlistNode *)buddy); 1081 ops->new_node((GaimBlistNode *)buddy);
1080 1082
1083 GAIM_DBUS_REGISTER_POINTER(buddy, DBUS_POINTER_BUDDY);
1081 return buddy; 1084 return buddy;
1082 } 1085 }
1083 1086
1084 void 1087 void
1085 gaim_buddy_set_icon(GaimBuddy *buddy, GaimBuddyIcon *icon) 1088 gaim_buddy_set_icon(GaimBuddy *buddy, GaimBuddyIcon *icon)
1344 ((GaimBlistNode *)contact)->type = GAIM_BLIST_CONTACT_NODE; 1347 ((GaimBlistNode *)contact)->type = GAIM_BLIST_CONTACT_NODE;
1345 1348
1346 if (ops && ops->new_node) 1349 if (ops && ops->new_node)
1347 ops->new_node((GaimBlistNode *)contact); 1350 ops->new_node((GaimBlistNode *)contact);
1348 1351
1352 GAIM_DBUS_REGISTER_POINTER(contact, DBUS_POINTER_CONTACT);
1349 return contact; 1353 return contact;
1350 } 1354 }
1351 1355
1352 void gaim_contact_set_alias(GaimContact *contact, const char *alias) 1356 void gaim_contact_set_alias(GaimContact *contact, const char *alias)
1353 { 1357 {
1423 ((GaimBlistNode *)group)->type = GAIM_BLIST_GROUP_NODE; 1427 ((GaimBlistNode *)group)->type = GAIM_BLIST_GROUP_NODE;
1424 1428
1425 if (ops && ops->new_node) 1429 if (ops && ops->new_node)
1426 ops->new_node((GaimBlistNode *)group); 1430 ops->new_node((GaimBlistNode *)group);
1427 1431
1432 GAIM_DBUS_REGISTER_POINTER(group, DBUS_POINTER_GROUP);
1428 return group; 1433 return group;
1429 } 1434 }
1430 1435
1431 void gaim_blist_add_contact(GaimContact *contact, GaimGroup *group, GaimBlistNode *node) 1436 void gaim_blist_add_contact(GaimContact *contact, GaimGroup *group, GaimBlistNode *node)
1432 { 1437 {
1679 if (ops && ops->remove) 1684 if (ops && ops->remove)
1680 ops->remove(gaimbuddylist, node); 1685 ops->remove(gaimbuddylist, node);
1681 1686
1682 /* Delete the node */ 1687 /* Delete the node */
1683 g_hash_table_destroy(contact->node.settings); 1688 g_hash_table_destroy(contact->node.settings);
1689 GAIM_DBUS_UNREGISTER_POINTER(contact);
1684 g_free(contact); 1690 g_free(contact);
1685 } 1691 }
1686 } 1692 }
1687 1693
1688 void gaim_blist_remove_buddy(GaimBuddy *buddy) 1694 void gaim_blist_remove_buddy(GaimBuddy *buddy)
1751 gaim_presence_remove_buddy(buddy->presence, buddy); 1757 gaim_presence_remove_buddy(buddy->presence, buddy);
1752 gaim_presence_destroy(buddy->presence); 1758 gaim_presence_destroy(buddy->presence);
1753 g_free(buddy->name); 1759 g_free(buddy->name);
1754 g_free(buddy->alias); 1760 g_free(buddy->alias);
1755 g_free(buddy->server_alias); 1761 g_free(buddy->server_alias);
1762
1763 GAIM_DBUS_UNREGISTER_POINTER(buddy);
1756 g_free(buddy); 1764 g_free(buddy);
1757 1765
1758 /* If the contact is empty then remove it */ 1766 /* If the contact is empty then remove it */
1759 if (!cnode->child) 1767 if (!cnode->child)
1760 gaim_blist_remove_contact(contact); 1768 gaim_blist_remove_contact(contact);
1795 1803
1796 /* Delete the node */ 1804 /* Delete the node */
1797 g_hash_table_destroy(chat->components); 1805 g_hash_table_destroy(chat->components);
1798 g_hash_table_destroy(chat->node.settings); 1806 g_hash_table_destroy(chat->node.settings);
1799 g_free(chat->alias); 1807 g_free(chat->alias);
1808 GAIM_DBUS_UNREGISTER_POINTER(chat);
1800 g_free(chat); 1809 g_free(chat);
1801 } 1810 }
1802 1811
1803 void gaim_blist_remove_group(GaimGroup *group) 1812 void gaim_blist_remove_group(GaimGroup *group)
1804 { 1813 {
1857 } 1866 }
1858 1867
1859 /* Delete the node */ 1868 /* Delete the node */
1860 g_hash_table_destroy(group->node.settings); 1869 g_hash_table_destroy(group->node.settings);
1861 g_free(group->name); 1870 g_free(group->name);
1871 GAIM_DBUS_UNREGISTER_POINTER(group);
1862 g_free(group); 1872 g_free(group);
1863 } 1873 }
1864 1874
1865 GaimBuddy *gaim_contact_get_priority_buddy(GaimContact *contact) 1875 GaimBuddy *gaim_contact_get_priority_buddy(GaimContact *contact)
1866 { 1876 {