Mercurial > pidgin
annotate libpurple/protocols/msn/slplink.c @ 30830:e935d15725c3
Hide msn_slplink_destroy and use the unref version everywhere.
author | masca@cpw.pidgin.im |
---|---|
date | Thu, 24 Jun 2010 00:12:45 +0000 |
parents | 471e9b81da41 |
children | 210feb895031 |
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 slplink.c MSNSLP Link support |
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:
19654
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 */ |
30742
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30736
diff
changeset
|
24 |
30758
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
30742
diff
changeset
|
25 #include "internal.h" |
30742
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30736
diff
changeset
|
26 #include "debug.h" |
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30736
diff
changeset
|
27 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "msn.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "slplink.h" |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
30 #include "slpmsg_part.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 |
30793
f84fb808e8ed
Move MsnMessage stuff out of slplink to SBConn.
masca@cpw.pidgin.im
parents:
30792
diff
changeset
|
32 #include "sbconn.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "switchboard.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "slp.h" |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
35 #include "p2p.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #ifdef MSN_DEBUG_SLP_FILES |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 static int m_sc = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 static int m_rc = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 static void |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
42 debug_part_to_file(MsnSlpMessage *msg, gboolean send) |
15373
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 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 char *dir; |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
46 char *data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 int c; |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
48 gsize data_size; |
15373
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 dir = send ? "send" : "recv"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 c = send ? m_sc++ : m_rc++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c); |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
53 data = msn_slpmsg_serialize(msg, &data_size); |
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
54 if (!purple_util_write_data_to_file_absolute(tmp, data, data_size)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 { |
26505
0c796a1950b7
Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25335
diff
changeset
|
56 purple_debug_error("msn", "could not save debug file\n"); |
15373
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 g_free(tmp); |
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 #endif |
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 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 * Main |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 |
23304
945bf99cb233
msn_slplink_new() is only used within slplink.c, so make it static and
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
66 static MsnSlpLink * |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 msn_slplink_new(MsnSession *session, const char *username) |
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 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 g_return_val_if_fail(session != NULL, NULL); |
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 slplink = g_new0(MsnSlpLink, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
27483
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
75 if (purple_debug_is_verbose()) |
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
76 purple_debug_info("msn", "slplink_new: slplink(%p)\n", slplink); |
15373
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 slplink->session = session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 slplink->remote_user = g_strdup(username); |
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 slplink->slp_msg_queue = g_queue_new(); |
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 session->slplinks = |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 g_list_append(session->slplinks, slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 |
29762
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
88 return msn_slplink_ref(slplink); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 |
30830
e935d15725c3
Hide msn_slplink_destroy and use the unref version everywhere.
masca@cpw.pidgin.im
parents:
30828
diff
changeset
|
91 static void |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 msn_slplink_destroy(MsnSlpLink *slplink) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 MsnSession *session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 |
27483
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
96 if (purple_debug_is_verbose()) |
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
97 purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); |
15373
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 g_return_if_fail(slplink != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
30114
3f7f469ee1d0
NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30089
diff
changeset
|
101 if (slplink->swboard != NULL) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); |
30114
3f7f469ee1d0
NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30089
diff
changeset
|
103 slplink->swboard = NULL; |
3f7f469ee1d0
NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30089
diff
changeset
|
104 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
29762
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
106 if (slplink->refs > 1) { |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
107 slplink->refs--; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
108 return; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
109 } |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
110 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 session = slplink->session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
113 if (slplink->dc != NULL) { |
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
114 slplink->dc->slplink = NULL; |
30046
e471c1fb9c49
It's probably a good idea to free the direct connection when the slplink
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30036
diff
changeset
|
115 msn_dc_destroy(slplink->dc); |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
116 slplink->dc = NULL; |
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
117 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 while (slplink->slp_calls != NULL) |
24398
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
120 msn_slpcall_destroy(slplink->slp_calls->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 |
20945 | 122 g_queue_free(slplink->slp_msg_queue); |
123 | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 session->slplinks = |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 g_list_remove(session->slplinks, slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 |
23677
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23626
diff
changeset
|
127 g_free(slplink->remote_user); |
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23626
diff
changeset
|
128 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 g_free(slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 } |
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 MsnSlpLink * |
29762
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
133 msn_slplink_ref(MsnSlpLink *slplink) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
134 { |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
135 g_return_val_if_fail(slplink != NULL, NULL); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
136 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
137 slplink->refs++; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
138 if (purple_debug_is_verbose()) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
139 purple_debug_info("msn", "slplink ref (%p)[%d]\n", slplink, slplink->refs); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
140 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
141 return slplink; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
142 } |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
143 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
144 void |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
145 msn_slplink_unref(MsnSlpLink *slplink) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
146 { |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
147 g_return_if_fail(slplink != NULL); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
148 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
149 slplink->refs--; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
150 if (purple_debug_is_verbose()) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
151 purple_debug_info("msn", "slplink unref (%p)[%d]\n", slplink, slplink->refs); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
152 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
153 if (slplink->refs == 0) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
154 msn_slplink_destroy(slplink); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
155 } |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
156 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
157 MsnSlpLink * |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 msn_session_find_slplink(MsnSession *session, const char *who) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 GList *l; |
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 for (l = session->slplinks; l != NULL; l = l->next) |
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 MsnSlpLink *slplink; |
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 slplink = l->data; |
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 (!strcmp(slplink->remote_user, who)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 return slplink; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 } |
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 MsnSlpLink * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 msn_session_get_slplink(MsnSession *session, const char *username) |
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 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 g_return_val_if_fail(session != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 g_return_val_if_fail(username != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 slplink = msn_session_find_slplink(session, username); |
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 if (slplink == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 slplink = msn_slplink_new(session, username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 return slplink; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 if (slplink->swboard != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 slplink->swboard->flag |= MSN_SB_FLAG_FT; |
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 slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall); |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
198 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
199 /* |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
200 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
201 msn_dc_ref(slplink->dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
202 */ |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 { |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
208 /* |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
209 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
210 msn_dc_unref(slplink->dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
211 */ |
30014 | 212 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 |
24395
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24393
diff
changeset
|
215 /* The slplink has no slpcalls in it, release it from MSN_SB_FLAG_FT. |
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24393
diff
changeset
|
216 * If nothing else is using it then this might cause swboard to be |
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24393
diff
changeset
|
217 * destroyed. */ |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
218 if (slplink->slp_calls == NULL && slplink->swboard != NULL) { |
30129
a83167dd305c
And another one just like 94fa017925fa206fc36f520ee42c54f57429b4e1. But
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
219 slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); |
24395
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24393
diff
changeset
|
220 msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT); |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
221 slplink->swboard = NULL; |
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
222 } |
30057
7a82bc59b63f
Close the DC when the slplink is empty.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30046
diff
changeset
|
223 |
7a82bc59b63f
Close the DC when the slplink is empty.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30046
diff
changeset
|
224 /* The slplink has no slpcalls in it, release it from the DC. */ |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
225 if (slplink->slp_calls == NULL && slplink->dc != NULL) { |
30124
bc9f74e9f596
And another one of those reverse links. We don't want dc to automatically
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30114
diff
changeset
|
226 slplink->dc->slplink = NULL; |
30057
7a82bc59b63f
Close the DC when the slplink is empty.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30046
diff
changeset
|
227 msn_dc_destroy(slplink->dc); |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
228 slplink->dc = NULL; |
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
229 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 MsnSlpCall * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 msn_slplink_find_slp_call(MsnSlpLink *slplink, const char *id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 if (!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 for (l = slplink->slp_calls; l != NULL; l = l->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 slpcall = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 if (slpcall->id && !strcmp(slpcall->id, id)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 return slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 } |
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 MsnSlpCall * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 MsnSlpCall *slpcall; |
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 for (l = slplink->slp_calls; l != NULL; l = l->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 slpcall = l->data; |
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 (slpcall->session_id == id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 return slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 } |
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 return 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 |
30077
11e748b759a2
This is supposed to go along with the queue sending stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30068
diff
changeset
|
269 void |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
270 msn_slplink_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part) |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
271 { |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
272 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
273 { |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
274 msn_dc_enqueue_part(slplink->dc, part); |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
275 } |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
276 else |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
277 { |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
278 msn_sbconn_send_part(slplink, part); |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
279 } |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
280 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
282 void |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 { |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
285 MsnSlpMessagePart *part; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 long long real_size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 size_t len = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 /* Maybe we will want to create a new msg for this slpmsg instead of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 * reusing the same one all the time. */ |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
291 part = msn_slpmsgpart_new(slpmsg->header, slpmsg->footer); |
30805
dfada77da5cb
Reomove MsnMessage reference from DirectConn.
masca@cpw.pidgin.im
parents:
30802
diff
changeset
|
292 part->ack_data = slpmsg; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
294 real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 if (slpmsg->offset < real_size) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 { |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
298 if (slpmsg->slpcall && slpmsg->slpcall->xfer && purple_xfer_get_type(slpmsg->slpcall->xfer) == PURPLE_XFER_SEND && |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
299 purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED) |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
300 { |
30794 | 301 len = MIN(MSN_SBCONN_MAX_SIZE, slpmsg->slpcall->u.outgoing.len); |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
302 msn_slpmsgpart_set_bin_data(part, slpmsg->slpcall->u.outgoing.data, len); |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
303 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 else |
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 len = slpmsg->size - slpmsg->offset; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 |
30794 | 308 if (len > MSN_SBCONN_MAX_SIZE) |
309 len = MSN_SBCONN_MAX_SIZE; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
311 msn_slpmsgpart_set_bin_data(part, slpmsg->slpcall->u.outgoing.data, len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 |
30784
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
30779
diff
changeset
|
314 slpmsg->header->offset = slpmsg->offset; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
30779
diff
changeset
|
315 slpmsg->header->length = len; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
318 #if 0 |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
319 /* TODO: port this function to SlpMessageParts */ |
27483
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
320 if (purple_debug_is_verbose()) |
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
321 msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
322 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 #ifdef MSN_DEBUG_SLP_FILES |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
325 debug_part_to_file(slpmsg, TRUE); |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
326 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
328 slpmsg->parts = g_list_append(slpmsg->parts, part); |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
329 msn_slplink_send_part(slplink, part); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
331 if ((slpmsg->flags == P2P_MSN_OBJ_DATA || |
30776
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
30767
diff
changeset
|
332 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
333 slpmsg->flags == P2P_FILE_DATA) && |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 (slpmsg->slpcall != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 slpmsg->slpcall->progress = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 if (slpmsg->slpcall->progress_cb != NULL) |
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 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 len, slpmsg->offset); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 /* slpmsg->offset += len; */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 |
24403
89cb1c13036e
Make another function static
Mark Doliner <mark@kingant.net>
parents:
24402
diff
changeset
|
348 static void |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 { |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
351 slpmsg = slpmsg; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
352 slpmsg->header = g_new0(MsnP2PHeader, 1); |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
353 slpmsg->footer = g_new0(MsnP2PFooter, 1); |
30784
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
30779
diff
changeset
|
354 |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
355 if (slpmsg->flags == P2P_NO_FLAG) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 { |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
357 slpmsg->header->session_id = slpmsg->session_id; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
358 slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 } |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
360 else if (slpmsg->flags == P2P_ACK) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 { |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
362 slpmsg->header->session_id = slpmsg->session_id; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
363 slpmsg->header->ack_id = slpmsg->ack_id; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
364 slpmsg->header->ack_size = slpmsg->ack_size; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
365 slpmsg->header->ack_sub_id = slpmsg->ack_sub_id; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
367 else if (slpmsg->flags == P2P_MSN_OBJ_DATA || |
30776
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
30767
diff
changeset
|
368 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
369 slpmsg->flags == P2P_FILE_DATA) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 { |
23626
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23510
diff
changeset
|
371 MsnSlpCall *slpcall; |
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23510
diff
changeset
|
372 slpcall = slpmsg->slpcall; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 |
23626
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23510
diff
changeset
|
374 g_return_if_fail(slpcall != NULL); |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
375 slpmsg->header->session_id = slpcall->session_id; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
376 slpmsg->footer->value = slpcall->app_id; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
377 slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
15373
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 else if (slpmsg->flags == 0x100) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 { |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
381 slpmsg->header->ack_id = slpmsg->ack_id; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
382 slpmsg->header->ack_sub_id = slpmsg->ack_sub_id; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
383 slpmsg->header->ack_size = slpmsg->ack_size; |
15373
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 |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
386 slpmsg->header->id = slpmsg->id; |
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
387 slpmsg->header->flags = (guint32)slpmsg->flags; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
389 slpmsg->header->total_size = slpmsg->size; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
391 msn_slplink_send_msgpart(slplink, slpmsg); |
15373
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 { |
25329
36897ddd3e08
This should prevent the crash in #8109 by stopping an invalid message from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24403
diff
changeset
|
397 g_return_if_fail(slpmsg != NULL); |
36897ddd3e08
This should prevent the crash in #8109 by stopping an invalid message from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24403
diff
changeset
|
398 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 slpmsg->id = slplink->slp_seq_id++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 |
24402
b9e09053e53a
This doesn't matter, but I think the metaphor tends to be that you push
Mark Doliner <mark@kingant.net>
parents:
24401
diff
changeset
|
401 g_queue_push_tail(slplink->slp_msg_queue, slpmsg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 msn_slplink_send_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
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 slpmsg->id = slplink->slp_seq_id++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 msn_slplink_release_slpmsg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 } |
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 void |
24401
bceefbae1ca6
Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents:
24398
diff
changeset
|
413 msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink) |
15373
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 MsnSlpMessage *slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 |
24401
bceefbae1ca6
Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents:
24398
diff
changeset
|
417 /* Send the queued msgs in the order they were created */ |
24402
b9e09053e53a
This doesn't matter, but I think the metaphor tends to be that you push
Mark Doliner <mark@kingant.net>
parents:
24401
diff
changeset
|
418 while ((slpmsg = g_queue_pop_head(slplink->slp_msg_queue)) != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 msn_slplink_release_slpmsg(slplink, slpmsg); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
424 static MsnSlpMessage * |
30767 | 425 msn_slplink_create_ack(MsnSlpLink *slplink, MsnP2PHeader *header) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 MsnSlpMessage *slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 |
30792 | 429 slpmsg = msn_slpmsg_ack_new(header); |
30790
545fa069c531
The creation of SlpMessage must be done in its own module.
masca@cpw.pidgin.im
parents:
30784
diff
changeset
|
430 msn_slpmsg_set_slplink(slpmsg, slplink); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
432 return slpmsg; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
433 } |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
434 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
435 static void |
30767 | 436 msn_slplink_send_ack(MsnSlpLink *slplink, MsnP2PHeader *header) |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
437 { |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
438 MsnSlpMessage *slpmsg = msn_slplink_create_ack(slplink, header); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
439 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 msn_slplink_send_slpmsg(slplink, slpmsg); |
27939
4200554dd0fc
Patch written by Mark Doliner and Paul Aurich to fix a remote crash on MSN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27887
diff
changeset
|
441 msn_slpmsg_destroy(slpmsg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 static void |
23626
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23510
diff
changeset
|
445 send_file_cb(MsnSlpCall *slpcall) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 MsnSlpMessage *slpmsg; |
17054
21830d70709b
Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents:
15822
diff
changeset
|
448 PurpleXfer *xfer; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 |
28795
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
450 xfer = (PurpleXfer *)slpcall->xfer; |
30068
dbe96260108c
It seems like aMSN can get a bit stuck when using multiple file transfers,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30061
diff
changeset
|
451 if (purple_xfer_get_status(xfer) >= PURPLE_XFER_STATUS_STARTED) |
dbe96260108c
It seems like aMSN can get a bit stuck when using multiple file transfers,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30061
diff
changeset
|
452 return; |
dbe96260108c
It seems like aMSN can get a bit stuck when using multiple file transfers,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30061
diff
changeset
|
453 |
28795
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
454 purple_xfer_ref(xfer); |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
455 purple_xfer_start(xfer, -1, NULL, 0); |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
456 if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_STARTED) { |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
457 purple_xfer_unref(xfer); |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
458 return; |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
459 } |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
460 purple_xfer_unref(xfer); |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28794
diff
changeset
|
461 |
30792 | 462 slpmsg = msn_slpmsg_file_new(slpcall, purple_xfer_get_size(xfer)); |
30791
64a6ce55aa63
Move more SlpMessage creation to its module.
masca@cpw.pidgin.im
parents:
30790
diff
changeset
|
463 msn_slpmsg_set_slplink(slpmsg, slpcall->slplink); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); |
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 |
24396
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
468 static MsnSlpMessage * |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
469 msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id) |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
470 { |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
471 GList *e; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
472 |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
473 for (e = slplink->slp_msgs; e != NULL; e = e->next) |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
474 { |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
475 MsnSlpMessage *slpmsg = e->data; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
476 |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
477 if ((slpmsg->session_id == session_id) && (slpmsg->id == id)) |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
478 return slpmsg; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
479 } |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
480 |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
481 return NULL; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
482 } |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
483 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 void |
30767 | 485 msn_slplink_process_msg(MsnSlpLink *slplink, MsnP2PHeader *header, const char *data, gsize len) |
15373
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 MsnSlpMessage *slpmsg; |
25598
9931796e1765
*** Plucked rev 9dd1c4c3 (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25335
diff
changeset
|
488 guint64 offset; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
490 if (header->total_size < header->length) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 { |
30697
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
492 /* We seem to have received a bad header */ |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
493 purple_debug_warning("msn", "Total size listed in SLP binary header " |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
494 "was less than length of this particular message. This " |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
495 "should not happen. Dropping message.\n"); |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
496 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
499 offset = header->offset; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 if (offset == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 slpmsg = msn_slpmsg_new(slplink); |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
504 slpmsg->id = header->id; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
505 slpmsg->session_id = header->session_id; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
506 slpmsg->size = header->total_size; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
507 slpmsg->flags = header->flags; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 if (slpmsg->session_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 { |
30698
24f371e16a51
We just allocated slpmsg, so of course slpmsg->slpcall will be NULL here
Mark Doliner <mark@kingant.net>
parents:
30697
diff
changeset
|
511 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 if (slpmsg->slpcall != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 { |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
514 if (slpmsg->flags == P2P_MSN_OBJ_DATA || |
30776
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
30767
diff
changeset
|
515 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
516 slpmsg->flags == P2P_FILE_DATA) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 { |
30697
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
518 PurpleXfer *xfer = slpmsg->slpcall->xfer; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 if (xfer != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 { |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
521 slpmsg->ft = TRUE; |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
522 slpmsg->slpcall->xfer_msg = slpmsg; |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
523 |
23662
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23626
diff
changeset
|
524 purple_xfer_ref(xfer); |
27874
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
27751
diff
changeset
|
525 purple_xfer_start(xfer, -1, NULL, 0); |
23662
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23626
diff
changeset
|
526 |
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23626
diff
changeset
|
527 if (xfer->data == NULL) { |
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23626
diff
changeset
|
528 purple_xfer_unref(xfer); |
27751
58f29c0286fe
I don't understand how this branch could be reached, but don't leak the slp
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27483
diff
changeset
|
529 msn_slpmsg_destroy(slpmsg); |
58f29c0286fe
I don't understand how this branch could be reached, but don't leak the slp
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27483
diff
changeset
|
530 g_return_if_reached(); |
23662
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23626
diff
changeset
|
531 } else { |
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23626
diff
changeset
|
532 purple_xfer_unref(xfer); |
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23626
diff
changeset
|
533 } |
15373
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 } |
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 } |
28693
6aea98f6a5cd
Get rid of slpmsg->fp since the core is handling all the partial reads and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28691
diff
changeset
|
538 if (!slpmsg->ft && slpmsg->size) |
15373
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 slpmsg->buffer = g_try_malloc(slpmsg->size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 if (slpmsg->buffer == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 { |
15822 | 543 purple_debug_error("msn", "Failed to allocate buffer for slpmsg\n"); |
25598
9931796e1765
*** Plucked rev 9dd1c4c3 (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
25335
diff
changeset
|
544 msn_slpmsg_destroy(slpmsg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 } |
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 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 { |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
551 slpmsg = msn_slplink_message_find(slplink, header->session_id, header->id); |
27887
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
552 if (slpmsg == NULL) |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
553 { |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
554 /* Probably the transfer was canceled */ |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
555 purple_debug_error("msn", "Couldn't find slpmsg\n"); |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
556 return; |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
557 } |
15373
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 |
28693
6aea98f6a5cd
Get rid of slpmsg->fp since the core is handling all the partial reads and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28691
diff
changeset
|
560 if (slpmsg->ft) |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
561 { |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
562 slpmsg->slpcall->u.incoming_data = |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
563 g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)data, len); |
30697
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
564 purple_xfer_prpl_ready(slpmsg->slpcall->xfer); |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
565 } |
27939
4200554dd0fc
Patch written by Mark Doliner and Paul Aurich to fix a remote crash on MSN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27887
diff
changeset
|
566 else if (slpmsg->size && slpmsg->buffer) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 { |
29072
69077f3993f6
Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents:
28839
diff
changeset
|
568 if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size || slpmsg->offset != offset) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 { |
22822
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22568
diff
changeset
|
570 purple_debug_error("msn", |
26925
e45fe73b47e3
Fix two warnings when building on OS X
Paul Aurich <paul@darkrain42.org>
parents:
26862
diff
changeset
|
571 "Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n", |
22822
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22568
diff
changeset
|
572 slpmsg->size, offset, len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 g_return_if_reached(); |
29072
69077f3993f6
Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents:
28839
diff
changeset
|
574 } else { |
69077f3993f6
Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents:
28839
diff
changeset
|
575 memcpy(slpmsg->buffer + offset, data, len); |
69077f3993f6
Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents:
28839
diff
changeset
|
576 slpmsg->offset += len; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
580 if ((slpmsg->flags == P2P_MSN_OBJ_DATA || |
30776
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
30767
diff
changeset
|
581 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
582 slpmsg->flags == P2P_FILE_DATA) && |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 (slpmsg->slpcall != NULL)) |
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 slpmsg->slpcall->progress = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 if (slpmsg->slpcall->progress_cb != NULL) |
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 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 len, offset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 } |
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 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 if (slpmsg->buffer == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
599 if (header->offset + header->length >= header->total_size) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 /* All the pieces of the slpmsg have been received */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 slpcall = msn_slp_process_msg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 |
28797
dc7b50d09922
Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28795
diff
changeset
|
606 if (slpcall == NULL) { |
dc7b50d09922
Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28795
diff
changeset
|
607 msn_slpmsg_destroy(slpmsg); |
dc7b50d09922
Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28795
diff
changeset
|
608 return; |
dc7b50d09922
Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28795
diff
changeset
|
609 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
611 purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n"); |
28797
dc7b50d09922
Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28795
diff
changeset
|
612 |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
613 if (/* !slpcall->wasted && */ slpmsg->flags == 0x100) |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
614 { |
20431
67cda4e0dac8
Finish commenting out references to directconn that would never be called
Stu Tomlinson <stu@nosnilmot.com>
parents:
20426
diff
changeset
|
615 #if 0 |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
616 MsnDirectConn *directconn; |
28797
dc7b50d09922
Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28795
diff
changeset
|
617 |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
618 directconn = slplink->directconn; |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
619 if (!directconn->acked) |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
620 msn_directconn_send_handshake(directconn); |
20431
67cda4e0dac8
Finish commenting out references to directconn that would never be called
Stu Tomlinson <stu@nosnilmot.com>
parents:
20426
diff
changeset
|
621 #endif |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
622 } |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
623 else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP || |
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
624 slpmsg->flags == P2P_MSN_OBJ_DATA || |
30776
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
30767
diff
changeset
|
625 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
626 slpmsg->flags == P2P_FILE_DATA) |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
627 { |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
628 /* Release all the messages and send the ACK */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
630 if (slpcall->wait_for_socket) { |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
631 /* |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
632 * Save ack for later because we have to send |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
633 * a 200 OK message to the previous direct connect |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
634 * invitation before ACK but the listening socket isn't |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
635 * created yet. |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
636 */ |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
637 purple_debug_info("msn", "msn_slplink_process_msg: save ACK\n"); |
30014 | 638 |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
639 slpcall->slplink->dc->prev_ack = msn_slplink_create_ack(slplink, header); |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
640 } else if (!slpcall->wasted) { |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
641 purple_debug_info("msn", "msn_slplink_process_msg: send ACK\n"); |
30014 | 642 |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
643 msn_slplink_send_ack(slplink, header); |
28797
dc7b50d09922
Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28795
diff
changeset
|
644 msn_slplink_send_queued_slpmsgs(slplink); |
dc7b50d09922
Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28795
diff
changeset
|
645 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 } |
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 msn_slpmsg_destroy(slpmsg); |
28799
bcea7c92d3f1
Oops, don't break things for successfully receiving of a file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28798
diff
changeset
|
649 |
30028
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30015
diff
changeset
|
650 if (!slpcall->wait_for_socket && slpcall->wasted) |
28799
bcea7c92d3f1
Oops, don't break things for successfully receiving of a file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28798
diff
changeset
|
651 msn_slpcall_destroy(slpcall); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 } |
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 static gchar * |
28830
24b341ae63f7
msn: Use the PurpleXfer size if available.
Paul Aurich <paul@darkrain42.org>
parents:
28799
diff
changeset
|
656 gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 gsize size = 0; |
29815
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
659 MsnFileContext *header; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 gchar *u8 = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 gchar *ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 gunichar2 *uni = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 glong currentChar = 0; |
29494
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29072
diff
changeset
|
664 glong len = 0; |
29815
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
665 const char *preview; |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
666 gsize preview_len; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 |
28839
932f16167621
I already removed the other g_stat, so I don't think this one is needed
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28830
diff
changeset
|
668 size = purple_xfer_get_size(xfer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 |
29823
79bb2804a19e
Set desired image formats for thumbnails as a parameter to
Marcus Lundblad <ml@update.uu.se>
parents:
29819
diff
changeset
|
670 purple_xfer_prepare_thumbnail(xfer, "png"); |
29815
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
671 |
29494
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29072
diff
changeset
|
672 if (!file_name) { |
26862
c69a2e88fee3
Fix a signed-ness warning.
Paul Aurich <paul@darkrain42.org>
parents:
26778
diff
changeset
|
673 gchar *basename = g_path_get_basename(file_path); |
c69a2e88fee3
Fix a signed-ness warning.
Paul Aurich <paul@darkrain42.org>
parents:
26778
diff
changeset
|
674 u8 = purple_utf8_try_convert(basename); |
c69a2e88fee3
Fix a signed-ness warning.
Paul Aurich <paul@darkrain42.org>
parents:
26778
diff
changeset
|
675 g_free(basename); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 file_name = u8; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 |
29494
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29072
diff
changeset
|
679 uni = g_utf8_to_utf16(file_name, -1, NULL, &len, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 |
29494
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29072
diff
changeset
|
681 if (u8) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 g_free(u8); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 file_name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 u8 = NULL; |
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 |
29835
afc9cec164e4
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29832
diff
changeset
|
687 preview = purple_xfer_get_thumbnail(xfer, &preview_len); |
29815
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
688 header = g_malloc(sizeof(MsnFileContext) + preview_len); |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
689 |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
690 header->length = GUINT32_TO_LE(sizeof(MsnFileContext) - 1); |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
691 header->version = GUINT32_TO_LE(2); /* V.3 contains additional unnecessary data */ |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
692 header->file_size = GUINT64_TO_LE(size); |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
693 if (preview) |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
694 header->type = GUINT32_TO_LE(0); |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
695 else |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
696 header->type = GUINT32_TO_LE(1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 |
29494
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29072
diff
changeset
|
698 len = MIN(len, MAX_FILE_NAME_LEN); |
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29072
diff
changeset
|
699 for (currentChar = 0; currentChar < len; currentChar++) { |
29815
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
700 header->file_name[currentChar] = GUINT16_TO_LE(uni[currentChar]); |
29494
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29072
diff
changeset
|
701 } |
29815
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
702 memset(&header->file_name[currentChar], 0x00, (MAX_FILE_NAME_LEN - currentChar) * 2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 |
29815
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
704 memset(&header->unknown1, 0, sizeof(header->unknown1)); |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
705 header->unknown2 = GUINT32_TO_LE(0xffffffff); |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
706 if (preview) { |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
707 memcpy(&header->preview, preview, preview_len); |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
708 } |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
709 header->preview[preview_len] = '\0'; |
15373
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 g_free(uni); |
29815
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
712 ret = purple_base64_encode((const guchar *)header, sizeof(MsnFileContext) + preview_len); |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29495
diff
changeset
|
713 g_free(header); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 void |
15822 | 718 msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 char *context; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 const char *fn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 const char *fp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 |
15822 | 725 fn = purple_xfer_get_filename(xfer); |
726 fp = purple_xfer_get_local_filename(xfer); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 g_return_if_fail(slplink != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 g_return_if_fail(fp != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 |
24398
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
731 slpcall = msn_slpcall_new(slplink); |
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
732 msn_slpcall_init(slpcall, MSN_SLPCALL_DC); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 slpcall->session_init_cb = send_file_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 slpcall->end_cb = msn_xfer_end_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 slpcall->cb = msn_xfer_completed_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 slpcall->xfer = xfer; |
17114
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:
17113
diff
changeset
|
738 purple_xfer_ref(slpcall->xfer); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 slpcall->pending = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 |
15822 | 742 purple_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel); |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
743 purple_xfer_set_read_fnc(xfer, msn_xfer_read); |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
744 purple_xfer_set_write_fnc(xfer, msn_xfer_write); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 xfer->data = slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 |
28830
24b341ae63f7
msn: Use the PurpleXfer size if available.
Paul Aurich <paul@darkrain42.org>
parents:
28799
diff
changeset
|
748 context = gen_context(xfer, fn, fp); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 |
24398
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
750 msn_slpcall_invite(slpcall, MSN_FT_GUID, 2, context); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 g_free(context); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 msn_slplink_request_object(MsnSlpLink *slplink, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 const char *info, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 MsnSlpCb cb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 MsnSlpEndCb end_cb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 const MsnObject *obj) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 char *msnobj_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 char *msnobj_base64; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 g_return_if_fail(slplink != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 g_return_if_fail(obj != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 msnobj_data = msn_object_to_string(obj); |
15822 | 770 msnobj_base64 = purple_base64_encode((const guchar *)msnobj_data, strlen(msnobj_data)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 g_free(msnobj_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 |
24398
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
773 slpcall = msn_slpcall_new(slplink); |
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
774 msn_slpcall_init(slpcall, MSN_SLPCALL_ANY); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 slpcall->data_info = g_strdup(info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 slpcall->cb = cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 slpcall->end_cb = end_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 |
24398
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
780 msn_slpcall_invite(slpcall, MSN_OBJ_GUID, 1, msnobj_base64); |
15373
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 g_free(msnobj_base64); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 } |