Mercurial > pidgin.yaz
annotate libpurple/protocols/msn/slpcall.c @ 28875:8464e695c62b
Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
the 16 byte mark would cause a segmentation fault due to chopping the
multi-byte character and turning the string into invalidate utf8.
Thanks to Shaun Lindsay at Meebo for tracking this down and fixing it.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 04 Nov 2009 18:41:21 +0000 |
parents | 500d1e806264 |
children | 59b0c556f787 |
rev | line source |
---|---|
15374
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 slpcall.c SLP Call Functions |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15823 | 4 * purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15823 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15374
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 |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17137
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
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" |
19797
60bc06498746
Committing khc's msnp14 changes from Trac Ticket #148. --rlaager
Ka-Hing Cheung <khc@hxbc.us>
parents:
15823
diff
changeset
|
25 #include "msnutils.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "slpcall.h" |
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 #include "slp.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 |
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 * Main |
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 |
24337
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
34 static gboolean |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
35 msn_slpcall_timeout(gpointer data) |
24337
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
36 { |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
37 MsnSlpCall *slpcall; |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
38 |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
39 slpcall = data; |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
40 |
27509
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27374
diff
changeset
|
41 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:
27374
diff
changeset
|
42 purple_debug_info("msn", "slpcall_timeout: slpcall(%p)\n", slpcall); |
24337
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
43 |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
44 if (!slpcall->pending && !slpcall->progress) |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
45 { |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
46 msn_slpcall_destroy(slpcall); |
25169
14b927f45ec5
We just freed slpcall, so don't set slpcall->timer to 0. And return
Mark Doliner <mark@kingant.net>
parents:
25072
diff
changeset
|
47 return TRUE; |
24337
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
48 } |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
49 |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
50 slpcall->progress = FALSE; |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
51 |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
52 return TRUE; |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
53 } |
f0160066b58b
Make msn_slp_call_timeout static
Mark Doliner <mark@kingant.net>
parents:
23737
diff
changeset
|
54 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 MsnSlpCall * |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
56 msn_slpcall_new(MsnSlpLink *slplink) |
15374
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 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 g_return_val_if_fail(slplink != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 slpcall = g_new0(MsnSlpCall, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 |
27509
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27374
diff
changeset
|
64 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:
27374
diff
changeset
|
65 purple_debug_info("msn", "slpcall_new: slpcall(%p)\n", slpcall); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 slpcall->slplink = slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 msn_slplink_add_slpcall(slplink, slpcall); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 |
24342
9bdaf273c0ff
Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents:
24341
diff
changeset
|
71 slpcall->timer = purple_timeout_add_seconds(MSN_SLPCALL_TIMEOUT, msn_slpcall_timeout, slpcall); |
15374
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 return slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 } |
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 void |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
77 msn_slpcall_destroy(MsnSlpCall *slpcall) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 GList *e; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 |
27509
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27374
diff
changeset
|
81 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:
27374
diff
changeset
|
82 purple_debug_info("msn", "slpcall_destroy: slpcall(%p)\n", slpcall); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 g_return_if_fail(slpcall != NULL); |
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 if (slpcall->timer) |
15823 | 87 purple_timeout_remove(slpcall->timer); |
15374
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 for (e = slpcall->slplink->slp_msgs; e != NULL; ) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 MsnSlpMessage *slpmsg = e->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 e = e->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
27509
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27374
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:
27374
diff
changeset
|
95 purple_debug_info("msn", "slpcall_destroy: trying slpmsg(%p)\n", |
35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27374
diff
changeset
|
96 slpmsg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 if (slpmsg->slpcall == slpcall) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 msn_slpmsg_destroy(slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 } |
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 if (slpcall->end_cb != NULL) |
24340
33697964e62b
There's no need for this variable anymore
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
105 slpcall->end_cb(slpcall, slpcall->slplink->session); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 |
23719
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23671
diff
changeset
|
107 if (slpcall->xfer != NULL) { |
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23671
diff
changeset
|
108 slpcall->xfer->data = NULL; |
17137
8ed7b2d32ad1
slpcall now explicitlt references its xfer and unreferences it when it is destroyed. While it *looks* like this should *probably* have happened anyways due to the interactins between xfer_init, xfer_end, and xfer_cancel_remote, having the xfer's owner make this explicit makes the process less fragile and more obvious, and it may fix a crash as the slp is destroyed. Fixes #1070
Evan Schoenberg <evan.s@dreskin.net>
parents:
17136
diff
changeset
|
109 purple_xfer_unref(slpcall->xfer); |
23719
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23671
diff
changeset
|
110 } |
17137
8ed7b2d32ad1
slpcall now explicitlt references its xfer and unreferences it when it is destroyed. While it *looks* like this should *probably* have happened anyways due to the interactins between xfer_init, xfer_end, and xfer_cancel_remote, having the xfer's owner make this explicit makes the process less fragile and more obvious, and it may fix a crash as the slp is destroyed. Fixes #1070
Evan Schoenberg <evan.s@dreskin.net>
parents:
17136
diff
changeset
|
111 |
24338
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24337
diff
changeset
|
112 msn_slplink_remove_slpcall(slpcall->slplink, slpcall); |
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24337
diff
changeset
|
113 |
23735
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23671
diff
changeset
|
114 g_free(slpcall->id); |
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23671
diff
changeset
|
115 g_free(slpcall->branch); |
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23671
diff
changeset
|
116 g_free(slpcall->data_info); |
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23671
diff
changeset
|
117 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 g_free(slpcall); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 void |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
122 msn_slpcall_init(MsnSlpCall *slpcall, MsnSlpCallType type) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 slpcall->session_id = rand() % 0xFFFFFF00 + 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 slpcall->id = rand_guid(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 slpcall->type = type; |
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 void |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
130 msn_slpcall_session_init(MsnSlpCall *slpcall) |
15374
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 if (slpcall->session_init_cb) |
23671
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22808
diff
changeset
|
133 slpcall->session_init_cb(slpcall); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 slpcall->started = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 } |
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 void |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
139 msn_slpcall_invite(MsnSlpCall *slpcall, const char *euf_guid, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 int app_id, const char *context) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 MsnSlpMessage *slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 char *header; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 char *content; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 g_return_if_fail(slpcall != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 g_return_if_fail(context != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 slplink = slpcall->slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 slpcall->branch = rand_guid(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 content = g_strdup_printf( |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 "EUF-GUID: {%s}\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 "SessionID: %lu\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 "AppID: %d\r\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 "Context: %s\r\n\r\n", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 euf_guid, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 slpcall->session_id, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 app_id, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 context); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 slplink->remote_user); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 "application/x-msnmsgr-sessionreqbody", content); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 slpmsg->info = "SLP INVITE"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 slpmsg->text_body = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 msn_slplink_send_slpmsg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 g_free(header); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 g_free(content); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 void |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
180 msn_slpcall_close(MsnSlpCall *slpcall) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 g_return_if_fail(slpcall != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 g_return_if_fail(slpcall->slplink != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 send_bye(slpcall, "application/x-msnmsgr-sessionclosebody"); |
24344
bceefbae1ca6
Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents:
24342
diff
changeset
|
186 msn_slplink_send_queued_slpmsgs(slpcall->slplink); |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
187 msn_slpcall_destroy(slpcall); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 } |
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 MsnSlpCall * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 const guchar *body; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 gsize 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 slpcall = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 body = slpmsg->buffer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 body_len = slpmsg->size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 |
24965
bcedd3b2ca69
A patch from Thomas Gibson-Robinson to fix receiving buddy icons, custom
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24344
diff
changeset
|
201 if (slpmsg->flags == 0x0 || slpmsg->flags == 0x1000000) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 char *body_str; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
27374
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
205 if (slpmsg->session_id == 64) |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
206 { |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
207 /* This is for handwritten messages (Ink) */ |
28431
500d1e806264
So apparently, I messed up the name of this charset. But I wonder why it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28156
diff
changeset
|
208 GError *error = NULL; |
28093
4362f871369c
Using g_convert instead of g_utf16_to_utf8 so that we can explicitly set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27509
diff
changeset
|
209 gsize bytes_read, bytes_written; |
27374
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
210 |
28094
a82fec14ac0f
Fix the warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28093
diff
changeset
|
211 body_str = g_convert((const gchar *)body, body_len / 2, |
28156
0cd438c47ab3
THis conversion specifier is incorrect.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28099
diff
changeset
|
212 "UTF-8", "UTF-16LE", |
28093
4362f871369c
Using g_convert instead of g_utf16_to_utf8 so that we can explicitly set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27509
diff
changeset
|
213 &bytes_read, &bytes_written, &error); |
4362f871369c
Using g_convert instead of g_utf16_to_utf8 so that we can explicitly set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27509
diff
changeset
|
214 body_len -= bytes_read + 2; |
4362f871369c
Using g_convert instead of g_utf16_to_utf8 so that we can explicitly set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27509
diff
changeset
|
215 body += bytes_read + 2; |
27374
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
216 if (body_str == NULL |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
217 || body_len <= 0 |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
218 || strstr(body_str, "image/gif") == NULL) |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
219 { |
28099
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
220 if (error != NULL) { |
27374
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
221 purple_debug_error("msn", |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
222 "Unable to convert Ink header from UTF-16 to UTF-8: %s\n", |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
223 error->message); |
28099
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
224 g_error_free(error); |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
225 } |
27374
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
226 else |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
227 purple_debug_error("msn", |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
228 "Received Ink in unknown format\n"); |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
229 g_free(body_str); |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
230 return NULL; |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
231 } |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
232 g_free(body_str); |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
233 |
28094
a82fec14ac0f
Fix the warnings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28093
diff
changeset
|
234 body_str = g_convert((const gchar *)body, body_len / 2, |
28431
500d1e806264
So apparently, I messed up the name of this charset. But I wonder why it
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28156
diff
changeset
|
235 "UTF-8", "UTF-16LE", |
28093
4362f871369c
Using g_convert instead of g_utf16_to_utf8 so that we can explicitly set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27509
diff
changeset
|
236 &bytes_read, &bytes_written, &error); |
27374
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
237 if (!body_str) |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
238 { |
28099
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
239 if (error != NULL) { |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
240 purple_debug_error("msn", |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
241 "Unable to convert Ink body from UTF-16 to UTF-8: %s\n", |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
242 error->message); |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
243 g_error_free(error); |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
244 } |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
245 else |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
246 purple_debug_error("msn", |
080cfd84038c
Don't leak the GError from g_convert.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28095
diff
changeset
|
247 "Received Ink in unknown format\n"); |
27374
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
248 return NULL; |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
249 } |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
250 |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
251 msn_switchboard_show_ink(slpmsg->slplink->swboard, |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
252 slplink->remote_user, |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
253 body_str); |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
254 } |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
255 else |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
256 { |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
257 body_str = g_strndup((const char *)body, body_len); |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
258 slpcall = msn_slp_sip_recv(slplink, body_str); |
a6d84d9de605
Add support for receiving handwritten (Ink) messages from MSN buddies.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25169
diff
changeset
|
259 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 g_free(body_str); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 } |
24965
bcedd3b2ca69
A patch from Thomas Gibson-Robinson to fix receiving buddy icons, custom
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24344
diff
changeset
|
262 else if (slpmsg->flags == 0x20 || |
bcedd3b2ca69
A patch from Thomas Gibson-Robinson to fix receiving buddy icons, custom
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24344
diff
changeset
|
263 slpmsg->flags == 0x1000020 || |
bcedd3b2ca69
A patch from Thomas Gibson-Robinson to fix receiving buddy icons, custom
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24344
diff
changeset
|
264 slpmsg->flags == 0x1000030) |
15374
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 slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); |
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 (slpcall != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 { |
25072
5fd2102643d5
Avoid canceling this timer twice
Mark Doliner <mark@kingant.net>
parents:
24971
diff
changeset
|
270 if (slpcall->timer) { |
15823 | 271 purple_timeout_remove(slpcall->timer); |
25072
5fd2102643d5
Avoid canceling this timer twice
Mark Doliner <mark@kingant.net>
parents:
24971
diff
changeset
|
272 slpcall->timer = 0; |
5fd2102643d5
Avoid canceling this timer twice
Mark Doliner <mark@kingant.net>
parents:
24971
diff
changeset
|
273 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 slpcall->cb(slpcall, body, body_len); |
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 slpcall->wasted = TRUE; |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 else if (slpmsg->flags == 0x100) |
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 slpcall = slplink->directconn->initial_call; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 if (slpcall != NULL) |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24340
diff
changeset
|
286 msn_slpcall_session_init(slpcall); |
15374
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 #endif |
24971
859e5b3f5c47
On MSN, don't print an "unknown" message for SLP acknowledgement messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24967
diff
changeset
|
289 else if (slpmsg->flags == 0x2) |
859e5b3f5c47
On MSN, don't print an "unknown" message for SLP acknowledgement messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24967
diff
changeset
|
290 { |
859e5b3f5c47
On MSN, don't print an "unknown" message for SLP acknowledgement messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24967
diff
changeset
|
291 /* Acknowledgement of previous message. Don't do anything currently. */ |
859e5b3f5c47
On MSN, don't print an "unknown" message for SLP acknowledgement messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24967
diff
changeset
|
292 } |
24967
5e77f8512f5b
Report a debug warning if a SLP MSG is not processed because it has unknown
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24965
diff
changeset
|
293 else |
5e77f8512f5b
Report a debug warning if a SLP MSG is not processed because it has unknown
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24965
diff
changeset
|
294 purple_debug_warning("msn", "Unprocessed SLP message with flags 0x%08lx\n", |
5e77f8512f5b
Report a debug warning if a SLP MSG is not processed because it has unknown
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24965
diff
changeset
|
295 slpmsg->flags); |
15374
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 return slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 } |