Mercurial > pidgin.yaz
changeset 5316:d5690ed70085
[gaim-migrate @ 5688]
Added experimental support for the text/x-clientinfo content-type being
discussed on the forums at hypothetic.org. It may change, but for now, I
just want to play with it, and I want us to be able to accept the messages.
Ignore what it consists of right now. It'll change.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 06 May 2003 08:54:58 +0000 |
parents | b1c430fbf9d5 |
children | 2b437c18719e |
files | src/protocols/msn/msn.h src/protocols/msn/switchboard.c src/protocols/msn/user.c src/protocols/msn/user.h |
diffstat | 4 files changed, 96 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/msn/msn.h Tue May 06 08:53:52 2003 +0000 +++ b/src/protocols/msn/msn.h Tue May 06 08:54:58 2003 +0000 @@ -71,4 +71,9 @@ #define MSN_FT_GUID "{5D3E02AB-6190-11d3-BBBB-00C04F795683}" +#define MSN_CLIENTINFO \ + "User-Agent: Gaim/" VERSION "\r\n" \ + "Buddy-Icons: 1\r\n" \ + "Logging: 1\r\n" + #endif /* _MSN_H_ */
--- a/src/protocols/msn/switchboard.c Tue May 06 08:53:52 2003 +0000 +++ b/src/protocols/msn/switchboard.c Tue May 06 08:54:58 2003 +0000 @@ -26,6 +26,32 @@ static GHashTable *switchboard_commands = NULL; static GHashTable *switchboard_msg_types = NULL; +/************************************************************************** + * Utility functions + **************************************************************************/ +static gboolean +__send_clientinfo(MsnSwitchBoard *swboard) +{ + MsnMessage *msg; + + msg = msn_message_new(); + msn_message_set_content_type(msg, "text/x-clientinfo"); + msn_message_set_charset(msg, NULL); + msn_message_set_attr(msg, "User-Agent", NULL); + msn_message_set_body(msg, MSN_CLIENTINFO); + + if (!msn_switchboard_send_msg(swboard, msg)) { + msn_switchboard_destroy(swboard); + + msn_message_destroy(msg); + + return FALSE; + } + + msn_message_destroy(msg); + + return TRUE; +} /************************************************************************** * Catch-all commands @@ -60,7 +86,7 @@ if (swboard->chat != NULL) gaim_chat_add_user(GAIM_CHAT(swboard->chat), gc->username, NULL); - return TRUE; + return __send_clientinfo(swboard); } static gboolean @@ -159,7 +185,7 @@ } } - return TRUE; + return __send_clientinfo(swboard); } static gboolean @@ -277,6 +303,20 @@ return TRUE; } +static gboolean +__clientinfo_msg(MsnServConn *servconn, const MsnMessage *msg) +{ + MsnSession *session = servconn->session; + MsnUser *user; + GHashTable *clientinfo; + + user = msn_user_new(session, servconn->msg_passport, NULL); + + clientinfo = msn_message_get_hashtable_from_body(msg); + + return TRUE; +} + /************************************************************************** * Connect stuff **************************************************************************/ @@ -364,6 +404,8 @@ msn_servconn_register_msg_type(servconn, "text/plain", __plain_msg); msn_servconn_register_msg_type(servconn, "text/x-msmsgscontrol", __control_msg); + msn_servconn_register_msg_type(servconn, "text/x-clientinfo", + __clientinfo_msg); /* Save these for future use. */ switchboard_commands = servconn->commands;
--- a/src/protocols/msn/user.c Tue May 06 08:53:52 2003 +0000 +++ b/src/protocols/msn/user.c Tue May 06 08:54:58 2003 +0000 @@ -69,6 +69,9 @@ if (user->session != NULL && user->session->users != NULL) msn_users_remove(user->session->users, user); + if (user->clientinfo != NULL) + g_hash_table_destroy(user->clientinfo); + if (user->passport != NULL) g_free(user->passport); @@ -161,6 +164,26 @@ return user->group_id; } +void +msn_user_set_client_info(MsnUser *user, GHashTable *info) +{ + g_return_if_fail(user != NULL); + g_return_if_fail(info != NULL); + + if (user->clientinfo != NULL) + g_hash_table_destroy(user->clientinfo); + + user->clientinfo = info; +} + +GHashTable * +msn_user_get_client_info(const MsnUser *user) +{ + g_return_val_if_fail(user != NULL, NULL); + + return user->clientinfo; +} + MsnUsers * msn_users_new(void) {
--- a/src/protocols/msn/user.h Tue May 06 08:53:52 2003 +0000 +++ b/src/protocols/msn/user.h Tue May 06 08:54:58 2003 +0000 @@ -32,14 +32,16 @@ */ struct _MsnUser { - MsnSession *session; /**< The MSN session. */ + MsnSession *session; /**< The MSN session. */ + + char *passport; /**< The passport account. */ + char *name; /**< The friendly name. */ - char *passport; /**< The passport account. */ - char *name; /**< The friendly name. */ + int group_id; /**< The group ID. */ - int group_id; /**< The group ID. */ + size_t ref_count; /**< The reference count. */ - size_t ref_count; /**< The reference count. */ + GHashTable *clientinfo; /**< The client information. */ }; /** @@ -141,6 +143,23 @@ int msn_user_get_group_id(const MsnUser *user); /** + * Sets the client information for a user. + * + * @param user The user. + * @param info The client information. + */ +void msn_user_set_client_info(MsnUser *user, GHashTable *info); + +/** + * Returns the client information for a user. + * + * @param user The user. + * + * @return The client information. + */ +GHashTable *msn_user_get_client_info(const MsnUser *user); + +/** * Creates a new MsnUsers structure. * * @return A new MsnUsers structure. @@ -170,7 +189,6 @@ */ void msn_users_remove(MsnUsers *users, MsnUser *user); - /** * Finds a user with the specified passport. *