Mercurial > pidgin
changeset 22043:23fef20a0ef2
Use a unique chat id across all sessions for multi-user chats, probably
fixes the chat-reuse issues discussed on devel@pidgin.im. I might test this
some time.
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Tue, 08 Jan 2008 03:46:41 +0000 |
parents | 7553cbc95504 |
children | 4a204ebed41c |
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 |
diffstat | 10 files changed, 34 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Tue Jan 08 03:46:41 2008 +0000 @@ -461,7 +461,7 @@ 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;
--- a/libpurple/protocols/msn/session.c Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msn/session.c Tue Jan 08 03:46:41 2008 +0000 @@ -48,7 +48,6 @@ /*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; }
--- a/libpurple/protocols/msn/session.h Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msn/session.h Tue Jan 08 03:46:41 2008 +0000 @@ -107,8 +107,6 @@ 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;
--- a/libpurple/protocols/msn/switchboard.c Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msn/switchboard.c Tue Jan 08 03:46:41 2008 +0000 @@ -164,6 +164,14 @@ 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 @@ 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,
--- a/libpurple/protocols/msn/switchboard.h Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msn/switchboard.h Tue Jan 08 03:46:41 2008 +0000 @@ -167,6 +167,13 @@ 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.
--- a/libpurple/protocols/msnp9/msn.c Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msnp9/msn.c Tue Jan 08 03:46:41 2008 +0000 @@ -435,7 +435,7 @@ 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;
--- a/libpurple/protocols/msnp9/session.c Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msnp9/session.c Tue Jan 08 03:46:41 2008 +0000 @@ -44,7 +44,6 @@ purple_account_get_username(account), NULL); session->protocol_ver = 9; - session->conv_seq = 1; return session; }
--- a/libpurple/protocols/msnp9/session.h Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msnp9/session.h Tue Jan 08 03:46:41 2008 +0000 @@ -103,8 +103,6 @@ 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;
--- a/libpurple/protocols/msnp9/switchboard.c Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msnp9/switchboard.c Tue Jan 08 03:46:41 2008 +0000 @@ -166,6 +166,14 @@ 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 @@ 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,
--- a/libpurple/protocols/msnp9/switchboard.h Tue Jan 08 03:28:48 2008 +0000 +++ b/libpurple/protocols/msnp9/switchboard.h Tue Jan 08 03:46:41 2008 +0000 @@ -167,6 +167,13 @@ 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.