annotate libpurple/protocols/msn/slplink.c @ 31293:6814678f3c63

Remove session_id from SlpMsg and use the one from the header.
author masca@cpw.pidgin.im
date Wed, 21 Jul 2010 19:59:38 +0000
parents 47b6eda87723
children 9f41998d4fcc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file slplink.c MSNSLP Link support
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
4 * purple
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19653
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 */
31180
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 31174
diff changeset
24
31196
230caecf5435 Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents: 31180
diff changeset
25 #include "internal.h"
31180
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 31174
diff changeset
26 #include "debug.h"
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 31174
diff changeset
27
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "msn.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "slplink.h"
31240
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
30 #include "slpmsg_part.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
31231
f84fb808e8ed Move MsnMessage stuff out of slplink to SBConn.
masca@cpw.pidgin.im
parents: 31230
diff changeset
32 #include "sbconn.h"
15374
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"
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
35 #include "p2p.h"
15374
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
31264
f4c86572e745 Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents: 31246
diff changeset
42 debug_part_to_file(MsnSlpMessage *msg, gboolean send)
15374
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;
31264
f4c86572e745 Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents: 31246
diff changeset
46 char *data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 int c;
31264
f4c86572e745 Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents: 31246
diff changeset
48 gsize data_size;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 dir = send ? "send" : "recv";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 c = send ? m_sc++ : m_rc++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c);
31264
f4c86572e745 Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents: 31246
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: 31246
diff changeset
54 if (!purple_util_write_data_to_file_absolute(tmp, data, data_size))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 {
26587
0c796a1950b7 Updates for GTK+ 3.0. Remove some deprecated functions (someone should
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24965
diff changeset
56 purple_debug_error("msn", "could not save debug file\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
23306
945bf99cb233 msn_slplink_new() is only used within slplink.c, so make it static and
Mark Doliner <mark@kingant.net>
parents: 22808
diff changeset
66 static MsnSlpLink *
15374
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
27559
3dcc42d3cc12 Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27219
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: 27219
diff changeset
76 purple_debug_info("msn", "slplink_new: slplink(%p)\n", slplink);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 slplink->session = session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 slplink->remote_user = g_strdup(username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 slplink->slp_msg_queue = g_queue_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 session->slplinks =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 g_list_append(session->slplinks, slplink);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87
30174
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
88 return msn_slplink_ref(slplink);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90
31268
e935d15725c3 Hide msn_slplink_destroy and use the unref version everywhere.
masca@cpw.pidgin.im
parents: 31266
diff changeset
91 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 msn_slplink_destroy(MsnSlpLink *slplink)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 MsnSession *session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
27559
3dcc42d3cc12 Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27219
diff changeset
96 if (purple_debug_is_verbose())
3dcc42d3cc12 Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27219
diff changeset
97 purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 g_return_if_fail(slplink != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
30538
3f7f469ee1d0 NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30509
diff changeset
101 if (slplink->swboard != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink);
30538
3f7f469ee1d0 NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30509
diff changeset
103 slplink->swboard = NULL;
3f7f469ee1d0 NULL-ify one more link on destroy that might lead to a crash.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30509
diff changeset
104 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
30174
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
106 if (slplink->refs > 1) {
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
107 slplink->refs--;
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
108 return;
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
109 }
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
110
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 session = slplink->session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
30508
e432507151d1 NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30497
diff changeset
113 if (slplink->dc != NULL) {
e432507151d1 NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30497
diff changeset
114 slplink->dc->slplink = NULL;
30466
e471c1fb9c49 It's probably a good idea to free the direct connection when the slplink
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30456
diff changeset
115 msn_dc_destroy(slplink->dc);
30508
e432507151d1 NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30497
diff changeset
116 slplink->dc = NULL;
e432507151d1 NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30497
diff changeset
117 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 while (slplink->slp_calls != NULL)
24341
b27908701f66 For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents: 24339
diff changeset
120 msn_slpcall_destroy(slplink->slp_calls->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121
20945
4cd97da26150 Leak fix.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
122 g_queue_free(slplink->slp_msg_queue);
4cd97da26150 Leak fix.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20514
diff changeset
123
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 session->slplinks =
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 g_list_remove(session->slplinks, slplink);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126
23735
331effbd1cc8 Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23671
diff changeset
127 g_free(slplink->remote_user);
331effbd1cc8 Re-arrange msn_slplink_destroy and msn_slp_call_destroy. Might help
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23671
diff changeset
128
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 g_free(slplink);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 MsnSlpLink *
30174
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
133 msn_slplink_ref(MsnSlpLink *slplink)
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
134 {
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
135 g_return_val_if_fail(slplink != NULL, NULL);
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
136
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
137 slplink->refs++;
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
138 if (purple_debug_is_verbose())
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
139 purple_debug_info("msn", "slplink ref (%p)[%d]\n", slplink, slplink->refs);
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
140
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
141 return slplink;
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
142 }
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
143
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
144 void
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
145 msn_slplink_unref(MsnSlpLink *slplink)
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
146 {
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
147 g_return_if_fail(slplink != NULL);
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
148
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
149 slplink->refs--;
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
150 if (purple_debug_is_verbose())
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
151 purple_debug_info("msn", "slplink unref (%p)[%d]\n", slplink, slplink->refs);
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
152
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
153 if (slplink->refs == 0)
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
154 msn_slplink_destroy(slplink);
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
155 }
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
156
b0bc67f42027 Fix a possible use-after-free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29894
diff changeset
157 MsnSlpLink *
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 msn_session_find_slplink(MsnSession *session, const char *who)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 for (l = session->slplinks; l != NULL; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 slplink = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 if (!strcmp(slplink->remote_user, who))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 return slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 MsnSlpLink *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 msn_session_get_slplink(MsnSession *session, const char *username)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 g_return_val_if_fail(session != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 g_return_val_if_fail(username != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 slplink = msn_session_find_slplink(session, username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 if (slplink == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 slplink = msn_slplink_new(session, username);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 return slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 if (slplink->swboard != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 slplink->swboard->flag |= MSN_SB_FLAG_FT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall);
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
198
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
199 /*
30435
bcb5e6c2e5a3 Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
200 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED)
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
201 msn_dc_ref(slplink->dc);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
202 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 {
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
208 /*
30435
bcb5e6c2e5a3 Re-indent directconn.h, and fix a typo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
209 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED)
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
210 msn_dc_unref(slplink->dc);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
211 */
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
212
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214
24338
9b253ce969d0 msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents: 24336
diff changeset
215 /* The slplink has no slpcalls in it, release it from MSN_SB_FLAG_FT.
9b253ce969d0 msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents: 24336
diff changeset
216 * If nothing else is using it then this might cause swboard to be
9b253ce969d0 msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents: 24336
diff changeset
217 * destroyed. */
30508
e432507151d1 NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30497
diff changeset
218 if (slplink->slp_calls == NULL && slplink->swboard != NULL) {
30553
a83167dd305c And another one just like 94fa017925fa206fc36f520ee42c54f57429b4e1. But
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30548
diff changeset
219 slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink);
24338
9b253ce969d0 msn_slplink_remove_slpcall() shouldn't be responsible for setting
Mark Doliner <mark@kingant.net>
parents: 24336
diff changeset
220 msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT);
30508
e432507151d1 NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30497
diff changeset
221 slplink->swboard = NULL;
e432507151d1 NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30497
diff changeset
222 }
30477
7a82bc59b63f Close the DC when the slplink is empty.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30466
diff changeset
223
30666
8c1a2ef5a713 Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30553
diff changeset
224 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: 30553
diff changeset
225 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: 30553
diff changeset
226 || (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: 30553
diff changeset
227 /* 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: 30553
diff changeset
228 * 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: 30553
diff changeset
229 */
8c1a2ef5a713 Destroy a DC if its corresponding slpcall is going away and it hasn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30553
diff changeset
230 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: 30553
diff changeset
231 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: 30553
diff changeset
232 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: 30553
diff changeset
233 }
30508
e432507151d1 NULL-ify some reverse links so that there's no double-free on exit.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30497
diff changeset
234 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 }
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 MsnSlpCall *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 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
239 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 if (!id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 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
247 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 slpcall = l->data;
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 if (slpcall->id && !strcmp(slpcall->id, id))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 return slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 }
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 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 }
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 MsnSlpCall *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 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
259 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 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
264 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 slpcall = l->data;
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 if (slpcall->session_id == id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 return slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
30497
11e748b759a2 This is supposed to go along with the queue sending stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30488
diff changeset
274 void
31240
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
275 msn_slplink_send_part(MsnSlpLink *slplink, MsnSlpMessagePart *part)
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
276 {
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
277 if (slplink->dc != NULL && slplink->dc->state == DC_STATE_ESTABLISHED)
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
278 {
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
279 msn_dc_enqueue_part(slplink->dc, part);
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
280 }
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
281 else
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
282 {
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
283 msn_sbconn_send_part(slplink, part);
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
284 }
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
285 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
287 void
15374
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 {
31240
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
290 MsnSlpMessagePart *part;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 long long real_size;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 size_t len = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 /* 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
295 * reusing the same one all the time. */
31240
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
296 part = msn_slpmsgpart_new(slpmsg->header, slpmsg->footer);
31243
dfada77da5cb Reomove MsnMessage reference from DirectConn.
masca@cpw.pidgin.im
parents: 31240
diff changeset
297 part->ack_data = slpmsg;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
299 real_size = (slpmsg->flags == P2P_ACK) ? 0 : slpmsg->size;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 if (slpmsg->offset < real_size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 {
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
303 if (slpmsg->slpcall && slpmsg->slpcall->xfer && purple_xfer_get_type(slpmsg->slpcall->xfer) == PURPLE_XFER_SEND &&
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
304 purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED)
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
305 {
31232
4481d04cda70 Document SlpMessage size limits.
masca@cpw.pidgin.im
parents: 31231
diff changeset
306 len = MIN(MSN_SBCONN_MAX_SIZE, slpmsg->slpcall->u.outgoing.len);
31240
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
307 msn_slpmsgpart_set_bin_data(part, slpmsg->slpcall->u.outgoing.data, len);
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
308 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 len = slpmsg->size - slpmsg->offset;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312
31232
4481d04cda70 Document SlpMessage size limits.
masca@cpw.pidgin.im
parents: 31231
diff changeset
313 if (len > MSN_SBCONN_MAX_SIZE)
4481d04cda70 Document SlpMessage size limits.
masca@cpw.pidgin.im
parents: 31231
diff changeset
314 len = MSN_SBCONN_MAX_SIZE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315
31276
f86ebed1930a Send buffer data when the message is not a xfer.
masca@cpw.pidgin.im
parents: 31269
diff changeset
316 msn_slpmsgpart_set_bin_data(part, slpmsg->buffer + slpmsg->offset, len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318
31222
320c0852b5cc Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents: 31217
diff changeset
319 slpmsg->header->offset = slpmsg->offset;
320c0852b5cc Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents: 31217
diff changeset
320 slpmsg->header->length = len;
15374
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
31240
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
323 #if 0
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
324 /* TODO: port this function to SlpMessageParts */
27559
3dcc42d3cc12 Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27219
diff changeset
325 if (purple_debug_is_verbose())
3dcc42d3cc12 Apparently, I missed a few changes for purple_debug_is_verbose().
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27219
diff changeset
326 msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body);
31264
f4c86572e745 Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents: 31246
diff changeset
327 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 #ifdef MSN_DEBUG_SLP_FILES
31264
f4c86572e745 Fix debug_*_to_file to process SlpMessages instead of MsnMessages.
masca@cpw.pidgin.im
parents: 31246
diff changeset
330 debug_part_to_file(slpmsg, TRUE);
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
331 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
31240
0f26d510af1b SlpLink must not use MsnMessages but SlpMessageParts, so migrate code to use SlpMessagePart API.
masca@cpw.pidgin.im
parents: 31233
diff changeset
333 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: 31233
diff changeset
334 msn_slplink_send_part(slplink, part);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
336 if ((slpmsg->flags == P2P_MSN_OBJ_DATA ||
31214
432e3331f607 Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents: 31205
diff changeset
337 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
338 slpmsg->flags == P2P_FILE_DATA) &&
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 (slpmsg->slpcall != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 slpmsg->slpcall->progress = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 if (slpmsg->slpcall->progress_cb != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 len, slpmsg->offset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 }
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 /* slpmsg->offset += len; */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352
24346
89cb1c13036e Make another function static
Mark Doliner <mark@kingant.net>
parents: 24345
diff changeset
353 static void
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 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
355 {
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
356 slpmsg = slpmsg;
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
357 slpmsg->footer = g_new0(MsnP2PFooter, 1);
31222
320c0852b5cc Drop slp header and footer from MsnMessage in favor of MsnSlpMessage->header and footer.
masca@cpw.pidgin.im
parents: 31217
diff changeset
358
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
359 if (slpmsg->flags == P2P_NO_FLAG)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 {
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
361 slpmsg->header->ack_id = rand() % 0xFFFFFF00;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 }
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
363 else if (slpmsg->flags == P2P_ACK)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 {
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
365 slpmsg->header->ack_id = slpmsg->ack_id;
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
366 slpmsg->header->ack_size = slpmsg->ack_size;
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
367 slpmsg->header->ack_sub_id = slpmsg->ack_sub_id;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 }
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
369 else if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
31214
432e3331f607 Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents: 31205
diff changeset
370 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
371 slpmsg->flags == P2P_FILE_DATA)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 {
23671
96e78c0fa32b Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23555
diff changeset
373 MsnSlpCall *slpcall;
96e78c0fa32b Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23555
diff changeset
374 slpcall = slpmsg->slpcall;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375
23671
96e78c0fa32b Get rid of MsnSlpSession entirely. It only seems to link to MsnSlpCall
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23555
diff changeset
376 g_return_if_fail(slpcall != NULL);
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
377 slpmsg->header->session_id = slpcall->session_id;
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
378 slpmsg->footer->value = slpcall->app_id;
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
379 slpmsg->header->ack_id = rand() % 0xFFFFFF00;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 else if (slpmsg->flags == 0x100)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 {
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
383 slpmsg->header->ack_id = slpmsg->ack_id;
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
384 slpmsg->header->ack_sub_id = slpmsg->ack_sub_id;
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
385 slpmsg->header->ack_size = slpmsg->ack_size;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
388 slpmsg->header->id = slpmsg->id;
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
389 slpmsg->header->flags = (guint32)slpmsg->flags;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
391 slpmsg->header->total_size = slpmsg->size;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392
31246
07a9356ad2e0 Remove the MsnMessage from SlpMessage.
masca@cpw.pidgin.im
parents: 31243
diff changeset
393 msn_slplink_send_msgpart(slplink, slpmsg);
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 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
398 {
24963
36897ddd3e08 This should prevent the crash in #8109 by stopping an invalid message from
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24346
diff changeset
399 g_return_if_fail(slpmsg != NULL);
36897ddd3e08 This should prevent the crash in #8109 by stopping an invalid message from
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24346
diff changeset
400
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 slpmsg->id = slplink->slp_seq_id++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402
24345
b9e09053e53a This doesn't matter, but I think the metaphor tends to be that you push
Mark Doliner <mark@kingant.net>
parents: 24344
diff changeset
403 g_queue_push_tail(slplink->slp_msg_queue, slpmsg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 }
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 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 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
408 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 slpmsg->id = slplink->slp_seq_id++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410
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 void
24344
bceefbae1ca6 Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents: 24341
diff changeset
415 msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418
24344
bceefbae1ca6 Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents: 24341
diff changeset
419 /* Send the queued msgs in the order they were created */
24345
b9e09053e53a This doesn't matter, but I think the metaphor tends to be that you push
Mark Doliner <mark@kingant.net>
parents: 24344
diff changeset
420 while ((slpmsg = g_queue_pop_head(slplink->slp_msg_queue)) != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 msn_slplink_release_slpmsg(slplink, slpmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
426 static MsnSlpMessage *
31205
e5e712cf9f7e Drop Binary from the struct name.
masca@cpw.pidgin.im
parents: 31203
diff changeset
427 msn_slplink_create_ack(MsnSlpLink *slplink, MsnP2PHeader *header)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430
31230
9192c59f2f84 Use better function names.
masca@cpw.pidgin.im
parents: 31229
diff changeset
431 slpmsg = msn_slpmsg_ack_new(header);
31228
545fa069c531 The creation of SlpMessage must be done in its own module.
masca@cpw.pidgin.im
parents: 31222
diff changeset
432 msn_slpmsg_set_slplink(slpmsg, slplink);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
434 return slpmsg;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
435 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
436
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
437 static void
31205
e5e712cf9f7e Drop Binary from the struct name.
masca@cpw.pidgin.im
parents: 31203
diff changeset
438 msn_slplink_send_ack(MsnSlpLink *slplink, MsnP2PHeader *header)
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
439 {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
440 MsnSlpMessage *slpmsg = msn_slplink_create_ack(slplink, header);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
441
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 msn_slplink_send_slpmsg(slplink, slpmsg);
28287
4200554dd0fc Patch written by Mark Doliner and Paul Aurich to fix a remote crash on MSN
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28232
diff changeset
443 msn_slpmsg_destroy(slpmsg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445
24339
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
446 static MsnSlpMessage *
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
447 msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id)
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
448 {
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
449 GList *e;
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
450
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
451 for (e = slplink->slp_msgs; e != NULL; e = e->next)
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
452 {
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
453 MsnSlpMessage *slpmsg = e->data;
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
454
31293
6814678f3c63 Remove session_id from SlpMsg and use the one from the header.
masca@cpw.pidgin.im
parents: 31292
diff changeset
455 if ((slpmsg->header->session_id == session_id) && (slpmsg->id == id))
24339
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
456 return slpmsg;
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
457 }
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
458
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
459 return NULL;
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
460 }
58fabce901e1 Make a few more functions static and remove a few declarations for
Mark Doliner <mark@kingant.net>
parents: 24338
diff changeset
461
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 void
31205
e5e712cf9f7e Drop Binary from the struct name.
masca@cpw.pidgin.im
parents: 31203
diff changeset
463 msn_slplink_process_msg(MsnSlpLink *slplink, MsnP2PHeader *header, const char *data, gsize len)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 MsnSlpMessage *slpmsg;
25883
9931796e1765 *** Plucked rev 9dd1c4c3 (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents: 24965
diff changeset
466 guint64 offset;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
468 if (header->total_size < header->length)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 {
31135
f3d2a46a5ea8 Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents: 31132
diff changeset
470 /* We seem to have received a bad header */
f3d2a46a5ea8 Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents: 31132
diff changeset
471 purple_debug_warning("msn", "Total size listed in SLP binary header "
f3d2a46a5ea8 Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents: 31132
diff changeset
472 "was less than length of this particular message. This "
f3d2a46a5ea8 Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents: 31132
diff changeset
473 "should not happen. Dropping message.\n");
f3d2a46a5ea8 Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents: 31132
diff changeset
474 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
477 offset = header->offset;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 if (offset == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 slpmsg = msn_slpmsg_new(slplink);
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
482 slpmsg->id = header->id;
31293
6814678f3c63 Remove session_id from SlpMsg and use the one from the header.
masca@cpw.pidgin.im
parents: 31292
diff changeset
483 slpmsg->header->session_id = header->session_id;
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
484 slpmsg->size = header->total_size;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
485 slpmsg->flags = header->flags;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486
31293
6814678f3c63 Remove session_id from SlpMsg and use the one from the header.
masca@cpw.pidgin.im
parents: 31292
diff changeset
487 if (slpmsg->header->session_id)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 {
31293
6814678f3c63 Remove session_id from SlpMsg and use the one from the header.
masca@cpw.pidgin.im
parents: 31292
diff changeset
489 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->header->session_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 if (slpmsg->slpcall != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 {
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
492 if (slpmsg->flags == P2P_MSN_OBJ_DATA ||
31214
432e3331f607 Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents: 31205
diff changeset
493 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
494 slpmsg->flags == P2P_FILE_DATA)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 {
31135
f3d2a46a5ea8 Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents: 31132
diff changeset
496 PurpleXfer *xfer = slpmsg->slpcall->xfer;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 if (xfer != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 {
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
499 slpmsg->ft = TRUE;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
500 slpmsg->slpcall->xfer_msg = slpmsg;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
501
23719
7b2fdeb078cd take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents: 23671
diff changeset
502 purple_xfer_ref(xfer);
28218
6adbdd4b2963 ft: Fix a bunch of uses of 0 as an 'invalid' fd.
Paul Aurich <paul@darkrain42.org>
parents: 28088
diff changeset
503 purple_xfer_start(xfer, -1, NULL, 0);
23719
7b2fdeb078cd take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents: 23671
diff changeset
504
7b2fdeb078cd take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents: 23671
diff changeset
505 if (xfer->data == NULL) {
7b2fdeb078cd take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents: 23671
diff changeset
506 purple_xfer_unref(xfer);
28088
58f29c0286fe I don't understand how this branch could be reached, but don't leak the slp
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27559
diff changeset
507 msn_slpmsg_destroy(slpmsg);
58f29c0286fe I don't understand how this branch could be reached, but don't leak the slp
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27559
diff changeset
508 g_return_if_reached();
23719
7b2fdeb078cd take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents: 23671
diff changeset
509 } else {
7b2fdeb078cd take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents: 23671
diff changeset
510 purple_xfer_unref(xfer);
7b2fdeb078cd take an extra reference to PurpleXfer so we can check whether the whole
Ka-Hing Cheung <khc@hxbc.us>
parents: 23671
diff changeset
511 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 }
29075
6aea98f6a5cd Get rid of slpmsg->fp since the core is handling all the partial reads and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29073
diff changeset
516 if (!slpmsg->ft && slpmsg->size)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 slpmsg->buffer = g_try_malloc(slpmsg->size);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 if (slpmsg->buffer == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
521 purple_debug_error("msn", "Failed to allocate buffer for slpmsg\n");
25883
9931796e1765 *** Plucked rev 9dd1c4c3 (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents: 24965
diff changeset
522 msn_slpmsg_destroy(slpmsg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 {
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
529 slpmsg = msn_slplink_message_find(slplink, header->session_id, header->id);
28232
de7f6fd04298 Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents: 28218
diff changeset
530 if (slpmsg == NULL)
de7f6fd04298 Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents: 28218
diff changeset
531 {
de7f6fd04298 Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents: 28218
diff changeset
532 /* Probably the transfer was canceled */
de7f6fd04298 Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents: 28218
diff changeset
533 purple_debug_error("msn", "Couldn't find slpmsg\n");
de7f6fd04298 Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents: 28218
diff changeset
534 return;
de7f6fd04298 Move this check inside the else condition. The other half of the if
Mark Doliner <mark@kingant.net>
parents: 28218
diff changeset
535 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537
29075
6aea98f6a5cd Get rid of slpmsg->fp since the core is handling all the partial reads and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29073
diff changeset
538 if (slpmsg->ft)
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
539 {
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
540 slpmsg->slpcall->u.incoming_data =
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
541 g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)data, len);
31135
f3d2a46a5ea8 Attempt to simplify and clean
Mark Doliner <mark@kingant.net>
parents: 31132
diff changeset
542 purple_xfer_prpl_ready(slpmsg->slpcall->xfer);
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28346
diff changeset
543 }
28287
4200554dd0fc Patch written by Mark Doliner and Paul Aurich to fix a remote crash on MSN
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28232
diff changeset
544 else if (slpmsg->size && slpmsg->buffer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 {
29466
69077f3993f6 Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents: 29223
diff changeset
546 if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size || slpmsg->offset != offset)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 {
22798
05cb3f04c01e This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22551
diff changeset
548 purple_debug_error("msn",
27007
e45fe73b47e3 Fix two warnings when building on OS X
Paul Aurich <paul@darkrain42.org>
parents: 26944
diff changeset
549 "Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n",
22798
05cb3f04c01e This cleans up a bunch of warnings that stem from the fact that size_t and
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22551
diff changeset
550 slpmsg->size, offset, len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 g_return_if_reached();
29466
69077f3993f6 Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents: 29223
diff changeset
552 } else {
69077f3993f6 Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents: 29223
diff changeset
553 memcpy(slpmsg->buffer + offset, data, len);
69077f3993f6 Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents: 29223
diff changeset
554 slpmsg->offset += len;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
558 if ((slpmsg->flags == P2P_MSN_OBJ_DATA ||
31214
432e3331f607 Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents: 31205
diff changeset
559 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
560 slpmsg->flags == P2P_FILE_DATA) &&
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 (slpmsg->slpcall != NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 slpmsg->slpcall->progress = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 if (slpmsg->slpcall->progress_cb != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 len, offset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 if (slpmsg->buffer == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
577 if (header->offset + header->length >= header->total_size)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 /* All the pieces of the slpmsg have been received */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
582 slpcall = msn_slp_process_msg(slplink, slpmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583
29179
dc7b50d09922 Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29177
diff changeset
584 if (slpcall == NULL) {
dc7b50d09922 Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29177
diff changeset
585 msn_slpmsg_destroy(slpmsg);
dc7b50d09922 Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29177
diff changeset
586 return;
dc7b50d09922 Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29177
diff changeset
587 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29894
diff changeset
589 purple_debug_info("msn", "msn_slplink_process_msg: slpmsg complete\n");
29179
dc7b50d09922 Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29177
diff changeset
590
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
591 if (/* !slpcall->wasted && */ slpmsg->flags == 0x100)
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
592 {
20431
67cda4e0dac8 Finish commenting out references to directconn that would never be called
Stu Tomlinson <stu@nosnilmot.com>
parents: 20426
diff changeset
593 #if 0
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
594 MsnDirectConn *directconn;
29179
dc7b50d09922 Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29177
diff changeset
595
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
596 directconn = slplink->directconn;
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
597 if (!directconn->acked)
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
598 msn_directconn_send_handshake(directconn);
20431
67cda4e0dac8 Finish commenting out references to directconn that would never be called
Stu Tomlinson <stu@nosnilmot.com>
parents: 20426
diff changeset
599 #endif
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
600 }
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
601 else if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP ||
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
602 slpmsg->flags == P2P_MSN_OBJ_DATA ||
31214
432e3331f607 Fix logic error as pointed out by Elliot.
masca@cpw.pidgin.im
parents: 31205
diff changeset
603 slpmsg->flags == (P2P_WML2009_COMP | P2P_MSN_OBJ_DATA) ||
31200
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 31198
diff changeset
604 slpmsg->flags == P2P_FILE_DATA)
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
605 {
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
606 /* Release all the messages and send the ACK */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
608 if (slpcall->wait_for_socket) {
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
609 /*
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
610 * Save ack for later because we have to send
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
611 * a 200 OK message to the previous direct connect
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
612 * invitation before ACK but the listening socket isn't
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
613 * created yet.
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
614 */
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
615 purple_debug_info("msn", "msn_slplink_process_msg: save ACK\n");
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
616
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
617 slpcall->slplink->dc->prev_ack = msn_slplink_create_ack(slplink, header);
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
618 } else if (!slpcall->wasted) {
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
619 purple_debug_info("msn", "msn_slplink_process_msg: send ACK\n");
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
620
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
621 msn_slplink_send_ack(slplink, header);
29179
dc7b50d09922 Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29177
diff changeset
622 msn_slplink_send_queued_slpmsgs(slplink);
dc7b50d09922 Don't sent an ACK to a SLP message if the SlpCall has been marked as wasted
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29177
diff changeset
623 }
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 msn_slpmsg_destroy(slpmsg);
29181
bcea7c92d3f1 Oops, don't break things for successfully receiving of a file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29180
diff changeset
627
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30435
diff changeset
628 if (!slpcall->wait_for_socket && slpcall->wasted)
29181
bcea7c92d3f1 Oops, don't break things for successfully receiving of a file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29180
diff changeset
629 msn_slpcall_destroy(slpcall);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 msn_slplink_request_object(MsnSlpLink *slplink,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 const char *info,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 MsnSlpCb cb,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 MsnSlpEndCb end_cb,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 const MsnObject *obj)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 char *msnobj_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 char *msnobj_base64;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 g_return_if_fail(slplink != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645 g_return_if_fail(obj != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 msnobj_data = msn_object_to_string(obj);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
648 msnobj_base64 = purple_base64_encode((const guchar *)msnobj_data, strlen(msnobj_data));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 g_free(msnobj_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650
24341
b27908701f66 For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents: 24339
diff changeset
651 slpcall = msn_slpcall_new(slplink);
b27908701f66 For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents: 24339
diff changeset
652 msn_slpcall_init(slpcall, MSN_SLPCALL_ANY);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 slpcall->data_info = g_strdup(info);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 slpcall->cb = cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656 slpcall->end_cb = end_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657
31282
7b1b7a4e0bb4 Documetn P2P Application ID in a enum and use it instead of 'magic numbers'.
masca@cpw.pidgin.im
parents: 31280
diff changeset
658 msn_slpcall_invite(slpcall, MSN_OBJ_GUID, P2P_APPID_OBJ, msnobj_base64);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 g_free(msnobj_base64);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 }