im.pidgin.pidgin: 817f52f5f51ef6c9ba6eea39838bbafbcd2c52ed

nosnilmot at pidgin.im nosnilmot at pidgin.im
Mon Jan 7 22:50:38 EST 2008


-----------------------------------------------------------------
Revision: 817f52f5f51ef6c9ba6eea39838bbafbcd2c52ed
Ancestor: 1a2a1878026930df8376ed7eb166d11cd415fa3f
Author: nosnilmot at pidgin.im
Date: 2008-01-08T03:46:41
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/msn/msn.c
        libpurple/protocols/msn/session.c
        libpurple/protocols/msn/session.h
        libpurple/protocols/msn/switchboard.c
        libpurple/protocols/msn/switchboard.h
        libpurple/protocols/msnp9/msn.c
        libpurple/protocols/msnp9/session.c
        libpurple/protocols/msnp9/session.h
        libpurple/protocols/msnp9/switchboard.c
        libpurple/protocols/msnp9/switchboard.h

ChangeLog: 

Use a unique chat id across all sessions for multi-user chats, probably
fixes the chat-reuse issues discussed on devel at pidgin.im. I might test this
some time.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	51607f0cffcd9939617526f95ae2abb9741064ce
+++ libpurple/protocols/msn/msn.c	0cd770aff69ebbc807f60ad0962a08b87afd48fa
@@ -461,7 +461,7 @@ initiate_chat_cb(PurpleBlistNode *node, 
 	msn_switchboard_request_add_user(swboard, buddy->name);
 
 	/* TODO: This might move somewhere else, after USR might be */
-	swboard->chat_id = session->conv_seq++;
+	swboard->chat_id = msn_switchboard_get_chat_id();
 	swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
 	swboard->flag = MSN_SB_FLAG_IM;
 
============================================================
--- libpurple/protocols/msn/session.c	1f88d11f445951bdf327e9a207bf9cf85f0be0d9
+++ libpurple/protocols/msn/session.c	76ab4406cd30437a247d39d760384b8a1a6c2dfe
@@ -48,7 +48,6 @@ msn_session_new(PurpleAccount *account)
 	/*if you want to chat with Yahoo Messenger*/
 	//session->protocol_ver = WLM_YAHOO_PROT_VER;
 	session->protocol_ver = WLM_PROT_VER;
-	session->conv_seq = 1;
 
 	return session;
 }
============================================================
--- libpurple/protocols/msn/session.h	dbf5a728922bddde67ff45b180d025cfd9701c1e
+++ libpurple/protocols/msn/session.h	770d875c62082ed7d95499b84d432d7715fb9db0
@@ -107,8 +107,6 @@ struct _MsnSession
 	GList *directconns; /**< The list of all the directconnections. */
 	GList *slplinks; /**< The list of all the slplinks. */
 
-	int conv_seq; /**< The current conversation sequence number. */
-
 	/*psm info*/
 	char *psm;
 
============================================================
--- libpurple/protocols/msn/switchboard.c	445ad20b38f8d022331249a0f3939530b91183e3
+++ libpurple/protocols/msn/switchboard.c	543cea9bdcf761eb30a64dd16e4f387120b2273c
@@ -164,6 +164,14 @@ msn_switchboard_get_session_id(MsnSwitch
 	return swboard->session_id;
 }
 
+int
+msn_switchboard_get_chat_id(void)
+{
+	static int chat_id = 1;
+
+	return chat_id++;
+}
+
 void
 msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited)
 {
@@ -250,7 +258,7 @@ msn_switchboard_add_user(MsnSwitchBoard 
 				purple_conversation_destroy(swboard->conv);
 #endif
 
-			swboard->chat_id = cmdproc->session->conv_seq++;
+			swboard->chat_id = msn_switchboard_get_chat_id();
 			swboard->flag |= MSN_SB_FLAG_IM;
 			swboard->conv = serv_got_joined_chat(account->gc,
 												 swboard->chat_id,
============================================================
--- libpurple/protocols/msn/switchboard.h	cc95597b760e613460b789d4e0739f291af06c48
+++ libpurple/protocols/msn/switchboard.h	4218bd35472061b8d450b29587d1aba3bc5a733d
@@ -167,6 +167,13 @@ const char *msn_switchboard_get_session_
 const char *msn_switchboard_get_session_id(MsnSwitchBoard *swboard);
 
 /**
+ * Returns the next chat ID for use by a switchboard.
+ *
+ * @return The chat ID.
+ */
+int msn_switchboard_get_chat_id(void);
+
+/**
  * Sets whether or not we were invited to this switchboard.
  *
  * @param swboard The switchboard.
============================================================
--- libpurple/protocols/msnp9/msn.c	bd5f30fcf5fc40abee97ce8f75d41ac953a577ed
+++ libpurple/protocols/msnp9/msn.c	9ce07254a336e843ef7ce2a7139995a99feabb0d
@@ -435,7 +435,7 @@ initiate_chat_cb(PurpleBlistNode *node, 
 	msn_switchboard_request_add_user(swboard, buddy->name);
 
 	/* TODO: This might move somewhere else, after USR might be */
-	swboard->chat_id = session->conv_seq++;
+	swboard->chat_id = msn_switchboard_get_chat_id();
 	swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat");
 	swboard->flag = MSN_SB_FLAG_IM;
 
============================================================
--- libpurple/protocols/msnp9/session.c	94fcebb353868bed5a45c468478dc70b3569e87a
+++ libpurple/protocols/msnp9/session.c	5b560c3e62423275d0119c679eee91fe15bd319e
@@ -44,7 +44,6 @@ msn_session_new(PurpleAccount *account)
 								 purple_account_get_username(account), NULL);
 
 	session->protocol_ver = 9;
-	session->conv_seq = 1;
 
 	return session;
 }
============================================================
--- libpurple/protocols/msnp9/session.h	dfa5899b4e3af635d628382342b68851745022d3
+++ libpurple/protocols/msnp9/session.h	7e85757b79592c5010f7554e3e6190a9b61b45d5
@@ -103,8 +103,6 @@ struct _MsnSession
 	GList *directconns; /**< The list of all the directconnections. */
 	GList *slplinks; /**< The list of all the slplinks. */
 
-	int conv_seq; /**< The current conversation sequence number. */
-
 	struct
 	{
 		char *kv;
============================================================
--- libpurple/protocols/msnp9/switchboard.c	db55194a4bdc9036a8d6afc56f7f1384c786fcec
+++ libpurple/protocols/msnp9/switchboard.c	ceaf6990e754b92635d8e5559629d62e74f12936
@@ -166,6 +166,14 @@ msn_switchboard_get_session_id(MsnSwitch
 	return swboard->session_id;
 }
 
+int
+msn_switchboard_get_chat_id(void)
+{
+	static int chat_id = 1;
+
+	return chat_id++;
+}
+
 void
 msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited)
 {
@@ -252,7 +260,7 @@ msn_switchboard_add_user(MsnSwitchBoard 
 				purple_conversation_destroy(swboard->conv);
 #endif
 
-			swboard->chat_id = cmdproc->session->conv_seq++;
+			swboard->chat_id = msn_switchboard_get_chat_id();
 			swboard->flag |= MSN_SB_FLAG_IM;
 			swboard->conv = serv_got_joined_chat(account->gc,
 												 swboard->chat_id,
============================================================
--- libpurple/protocols/msnp9/switchboard.h	cc95597b760e613460b789d4e0739f291af06c48
+++ libpurple/protocols/msnp9/switchboard.h	4218bd35472061b8d450b29587d1aba3bc5a733d
@@ -167,6 +167,13 @@ const char *msn_switchboard_get_session_
 const char *msn_switchboard_get_session_id(MsnSwitchBoard *swboard);
 
 /**
+ * Returns the next chat ID for use by a switchboard.
+ *
+ * @return The chat ID.
+ */
+int msn_switchboard_get_chat_id(void);
+
+/**
  * Sets whether or not we were invited to this switchboard.
  *
  * @param swboard The switchboard.


More information about the Commits mailing list