Revision 1d081159fd893e5a84ee27ec41737372555c1943

nosnilmot at pidgin.im nosnilmot at pidgin.im
Wed Apr 11 01:21:07 EDT 2007


o   -----------------------------------------------------------------
|   Revision: 1d081159fd893e5a84ee27ec41737372555c1943
|   Ancestor: f6e512e9bd214bdc90a365f064c92ae6c3d6004d
|   Author: nosnilmot
|   Date: 2004-12-12T17:37:12
|   Branch: im.pidgin.gaim.oldstatus
|   
|   Modified files:
|           src/protocols/msn/msg.h src/protocols/msn/msn.c
|           src/protocols/msn/slp.h src/protocols/msn/slplink.c
|           src/protocols/msn/switchboard.c
|           src/protocols/msn/switchboard.h
|   
|   ChangeLog: 
|   
|   [gaim-migrate @ 11559]
|   More more MSN bug fixes from Felipe Contreras, and I fixed up the
|   display of messages that failed to send so that it matches what you
|   tried to send and doesn't have kittens with html entities and such.
|   ============================================================
|   --- src/protocols/msn/msg.h	90c23fe3199983035e2b15bd28e5e32ae7138c7b
|   +++ src/protocols/msn/msg.h	8a71fda0ac43d54a648486897fcd3d0e6766aa03
|   @@ -109,13 +109,16 @@ struct _MsnMessage
|    	GHashTable *attr_table;
|    	GList *attr_list;
|    
|   +	gboolean ack_ref;           /**< A flag that states if this message has
|   +								  been ref'ed for using it in a callback. */
|   +
|    	MsnCommand *cmd;
|    	MsnTransaction *trans;
|    
|    	MsnMsgCb ack_cb; /**< The callback to call when we receive an ACK of this
|   -					message. */
|   +					   message. */
|    	MsnMsgCb nak_cb; /**< The callback to call when we receive a NAK of this
|   -					message. */
|   +					   message. */
|    	void *ack_data; /**< The data used by callbacks. */
|    
|    	MsnMsgErrorType error; /**< The error of the message. */
|   ============================================================
|   --- src/protocols/msn/msn.c	c43b6ae3f6f0bc69eb3b1a1ef46fc43fcd46a902
|   +++ src/protocols/msn/msn.c	218370101699e9f598eba8641594534c69adf10b
|   @@ -738,6 +738,7 @@ msn_send_im(GaimConnection *gc, const ch
|    		format = msn_message_get_attr(msg, "X-MMS-IM-Format");
|    		msn_parse_format(format, &pre, &post);
|    		body_str = g_strdup_printf("%s%s%s", pre, body_enc, post);
|   +		g_free(body_enc);
|    		g_free(pre);
|    		g_free(post);
|    
|   @@ -781,6 +782,9 @@ msn_send_typing(GaimConnection *gc, cons
|    	if (swboard->empty)
|    		return 0;
|    
|   +	if (!g_queue_is_empty(swboard->im_queue))
|   +		return 0;
|   +
|    	msg = msn_message_new(MSN_MSG_TYPING);
|    	msn_message_set_content_type(msg, "text/x-msmsgscontrol");
|    	msn_message_set_flag(msg, 'U');
|   @@ -788,17 +792,8 @@ msn_send_typing(GaimConnection *gc, cons
|    						 gaim_account_get_username(account));
|    	msn_message_set_bin_data(msg, "\r\n", 2);
|    
|   -	swboard = msn_session_get_swboard(session, who);
|   +	msn_switchboard_send_msg(swboard, msg);
|    
|   -	if (!g_queue_is_empty(swboard->im_queue) || swboard->empty)
|   -	{
|   -		msn_switchboard_queue_msg(swboard, msg);
|   -	}
|   -	else
|   -	{
|   -		msn_switchboard_send_msg(swboard, msg);
|   -	}
|   -
|    	msn_message_destroy(msg);
|    
|    	return MSN_TYPING_SEND_TIMEOUT;
|   ============================================================
|   --- src/protocols/msn/slp.h	0cbf4f9e6b27d779fce798aa600e906b5d3efd25
|   +++ src/protocols/msn/slp.h	29a70081ea721a05cf79ac8932dc4e72721a2039
|   @@ -24,7 +24,7 @@
|    #ifndef _MSN_SLP_H_
|    #define _MSN_SLP_H_
|    
|   -/* #define MSN_DEBUG_MSG 1 */
|   +#define MSN_DEBUG_MSG 1
|    /* #define MSN_DEBUG_SLPMSG 1 */
|    
|    /* #define MSN_DEBUG_SLP 1 */
|   ============================================================
|   --- src/protocols/msn/slplink.c	24ff05d2c13b92e5585a76b9c0c0eccb6fae5e1e
|   +++ src/protocols/msn/slplink.c	a4b1a2cc8527f507cfccb4831b39d27e2d7ad7d7
|   @@ -209,7 +209,7 @@ msn_slplink_send_msg(MsnSlpLink *slplink
|    			if (slplink->swboard == NULL)
|    				return;
|    
|   -			/* If swboard is destroyed we will too */
|   +			/* If swboard is destroyed we will be too */
|    			slplink->swboard->slplink = slplink;
|    		}
|    
|   ============================================================
|   --- src/protocols/msn/switchboard.c	36740bbefad64dcdedf4e9928b566fab6dd86786
|   +++ src/protocols/msn/switchboard.c	94defc6830a1387307f7d6eab57bfeee40dce8bc
|   @@ -201,6 +201,7 @@ msn_switchboard_add_user(MsnSwitchBoard 
|    
|    	swboard->users = g_list_prepend(swboard->users, g_strdup(user));
|    	swboard->current_users++;
|   +	swboard->empty = FALSE;
|    
|    	/* gaim_debug_info("msn", "user=[%s], total=%d\n", user,
|    	 * swboard->current_users); */
|   @@ -274,7 +275,7 @@ msn_switchboard_get_conv(MsnSwitchBoard 
|    	if (swboard->conv != NULL)
|    		return swboard->conv;
|    
|   -	gaim_debug_error("msn", "Switchboard with unnasigned conversation\n");
|   +	gaim_debug_error("msn", "Switchboard with unassigned conversation\n");
|    
|    	account = swboard->session->account;
|    
|   @@ -337,8 +338,8 @@ msg_error_helper(MsnCmdProc *cmdproc, Ms
|    	if (msg->type == MSN_MSG_TEXT)
|    	{
|    		MsnSwitchBoard *swboard;
|   -		char *body;
|   -		char *report;
|   +		const char *format;
|   +		char *body_str, *body_enc, *pre, *post;
|    		char *str_reason;
|    
|    		swboard = cmdproc->servconn->data;
|   @@ -346,61 +347,68 @@ msg_error_helper(MsnCmdProc *cmdproc, Ms
|    #if 0
|    		if (swboard->conv == NULL)
|    		{
|   -			msn_message_unref(msg);
|   +			if (msg->ack_ref)
|   +				 msn_message_unref(msg);
|   +
|    			return;
|    		}
|    #endif
|    
|   -		if (msg->error == MSN_MSG_ERROR_TIMEOUT)
|   +		if (error == MSN_MSG_ERROR_TIMEOUT)
|    		{
|    			str_reason = _("Message may have not been sent "
|   -						   "because a time out occured.");
|   +						   "because a time out occured:");
|    		}
|   -		else if (msg->error == MSN_MSG_ERROR_SB)
|   +		else if (error == MSN_MSG_ERROR_SB)
|    		{
|    			switch (swboard->error)
|    			{
|    				case MSN_SB_ERROR_OFFLINE:
|    					str_reason = _("Message could not be sent, "
|   -								   "not allowed while invisible");
|   +								   "not allowed while invisible:");
|    					break;
|    				case MSN_SB_ERROR_USER_OFFLINE:
|    					str_reason = _("Message could not be sent "
|   -								   "because the user is offline");
|   +								   "because the user is offline:");
|    					break;
|    				case MSN_SB_ERROR_CONNECTION:
|    					str_reason = _("Message could not be sent "
|   -								   "because a connection error occured");
|   +								   "because a connection error occured:");
|    					break;
|    				default:
|    					str_reason = _("Message could not be sent "
|    								   "because an error with "
|   -								   "the switchboard occured");
|   +								   "the switchboard occured:");
|    					break;
|    			}
|    		}
|    		else
|    		{
|    			str_reason = _("Message may have not been sent "
|   -						   "because an unkwown error occured");
|   +						   "because an unkwown error occured:");
|    		}
|    
|   -		body = msn_message_to_string(msg);
|   -		report = g_strdup_printf(_("%s:\n%s"), str_reason, body);
|   +		body_str = msn_message_to_string(msg);
|   +		body_enc = gaim_escape_html(body_str);
|   +		g_free(body_str);
|    
|   -		msn_switchboard_report_user(cmdproc->servconn->data,
|   -									GAIM_MESSAGE_ERROR, report);
|   +		format = msn_message_get_attr(msg, "X-MMS-IM-Format");
|   +		msn_parse_format(format, &pre, &post);
|   +		body_str = g_strdup_printf("%s%s%s", pre, body_enc, post);
|   +		g_free(body_enc);
|   +		g_free(pre);
|   +		g_free(post);
|    
|   -		g_free(report);
|   -		g_free(body);
|   +		msn_switchboard_report_user(cmdproc->servconn->data,
|   +									GAIM_MESSAGE_ERROR, str_reason);
|   +		msn_switchboard_report_user(cmdproc->servconn->data,
|   +									GAIM_MESSAGE_NO_LOG, body_str);
|    
|   -		msn_message_unref(msg);
|   +		g_free(body_str);
|    	}
|   -	else if (msg->type == MSN_MSG_SLP)
|   -	{
|   -		msn_message_unref(msg);
|   -	}
|    
|   +	if (msg->ack_ref)
|   +		msn_message_unref(msg);
|    }
|    
|    /**************************************************************************
|   @@ -511,8 +519,6 @@ joi_cmd(MsnCmdProc *cmdproc, MsnCommand 
|    
|    	msn_switchboard_add_user(swboard, passport);
|    
|   -	swboard->empty = FALSE;
|   -
|    	msn_switchboard_process_queue(swboard);
|    
|    	send_clientcaps(swboard);
|   @@ -785,11 +791,13 @@ msn_switchboard_send_msg(MsnSwitchBoard 
|    
|    	if (msg->type == MSN_MSG_TEXT)
|    	{
|   +		msg->ack_ref = TRUE;
|    		msn_message_ref(msg);
|    		msn_transaction_set_timeout_cb(trans, msg_timeout);
|    	}
|    	else if (msg->type == MSN_MSG_SLP)
|    	{
|   +		msg->ack_ref = TRUE;
|    		msn_message_ref(msg);
|    		msn_transaction_set_timeout_cb(trans, msg_timeout);
|    #if 0
|   @@ -858,10 +866,10 @@ connect_cb(MsnServConn *servconn)
|    	swboard = servconn->data;
|    	g_return_if_fail(swboard != NULL);
|    
|   -	swboard->empty = FALSE;
|   -
|    	if (msn_switchboard_is_invited(swboard))
|    	{
|   +		swboard->empty = FALSE;
|   +
|    		msn_cmdproc_send(cmdproc, "ANS", "%s %s %s",
|    						 gaim_account_get_username(account),
|    						 swboard->auth_key, swboard->session_id);
|   ============================================================
|   --- src/protocols/msn/switchboard.h	27ed257a35e8bf8fdd816315ef2f387b38bbef41
|   +++ src/protocols/msn/switchboard.h	3a9e6e9b72e641acd053c719ca62c7ed5c992a92
|   @@ -40,12 +40,12 @@ typedef enum
|     */
|    typedef enum
|    {
|   -	MSN_SB_ERROR_NONE, /**< No error */
|   -	MSN_SB_ERROR_CAL, /**< The user could not join (answer the call) */
|   -	MSN_SB_ERROR_OFFLINE, /**< The account is offline */
|   -	MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline */
|   -	MSN_SB_ERROR_CONNECTION, /**< There was a connection error */
|   -	MSN_SB_ERROR_UNKNOWN /**< An unknown error occured */
|   +	MSN_SB_ERROR_NONE, /**< No error. */
|   +	MSN_SB_ERROR_CAL, /**< The user could not join (answer the call). */
|   +	MSN_SB_ERROR_OFFLINE, /**< The account is offline. */
|   +	MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline. */
|   +	MSN_SB_ERROR_CONNECTION, /**< There was a connection error. */
|   +	MSN_SB_ERROR_UNKNOWN /**< An unknown error occured. */
|    
|    } MsnSBErrorType;
|    

To get the patch for this revision, please do this:
mtn log --last 1 --diffs --from 1d081159fd893e5a84ee27ec41737372555c1943


More information about the Commits mailing list