Mercurial > pidgin
comparison src/protocols/msn/switchboard.c @ 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 | e2e53316a21d |
children | 8523e6797d47 |
comparison
equal
deleted
inserted
replaced
5315:b1c430fbf9d5 | 5316:d5690ed70085 |
---|---|
24 #include "utils.h" | 24 #include "utils.h" |
25 | 25 |
26 static GHashTable *switchboard_commands = NULL; | 26 static GHashTable *switchboard_commands = NULL; |
27 static GHashTable *switchboard_msg_types = NULL; | 27 static GHashTable *switchboard_msg_types = NULL; |
28 | 28 |
29 /************************************************************************** | |
30 * Utility functions | |
31 **************************************************************************/ | |
32 static gboolean | |
33 __send_clientinfo(MsnSwitchBoard *swboard) | |
34 { | |
35 MsnMessage *msg; | |
36 | |
37 msg = msn_message_new(); | |
38 msn_message_set_content_type(msg, "text/x-clientinfo"); | |
39 msn_message_set_charset(msg, NULL); | |
40 msn_message_set_attr(msg, "User-Agent", NULL); | |
41 msn_message_set_body(msg, MSN_CLIENTINFO); | |
42 | |
43 if (!msn_switchboard_send_msg(swboard, msg)) { | |
44 msn_switchboard_destroy(swboard); | |
45 | |
46 msn_message_destroy(msg); | |
47 | |
48 return FALSE; | |
49 } | |
50 | |
51 msn_message_destroy(msg); | |
52 | |
53 return TRUE; | |
54 } | |
29 | 55 |
30 /************************************************************************** | 56 /************************************************************************** |
31 * Catch-all commands | 57 * Catch-all commands |
32 **************************************************************************/ | 58 **************************************************************************/ |
33 static gboolean | 59 static gboolean |
58 MsnSwitchBoard *swboard = servconn->data; | 84 MsnSwitchBoard *swboard = servconn->data; |
59 | 85 |
60 if (swboard->chat != NULL) | 86 if (swboard->chat != NULL) |
61 gaim_chat_add_user(GAIM_CHAT(swboard->chat), gc->username, NULL); | 87 gaim_chat_add_user(GAIM_CHAT(swboard->chat), gc->username, NULL); |
62 | 88 |
63 return TRUE; | 89 return __send_clientinfo(swboard); |
64 } | 90 } |
65 | 91 |
66 static gboolean | 92 static gboolean |
67 __bye_cmd(MsnServConn *servconn, const char *command, const char **params, | 93 __bye_cmd(MsnServConn *servconn, const char *command, const char **params, |
68 size_t param_count) | 94 size_t param_count) |
157 | 183 |
158 return FALSE; | 184 return FALSE; |
159 } | 185 } |
160 } | 186 } |
161 | 187 |
162 return TRUE; | 188 return __send_clientinfo(swboard); |
163 } | 189 } |
164 | 190 |
165 static gboolean | 191 static gboolean |
166 __msg_cmd(MsnServConn *servconn, const char *command, const char **params, | 192 __msg_cmd(MsnServConn *servconn, const char *command, const char **params, |
167 size_t param_count) | 193 size_t param_count) |
271 (value = msn_message_get_attr(msg, "TypingUser")) != NULL) { | 297 (value = msn_message_get_attr(msg, "TypingUser")) != NULL) { |
272 | 298 |
273 serv_got_typing(gc, servconn->msg_passport, MSN_TYPING_RECV_TIMEOUT, | 299 serv_got_typing(gc, servconn->msg_passport, MSN_TYPING_RECV_TIMEOUT, |
274 TYPING); | 300 TYPING); |
275 } | 301 } |
302 | |
303 return TRUE; | |
304 } | |
305 | |
306 static gboolean | |
307 __clientinfo_msg(MsnServConn *servconn, const MsnMessage *msg) | |
308 { | |
309 MsnSession *session = servconn->session; | |
310 MsnUser *user; | |
311 GHashTable *clientinfo; | |
312 | |
313 user = msn_user_new(session, servconn->msg_passport, NULL); | |
314 | |
315 clientinfo = msn_message_get_hashtable_from_body(msg); | |
276 | 316 |
277 return TRUE; | 317 return TRUE; |
278 } | 318 } |
279 | 319 |
280 /************************************************************************** | 320 /************************************************************************** |
362 | 402 |
363 /* Register the message type callbacks. */ | 403 /* Register the message type callbacks. */ |
364 msn_servconn_register_msg_type(servconn, "text/plain", __plain_msg); | 404 msn_servconn_register_msg_type(servconn, "text/plain", __plain_msg); |
365 msn_servconn_register_msg_type(servconn, "text/x-msmsgscontrol", | 405 msn_servconn_register_msg_type(servconn, "text/x-msmsgscontrol", |
366 __control_msg); | 406 __control_msg); |
407 msn_servconn_register_msg_type(servconn, "text/x-clientinfo", | |
408 __clientinfo_msg); | |
367 | 409 |
368 /* Save these for future use. */ | 410 /* Save these for future use. */ |
369 switchboard_commands = servconn->commands; | 411 switchboard_commands = servconn->commands; |
370 switchboard_msg_types = servconn->msg_types; | 412 switchboard_msg_types = servconn->msg_types; |
371 } | 413 } |