diff 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
line wrap: on
line diff
--- a/src/protocols/novell/novell.c	Wed Jun 23 16:58:22 2004 +0000
+++ b/src/protocols/novell/novell.c	Wed Jun 23 17:27:56 2004 +0000
@@ -101,12 +101,12 @@
 				gaim_account_set_alias(user->client_data, alias);
 		}
 
-		_sync_contact_list(user);
-
 		/* Tell Gaim that we are connected */
 		gaim_connection_set_state(gc, GAIM_CONNECTED);
 		serv_finish_login(gc);
 
+		_sync_contact_list(user);
+
 		rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL,
 								NULL);
 		_check_for_disconnect(user, rc);
@@ -1316,6 +1316,7 @@
 	 */
 	_remove_gaim_buddies(user);
 	_add_gaim_buddies(user);
+	user->clist_synched = TRUE;
 }
 
 static void
@@ -2445,6 +2446,12 @@
 	if (user == NULL)
 		return;
 
+	/* If we haven't synched the contact list yet, ignore
+	 * the add_buddy calls. Server side list is the master.
+	 */
+	if (!user->clist_synched)
+		return;
+
 	contact = nm_create_contact();
 	nm_contact_set_dn(contact, buddy->name);
 
@@ -2477,7 +2484,7 @@
 }
 
 static void
-novell_remove_buddy(GaimConnection * gc, GaimBuddy *buddy, GaimGroup *group)
+novell_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group)
 {
 	NMContact *contact;
 	NMFolder *folder;
@@ -2490,7 +2497,6 @@
 
 	user = (NMUser *) gc->proto_data;
 	if (user && (dn = nm_lookup_dn(user, buddy->name))) {
-
 		folder = nm_find_folder(user, group->name);
 		if (folder) {
 			contact = nm_folder_find_contact(folder, dn);