Mercurial > pidgin
annotate libpurple/protocols/msn/slplink.c @ 32794:9350878c0b38
I'm planning to release tomorrow
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 06 May 2012 06:08:40 +0000 |
parents | 1e657ff2eacb |
children | 92711688c245 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file slplink.c MSNSLP Link support |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15822 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19654
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
30742
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30736
diff
changeset
|
24 |
30758
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
30742
diff
changeset
|
25 #include "internal.h" |
30742
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30736
diff
changeset
|
26 #include "debug.h" |
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
30736
diff
changeset
|
27 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "msn.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "slplink.h" |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
30 #include "slpmsg_part.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 |
30793
f84fb808e8ed
Move MsnMessage stuff out of slplink to SBConn.
masca@cpw.pidgin.im
parents:
30792
diff
changeset
|
32 #include "sbconn.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "switchboard.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "slp.h" |
30762
e03f912141dd
Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents:
30760
diff
changeset
|
35 #include "p2p.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #ifdef MSN_DEBUG_SLP_FILES |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 static int m_sc = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 static int m_rc = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 static void |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
42 debug_part_to_file(MsnSlpMessage *msg, gboolean send) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 char *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 char *dir; |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
46 char *data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 int c; |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
48 gsize data_size; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 dir = send ? "send" : "recv"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 c = send ? m_sc++ : m_rc++; |
31035
fa9b2cf68b9b
Not that anyone uses this, but it should probably go in the user's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30974
diff
changeset
|
52 tmp = g_strdup_printf("%s/msntest/%s/%03d", purple_user_dir(), dir, c); |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
53 data = msn_slpmsg_serialize(msg, &data_size); |
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
54 if (!purple_util_write_data_to_file_absolute(tmp, data, data_size)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 { |
26505
0c796a1950b7
Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25335
diff
changeset
|
56 purple_debug_error("msn", "could not save debug file\n"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 * Main |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 |
23304
945bf99cb233
msn_slplink_new() is only used within slplink.c, so make it static and
Mark Doliner <mark@kingant.net>
parents:
22832
diff
changeset
|
66 static MsnSlpLink * |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 msn_slplink_new(MsnSession *session, const char *username) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 g_return_val_if_fail(session != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 slplink = g_new0(MsnSlpLink, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
27483
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
75 if (purple_debug_is_verbose()) |
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
76 purple_debug_info("msn", "slplink_new: slplink(%p)\n", slplink); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 slplink->session = session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 slplink->remote_user = g_strdup(username); |
31584
cf702c6ab9e7
Getting the P2P version is probably the slplink's job, since it has
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31574
diff
changeset
|
82 slplink->p2p_version = MSN_P2P_VERSION_ONE; |
15373
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 slplink->slp_msg_queue = g_queue_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 session->slplinks = |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 g_list_append(session->slplinks, slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
29762
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
89 return msn_slplink_ref(slplink); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 |
30830
e935d15725c3
Hide msn_slplink_destroy and use the unref version everywhere.
masca@cpw.pidgin.im
parents:
30828
diff
changeset
|
92 static void |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 msn_slplink_destroy(MsnSlpLink *slplink) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 MsnSession *session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
27483
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
97 if (purple_debug_is_verbose()) |
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
98 purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 |
30114
3f7f469ee1d0
NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30089
diff
changeset
|
100 if (slplink->swboard != NULL) { |
15373
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); |
30114
3f7f469ee1d0
NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30089
diff
changeset
|
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:
30089
diff
changeset
|
103 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 session = slplink->session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
107 if (slplink->dc != NULL) { |
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
108 slplink->dc->slplink = NULL; |
30046
e471c1fb9c49
It's probably a good idea to free the direct connection when the slplink
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30036
diff
changeset
|
109 msn_dc_destroy(slplink->dc); |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
110 slplink->dc = NULL; |
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
111 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 while (slplink->slp_calls != NULL) |
24398
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
114 msn_slpcall_destroy(slplink->slp_calls->data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 |
20945 | 116 g_queue_free(slplink->slp_msg_queue); |
117 | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 session->slplinks = |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 g_list_remove(session->slplinks, slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
23677
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23626
diff
changeset
|
121 g_free(slplink->remote_user); |
331effbd1cc8
Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23626
diff
changeset
|
122 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 g_free(slplink); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 MsnSlpLink * |
29762
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
127 msn_slplink_ref(MsnSlpLink *slplink) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
128 { |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
129 g_return_val_if_fail(slplink != NULL, NULL); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
130 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
131 slplink->refs++; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
132 if (purple_debug_is_verbose()) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
133 purple_debug_info("msn", "slplink ref (%p)[%d]\n", slplink, slplink->refs); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
134 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
135 return slplink; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
136 } |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
137 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
138 void |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
139 msn_slplink_unref(MsnSlpLink *slplink) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
140 { |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
141 g_return_if_fail(slplink != NULL); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
142 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
143 slplink->refs--; |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
144 if (purple_debug_is_verbose()) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
145 purple_debug_info("msn", "slplink unref (%p)[%d]\n", slplink, slplink->refs); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
146 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
147 if (slplink->refs == 0) |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
148 msn_slplink_destroy(slplink); |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
149 } |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
150 |
b0bc67f42027
Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29496
diff
changeset
|
151 MsnSlpLink * |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 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
|
153 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 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
|
157 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 MsnSlpLink *slplink; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 slplink = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 if (!strcmp(slplink->remote_user, who)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 return 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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 MsnSlpLink * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 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
|
171 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 MsnSlpLink *slplink; |
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 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
|
175 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
|
176 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 slplink = msn_session_find_slplink(session, username); |
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 if (slplink == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 slplink = msn_slplink_new(session, username); |
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 return slplink; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 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
|
187 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 if (slplink->swboard != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 slplink->swboard->flag |= MSN_SB_FLAG_FT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall); |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
192 |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
193 /* |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
194 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
195 msn_dc_ref(slplink->dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
196 */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 { |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
202 /* |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
203 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
204 msn_dc_unref(slplink->dc); |
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
205 */ |
30014 | 206 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 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
|
208 |
24395
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24393
diff
changeset
|
209 /* The slplink has no slpcalls in it, release it from MSN_SB_FLAG_FT. |
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24393
diff
changeset
|
210 * If nothing else is using it then this might cause swboard to be |
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24393
diff
changeset
|
211 * destroyed. */ |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
212 if (slplink->slp_calls == NULL && slplink->swboard != NULL) { |
30129
a83167dd305c
And another one just like 94fa017925fa206fc36f520ee42c54f57429b4e1. But
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30124
diff
changeset
|
213 slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); |
24395
9b253ce969d0
msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents:
24393
diff
changeset
|
214 msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT); |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
215 slplink->swboard = NULL; |
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
216 } |
30057
7a82bc59b63f
Close the DC when the slplink is empty.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30046
diff
changeset
|
217 |
30238
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
218 if (slplink->dc != NULL) { |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
219 if ((slplink->dc->state != DC_STATE_ESTABLISHED && slplink->dc->slpcall == slpcall) |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
220 || (slplink->slp_calls == NULL)) { |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
221 /* The DC is not established and its corresponding slpcall is dead, |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
222 * or the slplink has no slpcalls in it and no longer needs the DC. |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
223 */ |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
224 slplink->dc->slplink = NULL; |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
225 msn_dc_destroy(slplink->dc); |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
226 slplink->dc = NULL; |
8c1a2ef5a713
Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30129
diff
changeset
|
227 } |
30088
e432507151d1
NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30077
diff
changeset
|
228 } |
15373
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 |
31584
cf702c6ab9e7
Getting the P2P version is probably the slplink's job, since it has
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31574
diff
changeset
|
268 MsnP2PVersion |
cf702c6ab9e7
Getting the P2P version is probably the slplink's job, since it has
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31574
diff
changeset
|
269 msn_slplink_get_p2p_version(MsnSlpLink *slplink) |
cf702c6ab9e7
Getting the P2P version is probably the slplink's job, since it has
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31574
diff
changeset
|
270 { |
cf702c6ab9e7
Getting the P2P version is probably the slplink's job, since it has
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31574
diff
changeset
|
271 return slplink->p2p_version; |
cf702c6ab9e7
Getting the P2P version is probably the slplink's job, since it has
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31574
diff
changeset
|
272 } |
cf702c6ab9e7
Getting the P2P version is probably the slplink's job, since it has
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31574
diff
changeset
|
273 |
30856
9f41998d4fcc
Fix a warning about a static function.
masca@cpw.pidgin.im
parents:
30855
diff
changeset
|
274 static void |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
275 msn_slplink_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 { |
30015
bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30014
diff
changeset
|
277 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 { |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
279 msn_dc_enqueue_part(slplink->dc, part); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 { |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
283 msn_sbconn_send_part(slplink, part); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
287 void |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 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
|
289 { |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
290 MsnSlpMessagePart *part; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
291 MsnP2PInfo *info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 long long real_size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 size_t len = 0; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
294 guint64 offset; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 /* 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
|
297 * reusing the same one all the time. */ |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
298 info = slpmsg->p2p_info; |
31319
8cf9270acf4c
Add a maximum length when parsing the P2P wire data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31151
diff
changeset
|
299 part = msn_slpmsgpart_new(msn_p2p_info_dup(info)); |
30805
dfada77da5cb
Reomove MsnMessage reference from DirectConn.
masca@cpw.pidgin.im
parents:
30802
diff
changeset
|
300 part->ack_data = slpmsg; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 |
31569
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
302 real_size = msn_p2p_info_is_ack(info) ? 0 : slpmsg->size; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
304 offset = msn_p2p_info_get_offset(info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
305 if (offset < real_size) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 { |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
307 if (slpmsg->slpcall && slpmsg->slpcall->xfer && purple_xfer_get_type(slpmsg->slpcall->xfer) == PURPLE_XFER_SEND && |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
308 purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED) |
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
309 { |
30794 | 310 len = MIN(MSN_SBCONN_MAX_SIZE, slpmsg->slpcall->u.outgoing.len); |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
311 msn_slpmsgpart_set_bin_data(part, slpmsg->slpcall->u.outgoing.data, len); |
28691
59b0c556f787
A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents:
27996
diff
changeset
|
312 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 { |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
315 len = slpmsg->size - offset; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 |
30794 | 317 if (len > MSN_SBCONN_MAX_SIZE) |
318 len = MSN_SBCONN_MAX_SIZE; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
320 msn_slpmsgpart_set_bin_data(part, slpmsg->buffer + offset, len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
323 msn_p2p_info_set_length(slpmsg->p2p_info, len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
326 #if 0 |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
327 /* TODO: port this function to SlpMessageParts */ |
27483
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
328 if (purple_debug_is_verbose()) |
3dcc42d3cc12
Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27137
diff
changeset
|
329 msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 #endif |
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 #ifdef MSN_DEBUG_SLP_FILES |
30826
f4c86572e745
Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents:
30808
diff
changeset
|
333 debug_part_to_file(slpmsg, TRUE); |
30808
07a9356ad2e0
Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents:
30805
diff
changeset
|
334 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 |
30802
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
336 slpmsg->parts = g_list_append(slpmsg->parts, part); |
0f26d510af1b
SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents:
30795
diff
changeset
|
337 msn_slplink_send_part(slplink, part); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 |
30868
5964f65c17ed
Avoid duplicated code using a util function to check the flags.
masca@cpw.pidgin.im
parents:
30867
diff
changeset
|
339 |
31569
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
340 if (msn_p2p_msg_is_data(info) && slpmsg->slpcall != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 slpmsg->slpcall->progress = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 if (slpmsg->slpcall->progress_cb != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, |
31585
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
347 len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 /* slpmsg->offset += len; */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 |
24403
89cb1c13036e
Make another function static
Mark Doliner <mark@kingant.net>
parents:
24402
diff
changeset
|
354 static void |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 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
|
356 { |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
357 MsnP2PInfo *info; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
358 guint32 flags; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
359 |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
360 info = slpmsg->p2p_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
362 flags = msn_p2p_info_get_flags(info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
363 if (flags == P2P_NO_FLAG) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 { |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
365 msn_p2p_info_set_ack_id(info, rand() % 0xFFFFFF00); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
31569
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
367 else if (msn_p2p_msg_is_data(info)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 { |
23626
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23510
diff
changeset
|
369 MsnSlpCall *slpcall; |
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23510
diff
changeset
|
370 slpcall = slpmsg->slpcall; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 |
23626
96e78c0fa32b
Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23510
diff
changeset
|
372 g_return_if_fail(slpcall != NULL); |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
373 msn_p2p_info_set_session_id(info, slpcall->session_id); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
374 msn_p2p_info_set_app_id(info, slpcall->app_id); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
375 msn_p2p_info_set_ack_id(info, rand() % 0xFFFFFF00); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
378 msn_p2p_info_set_id(info, slpmsg->id); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
380 msn_p2p_info_set_total_size(info, slpmsg->size); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 msn_slplink_send_msgpart(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 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
|
387 { |
25329
36897ddd3e08
This should prevent the crash in #8109 by stopping an invalid message from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24403
diff
changeset
|
388 g_return_if_fail(slpmsg != NULL); |
36897ddd3e08
This should prevent the crash in #8109 by stopping an invalid message from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24403
diff
changeset
|
389 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 slpmsg->id = slplink->slp_seq_id++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 |
24402
b9e09053e53a
This doesn't matter, but I think the metaphor tends to be that you push
Mark Doliner <mark@kingant.net>
parents:
24401
diff
changeset
|
392 g_queue_push_tail(slplink->slp_msg_queue, slpmsg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 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
|
397 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 slpmsg->id = slplink->slp_seq_id++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 msn_slplink_release_slpmsg(slplink, slpmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 } |
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 void |
24401
bceefbae1ca6
Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents:
24398
diff
changeset
|
404 msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 MsnSlpMessage *slpmsg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 |
24401
bceefbae1ca6
Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents:
24398
diff
changeset
|
408 /* Send the queued msgs in the order they were created */ |
24402
b9e09053e53a
This doesn't matter, but I think the metaphor tends to be that you push
Mark Doliner <mark@kingant.net>
parents:
24401
diff
changeset
|
409 while ((slpmsg = g_queue_pop_head(slplink->slp_msg_queue)) != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 msn_slplink_release_slpmsg(slplink, slpmsg); |
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 |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
415 static void |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
416 msn_slplink_send_ack(MsnSlpLink *slplink, MsnP2PInfo *info) |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
417 { |
31574
37dda442bb8f
This function doesn't do much of anything any more.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31573
diff
changeset
|
418 MsnSlpMessage *slpmsg = msn_slpmsg_ack_new(slplink, info); |
30013
119bd7b072eb
Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents:
29496
diff
changeset
|
419 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 msn_slplink_send_slpmsg(slplink, slpmsg); |
27939
4200554dd0fc
Patch written by Mark Doliner and Paul Aurich to fix a remote crash on MSN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27887
diff
changeset
|
421 msn_slpmsg_destroy(slpmsg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 |
24396
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
424 static MsnSlpMessage * |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
425 msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id) |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
426 { |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
427 GList *e; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
428 |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
429 for (e = slplink->slp_msgs; e != NULL; e = e->next) |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
430 { |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
431 MsnSlpMessage *slpmsg = e->data; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
432 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
433 if ((msn_p2p_info_get_session_id(slpmsg->p2p_info) == session_id) && (slpmsg->id == id)) |
24396
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
434 return slpmsg; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
435 } |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
436 |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
437 return NULL; |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
438 } |
58fabce901e1
Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents:
24395
diff
changeset
|
439 |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
440 static MsnSlpMessage * |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
441 init_first_msg(MsnSlpLink *slplink, MsnP2PInfo *info) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 MsnSlpMessage *slpmsg; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
444 guint32 session_id; |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
445 |
31572
2201ecdf0c45
Add the slpcall as a parameter when creating a slpmsg.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31569
diff
changeset
|
446 slpmsg = msn_slpmsg_new(slplink, NULL); |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
447 slpmsg->id = msn_p2p_info_get_id(info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
448 session_id = msn_p2p_info_get_session_id(info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
449 slpmsg->size = msn_p2p_info_get_total_size(info); |
31569
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
450 msn_p2p_info_init_first(slpmsg->p2p_info, info); |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
451 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
452 if (session_id) |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
453 { |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
454 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, session_id); |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
455 if (slpmsg->slpcall != NULL) |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
456 { |
31569
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
457 if (msn_p2p_msg_is_data(info)) |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
458 { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
459 PurpleXfer *xfer = slpmsg->slpcall->xfer; |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
460 if (xfer != NULL) |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
461 { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
462 slpmsg->ft = TRUE; |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
463 slpmsg->slpcall->xfer_msg = slpmsg; |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
464 |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
465 purple_xfer_ref(xfer); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
466 purple_xfer_start(xfer, -1, NULL, 0); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
467 |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
468 if (xfer->data == NULL) { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
469 purple_xfer_unref(xfer); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
470 msn_slpmsg_destroy(slpmsg); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
471 g_return_val_if_reached(NULL); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
472 } else { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
473 purple_xfer_unref(xfer); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
474 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
475 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
476 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
477 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
478 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
479 if (!slpmsg->ft && slpmsg->size) |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
480 { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
481 slpmsg->buffer = g_try_malloc(slpmsg->size); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
482 if (slpmsg->buffer == NULL) |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
483 { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
484 purple_debug_error("msn", "Failed to allocate buffer for slpmsg\n"); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
485 msn_slpmsg_destroy(slpmsg); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
486 return NULL; |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
487 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
488 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
489 |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
490 return slpmsg; |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
491 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
492 |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
493 static void |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
494 process_complete_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg, MsnP2PInfo *info) |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
495 { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
496 MsnSlpCall *slpcall; |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
497 |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
498 slpcall = msn_slp_process_msg(slplink, slpmsg); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
499 |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
500 if (slpcall == NULL) { |
30948
b64b2b05bd3c
Sigh, so apparently, I broke receiving smileys with some over-zealous
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30935
diff
changeset
|
501 msn_slpmsg_destroy(slpmsg); |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
502 return; |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
503 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
504 |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
505 purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n"); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
506 |
31568
50ca9e64186b
Only send acks on p2pv2 when required.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31319
diff
changeset
|
507 if (msn_p2p_info_require_ack(slpmsg->p2p_info)) |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
508 { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
509 /* Release all the messages and send the ACK */ |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
510 |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
511 if (slpcall->wait_for_socket) { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
512 /* |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
513 * Save ack for later because we have to send |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
514 * a 200 OK message to the previous direct connect |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
515 * invitation before ACK but the listening socket isn't |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
516 * created yet. |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
517 */ |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
518 purple_debug_info("msn", "msn_slplink_process_msg: save ACK\n"); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
519 |
31574
37dda442bb8f
This function doesn't do much of anything any more.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31573
diff
changeset
|
520 slpcall->slplink->dc->prev_ack = msn_slpmsg_ack_new(slplink, info); |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
521 } else if (!slpcall->wasted) { |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
522 purple_debug_info("msn", "msn_slplink_process_msg: send ACK\n"); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
523 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
524 msn_slplink_send_ack(slplink, info); |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
525 msn_slplink_send_queued_slpmsgs(slplink); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
526 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
527 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
528 |
30948
b64b2b05bd3c
Sigh, so apparently, I broke receiving smileys with some over-zealous
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30935
diff
changeset
|
529 msn_slpmsg_destroy(slpmsg); |
b64b2b05bd3c
Sigh, so apparently, I broke receiving smileys with some over-zealous
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30935
diff
changeset
|
530 |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
531 if (!slpcall->wait_for_socket && slpcall->wasted) |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
532 msn_slpcall_destroy(slpcall); |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
533 } |
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
534 |
30859
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
535 static void |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
536 slpmsg_add_part(MsnSlpMessage *slpmsg, MsnSlpMessagePart *part) |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
537 { |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
538 if (slpmsg->ft) { |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
539 slpmsg->slpcall->u.incoming_data = |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
540 g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)part->buffer, part->size); |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
541 purple_xfer_prpl_ready(slpmsg->slpcall->xfer); |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
542 } |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
543 else if (slpmsg->size && slpmsg->buffer) { |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
544 guint64 offset = msn_p2p_info_get_offset(part->info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
545 if (G_MAXSIZE - part->size < offset |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
546 || (offset + part->size) > slpmsg->size |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
547 || msn_p2p_info_get_offset(slpmsg->p2p_info) != offset) { |
30859
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
548 purple_debug_error("msn", |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
549 "Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n", |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
550 slpmsg->size, offset, part->size); |
30859
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
551 g_return_if_reached(); |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
552 } else { |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
553 memcpy(slpmsg->buffer + offset, part->buffer, part->size); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
554 msn_p2p_info_set_offset(slpmsg->p2p_info, offset + part->size); |
30859
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
555 } |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
556 } |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
557 } |
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
558 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 void |
30858
2d00d29a45fd
Process SlpMessageParts, a sequence of parts will generate a SlpMessage.
masca@cpw.pidgin.im
parents:
30857
diff
changeset
|
560 msn_slplink_process_msg(MsnSlpLink *slplink, MsnSlpMessagePart *part) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 MsnSlpMessage *slpmsg; |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
563 MsnP2PInfo *info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
565 info = part->info; |
30858
2d00d29a45fd
Process SlpMessageParts, a sequence of parts will generate a SlpMessage.
masca@cpw.pidgin.im
parents:
30857
diff
changeset
|
566 |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
567 if (!msn_p2p_info_is_valid(info)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 { |
30697
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
569 /* We seem to have received a bad header */ |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
570 purple_debug_warning("msn", "Total size listed in SLP binary header " |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
571 "was less than length of this particular message. This " |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
572 "should not happen. Dropping message.\n"); |
f3d2a46a5ea8
Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents:
30694
diff
changeset
|
573 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 |
31585
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
576 if (msn_p2p_info_is_first(info)) |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
577 slpmsg = init_first_msg(slplink, info); |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
578 else { |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
579 guint32 session_id, id; |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
580 session_id = msn_p2p_info_get_session_id(info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
581 id = msn_p2p_info_get_id(info); |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
582 slpmsg = msn_slplink_message_find(slplink, session_id, id); |
27887
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
583 if (slpmsg == NULL) |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
584 { |
30432
1cdae196aac8
Standardize on "cancelled".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30238
diff
changeset
|
585 /* Probably the transfer was cancelled */ |
27887
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
586 purple_debug_error("msn", "Couldn't find slpmsg\n"); |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
587 return; |
de7f6fd04298
Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents:
27874
diff
changeset
|
588 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 |
30859
2c2ca0aed68e
Split a little more msn_slplink_process_msg. I think this way is easier to read.
masca@cpw.pidgin.im
parents:
30858
diff
changeset
|
591 slpmsg_add_part(slpmsg, part); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 |
31569
eb1bbaae3427
Try to hide msn_p2p_info_get_flags as much as possible, since it may
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31568
diff
changeset
|
593 if (msn_p2p_msg_is_data(slpmsg->p2p_info) && slpmsg->slpcall != NULL) |
15373
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, |
31585
1e657ff2eacb
Hide some offset occurrences and define a couple of abstractions in
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31584
diff
changeset
|
600 part->size); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 |
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 |
30857
1ded0bc5c911
Split msn_slplink_process_msg in three smaller functions.
masca@cpw.pidgin.im
parents:
30856
diff
changeset
|
609 /* All the pieces of the slpmsg have been received */ |
31151
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
610 if (msn_p2p_info_is_final(info)) |
34da321b60f1
Try to hide all P2P fields away behind accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31093
diff
changeset
|
611 process_complete_msg(slplink, slpmsg, info); |
30935
2de522fa534a
Fix a lot more leaks, some old, some new.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
612 |
30948
b64b2b05bd3c
Sigh, so apparently, I broke receiving smileys with some over-zealous
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30935
diff
changeset
|
613 /* NOTE: The slpmsg will be destroyed in process_complete_msg or left in |
b64b2b05bd3c
Sigh, so apparently, I broke receiving smileys with some over-zealous
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30935
diff
changeset
|
614 the slplink until fully received. Don't free it here! |
b64b2b05bd3c
Sigh, so apparently, I broke receiving smileys with some over-zealous
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30935
diff
changeset
|
615 */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 msn_slplink_request_object(MsnSlpLink *slplink, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 const char *info, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 MsnSlpCb cb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 MsnSlpEndCb end_cb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 const MsnObject *obj) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 MsnSlpCall *slpcall; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 char *msnobj_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 char *msnobj_base64; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 g_return_if_fail(slplink != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 g_return_if_fail(obj != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 msnobj_data = msn_object_to_string(obj); |
15822 | 633 msnobj_base64 = purple_base64_encode((const guchar *)msnobj_data, strlen(msnobj_data)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 g_free(msnobj_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 |
24398
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
636 slpcall = msn_slpcall_new(slplink); |
b27908701f66
For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents:
24396
diff
changeset
|
637 msn_slpcall_init(slpcall, MSN_SLPCALL_ANY); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 slpcall->data_info = g_strdup(info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 slpcall->cb = cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 slpcall->end_cb = end_cb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 |
30844
7b1b7a4e0bb4
Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents:
30842
diff
changeset
|
643 msn_slpcall_invite(slpcall, MSN_OBJ_GUID, P2P_APPID_OBJ, msnobj_base64); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 g_free(msnobj_base64); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 } |