Mercurial > pidgin.yaz
comparison libpurple/blist.c @ 27666:a08e84032814
merge of '2348ff22f0ff3453774b8b25b36238465580c609'
and 'e76f11543c2a4aa05bdf584f087cbe3439029661'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 12 Jul 2009 05:43:38 +0000 |
parents | c7812bda30f1 |
children | 36aa9ed8cd39 |
comparison
equal
deleted
inserted
replaced
27186:048bcf41deef | 27666:a08e84032814 |
---|---|
81 char *name; | 81 char *name; |
82 PurpleAccount *account; | 82 PurpleAccount *account; |
83 PurpleBlistNode *group; | 83 PurpleBlistNode *group; |
84 }; | 84 }; |
85 | 85 |
86 /* This function must not use purple_normalize */ | |
86 static guint _purple_blist_hbuddy_hash(struct _purple_hbuddy *hb) | 87 static guint _purple_blist_hbuddy_hash(struct _purple_hbuddy *hb) |
87 { | 88 { |
88 return g_str_hash(hb->name); | 89 return g_str_hash(hb->name); |
89 } | 90 } |
90 | 91 |
92 /* This function must not use purple_normalize */ | |
91 static guint _purple_blist_hbuddy_equal(struct _purple_hbuddy *hb1, struct _purple_hbuddy *hb2) | 93 static guint _purple_blist_hbuddy_equal(struct _purple_hbuddy *hb1, struct _purple_hbuddy *hb2) |
92 { | 94 { |
93 return (purple_strequal(hb1->name, hb2->name) && hb1->account == hb2->account && hb1->group == hb2->group); | 95 return (purple_strequal(hb1->name, hb2->name) && hb1->account == hb2->account && hb1->group == hb2->group); |
94 } | 96 } |
95 | 97 |
1907 } | 1909 } |
1908 | 1910 |
1909 void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node) | 1911 void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node) |
1910 { | 1912 { |
1911 PurpleBlistNode *sourcenode = (PurpleBlistNode*)source; | 1913 PurpleBlistNode *sourcenode = (PurpleBlistNode*)source; |
1912 PurpleBlistNode *targetnode; | |
1913 PurpleBlistNode *prev, *cur, *next; | 1914 PurpleBlistNode *prev, *cur, *next; |
1914 PurpleContact *target; | 1915 PurpleContact *target; |
1915 | 1916 |
1916 g_return_if_fail(source != NULL); | 1917 g_return_if_fail(source != NULL); |
1917 g_return_if_fail(node != NULL); | 1918 g_return_if_fail(node != NULL); |
1927 } | 1928 } |
1928 | 1929 |
1929 if (source == target || !target) | 1930 if (source == target || !target) |
1930 return; | 1931 return; |
1931 | 1932 |
1932 targetnode = (PurpleBlistNode *)target; | |
1933 next = sourcenode->child; | 1933 next = sourcenode->child; |
1934 | 1934 |
1935 while (next) { | 1935 while (next) { |
1936 cur = next; | 1936 cur = next; |
1937 next = cur->next; | 1937 next = cur->next; |
2352 g_return_val_if_fail(purplebuddylist != NULL, NULL); | 2352 g_return_val_if_fail(purplebuddylist != NULL, NULL); |
2353 g_return_val_if_fail(account != NULL, NULL); | 2353 g_return_val_if_fail(account != NULL, NULL); |
2354 g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); | 2354 g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); |
2355 | 2355 |
2356 hb.account = account; | 2356 hb.account = account; |
2357 hb.name = g_strdup(purple_normalize(account, name)); | 2357 hb.name = (gchar *)purple_normalize(account, name); |
2358 | 2358 |
2359 for (group = purplebuddylist->root; group; group = group->next) { | 2359 for (group = purplebuddylist->root; group; group = group->next) { |
2360 hb.group = group; | 2360 hb.group = group; |
2361 if ((buddy = g_hash_table_lookup(purplebuddylist->buddies, &hb))) { | 2361 if ((buddy = g_hash_table_lookup(purplebuddylist->buddies, &hb))) { |
2362 g_free(hb.name); | |
2363 return buddy; | 2362 return buddy; |
2364 } | 2363 } |
2365 } | 2364 } |
2366 g_free(hb.name); | |
2367 | 2365 |
2368 return NULL; | 2366 return NULL; |
2369 } | 2367 } |
2370 | 2368 |
2371 PurpleBuddy *purple_find_buddy_in_group(PurpleAccount *account, const char *name, | 2369 PurpleBuddy *purple_find_buddy_in_group(PurpleAccount *account, const char *name, |
3105 purple_timeout_remove(save_timer); | 3103 purple_timeout_remove(save_timer); |
3106 save_timer = 0; | 3104 save_timer = 0; |
3107 purple_blist_sync(); | 3105 purple_blist_sync(); |
3108 } | 3106 } |
3109 | 3107 |
3108 purple_blist_destroy(); | |
3109 | |
3110 node = purple_blist_get_root(); | 3110 node = purple_blist_get_root(); |
3111 while (node) { | 3111 while (node) { |
3112 next_node = node->next; | 3112 next_node = node->next; |
3113 purple_blist_node_destroy(node); | 3113 purple_blist_node_destroy(node); |
3114 node = next_node; | 3114 node = next_node; |
3115 } | 3115 } |
3116 purplebuddylist->root = NULL; | 3116 purplebuddylist->root = NULL; |
3117 | 3117 |
3118 g_hash_table_destroy(purplebuddylist->buddies); | 3118 g_hash_table_destroy(purplebuddylist->buddies); |
3119 g_hash_table_destroy(buddies_cache); | 3119 g_hash_table_destroy(buddies_cache); |
3120 | 3120 |
3121 PURPLE_DBUS_UNREGISTER_POINTER(purplebuddylist); | |
3122 g_free(purplebuddylist); | |
3123 purplebuddylist = NULL; | |
3124 | |
3121 purple_signals_disconnect_by_handle(purple_blist_get_handle()); | 3125 purple_signals_disconnect_by_handle(purple_blist_get_handle()); |
3122 purple_signals_unregister_by_instance(purple_blist_get_handle()); | 3126 purple_signals_unregister_by_instance(purple_blist_get_handle()); |
3123 } | 3127 } |