annotate src/protocols/msn/slplink.c @ 10774:d83f745c997b

[gaim-migrate @ 12383] Some escaping stuff, all over the place. Various escaping fixes in the IRC prpl. The core and plugins only need to escape text if it's going to be shown in a gtkimhtml or equivalent - such as writing to a conversation window, or gaim_notify_{formatted,userinfo} The primary and secondary text for all notify and request API functions do NOT need to be escaped by the core or plugins, because whether html-like markup is required for these is UI dependent. Now we always escape these in the Gtk UI request & notify ops. Should I backport any of the above to oldstatus? I also removed gaim_chat_get_display_name() - it was almost a duplicate of gaim_chat_get_name(), and it leaked. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 02 Apr 2005 17:18:43 +0000
parents 888d4c328be5
children 93663df88ec4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
1 /**
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
2 * @file slplink.c MSNSLP Link support
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
3 *
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
4 * gaim
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
5 *
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.
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
9 *
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
10 * This program is free software; you can redistribute it and/or modify
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
11 * it under the terms of the GNU General Public License as published by
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
13 * (at your option) any later version.
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
14 *
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
15 * This program is distributed in the hope that it will be useful,
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
18 * GNU General Public License for more details.
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
19 *
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
20 * You should have received a copy of the GNU General Public License
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
21 * along with this program; if not, write to the Free Software
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
23 */
9193
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 "slplink.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "switchboard.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 #include "slp.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 void msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
32 #ifdef MSN_DEBUG_SLP_FILES
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 static int m_sc = 0;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 static int m_rc = 0;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 debug_msg_to_file(MsnMessage *msg, gboolean send)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 char *tmp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 char *dir;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 char *pload;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 FILE *tf;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 int c;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 gsize pload_size;
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 dir = send ? "send" : "recv";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 c = send ? m_sc++ : m_rc++;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c);
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10481
diff changeset
49 tf = g_fopen(tmp, "wb");
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 pload = msn_message_gen_payload(msg, &pload_size);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 fwrite(pload, 1, pload_size, tf);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 fclose(tf);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 g_free(tmp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
57 /**************************************************************************
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
58 * Main
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
59 **************************************************************************/
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
60
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 MsnSlpLink *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 msn_slplink_new(MsnSession *session, const char *username)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
66 g_return_val_if_fail(session != NULL, NULL);
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
67
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 slplink = g_new0(MsnSlpLink, 1);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
70 #ifdef MSN_DEBUG_SLPLINK
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
71 gaim_debug_info("msn", "slplink_new: slplink(%p)\n", slplink);
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
72 #endif
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
73
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 slplink->session = session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 slplink->local_user = g_strdup(msn_user_get_passport(session->user));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 slplink->remote_user = g_strdup(username);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 slplink->slp_msg_queue = g_queue_new();
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 session->slplinks =
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 g_list_append(session->slplinks, slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 return slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 msn_slplink_destroy(MsnSlpLink *slplink)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 MsnSession *session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
93 #ifdef MSN_DEBUG_SLPLINK
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
94 gaim_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink);
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
95 #endif
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
96
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
97 g_return_if_fail(slplink != NULL);
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
98
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
99 if (slplink->swboard != NULL)
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
100 slplink->swboard->slplink = NULL;
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
101
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 session = slplink->session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 if (slplink->local_user != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 g_free(slplink->local_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 if (slplink->remote_user != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 g_free(slplink->remote_user);
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 (slplink->directconn != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 msn_directconn_destroy(slplink->directconn);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
113 while (slplink->slp_calls != NULL)
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
114 msn_slp_call_destroy(slplink->slp_calls->data);
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
115
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 session->slplinks =
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 g_list_remove(session->slplinks, slplink);
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 g_free(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 }
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 MsnSlpLink *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 msn_session_find_slplink(MsnSession *session, const char *who)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 GList *l;
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 for (l = session->slplinks; l != NULL; l = l->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 {
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
129 MsnSlpLink *slplink;
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
130
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 slplink = l->data;
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 if (!strcmp(slplink->remote_user, who))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 return slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 }
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 MsnSlpLink *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 msn_session_get_slplink(MsnSession *session, const char *username)
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 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 slplink = msn_session_find_slplink(session, username);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 if (slplink == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 slplink = msn_slplink_new(session, username);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 return slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 }
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 MsnSlpSession *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 msn_slplink_find_slp_session(MsnSlpLink *slplink, long session_id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 GList *l;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 MsnSlpSession *slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 for (l = slplink->slp_sessions; l != NULL; l = l->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 slpsession = l->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 if (slpsession->id == session_id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 return slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
170 void
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
171 msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall)
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
172 {
10621
fe919915fceb [gaim-migrate @ 12090]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
173 if (slplink->swboard != NULL)
fe919915fceb [gaim-migrate @ 12090]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10602
diff changeset
174 slplink->swboard->flag |= MSN_SB_FLAG_FT;
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
175
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
176 slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall);
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
177 }
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
178
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
179 void
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
180 msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall)
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
181 {
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
182 slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall);
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
183
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
184 /* The slplink has no slpcalls in it. If no one is using it, we might
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
185 * destroy the switchboard, but we should be careful not to use the slplink
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
186 * again. */
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
187 if (slplink->slp_calls == NULL)
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
188 {
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
189 if (slplink->swboard != NULL)
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
190 {
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
191 if (msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT))
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
192 /* I'm not sure this is the best thing to do, but it's better
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
193 * than nothing. */
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
194 slpcall->slplink = NULL;
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
195 }
10602
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
196 }
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
197 }
f52ab405f1ab [gaim-migrate @ 12032]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10589
diff changeset
198
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 MsnSlpCall *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 msn_slplink_find_slp_call(MsnSlpLink *slplink, const char *id)
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 GList *l;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204
10107
65e7df286076 [gaim-migrate @ 11139]
Luke Schierer <lschiere@pidgin.im>
parents: 10092
diff changeset
205 if (!id)
65e7df286076 [gaim-migrate @ 11139]
Luke Schierer <lschiere@pidgin.im>
parents: 10092
diff changeset
206 return NULL;
65e7df286076 [gaim-migrate @ 11139]
Luke Schierer <lschiere@pidgin.im>
parents: 10092
diff changeset
207
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 for (l = slplink->slp_calls; l != NULL; l = l->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 slpcall = l->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211
10107
65e7df286076 [gaim-migrate @ 11139]
Luke Schierer <lschiere@pidgin.im>
parents: 10092
diff changeset
212 if (slpcall->id && !strcmp(slpcall->id, id))
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 return slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 MsnSlpCall *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 GList *l;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 for (l = slplink->slp_calls; l != NULL; l = l->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 slpcall = l->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 if (slpcall->session_id == id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 return slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239 if (slplink->directconn != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 msn_directconn_send_msg(slplink->directconn, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 {
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
245 if (slplink->swboard == NULL)
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
246 {
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
247 slplink->swboard = msn_session_get_swboard(slplink->session,
10773
888d4c328be5 [gaim-migrate @ 12382]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10621
diff changeset
248 slplink->remote_user, MSN_SB_FLAG_FT);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
250 if (slplink->swboard == NULL)
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
251 return;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252
10346
bbf738a0ce7b [gaim-migrate @ 11560]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10345
diff changeset
253 /* If swboard is destroyed we will be too */
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
254 slplink->swboard->slplink = slplink;
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
255 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256
10481
bcfea6c3d5c9 [gaim-migrate @ 11769]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10388
diff changeset
257 msn_switchboard_send_msg(slplink->swboard, msg, TRUE);
9193
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 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
261 /* We have received the message ack */
9571
b3711e089751 [gaim-migrate @ 10414]
Mark Doliner <mark@kingant.net>
parents: 9330
diff changeset
262 static void
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
263 msg_ack(MsnMessage *msg, void *data)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 long long real_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
268 slpmsg = data;
9193
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 real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
272 slpmsg->offset += msg->msnslp_header.length;
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
273
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 if (slpmsg->offset < real_size)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
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 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 /* The whole message has been sent */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281
9246
e20af87d8721 [gaim-migrate @ 10045]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
282 if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 {
9246
e20af87d8721 [gaim-migrate @ 10045]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
284 if ((slpmsg->slpcall != NULL) &&
e20af87d8721 [gaim-migrate @ 10045]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
285 (slpmsg->slpcall->cb != NULL))
e20af87d8721 [gaim-migrate @ 10045]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
286 {
e20af87d8721 [gaim-migrate @ 10045]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
287 slpmsg->slpcall->cb(slpmsg->slpcall, NULL, 0);
e20af87d8721 [gaim-migrate @ 10045]
Christian Hammond <chipx86@chipx86.com>
parents: 9231
diff changeset
288 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 }
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
290 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
292 slpmsg->msgs = g_list_remove(slpmsg->msgs, msg);
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
293 }
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
294
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
295 /* We have received the message nak. */
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
296 static void
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
297 msg_nak(MsnMessage *msg, void *data)
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
298 {
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
299 MsnSlpMessage *slpmsg;
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
300
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
301 slpmsg = data;
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
302
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
303 msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
304
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
305 slpmsg->msgs = g_list_remove(slpmsg->msgs, msg);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 MsnMessage *msg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312 long long real_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 size_t len = 0;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
315 /* Maybe we will want to create a new msg for this slpmsg instead of
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
316 * reusing the same one all the time. */
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 msg = slpmsg->msg;
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 real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size;
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 if (slpmsg->offset < real_size)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 if (slpmsg->fp)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 char data[1202];
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 len = fread(data, 1, sizeof(data), slpmsg->fp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 msn_message_set_bin_data(msg, data, len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331 len = slpmsg->size - slpmsg->offset;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 if (len > 1202)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 len = 1202;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
338
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339 msg->msnslp_header.offset = slpmsg->offset;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 msg->msnslp_header.length = len;
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
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
343 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
347 #ifdef MSN_DEBUG_SLP_FILES
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 debug_msg_to_file(msg, TRUE);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
351 slpmsg->msgs =
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
352 g_list_append(slpmsg->msgs, msg);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353 msn_slplink_send_msg(slplink, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
355 if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) &&
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
356 (slpmsg->slpcall != NULL))
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 {
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
358 slpmsg->slpcall->progress = TRUE;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
359
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
360 if (slpmsg->slpcall->progress_cb != NULL)
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
361 {
9231
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
362 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size,
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
363 len, slpmsg->offset);
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
364 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
367 /* slpmsg->offset += len; */
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
370 void
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
371 msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373 MsnMessage *msg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375 slpmsg->msg = msg = msn_message_new_msnslp();
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
376
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 if (slpmsg->flags == 0x0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379 msg->msnslp_header.session_id = slpmsg->session_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 msg->msnslp_header.ack_id = rand() % 0xFFFFFF00;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382 else if (slpmsg->flags == 0x2)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 msg->msnslp_header.session_id = slpmsg->session_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 msg->msnslp_header.ack_id = slpmsg->ack_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 msg->msnslp_header.ack_size = slpmsg->ack_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388 else if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 MsnSlpSession *slpsession;
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
391 slpsession = slpmsg->slpsession;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393 g_return_if_fail(slpsession != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394 msg->msnslp_header.session_id = slpsession->id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 msg->msnslp_footer.value = slpsession->app_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396 msg->msnslp_header.ack_id = rand() % 0xFFFFFF00;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 else if (slpmsg->flags == 0x100)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 msg->msnslp_header.ack_id = slpmsg->ack_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 msg->msnslp_header.ack_size = slpmsg->ack_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 msg->msnslp_header.id = slpmsg->id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406 msg->msnslp_header.flags = slpmsg->flags;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 msg->msnslp_header.total_size = slpmsg->size;
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 msn_message_set_attr(msg, "P2P-Dest", slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
412 msg->ack_cb = msg_ack;
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
413 msg->nak_cb = msg_nak;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414 msg->ack_data = slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 msn_slplink_send_msgpart(slplink, slpmsg);
10284
f776e117c17b [gaim-migrate @ 11454]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10225
diff changeset
417
f776e117c17b [gaim-migrate @ 11454]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10225
diff changeset
418 msn_message_destroy(msg);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
419 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
420
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
421 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
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 slpmsg->id = slplink->slp_seq_id++;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 g_queue_push_head(slplink->slp_msg_queue, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 msn_slplink_send_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 slpmsg->id = slplink->slp_seq_id++;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
434 msn_slplink_release_slpmsg(slplink, slpmsg);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 msn_slplink_unleash(MsnSlpLink *slplink)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 /* Send the queued msgs in the order they came. */
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 while ((slpmsg = g_queue_pop_tail(slplink->slp_msg_queue)) != NULL)
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
445 {
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
446 msn_slplink_release_slpmsg(slplink, slpmsg);
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
447 }
9193
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 slpmsg = msn_slpmsg_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 slpmsg->session_id = msg->msnslp_header.session_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458 slpmsg->size = msg->msnslp_header.total_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 slpmsg->flags = 0x02;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 slpmsg->ack_id = msg->msnslp_header.id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 slpmsg->ack_sub_id = msg->msnslp_header.ack_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 slpmsg->ack_size = msg->msnslp_header.total_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
464 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 slpmsg->info = "SLP ACK";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
467
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 msn_slplink_send_slpmsg(slplink, slpmsg);
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
9571
b3711e089751 [gaim-migrate @ 10414]
Mark Doliner <mark@kingant.net>
parents: 9330
diff changeset
471 static void
b3711e089751 [gaim-migrate @ 10414]
Mark Doliner <mark@kingant.net>
parents: 9330
diff changeset
472 send_file_cb(MsnSlpSession *slpsession)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 slpcall = slpsession->slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 slpmsg = msn_slpmsg_new(slpcall->slplink);
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
479 slpmsg->slpcall = slpcall;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 slpmsg->flags = 0x1000030;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 slpmsg->slpsession = slpsession;
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
482 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 slpmsg->info = "SLP FILE";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 msn_slpmsg_open_file(slpmsg, gaim_xfer_get_local_filename(slpcall->xfer));
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 msn_slplink_send_slpmsg(slpcall->slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491 msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 const char *data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 gsize offset;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 gsize len;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
498 #ifdef MSN_DEBUG_SLP
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499 msn_slpmsg_show(msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
502 #ifdef MSN_DEBUG_SLP_FILES
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503 debug_msg_to_file(msg, FALSE);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 if (msg->msnslp_header.total_size < msg->msnslp_header.length)
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 gaim_debug_error("msn", "This can't be good\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 g_return_if_reached();
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 slpmsg = NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513 data = msn_message_get_bin_data(msg, &len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515 /*
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 OVERHEAD!
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 if (msg->msnslp_header.length < msg->msnslp_header.total_size)
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 offset = msg->msnslp_header.offset;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
521
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
522 if (offset == 0)
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 slpmsg = msn_slpmsg_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
525 slpmsg->id = msg->msnslp_header.id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
526 slpmsg->session_id = msg->msnslp_header.session_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
527 slpmsg->size = msg->msnslp_header.total_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
528 slpmsg->flags = msg->msnslp_header.flags;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
529
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530 if (slpmsg->session_id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
531 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
532 if (slpmsg->slpcall == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
534
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
535 if (slpmsg->slpcall != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 {
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
537 if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030)
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
538 {
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
539 GaimXfer *xfer;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
541 xfer = slpmsg->slpcall->xfer;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
543 if (xfer != NULL)
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
544 {
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
545 slpmsg->fp =
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10481
diff changeset
546 g_fopen(gaim_xfer_get_local_filename(slpmsg->slpcall->xfer),
9226
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
547 "wb");
7a00289f2ef1 [gaim-migrate @ 10022]
Christian Hammond <chipx86@chipx86.com>
parents: 9219
diff changeset
548 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 }
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 }
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
552 if (!slpmsg->fp && slpmsg->size)
10092
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
553 {
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
554 slpmsg->buffer = g_try_malloc(slpmsg->size);
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
555 if (slpmsg->buffer == NULL)
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
556 {
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
557 gaim_debug_error("msn", "Failed to allocate buffer for slpmsg\n");
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
558 return;
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
559 }
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
560 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563 {
10092
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
564 slpmsg = msn_slplink_message_find(slplink, msg->msnslp_header.session_id, msg->msnslp_header.id);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
567 if (slpmsg == NULL)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 {
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
569 /* Probably the transfer was canceled */
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 gaim_debug_error("msn", "Couldn't find slpmsg\n");
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
571 return;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573
10345
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
574 if (slpmsg->fp)
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
575 {
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
576 /* fseek(slpmsg->fp, offset, SEEK_SET); */
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
577 len = fwrite(data, 1, len, slpmsg->fp);
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
578 }
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
579 else if (slpmsg->size)
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
580 {
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
581 if ((offset + len) > slpmsg->size)
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
582 {
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
583 gaim_debug_error("msn", "Oversized slpmsg\n");
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
584 g_return_if_reached();
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
585 }
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
586 else
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
587 memcpy(slpmsg->buffer + offset, data, len);
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
588 }
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
589
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
590 if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) &&
2e01c503aa4f [gaim-migrate @ 11556]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10296
diff changeset
591 (slpmsg->slpcall != NULL))
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 {
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
593 slpmsg->slpcall->progress = TRUE;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
594
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
595 if (slpmsg->slpcall->progress_cb != NULL)
9231
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
596 {
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
597 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size,
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
598 len, offset);
ac8790437abe [gaim-migrate @ 10027]
Christian Hammond <chipx86@chipx86.com>
parents: 9226
diff changeset
599 }
9193
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603 if (slpmsg->buffer == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 if (msg->msnslp_header.offset + msg->msnslp_header.length
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608 >= msg->msnslp_header.total_size)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
610 /* All the pieces of the slpmsg have been received */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
611 MsnSlpCall *slpcall;
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 slpcall = msn_slp_process_msg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
614
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
615 if (slpmsg->flags == 0x100)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
616 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
617 MsnDirectConn *directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
619 directconn = slplink->directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
621 if (!directconn->acked)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
622 msn_directconn_send_handshake(directconn);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
623 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624 else if (slpmsg->flags == 0x0 || slpmsg->flags == 0x20 ||
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625 slpmsg->flags == 0x1000030)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
627 /* Release all the messages and send the ACK */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629 msn_slplink_send_ack(slplink, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630 msn_slplink_unleash(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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633 msn_slpmsg_destroy(slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
634
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
635 if (slpcall != NULL && slpcall->wasted)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
636 msn_slp_call_destroy(slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
637 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
638 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
639
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
640 MsnSlpMessage *
10092
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
641 msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643 GList *e;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
645 for (e = slplink->slp_msgs; e != NULL; e = e->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
646 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
647 MsnSlpMessage *slpmsg = e->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
648
10092
1843023b8189 [gaim-migrate @ 11109]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10088
diff changeset
649 if ((slpmsg->session_id == session_id) && (slpmsg->id == id))
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650 return slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
651 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
652
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
653 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
654 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
655
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
656 typedef struct
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
657 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
658 guint32 length;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659 guint32 unk1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 guint32 file_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
661 guint32 unk2;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
662 guint32 unk3;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663 } MsnContextHeader;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
664
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
665 #define MAX_FILE_NAME_LEN 0x226
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666
10388
088633feb846 [gaim-migrate @ 11615]
Nathan Walp <nwalp@pidgin.im>
parents: 10346
diff changeset
667 static unsigned char *
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
668 gen_context(const char *file_name, const char *file_path)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
669 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
670 struct stat st;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
671 gsize size = 0;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
672 MsnContextHeader header;
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
673 gchar *u8 = NULL;
10388
088633feb846 [gaim-migrate @ 11615]
Nathan Walp <nwalp@pidgin.im>
parents: 10346
diff changeset
674 guchar *base, *n;
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
675 gunichar2 *uni = NULL;
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
676 glong currentChar = 0;
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
677 glong uni_len = 0;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
678 gsize len;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
679
10589
0f7452b1f777 [gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10481
diff changeset
680 if (g_stat(file_path, &st) == 0)
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
681 size = st.st_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
682
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
683 if(!file_name) {
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
684 u8 = gaim_utf8_try_convert(g_basename(file_path));
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
685 file_name = u8;
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
686 }
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
687
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
688 uni = g_utf8_to_utf16(file_name, -1, NULL, &uni_len, NULL);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
689
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
690 if(u8) {
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
691 g_free(u8);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
692 file_name = NULL;
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
693 u8 = NULL;
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
694 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
695
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
696 len = sizeof(MsnContextHeader) + MAX_FILE_NAME_LEN + 4;
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 header.length = GUINT32_TO_LE(len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
699 header.unk1 = GUINT32_TO_LE(2);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
700 header.file_size = GUINT32_TO_LE(size);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
701 header.unk2 = GUINT32_TO_LE(0);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
702 header.unk3 = GUINT32_TO_LE(0);
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
703
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
704 base = g_malloc(len + 1);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
705 n = base;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
706
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
707 memcpy(n, &header, sizeof(MsnContextHeader));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
708 n += sizeof(MsnContextHeader);
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 memset(n, 0x00, MAX_FILE_NAME_LEN);
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
711 for(currentChar = 0; currentChar < uni_len; currentChar++) {
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
712 *((gunichar2 *)n + currentChar) = GUINT16_TO_LE(uni[currentChar]);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
713 }
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
714 n += MAX_FILE_NAME_LEN;
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 memset(n, 0xFF, 4);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
717 n += 4;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
718
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
719 g_free(uni);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
720 return gaim_base64_encode(base, len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
721 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
722
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
723 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
724 msn_slplink_request_ft(MsnSlpLink *slplink, GaimXfer *xfer)
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 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
727 char *context;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
728 const char *fn;
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
729 const char *fp;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
730
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
731 fn = gaim_xfer_get_filename(xfer);
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
732 fp = gaim_xfer_get_local_filename(xfer);
9193
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 g_return_if_fail(slplink != NULL);
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
735 g_return_if_fail(fp != NULL);
9193
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 slpcall = msn_slp_call_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738 msn_slp_call_init(slpcall, MSN_SLPCALL_DC);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
739
9571
b3711e089751 [gaim-migrate @ 10414]
Mark Doliner <mark@kingant.net>
parents: 9330
diff changeset
740 slpcall->session_init_cb = send_file_cb;
9715
b030f83693da [gaim-migrate @ 10576]
Christian Hammond <chipx86@chipx86.com>
parents: 9571
diff changeset
741 slpcall->end_cb = msn_xfer_end_cb;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
742 slpcall->progress_cb = msn_xfer_progress_cb;
9259
f5f7482678d2 [gaim-migrate @ 10058]
Christian Hammond <chipx86@chipx86.com>
parents: 9246
diff changeset
743 slpcall->cb = msn_xfer_completed_cb;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
744 slpcall->xfer = xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
745
10296
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
746 slpcall->pending = TRUE;
a7b2fd5efcf2 [gaim-migrate @ 11476]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10284
diff changeset
747
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
748 gaim_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
749
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
750 xfer->data = slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
751
10047
9b82412d3e52 [gaim-migrate @ 11008]
Mark Doliner <mark@kingant.net>
parents: 9861
diff changeset
752 context = gen_context(fn, fp);
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
753
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
754 msn_slp_call_invite(slpcall, "5D3E02AB-6190-11D3-BBBB-00C04F795683", 2,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
755 context);
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 g_free(context);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
758 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
759
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
760 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
761 msn_slplink_request_object(MsnSlpLink *slplink,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
762 const char *info,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
763 MsnSlpCb cb,
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
764 MsnSlpEndCb end_cb,
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
765 const MsnObject *obj)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
766 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
767 MsnSlpCall *slpcall;
10388
088633feb846 [gaim-migrate @ 11615]
Nathan Walp <nwalp@pidgin.im>
parents: 10346
diff changeset
768 unsigned char *msnobj_data;
088633feb846 [gaim-migrate @ 11615]
Nathan Walp <nwalp@pidgin.im>
parents: 10346
diff changeset
769 unsigned char *msnobj_base64;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
770
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
771 g_return_if_fail(slplink != NULL);
9861
68561f39acdc [gaim-migrate @ 10740]
Luke Schierer <lschiere@pidgin.im>
parents: 9788
diff changeset
772 g_return_if_fail(obj != NULL);
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9193
diff changeset
773
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
774 msnobj_data = msn_object_to_string(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
775 msnobj_base64 = gaim_base64_encode(msnobj_data, strlen(msnobj_data));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
776 g_free(msnobj_data);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
777
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
778 slpcall = msn_slp_call_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
779 msn_slp_call_init(slpcall, MSN_SLPCALL_ANY);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
780
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
781 slpcall->data_info = g_strdup(info);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
782 slpcall->cb = cb;
10225
ecf3ce2e2ab1 [gaim-migrate @ 11357]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10107
diff changeset
783 slpcall->end_cb = end_cb;
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
784
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
785 msn_slp_call_invite(slpcall, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6", 1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
786 msnobj_base64);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
787
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
788 g_free(msnobj_base64);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
789 }