# HG changeset patch # User Stu Tomlinson # Date 1199764001 0 # Node ID 23fef20a0ef2e9724b046dad28dbea39ba3a331a # Parent 7553cbc95504ed91c4538f375bb2fc2baa15e547 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. diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msn/msn.c --- 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; diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msn/session.c --- 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; } diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msn/session.h --- 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; diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msn/switchboard.c --- 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, diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msn/switchboard.h --- 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. diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msnp9/msn.c --- 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; diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msnp9/session.c --- 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; } diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msnp9/session.h --- 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; diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msnp9/switchboard.c --- 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, diff -r 7553cbc95504 -r 23fef20a0ef2 libpurple/protocols/msnp9/switchboard.h --- 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.