Mercurial > pidgin
annotate libpurple/protocols/msn/msg.c @ 30730:f8ec889c5bce
propagate from branch 'im.pidgin.pidgin' (head f6cdf8776559775f9a4a72563e69741e139518bd)
to branch 'im.pidgin.cpw.qulogic.msnp16' (head ee6655c65ffae7f61734aa5a05267a3f5a4fc0de)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 10 May 2010 23:21:44 +0000 |
parents | c5a7516418c7 0f1df8098d00 |
children | 7fa07adbe482 66e7fe9f7810 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file msg.c Message functions |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15822 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15822
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "msn.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "msg.h" |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
26 #include "msnutils.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 MsnMessage * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 msn_message_new(MsnMsgType type) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 MsnMessage *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 msg = g_new0(MsnMessage, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 msg->type = type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 |
27432
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27431
diff
changeset
|
36 if (purple_debug_is_verbose()) |
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27431
diff
changeset
|
37 purple_debug_info("msn", "message new (%p)(%d)\n", msg, type); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
39 msg->header_table = g_hash_table_new_full(g_str_hash, g_str_equal, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 g_free, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 msn_message_ref(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 return msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 msn_message_destroy(MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 g_return_if_fail(msg != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 if (msg->ref_count > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 msn_message_unref(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 |
27432
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27431
diff
changeset
|
59 if (purple_debug_is_verbose()) |
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27431
diff
changeset
|
60 purple_debug_info("msn", "message destroy (%p)\n", msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 |
20991
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20989
diff
changeset
|
62 g_free(msg->remote_user); |
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20989
diff
changeset
|
63 g_free(msg->body); |
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20989
diff
changeset
|
64 g_free(msg->content_type); |
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20989
diff
changeset
|
65 g_free(msg->charset); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
67 g_hash_table_destroy(msg->header_table); |
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
68 g_list_free(msg->header_list); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 MsnMessage * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 msn_message_ref(MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 msg->ref_count++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
27432
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27431
diff
changeset
|
80 if (purple_debug_is_verbose()) |
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27431
diff
changeset
|
81 purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 return msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 MsnMessage * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 msn_message_unref(MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 g_return_val_if_fail(msg->ref_count > 0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 msg->ref_count--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
27432
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27431
diff
changeset
|
94 if (purple_debug_is_verbose()) |
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27431
diff
changeset
|
95 purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 if (msg->ref_count == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 msn_message_destroy(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 return msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 MsnMessage * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 msn_message_new_plain(const char *message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 MsnMessage *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 char *message_cr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 msg = msn_message_new(MSN_MSG_TEXT); |
24207
fb722b8b4c74
attempts to resend message on switchboard error once, tested by maually
Ka-Hing Cheung <khc@hxbc.us>
parents:
23095
diff
changeset
|
114 msg->retries = 1; |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
115 msn_message_set_header(msg, "User-Agent", PACKAGE_NAME "/" VERSION); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 msn_message_set_content_type(msg, "text/plain"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 msn_message_set_charset(msg, "UTF-8"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 msn_message_set_flag(msg, 'A'); |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
119 msn_message_set_header(msg, "X-MMS-IM-Format", |
25309
b0e069922896
Fixes #7373, the new live messenger client now sends Segoe UI as the default
Ka-Hing Cheung <khc@hxbc.us>
parents:
24728
diff
changeset
|
120 "FN=Segoe%20UI; EF=; CO=0; CS=1;PF=0"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 |
15822 | 122 message_cr = purple_str_add_cr(message); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 msn_message_set_bin_data(msg, message_cr, strlen(message_cr)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 g_free(message_cr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 return msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 MsnMessage * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 msn_message_new_msnslp(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 MsnMessage *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 msg = msn_message_new(MSN_MSG_SLP); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
136 msn_message_set_header(msg, "User-Agent", NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 msg->msnslp_message = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 msn_message_set_flag(msg, 'D'); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 msn_message_set_content_type(msg, "application/x-msnmsgrp2p"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 return msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 MsnMessage * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 msn_message_new_nudge(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 MsnMessage *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 msg = msn_message_new(MSN_MSG_NUDGE); |
23095
56d958e7b7d1
Fix a TODO uncovered by Mark the other day. Instead of using a hacky
Stu Tomlinson <stu@nosnilmot.com>
parents:
23011
diff
changeset
|
152 msn_message_set_content_type(msg, "text/x-msnmsgr-datacast"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 msn_message_set_flag(msg, 'N'); |
23095
56d958e7b7d1
Fix a TODO uncovered by Mark the other day. Instead of using a hacky
Stu Tomlinson <stu@nosnilmot.com>
parents:
23011
diff
changeset
|
154 msn_message_set_bin_data(msg, "ID: 1\r\n", 7); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 return msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 msn_message_parse_slp_body(MsnMessage *msg, const char *body, size_t len) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 MsnSlpHeader header; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 const char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 int body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 tmp = body; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 if (len < sizeof(header)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 g_return_if_reached(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
172 /* Extract the binary SLP header */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 memcpy(&header, tmp, sizeof(header)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 tmp += sizeof(header); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 msg->msnslp_header.id = GUINT32_FROM_LE(header.id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 msg->msnslp_header.length = GUINT32_FROM_LE(header.length); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
186 /* Extract the body */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 body_len = len - (tmp - body); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 /* msg->body_len = msg->msnslp_header.length; */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 if (body_len > 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 msg->body_len = len - (tmp - body); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
192 msg->body = g_malloc(msg->body_len + 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 memcpy(msg->body, tmp, msg->body_len); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
194 msg->body[msg->body_len] = '\0'; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 tmp += body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 msn_message_parse_payload(MsnMessage *msg, |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
201 const char *payload, size_t payload_len, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
202 const char *line_dem,const char *body_dem) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 char *tmp_base, *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 const char *content_type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 char *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 char **elems, **cur, **tokens; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 g_return_if_fail(payload != NULL); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
210 tmp_base = tmp = g_malloc(payload_len + 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 memcpy(tmp_base, payload, payload_len); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
212 tmp_base[payload_len] = '\0'; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
214 /* Find the end of the headers */ |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
215 end = strstr(tmp, body_dem); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 /* TODO? some clients use \r delimiters instead of \r\n, the official client |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 * doesn't send such messages, but does handle receiving them. We'll just |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 * avoid crashing for now */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 if (end == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 g_free(tmp_base); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 g_return_if_reached(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 *end = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
225 /* Split the headers and parse each one */ |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
226 elems = g_strsplit(tmp, line_dem, 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 for (cur = elems; *cur != NULL; cur++) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 const char *key, *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 |
24728
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
231 /* If this line starts with whitespace, it's been folded from the |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
232 previous line and won't have ':'. */ |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
233 if ((**cur == ' ') || (**cur == '\t')) { |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
234 tokens = g_strsplit(g_strchug(*cur), "=\"", 2); |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
235 key = tokens[0]; |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
236 value = tokens[1]; |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
237 |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
238 /* The only one I care about is 'boundary' (which is folded from |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
239 the key 'Content-Type'), so only process that. */ |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
240 if (!strcmp(key, "boundary")) { |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
241 char *end = strchr(value, '\"'); |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
242 *end = '\0'; |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
243 msn_message_set_header(msg, key, value); |
24728
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
244 } |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
245 |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
246 g_strfreev(tokens); |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
247 continue; |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
248 } |
c09a647fd538
When parsing MSN message payload headers, check for folded lines. The only
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24388
diff
changeset
|
249 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 tokens = g_strsplit(*cur, ": ", 2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 key = tokens[0]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 value = tokens[1]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
255 /*if not MIME content ,then return*/ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 if (!strcmp(key, "MIME-Version")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 g_strfreev(tokens); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 if (!strcmp(key, "Content-Type")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 char *charset, *c; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 if ((c = strchr(value, ';')) != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 if ((charset = strchr(c, '=')) != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 charset++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 msn_message_set_charset(msg, charset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 *c = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 msn_message_set_content_type(msg, value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 { |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
281 msn_message_set_header(msg, key, value); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 g_strfreev(tokens); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 g_strfreev(elems); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 /* Proceed to the end of the "\r\n\r\n" */ |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
289 tmp = end + strlen(body_dem); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 /* Now we *should* be at the body. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 content_type = msn_message_get_content_type(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 if (content_type != NULL && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 !strcmp(content_type, "application/x-msnmsgrp2p")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 MsnSlpHeader header; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 MsnSlpFooter footer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 int body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 if (payload_len - (tmp - tmp_base) < sizeof(header)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 g_free(tmp_base); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 g_return_if_reached(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 msg->msnslp_message = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
308 /* Extract the binary SLP header */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 memcpy(&header, tmp, sizeof(header)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 tmp += sizeof(header); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 msg->msnslp_header.id = GUINT32_FROM_LE(header.id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 msg->msnslp_header.length = GUINT32_FROM_LE(header.length); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 body_len = payload_len - (tmp - tmp_base) - sizeof(footer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
324 /* Extract the body */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 if (body_len > 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 msg->body_len = body_len; |
20989
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20935
diff
changeset
|
327 g_free(msg->body); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
328 msg->body = g_malloc(msg->body_len + 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 memcpy(msg->body, tmp, msg->body_len); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
330 msg->body[msg->body_len] = '\0'; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 tmp += body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
334 /* Extract the footer */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 if (body_len >= 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 memcpy(&footer, tmp, sizeof(footer)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 tmp += sizeof(footer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 if (payload_len - (tmp - tmp_base) > 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 msg->body_len = payload_len - (tmp - tmp_base); |
20989
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20935
diff
changeset
|
345 g_free(msg->body); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
346 msg->body = g_malloc(msg->body_len + 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 memcpy(msg->body, tmp, msg->body_len); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
348 msg->body[msg->body_len] = '\0'; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 } |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
350 |
27586
0f48945aa77f
Only fall back to ISO-8859-1 for text/plain messages. This fixes some wrong
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27483
diff
changeset
|
351 if ((!content_type || !strcmp(content_type, "text/plain")) |
0f48945aa77f
Only fall back to ISO-8859-1 for text/plain messages. This fixes some wrong
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27483
diff
changeset
|
352 && msg->charset == NULL) { |
25461
15fc25014ce2
Convert from ISO-8859-1 to UTF-8 if no charset is supplied. This should fix
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25427
diff
changeset
|
353 char *body = g_convert(msg->body, msg->body_len, "UTF-8", |
15fc25014ce2
Convert from ISO-8859-1 to UTF-8 if no charset is supplied. This should fix
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25427
diff
changeset
|
354 "ISO-8859-1", NULL, &msg->body_len, NULL); |
15fc25014ce2
Convert from ISO-8859-1 to UTF-8 if no charset is supplied. This should fix
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25427
diff
changeset
|
355 g_free(msg->body); |
15fc25014ce2
Convert from ISO-8859-1 to UTF-8 if no charset is supplied. This should fix
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25427
diff
changeset
|
356 msg->body = body; |
15fc25014ce2
Convert from ISO-8859-1 to UTF-8 if no charset is supplied. This should fix
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25427
diff
changeset
|
357 msg->charset = g_strdup("UTF-8"); |
15fc25014ce2
Convert from ISO-8859-1 to UTF-8 if no charset is supplied. This should fix
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25427
diff
changeset
|
358 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 g_free(tmp_base); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 MsnMessage * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 MsnMessage *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 g_return_val_if_fail(cmd != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 msg = msn_message_new(MSN_MSG_UNKNOWN); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 msg->remote_user = g_strdup(cmd->params[0]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 /* msg->size = atoi(cmd->params[2]); */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 msg->cmd = cmd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 return msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 MsnSlpHeader header; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 char *tmp, *base; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 const void *body; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 size_t len, body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 len = MSN_BUF_LEN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 base = tmp = g_malloc(len + 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 body = msn_message_get_bin_data(msg, &body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 header.id = GUINT32_TO_LE(msg->msnslp_header.id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 header.length = GUINT32_TO_LE(msg->msnslp_header.length); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 memcpy(tmp, &header, 48); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 tmp += 48; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 if (body != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 memcpy(tmp, body, body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 tmp += body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 if (ret_size != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 *ret_size = tmp - base; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 return base; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 msn_message_gen_payload(MsnMessage *msg, size_t *ret_size) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 char *n, *base, *end; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 int len; |
19732
97559afd70e4
Silence the warning that body_len might be used uninitialized in msn_message_gen_payload().
Evan Schoenberg <evan.s@dreskin.net>
parents:
19681
diff
changeset
|
428 size_t body_len = 0; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 const void *body; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 len = MSN_BUF_LEN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 base = n = end = g_malloc(len + 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 end += len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 /* Standard header. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 if (msg->charset == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 g_snprintf(n, len, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 "MIME-Version: 1.0\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 "Content-Type: %s\r\n", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 msg->content_type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 g_snprintf(n, len, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 "MIME-Version: 1.0\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 "Content-Type: %s; charset=%s\r\n", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 msg->content_type, msg->charset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 n += strlen(n); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
456 for (l = msg->header_list; l != NULL; l = l->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 const char *key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 const char *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 key = l->data; |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
462 value = msn_message_get_header_value(msg, key); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 g_snprintf(n, end - n, "%s: %s\r\n", key, value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 n += strlen(n); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 n += g_strlcpy(n, "\r\n", end - n); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 body = msn_message_get_bin_data(msg, &body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 if (msg->msnslp_message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 MsnSlpHeader header; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 MsnSlpFooter footer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 header.id = GUINT32_TO_LE(msg->msnslp_header.id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 header.length = GUINT32_TO_LE(msg->msnslp_header.length); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 memcpy(n, &header, 48); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 n += 48; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 if (body != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 memcpy(n, body, body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 n += body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 footer.value = GUINT32_TO_BE(msg->msnslp_footer.value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 memcpy(n, &footer, 4); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 n += 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 if (body != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 memcpy(n, body, body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 n += body_len; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
508 *n = '\0'; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 if (ret_size != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 *ret_size = n - base; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 if (*ret_size > 1664) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 *ret_size = 1664; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 return base; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 msn_message_set_flag(MsnMessage *msg, char flag) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 g_return_if_fail(msg != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 g_return_if_fail(flag != 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 msg->flag = flag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 char |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 msn_message_get_flag(const MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 g_return_val_if_fail(msg != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 return msg->flag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 g_return_if_fail(msg != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 /* There is no need to waste memory on data we cannot send anyway */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 if (len > 1664) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 len = 1664; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 if (msg->body != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 g_free(msg->body); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 if (data != NULL && len > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 { |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
554 msg->body = g_malloc(len + 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 memcpy(msg->body, data, len); |
24388
7e8175f9b009
It should be more efficient to just use g_mallc() and then manually
Mark Doliner <mark@kingant.net>
parents:
24207
diff
changeset
|
556 msg->body[len] = '\0'; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 msg->body_len = len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 msg->body = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 msg->body_len = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 const void * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 msn_message_get_bin_data(const MsnMessage *msg, size_t *len) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 if (len) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 *len = msg->body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 return msg->body; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 msn_message_set_content_type(MsnMessage *msg, const char *type) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 g_return_if_fail(msg != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 |
20991
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20989
diff
changeset
|
582 g_free(msg->content_type); |
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20989
diff
changeset
|
583 msg->content_type = g_strdup(type); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 const char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 msn_message_get_content_type(const MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 return msg->content_type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 msn_message_set_charset(MsnMessage *msg, const char *charset) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 g_return_if_fail(msg != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 |
20991
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20989
diff
changeset
|
599 g_free(msg->charset); |
c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20989
diff
changeset
|
600 msg->charset = g_strdup(charset); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 const char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 msn_message_get_charset(const MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 return msg->charset; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 void |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
612 msn_message_set_header(MsnMessage *msg, const char *name, const char *value) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 const char *temp; |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
615 char *new_name; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 g_return_if_fail(msg != NULL); |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
618 g_return_if_fail(name != NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
620 temp = msn_message_get_header_value(msg, name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 if (value == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 if (temp != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
628 for (l = msg->header_list; l != NULL; l = l->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 { |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
630 if (!g_ascii_strcasecmp(l->data, name)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 { |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
632 msg->header_list = g_list_remove(msg->header_list, l->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
638 g_hash_table_remove(msg->header_table, name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
644 new_name = g_strdup(name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
646 g_hash_table_insert(msg->header_table, new_name, g_strdup(value)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 if (temp == NULL) |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
649 msg->header_list = g_list_append(msg->header_list, new_name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 const char * |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
653 msn_message_get_header_value(const MsnMessage *msg, const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 g_return_val_if_fail(msg != NULL, NULL); |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
656 g_return_val_if_fail(name != NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
658 return g_hash_table_lookup(msg->header_table, name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 GHashTable * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 msn_message_get_hashtable_from_body(const MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 GHashTable *table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 size_t body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 const char *body; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 char **elems, **cur, **tokens, *body_str; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 body = msn_message_get_bin_data(msg, &body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 g_return_val_if_fail(body != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 body_str = g_strndup(body, body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 elems = g_strsplit(body_str, "\r\n", 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 g_free(body_str); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 for (cur = elems; *cur != NULL; cur++) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 if (**cur == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 tokens = g_strsplit(*cur, ": ", 2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 |
20935
1d9d5de48b9e
Fix some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20517
diff
changeset
|
688 if (tokens[0] != NULL && tokens[1] != NULL) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 g_hash_table_insert(table, tokens[0], tokens[1]); |
20935
1d9d5de48b9e
Fix some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20517
diff
changeset
|
690 g_free(tokens); |
1d9d5de48b9e
Fix some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20517
diff
changeset
|
691 } else |
1d9d5de48b9e
Fix some leaks.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20517
diff
changeset
|
692 g_strfreev(tokens); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 g_strfreev(elems); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 return table; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 msn_message_to_string(MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 size_t body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 const char *body; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 g_return_val_if_fail(msg != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 g_return_val_if_fail(msg->type == MSN_MSG_TEXT, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 body = msn_message_get_bin_data(msg, &body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 return g_strndup(body, body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 msn_message_show_readable(MsnMessage *msg, const char *info, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 gboolean text_body) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 GString *str; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 size_t body_len; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 const char *body; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 g_return_if_fail(msg != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 str = g_string_new(NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 /* Standard header. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 if (msg->charset == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 g_string_append_printf(str, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 "MIME-Version: 1.0\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 "Content-Type: %s\r\n", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 msg->content_type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 g_string_append_printf(str, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 "MIME-Version: 1.0\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 "Content-Type: %s; charset=%s\r\n", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 msg->content_type, msg->charset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
743 for (l = msg->header_list; l; l = l->next) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 char *key; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 const char *value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 key = l->data; |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
749 value = msn_message_get_header_value(msg, key); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 g_string_append_printf(str, "%s: %s\r\n", key, value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 g_string_append(str, "\r\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 body = msn_message_get_bin_data(msg, &body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 if (msg->msnslp_message) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 g_string_append_printf(str, "Session ID: %u\r\n", msg->msnslp_header.session_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 g_string_append_printf(str, "ID: %u\r\n", msg->msnslp_header.id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 g_string_append_printf(str, "Offset: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.offset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 g_string_append_printf(str, "Total size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.total_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 g_string_append_printf(str, "Length: %u\r\n", msg->msnslp_header.length); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 g_string_append_printf(str, "Flags: 0x%x\r\n", msg->msnslp_header.flags); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 g_string_append_printf(str, "ACK ID: %u\r\n", msg->msnslp_header.ack_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 g_string_append_printf(str, "SUB ID: %u\r\n", msg->msnslp_header.ack_sub_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 g_string_append_printf(str, "ACK Size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.ack_size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 |
27483
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27432
diff
changeset
|
770 if (purple_debug_is_verbose() && body != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 if (text_body) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 g_string_append_len(str, body, body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 if (body[body_len - 1] == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 str->len--; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 g_string_append(str, " 0x00"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 g_string_append(str, "\r\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 for (i = 0; i < msg->body_len; i++) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 g_string_append_printf(str, "%.2hhX ", body[i]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 if ((i % 16) == 15) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 g_string_append(str, "\r\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 g_string_append(str, "\r\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 g_string_append_printf(str, "Footer: %u\r\n", msg->msnslp_footer.value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 if (body != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 g_string_append_len(str, body, body_len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 g_string_append(str, "\r\n"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 |
15822 | 806 purple_debug_info("msn", "Message %s:\n{%s}\n", info, str->str); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 g_string_free(str, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 } |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
810 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
811 /************************************************************************** |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
812 * Message Handlers |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
813 **************************************************************************/ |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
814 void |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
815 msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
816 { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
817 PurpleConnection *gc; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
818 const char *body; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
819 char *body_enc; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
820 char *body_final; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
821 size_t body_len; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
822 const char *passport; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
823 const char *value; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
824 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
825 gc = cmdproc->session->account->gc; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
826 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
827 body = msn_message_get_bin_data(msg, &body_len); |
30699
a786d893df2b
I don't believe there's any reason to duplicate this string.
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
828 body_enc = g_markup_escape_text(body, body_len); |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
829 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
830 passport = msg->remote_user; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
831 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
832 if (!strcmp(passport, "messenger@microsoft.com") && |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
833 strstr(body, "immediate security update")) |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
834 { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
835 return; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
836 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
837 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
838 #if 0 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
839 if ((value = msn_message_get_header_value(msg, "User-Agent")) != NULL) |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
840 { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
841 purple_debug_misc("msn", "User-Agent = '%s'\n", value); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
842 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
843 #endif |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
844 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
845 if ((value = msn_message_get_header_value(msg, "X-MMS-IM-Format")) != NULL) |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
846 { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
847 char *pre, *post; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
848 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
849 msn_parse_format(value, &pre, &post); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
850 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
851 body_final = g_strdup_printf("%s%s%s", pre ? pre : "", |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
852 body_enc ? body_enc : "", post ? post : ""); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
853 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
854 g_free(pre); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
855 g_free(post); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
856 g_free(body_enc); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
857 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
858 else |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
859 { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
860 body_final = body_enc; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
861 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
862 |
25399
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
863 if (cmdproc->servconn->type == MSN_SERVCONN_SB) { |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
864 MsnSwitchBoard *swboard = cmdproc->data; |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
865 |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
866 swboard->flag |= MSN_SB_FLAG_IM; |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
867 |
25399
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
868 if (swboard->current_users > 1 || |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
869 ((swboard->conv != NULL) && |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
870 purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
871 { |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
872 /* If current_users is always ok as it should then there is no need to |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
873 * check if this is a chat. */ |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
874 if (swboard->current_users <= 1) |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
875 purple_debug_misc("msn", "plain_msg: current_users(%d)\n", |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
876 swboard->current_users); |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
877 |
25399
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
878 serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final, |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
879 time(NULL)); |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
880 if (swboard->conv == NULL) |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
881 { |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
882 swboard->conv = purple_find_chat(gc, swboard->chat_id); |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
883 swboard->flag |= MSN_SB_FLAG_IM; |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
884 } |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
885 } |
25399
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
886 else |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
887 { |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
888 serv_got_im(gc, passport, body_final, 0, time(NULL)); |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
889 if (swboard->conv == NULL) |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
890 { |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
891 swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
892 passport, purple_connection_get_account(gc)); |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
893 swboard->flag |= MSN_SB_FLAG_IM; |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
894 } |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
895 } |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
896 |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
897 } else { |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
898 serv_got_im(gc, passport, body_final, 0, time(NULL)); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
899 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
900 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
901 g_free(body_final); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
902 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
903 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
904 void |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
905 msn_control_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
906 { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
907 PurpleConnection *gc; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
908 char *passport; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
909 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
910 gc = cmdproc->session->account->gc; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
911 passport = msg->remote_user; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
912 |
30694
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
27868
diff
changeset
|
913 if (msn_message_get_header_value(msg, "TypingUser") == NULL) |
25399
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
914 return; |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
915 |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
916 if (cmdproc->servconn->type == MSN_SERVCONN_SB) { |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
917 MsnSwitchBoard *swboard = cmdproc->data; |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
918 |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
919 if (swboard->current_users == 1) |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
920 { |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
921 serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
922 PURPLE_TYPING); |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
923 } |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
924 |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
925 } else { |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
926 serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
927 PURPLE_TYPING); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
928 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
929 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
930 |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
931 static void |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
932 datacast_inform_user(MsnSwitchBoard *swboard, const char *who, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
933 const char *msg, const char *filename) |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
934 { |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
935 char *username, *str; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
936 PurpleAccount *account; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
937 PurpleBuddy *b; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
938 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
939 account = swboard->session->account; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
940 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
941 if ((b = purple_find_buddy(account, who)) != NULL) |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
942 username = g_markup_escape_text(purple_buddy_get_alias(b), -1); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
943 else |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
944 username = g_markup_escape_text(who, -1); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
945 str = g_strdup_printf(msg, username, filename); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
946 g_free(username); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
947 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
948 if (swboard->conv == NULL) { |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
949 if (swboard->current_users > 1) |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
950 swboard->conv = purple_find_chat(account->gc, swboard->chat_id); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
951 else { |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
952 swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
953 who, account); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
954 if (swboard->conv == NULL) |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
955 swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
956 } |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
957 } |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
958 swboard->flag |= MSN_SB_FLAG_IM; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
959 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
960 purple_conversation_write(swboard->conv, NULL, str, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
961 g_free(str); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
962 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
963 } |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
964 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
965 /* TODO: Make these not be such duplicates of each other */ |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
966 static void |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
967 got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
968 { |
29779
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
969 FILE *f = NULL; |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
970 char *path = NULL; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
971 const char *who = slpcall->slplink->remote_user; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
972 purple_debug_info("msn", "Received wink from %s\n", who); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
973 |
29779
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
974 if ((f = purple_mkstemp(&path, TRUE)) && |
29780
0f1df8098d00
Oops, make sure that check actually succeeds when it's supposed to.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29779
diff
changeset
|
975 (fwrite(data, 1, size, f) == size)) { |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
976 datacast_inform_user(slpcall->slplink->swboard, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
977 who, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
978 _("%s sent a wink. <a href='msn-wink://%s'>Click here to play it</a>"), |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
979 path); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
980 } else { |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
981 purple_debug_error("msn", "Couldn\'t create temp file to store wink\n"); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
982 datacast_inform_user(slpcall->slplink->swboard, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
983 who, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
984 _("%s sent a wink, but it could not be saved"), |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
985 NULL); |
29779
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
986 } |
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
987 if (f) |
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
988 fclose(f); |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
989 g_free(path); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
990 } |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
991 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
992 static void |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
993 got_voiceclip_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
994 { |
29779
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
995 FILE *f = NULL; |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
996 char *path = NULL; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
997 const char *who = slpcall->slplink->remote_user; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
998 purple_debug_info("msn", "Received voice clip from %s\n", who); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
999 |
29779
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
1000 if ((f = purple_mkstemp(&path, TRUE)) && |
29780
0f1df8098d00
Oops, make sure that check actually succeeds when it's supposed to.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29779
diff
changeset
|
1001 (fwrite(data, 1, size, f) == size)) { |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1002 datacast_inform_user(slpcall->slplink->swboard, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1003 who, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1004 _("%s sent a voice clip. <a href='audio://%s'>Click here to play it</a>"), |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1005 path); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1006 } else { |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1007 purple_debug_error("msn", "Couldn\'t create temp file to store sound\n"); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1008 datacast_inform_user(slpcall->slplink->swboard, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1009 who, |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1010 _("%s sent a voice clip, but it could not be saved"), |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1011 NULL); |
29779
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
1012 } |
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
1013 if (f) |
1c3ee8378e2e
I'm tired of seeing this warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29310
diff
changeset
|
1014 fclose(f); |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1015 g_free(path); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1016 } |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1017 |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1018 void |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1019 msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1020 { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1021 GHashTable *body; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1022 const char *id; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1023 body = msn_message_get_hashtable_from_body(msg); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1024 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1025 id = g_hash_table_lookup(body, "ID"); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1026 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1027 if (!strcmp(id, "1")) { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1028 /* Nudge */ |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1029 PurpleAccount *account; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1030 const char *user; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1031 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1032 account = cmdproc->session->account; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1033 user = msg->remote_user; |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1034 |
25399
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1035 if (cmdproc->servconn->type == MSN_SERVCONN_SB) { |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1036 MsnSwitchBoard *swboard = cmdproc->data; |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1037 if (swboard->current_users > 1 || |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1038 ((swboard->conv != NULL) && |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1039 purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1040 purple_prpl_got_attention_in_chat(account->gc, swboard->chat_id, user, MSN_NUDGE); |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1041 |
25399
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1042 else |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1043 purple_prpl_got_attention(account->gc, user, MSN_NUDGE); |
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1044 } else { |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1045 purple_prpl_got_attention(account->gc, user, MSN_NUDGE); |
25399
8ee34225cfd9
Make message handlers more generic and able to work when used by the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25398
diff
changeset
|
1046 } |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1047 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1048 } else if (!strcmp(id, "2")) { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1049 /* Wink */ |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1050 MsnSession *session; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1051 MsnSlpLink *slplink; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1052 MsnObject *obj; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1053 const char *who; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1054 const char *data; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1055 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1056 session = cmdproc->session; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1057 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1058 data = g_hash_table_lookup(body, "Data"); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1059 obj = msn_object_new_from_string(data); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1060 who = msn_object_get_creator(obj); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1061 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1062 slplink = msn_session_get_slplink(session, who); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1063 msn_slplink_request_object(slplink, data, got_wink_cb, NULL, obj); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1064 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1065 msn_object_destroy(obj); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1066 |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1067 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1068 } else if (!strcmp(id, "3")) { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1069 /* Voiceclip */ |
27431
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1070 MsnSession *session; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1071 MsnSlpLink *slplink; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1072 MsnObject *obj; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1073 const char *who; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1074 const char *data; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1075 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1076 session = cmdproc->session; |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1077 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1078 data = g_hash_table_lookup(body, "Data"); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1079 obj = msn_object_new_from_string(data); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1080 who = msn_object_get_creator(obj); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1081 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1082 slplink = msn_session_get_slplink(session, who); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1083 msn_slplink_request_object(slplink, data, got_voiceclip_cb, NULL, obj); |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1084 |
9c413bda20be
Add support for receiving winks and audio clips on MSN. The resulting file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27292
diff
changeset
|
1085 msn_object_destroy(obj); |
25398
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1086 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1087 } else if (!strcmp(id, "4")) { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1088 /* Action */ |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1089 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1090 } else { |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1091 purple_debug_warning("msn", "Got unknown datacast with ID %s.\n", id); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1092 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1093 |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1094 g_hash_table_destroy(body); |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1095 } |
ea98810d89c5
Move some MSN message handlers from switchboard to general msg.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25309
diff
changeset
|
1096 |
26518
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1097 void |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1098 msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1099 { |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1100 GHashTable *body; |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1101 const gchar *guid; |
27868
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1102 gboolean accepted = FALSE; |
26518
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1103 |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1104 g_return_if_fail(cmdproc != NULL); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1105 g_return_if_fail(msg != NULL); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1106 |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1107 body = msn_message_get_hashtable_from_body(msg); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1108 |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1109 if (body == NULL) { |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1110 purple_debug_warning("msn", |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1111 "Unable to parse invite msg body.\n"); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1112 return; |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1113 } |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1114 |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1115 guid = g_hash_table_lookup(body, "Application-GUID"); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1116 |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1117 if (guid == NULL) { |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1118 const gchar *cmd = g_hash_table_lookup( |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1119 body, "Invitation-Command"); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1120 |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1121 if (cmd && !strcmp(cmd, "CANCEL")) { |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1122 const gchar *code = g_hash_table_lookup( |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1123 body, "Cancel-Code"); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1124 purple_debug_info("msn", |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1125 "MSMSGS invitation cancelled: %s.\n", |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1126 code ? code : "no reason given"); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1127 } else |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1128 purple_debug_warning("msn", "Invite msg missing " |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1129 "Application-GUID.\n"); |
27868
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1130 |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1131 accepted = TRUE; |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1132 |
26518
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1133 } else if (!strcmp(guid, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) { |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1134 purple_debug_info("msn", "Computer call\n"); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1135 |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1136 if (cmdproc->session) { |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1137 PurpleConversation *conv = NULL; |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1138 gchar *from = msg->remote_user; |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1139 gchar *buf = NULL; |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1140 |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1141 if (from) |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1142 conv = purple_find_conversation_with_account( |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1143 PURPLE_CONV_TYPE_IM, from, |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1144 cmdproc->session->account); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1145 if (conv) |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1146 buf = g_strdup_printf( |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1147 _("%s sent you a voice chat " |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1148 "invite, which is not yet " |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1149 "supported."), from); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1150 if (buf) { |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1151 purple_conversation_write(conv, NULL, buf, |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1152 PURPLE_MESSAGE_SYSTEM | |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1153 PURPLE_MESSAGE_NOTIFY, |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1154 time(NULL)); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1155 g_free(buf); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1156 } |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1157 } |
27867
2f7386e1c5d1
Print name of application in the invite to the debug log if it's available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27586
diff
changeset
|
1158 } else { |
2f7386e1c5d1
Print name of application in the invite to the debug log if it's available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27586
diff
changeset
|
1159 const gchar *application = g_hash_table_lookup(body, "Application-Name"); |
2f7386e1c5d1
Print name of application in the invite to the debug log if it's available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27586
diff
changeset
|
1160 purple_debug_warning("msn", "Unhandled invite msg with GUID %s: %s.\n", |
2f7386e1c5d1
Print name of application in the invite to the debug log if it's available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27586
diff
changeset
|
1161 guid, application ? application : "(null)"); |
2f7386e1c5d1
Print name of application in the invite to the debug log if it's available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27586
diff
changeset
|
1162 } |
26518
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1163 |
27868
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1164 if (!accepted) { |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1165 const gchar *cookie = g_hash_table_lookup(body, "Invitation-Cookie"); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1166 if (cookie) { |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1167 MsnSwitchBoard *swboard = cmdproc->data; |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1168 char *text; |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1169 MsnMessage *cancel; |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1170 |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1171 cancel = msn_message_new(MSN_MSG_TEXT); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1172 msn_message_set_content_type(cancel, "text/x-msmsgsinvite"); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1173 msn_message_set_charset(cancel, "UTF-8"); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1174 msn_message_set_flag(cancel, 'U'); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1175 |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1176 text = g_strdup_printf("Invitation-Command: CANCEL\r\n" |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1177 "Invitation-Cookie: %s\r\n" |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1178 "Cancel-Code: REJECT_NOT_INSTALLED\r\n", |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1179 cookie); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1180 msn_message_set_bin_data(cancel, text, strlen(text)); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1181 g_free(text); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1182 |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1183 msn_switchboard_send_msg(swboard, cancel, TRUE); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1184 msn_message_destroy(cancel); |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1185 } |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1186 } |
9262c8f306a6
Send a cancel message for any unknown text/x-msmsgsinvite requests, so that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27867
diff
changeset
|
1187 |
26518
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1188 g_hash_table_destroy(body); |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1189 } |
79e043347bbe
Notify the user if a contact invites them to a voice call over MSN.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25461
diff
changeset
|
1190 |
27292
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1191 /* Only called from chats. Handwritten messages for IMs come as a SLP message */ |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1192 void |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1193 msn_handwritten_msg(MsnCmdProc *cmdproc, MsnMessage *msg) |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1194 { |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1195 const char *body; |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1196 size_t body_len; |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1197 |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1198 body = msn_message_get_bin_data(msg, &body_len); |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1199 msn_switchboard_show_ink(cmdproc->data, msg->remote_user, body); |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1200 } |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26518
diff
changeset
|
1201 |