annotate libpurple/protocols/msn/slp.c @ 30811:fcfe022982e4

This header is needed to know the max size of a part.
author masca@cpw.pidgin.im
date Sat, 19 Jun 2010 22:28:59 +0000
parents 37ea491f1f79
children 4e0593a35b8c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file msnslp.c MSNSLP support
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
4 * purple
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19591
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 */
30742
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 30735
diff changeset
24
30758
230caecf5435 Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents: 30742
diff changeset
25 #include "internal.h"
30742
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 30735
diff changeset
26 #include "debug.h"
a99b6dcdb60d Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents: 30735
diff changeset
27
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "slp.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "slpcall.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "slpmsg.h"
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
31 #include "msnutils.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "object.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "user.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "switchboard.h"
30811
fcfe022982e4 This header is needed to know the max size of a part.
masca@cpw.pidgin.im
parents: 30810
diff changeset
36 #include "sbconn.h"
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
37 #include "directconn.h"
30762
e03f912141dd Start moving p2p specific code to its own module.
masca@cpw.pidgin.im
parents: 30760
diff changeset
38 #include "p2p.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
22512
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
40 #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
41
30081
ee423c6c71b6 Minor comment fix.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30079
diff changeset
42 /* seconds to delay between sending buddy icon requests to the server. */
24399
9bdaf273c0ff Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents: 24398
diff changeset
43 #define BUDDY_ICON_DELAY 20
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
45 static void request_user_display(MsnUser *user);
15373
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 * Util
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 **************************************************************************/
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 static char *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 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
54 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 const char *c, *c2;
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 ((c = strstr(str, start)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 c += strlen(start);
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 if (end != NULL)
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 if ((c2 = strstr(c, end)) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 return g_strndup(c, c2 - 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 else
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 /* This has to be changed */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 return g_strdup(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 * Xfer
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
82 msn_xfer_init(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 /* MsnSlpLink *slplink; */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 char *content;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
88 purple_debug_info("msn", "xfer_init\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 slpcall = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 /* Send Ok */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 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
94 slpcall->session_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
96 msn_slp_send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 g_free(content);
24401
bceefbae1ca6 Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents: 24399
diff changeset
100 msn_slplink_send_queued_slpmsgs(slpcall->slplink);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
104 msn_xfer_cancel(PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 char *content;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 g_return_if_fail(xfer != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 g_return_if_fail(xfer->data != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 slpcall = xfer->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
114 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 if (slpcall->started)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 {
24398
b27908701f66 For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents: 24392
diff changeset
118 msn_slpcall_close(slpcall);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 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
123 slpcall->session_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
125 msn_slp_send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 g_free(content);
24401
bceefbae1ca6 Reame msn_slplink_unleash to msn_slplink_send_queued_slpmsgs, which I
Mark Doliner <mark@kingant.net>
parents: 24399
diff changeset
129 msn_slplink_send_queued_slpmsgs(slpcall->slplink);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
28796
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: 28694
diff changeset
131 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: 28694
diff changeset
132 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: 28694
diff changeset
133 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: 28694
diff changeset
134 msn_slpcall_destroy(slpcall);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
28691
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
139 gssize
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
140 msn_xfer_write(const guchar *data, gsize len, PurpleXfer *xfer)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 {
28691
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
142 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: 28168
diff changeset
143
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
144 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: 28168
diff changeset
145 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: 28168
diff changeset
146 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: 28168
diff changeset
147
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
148 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: 28168
diff changeset
149
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
150 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: 28168
diff changeset
151 /* 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: 28168
diff changeset
152 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: 28168
diff changeset
153
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
154 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: 28168
diff changeset
155
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
156 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: 28168
diff changeset
157 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: 28168
diff changeset
158 msn_slplink_send_msgpart(slpcall->slplink, slpcall->xfer_msg);
30810
37ea491f1f79 Avoid magic numbers.
masca@cpw.pidgin.im
parents: 30809
diff changeset
159 return MIN(MSN_SBCONN_MAX_SIZE, len);
28691
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
160 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161
28691
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
162 gssize
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
163 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: 28168
diff changeset
164 {
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
165 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: 28168
diff changeset
166 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: 28168
diff changeset
167
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
168 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: 28168
diff changeset
169 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: 28168
diff changeset
170
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
171 g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE, -1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172
28691
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
173 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: 28168
diff changeset
174 /* 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: 28168
diff changeset
175 g_return_val_if_fail(slpcall != NULL, -1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176
28691
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
177 /* 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: 28168
diff changeset
178 *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: 28168
diff changeset
179 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: 28168
diff changeset
180
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
181 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: 28168
diff changeset
182 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: 28168
diff changeset
183
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
184 return len;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 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
189 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
190 if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
191 (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
192 (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
194 purple_xfer_cancel_remote(slpcall->xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 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
200 gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 {
17054
21830d70709b Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents: 16693
diff changeset
202 PurpleXfer *xfer = slpcall->xfer;
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
203
17054
21830d70709b Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents: 16693
diff changeset
204 purple_xfer_set_completed(xfer, TRUE);
21830d70709b Patch from sourceforge tracker 1652005 from wabz to fix displaying file
Stu Tomlinson <stu@nosnilmot.com>
parents: 16693
diff changeset
205 purple_xfer_end(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 * SLP Control
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
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
212 void
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
213 msn_slp_send_ok(MsnSlpCall *slpcall, const char *branch,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 const char *type, const char *content)
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 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 slplink = slpcall->slplink;
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 /* 200 OK */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 slpmsg = msn_slpmsg_sip_new(slpcall, 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 "MSNSLP/1.0 200 OK",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 branch, type, content);
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 slpmsg->info = "SLP 200 OK";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 slpmsg->text_body = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 msn_slplink_queue_slpmsg(slplink, slpmsg);
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
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
232 void
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
233 msn_slp_send_decline(MsnSlpCall *slpcall, const char *branch,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 const char *type, const char *content)
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 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 slplink = slpcall->slplink;
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 /* 603 Decline */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 slpmsg = msn_slpmsg_sip_new(slpcall, 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 "MSNSLP/1.0 603 Decline",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 branch, type, content);
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 slpmsg->info = "SLP 603 Decline";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 slpmsg->text_body = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 msn_slplink_queue_slpmsg(slplink, slpmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
252 /* XXX: this could be improved if we tracked custom smileys
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
253 * per-protocol, per-account, per-session or (ideally) per-conversation
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
254 */
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
255 static PurpleStoredImage *
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
256 find_valid_emoticon(PurpleAccount *account, const char *path)
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
257 {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
258 GList *smileys;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
259
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
260 if (!purple_account_get_bool(account, "custom_smileys", TRUE))
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
261 return NULL;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
262
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
263 smileys = purple_smileys_get_all();
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
264
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
265 for (; smileys; smileys = g_list_delete_link(smileys, smileys)) {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
266 PurpleSmiley *smiley;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
267 PurpleStoredImage *img;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
268
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
269 smiley = smileys->data;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
270 img = purple_smiley_get_stored_image(smiley);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
271
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
272 if (purple_strequal(path, purple_imgstore_get_filename(img))) {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
273 g_list_free(smileys);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
274 return img;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
275 }
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
276
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
277 purple_imgstore_unref(img);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
278 }
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
279
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
280 purple_debug_error("msn", "Received illegal request for file %s\n", path);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
281 return NULL;
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
282 }
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
283
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
284 static char *
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
285 parse_dc_nonce(const char *content, MsnDirectConnNonceType *ntype)
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
286 {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
287 char *nonce;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
288
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
289 *ntype = DC_NONCE_UNKNOWN;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
290
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
291 nonce = get_token(content, "Hashed-Nonce: {", "}\r\n");
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
292 if (nonce) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
293 *ntype = DC_NONCE_SHA1;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
294 } else {
30122
fc93bc1a546f So, elb informs me this is probably not safe on non-x86 architectures.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30101
diff changeset
295 guint32 n1, n6;
fc93bc1a546f So, elb informs me this is probably not safe on non-x86 architectures.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30101
diff changeset
296 guint16 n2, n3, n4, n5;
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
297 nonce = get_token(content, "Nonce: {", "}\r\n");
30076
ad6c8747e835 Don't crash if there's no Hashed-Nonce or Nonce.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30075
diff changeset
298 if (nonce
30122
fc93bc1a546f So, elb informs me this is probably not safe on non-x86 architectures.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30101
diff changeset
299 && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%04hx%08x",
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
300 &n1, &n2, &n3, &n4, &n5, &n6) == 6) {
30076
ad6c8747e835 Don't crash if there's no Hashed-Nonce or Nonce.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30075
diff changeset
301 *ntype = DC_NONCE_PLAIN;
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
302 g_free(nonce);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
303 nonce = g_malloc(16);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
304 *(guint32 *)(nonce + 0) = GUINT32_TO_LE(n1);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
305 *(guint16 *)(nonce + 4) = GUINT16_TO_LE(n2);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
306 *(guint16 *)(nonce + 6) = GUINT16_TO_LE(n3);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
307 *(guint16 *)(nonce + 8) = GUINT16_TO_BE(n4);
30122
fc93bc1a546f So, elb informs me this is probably not safe on non-x86 architectures.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30101
diff changeset
308 *(guint16 *)(nonce + 10) = GUINT16_TO_BE(n5);
fc93bc1a546f So, elb informs me this is probably not safe on non-x86 architectures.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30101
diff changeset
309 *(guint32 *)(nonce + 12) = GUINT32_TO_BE(n6);
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
310 } else {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
311 /* Invalid nonce, so ignore request */
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
312 g_free(nonce);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
313 nonce = NULL;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
314 }
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
315 }
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
316
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
317 return nonce;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
318 }
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
319
30075
4bcb8e537fc0 I don't know why this function returns a boolean that's never used.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30074
diff changeset
320 static void
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
321 msn_slp_process_transresp(MsnSlpCall *slpcall, const char *content)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
322 {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
323 /* A direct connection negotiation response */
30027
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30014
diff changeset
324 char *bridge;
30037
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30035
diff changeset
325 char *nonce;
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
326 char *listening;
30027
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30014
diff changeset
327 MsnDirectConn *dc = slpcall->slplink->dc;
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
328 MsnDirectConnNonceType ntype;
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
329
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
330 purple_debug_info("msn", "process_transresp\n");
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
331
30074
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
332 /* Direct connections are disabled. */
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
333 if (!purple_account_get_bool(slpcall->slplink->session->account, "direct_connect", TRUE))
30075
4bcb8e537fc0 I don't know why this function returns a boolean that's never used.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30074
diff changeset
334 return;
30074
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
335
30075
4bcb8e537fc0 I don't know why this function returns a boolean that's never used.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30074
diff changeset
336 g_return_if_fail(dc != NULL);
4bcb8e537fc0 I don't know why this function returns a boolean that's never used.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30074
diff changeset
337 g_return_if_fail(dc->state == DC_STATE_CLOSED);
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
338
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
339 bridge = get_token(content, "Bridge: ", "\r\n");
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
340 nonce = parse_dc_nonce(content, &ntype);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
341 listening = get_token(content, "Listening: ", "\r\n");
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
342 if (listening && bridge && !strcmp(bridge, "TCPv1")) {
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
343 /* Ok, the client supports direct TCP connection */
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
344
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
345 /* We always need this. */
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
346 if (ntype == DC_NONCE_SHA1) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
347 strncpy(dc->remote_nonce, nonce, 36);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
348 dc->remote_nonce[36] = '\0';
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
349 }
30037
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30035
diff changeset
350
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
351 if (!strcasecmp(listening, "false")) {
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
352 if (dc->listen_data != NULL) {
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
353 /*
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
354 * We'll listen for incoming connections but
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
355 * 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: 29495
diff changeset
356 * 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: 29495
diff changeset
357 * and let the callback send the invite.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
358 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
359 slpcall->wait_for_socket = TRUE;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
360
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
361 } else if (dc->listenfd != -1) {
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
362 /* The listening socket is ready. Send the INVITE here. */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
363 msn_dc_send_invite(dc);
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
364
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
365 } else {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
366 /* We weren't able to create a listener either. Use SB. */
30101
7f564cf26ea3 I think it's more accurate to say that a DC is a P2P transfer, so if that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30100
diff changeset
367 msn_dc_fallback_to_sb(dc);
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
368 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
369
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
370 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
371 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
372 * We should connect to the client so parse
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
373 * IP/port from response.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
374 */
30027
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30014
diff changeset
375 char *ip, *port_str;
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30014
diff changeset
376 int port = 0;
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
377
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
378 if (ntype == DC_NONCE_PLAIN) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
379 /* Only needed for listening side. */
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
380 memcpy(dc->nonce, nonce, 16);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
381 }
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
382
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
383 /* Cancel any listen attempts because we don't need them. */
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
384 if (dc->listenfd_handle != 0) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
385 purple_input_remove(dc->listenfd_handle);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
386 dc->listenfd_handle = 0;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
387 }
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
388 if (dc->connect_timeout_handle != 0) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
389 purple_timeout_remove(dc->connect_timeout_handle);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
390 dc->connect_timeout_handle = 0;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
391 }
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
392 if (dc->listenfd != -1) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
393 purple_network_remove_port_mapping(dc->listenfd);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
394 close(dc->listenfd);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
395 dc->listenfd = -1;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
396 }
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
397 if (dc->listen_data != NULL) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
398 purple_network_listen_cancel(dc->listen_data);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
399 dc->listen_data = NULL;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
400 }
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
401
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
402 /* 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: 29495
diff changeset
403 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: 29495
diff changeset
404 port_str = get_token(content, "IPv4External-Port: ", "\r\n");
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
405 if (port_str) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
406 dc->ext_port = atoi(port_str);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
407 g_free(port_str);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
408 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
409
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
410 ip = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
411 port_str = get_token(content, "IPv4Internal-Port: ", "\r\n");
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
412 if (port_str) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
413 port = atoi(port_str);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
414 g_free(port_str);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
415 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
416
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
417 if (ip && port) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
418 /* Try internal address first */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
419 dc->connect_data = purple_proxy_connect(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
420 NULL,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
421 slpcall->slplink->session->account,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
422 ip,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
423 port,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
424 msn_dc_connected_to_peer_cb,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
425 dc
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
426 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
427
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
428 if (dc->connect_data) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
429 /* Add connect timeout handle */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
430 dc->connect_timeout_handle = purple_timeout_add_seconds(
30079
1aa1e1e1876d Make it more explicit that incoming and outgoing timeouts are different.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30078
diff changeset
431 DC_OUTGOING_TIMEOUT,
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
432 msn_dc_outgoing_connection_timeout_cb,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
433 dc
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
434 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
435 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
436 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
437 * Connection failed
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
438 * Try external IP/port (if specified)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
439 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
440 msn_dc_outgoing_connection_timeout_cb(dc);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
441 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
442
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
443 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
444 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
445 * Omitted or invalid internal IP address / port
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
446 * Try external IP/port (if specified)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
447 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
448 msn_dc_outgoing_connection_timeout_cb(dc);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
449 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
450
30027
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30014
diff changeset
451 g_free(ip);
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
452 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
453
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
454 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
455 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
456 * Invalid direct connect invitation or
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
457 * TCP connection is not supported
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
458 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
459 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
460
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
461 g_free(listening);
30037
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30035
diff changeset
462 g_free(nonce);
30027
e7d298d270bc Fix some double-frees and/or leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30014
diff changeset
463 g_free(bridge);
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
464
30075
4bcb8e537fc0 I don't know why this function returns a boolean that's never used.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30074
diff changeset
465 return;
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
466 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
467
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 got_sessionreq(MsnSlpCall *slpcall, const char *branch,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 const char *euf_guid, const char *context)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 {
27869
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: 27820
diff changeset
472 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: 27820
diff changeset
473
23505
efa4534fd23a Clean up some #define's in msn.h and various supporting changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
474 if (!strcmp(euf_guid, MSN_OBJ_GUID))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 /* 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
477 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
478 gsize len;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 MsnObject *obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 char *msnobj_data;
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
483 PurpleStoredImage *img = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 int type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 /* Send Ok */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 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
488 slpcall->session_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
490 msn_slp_send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 g_free(content);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 slplink = slpcall->slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
497 msnobj_data = (char *)purple_base64_decode(context, &len);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 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
499 type = msn_object_get_type(obj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 g_free(msnobj_data);
22513
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22512
diff changeset
501 if (type == MSN_OBJECT_EMOTICON) {
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
502 img = find_valid_emoticon(slplink->session->account, obj->location);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
503 } else if (type == MSN_OBJECT_USERTILE) {
22513
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22512
diff changeset
504 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: 22512
diff changeset
505 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: 22512
diff changeset
506 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: 22512
diff changeset
507 }
22512
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
508 msn_object_destroy(obj);
22513
98167ea7c093 Fix setting display picture/avatar in msnp14. Thanks to Twain28 for reporting the bug. References #1187.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22512
diff changeset
509
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
510 if (img != NULL) {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
511 /* DATA PREP */
30792
9192c59f2f84 Use better function names.
masca@cpw.pidgin.im
parents: 30791
diff changeset
512 slpmsg = msn_slpmsg_dataprep_new(slpcall);
30791
64a6ce55aa63 Move more SlpMessage creation to its module.
masca@cpw.pidgin.im
parents: 30784
diff changeset
513 msn_slpmsg_set_slplink(slpmsg, slplink);
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
514 msn_slplink_queue_slpmsg(slplink, slpmsg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
516 /* DATA */
30792
9192c59f2f84 Use better function names.
masca@cpw.pidgin.im
parents: 30791
diff changeset
517 slpmsg = msn_slpmsg_obj_new(slpcall, img);
30791
64a6ce55aa63 Move more SlpMessage creation to its module.
masca@cpw.pidgin.im
parents: 30784
diff changeset
518 msn_slpmsg_set_slplink(slpmsg, slplink);
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
519 msn_slplink_queue_slpmsg(slplink, slpmsg);
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
520 purple_imgstore_unref(img);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
522 accepted = TRUE;
27869
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: 27820
diff changeset
523
28855
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
524 } else {
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
525 purple_debug_error("msn", "Wrong object.\n");
1be982612d9a *** Plucked rev 4be2df4f72bd8a55cdae7f2554b73342a497c92f (bcc0147bab874ca52c55ad4900545e17528bf8fd):
Daniel Atallah <daniel.atallah@gmail.com>
parents: 28168
diff changeset
526 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 }
27869
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: 27820
diff changeset
528
23505
efa4534fd23a Clean up some #define's in msn.h and various supporting changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
529 else if (!strcmp(euf_guid, MSN_FT_GUID))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 /* File Transfer */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
532 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
533 PurpleXfer *xfer;
29494
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29072
diff changeset
534 MsnFileContext *header;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 gsize bin_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 guint32 file_size;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 char *file_name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 account = slpcall->slplink->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 slpcall->end_cb = msn_xfer_end_cb;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 slpcall->branch = g_strdup(branch);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 slpcall->pending = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
546 xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 slpcall->slplink->remote_user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548
29494
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29072
diff changeset
549 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: 29072
diff changeset
550 if (bin_len >= sizeof(MsnFileContext) - 1 &&
29495
f8a95fdab3bd Fix FT context header length handling. The official client only seems to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29494
diff changeset
551 (header->version == 2 ||
f8a95fdab3bd Fix FT context header length handling. The official client only seems to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29494
diff changeset
552 (header->version == 3 && header->length == sizeof(MsnFileContext) + 63))) {
29494
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29072
diff changeset
553 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: 29072
diff changeset
554
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29072
diff changeset
555 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: 29072
diff changeset
556 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: 29072
diff changeset
557 "UTF-8", "UTF-16LE",
27820
769142e728ec Somehow this bit got left in there. Should really compile this time.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27817
diff changeset
558 NULL, NULL, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559
27941
db99cde1845c Fix crashes when filenames end up being NULL in some prpls. Fixed a minor
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27869
diff changeset
560 purple_xfer_set_filename(xfer, file_name ? file_name : "");
22828
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
561 g_free(file_name);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
562 purple_xfer_set_size(xfer, file_size);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
563 purple_xfer_set_init_fnc(xfer, msn_xfer_init);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
564 purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
565 purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel);
28691
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
566 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: 28168
diff changeset
567 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: 28168
diff changeset
568
59b0c556f787 A quick and dirty hack to make MSN use the in-core code to perform FT.
Paul Aurich <paul@darkrain42.org>
parents: 28168
diff changeset
569 slpcall->u.incoming_data = g_byte_array_new();
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571 slpcall->xfer = xfer;
17114
8ed7b2d32ad1 slpcall now explicitlt references its xfer and unreferences it when it is destroyed. While it *looks* like this should *probably* have happened anyways due to the interactins between xfer_init, xfer_end, and xfer_cancel_remote, having the xfer's owner make this explicit makes the process less fragile and more obvious, and it may fix a crash as the slp is destroyed. Fixes #1070
Evan Schoenberg <evan.s@dreskin.net>
parents: 17113
diff changeset
572 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: 17113
diff changeset
573
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 xfer->data = slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575
29815
3175b89c5156 Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29495
diff changeset
576 if (header->type == 0 && bin_len >= sizeof(MsnFileContext)) {
3175b89c5156 Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29495
diff changeset
577 purple_xfer_set_thumbnail(xfer, &header->preview,
29822
25a53c299713 Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents: 29815
diff changeset
578 bin_len - sizeof(MsnFileContext),
25a53c299713 Allow PRPLs to specify the image formats acceptable for thumbnails (in
Marcus Lundblad <ml@update.uu.se>
parents: 29815
diff changeset
579 "image/png");
29815
3175b89c5156 Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29495
diff changeset
580 }
3175b89c5156 Add support for recieving and sending MSN file transfer previews.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29495
diff changeset
581
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
582 purple_xfer_request(xfer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 }
29494
1a9977557dc9 I never liked randomly poking at offsets. Fortunately, I was able to find
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29072
diff changeset
584 g_free(header);
27869
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: 27820
diff changeset
585
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: 27820
diff changeset
586 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: 27820
diff changeset
587
26517
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24439
diff changeset
588 } 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: 24439
diff changeset
589 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: 24439
diff changeset
590 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: 24439
diff changeset
591 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: 24439
diff changeset
592 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: 24439
diff changeset
593 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: 24439
diff changeset
594 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: 24439
diff changeset
595 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: 24439
diff changeset
596 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: 24439
diff changeset
597 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: 24439
diff changeset
598 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: 24439
diff changeset
599 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: 24439
diff changeset
600 _("%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: 24439
diff changeset
601 "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: 24439
diff changeset
602 "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: 24439
diff changeset
603 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: 24439
diff changeset
604 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: 24439
diff changeset
605 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: 24439
diff changeset
606 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: 24439
diff changeset
607 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: 24439
diff changeset
608 }
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24439
diff changeset
609 }
27869
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: 27820
diff changeset
610
26517
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24439
diff changeset
611 } 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: 24439
diff changeset
612 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: 24439
diff changeset
613 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: 24439
diff changeset
614 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: 24439
diff changeset
615 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: 24439
diff changeset
616 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: 24439
diff changeset
617 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: 24439
diff changeset
618 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: 24439
diff changeset
619 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: 24439
diff changeset
620 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: 24439
diff changeset
621 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: 24439
diff changeset
622 buf = g_strdup_printf(
28025
c9e760d350b8 I was missing a space!
Mark Doliner <mark@kingant.net>
parents: 28024
diff changeset
623 _("%s invited you to view his/her webcam, but "
c9e760d350b8 I was missing a space!
Mark Doliner <mark@kingant.net>
parents: 28024
diff changeset
624 "this is not yet supported."), from);
26517
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24439
diff changeset
625 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: 24439
diff changeset
626 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: 24439
diff changeset
627 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: 24439
diff changeset
628 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: 24439
diff changeset
629 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: 24439
diff changeset
630 }
3609fb4bc78e Inform the user when someone tries to initiate a video call with them in msn.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24439
diff changeset
631 }
27869
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: 27820
diff changeset
632
23505
efa4534fd23a Clean up some #define's in msn.h and various supporting changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
633 } else
efa4534fd23a Clean up some #define's in msn.h and various supporting changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
634 purple_debug_warning("msn", "SLP SessionReq with unknown EUF-GUID: %s\n", euf_guid);
27869
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: 27820
diff changeset
635
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: 27820
diff changeset
636 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: 27820
diff changeset
637 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: 27820
diff changeset
638 slpcall->session_id);
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
639 msn_slp_send_decline(slpcall, branch, "application/x-msnmsgr-sessionreqbody", content);
27869
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: 27820
diff changeset
640 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: 27820
diff changeset
641 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645 send_bye(MsnSlpCall *slpcall, const char *type)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 MsnSlpLink *slplink;
24390
c6c714b7841d Get rid of slplink->local_user because it's a copy of
Mark Doliner <mark@kingant.net>
parents: 23671
diff changeset
648 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 MsnSlpMessage *slpmsg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 char *header;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 slplink = slpcall->slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 g_return_if_fail(slplink != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655
24390
c6c714b7841d Get rid of slplink->local_user because it's a copy of
Mark Doliner <mark@kingant.net>
parents: 23671
diff changeset
656 account = slplink->session->account;
c6c714b7841d Get rid of slplink->local_user because it's a copy of
Mark Doliner <mark@kingant.net>
parents: 23671
diff changeset
657
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0",
24390
c6c714b7841d Get rid of slplink->local_user because it's a copy of
Mark Doliner <mark@kingant.net>
parents: 23671
diff changeset
659 purple_account_get_username(account));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 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
662 "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 type,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665 g_free(header);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667 slpmsg->info = "SLP BYE";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668 slpmsg->text_body = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 msn_slplink_queue_slpmsg(slplink, slpmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674 got_invite(MsnSlpCall *slpcall,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675 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
676 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
677 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 slplink = slpcall->slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 char *euf_guid, *context;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 char *temp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 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
687
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 temp = get_token(content, "SessionID: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 if (temp != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690 slpcall->session_id = atoi(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 g_free(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 temp = get_token(content, "AppID: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 if (temp != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 slpcall->app_id = atoi(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 g_free(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 context = get_token(content, "Context: ", "\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 if (context != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 got_sessionreq(slpcall, branch, euf_guid, context);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
703 g_free(context);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 g_free(euf_guid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 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
707 {
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
708 /* A direct connection negotiation request */
30028
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30027
diff changeset
709 char *bridges;
30037
4e532eedcab4 Save remote nonce, and verify we get the same data when initiating the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30035
diff changeset
710 char *nonce;
30039
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30037
diff changeset
711 MsnDirectConnNonceType ntype;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
713 purple_debug_info("msn", "got_invite: transreqbody received\n");
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
714
30074
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
715 /* Direct connections may be disabled. */
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
716 if (!purple_account_get_bool(slplink->session->account, "direct_connect", TRUE)) {
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
717 msn_slp_send_ok(slpcall, branch,
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
718 "application/x-msnmsgr-transrespbody",
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
719 "Bridge: TCPv1\r\n"
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
720 "Listening: false\r\n"
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
721 "Nonce: {00000000-0000-0000-0000-000000000000}\r\n"
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
722 "\r\n");
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
723 msn_slpcall_session_init(slpcall);
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
724
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
725 return;
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
726 }
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
727
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
728 /* Don't do anything if we already have a direct connection */
30074
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
729 if (slplink->dc != NULL)
30029
5be6177e369e This doesn't appear to be a programming error.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30028
diff changeset
730 return;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
732 bridges = get_token(content, "Bridges: ", "\r\n");
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
733 nonce = parse_dc_nonce(content, &ntype);
30078
3c4f821de25b A nonce doesn't seem to be necessary for an INVITE with Bridges. Didn't I
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30076
diff changeset
734 if (bridges && strstr(bridges, "TCPv1") != NULL) {
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
735 /*
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
736 * Ok, the client supports direct TCP connection
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
737 * Try to create a listening port
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
738 */
30028
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30027
diff changeset
739 MsnDirectConn *dc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
741 dc = msn_dc_new(slpcall);
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
742 if (ntype == DC_NONCE_PLAIN) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
743 /* There is only one nonce for plain auth. */
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
744 dc->nonce_type = ntype;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
745 memcpy(dc->nonce, nonce, 16);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
746 } else if (ntype == DC_NONCE_SHA1) {
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
747 /* Each side has a nonce in SHA1 auth. */
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
748 dc->nonce_type = ntype;
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
749 strncpy(dc->remote_nonce, nonce, 36);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
750 dc->remote_nonce[36] = '\0';
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
751 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
753 dc->listen_data = purple_network_listen_range(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
754 0, 0,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
755 SOCK_STREAM,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
756 msn_dc_listen_socket_created_cb,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
757 dc
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
758 );
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
760 if (dc->listen_data == NULL) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
761 /* Listen socket creation failed */
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
762
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
763 purple_debug_info("msn", "got_invite: listening failed\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764
30039
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30037
diff changeset
765 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: 30037
diff changeset
766 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: 30037
diff changeset
767 "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: 30037
diff changeset
768 "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: 30037
diff changeset
769 "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: 30037
diff changeset
770 "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: 30037
diff changeset
771 "\r\n");
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30037
diff changeset
772 else
a97d60c15e25 Support old-style Nonce, which should let us use direct connections to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30037
diff changeset
773 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: 30037
diff changeset
774 "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: 30037
diff changeset
775 "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: 30037
diff changeset
776 "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: 30037
diff changeset
777 "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: 30037
diff changeset
778 "\r\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
780 } else {
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
781 /*
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
782 * Listen socket created successfully.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
783 * 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: 29495
diff changeset
784 * 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: 29495
diff changeset
785 * the callback function: dc_listen_socket_created_cb
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
786 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
787 purple_debug_info("msn", "got_invite: listening socket created\n");
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
788
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
789 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: 29495
diff changeset
790 slpcall->wait_for_socket = TRUE;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
791 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
792
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
793 } else {
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
794 /*
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
795 * Invalid direct connect invitation or
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
796 * TCP connection is not supported.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
797 */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 g_free(nonce);
30035
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30034
diff changeset
801 g_free(bridges);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 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
804 {
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
805 /* A direct connection negotiation response */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
806 msn_slp_process_transresp(slpcall, content);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 got_ok(MsnSlpCall *slpcall,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 const char *type, const char *content)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 g_return_if_fail(slpcall != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 g_return_if_fail(type != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 {
30028
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30027
diff changeset
819 char *content;
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30027
diff changeset
820 char *header;
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
821 char *nonce = NULL;
30074
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
822 MsnSession *session = slpcall->slplink->session;
30028
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30027
diff changeset
823 MsnSlpMessage *msg;
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30027
diff changeset
824 MsnDirectConn *dc;
30040
0cc4f8651462 Don't bother sending a direct connection request if the other side doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30039
diff changeset
825 MsnUser *user;
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
826
30074
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
827 if (!purple_account_get_bool(session->account, "direct_connect", TRUE)) {
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
828 /* Don't attempt a direct connection if disabled. */
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
829 msn_slpcall_session_init(slpcall);
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
830 return;
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
831 }
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
832
30028
911ca152210c Remove old code that was commented out, but is really just not necessary.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30027
diff changeset
833 if (slpcall->slplink->dc != NULL) {
30040
0cc4f8651462 Don't bother sending a direct connection request if the other side doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30039
diff changeset
834 /* If we already have an established direct connection
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
835 * then just start the transfer.
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
836 */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
837 msn_slpcall_session_init(slpcall);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
838 return;
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
839 }
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
840
30074
d7ecbc47f647 Disable direct connections when the account option is off.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30073
diff changeset
841 user = msn_userlist_find_user(session->userlist,
30040
0cc4f8651462 Don't bother sending a direct connection request if the other side doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30039
diff changeset
842 slpcall->slplink->remote_user);
30055
71c24c85e4af I think user might be NULL here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30049
diff changeset
843 if (!user || !(user->clientid & 0xF0000000)) {
30040
0cc4f8651462 Don't bother sending a direct connection request if the other side doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30039
diff changeset
844 /* Just start a normal SB transfer. */
0cc4f8651462 Don't bother sending a direct connection request if the other side doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30039
diff changeset
845 msn_slpcall_session_init(slpcall);
0cc4f8651462 Don't bother sending a direct connection request if the other side doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30039
diff changeset
846 return;
0cc4f8651462 Don't bother sending a direct connection request if the other side doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30039
diff changeset
847 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
848
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
849 /* Try direct file transfer by sending a second INVITE */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
850 dc = msn_dc_new(slpcall);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
851 slpcall->branch = rand_guid();
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
852
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
853 dc->listen_data = purple_network_listen_range(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
854 0, 0,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
855 SOCK_STREAM,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
856 msn_dc_listen_socket_created_cb,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
857 dc
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
858 );
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
859
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
860 header = g_strdup_printf(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
861 "INVITE MSNMSGR:%s MSNSLP/1.0",
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
862 slpcall->slplink->remote_user
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
863 );
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
864
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
865 if (dc->nonce_type == DC_NONCE_SHA1)
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
866 nonce = g_strdup_printf("Hashed-Nonce: {%s}\r\n", dc->nonce_hash);
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
867
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
868 if (dc->listen_data == NULL) {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
869 /* Listen socket creation failed */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
870 purple_debug_info("msn", "got_ok: listening failed\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
872 content = g_strdup_printf(
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
873 "Bridges: TCPv1\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
874 "NetID: %u\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
875 "Conn-Type: IP-Restrict-NAT\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
876 "UPnPNat: false\r\n"
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
877 "ICF: false\r\n"
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
878 "%s"
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
879 "\r\n",
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
880
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
881 rand() % G_MAXUINT32,
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
882 nonce ? nonce : ""
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
883 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
884
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
885 } else {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
886 /* Listen socket created successfully. */
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
887 purple_debug_info("msn", "got_ok: listening socket created\n");
30014
b1cda3f8fdc9 De-spacify.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30013
diff changeset
888
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
889 content = g_strdup_printf(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
890 "Bridges: TCPv1\r\n"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
891 "NetID: 0\r\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892 "Conn-Type: Direct-Connect\r\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 "UPnPNat: false\r\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
894 "ICF: false\r\n"
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
895 "%s"
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
896 "\r\n",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
898 nonce ? nonce : ""
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
899 );
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
900 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
902 msg = msn_slpmsg_sip_new(
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
903 slpcall,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
904 0,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
905 header,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
906 slpcall->branch,
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
907 "application/x-msnmsgr-transreqbody",
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
908 content
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
909 );
30033
a613180bfeab Set some information for debugging.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30030
diff changeset
910 msg->info = "DC INVITE";
a613180bfeab Set some information for debugging.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30030
diff changeset
911 msg->text_body = TRUE;
30049
b0a7b31dcc5d I think this finally works with both aMSN and the official client, for
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30040
diff changeset
912 g_free(nonce);
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
913 g_free(header);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
914 g_free(content);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
916 msn_slplink_queue_slpmsg(slpcall->slplink, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 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
919 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 /* Do we get this? */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
921 purple_debug_info("msn", "OK with transreqbody\n");
15373
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 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
924 {
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
925 msn_slp_process_transresp(slpcall, content);
15373
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928
30099
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
929 static void
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
930 got_error(MsnSlpCall *slpcall,
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
931 const char *error, const char *type, const char *content)
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
932 {
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
933 /* It's not valid. Kill this off. */
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
934 purple_debug_error("msn", "Received non-OK result: %s\n",
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
935 error ? error : "Unknown");
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
936
30100
3c09870e8564 ALICE sends a "603 Decline" to our DC request, so we need to fallback to a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30099
diff changeset
937 if (type && !strcmp(type, "application/x-msnmsgr-transreqbody")) {
3c09870e8564 ALICE sends a "603 Decline" to our DC request, so we need to fallback to a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30099
diff changeset
938 MsnDirectConn *dc = slpcall->slplink->dc;
3c09870e8564 ALICE sends a "603 Decline" to our DC request, so we need to fallback to a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30099
diff changeset
939 if (dc) {
30101
7f564cf26ea3 I think it's more accurate to say that a DC is a P2P transfer, so if that
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30100
diff changeset
940 msn_dc_fallback_to_sb(dc);
30100
3c09870e8564 ALICE sends a "603 Decline" to our DC request, so we need to fallback to a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30099
diff changeset
941 return;
3c09870e8564 ALICE sends a "603 Decline" to our DC request, so we need to fallback to a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30099
diff changeset
942 }
3c09870e8564 ALICE sends a "603 Decline" to our DC request, so we need to fallback to a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30099
diff changeset
943 }
3c09870e8564 ALICE sends a "603 Decline" to our DC request, so we need to fallback to a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30099
diff changeset
944
30099
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
945 slpcall->wasted = TRUE;
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
946 }
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
947
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 MsnSlpCall *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 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
950 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 MsnSlpCall *slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 if (body == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
954 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
955 purple_debug_warning("msn", "received bogus message\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
956 return NULL;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
959 if (!strncmp(body, "INVITE", strlen("INVITE")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960 {
30694
33b4ae796648 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents: 28876
diff changeset
961 /* This is an INVITE request */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962 char *branch;
29072
69077f3993f6 Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents: 28876
diff changeset
963 char *call_id;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 char *content;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 char *content_type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967 /* From: <msnmsgr:buddy@hotmail.com> */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 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
970 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 branch = get_token(body, ";branch={", "}");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973
29072
69077f3993f6 Fix CVE-2010-0277, a possible remote crash when parsing an incoming
Mark Doliner <mark@kingant.net>
parents: 28876
diff changeset
974 call_id = get_token(body, "Call-ID: {", "}");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977 long content_len = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
979 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
980 if (temp != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 content_len = atoi(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 g_free(temp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 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
985
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 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
987
30035
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30034
diff changeset
988 slpcall = NULL;
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
989 if (branch && call_id)
28168
5546612e70e2 Ignore SLP invites if they do not contain all the required fields. The
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28025
diff changeset
990 {
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
991 slpcall = msn_slplink_find_slp_call(slplink, call_id);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
992 if (slpcall)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
993 {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
994 g_free(slpcall->branch);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
995 slpcall->branch = g_strdup(branch);
30073
2b2549680b5d We want to call got_invite for existing slpcalls, too.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30061
diff changeset
996 got_invite(slpcall, branch, content_type, content);
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
997 }
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
998 else if (content_type && content)
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
999 {
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
1000 slpcall = msn_slpcall_new(slplink);
30035
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30034
diff changeset
1001 slpcall->id = g_strdup(call_id);
30013
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
1002 got_invite(slpcall, branch, content_type, content);
119bd7b072eb Initial support for direct connections. Preliminary patch from ticket #247
kukkerman@gmail.com
parents: 29495
diff changeset
1003 }
28168
5546612e70e2 Ignore SLP invites if they do not contain all the required fields. The
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28025
diff changeset
1004 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005
30035
e47a4a7940ea Fix some leaks, and simplify these branches.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30034
diff changeset
1006 g_free(call_id);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007 g_free(branch);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 g_free(content_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 g_free(content);
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 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
1012 {
30694
33b4ae796648 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents: 28876
diff changeset
1013 /* This is a response */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 char *content;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 char *content_type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1016 /* Make sure this is "OK" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 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
1018 char *call_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1019
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 call_id = get_token(body, "Call-ID: {", "}");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1021 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
1022 g_free(call_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1023
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1024 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
1025
30099
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1026 content_type = get_token(body, "Content-Type: ", "\r\n");
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1027
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1028 content = get_token(body, "\r\n\r\n", NULL);
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1029
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030 if (strncmp(status, "200 OK", 6))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 {
30099
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1032 char *error = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033 const char *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035 /* Eww */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036 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
1037 (c = strchr(status, '\0')))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1038 {
30099
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1039 size_t len = c - status;
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1040 error = g_strndup(status, len);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042
30099
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1043 got_error(slpcall, error, content_type, content);
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1044 g_free(error);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045
30099
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1046 } else {
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1047 /* Everything's just dandy */
ffcc09277b88 Add an error handler for SLP messages instead of bailing out immediately.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30081
diff changeset
1048 got_ok(slpcall, content_type, content);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049 }
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 g_free(content_type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1052 g_free(content);
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 else if (!strncmp(body, "BYE", strlen("BYE")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 {
30694
33b4ae796648 Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents: 28876
diff changeset
1056 /* This is a BYE request */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 char *call_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1059 call_id = get_token(body, "Call-ID: {", "}");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060 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
1061 g_free(call_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1062
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063 if (slpcall != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064 slpcall->wasted = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065
24398
b27908701f66 For some reason the slpmsg and slplink functions don't have underscores
Mark Doliner <mark@kingant.net>
parents: 24392
diff changeset
1066 /* msn_slpcall_destroy(slpcall); */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069 slpcall = NULL;
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 return slpcall;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 /**************************************************************************
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 * Msg Callbacks
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 **************************************************************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 static gboolean
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1079 buddy_icon_cached(PurpleConnection *gc, MsnObject *obj)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1081 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1082 PurpleBuddy *buddy;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 const char *old;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084 const char *new;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 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
1087
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1088 account = purple_connection_get_account(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1090 buddy = purple_find_buddy(account, msn_object_get_creator(obj));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 if (buddy == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093
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
1094 old = purple_buddy_icons_get_checksum_for_user(buddy);
16031
7873f314fadf Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
1095 new = msn_object_get_sha1(obj);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1096
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097 if (new == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100 /* 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
1101 * 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
1102 if (old != NULL && !strcmp(old, new))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1108 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1109 msn_release_buddy_icon_request(MsnUserList *userlist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1110 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111 MsnUser *user;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113 g_return_if_fail(userlist != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114
27432
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26517
diff changeset
1115 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: 26517
diff changeset
1116 purple_debug_info("msn", "Releasing buddy icon request\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1117
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1118 if (userlist->buddy_icon_window > 0)
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 GQueue *queue;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1121 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122 const char *username;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 queue = userlist->buddy_icon_requests;
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 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
1127 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1129 user = g_queue_pop_head(queue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1130
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1131 account = userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1132 username = user->passport;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1134 userlist->buddy_icon_window--;
23497
01c3074b2299 A patch from felipec to make (msn_)request_user_display static.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23298
diff changeset
1135 request_user_display(user);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136
27432
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26517
diff changeset
1137 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: 26517
diff changeset
1138 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: 26517
diff changeset
1139 "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: 26517
diff changeset
1140 userlist->buddy_icon_window);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142 }
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145 * 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
1146 * buddy icon request if there is one.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 static gboolean
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 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
1150 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151 MsnUserList *userlist = (MsnUserList *)data;
23298
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23129
diff changeset
1152
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 /* Free one window slot */
23298
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23129
diff changeset
1154 userlist->buddy_icon_window++;
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23129
diff changeset
1155
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 /* 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
1157 userlist->buddy_icon_request_timer = 0;
23298
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23129
diff changeset
1158
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 msn_release_buddy_icon_request(userlist);
23298
5cdd93dac7a2 Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents: 23129
diff changeset
1160
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161 return FALSE;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164 void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1165 msn_queue_buddy_icon_request(MsnUser *user)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1166 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1167 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1168 MsnObject *obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1169 GQueue *queue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1171 g_return_if_fail(user != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173 account = user->userlist->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175 obj = msn_user_get_object(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1177 if (obj == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1178 {
16693
7891f854bbb8 disapproval of revision '6784458226495385202ec621f5d645002ea93d07'
Richard Laager <rlaager@wiktel.com>
parents: 16692
diff changeset
1179 purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1180 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1181 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1183 if (!buddy_icon_cached(account->gc, obj))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1184 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1185 MsnUserList *userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1187 userlist = user->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1188 queue = userlist->buddy_icon_requests;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1189
27432
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26517
diff changeset
1190 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: 26517
diff changeset
1191 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: 26517
diff changeset
1192 user->passport, userlist->buddy_icon_window);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1194 g_queue_push_tail(queue, user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1195
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1196 if (userlist->buddy_icon_window > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1197 msn_release_buddy_icon_request(userlist);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1198 }
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1201 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1202 got_user_display(MsnSlpCall *slpcall,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1203 const guchar *data, gsize size)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1204 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1205 MsnUserList *userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1206 const char *info;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1207 PurpleAccount *account;
15373
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_return_if_fail(slpcall != NULL);
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 info = slpcall->data_info;
27432
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26517
diff changeset
1212 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: 26517
diff changeset
1213 purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user);
15373
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 userlist = slpcall->slplink->session->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1216 account = slpcall->slplink->session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1217
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1218 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
1219 g_memdup(data, size), size, info);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1221 #if 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1222 /* Free one window slot */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1223 userlist->buddy_icon_window++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1224
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1225 purple_debug_info("msn", "got_user_display(): buddy_icon_window++ yields =%d\n",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1226 userlist->buddy_icon_window);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1227
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1228 msn_release_buddy_icon_request(userlist);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1229 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1230 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1232 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1233 end_user_display(MsnSlpCall *slpcall, MsnSession *session)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1234 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1235 MsnUserList *userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1237 g_return_if_fail(session != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1238
27432
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26517
diff changeset
1239 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: 26517
diff changeset
1240 purple_debug_info("msn", "End User Display\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1242 userlist = session->userlist;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1243
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1244 /* 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
1245 if (session->destroying)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1246 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1248 /* 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
1249 * 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
1250 * send us an error 800 like so:
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 * C: NS 000: XFR 21 SB
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1253 * S: NS 000: 800 21
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1254 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1255 if (userlist->buddy_icon_request_timer) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1256 /* 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
1257 userlist->buddy_icon_window++;
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 /* Clear our pending timeout */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1260 purple_timeout_remove(userlist->buddy_icon_request_timer);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1261 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1262
24399
9bdaf273c0ff Use purple_timeout_add_seconds() instead of purple_timeout_add() in a
Mark Doliner <mark@kingant.net>
parents: 24398
diff changeset
1263 /* 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: 24398
diff changeset
1264 userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1265 msn_release_buddy_icon_request_timeout, userlist);
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
23497
01c3074b2299 A patch from felipec to make (msn_)request_user_display static.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23298
diff changeset
1268 static void
01c3074b2299 A patch from felipec to make (msn_)request_user_display static.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23298
diff changeset
1269 request_user_display(MsnUser *user)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1270 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1271 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1272 MsnSession *session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1273 MsnSlpLink *slplink;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1274 MsnObject *obj;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1275 const char *info;
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 session = user->userlist->session;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1278 account = session->account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1279
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1280 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
1281
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1282 obj = msn_user_get_object(user);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1283
16031
7873f314fadf Patch in Trac ticket #113 from Simom.
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
1284 info = msn_object_get_sha1(obj);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1286 if (g_ascii_strcasecmp(user->passport,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
1287 purple_account_get_username(account)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1288 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1289 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
1290 end_user_display, obj);
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 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1293 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1294 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
1295 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
1296 size_t len = 0;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1297
27432
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26517
diff changeset
1298 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: 26517
diff changeset
1299 purple_debug_info("msn", "Requesting our own user display\n");
15373
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 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
1302
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1303 if (my_obj != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1304 {
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
1305 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
1306 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
1307 len = purple_imgstore_get_size(img);
15373
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
16474
3be560001d26 Kill some compiler warnings and TODOs of mine.
Richard Laager <rlaager@wiktel.com>
parents: 16391
diff changeset
1310 purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1311
23500
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
1312 /* Free one window slot */
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
1313 session->userlist->buddy_icon_window++;
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
1314
27432
35b6fd563056 Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26517
diff changeset
1315 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: 26517
diff changeset
1316 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: 26517
diff changeset
1317 session->userlist->buddy_icon_window);
23500
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
1318
1061a9ad1ddb disapproval of revision '075bff91d9cbcfd6f59c270802c5bffeb98c3b50'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23499
diff changeset
1319 msn_release_buddy_icon_request(session->userlist);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1320 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1321 }