annotate src/protocols/msn/slp.c @ 19738:bc30c6270d9f

[gaim-migrate @ 16473] add the Framework of SOAP request Now can retrieve the Contact via SOAP Request. so many bug still exist! commited by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sun, 09 Jul 2006 16:48:25 +0000
parents 967ef719cb62
children 99b9b58b19dd bddd32f36bde
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 *file_name;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 char *content;
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11020
diff changeset
258 gsize len;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 int type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 /* Send Ok */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 slpcall->session_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11020
diff changeset
272 msnobj_data = (char *)gaim_base64_decode(context, &len);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 obj = msn_object_new_from_string(msnobj_data);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 type = msn_object_get_type(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 g_free(msnobj_data);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
276
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 if (!(type == MSN_OBJECT_USERTILE))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 gaim_debug_error("msn", "Wrong object?\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 msn_object_destroy(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 g_return_if_reached();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282 }
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
283
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 file_name = msn_object_get_real_location(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285
9858
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
286 if (file_name == NULL)
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
287 {
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
288 gaim_debug_error("msn", "Wrong object.\n");
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
289 msn_object_destroy(obj);
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
290 g_return_if_reached();
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
291 }
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
292
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
293 msn_object_destroy(obj);
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
294
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
295 slpsession = msn_slplink_find_slp_session(slplink,
9861
68561f39acdc [gaim-migrate @ 10740]
Luke Schierer <lschiere@pidgin.im>
parents: 9860
diff changeset
296 slpcall->session_id);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
297
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 /* DATA PREP */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 slpmsg = msn_slpmsg_new(slplink);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
300 slpmsg->slpcall = slpcall;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301 slpmsg->slpsession = slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
302 slpmsg->session_id = slpsession->id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303 msn_slpmsg_set_body(slpmsg, NULL, 4);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
304 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305 slpmsg->info = "SLP DATA PREP";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 /* DATA */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 slpmsg = msn_slpmsg_new(slplink);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
311 slpmsg->slpcall = slpcall;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
312 slpmsg->slpsession = slpsession;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 slpmsg->flags = 0x20;
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
314 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 slpmsg->info = "SLP DATA";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 msn_slpmsg_open_file(slpmsg, file_name);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320 else if (!strcmp(euf_guid, "5D3E02AB-6190-11D3-BBBB-00C04F795683"))
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 /* File Transfer */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 GaimAccount *account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 GaimXfer *xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 char *bin;
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11020
diff changeset
326 gsize bin_len;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 guint32 file_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 char *file_name;
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
329 gunichar2 *uni_name;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331 account = slpcall->slplink->session->account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332
9259
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
333 slpcall->cb = msn_xfer_completed_cb;
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
334 slpcall->end_cb = msn_xfer_end_cb;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335 slpcall->progress_cb = msn_xfer_progress_cb;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 slpcall->branch = g_strdup(branch);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
338 slpcall->pending = TRUE;
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
339
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 xfer = gaim_xfer_new(account, GAIM_XFER_RECEIVE,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341 slpcall->slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11020
diff changeset
343 bin = (char *)gaim_base64_decode(context, &bin_len);
9263
70153c759016 [gaim-migrate @ 10062]
Christian Hammond <chipx86@chipx86.com>
parents: 9259
diff changeset
344 file_size = GUINT32_FROM_LE(*((gsize *)bin + 2));
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
345
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
346 uni_name = (gunichar2 *)(bin + 20);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
347 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
348 *uni_name = GUINT16_FROM_LE(*uni_name);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
349 uni_name++;
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
350 }
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
351
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353 NULL, NULL, NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 g_free(bin);
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 gaim_xfer_set_filename(xfer, file_name);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 gaim_xfer_set_size(xfer, file_size);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359 gaim_xfer_set_init_fnc(xfer, msn_xfer_init);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 gaim_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361 gaim_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363 slpcall->xfer = xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 xfer->data = slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366 gaim_xfer_request(xfer);
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 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371 send_bye(MsnSlpCall *slpcall, const char *type)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375 char *header;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 slplink = slpcall->slplink;
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 g_return_if_fail(slplink != NULL);
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 header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382 slplink->local_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 slpmsg = msn_slpmsg_sip_new(slpcall, 0, header,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 type,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388 g_free(header);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
390 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391 slpmsg->info = "SLP BYE";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 msn_slplink_queue_slpmsg(slplink, slpmsg);
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399 got_invite(MsnSlpCall *slpcall,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 const char *branch, const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 MsnSlpLink *slplink;
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 slplink = slpcall->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 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
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 char *euf_guid, *context;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 euf_guid = get_token(content, "EUF-GUID: {", "}\r\n");
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 temp = get_token(content, "SessionID: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 slpcall->session_id = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418 temp = get_token(content, "AppID: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420 slpcall->app_id = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421 g_free(temp);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
422
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423 context = get_token(content, "Context: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425 got_sessionreq(slpcall, branch, euf_guid, context);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
426
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 g_free(context);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 g_free(euf_guid);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
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 /* A direct connection? */
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 char *listening, *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 char *content;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
436
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 if (FALSE)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 MsnDirectConn *directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441 /* const char *ip_addr; */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 char *ip_port;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 int port;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 /* ip_addr = gaim_prefs_get_string("/core/ft/public_ip"); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 ip_port = "5190";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 listening = "true";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448 nonce = rand_guid();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 directconn = msn_directconn_new(slplink);
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 /* msn_directconn_parse_nonce(directconn, nonce); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 directconn->nonce = g_strdup(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 msn_directconn_listen(directconn);
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 port = directconn->port;
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 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 "Bridge: TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 "Listening: %s\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 "Nonce: {%s}\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463 "Ipv4Internal-Addrs: 192.168.0.82\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 "Ipv4Internal-Port: %d\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 "\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 listening,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467 nonce,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
471 else
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 listening = "false";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 nonce = g_strdup("00000000-0000-0000-0000-000000000000");
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
475
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 "Bridge: TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 "Listening: %s\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 "Nonce: {%s}\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 "\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 listening,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482 nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 send_ok(slpcall, branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486 "application/x-msnmsgr-transrespbody", content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
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 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 char *ip_addrs;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 char *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497 int port;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
498
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499 nonce = get_token(content, "Nonce: {", "}\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 port = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 port = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 if (ip_addrs == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
510 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 if (port > 0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513 got_transresp(slpcall, nonce, ip_addrs, port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 g_free(ip_addrs);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
518 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
519 }
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 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
522 got_ok(MsnSlpCall *slpcall,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
523 const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
524 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
525 g_return_if_fail(slpcall != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
526 g_return_if_fail(type != NULL);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
527
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
528 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
529 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
531 if (slpcall->type == MSN_SLPCALL_DC)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
532 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 /* First let's try a DirectConnection. */
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 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
537 char *header;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
538 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 char *branch;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541 slplink = slpcall->slplink;
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 branch = rand_guid();
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 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546 "Bridges: TRUDPv1 TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547 "NetID: 0\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
548 "Conn-Type: Direct-Connect\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 "UPnPNat: false\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
550 "ICF: false\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
551 );
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
552
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
553 header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554 slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557 "application/x-msnmsgr-transreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558 content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
560 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 slpmsg->info = "SLP INVITE";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564 msn_slplink_send_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 g_free(header);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 g_free(content);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
568
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 g_free(branch);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571 else
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 msn_slp_call_session_init(slpcall);
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 #else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
576 msn_slp_call_session_init(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
577 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
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 /* Do we get this? */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582 gaim_debug_info("msn", "OK with transreqbody\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
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 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
587 char *ip_addrs;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
588 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
589 char *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 int port;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
591
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 nonce = get_token(content, "Nonce: {", "}\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597 port = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 port = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
600 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
601
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602 if (ip_addrs == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605 if (port > 0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606 got_transresp(slpcall, nonce, ip_addrs, port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609 g_free(ip_addrs);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
610 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
611 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
612 }
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 MsnSlpCall *
11236
fd6d96ef5c6d [gaim-migrate @ 13382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11235
diff changeset
615 msn_slp_sip_recv(MsnSlpLink *slplink, const char *body)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
616 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
617 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618
10907
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
619 if (body == NULL)
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
620 {
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
621 gaim_debug_warning("msn", "received bogus message\n");
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
622 return NULL;
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
623 }
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
624
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625 if (!strncmp(body, "INVITE", strlen("INVITE")))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
627 char *branch;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629 char *content_type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631 slpcall = msn_slp_call_new(slplink);
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 /* From: <msnmsgr:buddy@hotmail.com> */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
634 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
635 slpcall->remote_user = get_token(body, "From: <msnmsgr:", ">\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
636 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
637
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
638 branch = get_token(body, ";branch={", "}");
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 slpcall->id = get_token(body, "Call-ID: {", "}");
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 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643 long content_len = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
645 temp = get_token(body, "Content-Length: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
646 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
647 content_len = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
648 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
649 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650 content_type = get_token(body, "Content-Type: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
651
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
652 content = get_token(body, "\r\n\r\n", NULL);
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 got_invite(slpcall, branch, content_type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
655
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
656 g_free(branch);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
657 g_free(content_type);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
658 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 ")))
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 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663 char *content_type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
664 /* Make sure this is "OK" */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
665 const char *status = body + strlen("MSNSLP/1.0 ");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666 char *call_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
667
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
668 call_id = get_token(body, "Call-ID: {", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
669 slpcall = msn_slplink_find_slp_call(slplink, call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
670 g_free(call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
671
9231
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
672 g_return_val_if_fail(slpcall != NULL, NULL);
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
673
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
674 if (strncmp(status, "200 OK", 6))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
675 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
676 /* It's not valid. Kill this off. */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
677 char temp[32];
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
678 const char *c;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
679
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
680 /* Eww */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
681 if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) ||
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
682 (c = strchr(status, '\0')))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
683 {
9739
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
684 size_t offset = c - status;
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
685 if (offset >= sizeof(temp))
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
686 offset = sizeof(temp) - 1;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
687
9739
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
688 strncpy(temp, status, offset);
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
689 temp[offset] = '\0';
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
690 }
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
691
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
692 gaim_debug_error("msn", "Received non-OK result: %s\n", temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
693
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
694 slpcall->wasted = TRUE;
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 /* msn_slp_call_destroy(slpcall); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
697 return slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
698 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
699
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
700 content_type = get_token(body, "Content-Type: ", "\r\n");
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 = get_token(body, "\r\n\r\n", NULL);
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 got_ok(slpcall, content_type, content);
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 g_free(content_type);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
707 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
708 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
709 else if (!strncmp(body, "BYE", strlen("BYE")))
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 char *call_id;
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 call_id = get_token(body, "Call-ID: {", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
714 slpcall = msn_slplink_find_slp_call(slplink, call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
715 g_free(call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
716
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
717 if (slpcall != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
718 slpcall->wasted = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
719
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
720 /* msn_slp_call_destroy(slpcall); */
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 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
723 slpcall = NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
724
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
725 return slpcall;
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
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 * Msg Callbacks
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
732 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
733 msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
734 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
735 MsnSession *session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
736 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
737
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738 session = cmdproc->servconn->session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
739 slplink = msn_session_get_slplink(session, msg->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
740
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
741 if (slplink->swboard == NULL)
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
742 {
10887
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
743 /* We will need this in order to change its flags. */
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
744 slplink->swboard = (MsnSwitchBoard *)cmdproc->data;
10887
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
745 /* If swboard is NULL, something has probably gone wrong earlier on
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
746 * 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
747 * 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
748 * reporting bugs. Hopefully this doesn't cause more crashes. Stu.
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
749 */
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
750 if (slplink->swboard != NULL)
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
751 slplink->swboard->slplink = slplink;
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
752 else
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
753 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
754 }
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
755
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
756 msn_slplink_process_msg(slplink, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
757 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
758
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
759 static void
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
760 got_emoticon(MsnSlpCall *slpcall,
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
761 const guchar *data, gsize size)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
762 {
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
763
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
764 GaimConversation *conv;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
765 GaimConnection *gc;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
766 const char *who;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
767
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
768 gc = slpcall->slplink->session->account->gc;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
769 who = slpcall->slplink->remote_user;
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
770
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11236
diff changeset
771 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
772
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
773 /* 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
774 instead of all at once, calling write multiple times and
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
775 close once at the very end
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
776 */
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
777 gaim_conv_custom_smiley_write(conv, slpcall->data_info, data, size);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
778 gaim_conv_custom_smiley_close(conv, slpcall->data_info );
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
779 #ifdef MSN_DEBUG_UD
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
780 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
781 #endif
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
782 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
783
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
784 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
785 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
786 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
787 MsnSession *session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
788 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
789 MsnObject *obj;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
790 char **tokens;
11235
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
791 char *smile, *body_str;
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
792 const char *body, *who, *sha1c;
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
793 guint tok;
11235
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
794 size_t body_len;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
795
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
796 GaimConversation *conv;
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
797
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
798 session = cmdproc->servconn->session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
799
12886
d8e8feac6cce [gaim-migrate @ 15238]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12618
diff changeset
800 if (!gaim_account_get_bool(session->account, "custom_smileys", TRUE))
d8e8feac6cce [gaim-migrate @ 15238]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12618
diff changeset
801 return;
d8e8feac6cce [gaim-migrate @ 15238]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12618
diff changeset
802
11235
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
803 body = msn_message_get_bin_data(msg, &body_len);
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
804 body_str = g_strndup(body, body_len);
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
805
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
806 /* 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
807 * Maybe 10 tokens is a reasonable max value. */
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
808 tokens = g_strsplit(body_str, "\t", 10);
11235
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
809
5ea38c98ff30 [gaim-migrate @ 13380]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11138
diff changeset
810 g_free(body_str);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
811
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
812 for (tok = 0; tok < 9; tok += 2) {
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
813 if (tokens[tok] == NULL || tokens[tok + 1] == NULL) {
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
814 break;
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
815 }
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
816
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
817 smile = tokens[tok];
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
818 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
819
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
820 who = msn_object_get_creator(obj);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
821 sha1c = msn_object_get_sha1c(obj);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
822
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
823 slplink = msn_session_get_slplink(session, who);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
824
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
825 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, who,
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
826 session->account);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
827
11518
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
828 /* 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
829 * 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
830 * the conversation now, otherwise the custom smiley won't be shown.
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
831 * This happens because every GtkIMHtml has its own smiley tree: if
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
832 * the conversation doesn't exist then we cannot associate the new
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
833 * smiley with its GtkIMHtml widget. */
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
834 if (!conv) {
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
835 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, session->account, who);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
836 }
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
837
12618
204bd8fac61f [gaim-migrate @ 14954]
Richard Laager <rlaager@wiktel.com>
parents: 12323
diff changeset
838 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
839 msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
840 }
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
841
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
842 msn_object_destroy(obj);
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
843 obj = NULL;
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
844 who = NULL;
922782381027 [gaim-migrate @ 13763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11338
diff changeset
845 sha1c = NULL;
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
846 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
847 g_strfreev(tokens);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
848 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
849
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
850 static gboolean
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
851 buddy_icon_cached(GaimConnection *gc, MsnObject *obj)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
852 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
853 GaimAccount *account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
854 GaimBuddy *buddy;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
855 const char *old;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
856 const char *new;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
857
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
858 g_return_val_if_fail(obj != NULL, FALSE);
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 account = gaim_connection_get_account(gc);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
861
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
862 buddy = gaim_find_buddy(account, msn_object_get_creator(obj));
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
863 if (buddy == NULL)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
864 return FALSE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
865
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
866 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
867 new = msn_object_get_sha1c(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
868
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
869 if (new == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
870 return FALSE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
871
11020
407e47f580e4 [gaim-migrate @ 12891]
Mark Doliner <mark@kingant.net>
parents: 10907
diff changeset
872 /* 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
873 * then return TRUE */
407e47f580e4 [gaim-migrate @ 12891]
Mark Doliner <mark@kingant.net>
parents: 10907
diff changeset
874 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
875 return TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
876
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
877 return FALSE;
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
12323
fc464a0abccc [gaim-migrate @ 14627]
Richard Laager <rlaager@wiktel.com>
parents: 12126
diff changeset
880 static void
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
881 msn_release_buddy_icon_request(MsnUserList *userlist)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
882 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
883 MsnUser *user;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
884
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
885 g_return_if_fail(userlist != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
886
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
887 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
888 gaim_debug_info("msn", "Releasing buddy icon request\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
889 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
890
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
891 if (userlist->buddy_icon_window > 0)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
892 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
893 GQueue *queue;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
894 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
895 const char *username;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
896
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
897 queue = userlist->buddy_icon_requests;
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 if (g_queue_is_empty(userlist->buddy_icon_requests))
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
900 return;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
901
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
902 user = g_queue_pop_head(queue);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
903
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
904 account = userlist->session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
905 username = user->passport;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
906
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
907 userlist->buddy_icon_window--;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
908 msn_request_user_display(user);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
909
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
910 #ifdef MSN_DEBUG_UD
13028
a19529ed8acb [gaim-migrate @ 15381]
Mark Doliner <mark@kingant.net>
parents: 12886
diff changeset
911 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
912 userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
913 #endif
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
914 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
915 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
916
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
917 /*
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
918 * 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
919 * buddy icon request if there is one.
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
920 */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
921 static gboolean
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
922 msn_release_buddy_icon_request_timeout(gpointer data)
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
923 {
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
924 MsnUserList *userlist = (MsnUserList *)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 /* Free one window slot */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
927 userlist->buddy_icon_window++;
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
928
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
929 /* Clear the tag for our former request timer */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
930 userlist->buddy_icon_request_timer = 0;
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
931
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
932 msn_release_buddy_icon_request(userlist);
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 return FALSE;
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
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
937 void
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
938 msn_queue_buddy_icon_request(MsnUser *user)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
939 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
940 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
941 MsnObject *obj;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
942 GQueue *queue;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
943
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
944 g_return_if_fail(user != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
945
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
946 account = user->userlist->session->account;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
947
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
948 obj = msn_user_get_object(user);
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 if (obj == NULL)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
951 {
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
952 /* It seems the user has not set a msnobject */
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
953 GSList *sl, *list;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
954
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
955 /* TODO: I think we need better buddy icon core functions. */
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
956 gaim_buddy_icons_set_for_user(account, user->passport, NULL, -1);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
957
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
958 list = gaim_find_buddies(account, user->passport);
9860
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 for (sl = list; sl != NULL; sl = sl->next)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
961 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
962 GaimBuddy *buddy = (GaimBuddy *)sl->data;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
963 gaim_blist_node_remove_setting((GaimBlistNode*)buddy, "icon_checksum");
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
964 }
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
965 g_slist_free(list);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
966
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
967 return;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
968 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
969
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
970 if (!buddy_icon_cached(account->gc, obj))
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 MsnUserList *userlist;
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 userlist = user->userlist;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
975 queue = userlist->buddy_icon_requests;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
976
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
977 #ifdef MSN_DEBUG_UD
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
978 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
979 user->passport, userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
980 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
981
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
982 g_queue_push_tail(queue, user);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
983
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
984 if (userlist->buddy_icon_window > 0)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
985 msn_release_buddy_icon_request(userlist);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
986 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
987 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
988
11897
a1aa681f1448 [gaim-migrate @ 14188]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11595
diff changeset
989 static void
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
990 got_user_display(MsnSlpCall *slpcall,
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
991 const guchar *data, gsize size)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
992 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
993 MsnUserList *userlist;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
994 const char *info;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
995 GaimAccount *account;
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
996 GSList *sl, *list;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
997
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
998 g_return_if_fail(slpcall != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
999
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1000 info = slpcall->data_info;
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1001 #ifdef MSN_DEBUG_UD
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1002 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
1003 #endif
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1004
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1005 userlist = slpcall->slplink->session->userlist;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1006 account = slpcall->slplink->session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1007
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1008 /* TODO: I think we need better buddy icon core functions. */
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1009 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user,
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1010 (void *)data, size);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1011
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1012 list = gaim_find_buddies(account, slpcall->slplink->remote_user);
9860
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 for (sl = list; sl != NULL; sl = sl->next)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1015 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1016 GaimBuddy *buddy = (GaimBuddy *)sl->data;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1017 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1018 }
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1019 g_slist_free(list);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1020
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1021 #if 0
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1022 /* Free one window slot */
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1023 userlist->buddy_icon_window++;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1024
13028
a19529ed8acb [gaim-migrate @ 15381]
Mark Doliner <mark@kingant.net>
parents: 12886
diff changeset
1025 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
1026 userlist->buddy_icon_window);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1027
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1028 msn_release_buddy_icon_request(userlist);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1029 #endif
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1030 }
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1031
11897
a1aa681f1448 [gaim-migrate @ 14188]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11595
diff changeset
1032 static void
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1033 end_user_display(MsnSlpCall *slpcall, MsnSession *session)
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1034 {
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1035 MsnUserList *userlist;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1036
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1037 g_return_if_fail(session != NULL);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1038
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1039 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1040 gaim_debug_info("msn", "End User Display\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1041 #endif
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1042
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1043 userlist = session->userlist;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1044
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1045 /* 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
1046 if (session->destroying)
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1047 return;
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1048
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1049 /* 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
1050 * 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
1051 * send us an error 800 like so:
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1052 *
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1053 * C: NS 000: XFR 21 SB
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1054 * S: NS 000: 800 21
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1055 */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1056 if (userlist->buddy_icon_request_timer) {
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1057 /* Free the window slot used by this previous request */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1058 userlist->buddy_icon_window++;
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1059
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1060 /* Clear our pending timeout */
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1061 gaim_timeout_remove(userlist->buddy_icon_request_timer);
13028
a19529ed8acb [gaim-migrate @ 15381]
Mark Doliner <mark@kingant.net>
parents: 12886
diff changeset
1062 }
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1063
13125
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1064 /* 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
1065 userlist->buddy_icon_request_timer = gaim_timeout_add(BUDDY_ICON_DELAY,
442b23efba54 [gaim-migrate @ 15487]
Mark Doliner <mark@kingant.net>
parents: 13028
diff changeset
1066 msn_release_buddy_icon_request_timeout, userlist);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1067 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1068
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1069 void
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1070 msn_request_user_display(MsnUser *user)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1071 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1072 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1073 MsnSession *session;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1074 MsnSlpLink *slplink;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1075 MsnObject *obj;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1076 const char *info;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1077
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1078 session = user->userlist->session;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1079 account = session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1080
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1081 slplink = msn_session_get_slplink(session, user->passport);
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 obj = msn_user_get_object(user);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1084
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1085 info = msn_object_get_sha1c(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1086
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1087 if (g_ascii_strcasecmp(user->passport,
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1088 gaim_account_get_username(account)))
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1089 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1090 msn_slplink_request_object(slplink, info, got_user_display,
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1091 end_user_display, obj);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1092 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1093 else
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1094 {
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1095 MsnObject *my_obj = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1096 gchar *data = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1097 gsize len = 0;
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1098 GSList *sl, *list;
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1099
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1100 #ifdef MSN_DEBUG_UD
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1101 gaim_debug_info("msn", "Requesting our own user display\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1102 #endif
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1103
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1104 my_obj = msn_user_get_object(session->user);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1105
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1106 if (my_obj != NULL)
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1107 {
13711
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13125
diff changeset
1108 const char *filename = msn_object_get_real_location(my_obj);
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13125
diff changeset
1109
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13125
diff changeset
1110 if (filename != NULL)
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13125
diff changeset
1111 g_file_get_contents(filename, &data, &len, NULL);
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1112 }
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1113
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1114 /* TODO: I think we need better buddy icon core functions. */
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1115 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
1116 g_free(data);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1117
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1118 list = gaim_find_buddies(account, user->passport);
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1119
12126
35c4797c5c57 [gaim-migrate @ 14426]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
1120 for (sl = list; sl != NULL; sl = sl->next)
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1121 {
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1122 GaimBuddy *buddy = (GaimBuddy *)sl->data;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1123 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info);
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 g_slist_free(list);
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1126
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1127 /* Free one window slot */
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1128 session->userlist->buddy_icon_window++;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1129
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1130 #ifdef MSN_DEBUG_UD
13028
a19529ed8acb [gaim-migrate @ 15381]
Mark Doliner <mark@kingant.net>
parents: 12886
diff changeset
1131 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
1132 session->userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1133 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1134
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1135 msn_release_buddy_icon_request(session->userlist);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1136 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1137 }