Mercurial > pidgin.yaz
annotate libpurple/protocols/msn/slplink.c @ 31233:22f26c372797
Manage sending messages trough switchboard in sbconn.
author | masca@cpw.pidgin.im |
---|---|
date | Tue, 15 Jun 2010 21:21:24 +0000 |
parents | 4481d04cda70 |
children | 0f26d510af1b |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file slplink.c MSNSLP Link support |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15823 | 4 * purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15823 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19653
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
31180
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
31174
diff
changeset
|
24 |
31196
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
31180
diff
changeset
|
25 #include "internal.h" |
31180
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
31174
diff
changeset
|
26 #include "debug.h" |
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
31174
diff
changeset
|
27 |
15374
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" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 |
31231
f84fb808e8ed
Move MsnMessage stuff out of slplink to SBConn.
masca@cpw.pidgin.im
parents:
31230
diff
changeset
|
31 #include "sbconn.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "switchboard.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "slp.h" |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
34 #include "p2p.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #ifdef MSN_DEBUG_SLP_FILES |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 static int m_sc = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 static int m_rc = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 debug_msg_to_file(MsnMessage *msg, gboolean send) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 char *dir; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 char *pload; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 int c; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 gsize pload_size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 dir = send ? "send" : "recv"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 c = send ? m_sc++ : m_rc++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c); |
21116
a3dc160d7914
Patch from eperez to fix some debug code, Fixes #3524
Ka-Hing Cheung <khc@hxbc.us>
parents:
20945
diff
changeset
|
52 pload = msn_message_gen_payload(msg, &pload_size); |
a3dc160d7914
Patch from eperez to fix some debug code, Fixes #3524
Ka-Hing Cheung <khc@hxbc.us>
parents:
20945
diff
changeset
|
53 if (!purple_util_write_data_to_file_absolute(tmp, pload, pload_size)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 { |
26587
0c796a1950b7
Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24965
diff
changeset
|
55 purple_debug_error("msn", "could not save debug file\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 |
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 * Main |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 |
23306
945bf99cb233
msn_slplink_new() is only used within slplink.c, so make it static and
Mark Doliner <mark@kingant.net>
parents:
22808
diff
changeset
|
65 static MsnSlpLink * |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 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
|
67 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 g_return_val_if_fail(session != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 slplink = g_new0(MsnSlpLink, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 |
27559
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27219
diff
changeset
|
74 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:
27219
diff
changeset
|
75 purple_debug_info("msn", "slplink_new: slplink(%p)\n", slplink); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 slplink->session = session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 slplink->remote_user = g_strdup(username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 slplink->slp_msg_queue = g_queue_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 session->slplinks = |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 g_list_append(session->slplinks, slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
30174
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
87 return msn_slplink_ref(slplink); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 msn_slplink_destroy(MsnSlpLink *slplink) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 MsnSession *session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 |
27559
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27219
diff
changeset
|
95 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:
27219
diff
changeset
|
96 purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 g_return_if_fail(slplink != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 |
30538
3f7f469ee1d0
NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30509
diff
changeset
|
100 if (slplink->swboard != NULL) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); |
30538
3f7f469ee1d0
NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30509
diff
changeset
|
102 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:
30509
diff
changeset
|
103 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 |
30174
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
105 if (slplink->refs > 1) { |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
106 slplink->refs--; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
107 return; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
108 } |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
109 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 session = slplink->session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 |
30508
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30497
diff
changeset
|
112 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:
30497
diff
changeset
|
113 slplink->dc->slplink = NULL; |
30466
e471c1fb9c49
It's probably a good idea to free the direct connection when the slplink
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30456
diff
changeset
|
114 msn_dc_destroy(slplink->dc); |
30508
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30497
diff
changeset
|
115 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:
30497
diff
changeset
|
116 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 while (slplink->slp_calls != NULL) |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24339
diff
changeset
|
119 msn_slpcall_destroy(slplink->slp_calls->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
20945 | 121 g_queue_free(slplink->slp_msg_queue); |
122 | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 session->slplinks = |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 g_list_remove(session->slplinks, slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
23735
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23671
diff
changeset
|
126 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:
23671
diff
changeset
|
127 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 g_free(slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 } |
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 MsnSlpLink * |
30174
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
132 msn_slplink_ref(MsnSlpLink *slplink) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
133 { |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
134 g_return_val_if_fail(slplink != NULL, NULL); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
135 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
136 slplink->refs++; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
137 if (purple_debug_is_verbose()) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
138 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:
29894
diff
changeset
|
139 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
140 return slplink; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
141 } |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
142 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
143 void |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
144 msn_slplink_unref(MsnSlpLink *slplink) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
145 { |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
146 g_return_if_fail(slplink != NULL); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
147 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
148 slplink->refs--; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
149 if (purple_debug_is_verbose()) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
150 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:
29894
diff
changeset
|
151 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
152 if (slplink->refs == 0) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
153 msn_slplink_destroy(slplink); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
154 } |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
155 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29894
diff
changeset
|
156 MsnSlpLink * |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 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
|
158 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 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
|
162 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 slplink = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 if (!strcmp(slplink->remote_user, who)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 return slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 MsnSlpLink * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 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
|
176 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 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
|
180 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
|
181 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 slplink = msn_session_find_slplink(session, username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 if (slplink == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 slplink = msn_slplink_new(session, username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 return slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 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
|
192 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 if (slplink->swboard != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 slplink->swboard->flag |= MSN_SB_FLAG_FT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall); |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
197 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
198 /* |
30435
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30434
diff
changeset
|
199 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
200 msn_dc_ref(slplink->dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
201 */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 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
|
206 { |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
207 /* |
30435
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30434
diff
changeset
|
208 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
209 msn_dc_unref(slplink->dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
210 */ |
30434 | 211 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 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
|
213 |
24338
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24336
diff
changeset
|
214 /* 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:
24336
diff
changeset
|
215 * 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:
24336
diff
changeset
|
216 * destroyed. */ |
30508
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30497
diff
changeset
|
217 if (slplink->slp_calls == NULL && slplink->swboard != NULL) { |
30553
a83167dd305c
And another one just like 94fa017925fa206fc36f520ee42c54f57429b4e1. But
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30548
diff
changeset
|
218 slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); |
24338
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24336
diff
changeset
|
219 msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT); |
30508
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30497
diff
changeset
|
220 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:
30497
diff
changeset
|
221 } |
30477
7a82bc59b63f
Close the DC when the slplink is empty.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30466
diff
changeset
|
222 |
7a82bc59b63f
Close the DC when the slplink is empty.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30466
diff
changeset
|
223 /* The slplink has no slpcalls in it, release it from the DC. */ |
30508
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30497
diff
changeset
|
224 if (slplink->slp_calls == NULL && slplink->dc != NULL) { |
30548
bc9f74e9f596
And another one of those reverse links. We don't want dc to automatically
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30538
diff
changeset
|
225 slplink->dc->slplink = NULL; |
30477
7a82bc59b63f
Close the DC when the slplink is empty.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30466
diff
changeset
|
226 msn_dc_destroy(slplink->dc); |
30508
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30497
diff
changeset
|
227 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:
30497
diff
changeset
|
228 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 } |
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 MsnSlpCall * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 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
|
233 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 if (!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 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
|
241 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 slpcall = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 if (slpcall->id && !strcmp(slpcall->id, id)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 return slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 } |
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 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 } |
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 MsnSlpCall * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 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
|
253 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 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
|
258 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 slpcall = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 if (slpcall->session_id == id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 return slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
30497
11e748b759a2
This is supposed to go along with the queue sending stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30488
diff
changeset
|
268 void |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 { |
30435
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30434
diff
changeset
|
271 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 { |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
273 msn_dc_enqueue_msg(slplink->dc, msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 { |
31233
22f26c372797
Manage sending messages trough switchboard in sbconn.
masca@cpw.pidgin.im
parents:
31232
diff
changeset
|
277 msn_sbconn_send_msg(slplink, msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 |
29073
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
281 void |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 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
|
283 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 MsnMessage *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 long long real_size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 size_t len = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 /* 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
|
289 * reusing the same one all the time. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 msg = slpmsg->msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
292 real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 if (slpmsg->offset < real_size) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 { |
29073
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
296 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:
28346
diff
changeset
|
297 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:
28346
diff
changeset
|
298 { |
31232 | 299 len = MIN(MSN_SBCONN_MAX_SIZE, slpmsg->slpcall->u.outgoing.len); |
29073
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
300 msn_message_set_bin_data(msg, slpmsg->slpcall->u.outgoing.data, len); |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
301 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 len = slpmsg->size - slpmsg->offset; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 |
31232 | 306 if (len > MSN_SBCONN_MAX_SIZE) |
307 len = MSN_SBCONN_MAX_SIZE; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
31222
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
312 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:
31217
diff
changeset
|
313 slpmsg->header->length = len; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 |
27559
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27219
diff
changeset
|
316 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:
27219
diff
changeset
|
317 msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 #ifdef MSN_DEBUG_SLP_FILES |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 debug_msg_to_file(msg, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 slpmsg->msgs = |
30509
287fc4ac2bd9
Add and remove an extra ref per MsnMessage when saving it in a slpmsg, to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30508
diff
changeset
|
324 g_list_append(slpmsg->msgs, msn_message_ref(msg)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 msn_slplink_send_msg(slplink, msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
327 if ((slpmsg->flags == P2P_MSN_OBJ_DATA || |
31214
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
31205
diff
changeset
|
328 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
329 slpmsg->flags == P2P_FILE_DATA) && |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 (slpmsg->slpcall != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 slpmsg->slpcall->progress = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 if (slpmsg->slpcall->progress_cb != 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_cb(slpmsg->slpcall, slpmsg->size, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 len, slpmsg->offset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 /* slpmsg->offset += len; */ |
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 |
24346
89cb1c13036e
Make another function static
Mark Doliner <mark@kingant.net>
parents:
24345
diff
changeset
|
344 static void |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 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
|
346 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 MsnMessage *msg; |
30334
94c380160595
Normalize the remote passport before sending a P2P message. If it's not
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30314
diff
changeset
|
348 const char *passport; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 slpmsg->msg = msg = msn_message_new_msnslp(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 |
31222
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
352 msg->slpmsg = slpmsg; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
353 msg->slpmsg->header = g_new0(MsnP2PHeader, 1); |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
354 msg->slpmsg->footer = g_new0(MsnP2PFooter, 1); |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
355 |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
356 if (slpmsg->flags == P2P_NO_FLAG) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 { |
31222
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
358 msg->slpmsg->header->session_id = slpmsg->session_id; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
359 msg->slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 } |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
361 else if (slpmsg->flags == P2P_ACK) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 { |
31222
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
363 msg->slpmsg->header->session_id = slpmsg->session_id; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
364 msg->slpmsg->header->ack_id = slpmsg->ack_id; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
365 msg->slpmsg->header->ack_size = slpmsg->ack_size; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
366 msg->slpmsg->header->ack_sub_id = slpmsg->ack_sub_id; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 } |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
368 else if (slpmsg->flags == P2P_MSN_OBJ_DATA || |
31214
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
31205
diff
changeset
|
369 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
370 slpmsg->flags == P2P_FILE_DATA) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 { |
23671
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
372 MsnSlpCall *slpcall; |
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
373 slpcall = slpmsg->slpcall; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 |
23671
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
375 g_return_if_fail(slpcall != NULL); |
31222
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
376 msg->slpmsg->header->session_id = slpcall->session_id; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
377 msg->slpmsg->footer->value = slpcall->app_id; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
378 msg->slpmsg->header->ack_id = rand() % 0xFFFFFF00; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 else if (slpmsg->flags == 0x100) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 { |
31222
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
382 msg->slpmsg->header->ack_id = slpmsg->ack_id; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
383 msg->slpmsg->header->ack_sub_id = slpmsg->ack_sub_id; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
384 msg->slpmsg->header->ack_size = slpmsg->ack_size; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 |
31222
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
387 msg->slpmsg->header->id = slpmsg->id; |
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
388 msg->slpmsg->header->flags = (guint32)slpmsg->flags; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 |
31222
320c0852b5cc
Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents:
31217
diff
changeset
|
390 msg->slpmsg->header->total_size = slpmsg->size; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 |
30334
94c380160595
Normalize the remote passport before sending a P2P message. If it's not
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30314
diff
changeset
|
392 passport = purple_normalize(slplink->session->account, slplink->remote_user); |
31173
66e7fe9f7810
propagate from branch 'im.pidgin.pidgin' (head cd770a44f05f96d1e74ea761e614d1a468ba60df)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
393 msn_message_set_header(msg, "P2P-Dest", passport); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 |
31231
f84fb808e8ed
Move MsnMessage stuff out of slplink to SBConn.
masca@cpw.pidgin.im
parents:
31230
diff
changeset
|
395 msg->ack_cb = msn_sbconn_msg_ack; |
f84fb808e8ed
Move MsnMessage stuff out of slplink to SBConn.
masca@cpw.pidgin.im
parents:
31230
diff
changeset
|
396 msg->nak_cb = msn_sbconn_msg_nak; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 msg->ack_data = slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 msn_slplink_send_msgpart(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 msn_message_destroy(msg); |
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_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 { |
24963
36897ddd3e08
This should prevent the crash in #8109 by stopping an invalid message from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24346
diff
changeset
|
407 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:
24346
diff
changeset
|
408 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 slpmsg->id = slplink->slp_seq_id++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 |
24345
b9e09053e53a
This doesn't matter, but I think the metaphor tends to be that you push
Mark Doliner <mark@kingant.net>
parents:
24344
diff
changeset
|
411 g_queue_push_tail(slplink->slp_msg_queue, slpmsg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 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
|
416 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 slpmsg->id = slplink->slp_seq_id++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 msn_slplink_release_slpmsg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 void |
24344
bceefbae1ca6
Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents:
24341
diff
changeset
|
423 msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 MsnSlpMessage *slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 |
24344
bceefbae1ca6
Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents:
24341
diff
changeset
|
427 /* Send the queued msgs in the order they were created */ |
24345
b9e09053e53a
This doesn't matter, but I think the metaphor tends to be that you push
Mark Doliner <mark@kingant.net>
parents:
24344
diff
changeset
|
428 while ((slpmsg = g_queue_pop_head(slplink->slp_msg_queue)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 msn_slplink_release_slpmsg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
434 static MsnSlpMessage * |
31205 | 435 msn_slplink_create_ack(MsnSlpLink *slplink, MsnP2PHeader *header) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 MsnSlpMessage *slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 |
31230 | 439 slpmsg = msn_slpmsg_ack_new(header); |
31228
545fa069c531
The creation of SlpMessage must be done in its own module.
masca@cpw.pidgin.im
parents:
31222
diff
changeset
|
440 msn_slpmsg_set_slplink(slpmsg, slplink); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
442 return slpmsg; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
443 } |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
444 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
445 static void |
31205 | 446 msn_slplink_send_ack(MsnSlpLink *slplink, MsnP2PHeader *header) |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
447 { |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
448 MsnSlpMessage *slpmsg = msn_slplink_create_ack(slplink, header); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
449 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 msn_slplink_send_slpmsg(slplink, slpmsg); |
28287
4200554dd0fc
Patch written by Mark Doliner and Paul Aurich to fix a remote crash on MSN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28232
diff
changeset
|
451 msn_slpmsg_destroy(slpmsg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 static void |
23671
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
455 send_file_cb(MsnSlpCall *slpcall) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 MsnSlpMessage *slpmsg; |
17065
21830d70709b
Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
458 PurpleXfer *xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 |
29177
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29176
diff
changeset
|
460 xfer = (PurpleXfer *)slpcall->xfer; |
30488
dbe96260108c
It seems like aMSN can get a bit stuck when using multiple file transfers,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
461 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:
30481
diff
changeset
|
462 return; |
dbe96260108c
It seems like aMSN can get a bit stuck when using multiple file transfers,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30481
diff
changeset
|
463 |
29177
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29176
diff
changeset
|
464 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:
29176
diff
changeset
|
465 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:
29176
diff
changeset
|
466 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:
29176
diff
changeset
|
467 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:
29176
diff
changeset
|
468 return; |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29176
diff
changeset
|
469 } |
bffe098efca2
Calling purple_xfer_start may actually cancel the transfer (if the file
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29176
diff
changeset
|
470 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:
29176
diff
changeset
|
471 |
31230 | 472 slpmsg = msn_slpmsg_file_new(slpcall, purple_xfer_get_size(xfer)); |
31229
64a6ce55aa63
Move more SlpMessage creation to its module.
masca@cpw.pidgin.im
parents:
31228
diff
changeset
|
473 msn_slpmsg_set_slplink(slpmsg, slpcall->slplink); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 |
24339
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
478 static MsnSlpMessage * |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
479 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:
24338
diff
changeset
|
480 { |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
481 GList *e; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
482 |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
483 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:
24338
diff
changeset
|
484 { |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
485 MsnSlpMessage *slpmsg = e->data; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
486 |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
487 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:
24338
diff
changeset
|
488 return slpmsg; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
489 } |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
490 |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
491 return NULL; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
492 } |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24338
diff
changeset
|
493 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 void |
31205 | 495 msn_slplink_process_msg(MsnSlpLink *slplink, MsnP2PHeader *header, const char *data, gsize len) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 MsnSlpMessage *slpmsg; |
25883
9931796e1765
*** Plucked rev 9dd1c4c3 (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24965
diff
changeset
|
498 guint64 offset; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
500 if (header->total_size < header->length) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 { |
31135
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
31132
diff
changeset
|
502 /* We seem to have received a bad header */ |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
31132
diff
changeset
|
503 purple_debug_warning("msn", "Total size listed in SLP binary header " |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
31132
diff
changeset
|
504 "was less than length of this particular message. This " |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
31132
diff
changeset
|
505 "should not happen. Dropping message.\n"); |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
31132
diff
changeset
|
506 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
509 offset = header->offset; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 if (offset == 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 slpmsg = msn_slpmsg_new(slplink); |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
514 slpmsg->id = header->id; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
515 slpmsg->session_id = header->session_id; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
516 slpmsg->size = header->total_size; |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
517 slpmsg->flags = header->flags; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 if (slpmsg->session_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 { |
31136
24f371e16a51
We just allocated slpmsg, so of course slpmsg->slpcall will be NULL here
Mark Doliner <mark@kingant.net>
parents:
31135
diff
changeset
|
521 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 if (slpmsg->slpcall != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 { |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
524 if (slpmsg->flags == P2P_MSN_OBJ_DATA || |
31214
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
31205
diff
changeset
|
525 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
526 slpmsg->flags == P2P_FILE_DATA) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 { |
31135
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
31132
diff
changeset
|
528 PurpleXfer *xfer = slpmsg->slpcall->xfer; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 if (xfer != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 { |
29073
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
531 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:
28346
diff
changeset
|
532 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:
28346
diff
changeset
|
533 |
23719
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23671
diff
changeset
|
534 purple_xfer_ref(xfer); |
28218
6adbdd4b2963
ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents:
28088
diff
changeset
|
535 purple_xfer_start(xfer, -1, NULL, 0); |
23719
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23671
diff
changeset
|
536 |
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23671
diff
changeset
|
537 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:
23671
diff
changeset
|
538 purple_xfer_unref(xfer); |
28088
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:
27559
diff
changeset
|
539 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:
27559
diff
changeset
|
540 g_return_if_reached(); |
23719
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23671
diff
changeset
|
541 } else { |
7b2fdeb078cd
take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents:
23671
diff
changeset
|
542 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:
23671
diff
changeset
|
543 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 } |
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 } |
29075
6aea98f6a5cd
Get rid of slpmsg->fp since the core is handling all the partial reads and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29073
diff
changeset
|
548 if (!slpmsg->ft && slpmsg->size) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 slpmsg->buffer = g_try_malloc(slpmsg->size); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 if (slpmsg->buffer == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 { |
15823 | 553 purple_debug_error("msn", "Failed to allocate buffer for slpmsg\n"); |
25883
9931796e1765
*** Plucked rev 9dd1c4c3 (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24965
diff
changeset
|
554 msn_slpmsg_destroy(slpmsg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 { |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
561 slpmsg = msn_slplink_message_find(slplink, header->session_id, header->id); |
28232
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
28218
diff
changeset
|
562 if (slpmsg == NULL) |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
28218
diff
changeset
|
563 { |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
28218
diff
changeset
|
564 /* 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:
28218
diff
changeset
|
565 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:
28218
diff
changeset
|
566 return; |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
28218
diff
changeset
|
567 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 |
29075
6aea98f6a5cd
Get rid of slpmsg->fp since the core is handling all the partial reads and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29073
diff
changeset
|
570 if (slpmsg->ft) |
29073
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
571 { |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
572 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:
28346
diff
changeset
|
573 g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)data, len); |
31135
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
31132
diff
changeset
|
574 purple_xfer_prpl_ready(slpmsg->slpcall->xfer); |
29073
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
575 } |
28287
4200554dd0fc
Patch written by Mark Doliner and Paul Aurich to fix a remote crash on MSN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28232
diff
changeset
|
576 else if (slpmsg->size && slpmsg->buffer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 { |
29466
69077f3993f6
Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents:
29223
diff
changeset
|
578 if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size || slpmsg->offset != offset) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 { |
22798
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22551
diff
changeset
|
580 purple_debug_error("msn", |
27007
e45fe73b47e3
Fix two warnings when building on OS X
Paul Aurich <paul@darkrain42.org>
parents:
26944
diff
changeset
|
581 "Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n", |
22798
05cb3f04c01e
This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22551
diff
changeset
|
582 slpmsg->size, offset, len); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 g_return_if_reached(); |
29466
69077f3993f6
Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents:
29223
diff
changeset
|
584 } else { |
69077f3993f6
Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents:
29223
diff
changeset
|
585 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:
29223
diff
changeset
|
586 slpmsg->offset += len; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 } |
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 |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
590 if ((slpmsg->flags == P2P_MSN_OBJ_DATA || |
31214
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
31205
diff
changeset
|
591 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
592 slpmsg->flags == P2P_FILE_DATA) && |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 (slpmsg->slpcall != NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 slpmsg->slpcall->progress = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 if (slpmsg->slpcall->progress_cb != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 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
|
600 len, offset); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 if (slpmsg->buffer == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
609 if (header->offset + header->length >= header->total_size) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 /* 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
|
612 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 slpcall = msn_slp_process_msg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 |
29179
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:
29177
diff
changeset
|
616 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:
29177
diff
changeset
|
617 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:
29177
diff
changeset
|
618 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:
29177
diff
changeset
|
619 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 |
30433
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29894
diff
changeset
|
621 purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n"); |
29179
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:
29177
diff
changeset
|
622 |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
623 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:
30435
diff
changeset
|
624 { |
20431
67cda4e0dac8
Finish commenting out references to directconn that would never be called
Stu Tomlinson <stu@nosnilmot.com>
parents:
20426
diff
changeset
|
625 #if 0 |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
626 MsnDirectConn *directconn; |
29179
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:
29177
diff
changeset
|
627 |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
628 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:
30435
diff
changeset
|
629 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:
30435
diff
changeset
|
630 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
|
631 #endif |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
632 } |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
633 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:
31198
diff
changeset
|
634 slpmsg->flags == P2P_MSN_OBJ_DATA || |
31214
432e3331f607
Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents:
31205
diff
changeset
|
635 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) || |
31200
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
31198
diff
changeset
|
636 slpmsg->flags == P2P_FILE_DATA) |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
637 { |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
638 /* Release all the messages and send the ACK */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
640 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:
30435
diff
changeset
|
641 /* |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
642 * 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:
30435
diff
changeset
|
643 * 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:
30435
diff
changeset
|
644 * 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:
30435
diff
changeset
|
645 * created yet. |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
646 */ |
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
647 purple_debug_info("msn", "msn_slplink_process_msg: save ACK\n"); |
30434 | 648 |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
649 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:
30435
diff
changeset
|
650 } 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:
30435
diff
changeset
|
651 purple_debug_info("msn", "msn_slplink_process_msg: send ACK\n"); |
30434 | 652 |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
653 msn_slplink_send_ack(slplink, header); |
29179
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:
29177
diff
changeset
|
654 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:
29177
diff
changeset
|
655 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 } |
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 msn_slpmsg_destroy(slpmsg); |
29181
bcea7c92d3f1
Oops, don't break things for successfully receiving of a file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29180
diff
changeset
|
659 |
30448
911ca152210c
Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30435
diff
changeset
|
660 if (!slpcall->wait_for_socket && slpcall->wasted) |
29181
bcea7c92d3f1
Oops, don't break things for successfully receiving of a file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29180
diff
changeset
|
661 msn_slpcall_destroy(slpcall); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 static gchar * |
29214
24b341ae63f7
msn: Use the PurpleXfer size if available.
Paul Aurich <paul@darkrain42.org>
parents:
29181
diff
changeset
|
666 gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 gsize size = 0; |
30230
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
669 MsnFileContext *header; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 gchar *u8 = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 gchar *ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 gunichar2 *uni = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 glong currentChar = 0; |
29892
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29466
diff
changeset
|
674 glong len = 0; |
30230
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
675 const char *preview; |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
676 gsize preview_len; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 |
29223
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:
29214
diff
changeset
|
678 size = purple_xfer_get_size(xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 |
30238
79bb2804a19e
Set desired image formats for thumbnails as a parameter to
Marcus Lundblad <ml@update.uu.se>
parents:
30234
diff
changeset
|
680 purple_xfer_prepare_thumbnail(xfer, "png"); |
30230
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
681 |
29892
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29466
diff
changeset
|
682 if (!file_name) { |
26944
c69a2e88fee3
Fix a signed-ness warning.
Paul Aurich <paul@darkrain42.org>
parents:
26860
diff
changeset
|
683 gchar *basename = g_path_get_basename(file_path); |
c69a2e88fee3
Fix a signed-ness warning.
Paul Aurich <paul@darkrain42.org>
parents:
26860
diff
changeset
|
684 u8 = purple_utf8_try_convert(basename); |
c69a2e88fee3
Fix a signed-ness warning.
Paul Aurich <paul@darkrain42.org>
parents:
26860
diff
changeset
|
685 g_free(basename); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 file_name = u8; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 |
29892
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29466
diff
changeset
|
689 uni = g_utf8_to_utf16(file_name, -1, NULL, &len, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 |
29892
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29466
diff
changeset
|
691 if (u8) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 g_free(u8); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 file_name = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 u8 = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 |
30250
afc9cec164e4
Rename purple_xfer_get_thumbnail_data/size to be more D-Bus friendly.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30247
diff
changeset
|
697 preview = purple_xfer_get_thumbnail(xfer, &preview_len); |
30230
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
698 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:
29893
diff
changeset
|
699 |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
700 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:
29893
diff
changeset
|
701 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:
29893
diff
changeset
|
702 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:
29893
diff
changeset
|
703 if (preview) |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
704 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:
29893
diff
changeset
|
705 else |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
706 header->type = GUINT32_TO_LE(1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 |
29892
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29466
diff
changeset
|
708 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:
29466
diff
changeset
|
709 for (currentChar = 0; currentChar < len; currentChar++) { |
30230
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
710 header->file_name[currentChar] = GUINT16_TO_LE(uni[currentChar]); |
29892
1a9977557dc9
I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29466
diff
changeset
|
711 } |
30230
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
712 memset(&header->file_name[currentChar], 0x00, (MAX_FILE_NAME_LEN - currentChar) * 2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 |
30230
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
714 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:
29893
diff
changeset
|
715 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:
29893
diff
changeset
|
716 if (preview) { |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
717 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:
29893
diff
changeset
|
718 } |
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
719 header->preview[preview_len] = '\0'; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 g_free(uni); |
30230
3175b89c5156
Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29893
diff
changeset
|
722 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:
29893
diff
changeset
|
723 g_free(header); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 void |
15823 | 728 msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 char *context; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 const char *fn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 const char *fp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 |
15823 | 735 fn = purple_xfer_get_filename(xfer); |
736 fp = purple_xfer_get_local_filename(xfer); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 g_return_if_fail(slplink != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 g_return_if_fail(fp != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24339
diff
changeset
|
741 slpcall = msn_slpcall_new(slplink); |
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24339
diff
changeset
|
742 msn_slpcall_init(slpcall, MSN_SLPCALL_DC); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 slpcall->session_init_cb = send_file_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 slpcall->end_cb = msn_xfer_end_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 slpcall->cb = msn_xfer_completed_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 slpcall->xfer = xfer; |
17137
8ed7b2d32ad1
slpcall now explicitlt references its xfer and unreferences it when it is destroyed. While it *looks* like this should *probably* have happened anyways due to the interactins between xfer_init, xfer_end, and xfer_cancel_remote, having the xfer's owner make this explicit makes the process less fragile and more obvious, and it may fix a crash as the slp is destroyed. Fixes #1070
Evan Schoenberg <evan.s@dreskin.net>
parents:
17136
diff
changeset
|
748 purple_xfer_ref(slpcall->xfer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 slpcall->pending = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 |
15823 | 752 purple_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel); |
29073
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
28346
diff
changeset
|
753 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:
28346
diff
changeset
|
754 purple_xfer_set_write_fnc(xfer, msn_xfer_write); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 xfer->data = slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 |
29214
24b341ae63f7
msn: Use the PurpleXfer size if available.
Paul Aurich <paul@darkrain42.org>
parents:
29181
diff
changeset
|
758 context = gen_context(xfer, fn, fp); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24339
diff
changeset
|
760 msn_slpcall_invite(slpcall, MSN_FT_GUID, 2, context); |
15374
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 g_free(context); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 msn_slplink_request_object(MsnSlpLink *slplink, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 const char *info, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 MsnSlpCb cb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 MsnSlpEndCb end_cb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 const MsnObject *obj) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 char *msnobj_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 char *msnobj_base64; |
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 g_return_if_fail(slplink != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 g_return_if_fail(obj != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 msnobj_data = msn_object_to_string(obj); |
15823 | 780 msnobj_base64 = purple_base64_encode((const guchar *)msnobj_data, strlen(msnobj_data)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 g_free(msnobj_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24339
diff
changeset
|
783 slpcall = msn_slpcall_new(slplink); |
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24339
diff
changeset
|
784 msn_slpcall_init(slpcall, MSN_SLPCALL_ANY); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 slpcall->data_info = g_strdup(info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 slpcall->cb = cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 slpcall->end_cb = end_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 |
24341
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24339
diff
changeset
|
790 msn_slpcall_invite(slpcall, MSN_OBJ_GUID, 1, msnobj_base64); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 g_free(msnobj_base64); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 } |