annotate libpurple/protocols/msn/slp.c @ 30459:a97d60c15e25

Support old-style Nonce, which should let us use direct connections to aMSN (or msn-pecan?) Refs #247.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 24 Apr 2010 06:41:52 +0000
parents 4e532eedcab4
children 0cc4f8651462
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 msnslp.c MSNSLP 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: 19591
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "msn.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include "slp.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "slpcall.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "slpmsg.h"
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
28 #include "msnutils.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "object.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "user.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "switchboard.h"
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
33 #include "directconn.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
22887
b65997110933 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20990
diff changeset
35 #include "smiley.h"
b65997110933 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20990
diff changeset
36
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 /* ms to delay between sending buddy icon requests to the server. */
24342
9bdaf273c0ff Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents: 24341
diff changeset
38 #define BUDDY_ICON_DELAY 20
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
40 static void request_user_display(MsnUser *user);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 * Util
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 static char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 get_token(const char *str, const char *start, const char *end)
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 const char *c, *c2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 if ((c = strstr(str, start)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 c += strlen(start);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 if (end != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 if ((c2 = strstr(c, end)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 return g_strndup(c, c2 - c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 /* This has to be changed */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 return g_strdup(c);
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
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
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 * Xfer
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
77 msn_xfer_init(PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 /* MsnSlpLink *slplink; */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 char *content;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
83 purple_debug_info("msn", "xfer_init\n");
15374
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 slpcall = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 /* Send Ok */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 slpcall->session_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
91 msn_slp_send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 content);
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 g_free(content);
24344
bceefbae1ca6 Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents: 24342
diff changeset
95 msn_slplink_send_queued_slpmsgs(slpcall->slplink);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
99 msn_xfer_cancel(PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 char *content;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 g_return_if_fail(xfer->data != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 slpcall = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
109 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 if (slpcall->started)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 {
24341
b27908701f66 For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents: 24335
diff changeset
113 msn_slpcall_close(slpcall);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 slpcall->session_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
120 msn_slp_send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 g_free(content);
24344
bceefbae1ca6 Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents: 24342
diff changeset
124 msn_slplink_send_queued_slpmsgs(slpcall->slplink);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125
29178
5d8867f11f0d If we're sending a file, and libpurple tells us to cancel it, then just set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29076
diff changeset
126 if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND)
5d8867f11f0d If we're sending a file, and libpurple tells us to cancel it, then just set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29076
diff changeset
127 slpcall->wasted = TRUE;
5d8867f11f0d If we're sending a file, and libpurple tells us to cancel it, then just set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29076
diff changeset
128 else
5d8867f11f0d If we're sending a file, and libpurple tells us to cancel it, then just set
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29076
diff changeset
129 msn_slpcall_destroy(slpcall);
15374
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
134 gssize
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
135 msn_xfer_write(const guchar *data, gsize len, PurpleXfer *xfer)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 {
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
137 MsnSlpCall *slpcall;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
138
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
139 g_return_val_if_fail(xfer != NULL, -1);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
140 g_return_val_if_fail(data != NULL, -1);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
141 g_return_val_if_fail(len > 0, -1);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
142
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
143 g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND, -1);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
144
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
145 slpcall = xfer->data;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
146 /* Not sure I trust it'll be there */
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
147 g_return_val_if_fail(slpcall != NULL, -1);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
148
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
149 g_return_val_if_fail(slpcall->xfer_msg != NULL, -1);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
150
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
151 slpcall->u.outgoing.len = len;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
152 slpcall->u.outgoing.data = data;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
153 msn_slplink_send_msgpart(slpcall->slplink, slpcall->xfer_msg);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
154 return MIN(1202, len);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
155 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
157 gssize
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
158 msn_xfer_read(guchar **data, PurpleXfer *xfer)
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
159 {
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
160 MsnSlpCall *slpcall;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
161 gsize len;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
162
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
163 g_return_val_if_fail(xfer != NULL, -1);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
164 g_return_val_if_fail(data != NULL, -1);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
165
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
166 g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE, -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
168 slpcall = xfer->data;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
169 /* Not sure I trust it'll be there */
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
170 g_return_val_if_fail(slpcall != NULL, -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
172 /* Just pass up the whole GByteArray. We'll make another. */
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
173 *data = slpcall->u.incoming_data->data;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
174 len = slpcall->u.incoming_data->len;
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
175
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
176 g_byte_array_free(slpcall->u.incoming_data, FALSE);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
177 slpcall->u.incoming_data = g_byte_array_new();
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
178
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
179 return len;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
185 if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
186 (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
187 (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
189 purple_xfer_cancel_remote(slpcall->xfer);
15374
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 msn_xfer_completed_cb(MsnSlpCall *slpcall, const guchar *body,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 {
17065
21830d70709b Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents: 16702
diff changeset
197 PurpleXfer *xfer = slpcall->xfer;
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
198
17065
21830d70709b Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents: 16702
diff changeset
199 purple_xfer_set_completed(xfer, TRUE);
21830d70709b Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents: 16702
diff changeset
200 purple_xfer_end(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 * SLP Control
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
207 void
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
208 msn_slp_send_ok(MsnSlpCall *slpcall, const char *branch,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 const char *type, const char *content)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 slplink = slpcall->slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 /* 200 OK */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 slpmsg = msn_slpmsg_sip_new(slpcall, 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 "MSNSLP/1.0 200 OK",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 branch, type, content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 slpmsg->info = "SLP 200 OK";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 slpmsg->text_body = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 msn_slplink_queue_slpmsg(slplink, slpmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
227 void
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
228 msn_slp_send_decline(MsnSlpCall *slpcall, const char *branch,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 const char *type, const char *content)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 slplink = slpcall->slplink;
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 /* 603 Decline */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 slpmsg = msn_slpmsg_sip_new(slpcall, 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 "MSNSLP/1.0 603 Decline",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 branch, type, content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 slpmsg->info = "SLP 603 Decline";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 slpmsg->text_body = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 msn_slplink_queue_slpmsg(slplink, slpmsg);
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
29240
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
247 /* XXX: this could be improved if we tracked custom smileys
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
248 * per-protocol, per-account, per-session or (ideally) per-conversation
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
249 */
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
250 static PurpleStoredImage *
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
251 find_valid_emoticon(PurpleAccount *account, const char *path)
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
252 {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
253 GList *smileys;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
254
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
255 if (!purple_account_get_bool(account, "custom_smileys", TRUE))
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
256 return NULL;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
257
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
258 smileys = purple_smileys_get_all();
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
259
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
260 for (; smileys; smileys = g_list_delete_link(smileys, smileys)) {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
261 PurpleSmiley *smiley;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
262 PurpleStoredImage *img;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
263
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
264 smiley = smileys->data;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
265 img = purple_smiley_get_stored_image(smiley);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
266
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
267 if (purple_strequal(path, purple_imgstore_get_filename(img))) {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
268 g_list_free(smileys);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
269 return img;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
270 }
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
271
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
272 purple_imgstore_unref(img);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
273 }
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
274
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
275 purple_debug_error("msn", "Received illegal request for file %s\n", path);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
276 return NULL;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
277 }
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
278
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
279 static gboolean
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
280 msn_slp_process_transresp(MsnSlpCall *slpcall, const char *content)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
281 {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
282 /* A direct connection negotiation response */
30447
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
283 char *bridge;
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
284 char *nonce;
30447
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
285 MsnDirectConn *dc = slpcall->slplink->dc;
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
286 gboolean result = FALSE;
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
287
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
288 purple_debug_info("msn", "process_transresp\n");
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
289
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
290 g_return_val_if_fail(dc != NULL, FALSE);
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
291 g_return_val_if_fail(dc->state == DC_STATE_CLOSED, FALSE);
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
292
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
293 bridge = get_token(content, "Bridge: ", "\r\n");
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
294 nonce = get_token(content, "Hashed-Nonce: {", "}\r\n");
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
295 if (nonce && bridge && !strcmp(bridge, "TCPv1")) {
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
296 /* Ok, the client supports direct TCP connection */
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
297
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
298 strncpy(dc->remote_nonce, nonce, 36);
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
299 dc->remote_nonce[36] = '\0';
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
300
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
301 if (dc->listen_data != NULL || dc->listenfd != -1) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
302 if (dc->listen_data != NULL) {
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
303 /*
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
304 * We'll listen for incoming connections but
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
305 * the listening socket isn't ready yet so we cannot
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
306 * send the INVITE packet now. Put the slpcall into waiting mode
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
307 * and let the callback send the invite.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
308 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
309 slpcall->wait_for_socket = TRUE;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
310
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
311 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
312 /* The listening socket is ready. Send the INVITE here. */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
313 msn_dc_send_invite(dc);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
314 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
315
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
316 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
317 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
318 * We should connect to the client so parse
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
319 * IP/port from response.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
320 */
30447
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
321 char *ip, *port_str;
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
322 int port = 0;
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
323
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
324 /* Save external IP/port for later use. We'll try local connection first. */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
325 dc->ext_ip = get_token(content, "IPv4External-Addrs: ", "\r\n");
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
326 port_str = get_token(content, "IPv4External-Port: ", "\r\n");
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
327 if (port_str) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
328 dc->ext_port = atoi(port_str);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
329 g_free(port_str);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
330 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
331
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
332 ip = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
333 port_str = get_token(content, "IPv4Internal-Port: ", "\r\n");
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
334 if (port_str) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
335 port = atoi(port_str);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
336 g_free(port_str);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
337 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
338
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
339 if (ip && port) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
340 /* Try internal address first */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
341 dc->connect_data = purple_proxy_connect(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
342 NULL,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
343 slpcall->slplink->session->account,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
344 ip,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
345 port,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
346 msn_dc_connected_to_peer_cb,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
347 dc
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
348 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
349
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
350 if (dc->connect_data) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
351 /* Add connect timeout handle */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
352 dc->connect_timeout_handle = purple_timeout_add_seconds(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
353 DC_CONNECT_TIMEOUT,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
354 msn_dc_outgoing_connection_timeout_cb,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
355 dc
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
356 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
357 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
358 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
359 * Connection failed
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
360 * Try external IP/port (if specified)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
361 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
362 msn_dc_outgoing_connection_timeout_cb(dc);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
363 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
364
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
365 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
366 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
367 * Omitted or invalid internal IP address / port
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
368 * Try external IP/port (if specified)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
369 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
370 msn_dc_outgoing_connection_timeout_cb(dc);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
371 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
372
30447
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
373 g_free(ip);
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
374 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
375
30447
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
376 result = TRUE;
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
377
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
378 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
379 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
380 * Invalid direct connect invitation or
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
381 * TCP connection is not supported
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
382 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
383 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
384
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
385 g_free(nonce);
30447
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
386 g_free(bridge);
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
387
30447
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30434
diff changeset
388 return result;
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
389 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
390
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 got_sessionreq(MsnSlpCall *slpcall, const char *branch,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 const char *euf_guid, const char *context)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 {
28212
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
395 gboolean accepted = FALSE;
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
396
23550
efa4534fd23a Clean up some #define's in msn.h and various supporting changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
397 if (!strcmp(euf_guid, MSN_OBJ_GUID))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 /* Emoticon or UserDisplay */
16390
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16388
diff changeset
400 char *content;
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16388
diff changeset
401 gsize len;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 MsnObject *obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 char *msnobj_data;
29240
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
406 PurpleStoredImage *img = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 int type;
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 /* Send Ok */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 slpcall->session_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
413 msn_slp_send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 g_free(content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 slplink = slpcall->slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
420 msnobj_data = (char *)purple_base64_decode(context, &len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 obj = msn_object_new_from_string(msnobj_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 type = msn_object_get_type(obj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 g_free(msnobj_data);
22888
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22887
diff changeset
424 if (type == MSN_OBJECT_EMOTICON) {
29240
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
425 img = find_valid_emoticon(slplink->session->account, obj->location);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
426 } else if (type == MSN_OBJECT_USERTILE) {
22888
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22887
diff changeset
427 img = msn_object_get_image(obj);
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22887
diff changeset
428 if (img)
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22887
diff changeset
429 purple_imgstore_ref(img);
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22887
diff changeset
430 }
22887
b65997110933 The patch to msn to allow sending custom smileys. Doesn't send all the custom smileys correctly at the moment. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20990
diff changeset
431 msn_object_destroy(obj);
22888
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22887
diff changeset
432
29240
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
433 if (img != NULL) {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
434 /* DATA PREP */
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
435 slpmsg = msn_slpmsg_new(slplink);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
436 slpmsg->slpcall = slpcall;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
437 slpmsg->session_id = slpcall->session_id;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
438 msn_slpmsg_set_body(slpmsg, NULL, 4);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
439 slpmsg->info = "SLP DATA PREP";
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
440 msn_slplink_queue_slpmsg(slplink, slpmsg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441
29240
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
442 /* DATA */
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
443 slpmsg = msn_slpmsg_new(slplink);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
444 slpmsg->slpcall = slpcall;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
445 slpmsg->flags = 0x20;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
446 slpmsg->info = "SLP DATA";
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
447 msn_slpmsg_set_image(slpmsg, img);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
448 msn_slplink_queue_slpmsg(slplink, slpmsg);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
449 purple_imgstore_unref(img);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450
29240
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
451 accepted = TRUE;
28212
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
452
29240
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
453 } else {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
454 purple_debug_error("msn", "Wrong object.\n");
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28525
diff changeset
455 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 }
28212
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
457
23550
efa4534fd23a Clean up some #define's in msn.h and various supporting changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
458 else if (!strcmp(euf_guid, MSN_FT_GUID))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 /* File Transfer */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
461 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
462 PurpleXfer *xfer;
29892
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
463 MsnFileContext *header;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 gsize bin_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 guint32 file_size;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 char *file_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 account = slpcall->slplink->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 slpcall->end_cb = msn_xfer_end_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 slpcall->branch = g_strdup(branch);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 slpcall->pending = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
475 xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 slpcall->slplink->remote_user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477
29892
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
478 header = (MsnFileContext *)purple_base64_decode(context, &bin_len);
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
479 if (bin_len >= sizeof(MsnFileContext) - 1 &&
29893
f8a95fdab3bd Fix FT context header length handling. The official client only seems to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29892
diff changeset
480 (header->version == 2 ||
f8a95fdab3bd Fix FT context header length handling. The official client only seems to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29892
diff changeset
481 (header->version == 3 && header->length == sizeof(MsnFileContext) + 63))) {
29892
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
482 file_size = GUINT64_FROM_LE(header->file_size);
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
483
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
484 file_name = g_convert((const gchar *)&header->file_name,
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
485 MAX_FILE_NAME_LEN * 2,
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
486 "UTF-8", "UTF-16LE",
28160
769142e728ec Somehow this bit got left in there. Should really compile this time.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28157
diff changeset
487 NULL, NULL, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488
28289
db99cde1845c Fix crashes when filenames end up being NULL in some prpls. Fixed a minor
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28212
diff changeset
489 purple_xfer_set_filename(xfer, file_name ? file_name : "");
22804
7d3b2c023ad8 This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20990
diff changeset
490 g_free(file_name);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
491 purple_xfer_set_size(xfer, file_size);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
492 purple_xfer_set_init_fnc(xfer, msn_xfer_init);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
493 purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
494 purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel);
29073
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
495 purple_xfer_set_read_fnc(xfer, msn_xfer_read);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
496 purple_xfer_set_write_fnc(xfer, msn_xfer_write);
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
497
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28525
diff changeset
498 slpcall->u.incoming_data = g_byte_array_new();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 slpcall->xfer = xfer;
17137
8ed7b2d32ad1 slpcall now explicitlt references its xfer and unreferences it when it is destroyed. While it *looks* like this should *probably* have happened anyways due to the interactins between xfer_init, xfer_end, and xfer_cancel_remote, having the xfer's owner make this explicit makes the process less fragile and more obvious, and it may fix a crash as the slp is destroyed. Fixes #1070
Evan Schoenberg <evan.s@dreskin.net>
parents: 17136
diff changeset
501 purple_xfer_ref(slpcall->xfer);
8ed7b2d32ad1 slpcall now explicitlt references its xfer and unreferences it when it is destroyed. While it *looks* like this should *probably* have happened anyways due to the interactins between xfer_init, xfer_end, and xfer_cancel_remote, having the xfer's owner make this explicit makes the process less fragile and more obvious, and it may fix a crash as the slp is destroyed. Fixes #1070
Evan Schoenberg <evan.s@dreskin.net>
parents: 17136
diff changeset
502
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 xfer->data = slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
505 purple_xfer_request(xfer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 }
29892
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29466
diff changeset
507 g_free(header);
28212
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
508
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
509 accepted = TRUE;
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
510
26599
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
511 } else if (!strcmp(euf_guid, MSN_CAM_REQUEST_GUID)) {
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
512 purple_debug_info("msn", "Cam request.\n");
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
513 if (slpcall && slpcall->slplink &&
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
514 slpcall->slplink->session) {
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
515 PurpleConversation *conv;
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
516 gchar *from = slpcall->slplink->remote_user;
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
517 conv = purple_find_conversation_with_account(
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
518 PURPLE_CONV_TYPE_IM, from,
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
519 slpcall->slplink->session->account);
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
520 if (conv) {
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
521 char *buf;
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
522 buf = g_strdup_printf(
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
523 _("%s requests to view your "
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
524 "webcam, but this request is "
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
525 "not yet supported."), from);
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
526 purple_conversation_write(conv, NULL, buf,
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
527 PURPLE_MESSAGE_SYSTEM |
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
528 PURPLE_MESSAGE_NOTIFY,
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
529 time(NULL));
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
530 g_free(buf);
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
531 }
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
532 }
28212
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
533
26599
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
534 } else if (!strcmp(euf_guid, MSN_CAM_GUID)) {
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
535 purple_debug_info("msn", "Cam invite.\n");
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
536 if (slpcall && slpcall->slplink &&
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
537 slpcall->slplink->session) {
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
538 PurpleConversation *conv;
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
539 gchar *from = slpcall->slplink->remote_user;
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
540 conv = purple_find_conversation_with_account(
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
541 PURPLE_CONV_TYPE_IM, from,
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
542 slpcall->slplink->session->account);
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
543 if (conv) {
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
544 char *buf;
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
545 buf = g_strdup_printf(
28375
c9e760d350b8 I was missing a space!
Mark Doliner <mark@kingant.net>
parents: 28374
diff changeset
546 _("%s invited you to view his/her webcam, but "
c9e760d350b8 I was missing a space!
Mark Doliner <mark@kingant.net>
parents: 28374
diff changeset
547 "this is not yet supported."), from);
26599
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
548 purple_conversation_write(conv, NULL, buf,
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
549 PURPLE_MESSAGE_SYSTEM |
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
550 PURPLE_MESSAGE_NOTIFY,
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
551 time(NULL));
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
552 g_free(buf);
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
553 }
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24382
diff changeset
554 }
28212
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
555
23550
efa4534fd23a Clean up some #define's in msn.h and various supporting changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
556 } else
efa4534fd23a Clean up some #define's in msn.h and various supporting changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
557 purple_debug_warning("msn", "SLP SessionReq with unknown EUF-GUID: %s\n", euf_guid);
28212
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
558
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
559 if (!accepted) {
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
560 char *content = g_strdup_printf("SessionID: %lu\r\n\r\n",
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
561 slpcall->session_id);
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
562 msn_slp_send_decline(slpcall, branch, "application/x-msnmsgr-sessionreqbody", content);
28212
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
563 g_free(content);
00836f1fde84 Send a 603 Decline for any SLP invite that we do not support, so that your
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28160
diff changeset
564 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 }
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 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 send_bye(MsnSlpCall *slpcall, const char *type)
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 MsnSlpLink *slplink;
24333
c6c714b7841d Get rid of slplink->local_user because it's a copy of
Mark Doliner <mark@kingant.net>
parents: 23729
diff changeset
571 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 char *header;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 slplink = slpcall->slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 g_return_if_fail(slplink != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578
24333
c6c714b7841d Get rid of slplink->local_user because it's a copy of
Mark Doliner <mark@kingant.net>
parents: 23729
diff changeset
579 account = slplink->session->account;
c6c714b7841d Get rid of slplink->local_user because it's a copy of
Mark Doliner <mark@kingant.net>
parents: 23729
diff changeset
580
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0",
24333
c6c714b7841d Get rid of slplink->local_user because it's a copy of
Mark Doliner <mark@kingant.net>
parents: 23729
diff changeset
582 purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 slpmsg = msn_slpmsg_sip_new(slpcall, 0, header,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585 "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 type,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 g_free(header);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 slpmsg->info = "SLP BYE";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 slpmsg->text_body = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 msn_slplink_queue_slpmsg(slplink, slpmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 got_invite(MsnSlpCall *slpcall,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 const char *branch, const char *type, const char *content)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 slplink = slpcall->slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 char *euf_guid, *context;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 char *temp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 euf_guid = get_token(content, "EUF-GUID: {", "}\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 temp = get_token(content, "SessionID: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 if (temp != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 slpcall->session_id = atoi(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 g_free(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 temp = get_token(content, "AppID: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 if (temp != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618 slpcall->app_id = atoi(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 g_free(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 context = get_token(content, "Context: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 if (context != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 got_sessionreq(slpcall, branch, euf_guid, context);
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 g_free(context);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 g_free(euf_guid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 {
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
631 /* A direct connection negotiation request */
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30447
diff changeset
632 char *bridges;
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
633 char *nonce;
30459
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
634 MsnDirectConnNonceType ntype;
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
635
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
636 purple_debug_info("msn", "got_invite: transreqbody received\n");
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
637
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
638 /* Don't do anything if we already have a direct connection */
30449
5be6177e369e This doesn't appear to be a programming error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30448
diff changeset
639 if (slpcall->slplink->dc != NULL)
5be6177e369e This doesn't appear to be a programming error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30448
diff changeset
640 return;
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
641
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
642 bridges = get_token(content, "Bridges: ", "\r\n");
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
643 nonce = get_token(content, "Hashed-Nonce: {", "}\r\n");
30459
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
644 if (nonce) {
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
645 ntype = DC_NONCE_SHA1;
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
646 } else {
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
647 nonce = get_token(content, "Nonce: {", "}\r\n");
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
648 ntype = DC_NONCE_PLAIN;
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
649 }
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
650 if (nonce && bridges && strstr(bridges, "TCPv1") != NULL) {
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
651 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
652 * Ok, the client supports direct TCP connection
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
653 * Try to create a listening port
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
654 */
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30447
diff changeset
655 MsnDirectConn *dc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
657 dc = msn_dc_new(slpcall);
30459
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
658 dc->nonce_type = ntype;
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
659 strncpy(dc->remote_nonce, nonce, 36);
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
660 dc->remote_nonce[36] = '\0';
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
662 dc->listen_data = purple_network_listen_range(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
663 0, 0,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
664 SOCK_STREAM,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
665 msn_dc_listen_socket_created_cb,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
666 dc
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
667 );
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
669 if (dc->listen_data == NULL) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
670 /* Listen socket creation failed */
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
671
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
672 purple_debug_info("msn", "got_invite: listening failed\n");
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
673
30459
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
674 if (dc->nonce_type != DC_NONCE_PLAIN)
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
675 msn_slp_send_ok(slpcall, branch,
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
676 "application/x-msnmsgr-transrespbody",
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
677 "Bridge: TCPv1\r\n"
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
678 "Listening: false\r\n"
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
679 "Hashed-Nonce: {00000000-0000-0000-0000-000000000000}\r\n"
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
680 "\r\n");
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
681 else
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
682 msn_slp_send_ok(slpcall, branch,
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
683 "application/x-msnmsgr-transrespbody",
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
684 "Bridge: TCPv1\r\n"
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
685 "Listening: false\r\n"
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
686 "Nonce: {00000000-0000-0000-0000-000000000000}\r\n"
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
687 "\r\n");
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
688
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
689 } else {
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
690 /*
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
691 * Listen socket created successfully.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
692 * Don't send anything here because we don't know the parameters
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
693 * of the created socket yet. msn_dc_send_ok will be called from
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
694 * the callback function: dc_listen_socket_created_cb
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
695 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
696 purple_debug_info("msn", "got_invite: listening socket created\n");
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
697
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
698 dc->send_connection_info_msg_cb = msn_dc_send_ok;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
699 slpcall->wait_for_socket = TRUE;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
700 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
701
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
702 } else {
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
703 /*
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
704 * Invalid direct connect invitation or
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
705 * TCP connection is not supported.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
706 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707 }
30455
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30454
diff changeset
708
30457
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30455
diff changeset
709 g_free(nonce);
30455
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30454
diff changeset
710 g_free(bridges);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 {
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
714 /* A direct connection negotiation response */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
715 msn_slp_process_transresp(slpcall, content);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 got_ok(MsnSlpCall *slpcall,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 const char *type, const char *content)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 g_return_if_fail(slpcall != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 g_return_if_fail(type != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 {
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30447
diff changeset
728 char *content;
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30447
diff changeset
729 char *header;
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30447
diff changeset
730 MsnSlpMessage *msg;
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30447
diff changeset
731 MsnDirectConn *dc;
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
732
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30447
diff changeset
733 if (slpcall->slplink->dc != NULL) {
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
734 /*
30448
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30447
diff changeset
735 * If we already have an established direct connection
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
736 * then just start the transfer.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
737 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
738 msn_slpcall_session_init(slpcall);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
739 return;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
740 }
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
741
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
742 /* Try direct file transfer by sending a second INVITE */
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
743
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
744 dc = msn_dc_new(slpcall);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
745 slpcall->branch = rand_guid();
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
746
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
747 dc->listen_data = purple_network_listen_range(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
748 0, 0,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
749 SOCK_STREAM,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
750 msn_dc_listen_socket_created_cb,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
751 dc
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
752 );
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
753
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
754 header = g_strdup_printf(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
755 "INVITE MSNMSGR:%s MSNSLP/1.0",
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
756 slpcall->slplink->remote_user
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
757 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
758
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
759 if (dc->listen_data == NULL) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
760 /* Listen socket creation failed */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
761 purple_debug_info("msn", "got_ok: listening failed\n");
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
762
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
763 content = g_strdup_printf(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
764 "Bridges: TCPv1\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
765 "NetID: %u\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
766 "Conn-Type: IP-Restrict-NAT\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
767 "UPnPNat: false\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
768 "ICF: false\r\n"
30459
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
769 "%sNonce: {%s}\r\n"
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
770 "\r\n",
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
771
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
772 rand() % G_MAXUINT32,
30459
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
773 dc->nonce_type != DC_NONCE_PLAIN ? "Hashed-" : "",
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
774 dc->nonce_hash
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
775 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
776
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
777 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
778 /* Listen socket created successfully. */
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
779
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
780 purple_debug_info("msn", "got_ok: listening socket created\n");
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
781
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
782 content = g_strdup_printf(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
783 "Bridges: TCPv1\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
784 "NetID: 0\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
785 "Conn-Type: Direct-Connect\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
786 "UPnPNat: false\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
787 "ICF: false\r\n"
30459
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
788 "%sNonce: {%s}\r\n"
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
789 "\r\n",
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
790
30459
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30457
diff changeset
791 dc->nonce_type != DC_NONCE_PLAIN ? "Hashed-" : "",
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
792 dc->nonce_hash
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
793 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
794 }
30434
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30433
diff changeset
795
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
796 msg = msn_slpmsg_sip_new(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
797 slpcall,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
798 0,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
799 header,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
800 slpcall->branch,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
801 "application/x-msnmsgr-transreqbody",
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
802 content
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
803 );
30453
a613180bfeab Set some information for debugging.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30450
diff changeset
804 msg->info = "DC INVITE";
a613180bfeab Set some information for debugging.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30450
diff changeset
805 msg->text_body = TRUE;
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
806 g_free(header);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
807 g_free(content);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
808
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
809 msn_slplink_queue_slpmsg(slpcall->slplink, msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 /* Do we get this? */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
814 purple_debug_info("msn", "OK with transreqbody\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 {
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
818 msn_slp_process_transresp(slpcall, content);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 MsnSlpCall *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823 msn_slp_sip_recv(MsnSlpLink *slplink, const char *body)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 if (body == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
829 purple_debug_warning("msn", "received bogus message\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
832
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
833 if (!strncmp(body, "INVITE", strlen("INVITE")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
834 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
835 char *branch;
29466
69077f3993f6 Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents: 29261
diff changeset
836 char *call_id;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
837 char *content;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
838 char *content_type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
839
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
840 /* From: <msnmsgr:buddy@hotmail.com> */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
841 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
842 slpcall->remote_user = get_token(body, "From: <msnmsgr:", ">\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
843 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
844
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
845 branch = get_token(body, ";branch={", "}");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
846
29466
69077f3993f6 Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents: 29261
diff changeset
847 call_id = get_token(body, "Call-ID: {", "}");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
849 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
850 long content_len = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
851
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
852 temp = get_token(body, "Content-Length: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
853 if (temp != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
854 content_len = atoi(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
855 g_free(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
856 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
857 content_type = get_token(body, "Content-Type: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
858
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859 content = get_token(body, "\r\n\r\n", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
860
30455
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30454
diff changeset
861 slpcall = NULL;
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
862 if (branch && call_id)
28525
5546612e70e2 Ignore SLP invites if they do not contain all the required fields. The
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28375
diff changeset
863 {
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
864 slpcall = msn_slplink_find_slp_call(slplink, call_id);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
865 if (slpcall)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
866 {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
867 g_free(slpcall->branch);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
868 slpcall->branch = g_strdup(branch);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
869 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
870 else if (content_type && content)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
871 {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
872 slpcall = msn_slpcall_new(slplink);
30455
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30454
diff changeset
873 slpcall->id = g_strdup(call_id);
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
874 got_invite(slpcall, branch, content_type, content);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
875 }
28525
5546612e70e2 Ignore SLP invites if they do not contain all the required fields. The
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28375
diff changeset
876 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
877
30455
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30454
diff changeset
878 g_free(call_id);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
879 g_free(branch);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
880 g_free(content_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
881 g_free(content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
883 else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 ")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 char *content;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 char *content_type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887 /* Make sure this is "OK" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 const char *status = body + strlen("MSNSLP/1.0 ");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
889 char *call_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
890
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 call_id = get_token(body, "Call-ID: {", "}");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 slpcall = msn_slplink_find_slp_call(slplink, call_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 g_free(call_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 g_return_val_if_fail(slpcall != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 if (strncmp(status, "200 OK", 6))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 /* It's not valid. Kill this off. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 char temp[32];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 const char *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 /* Eww */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
904 if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) ||
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 (c = strchr(status, '\0')))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 size_t offset = c - status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 if (offset >= sizeof(temp))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 offset = sizeof(temp) - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 strncpy(temp, status, offset);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 temp[offset] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
915 purple_debug_error("msn", "Received non-OK result: %s\n", temp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 slpcall->wasted = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918
24341
b27908701f66 For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents: 24335
diff changeset
919 /* msn_slpcall_destroy(slpcall); */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 return slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923 content_type = get_token(body, "Content-Type: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 content = get_token(body, "\r\n\r\n", NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 got_ok(slpcall, content_type, content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 g_free(content_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 g_free(content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 else if (!strncmp(body, "BYE", strlen("BYE")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 char *call_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
936 call_id = get_token(body, "Call-ID: {", "}");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937 slpcall = msn_slplink_find_slp_call(slplink, call_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
938 g_free(call_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 if (slpcall != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 slpcall->wasted = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942
24341
b27908701f66 For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents: 24335
diff changeset
943 /* msn_slpcall_destroy(slpcall); */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 slpcall = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 return slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952 * Msg Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
957 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 MsnSession *session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 MsnSlpLink *slplink;
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
960 const char *data;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
961 gsize len;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 session = cmdproc->servconn->session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 slplink = msn_session_get_slplink(session, msg->remote_user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 if (slplink->swboard == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 {
24382
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
968 /*
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
969 * We will need swboard in order to change its flags. If its
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
970 * NULL, something has probably gone wrong earlier on. I
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
971 * didn't want to do this, but MSN 7 is somehow causing us
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
972 * to crash here, I couldn't reproduce it to debug more,
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
973 * and people are reporting bugs. Hopefully this doesn't
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
974 * cause more crashes. Stu.
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
975 */
24350
e71c1fad229f cmdproc->data should never be null. Log a warning message if it
Mark Doliner <mark@kingant.net>
parents: 24344
diff changeset
976 if (cmdproc->data == NULL)
e71c1fad229f cmdproc->data should never be null. Log a warning message if it
Mark Doliner <mark@kingant.net>
parents: 24344
diff changeset
977 g_warning("msn_p2p_msg cmdproc->data was NULL\n");
e71c1fad229f cmdproc->data should never be null. Log a warning message if it
Mark Doliner <mark@kingant.net>
parents: 24344
diff changeset
978 else {
e71c1fad229f cmdproc->data should never be null. Log a warning message if it
Mark Doliner <mark@kingant.net>
parents: 24344
diff changeset
979 slplink->swboard = (MsnSwitchBoard *)cmdproc->data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980 slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink);
24350
e71c1fad229f cmdproc->data should never be null. Log a warning message if it
Mark Doliner <mark@kingant.net>
parents: 24344
diff changeset
981 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983
30433
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
984 data = msn_message_get_bin_data(msg, &len);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
985
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29893
diff changeset
986 msn_slplink_process_msg(slplink, &msg->msnslp_header, data, len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
987 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 got_emoticon(MsnSlpCall *slpcall,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991 const guchar *data, gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
993 PurpleConversation *conv;
23556
7fc1fa02184a When receiving an MSN custom smiley, look at the switchboard for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23550
diff changeset
994 MsnSwitchBoard *swboard;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995
23556
7fc1fa02184a When receiving an MSN custom smiley, look at the switchboard for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23550
diff changeset
996 swboard = slpcall->slplink->swboard;
7fc1fa02184a When receiving an MSN custom smiley, look at the switchboard for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23550
diff changeset
997 conv = swboard->conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998
23556
7fc1fa02184a When receiving an MSN custom smiley, look at the switchboard for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23550
diff changeset
999 if (conv) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000 /* FIXME: it would be better if we wrote the data as we received it
20419
c2b406b4ccd7 Port a custom emoticon crash fix that seemed to get lost somewhere along
Stu Tomlinson <stu@nosnilmot.com>
parents: 20418
diff changeset
1001 instead of all at once, calling write multiple times and
c2b406b4ccd7 Port a custom emoticon crash fix that seemed to get lost somewhere along
Stu Tomlinson <stu@nosnilmot.com>
parents: 20418
diff changeset
1002 close once at the very end
c2b406b4ccd7 Port a custom emoticon crash fix that seemed to get lost somewhere along
Stu Tomlinson <stu@nosnilmot.com>
parents: 20418
diff changeset
1003 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1004 purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size);
20419
c2b406b4ccd7 Port a custom emoticon crash fix that seemed to get lost somewhere along
Stu Tomlinson <stu@nosnilmot.com>
parents: 20418
diff changeset
1005 purple_conv_custom_smiley_close(conv, slpcall->data_info );
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 }
27509
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1007 if (purple_debug_is_verbose())
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1008 purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 MsnSession *session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 MsnSlpLink *slplink;
23556
7fc1fa02184a When receiving an MSN custom smiley, look at the switchboard for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23550
diff changeset
1016 MsnSwitchBoard *swboard;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 MsnObject *obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 char **tokens;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019 char *smile, *body_str;
16031
7873f314fadf Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
1020 const char *body, *who, *sha1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 guint tok;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022 size_t body_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1024 PurpleConversation *conv;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1026 session = cmdproc->servconn->session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1028 if (!purple_account_get_bool(session->account, "custom_smileys", TRUE))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1029 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030
23729
d88fd0d9cb57 Don't assign this stuff in a loop.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23671
diff changeset
1031 swboard = cmdproc->data;
d88fd0d9cb57 Don't assign this stuff in a loop.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23671
diff changeset
1032 conv = swboard->conv;
d88fd0d9cb57 Don't assign this stuff in a loop.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23671
diff changeset
1033
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034 body = msn_message_get_bin_data(msg, &body_len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035 body_str = g_strndup(body, body_len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1037 /* MSN Messenger 7 may send more than one MSNObject in a single message...
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038 * Maybe 10 tokens is a reasonable max value. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1039 tokens = g_strsplit(body_str, "\t", 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1040
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 g_free(body_str);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043 for (tok = 0; tok < 9; tok += 2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 if (tokens[tok] == NULL || tokens[tok + 1] == NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1046 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 smile = tokens[tok];
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1049 obj = msn_object_new_from_string(purple_url_decode(tokens[tok + 1]));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1051 if (obj == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054 who = msn_object_get_creator(obj);
16031
7873f314fadf Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
1055 sha1 = msn_object_get_sha1(obj);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 slplink = msn_session_get_slplink(session, who);
24352
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1058 if (slplink->swboard != swboard) {
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1059 if (slplink->swboard != NULL)
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1060 /*
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1061 * Apparently we're using a different switchboard now or
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1062 * something? I don't know if this is normal, but it
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1063 * definitely happens. So make sure the old switchboard
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1064 * doesn't still have a reference to us.
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1065 */
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1066 slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink);
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1067 slplink->swboard = swboard;
24382
809de3ab85d1 If we're setting swboard here then we need to add the slplink to the
Mark Doliner <mark@kingant.net>
parents: 24352
diff changeset
1068 slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink);
24352
b44e1bbd5b4a Attempt to avoid a crash in MSN. See the comment in the code.
Mark Doliner <mark@kingant.net>
parents: 24350
diff changeset
1069 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 /* If the conversation doesn't exist then this is a custom smiley
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 * used in the first message in a MSN conversation: we need to create
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 * the conversation now, otherwise the custom smiley won't be shown.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 * This happens because every GtkIMHtml has its own smiley tree: if
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 * the conversation doesn't exist then we cannot associate the new
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 * smiley with its GtkIMHtml widget. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 if (!conv) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1078 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, session->account, who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080
16031
7873f314fadf Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
1081 if (purple_conv_custom_smiley_add(conv, smile, "sha1", sha1, TRUE)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 msn_object_destroy(obj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 obj = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087 who = NULL;
16031
7873f314fadf Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
1088 sha1 = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 g_strfreev(tokens);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1094 buddy_icon_cached(PurpleConnection *gc, MsnObject *obj)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1095 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1096 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1097 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 const char *old;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099 const char *new;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101 g_return_val_if_fail(obj != NULL, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1102
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1103 account = purple_connection_get_account(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1105 buddy = purple_find_buddy(account, msn_object_get_creator(obj));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 if (buddy == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1108
16386
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 16031
diff changeset
1109 old = purple_buddy_icons_get_checksum_for_user(buddy);
16031
7873f314fadf Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
1110 new = msn_object_get_sha1(obj);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112 if (new == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1115 /* If the old and new checksums are the same, and the file actually exists,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1116 * then return TRUE */
16388
d4c79390d424 There's no need to actually lookup the icon now, as the core ensures the checksum gets deleted if the file disappears.
Richard Laager <rlaager@wiktel.com>
parents: 16386
diff changeset
1117 if (old != NULL && !strcmp(old, new))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1118 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 msn_release_buddy_icon_request(MsnUserList *userlist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 MsnUser *user;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128 g_return_if_fail(userlist != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129
27509
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1130 if (purple_debug_is_verbose())
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1131 purple_debug_info("msn", "Releasing buddy icon request\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133 if (userlist->buddy_icon_window > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135 GQueue *queue;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1136 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137 const char *username;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1138
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1139 queue = userlist->buddy_icon_requests;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1140
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141 if (g_queue_is_empty(userlist->buddy_icon_requests))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1143
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1144 user = g_queue_pop_head(queue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 account = userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 username = user->passport;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 userlist->buddy_icon_window--;
23542
01c3074b2299 A patch from felipec to make (msn_)request_user_display static.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23300
diff changeset
1150 request_user_display(user);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151
27509
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1152 if (purple_debug_is_verbose())
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1153 purple_debug_info("msn",
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1154 "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n",
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1155 userlist->buddy_icon_window);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160 * Called on a timeout from end_user_display(). Frees a buddy icon window slow and dequeues the next
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161 * buddy icon request if there is one.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1163 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164 msn_release_buddy_icon_request_timeout(gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1165 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1166 MsnUserList *userlist = (MsnUserList *)data;
23300
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23131
diff changeset
1167
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1168 /* Free one window slot */
23300
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23131
diff changeset
1169 userlist->buddy_icon_window++;
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23131
diff changeset
1170
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1171 /* Clear the tag for our former request timer */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172 userlist->buddy_icon_request_timer = 0;
23300
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23131
diff changeset
1173
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174 msn_release_buddy_icon_request(userlist);
23300
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23131
diff changeset
1175
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1177 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1179 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180 msn_queue_buddy_icon_request(MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1182 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1183 MsnObject *obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1184 GQueue *queue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1186 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 account = user->userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1189
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1190 obj = msn_user_get_object(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1192 if (obj == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1193 {
16702
7891f854bbb8 disapproval of revision '6784458226495385202ec621f5d645002ea93d07'
Richard Laager <rlaager@wiktel.com>
parents: 16701
diff changeset
1194 purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1195 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198 if (!buddy_icon_cached(account->gc, obj))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1199 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1200 MsnUserList *userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1201
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1202 userlist = user->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1203 queue = userlist->buddy_icon_requests;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1204
27509
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1205 if (purple_debug_is_verbose())
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1206 purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n",
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1207 user->passport, userlist->buddy_icon_window);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1208
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1209 g_queue_push_tail(queue, user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1210
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1211 if (userlist->buddy_icon_window > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1212 msn_release_buddy_icon_request(userlist);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1213 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1214 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217 got_user_display(MsnSlpCall *slpcall,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1218 const guchar *data, gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1219 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1220 MsnUserList *userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221 const char *info;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1222 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224 g_return_if_fail(slpcall != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1225
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226 info = slpcall->data_info;
27509
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1227 if (purple_debug_is_verbose())
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1228 purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1230 userlist = slpcall->slplink->session->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231 account = slpcall->slplink->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1233 purple_buddy_icons_set_for_user(account, slpcall->slplink->remote_user,
16391
24bbd7e46bfe Change the imgstore and by extension, then the buddy icon code to take over
Richard Laager <rlaager@wiktel.com>
parents: 16390
diff changeset
1234 g_memdup(data, size), size, info);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237 /* Free one window slot */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1238 userlist->buddy_icon_window++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1239
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1240 purple_debug_info("msn", "got_user_display(): buddy_icon_window++ yields =%d\n",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241 userlist->buddy_icon_window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243 msn_release_buddy_icon_request(userlist);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1245 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 end_user_display(MsnSlpCall *slpcall, MsnSession *session)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1249 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1250 MsnUserList *userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1251
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1252 g_return_if_fail(session != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253
27509
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1254 if (purple_debug_is_verbose())
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1255 purple_debug_info("msn", "End User Display\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1257 userlist = session->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1258
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1259 /* If the session is being destroyed we better stop doing anything. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1260 if (session->destroying)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1263 /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1264 * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1265 * send us an error 800 like so:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1266 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1267 * C: NS 000: XFR 21 SB
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1268 * S: NS 000: 800 21
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1269 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 if (userlist->buddy_icon_request_timer) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1271 /* Free the window slot used by this previous request */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 userlist->buddy_icon_window++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274 /* Clear our pending timeout */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1275 purple_timeout_remove(userlist->buddy_icon_request_timer);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1276 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1277
24342
9bdaf273c0ff Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents: 24341
diff changeset
1278 /* Wait BUDDY_ICON_DELAY s before freeing our window slot and requesting the next icon. */
9bdaf273c0ff Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents: 24341
diff changeset
1279 userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280 msn_release_buddy_icon_request_timeout, userlist);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1281 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1282
23542
01c3074b2299 A patch from felipec to make (msn_)request_user_display static.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23300
diff changeset
1283 static void
01c3074b2299 A patch from felipec to make (msn_)request_user_display static.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23300
diff changeset
1284 request_user_display(MsnUser *user)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1285 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1286 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1287 MsnSession *session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1288 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1289 MsnObject *obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1290 const char *info;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1291
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1292 session = user->userlist->session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 account = session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1294
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1295 slplink = msn_session_get_slplink(session, user->passport);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1296
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1297 obj = msn_user_get_object(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1298
16031
7873f314fadf Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
1299 info = msn_object_get_sha1(obj);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1301 if (g_ascii_strcasecmp(user->passport,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
1302 purple_account_get_username(account)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1303 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1304 msn_slplink_request_object(slplink, info, got_user_display,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1305 end_user_display, obj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1306 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1307 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1308 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1309 MsnObject *my_obj = NULL;
16390
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16388
diff changeset
1310 gconstpointer data = NULL;
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16388
diff changeset
1311 size_t len = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1312
27509
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1313 if (purple_debug_is_verbose())
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1314 purple_debug_info("msn", "Requesting our own user display\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1316 my_obj = msn_user_get_object(session->user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1318 if (my_obj != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1319 {
16390
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16388
diff changeset
1320 PurpleStoredImage *img = msn_object_get_image(my_obj);
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16388
diff changeset
1321 data = purple_imgstore_get_data(img);
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16388
diff changeset
1322 len = purple_imgstore_get_size(img);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1323 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1324
16482
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16391
diff changeset
1325 purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1326
23545
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
1327 /* Free one window slot */
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
1328 session->userlist->buddy_icon_window++;
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
1329
27509
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1330 if (purple_debug_is_verbose())
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1331 purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n",
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26599
diff changeset
1332 session->userlist->buddy_icon_window);
23545
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
1333
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23544
diff changeset
1334 msn_release_buddy_icon_request(session->userlist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1336 }