im.pidgin.pidgin: cd2be742f6c45c200000003fc5a6341297bbe857

typ0 at pidgin.im typ0 at pidgin.im
Wed Oct 3 22:46:15 EDT 2007


revision:            cd2be742f6c45c200000003fc5a6341297bbe857
date:                2007-10-04T02:42:15
author:              typ0 at pidgin.im
branch:              im.pidgin.pidgin
changelog:
merge of '701fb7aea7a77b05725227038ec645441c76668c'
     and '82ae4511a5006e8f04cd58e034b718deba69321a'

manifest:
format_version "1"

new_manifest [4dde77e28ee4238293c88d9989c040c05d88996a]

old_revision [701fb7aea7a77b05725227038ec645441c76668c]

patch "libpurple/protocols/msn/contact.c"
 from [a7a995a283fd788e18d72038b7749da91114b3fe]
   to [b8e3ab4b18772d098bd0913589611a1e8b5989a3]

patch "libpurple/protocols/msn/notification.c"
 from [50f4a7162c9ab91d492a768f2621b223281a6728]
   to [69711ff05d72c9f038eebd14827e975eaf245202]

patch "libpurple/protocols/msn/soap.c"
 from [f5a701f14faa491e9afd7c79615398e113d610e7]
   to [1fdfd8ef14b7f47f39a4c4f3df0ee68d74fe69d8]

patch "libpurple/protocols/msn/userlist.c"
 from [9600051ba1cca50d06264efee41da6096b0272af]
   to [a116c7d26beba61c65640a4a2b6a87da8e0376f5]

old_revision [82ae4511a5006e8f04cd58e034b718deba69321a]

patch "libpurple/protocols/msn/command.c"
 from [c254fc39b9eafaf8b9234da61716d44621c66e94]
   to [0fffb877a0b4f19b52625fc3a120bb2fed65817e]

patch "libpurple/protocols/msn/contact.c"
 from [2be23296aca8a7a0ccd7aa62a5bf7be2de322621]
   to [b8e3ab4b18772d098bd0913589611a1e8b5989a3]

patch "libpurple/protocols/msn/nexus.c"
 from [d9fa147a49267475bbbcfad3e859b02cc8f1d8bf]
   to [9bd63395fda2ec18e2fcbcfed61c1376c3d22903]

patch "libpurple/protocols/msn/oim.c"
 from [193865c5c46e2ba14f09d1addfd247c04ded2386]
   to [f9e705bd719c70b2aed9fa8f6644f64a1d417874]

patch "libpurple/protocols/msn/session.c"
 from [f4b8c4e2e4a0aafdcd74c44eb8ed55a7437f5599]
   to [b50e541ab8853cf4e75106f0dad23f776d3b74f7]

patch "libpurple/protocols/msn/soap.c"
 from [44a9818a90a4f96b34676103f52652d38d2f0d9e]
   to [1fdfd8ef14b7f47f39a4c4f3df0ee68d74fe69d8]

patch "libpurple/protocols/msn/soap.h"
 from [77457a117e8c85f3cfa8930c8d4581a3ba586ca7]
   to [9557b05bcf075239f98d97a1a90d2c7469967bd2]

patch "pidgin/plugins/win32/winprefs/gtkappbar.c"
 from [fd5ebb154ecb203e19e9e60b43fecd612a669cc1]
   to [e1276ea68676a28de5d4097d1cdf82ac89a6cb4f]
-------------- next part --------------
#
#
# patch "libpurple/protocols/msn/contact.c"
#  from [a7a995a283fd788e18d72038b7749da91114b3fe]
#    to [b8e3ab4b18772d098bd0913589611a1e8b5989a3]
# 
# patch "libpurple/protocols/msn/notification.c"
#  from [50f4a7162c9ab91d492a768f2621b223281a6728]
#    to [69711ff05d72c9f038eebd14827e975eaf245202]
# 
# patch "libpurple/protocols/msn/soap.c"
#  from [f5a701f14faa491e9afd7c79615398e113d610e7]
#    to [1fdfd8ef14b7f47f39a4c4f3df0ee68d74fe69d8]
# 
# patch "libpurple/protocols/msn/userlist.c"
#  from [9600051ba1cca50d06264efee41da6096b0272af]
#    to [a116c7d26beba61c65640a4a2b6a87da8e0376f5]
#
============================================================
--- libpurple/protocols/msn/contact.c	a7a995a283fd788e18d72038b7749da91114b3fe
+++ libpurple/protocols/msn/contact.c	b8e3ab4b18772d098bd0913589611a1e8b5989a3
@@ -1024,12 +1024,7 @@ msn_add_contact_read_cb(MsnSoapConn *soa
 	user = msn_userlist_find_add_user(userlist, state->who, state->who);
 	msn_user_add_group_id(user, state->guid);
 
-	if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) {
-		msn_del_contact_from_list(soapconn->session->contact, NULL, state->who, MSN_LIST_PL);
-	} else {
-		msn_soap_free_read_buf(soapconn);
-	}
-	
+	msn_soap_free_read_buf(soapconn);
 	msn_callback_state_free(state);
 
 	return TRUE;
@@ -1111,7 +1106,6 @@ msn_add_contact_to_group_read_cb(MsnSoap
 	}
 
 	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) ) {
 
@@ -1119,12 +1113,6 @@ msn_add_contact_to_group_read_cb(MsnSoap
 		                msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL);
 	        }
 	        msn_notification_send_fqy(soapconn->session, state->who);
-
-		if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) {
-			msn_del_contact_from_list(soapconn->session->contact, NULL, state->who, MSN_LIST_PL);
-			msn_callback_state_free(state);
-			return TRUE;
-		}
 	}
 
 	if (state->action & MSN_MOVE_BUDDY) {
@@ -1437,6 +1425,7 @@ msn_del_contact_from_list_read_cb(MsnSoa
 	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;
 
@@ -1448,6 +1437,11 @@ msn_del_contact_from_list_read_cb(MsnSoa
 	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;
 	}
@@ -1541,6 +1535,8 @@ msn_add_contact_to_list_read_cb(MsnSoapC
 	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;
 	
@@ -1551,12 +1547,19 @@ msn_add_contact_to_list_read_cb(MsnSoapC
 	
 	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) {
============================================================
--- libpurple/protocols/msn/notification.c	50f4a7162c9ab91d492a768f2621b223281a6728
+++ libpurple/protocols/msn/notification.c	69711ff05d72c9f038eebd14827e975eaf245202
@@ -1203,8 +1203,6 @@ prp_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	MsnSession *session = cmdproc->session;
 	const char *type, *value, *friendlyname;
 
-	purple_debug_info("MSN Notification", "prp_cmd()\n");
-
 	g_return_if_fail(cmd->param_count >= 3);
 
 	type  = cmd->params[2];
============================================================
--- libpurple/protocols/msn/soap.c	f5a701f14faa491e9afd7c79615398e113d610e7
+++ libpurple/protocols/msn/soap.c	1fdfd8ef14b7f47f39a4c4f3df0ee68d74fe69d8
@@ -764,7 +764,7 @@ void
  * if not connected, Connected first.
  */
 void
-msn_soap_post(MsnSoapConn *soapconn,MsnSoapReq *request)
+msn_soap_post(MsnSoapConn *soapconn, MsnSoapReq *request)
 {
 	MsnSoapReq *head_request;
 
@@ -808,10 +808,15 @@ msn_soap_post(MsnSoapConn *soapconn,MsnS
 			return;
 		}
 
+#ifdef MSN_SOAP_DEBUG
 		purple_debug_info("MSN SOAP", "Currently processing another SOAP request\n");
 	} else {
 		purple_debug_info("MSN SOAP", "No requests left to dispatch\n");
 	}
+#else
+      }
+#endif
+
 }
 
 /*Post the soap request action*/
============================================================
--- libpurple/protocols/msn/userlist.c	9600051ba1cca50d06264efee41da6096b0272af
+++ libpurple/protocols/msn/userlist.c	a116c7d26beba61c65640a4a2b6a87da8e0376f5
@@ -48,13 +48,10 @@ msn_accept_add_cb(gpointer data)
 	{
 		MsnSession *session = pa->gc->proto_data;
 		MsnUserList *userlist = session->userlist;
-		MsnUser *user = msn_userlist_find_add_user(userlist, pa->who, pa->who);
-
-
+		
 		msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_AL);
 
-		if (msn_userlist_user_is_in_list(user, MSN_LIST_FL))
-			msn_del_contact_from_list(session->contact, NULL, pa->who, MSN_LIST_PL);
+		msn_del_contact_from_list(session->contact, NULL, pa->who, MSN_LIST_PL);
 	}
 
 	g_free(pa->who);
-------------- next part --------------
#
#
# patch "libpurple/protocols/msn/command.c"
#  from [c254fc39b9eafaf8b9234da61716d44621c66e94]
#    to [0fffb877a0b4f19b52625fc3a120bb2fed65817e]
# 
# patch "libpurple/protocols/msn/contact.c"
#  from [2be23296aca8a7a0ccd7aa62a5bf7be2de322621]
#    to [b8e3ab4b18772d098bd0913589611a1e8b5989a3]
# 
# patch "libpurple/protocols/msn/nexus.c"
#  from [d9fa147a49267475bbbcfad3e859b02cc8f1d8bf]
#    to [9bd63395fda2ec18e2fcbcfed61c1376c3d22903]
# 
# patch "libpurple/protocols/msn/oim.c"
#  from [193865c5c46e2ba14f09d1addfd247c04ded2386]
#    to [f9e705bd719c70b2aed9fa8f6644f64a1d417874]
# 
# patch "libpurple/protocols/msn/session.c"
#  from [f4b8c4e2e4a0aafdcd74c44eb8ed55a7437f5599]
#    to [b50e541ab8853cf4e75106f0dad23f776d3b74f7]
# 
# patch "libpurple/protocols/msn/soap.c"
#  from [44a9818a90a4f96b34676103f52652d38d2f0d9e]
#    to [1fdfd8ef14b7f47f39a4c4f3df0ee68d74fe69d8]
# 
# patch "libpurple/protocols/msn/soap.h"
#  from [77457a117e8c85f3cfa8930c8d4581a3ba586ca7]
#    to [9557b05bcf075239f98d97a1a90d2c7469967bd2]
# 
# patch "pidgin/plugins/win32/winprefs/gtkappbar.c"
#  from [fd5ebb154ecb203e19e9e60b43fecd612a669cc1]
#    to [e1276ea68676a28de5d4097d1cdf82ac89a6cb4f]
#
============================================================
--- libpurple/protocols/msn/command.c	c254fc39b9eafaf8b9234da61716d44621c66e94
+++ libpurple/protocols/msn/command.c	0fffb877a0b4f19b52625fc3a120bb2fed65817e
@@ -25,9 +25,9 @@ static gboolean
 #include "command.h"
 
 static gboolean
-is_num(char *str)
+is_num(const char *str)
 {
-	char *c;
+	const char *c;
 	for (c = str; *c; c++) {
 		if (!(g_ascii_isdigit(*c)))
 			return FALSE;
@@ -42,9 +42,11 @@ static gboolean
  *  else 		return FALSE
  */
 static gboolean
-msn_check_payload_cmd(char *str)
+msn_check_payload_cmd(const char *str)
 {
-	if( (!strcmp(str,"ADL")) ||
+	g_return_val_if_fail(str != NULL, FALSE);
+
+	if((!strcmp(str,"ADL")) ||
 		(!strcmp(str,"GCF")) ||
 		(!strcmp(str,"SG")) ||
 		(!strcmp(str,"MSG")) ||
@@ -84,16 +86,13 @@ msn_command_from_string(const char *stri
 msn_command_from_string(const char *string)
 {
 	MsnCommand *cmd;
-	char *tmp;
 	char *param_start;
 
 	g_return_val_if_fail(string != NULL, NULL);
 
-	tmp = g_strdup(string);
-	param_start = strchr(tmp, ' ');
-
 	cmd = g_new0(MsnCommand, 1);
-	cmd->command = tmp;
+	cmd->command = g_strdup(string);
+	param_start = strchr(cmd->command, ' ');
 
 	if (param_start)
 	{
============================================================
--- libpurple/protocols/msn/contact.c	2be23296aca8a7a0ccd7aa62a5bf7be2de322621
+++ libpurple/protocols/msn/contact.c	b8e3ab4b18772d098bd0913589611a1e8b5989a3
@@ -1894,7 +1894,7 @@ msn_contact_connect_init(MsnSoapConn *so
 void
 msn_contact_connect_init(MsnSoapConn *soapconn)
 {
-	msn_soap_init(soapconn, MSN_CONTACT_SERVER, 1,
+	msn_soap_init(soapconn, MSN_CONTACT_SERVER, TRUE,
 		      msn_contact_login_connect_cb,
 		      msn_contact_login_error_cb);
 }
============================================================
--- libpurple/protocols/msn/nexus.c	d9fa147a49267475bbbcfad3e859b02cc8f1d8bf
+++ libpurple/protocols/msn/nexus.c	9bd63395fda2ec18e2fcbcfed61c1376c3d22903
@@ -463,6 +463,6 @@ msn_nexus_connect(MsnNexus *nexus)
 msn_nexus_connect(MsnNexus *nexus)
 {
 	/*  Authenticate via Windows Live ID. */
-	msn_soap_init(nexus->soapconn, MSN_TWN_SERVER, 1, nexus_login_connect_cb, nexus_login_error_cb);
+	msn_soap_init(nexus->soapconn, MSN_TWN_SERVER, TRUE, nexus_login_connect_cb, nexus_login_error_cb);
 	msn_soap_connect(nexus->soapconn);
 }
============================================================
--- libpurple/protocols/msn/oim.c	193865c5c46e2ba14f09d1addfd247c04ded2386
+++ libpurple/protocols/msn/oim.c	f9e705bd719c70b2aed9fa8f6644f64a1d417874
@@ -51,10 +51,10 @@ msn_oim_new(MsnSession *session)
 
 	oim = g_new0(MsnOim, 1);
 	oim->session = session;
-	oim->retrieveconn = msn_soap_new(session,oim,1);
+	oim->retrieveconn = msn_soap_new(session, oim, TRUE);
 	
-	oim->oim_list	= NULL;
-	oim->sendconn = msn_soap_new(session,oim,1);
+	oim->oim_list = NULL;
+	oim->sendconn = msn_soap_new(session, oim, TRUE);
 	oim->run_id = rand_guid();
 	oim->challenge = NULL;
 	oim->send_queue = g_queue_new();
@@ -165,70 +165,73 @@ msn_oim_send_process(MsnOim *oim, const 
 msn_oim_send_process(MsnOim *oim, const char *body, int len)
 {
 	xmlnode *responseNode, *bodyNode;
-	xmlnode	*faultNode, *faultCodeNode, *faultstringNode;
+	xmlnode *faultNode = NULL, *faultCodeNode, *faultstringNode;
 	xmlnode *detailNode, *challengeNode;
-	char *faultCodeStr = NULL, *faultstring = NULL;
+	char *fault_code, *fault_text;
 
 	responseNode = xmlnode_from_str(body,len);
+
 	g_return_if_fail(responseNode != NULL);
-	bodyNode = xmlnode_get_child(responseNode,"Body");
-	faultNode = xmlnode_get_child(bodyNode,"Fault");
-	if(faultNode == NULL){
+
+	if ((bodyNode = xmlnode_get_child(responseNode, "Body")))
+		faultNode = xmlnode_get_child(bodyNode, "Fault");
+
+	if (faultNode == NULL) {
 		/*Send OK! return*/
 		MsnOimSendReq *request;
-		
-		purple_debug_info("MSN OIM","send OIM OK!");
+
 		xmlnode_free(responseNode);
 		request = g_queue_pop_head(oim->send_queue);
 		msn_oim_free_send_req(request);
 		/*send next buffered Offline Message*/
 		msn_soap_post(oim->sendconn, NULL);
+
 		return;
 	}
+
 	/*get the challenge,and repost it*/
-	faultCodeNode = xmlnode_get_child(faultNode,"faultcode");
+	if (faultNode)
+		faultCodeNode = xmlnode_get_child(faultNode, "faultcode");
+
 	if(faultCodeNode == NULL){
-		purple_debug_info("MSN OIM","faultcode Node is NULL\n");
-		goto oim_send_process_fail;
+		purple_debug_info("MSN OIM", "No faultcode for failed Offline Message.\n");
+		xmlnode_free(responseNode);
+		return;
 	}
-	faultCodeStr = xmlnode_get_data(faultCodeNode);
-	purple_debug_info("MSN OIM","fault code:{%s}\n",faultCodeStr);
+
+	fault_code = xmlnode_get_data(faultCodeNode);
 #if 0
-	if(!strcmp(faultCodeStr,"q0:AuthenticationFailed")){
+	if(!strcmp(fault_code,"q0:AuthenticationFailed")){
 		/*other Fault Reason?*/
 		goto oim_send_process_fail;
 	}
 #endif
 
-	faultstringNode = xmlnode_get_child(faultNode,"faultstring");
-	faultstring = xmlnode_get_data(faultstringNode);
-	purple_debug_info("MSN OIM","fault string :{%s}\n",faultstring);
+	faultstringNode = xmlnode_get_child(faultNode, "faultstring");
+	fault_text = xmlnode_get_data(faultstringNode);
+	purple_debug_info("MSN OIM", "Error sending Offline Message: %s (%s)\n",
+		fault_text ? fault_text : "(null)", fault_code ? fault_code : "(null)");
 
 	/* lock key fault reason,
 	 * compute the challenge and resend it
 	 */
-	detailNode = xmlnode_get_child(faultNode, "detail");
-	if(detailNode == NULL){
-		goto oim_send_process_fail;
-	}
-	challengeNode = xmlnode_get_child(detailNode,"LockKeyChallenge");
-	if (challengeNode == NULL) {
-		goto oim_send_process_fail;
-	}
+	if ((detailNode = xmlnode_get_child(faultNode, "detail"))
+			&& (challengeNode = xmlnode_get_child(detailNode, "LockKeyChallenge"))) {
+		g_free(oim->challenge);
+		oim->challenge = xmlnode_get_data(challengeNode);
 
-	g_free(oim->challenge);
-	oim->challenge = xmlnode_get_data(challengeNode);
-	purple_debug_info("MSN OIM","lockkey:{%s}\n",oim->challenge);
+		purple_debug_info("MSN OIM", "Retrying Offline IM with lockkey:{%s}\n",
+			oim->challenge ? oim->challenge : "(null)");
 
-	/*repost the send*/
-	purple_debug_info("MSN OIM","prepare to repost the send...\n");
-	msn_oim_send_msg(oim);
+		/*repost the send*/
+		msn_oim_send_msg(oim);
 
-oim_send_process_fail:
-	g_free(faultstring);
-	g_free(faultCodeStr);
+		/* XXX: This needs to give up eventually (1 retry, maybe?) */
+	}
+
+	g_free(fault_text);
+	g_free(fault_code);
 	xmlnode_free(responseNode);
-	return ;
 }
 
 static gboolean
@@ -300,7 +303,7 @@ msn_oim_send_msg(MsnOim *oim)
 		purple_debug_info("MSN OIM","no lock key challenge,wait for SOAP Fault and Resend\n");
 		buf[0]='\0';
 	}
-	purple_debug_info("MSN OIM","get the lock key challenge {%s}\n",buf);	
+	purple_debug_info("MSN OIM","get the lock key challenge {%s}\n",buf);
 
 	msg_body = msn_oim_msg_to_str(oim, oim_request->oim_msg);
 	soap_body = g_strdup_printf(MSN_OIM_SEND_TEMPLATE,
@@ -311,8 +314,8 @@ msn_oim_send_msg(MsnOim *oim)
 					MSNP13_WLM_PRODUCT_ID,
 					buf,
 					oim_request->send_seq,
-					msg_body
-					);
+					msg_body);
+
 	soap_request = msn_soap_request_new(MSN_OIM_SEND_HOST,
 					MSN_OIM_SEND_URL,
 					MSN_OIM_SEND_SOAP_ACTION,
@@ -644,10 +647,8 @@ msn_parse_oim_msg(MsnOim *oim,const char
 		nickname = xmlnode_get_data(nNode);
 		/*receive time*/
 		rtNode = xmlnode_get_child(mNode,"RT");
-		if(rtNode != NULL) {
+		if(rtNode != NULL)
 			rTime = xmlnode_get_data(rtNode);
-			rtNode = NULL;
-		}
 /*		purple_debug_info("MSN OIM","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); */
 
 		oim->oim_list = g_list_append(oim->oim_list,strdup(msgid));
@@ -694,7 +695,7 @@ msn_oim_retrieve_connect_init(MsnSoapCon
 msn_oim_retrieve_connect_init(MsnSoapConn *soapconn)
 {
 	purple_debug_info("MSN OIM","Initializing OIM retrieve connection\n");
-	msn_soap_init(soapconn, MSN_OIM_RETRIEVE_HOST, 1,
+	msn_soap_init(soapconn, MSN_OIM_RETRIEVE_HOST, TRUE,
 		      msn_oim_get_connect_cb,
 		      msn_oim_get_error_cb);
 }
@@ -704,7 +705,7 @@ msn_oim_send_connect_init(MsnSoapConn *s
 msn_oim_send_connect_init(MsnSoapConn *sendconn)
 {
 	purple_debug_info("MSN OIM","Initializing OIM send connection\n");
-	msn_soap_init(sendconn, MSN_OIM_SEND_HOST, 1,
+	msn_soap_init(sendconn, MSN_OIM_SEND_HOST, TRUE,
 		      msn_oim_send_connect_cb,
 		      msn_oim_send_error_cb);
 }
============================================================
--- libpurple/protocols/msn/session.c	f4b8c4e2e4a0aafdcd74c44eb8ed55a7437f5599
+++ libpurple/protocols/msn/session.c	b50e541ab8853cf4e75106f0dad23f776d3b74f7
@@ -130,8 +130,10 @@ msn_session_disconnect(MsnSession *sessi
 msn_session_disconnect(MsnSession *session)
 {
 	g_return_if_fail(session != NULL);
-	g_return_if_fail(session->connected);
 
+	if (!session->connected)
+		return;
+
 	session->connected = FALSE;
 
 	while (session->switches != NULL)
============================================================
--- libpurple/protocols/msn/soap.c	44a9818a90a4f96b34676103f52652d38d2f0d9e
+++ libpurple/protocols/msn/soap.c	1fdfd8ef14b7f47f39a4c4f3df0ee68d74fe69d8
@@ -49,17 +49,16 @@ msn_soap_set_process_step(MsnSoapConn *s
 	soapconn->step = step;
 }
 
-//msn_soap_new(MsnSession *session,gpointer data,int sslconn)
 /*new a soap connection*/
 MsnSoapConn *
-msn_soap_new(MsnSession *session,gpointer data,int sslconn)
+msn_soap_new(MsnSession *session,gpointer data, gboolean ssl)
 {
 	MsnSoapConn *soapconn;
 
 	soapconn = g_new0(MsnSoapConn, 1);
 	soapconn->session = session;
 	soapconn->parent = data;
-	soapconn->ssl_conn = sslconn;
+	soapconn->ssl_conn = ssl;
 
 	soapconn->gsc = NULL;
 	soapconn->input_handler = 0;
@@ -127,7 +126,7 @@ void
 
 /*init the soap connection*/
 void
-msn_soap_init(MsnSoapConn *soapconn,char * host,int ssl,
+msn_soap_init(MsnSoapConn *soapconn,char * host, gboolean ssl,
 				MsnSoapSslConnectCbFunction connect_cb,
 				MsnSoapSslErrorCbFunction error_cb)
 {
============================================================
--- libpurple/protocols/msn/soap.h	77457a117e8c85f3cfa8930c8d4581a3ba586ca7
+++ libpurple/protocols/msn/soap.h	9557b05bcf075239f98d97a1a90d2c7469967bd2
@@ -83,9 +83,9 @@ struct _MsnSoapConn{
 
 	MsnSoapStep step;
 	/*ssl connection?*/
-	guint	ssl_conn;
+	gboolean ssl_conn;
 	/*normal connection*/
-	guint	fd;
+	guint fd;
 	/*SSL connection*/
 	PurpleSslConnection *gsc;
 	/*ssl connection callback*/
@@ -135,13 +135,13 @@ void msn_soap_post_head_request(MsnSoapC
 void msn_soap_post_head_request(MsnSoapConn *soapconn);
 
 /*new a soap conneciton */
-MsnSoapConn *msn_soap_new(MsnSession *session,gpointer data,int sslconn);
+MsnSoapConn *msn_soap_new(MsnSession *session, gpointer data, gboolean ssl);
 
 /*destroy */
 void msn_soap_destroy(MsnSoapConn *soapconn);
 
 /*init a soap conneciton */
-void msn_soap_init(MsnSoapConn *soapconn, char * host, int ssl,
+void msn_soap_init(MsnSoapConn *soapconn, char * host, gboolean ssl,
 		   MsnSoapSslConnectCbFunction connect_cb,
 		   MsnSoapSslErrorCbFunction error_cb);
 void msn_soap_connect(MsnSoapConn *soapconn);
============================================================
--- pidgin/plugins/win32/winprefs/gtkappbar.c	fd5ebb154ecb203e19e9e60b43fecd612a669cc1
+++ pidgin/plugins/win32/winprefs/gtkappbar.c	e1276ea68676a28de5d4097d1cdf82ac89a6cb4f
@@ -352,17 +352,37 @@ static GdkFilterReturn wnd_activate(GtkA
 	}
 	return GDK_FILTER_CONTINUE;
 }
+
+static void show_hide(GtkAppBar *ab, gboolean hide) {
+	purple_debug_info("gtkappbar", "show_hide(%d)\n", hide);
+
+	if (hide) {
+		purple_debug_info("gtkappbar", "hidden\n");
+		gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
+		ab->docked = TRUE;
+		ab->iconized = TRUE;
+	} else {
+		ab->iconized = FALSE;
+		purple_debug_info("gtkappbar", "shown\n");
+		ab->docked = FALSE;
+		gtk_appbar_do_dock(ab, ab->side);
+	}
+
+}
+
 /** Notify the system that the appbar's position has changed */
 static GdkFilterReturn wnd_poschanged(GtkAppBar *ab, GdkXEvent *xevent) {
 	if (ab->registered) {
 		APPBARDATA abd;
 		MSG *msg = (MSG*)xevent;
+
 		purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_poschanged\n");
 
 		abd.hWnd = msg->hwnd;
 		abd.cbSize = sizeof(APPBARDATA);
 
 		SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
+
 	}
 	return GDK_FILTER_CONTINUE;
 }
@@ -382,6 +402,14 @@ static GdkFilterReturn wnd_poschanging(G
                         set_toolbar(msg->hwnd, FALSE);
                 /*return GDK_FILTER_REMOVE;*/
         }
+
+	if (ab->docked) {
+		if (ab->iconized && wpos->flags & SWP_SHOWWINDOW)
+			show_hide(ab, FALSE);
+		else if (!ab->iconized && wpos->flags & SWP_HIDEWINDOW)
+			show_hide(ab, TRUE);
+	}
+
         return GDK_FILTER_CONTINUE;
 }
 
@@ -409,23 +437,17 @@ static GdkFilterReturn wnd_showwindow(Gt
 }
 
 static GdkFilterReturn wnd_showwindow(GtkAppBar *ab, GdkXEvent *xevent) {
-        MSG *msg = (MSG*)xevent;
+	MSG *msg = (MSG*)xevent;
 
-        purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "wnd_showwindow\n");
-        if(msg->wParam && ab->docked) {
-		ab->iconized = FALSE;
-                purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "shown\n");
-                ab->docked = FALSE;
-                gtk_appbar_do_dock(ab, ab->side);
-        }
-        else if(!msg->wParam && ab->docked) {
-                purple_debug(PURPLE_DEBUG_INFO, "gtkappbar", "hidden\n");
-                gtk_appbar_unregister(ab, GDK_WINDOW_HWND(ab->win->window));
-                ab->docked = TRUE;
-		ab->iconized = TRUE;
-        }
-        return GDK_FILTER_CONTINUE;
+	purple_debug_info("gtkappbar", "wnd_showwindow\n");
+	if(msg->wParam && ab->docked) {
+		show_hide(ab, FALSE);
+	} else if(!msg->wParam && ab->docked) {
+		show_hide(ab, TRUE);
+	}
+	return GDK_FILTER_CONTINUE;
 }
+
 /** The window's size has changed */
 static GdkFilterReturn wnd_size(GtkAppBar *ab, GdkXEvent *xevent) {
         MSG *msg = (MSG*)xevent;


More information about the Commits mailing list