annotate src/protocols/msn/slp.c @ 13678:299536c4caf1

[gaim-migrate @ 16080] Set the SIP/SIMPLE user-agent string to something more that I think makes more sense, and set wants_to_die in two places when disconnecting. This causes the account to be disable until the user re-enables it. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 22 Apr 2006 15:13:51 +0000
parents 442b23efba54
children 967ef719cb62
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file msnslp.c MSNSLP support
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * gaim
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
6 * Gaim is the legal property of its developers, whose names are too numerous
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
8 * source distribution.
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * (at your option) any later version.
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * GNU General Public License for more details.
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "msn.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "slp.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 #include "slpcall.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "slpmsg.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 #include "slpsession.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 #include "object.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 #include "user.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 #include "switchboard.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
34 /* ms to delay between sending buddy icon requests to the server. */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
35 #define BUDDY_ICON_DELAY 20000
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
36
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 static void send_ok(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 const char *type, const char *content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 static void send_decline(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 const char *type, const char *content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
43 void msn_request_user_display(MsnUser *user);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
44
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 /**************************************************************************
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 * Util
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 **************************************************************************/
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48
11897
a1aa681f1448 [gaim-migrate @ 14188]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11595
diff changeset
49 static char *
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 get_token(const char *str, const char *start, const char *end)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 const char *c, *c2;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 if ((c = strstr(str, start)) == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 c += strlen(start);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 if (end != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 if ((c2 = strstr(c, end)) == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 return NULL;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
63
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 return g_strndup(c, c2 - c);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 /* This has to be changed */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 return g_strdup(c);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 /**************************************************************************
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 * Xfer
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 **************************************************************************/
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 msn_xfer_init(GaimXfer *xfer)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 /* MsnSlpLink *slplink; */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 gaim_debug_info("msn", "xfer_init\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 slpcall = xfer->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 /* Send Ok */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 slpcall->session_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 msn_slplink_unleash(slpcall->slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 msn_xfer_cancel(GaimXfer *xfer)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105
9788
1e9ecca6c97e [gaim-migrate @ 10656]
Luke Schierer <lschiere@pidgin.im>
parents: 9739
diff changeset
106 g_return_if_fail(xfer != NULL);
1e9ecca6c97e [gaim-migrate @ 10656]
Luke Schierer <lschiere@pidgin.im>
parents: 9739
diff changeset
107 g_return_if_fail(xfer->data != NULL);
1e9ecca6c97e [gaim-migrate @ 10656]
Luke Schierer <lschiere@pidgin.im>
parents: 9739
diff changeset
108
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 slpcall = xfer->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 if (slpcall->started)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 msn_slp_call_close(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 slpcall->session_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 msn_slplink_unleash(slpcall->slplink);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
127
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
128 msn_slp_call_destroy(slpcall);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize len, gsize offset)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136 GaimXfer *xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
138 xfer = slpcall->xfer;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9198
diff changeset
140 xfer->bytes_sent = (offset + len);
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9198
diff changeset
141 xfer->bytes_remaining = total_length - (offset + len);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 gaim_xfer_update_progress(xfer);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 void
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
147 msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
149 if ((gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_DONE) &&
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
150 (gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_CANCEL_REMOTE) &&
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
151 (gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_CANCEL_LOCAL))
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9198
diff changeset
152 {
10226
62ab1a4c3a2a [gaim-migrate @ 11359]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10225
diff changeset
153 gaim_xfer_cancel_remote(slpcall->xfer);
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9198
diff changeset
154 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156
9259
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
157 void
11138
834a40ddab95 [gaim-migrate @ 13202]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
158 msn_xfer_completed_cb(MsnSlpCall *slpcall, const guchar *body,
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
159 gsize size)
9259
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
160 {
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
161 gaim_xfer_set_completed(slpcall->xfer, TRUE);
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
162 }
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
163
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 /**************************************************************************
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 * SLP Control
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 **************************************************************************/
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 got_transresp(MsnSlpCall *slpcall, const char *nonce,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 const char *ips_str, int port)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 MsnDirectConn *directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 char **ip_addrs, **c;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 directconn = msn_directconn_new(slpcall->slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 directconn->initial_call = slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 /* msn_directconn_parse_nonce(directconn, nonce); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 directconn->nonce = g_strdup(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 ip_addrs = g_strsplit(ips_str, " ", -1);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 for (c = ip_addrs; *c != NULL; c++)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 gaim_debug_info("msn", "ip_addr = %s\n", *c);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 if (msn_directconn_connect(directconn, *c, port))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 break;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 g_strfreev(ip_addrs);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 send_ok(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 /* 200 OK */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 slpmsg = msn_slpmsg_sip_new(slpcall, 1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 "MSNSLP/1.0 200 OK",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 branch, type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
210 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 slpmsg->info = "SLP 200 OK";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 msn_slp_call_session_init(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 send_decline(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 /* 603 Decline */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 slpmsg = msn_slpmsg_sip_new(slpcall, 1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231 "MSNSLP/1.0 603 Decline",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 branch, type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
234 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 slpmsg->info = "SLP 603 Decline";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
242 #define MAX_FILE_NAME_LEN 0x226
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
243
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 got_sessionreq(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 const char *euf_guid, const char *context)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 if (!strcmp(euf_guid, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 /* Emoticon or UserDisplay */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 MsnSlpSession *slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 MsnObject *obj;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 char *msnobj_data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 const char *sha1c;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 const char *file_name;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 char *content;
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11020
diff changeset
259 gsize len;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 int type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 /* Send Ok */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 slpcall->session_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11020
diff changeset
273 msnobj_data = (char *)gaim_base64_decode(context, &len);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 obj = msn_object_new_from_string(msnobj_data);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 type = msn_object_get_type(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 sha1c = msn_object_get_sha1c(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 g_free(msnobj_data);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
278
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 if (!(type == MSN_OBJECT_USERTILE))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 gaim_debug_error("msn", "Wrong object?\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282 msn_object_destroy(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 g_return_if_reached();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 }
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
285
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 file_name = msn_object_get_real_location(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287
9858
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
288 if (file_name == NULL)
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
289 {
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
290 gaim_debug_error("msn", "Wrong object.\n");
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
291 msn_object_destroy(obj);
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
292 g_return_if_reached();
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
293 }
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
294
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
295 msn_object_destroy(obj);
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
296
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 slpsession = msn_slplink_find_slp_session(slplink,
9861
68561f39acdc [gaim-migrate @ 10740]
Luke Schierer <lschiere@pidgin.im>
parents: 9860
diff changeset
298 slpcall->session_id);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
299
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 /* DATA PREP */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301 slpmsg = msn_slpmsg_new(slplink);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
302 slpmsg->slpcall = slpcall;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303 slpmsg->slpsession = slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 slpmsg->session_id = slpsession->id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305 msn_slpmsg_set_body(slpmsg, NULL, 4);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
306 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307 slpmsg->info = "SLP DATA PREP";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 /* DATA */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312 slpmsg = msn_slpmsg_new(slplink);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
313 slpmsg->slpcall = slpcall;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
314 slpmsg->slpsession = slpsession;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 slpmsg->flags = 0x20;
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
316 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 slpmsg->info = "SLP DATA";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 msn_slpmsg_open_file(slpmsg, file_name);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322 else if (!strcmp(euf_guid, "5D3E02AB-6190-11D3-BBBB-00C04F795683"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 /* File Transfer */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 GaimAccount *account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 GaimXfer *xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 char *bin;
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11020
diff changeset
328 gsize bin_len;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 guint32 file_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 char *file_name;
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
331 gunichar2 *uni_name;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 account = slpcall->slplink->session->account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334
9259
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
335 slpcall->cb = msn_xfer_completed_cb;
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
336 slpcall->end_cb = msn_xfer_end_cb;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 slpcall->progress_cb = msn_xfer_progress_cb;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
338 slpcall->branch = g_strdup(branch);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
340 slpcall->pending = TRUE;
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
341
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342 xfer = gaim_xfer_new(account, GAIM_XFER_RECEIVE,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 slpcall->slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11020
diff changeset
345 bin = (char *)gaim_base64_decode(context, &bin_len);
9263
70153c759016 [gaim-migrate @ 10062]
Christian Hammond <chipx86@chipx86.com>
parents: 9259
diff changeset
346 file_size = GUINT32_FROM_LE(*((gsize *)bin + 2));
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
347
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
348 uni_name = (gunichar2 *)(bin + 20);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
349 while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) {
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
350 *uni_name = GUINT16_FROM_LE(*uni_name);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
351 uni_name++;
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
352 }
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
353
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354 file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 NULL, NULL, NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 g_free(bin);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359 gaim_xfer_set_filename(xfer, file_name);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 gaim_xfer_set_size(xfer, file_size);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361 gaim_xfer_set_init_fnc(xfer, msn_xfer_init);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362 gaim_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363 gaim_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 slpcall->xfer = xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366 xfer->data = slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 gaim_xfer_request(xfer);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
370 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373 send_bye(MsnSlpCall *slpcall, const char *type)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 char *header;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 g_return_if_fail(slplink != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383 header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 slplink->local_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 slpmsg = msn_slpmsg_sip_new(slpcall, 0, header,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388 type,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389 "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 g_free(header);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
392 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393 slpmsg->info = "SLP BYE";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 got_invite(MsnSlpCall *slpcall,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 const char *branch, const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 char *euf_guid, *context;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 euf_guid = get_token(content, "EUF-GUID: {", "}\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 temp = get_token(content, "SessionID: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417 slpcall->session_id = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420 temp = get_token(content, "AppID: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 slpcall->app_id = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423 g_free(temp);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
424
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425 context = get_token(content, "Context: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 got_sessionreq(slpcall, branch, euf_guid, context);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
428
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 g_free(context);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 g_free(euf_guid);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 /* A direct connection? */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 char *listening, *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 char *content;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
438
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 if (FALSE)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 MsnDirectConn *directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 /* const char *ip_addr; */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 char *ip_port;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 int port;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 /* ip_addr = gaim_prefs_get_string("/core/ft/public_ip"); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448 ip_port = "5190";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 listening = "true";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 nonce = rand_guid();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 directconn = msn_directconn_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 /* msn_directconn_parse_nonce(directconn, nonce); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 directconn->nonce = g_strdup(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 msn_directconn_listen(directconn);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 port = directconn->port;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 "Bridge: TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463 "Listening: %s\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 "Nonce: {%s}\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 "Ipv4Internal-Addrs: 192.168.0.82\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 "Ipv4Internal-Port: %d\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467 "\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 listening,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469 nonce,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
471 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 listening = "false";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 nonce = g_strdup("00000000-0000-0000-0000-000000000000");
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
477
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 "Bridge: TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 "Listening: %s\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 "Nonce: {%s}\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482 "\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 listening,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484 nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487 send_ok(slpcall, branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 "application/x-msnmsgr-transrespbody", content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 char *ip_addrs;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498 char *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499 int port;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
500
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 nonce = get_token(content, "Nonce: {", "}\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 port = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508 port = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
510
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511 if (ip_addrs == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514 if (port > 0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515 got_transresp(slpcall, nonce, ip_addrs, port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
518 g_free(ip_addrs);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
519 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
520 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
521 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
522
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
523 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
524 got_ok(MsnSlpCall *slpcall,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
525 const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
526 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
527 g_return_if_fail(slpcall != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
528 g_return_if_fail(type != NULL);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
529
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
531 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
532 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 if (slpcall->type == MSN_SLPCALL_DC)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
534 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
535 /* First let's try a DirectConnection. */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
537 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
538 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 char *header;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541 char *branch;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
543 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
544
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545 branch = rand_guid();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
548 "Bridges: TRUDPv1 TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 "NetID: 0\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
550 "Conn-Type: Direct-Connect\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
551 "UPnPNat: false\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
552 "ICF: false\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
553 );
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555 header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558 slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559 "application/x-msnmsgr-transreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
562 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563 slpmsg->info = "SLP INVITE";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 msn_slplink_send_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 g_free(header);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 g_free(content);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
570
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571 g_free(branch);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
574 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
575 msn_slp_call_session_init(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
576 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
577 #else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578 msn_slp_call_session_init(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583 /* Do we get this? */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 gaim_debug_info("msn", "OK with transreqbody\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
586 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
587 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
588 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
589 char *ip_addrs;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591 char *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 int port;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
593
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594 nonce = get_token(content, "Nonce: {", "}\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 port = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
600 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
601 port = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 if (ip_addrs == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 if (port > 0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608 got_transresp(slpcall, nonce, ip_addrs, port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
610 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
611 g_free(ip_addrs);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
612 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
613 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
614 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
615
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
616 MsnSlpCall *
11236
fd6d96ef5c6d [gaim-migrate @ 13382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11235
diff changeset
617 msn_slp_sip_recv(MsnSlpLink *slplink, const char *body)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
619 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620
10907
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
621 if (body == NULL)
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
622 {
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
623 gaim_debug_warning("msn", "received bogus message\n");
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
624 return NULL;
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
625 }
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
626
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
627 if (!strncmp(body, "INVITE", strlen("INVITE")))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629 char *branch;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631 char *content_type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
632
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633 slpcall = msn_slp_call_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
634
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
635 /* From: <msnmsgr:buddy@hotmail.com> */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
636 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
637 slpcall->remote_user = get_token(body, "From: <msnmsgr:", ">\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
638 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
639
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
640 branch = get_token(body, ";branch={", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
641
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642 slpcall->id = get_token(body, "Call-ID: {", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
645 long content_len = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
646
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
647 temp = get_token(body, "Content-Length: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
648 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
649 content_len = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
651 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
652 content_type = get_token(body, "Content-Type: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
653
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
654 content = get_token(body, "\r\n\r\n", NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
655
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
656 got_invite(slpcall, branch, content_type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
657
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
658 g_free(branch);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659 g_free(content_type);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
661 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
662 else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 ")))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
664 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
665 char *content_type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666 /* Make sure this is "OK" */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
667 const char *status = body + strlen("MSNSLP/1.0 ");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
668 char *call_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
669
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
670 call_id = get_token(body, "Call-ID: {", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
671 slpcall = msn_slplink_find_slp_call(slplink, call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
672 g_free(call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
673
9231
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
674 g_return_val_if_fail(slpcall != NULL, NULL);
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
675
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
676 if (strncmp(status, "200 OK", 6))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
677 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
678 /* It's not valid. Kill this off. */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
679 char temp[32];
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
680 const char *c;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
681
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
682 /* Eww */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
683 if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) ||
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
684 (c = strchr(status, '\0')))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
685 {
9739
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
686 size_t offset = c - status;
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
687 if (offset >= sizeof(temp))
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
688 offset = sizeof(temp) - 1;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
689
9739
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
690 strncpy(temp, status, offset);
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
691 temp[offset] = '\0';
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
692 }
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
693
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
694 gaim_debug_error("msn", "Received non-OK result: %s\n", temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
695
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
696 slpcall->wasted = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
697
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
698 /* msn_slp_call_destroy(slpcall); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
699 return slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
700 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
701
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
702 content_type = get_token(body, "Content-Type: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
703
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
704 content = get_token(body, "\r\n\r\n", NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
705
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
706 got_ok(slpcall, content_type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
707
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
708 g_free(content_type);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
709 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
710 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
711 else if (!strncmp(body, "BYE", strlen("BYE")))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
712 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
713 char *call_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
714
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
715 call_id = get_token(body, "Call-ID: {", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
716 slpcall = msn_slplink_find_slp_call(slplink, call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
717 g_free(call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
718
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
719 if (slpcall != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
720 slpcall->wasted = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
721
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
722 /* msn_slp_call_destroy(slpcall); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
723 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
724 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
725 slpcall = NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
726
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
727 return slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
728 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
729
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
730 /**************************************************************************
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
731 * Msg Callbacks
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
732 **************************************************************************/
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
733
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
734 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
735 msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
736 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
737 MsnSession *session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
739
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
740 session = cmdproc->servconn->session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
741 slplink = msn_session_get_slplink(session, msg->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
742
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
743 if (slplink->swboard == NULL)
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
744 {
10887
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
745 /* We will need this in order to change its flags. */
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
746 slplink->swboard = (MsnSwitchBoard *)cmdproc->data;
10887
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
747 /* If swboard is NULL, something has probably gone wrong earlier on
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
748 * I didn't want to do this, but MSN 7 is somehow causing us to crash
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
749 * here, I couldn't reproduce it to debug more, and people are
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
750 * reporting bugs. Hopefully this doesn't cause more crashes. Stu.
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
751 */
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
752 if (slplink->swboard != NULL)
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
753 slplink->swboard->slplink = slplink;
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
754 else
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
755 gaim_debug_error("msn", "msn_p2p_msg, swboard is NULL, ouch!\n");
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
756 }
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
757
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
758 msn_slplink_process_msg(slplink, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
759 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
760
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
761 static void
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
762 got_emoticon(MsnSlpCall *slpcall,
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
763 const guchar *data, gsize size)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
764 {
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
765
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
766 GaimConversation *conv;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
767 GaimConnection *gc;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
768 const char *who;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
769
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
770 gc = slpcall->slplink->session->account->gc;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
771 who = slpcall->slplink->remote_user;
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
772
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11236
diff changeset
773 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who, gc->account);
10403
e5455f1dc9b6 [gaim-migrate @ 11648]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10345
diff changeset
774
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
775 /* FIXME: it would be better if we wrote the data as we received it
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
776 instead of all at once, calling write multiple times and
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
777 close once at the very end
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
778 */
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
779 gaim_conv_custom_smiley_write(conv, slpcall->data_info, data, size);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
780 gaim_conv_custom_smiley_close(conv, slpcall->data_info );
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
781 #ifdef MSN_DEBUG_UD
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
782 gaim_debug_info("msn", "Got smiley: %s\n", slpcall->data_info);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
783 #endif
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
784 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
785
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
786 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
787 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
788 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
789 MsnSession *session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
790 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
791 MsnObject *obj;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
792 char **tokens;
11235
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
793 char *smile, *body_str;
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
794 const char *body, *who, *sha1c;
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
795 guint tok;
11235
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
796 size_t body_len;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
797
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
798 GaimConversation *conv;
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
799
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
800 session = cmdproc->servconn->session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
801
12886
d8e8feac6cce [gaim-migrate @ 15238]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12618
diff changeset
802 if (!gaim_account_get_bool(session->account, "custom_smileys", TRUE))
d8e8feac6cce [gaim-migrate @ 15238]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12618
diff changeset
803 return;
d8e8feac6cce [gaim-migrate @ 15238]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12618
diff changeset
804
11235
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
805 body = msn_message_get_bin_data(msg, &body_len);
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
806 body_str = g_strndup(body, body_len);
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
807
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
808 /* MSN Messenger 7 may send more than one MSNObject in a single message...
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
809 * Maybe 10 tokens is a reasonable max value. */
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
810 tokens = g_strsplit(body_str, "\t", 10);
11235
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
811
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
812 g_free(body_str);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
813
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
814 for (tok = 0; tok < 9; tok += 2) {
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
815 if (tokens[tok] == NULL || tokens[tok + 1] == NULL) {
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
816 break;
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
817 }
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
818
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
819 smile = tokens[tok];
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
820 obj = msn_object_new_from_string(gaim_url_decode(tokens[tok + 1]));
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
821
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
822 who = msn_object_get_creator(obj);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
823 sha1c = msn_object_get_sha1c(obj);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
824
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
825 slplink = msn_session_get_slplink(session, who);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
826
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
827 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who,
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
828 session->account);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
829
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
830 /* If the conversation doesn't exist then this is a custom smiley
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
831 * used in the first message in a MSN conversation: we need to create
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
832 * the conversation now, otherwise the custom smiley won't be shown.
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
833 * This happens because every GtkIMHtml has its own smiley tree: if
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
834 * the conversation doesn't exist then we cannot associate the new
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
835 * smiley with its GtkIMHtml widget. */
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
836 if (!conv) {
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
837 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, session->account, who);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
838 }
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
839
12618
204bd8fac61f [gaim-migrate @ 14954]
Richard Laager <rlaager@wiktel.com>
parents: 12323
diff changeset
840 if (gaim_conv_custom_smiley_add(conv, smile, "sha1", sha1c, TRUE)) {
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
841 msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
842 }
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
843
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
844 msn_object_destroy(obj);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
845 obj = NULL;
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
846 who = NULL;
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
847 sha1c = NULL;
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
848 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
849 g_strfreev(tokens);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
850 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
851
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
852 static gboolean
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
853 buddy_icon_cached(GaimConnection *gc, MsnObject *obj)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
854 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
855 GaimAccount *account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
856 GaimBuddy *buddy;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
857 const char *old;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
858 const char *new;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
859
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
860 g_return_val_if_fail(obj != NULL, FALSE);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
861
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
862 account = gaim_connection_get_account(gc);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
863
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
864 buddy = gaim_find_buddy(account, msn_object_get_creator(obj));
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
865 if (buddy == NULL)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
866 return FALSE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
867
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
868 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
869 new = msn_object_get_sha1c(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
870
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
871 if (new == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
872 return FALSE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
873
11020
407e47f580e4 [gaim-migrate @ 12891]
Mark Doliner <mark@kingant.net>
parents: 10907
diff changeset
874 /* If the old and new checksums are the same, and the file actually exists,
407e47f580e4 [gaim-migrate @ 12891]
Mark Doliner <mark@kingant.net>
parents: 10907
diff changeset
875 * then return TRUE */
407e47f580e4 [gaim-migrate @ 12891]
Mark Doliner <mark@kingant.net>
parents: 10907
diff changeset
876 if (old != NULL && !strcmp(old, new) && (gaim_buddy_icons_find(account, gaim_buddy_get_name(buddy)) != NULL))
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
877 return TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
878
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
879 return FALSE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
880 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
881
12323
fc464a0abccc [gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents: 12126
diff changeset
882 static void
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
883 msn_release_buddy_icon_request(MsnUserList *userlist)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
884 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
885 MsnUser *user;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
886
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
887 g_return_if_fail(userlist != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
888
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
889 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
890 gaim_debug_info("msn", "Releasing buddy icon request\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
891 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
892
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
893 if (userlist->buddy_icon_window > 0)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
894 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
895 GQueue *queue;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
896 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
897 const char *username;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
898
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
899 queue = userlist->buddy_icon_requests;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
900
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
901 if (g_queue_is_empty(userlist->buddy_icon_requests))
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
902 return;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
903
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
904 user = g_queue_pop_head(queue);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
905
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
906 account = userlist->session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
907 username = user->passport;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
908
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
909 userlist->buddy_icon_window--;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
910 msn_request_user_display(user);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
911
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
912 #ifdef MSN_DEBUG_UD
13028
a19529ed8acb [gaim-migrate @ 15381]
Mark Doliner <mark@kingant.net>
parents: 12886
diff changeset
913 gaim_debug_info("msn", "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n",
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
914 userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
915 #endif
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
916 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
917 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
918
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
919 /*
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
920 * Called on a timeout from end_user_display(). Frees a buddy icon window slow and dequeues the next
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
921 * buddy icon request if there is one.
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
922 */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
923 static gboolean
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
924 msn_release_buddy_icon_request_timeout(gpointer data)
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
925 {
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
926 MsnUserList *userlist = (MsnUserList *)data;
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
927
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
928 /* Free one window slot */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
929 userlist->buddy_icon_window++;
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
930
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
931 /* Clear the tag for our former request timer */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
932 userlist->buddy_icon_request_timer = 0;
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
933
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
934 msn_release_buddy_icon_request(userlist);
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
935
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
936 return FALSE;
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
937 }
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
938
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
939 void
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
940 msn_queue_buddy_icon_request(MsnUser *user)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
941 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
942 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
943 MsnObject *obj;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
944 GQueue *queue;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
945
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
946 g_return_if_fail(user != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
947
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
948 account = user->userlist->session->account;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
949
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
950 obj = msn_user_get_object(user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
951
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
952 if (obj == NULL)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
953 {
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
954 /* It seems the user has not set a msnobject */
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
955 GSList *sl, *list;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
956
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
957 /* TODO: I think we need better buddy icon core functions. */
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
958 gaim_buddy_icons_set_for_user(account, user->passport, NULL, -1);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
959
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
960 list = gaim_find_buddies(account, user->passport);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
961
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
962 for (sl = list; sl != NULL; sl = sl->next)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
963 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
964 GaimBuddy *buddy = (GaimBuddy *)sl->data;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
965 gaim_blist_node_remove_setting((GaimBlistNode*)buddy, "icon_checksum");
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
966 }
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
967 g_slist_free(list);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
968
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
969 return;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
970 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
971
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
972 if (!buddy_icon_cached(account->gc, obj))
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
973 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
974 MsnUserList *userlist;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
975
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
976 userlist = user->userlist;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
977 queue = userlist->buddy_icon_requests;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
978
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
979 #ifdef MSN_DEBUG_UD
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
980 gaim_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n",
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
981 user->passport, userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
982 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
983
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
984 g_queue_push_tail(queue, user);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
985
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
986 if (userlist->buddy_icon_window > 0)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
987 msn_release_buddy_icon_request(userlist);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
988 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
989 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
990
11897
a1aa681f1448 [gaim-migrate @ 14188]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11595
diff changeset
991 static void
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
992 got_user_display(MsnSlpCall *slpcall,
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
993 const guchar *data, gsize size)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
994 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
995 MsnUserList *userlist;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
996 const char *info;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
997 GaimAccount *account;
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
998 GSList *sl, *list;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
999
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1000 g_return_if_fail(slpcall != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1001
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1002 info = slpcall->data_info;
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1003 #ifdef MSN_DEBUG_UD
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1004 gaim_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1005 #endif
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1006
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1007 userlist = slpcall->slplink->session->userlist;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1008 account = slpcall->slplink->session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1009
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1010 /* TODO: I think we need better buddy icon core functions. */
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1011 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user,
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1012 (void *)data, size);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1013
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1014 list = gaim_find_buddies(account, slpcall->slplink->remote_user);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1015
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1016 for (sl = list; sl != NULL; sl = sl->next)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1017 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1018 GaimBuddy *buddy = (GaimBuddy *)sl->data;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1019 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1020 }
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1021 g_slist_free(list);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1022
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1023 #if 0
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1024 /* Free one window slot */
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1025 userlist->buddy_icon_window++;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1026
13028
a19529ed8acb [gaim-migrate @ 15381]
Mark Doliner <mark@kingant.net>
parents: 12886
diff changeset
1027 gaim_debug_info("msn", "got_user_display(): buddy_icon_window++ yields =%d\n",
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1028 userlist->buddy_icon_window);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1029
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1030 msn_release_buddy_icon_request(userlist);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1031 #endif
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1032 }
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1033
11897
a1aa681f1448 [gaim-migrate @ 14188]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11595
diff changeset
1034 static void
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1035 end_user_display(MsnSlpCall *slpcall, MsnSession *session)
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1036 {
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1037 MsnUserList *userlist;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1038
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1039 g_return_if_fail(session != NULL);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1040
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1041 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1042 gaim_debug_info("msn", "End User Display\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1043 #endif
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1044
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1045 userlist = session->userlist;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1046
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1047 /* If the session is being destroyed we better stop doing anything. */
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1048 if (session->destroying)
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1049 return;
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1050
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1051 /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate.
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1052 * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1053 * send us an error 800 like so:
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1054 *
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1055 * C: NS 000: XFR 21 SB
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1056 * S: NS 000: 800 21
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1057 */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1058 if (userlist->buddy_icon_request_timer) {
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1059 /* Free the window slot used by this previous request */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1060 userlist->buddy_icon_window++;
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1061
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1062 /* Clear our pending timeout */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1063 gaim_timeout_remove(userlist->buddy_icon_request_timer);
13028
a19529ed8acb [gaim-migrate @ 15381]
Mark Doliner <mark@kingant.net>
parents: 12886
diff changeset
1064 }
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1065
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1066 /* Wait BUDDY_ICON_DELAY ms before freeing our window slot and requesting the next icon. */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1067 userlist->buddy_icon_request_timer = gaim_timeout_add(BUDDY_ICON_DELAY,
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1068 msn_release_buddy_icon_request_timeout, userlist);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1069 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1070
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1071 void
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1072 msn_request_user_display(MsnUser *user)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1073 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1074 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1075 MsnSession *session;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1076 MsnSlpLink *slplink;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1077 MsnObject *obj;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1078 const char *info;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1079
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1080 session = user->userlist->session;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1081 account = session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1082
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1083 slplink = msn_session_get_slplink(session, user->passport);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1084
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1085 obj = msn_user_get_object(user);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1086
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1087 info = msn_object_get_sha1c(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1088
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1089 if (g_ascii_strcasecmp(user->passport,
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1090 gaim_account_get_username(account)))
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1091 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1092 msn_slplink_request_object(slplink, info, got_user_display,
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1093 end_user_display, obj);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1094 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1095 else
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1096 {
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1097 MsnObject *my_obj = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1098 const char *filename = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1099 gchar *data = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1100 gsize len = 0;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1101 const char *my_info = NULL;
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1102 GSList *sl, *list;
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1103
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1104 #ifdef MSN_DEBUG_UD
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1105 gaim_debug_info("msn", "Requesting our own user display\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1106 #endif
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1107
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1108 my_obj = msn_user_get_object(session->user);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1109
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1110 if (my_obj != NULL)
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1111 {
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1112 filename = msn_object_get_real_location(my_obj);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1113 my_info = msn_object_get_sha1c(my_obj);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1114 }
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1115
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1116 if (filename != NULL)
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1117 g_file_get_contents(filename, &data, &len, NULL);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1118
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1119 /* TODO: I think we need better buddy icon core functions. */
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1120 gaim_buddy_icons_set_for_user(account, user->passport, (void *)data, len);
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
1121 g_free(data);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1122
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1123 list = gaim_find_buddies(account, user->passport);
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1124
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1125 for (sl = list; sl != NULL; sl = sl->next)
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1126 {
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1127 GaimBuddy *buddy = (GaimBuddy *)sl->data;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1128 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1129 }
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1130 g_slist_free(list);
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1131
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1132 /* Free one window slot */
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1133 session->userlist->buddy_icon_window++;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1134
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1135 #ifdef MSN_DEBUG_UD
13028
a19529ed8acb [gaim-migrate @ 15381]
Mark Doliner <mark@kingant.net>
parents: 12886
diff changeset
1136 gaim_debug_info("msn", "msn_request_user_display(): buddy_icon_window++ yields =%d\n",
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1137 session->userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1138 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1139
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1140 msn_release_buddy_icon_request(session->userlist);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1141 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1142 }