changeset 20773:dcb28d9939ee

Keep MsnUser->list_op in sync. Silence compiler warnings about unused vars.
author Carlos Silva <typ0@pidgin.im>
date Thu, 04 Oct 2007 02:34:10 +0000
parents 8e53c75bb87c
children d1e8f4d63f01
files libpurple/protocols/msn/contact.c
diffstat 1 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Thu Oct 04 02:04:38 2007 +0000
+++ b/libpurple/protocols/msn/contact.c	Thu Oct 04 02:34:10 2007 +0000
@@ -1106,7 +1106,6 @@
 	}
 
 	if (state->action & MSN_ADD_BUDDY) {
-		MsnUser *user = msn_userlist_find_user(userlist, state->who);
 
         	if ( !msn_user_is_yahoo(soapconn->session->account, state->who) ) {
 
@@ -1426,6 +1425,7 @@
 	g_return_val_if_fail(soapconn->data_cb != NULL, TRUE);
 	g_return_val_if_fail(soapconn->session != NULL, FALSE);
 	g_return_val_if_fail(soapconn->session->contact != NULL, FALSE);
+	g_return_val_if_fail(soapconn->session->userlist != NULL, FALSE);
 
 	state = (MsnCallbackState *) soapconn->data_cb;
 
@@ -1437,6 +1437,11 @@
 	purple_debug_info("MSN CL", "Contact %s deleted successfully from %s list on server!\n", state->who, MsnMemberRole[state->list_id]);
 
 	if (state->list_id == MSN_LIST_PL) {
+		MsnUser *user = msn_userlist_find_user(soapconn->session->userlist, state->who);
+		
+		if (user != NULL)
+			msn_user_unset_op(user, MSN_LIST_PL_OP);
+
 		msn_add_contact_to_list(soapconn->session->contact, state, state->who, MSN_LIST_RL);
 		return TRUE;
 	}
@@ -1530,6 +1535,8 @@
 	MsnCallbackState *state = NULL;
 
 	g_return_val_if_fail(soapconn->data_cb != NULL, TRUE);
+	g_return_val_if_fail(soapconn->session != NULL, FALSE);
+	g_return_val_if_fail(soapconn->session->userlist != NULL, FALSE);
 
 	state = (MsnCallbackState *) soapconn->data_cb;
 	
@@ -1540,12 +1547,19 @@
 	
 	purple_debug_info("MSN CL", "Contact %s added successfully to %s list on server!\n", state->who, MsnMemberRole[state->list_id]);
 
-	if (state->list_id == MSN_LIST_RL && (state->action & MSN_DENIED_BUDDY) ) {
-		g_return_val_if_fail(soapconn->session != NULL, FALSE);
-		g_return_val_if_fail(soapconn->session->contact != NULL, FALSE);
+	if (state->list_id == MSN_LIST_RL) {
+		MsnUser *user = msn_userlist_find_user(soapconn->session->userlist, state->who);
+		
+		if (user != NULL) {
+			msn_user_set_op(user, MSN_LIST_RL_OP);
+		}
 
-		msn_add_contact_to_list(soapconn->session->contact, NULL, state->who, MSN_LIST_BL);
-		return TRUE;
+		if (state->action & MSN_DENIED_BUDDY) {
+			g_return_val_if_fail(soapconn->session->contact != NULL, FALSE);
+
+			msn_add_contact_to_list(soapconn->session->contact, NULL, state->who, MSN_LIST_BL);
+			return TRUE;
+		}
 	}
 
 	if (state->list_id == MSN_LIST_AL) {