annotate src/protocols/msn/slp.c @ 11057:e9eeacd1a8d0

[gaim-migrate @ 13009] Patch #1223021 from Jason Roth (jroth2) Fixes Bug #1222552 "As described in bug report #1222552, gaim will disconnect the current msn session and corrupt blist.xml when you try to add an msn screenname with a space in it" -- jroth2 I reworked this quite a bit. Stu suggested using gaim_email_valid() rather than just checking for a space. I took this advice. I also made it display an error message instead of silently dropping the add request. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 05 Jul 2005 00:03:42 +0000
parents 407e47f580e4
children 719779387f96
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 static void send_ok(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 const char *type, const char *content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 static void send_decline(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
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
40 void msn_request_user_display(MsnUser *user);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
41
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 /**************************************************************************
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 * Util
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 **************************************************************************/
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 char *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 get_token(const char *str, const char *start, const char *end)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 const char *c, *c2;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 if ((c = strstr(str, start)) == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 return NULL;
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 c += strlen(start);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 if (end != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 if ((c2 = strstr(c, end)) == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 return NULL;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
60
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 return g_strndup(c, c2 - c);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 /* This has to be changed */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 return g_strdup(c);
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 }
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 * Xfer
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 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 msn_xfer_init(GaimXfer *xfer)
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 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 /* MsnSlpLink *slplink; */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 gaim_debug_info("msn", "xfer_init\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 slpcall = xfer->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 /* Send Ok */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 slpcall->session_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 content);
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 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 msn_slplink_unleash(slpcall->slplink);
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 msn_xfer_cancel(GaimXfer *xfer)
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 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102
9788
1e9ecca6c97e [gaim-migrate @ 10656]
Luke Schierer <lschiere@pidgin.im>
parents: 9739
diff changeset
103 g_return_if_fail(xfer != NULL);
1e9ecca6c97e [gaim-migrate @ 10656]
Luke Schierer <lschiere@pidgin.im>
parents: 9739
diff changeset
104 g_return_if_fail(xfer->data != NULL);
1e9ecca6c97e [gaim-migrate @ 10656]
Luke Schierer <lschiere@pidgin.im>
parents: 9739
diff changeset
105
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 slpcall = xfer->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 if (slpcall->started)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 msn_slp_call_close(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 slpcall->session_id);
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 send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 content);
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 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 msn_slplink_unleash(slpcall->slplink);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
124
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
125 msn_slp_call_destroy(slpcall);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 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
132 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 GaimXfer *xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
135 xfer = slpcall->xfer;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9198
diff changeset
137 xfer->bytes_sent = (offset + len);
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9198
diff changeset
138 xfer->bytes_remaining = total_length - (offset + len);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 gaim_xfer_update_progress(xfer);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 }
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 void
9259
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
144 msn_xfer_end_cb(MsnSlpCall *slpcall)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
146 if ((gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_DONE) &&
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
147 (gaim_xfer_get_status(slpcall->xfer) != GAIM_XFER_STATUS_CANCEL_REMOTE) &&
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
148 (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
149 {
10226
62ab1a4c3a2a [gaim-migrate @ 11359]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10225
diff changeset
150 gaim_xfer_cancel_remote(slpcall->xfer);
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9198
diff changeset
151 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153
9259
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
154 void
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
155 msn_xfer_completed_cb(MsnSlpCall *slpcall, const char *body,
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
156 long long size)
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
157 {
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
158 gaim_xfer_set_completed(slpcall->xfer, TRUE);
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
159 }
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
160
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 /**************************************************************************
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 * SLP Control
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 **************************************************************************/
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 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 got_transresp(MsnSlpCall *slpcall, const char *nonce,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 const char *ips_str, int port)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 MsnDirectConn *directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 char **ip_addrs, **c;
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 directconn = msn_directconn_new(slpcall->slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 directconn->initial_call = slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 /* msn_directconn_parse_nonce(directconn, nonce); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 directconn->nonce = g_strdup(nonce);
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 ip_addrs = g_strsplit(ips_str, " ", -1);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 for (c = ip_addrs; *c != NULL; c++)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 gaim_debug_info("msn", "ip_addr = %s\n", *c);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 if (msn_directconn_connect(directconn, *c, port))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 break;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 g_strfreev(ip_addrs);
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 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 send_ok(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 MsnSlpMessage *slpmsg;
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 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 /* 200 OK */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 slpmsg = msn_slpmsg_sip_new(slpcall, 1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 "MSNSLP/1.0 200 OK",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 branch, type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
207 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 slpmsg->info = "SLP 200 OK";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 msn_slp_call_session_init(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 }
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 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 send_decline(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 MsnSlpMessage *slpmsg;
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 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 /* 603 Decline */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 slpmsg = msn_slpmsg_sip_new(slpcall, 1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228 "MSNSLP/1.0 603 Decline",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 branch, type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
231 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 slpmsg->info = "SLP 603 Decline";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
239 #define MAX_FILE_NAME_LEN 0x226
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
240
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 got_sessionreq(MsnSlpCall *slpcall, const char *branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 const char *euf_guid, const char *context)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 if (!strcmp(euf_guid, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 /* Emoticon or UserDisplay */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 MsnSlpSession *slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 MsnObject *obj;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 char *msnobj_data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 const char *sha1c;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 const char *file_name;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 char *content;
10112
1a91e814e9d8 [gaim-migrate @ 11145]
Nathan Walp <nwalp@pidgin.im>
parents: 10072
diff changeset
256 int len;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 int type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 /* Send Ok */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 content = g_strdup_printf("SessionID: %lu\r\n\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 slpcall->session_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 g_free(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 slplink = slpcall->slplink;
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 gaim_base64_decode(context, &msnobj_data, &len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 obj = msn_object_new_from_string(msnobj_data);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 type = msn_object_get_type(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 sha1c = msn_object_get_sha1c(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 g_free(msnobj_data);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
275
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 if (!(type == MSN_OBJECT_USERTILE))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278 gaim_debug_error("msn", "Wrong object?\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 msn_object_destroy(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 g_return_if_reached();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 }
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
282
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 file_name = msn_object_get_real_location(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284
9858
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
285 if (file_name == NULL)
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
286 {
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
287 gaim_debug_error("msn", "Wrong object.\n");
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
288 msn_object_destroy(obj);
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
289 g_return_if_reached();
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
290 }
d0c196ebe176 [gaim-migrate @ 10737]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
291
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
292 msn_object_destroy(obj);
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
293
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 slpsession = msn_slplink_find_slp_session(slplink,
9861
68561f39acdc [gaim-migrate @ 10740]
Luke Schierer <lschiere@pidgin.im>
parents: 9860
diff changeset
295 slpcall->session_id);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
296
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 /* DATA PREP */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 slpmsg = msn_slpmsg_new(slplink);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
299 slpmsg->slpcall = slpcall;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 slpmsg->slpsession = slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301 slpmsg->session_id = slpsession->id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
302 msn_slpmsg_set_body(slpmsg, NULL, 4);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
303 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 slpmsg->info = "SLP DATA PREP";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 /* DATA */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 slpmsg = msn_slpmsg_new(slplink);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
310 slpmsg->slpcall = slpcall;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
311 slpmsg->slpsession = slpsession;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312 slpmsg->flags = 0x20;
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
313 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 slpmsg->info = "SLP DATA";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 msn_slpmsg_open_file(slpmsg, file_name);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 else if (!strcmp(euf_guid, "5D3E02AB-6190-11D3-BBBB-00C04F795683"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 /* File Transfer */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322 GaimAccount *account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 GaimXfer *xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 char *bin;
10112
1a91e814e9d8 [gaim-migrate @ 11145]
Nathan Walp <nwalp@pidgin.im>
parents: 10072
diff changeset
325 int bin_len;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 guint32 file_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 char *file_name;
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
328 gunichar2 *uni_name;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 account = slpcall->slplink->session->account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331
9259
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
332 slpcall->cb = msn_xfer_completed_cb;
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
333 slpcall->end_cb = msn_xfer_end_cb;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 slpcall->progress_cb = msn_xfer_progress_cb;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335 slpcall->branch = g_strdup(branch);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
337 slpcall->pending = TRUE;
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
338
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339 xfer = gaim_xfer_new(account, GAIM_XFER_RECEIVE,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 slpcall->slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342 gaim_base64_decode(context, &bin, &bin_len);
9263
70153c759016 [gaim-migrate @ 10062]
Christian Hammond <chipx86@chipx86.com>
parents: 9259
diff changeset
343 file_size = GUINT32_FROM_LE(*((gsize *)bin + 2));
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
344
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
345 uni_name = (gunichar2 *)(bin + 20);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
346 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
347 *uni_name = GUINT16_FROM_LE(*uni_name);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
348 uni_name++;
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
349 }
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
350
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351 file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 NULL, NULL, NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354 g_free(bin);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356 gaim_xfer_set_filename(xfer, file_name);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 gaim_xfer_set_size(xfer, file_size);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 gaim_xfer_set_init_fnc(xfer, msn_xfer_init);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359 gaim_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 gaim_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362 slpcall->xfer = xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363 xfer->data = slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 gaim_xfer_request(xfer);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
370 send_bye(MsnSlpCall *slpcall, const char *type)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374 char *header;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378 g_return_if_fail(slplink != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 slplink->local_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383 slpmsg = msn_slpmsg_sip_new(slpcall, 0, header,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 type,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 g_free(header);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
389 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 slpmsg->info = "SLP BYE";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394 msn_slplink_queue_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 }
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 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 got_invite(MsnSlpCall *slpcall,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399 const char *branch, const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407 char *euf_guid, *context;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 euf_guid = get_token(content, "EUF-GUID: {", "}\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412 temp = get_token(content, "SessionID: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414 slpcall->session_id = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417 temp = get_token(content, "AppID: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 slpcall->app_id = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420 g_free(temp);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
421
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 context = get_token(content, "Context: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424 got_sessionreq(slpcall, branch, euf_guid, context);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
425
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 g_free(context);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 g_free(euf_guid);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431 /* A direct connection? */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 char *listening, *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 char *content;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
435
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 if (FALSE)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 MsnDirectConn *directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 /* const char *ip_addr; */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441 char *ip_port;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 int port;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 /* ip_addr = gaim_prefs_get_string("/core/ft/public_ip"); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 ip_port = "5190";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 listening = "true";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 nonce = rand_guid();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 directconn = msn_directconn_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 /* msn_directconn_parse_nonce(directconn, nonce); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 directconn->nonce = g_strdup(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 msn_directconn_listen(directconn);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 port = directconn->port;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 "Bridge: TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 "Listening: %s\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 "Nonce: {%s}\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 "Ipv4Internal-Addrs: 192.168.0.82\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463 "Ipv4Internal-Port: %d\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 "\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 listening,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 nonce,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467 port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
471 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 listening = "false";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 nonce = g_strdup("00000000-0000-0000-0000-000000000000");
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
474
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 "Bridge: TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 "Listening: %s\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 "Nonce: {%s}\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 "\r\n",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 listening,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482 }
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 send_ok(slpcall, branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 "application/x-msnmsgr-transrespbody", content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 char *ip_addrs;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 char *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 int port;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
497
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498 nonce = get_token(content, "Nonce: {", "}\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503 port = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 port = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508 if (ip_addrs == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
510
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511 if (port > 0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 got_transresp(slpcall, nonce, ip_addrs, port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515 g_free(ip_addrs);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 }
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 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
521 got_ok(MsnSlpCall *slpcall,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
522 const char *type, const char *content)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
523 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
524 g_return_if_fail(slpcall != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
525 g_return_if_fail(type != NULL);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
526
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
527 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
528 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
529 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530 if (slpcall->type == MSN_SLPCALL_DC)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
531 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
532 /* First let's try a DirectConnection. */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
534 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
535 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 char *header;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
537 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
538 char *branch;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540 slplink = slpcall->slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542 branch = rand_guid();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
543
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
544 content = g_strdup_printf(
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545 "Bridges: TRUDPv1 TCPv1\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546 "NetID: 0\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547 "Conn-Type: Direct-Connect\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
548 "UPnPNat: false\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 "ICF: false\r\n"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
550 );
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 header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
553 slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555 slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 "application/x-msnmsgr-transreqbody",
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557 content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
559 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 slpmsg->info = "SLP INVITE";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 slpmsg->text_body = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563 msn_slplink_send_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565 g_free(header);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 g_free(content);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
567
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 g_free(branch);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572 msn_slp_call_session_init(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
574 #else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
575 msn_slp_call_session_init(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
576 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
577 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580 /* Do we get this? */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581 gaim_debug_info("msn", "OK with transreqbody\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583 else if (!strcmp(type, "application/x-msnmsgr-transrespbody"))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
586 char *ip_addrs;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
587 char *temp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
588 char *nonce;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
589 int port;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
590
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591 nonce = get_token(content, "Nonce: {", "}\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596 port = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598 port = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
600
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
601 if (ip_addrs == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 if (port > 0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605 got_transresp(slpcall, nonce, ip_addrs, port);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 g_free(nonce);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608 g_free(ip_addrs);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
610 }
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 MsnSlpCall *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
614 msn_slp_sip_recv(MsnSlpLink *slplink, const char *body, gsize len)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
615 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
616 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
617
10907
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
618 if (body == NULL)
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
619 {
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
620 gaim_debug_warning("msn", "received bogus message\n");
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
621 return NULL;
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
622 }
4f5fa4cc7eb4 [gaim-migrate @ 12638]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10887
diff changeset
623
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624 if (!strncmp(body, "INVITE", strlen("INVITE")))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 char *branch;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
627 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628 char *content_type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630 slpcall = msn_slp_call_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
632 /* From: <msnmsgr:buddy@hotmail.com> */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
634 slpcall->remote_user = get_token(body, "From: <msnmsgr:", ">\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
635 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
636
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
637 branch = get_token(body, ";branch={", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
638
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
639 slpcall->id = get_token(body, "Call-ID: {", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
640
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
641 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642 long content_len = -1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644 temp = get_token(body, "Content-Length: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
645 if (temp != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
646 content_len = atoi(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
647 g_free(temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
648 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
649 content_type = get_token(body, "Content-Type: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
651 content = get_token(body, "\r\n\r\n", NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
652
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
653 got_invite(slpcall, branch, content_type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
654
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10403
diff changeset
655 g_free(branch);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
656 g_free(content_type);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
657 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
658 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659 else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 ")))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
661 char *content;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
662 char *content_type;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663 /* Make sure this is "OK" */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
664 const char *status = body + strlen("MSNSLP/1.0 ");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
665 char *call_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
667 call_id = get_token(body, "Call-ID: {", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
668 slpcall = msn_slplink_find_slp_call(slplink, call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
669 g_free(call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
670
9231
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
671 g_return_val_if_fail(slpcall != NULL, NULL);
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
672
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
673 if (strncmp(status, "200 OK", 6))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
674 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
675 /* It's not valid. Kill this off. */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
676 char temp[32];
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
677 const char *c;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
678
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
679 /* Eww */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
680 if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) ||
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
681 (c = strchr(status, '\0')))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
682 {
9739
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
683 size_t offset = c - status;
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
684 if (offset >= sizeof(temp))
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
685 offset = sizeof(temp) - 1;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
686
9739
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
687 strncpy(temp, status, offset);
35f22ba01bd7 [gaim-migrate @ 10603]
Sean Egan <seanegan@gmail.com>
parents: 9285
diff changeset
688 temp[offset] = '\0';
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
689 }
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
690
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
691 gaim_debug_error("msn", "Received non-OK result: %s\n", temp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
692
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
693 slpcall->wasted = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
694
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
695 /* msn_slp_call_destroy(slpcall); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
696 return slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
697 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
698
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
699 content_type = get_token(body, "Content-Type: ", "\r\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
700
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
701 content = get_token(body, "\r\n\r\n", NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
702
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
703 got_ok(slpcall, content_type, content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
704
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
705 g_free(content_type);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
706 g_free(content);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
707 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
708 else if (!strncmp(body, "BYE", strlen("BYE")))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
709 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
710 char *call_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
711
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
712 call_id = get_token(body, "Call-ID: {", "}");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
713 slpcall = msn_slplink_find_slp_call(slplink, call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
714 g_free(call_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
715
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
716 if (slpcall != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
717 slpcall->wasted = TRUE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
718
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
719 /* msn_slp_call_destroy(slpcall); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
720 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
721 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
722 slpcall = NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
723
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
724 return slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
725 }
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 * Msg Callbacks
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
729 **************************************************************************/
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
730
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
731 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
732 msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
733 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
734 MsnSession *session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
735 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
736
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
737 session = cmdproc->servconn->session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738 slplink = msn_session_get_slplink(session, msg->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
739
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
740 if (slplink->swboard == NULL)
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
741 {
10887
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
742 /* We will need this in order to change its flags. */
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
743 slplink->swboard = (MsnSwitchBoard *)cmdproc->data;
10887
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
744 /* If swboard is NULL, something has probably gone wrong earlier on
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
745 * 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
746 * 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
747 * reporting bugs. Hopefully this doesn't cause more crashes. Stu.
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
748 */
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
749 if (slplink->swboard != NULL)
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
750 slplink->swboard->slplink = slplink;
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
751 else
bda4b39a22b8 [gaim-migrate @ 12591]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10773
diff changeset
752 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
753 }
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10527
diff changeset
754
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
755 msn_slplink_process_msg(slplink, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
756 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
759 got_emoticon(MsnSlpCall *slpcall,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
760 const char *data, long long size)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
761 {
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
762
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
763 GaimConversation *conv;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
764 GaimConnection *gc;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
765 const char *who;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
766
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
767 gc = slpcall->slplink->session->account->gc;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
768 who = slpcall->slplink->remote_user;
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
769
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
770 conv = gaim_find_conversation_with_account(GAIM_CONV_ANY, who, gc->account);
10403
e5455f1dc9b6 [gaim-migrate @ 11648]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10345
diff changeset
771
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
772 /* 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
773 instead of all at once, calling write multiple times and
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
774 close once at the very end
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
775 */
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
776 gaim_conv_custom_smiley_write(conv, slpcall->data_info, data, size);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
777 gaim_conv_custom_smiley_close(conv, slpcall->data_info );
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
778 #ifdef MSN_DEBUG_UD
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
779 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
780 #endif
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
781 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
784 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
785 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
786 MsnSession *session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
787 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
788 MsnObject *obj;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
789 char **tokens;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
790 char *smile;
10527
507c680b573e [gaim-migrate @ 11846]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10526
diff changeset
791 const char *who, *sha1c;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
792
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
793 GaimConversation *conversation;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
794 GaimConnection *gc;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
795
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
796 session = cmdproc->servconn->session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
797
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
798 tokens = g_strsplit(msg->body, "\t", 2);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
799
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
800 smile = tokens[0];
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
801 obj = msn_object_new_from_string(gaim_url_decode(tokens[1]));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
802
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
803 who = msn_object_get_creator(obj);
10527
507c680b573e [gaim-migrate @ 11846]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10526
diff changeset
804 sha1c = msn_object_get_sha1c(obj);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
805
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
806 slplink = msn_session_get_slplink(session, who);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
807
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
808 gc = slplink->session->account->gc;
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
809
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
810 conversation = gaim_find_conversation_with_account(GAIM_CONV_ANY, who, gc->account);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
811
10527
507c680b573e [gaim-migrate @ 11846]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10526
diff changeset
812 if (gaim_conv_custom_smiley_add(conversation, smile, "sha1", sha1c)) {
10526
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
813 msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj);
55e7d72fc09a [gaim-migrate @ 11843]
Tim Ringenbach <marv@pidgin.im>
parents: 10519
diff changeset
814 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
815
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
816 g_strfreev(tokens);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
817 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
818
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
819 static gboolean
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
820 buddy_icon_cached(GaimConnection *gc, MsnObject *obj)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
821 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
822 GaimAccount *account;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
823 GaimBuddy *buddy;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
824 GSList *sl;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
825 const char *old;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
826 const char *new;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
827
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
828 g_return_val_if_fail(obj != NULL, FALSE);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
829
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
830 account = gaim_connection_get_account(gc);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
831
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
832 sl = gaim_find_buddies(account, msn_object_get_creator(obj));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
833
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
834 if (sl == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
835 return FALSE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
836
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
837 buddy = (GaimBuddy *)sl->data;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
838
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
839 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
840 new = msn_object_get_sha1c(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
841
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
842 if (new == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
843 return FALSE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
844
11020
407e47f580e4 [gaim-migrate @ 12891]
Mark Doliner <mark@kingant.net>
parents: 10907
diff changeset
845 /* 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
846 * then return TRUE */
407e47f580e4 [gaim-migrate @ 12891]
Mark Doliner <mark@kingant.net>
parents: 10907
diff changeset
847 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
848 return TRUE;
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 return FALSE;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
851 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
852
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
853 void
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
854 msn_release_buddy_icon_request(MsnUserList *userlist)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
855 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
856 MsnUser *user;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
857
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
858 g_return_if_fail(userlist != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
859
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
860 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
861 gaim_debug_info("msn", "Releasing buddy icon request\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
862 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
863
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
864 while (userlist->buddy_icon_window > 0)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
865 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
866 GQueue *queue;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
867 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
868 const char *username;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
869
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
870 queue = userlist->buddy_icon_requests;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
871
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
872 if (g_queue_is_empty(userlist->buddy_icon_requests))
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
873 break;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
874
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
875 user = g_queue_pop_head(queue);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
876
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
877 account = userlist->session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
878 username = user->passport;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
879
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
880 msn_request_user_display(user);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
881 userlist->buddy_icon_window--;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
882
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
883 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
884 gaim_debug_info("msn", "buddy_icon_window=%d\n",
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
885 userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
886 #endif
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
887 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
888 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
889
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
890 void
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
891 msn_queue_buddy_icon_request(MsnUser *user)
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 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
894 MsnObject *obj;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
895 GQueue *queue;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
896
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
897 g_return_if_fail(user != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
898
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
899 account = user->userlist->session->account;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
900
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
901 obj = msn_user_get_object(user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
902
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
903 if (obj == NULL)
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
904 {
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
905 /* It seems the user has not set a msnobject */
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
906 GSList *sl;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
907
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
908 /* TODO: I think we need better buddy icon core functions. */
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
909 gaim_buddy_icons_set_for_user(account, user->passport, NULL, -1);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
910
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
911 sl = gaim_find_buddies(account, user->passport);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
912
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
913 for (; sl != NULL; sl = sl->next)
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 GaimBuddy *buddy = (GaimBuddy *)sl->data;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
916 gaim_blist_node_remove_setting((GaimBlistNode*)buddy, "icon_checksum");
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
917 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
918
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
919 return;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
920 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
921
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
922 if (!buddy_icon_cached(account->gc, obj))
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
923 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
924 MsnUserList *userlist;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
925
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
926 userlist = user->userlist;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
927 queue = userlist->buddy_icon_requests;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
928
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
929 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
930 gaim_debug_info("msn", "Queueing buddy icon request: %s\n",
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
931 user->passport);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
932 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
933
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
934 g_queue_push_tail(queue, user);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
935
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
936 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
937 gaim_debug_info("msn", "buddy_icon_window=%d\n",
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
938 userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
939 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
940
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
941 if (userlist->buddy_icon_window > 0)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
942 msn_release_buddy_icon_request(userlist);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
943 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
944 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
945
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
946 void
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
947 got_user_display(MsnSlpCall *slpcall,
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
948 const char *data, long long size)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
949 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
950 MsnUserList *userlist;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
951 const char *info;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
952 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
953 GSList *sl;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
954
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
955 g_return_if_fail(slpcall != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
956
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
957 info = slpcall->data_info;
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
958 #ifdef MSN_DEBUG_UD
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
959 gaim_debug_info("msn", "Got User Display: %s\n", info);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
960 #endif
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
961
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
962 userlist = slpcall->slplink->session->userlist;
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
963 account = slpcall->slplink->session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
964
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
965 /* TODO: I think we need better buddy icon core functions. */
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
966 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user,
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
967 (void *)data, size);
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 sl = gaim_find_buddies(account, slpcall->slplink->remote_user);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
970
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
971 for (; sl != NULL; sl = sl->next)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
972 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
973 GaimBuddy *buddy = (GaimBuddy *)sl->data;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
974 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
975 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
976
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
977 #if 0
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
978 /* Free one window slot */
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
979 userlist->buddy_icon_window++;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
980
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
981 gaim_debug_info("msn", "buddy_icon_window=%d\n",
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
982 userlist->buddy_icon_window);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
983
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
984 msn_release_buddy_icon_request(userlist);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
985 #endif
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
986 }
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
987
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
988 void
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
989 end_user_display(MsnSlpCall *slpcall)
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
990 {
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
991 MsnUserList *userlist;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
992
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
993 g_return_if_fail(slpcall != NULL);
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
994
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
995 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
996 gaim_debug_info("msn", "End User Display\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
997 #endif
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
998
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
999 /* Maybe the slplink was destroyed. */
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1000 if (slpcall->slplink == NULL)
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1001 return;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1002
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1003 userlist = slpcall->slplink->session->userlist;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1004
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1005 /* If the session is being destroyed we better stop doing anything. */
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1006 if (slpcall->slplink->session->destroying)
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1007 return;
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10226
diff changeset
1008
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1009 /* Free one window slot */
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1010 userlist->buddy_icon_window++;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1011
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1012 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1013 gaim_debug_info("msn", "buddy_icon_window=%d\n",
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1014 userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1015 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1016
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1017 msn_release_buddy_icon_request(userlist);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1018 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1019
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1020 void
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1021 msn_request_user_display(MsnUser *user)
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1022 {
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1023 GaimAccount *account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1024 MsnSession *session;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1025 MsnSlpLink *slplink;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1026 MsnObject *obj;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1027 const char *info;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1028
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1029 session = user->userlist->session;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1030 account = session->account;
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1031
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1032 slplink = msn_session_get_slplink(session, user->passport);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1033
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1034 obj = msn_user_get_object(user);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1035
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1036 info = msn_object_get_sha1c(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1037
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1038 if (g_ascii_strcasecmp(user->passport,
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1039 gaim_account_get_username(account)))
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1040 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1041 msn_slplink_request_object(slplink, info, got_user_display,
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1042 end_user_display, obj);
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1043 }
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1044 else
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1045 {
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1046 MsnObject *my_obj = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1047 const char *filename = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1048 gchar *data = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1049 gsize len = 0;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1050 const char *my_info = NULL;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1051 GSList *sl;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1052
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1053 #ifdef MSN_DEBUG_UD
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1054 gaim_debug_info("msn", "Requesting our own user display\n");
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1055 #endif
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1056
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1057 my_obj = msn_user_get_object(session->user);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1058
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1059 if (my_obj != NULL)
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1060 {
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1061 filename = msn_object_get_real_location(my_obj);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1062 my_info = msn_object_get_sha1c(my_obj);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1063 }
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1064
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1065 if (filename != NULL)
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1066 g_file_get_contents(filename, &data, &len, NULL);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1067
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1068 /* TODO: I think we need better buddy icon core functions. */
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1069 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
1070 g_free(data);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1071
10072
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1072 sl = gaim_find_buddies(account, user->passport);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1073
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1074 for (; sl != NULL; sl = sl->next)
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1075 {
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1076 GaimBuddy *buddy = (GaimBuddy *)sl->data;
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1077 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info);
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1078 }
cf3454eadc22 [gaim-migrate @ 11051]
Luke Schierer <lschiere@pidgin.im>
parents: 10047
diff changeset
1079
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1080 /* Free one window slot */
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1081 session->userlist->buddy_icon_window++;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1082
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1083 #ifdef MSN_DEBUG_UD
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1084 gaim_debug_info("msn", "buddy_icon_window=%d\n",
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1085 session->userlist->buddy_icon_window);
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
1086 #endif
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10112
diff changeset
1087
9860
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1088 msn_release_buddy_icon_request(session->userlist);
65b3156f9f48 [gaim-migrate @ 10739]
Luke Schierer <lschiere@pidgin.im>
parents: 9858
diff changeset
1089 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1090 }