Mercurial > pidgin
comparison src/protocols/novell/novell.c @ 9360:d77537e8bfe5
[gaim-migrate @ 10168]
" This patch fixes contact list sync problem, fixes a
memory leak, and includes some code cleanup." --Mike Stoddard of Novell
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 23 Jun 2004 17:27:56 +0000 |
parents | b3bda982996b |
children | 670daf18649b |
comparison
equal
deleted
inserted
replaced
9359:43741d8f76f7 | 9360:d77537e8bfe5 |
---|---|
99 | 99 |
100 if (alias) | 100 if (alias) |
101 gaim_account_set_alias(user->client_data, alias); | 101 gaim_account_set_alias(user->client_data, alias); |
102 } | 102 } |
103 | 103 |
104 _sync_contact_list(user); | |
105 | |
106 /* Tell Gaim that we are connected */ | 104 /* Tell Gaim that we are connected */ |
107 gaim_connection_set_state(gc, GAIM_CONNECTED); | 105 gaim_connection_set_state(gc, GAIM_CONNECTED); |
108 serv_finish_login(gc); | 106 serv_finish_login(gc); |
107 | |
108 _sync_contact_list(user); | |
109 | 109 |
110 rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, | 110 rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, |
111 NULL); | 111 NULL); |
112 _check_for_disconnect(user, rc); | 112 _check_for_disconnect(user, rc); |
113 | 113 |
1314 * from the server side list that are not in | 1314 * from the server side list that are not in |
1315 * the local list | 1315 * the local list |
1316 */ | 1316 */ |
1317 _remove_gaim_buddies(user); | 1317 _remove_gaim_buddies(user); |
1318 _add_gaim_buddies(user); | 1318 _add_gaim_buddies(user); |
1319 user->clist_synched = TRUE; | |
1319 } | 1320 } |
1320 | 1321 |
1321 static void | 1322 static void |
1322 _sync_privacy_lists(NMUser *user) | 1323 _sync_privacy_lists(NMUser *user) |
1323 { | 1324 { |
2443 | 2444 |
2444 user = (NMUser *) gc->proto_data; | 2445 user = (NMUser *) gc->proto_data; |
2445 if (user == NULL) | 2446 if (user == NULL) |
2446 return; | 2447 return; |
2447 | 2448 |
2449 /* If we haven't synched the contact list yet, ignore | |
2450 * the add_buddy calls. Server side list is the master. | |
2451 */ | |
2452 if (!user->clist_synched) | |
2453 return; | |
2454 | |
2448 contact = nm_create_contact(); | 2455 contact = nm_create_contact(); |
2449 nm_contact_set_dn(contact, buddy->name); | 2456 nm_contact_set_dn(contact, buddy->name); |
2450 | 2457 |
2451 /* Remove the GaimBuddy (we will add it back after adding it | 2458 /* Remove the GaimBuddy (we will add it back after adding it |
2452 * to the server side list). Save the alias if there is one. | 2459 * to the server side list). Save the alias if there is one. |
2475 _check_for_disconnect(user, rc); | 2482 _check_for_disconnect(user, rc); |
2476 | 2483 |
2477 } | 2484 } |
2478 | 2485 |
2479 static void | 2486 static void |
2480 novell_remove_buddy(GaimConnection * gc, GaimBuddy *buddy, GaimGroup *group) | 2487 novell_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
2481 { | 2488 { |
2482 NMContact *contact; | 2489 NMContact *contact; |
2483 NMFolder *folder; | 2490 NMFolder *folder; |
2484 NMUser *user; | 2491 NMUser *user; |
2485 const char *dn; | 2492 const char *dn; |
2488 if (gc == NULL || buddy == NULL || group == NULL) | 2495 if (gc == NULL || buddy == NULL || group == NULL) |
2489 return; | 2496 return; |
2490 | 2497 |
2491 user = (NMUser *) gc->proto_data; | 2498 user = (NMUser *) gc->proto_data; |
2492 if (user && (dn = nm_lookup_dn(user, buddy->name))) { | 2499 if (user && (dn = nm_lookup_dn(user, buddy->name))) { |
2493 | |
2494 folder = nm_find_folder(user, group->name); | 2500 folder = nm_find_folder(user, group->name); |
2495 if (folder) { | 2501 if (folder) { |
2496 contact = nm_folder_find_contact(folder, dn); | 2502 contact = nm_folder_find_contact(folder, dn); |
2497 if (contact) { | 2503 if (contact) { |
2498 | 2504 |