annotate src/protocols/msn/slplink.c @ 9193:502707ca1836

[gaim-migrate @ 9988] Patch by Felipe Contreras to add MSN file transfer and buddy icons. Please test and report any bugs! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 06 Jun 2004 02:39:08 +0000
parents
children ab6636c5a136
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9193
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 #include "msn.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 #include "slplink.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 #include "switchboard.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 #include "slp.h"
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 void msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 #ifdef DEBUG_SLP_FILES
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 static int m_sc = 0;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 static int m_rc = 0;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 static void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 debug_msg_to_file(MsnMessage *msg, gboolean send)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 char *tmp;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 char *dir;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 char *pload;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 FILE *tf;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 int c;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 gsize pload_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 dir = send ? "send" : "recv";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 c = send ? m_sc++ : m_rc++;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 tf = fopen(tmp, "w");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 pload = msn_message_gen_payload(msg, &pload_size);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 fwrite(pload, 1, pload_size, tf);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 fclose(tf);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 g_free(tmp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 MsnSlpLink *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 msn_slplink_new(MsnSession *session, const char *username)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 MsnSlpLink *slplink;
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 slplink = g_new0(MsnSlpLink, 1);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 slplink->session = session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 slplink->local_user = g_strdup(msn_user_get_passport(session->user));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 slplink->remote_user = g_strdup(username);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 slplink->slp_msg_queue = g_queue_new();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 session->slplinks =
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 g_list_append(session->slplinks, slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 return slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 msn_slplink_destroy(MsnSlpLink *slplink)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 MsnSession *session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 session = slplink->session;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 if (slplink->local_user != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 g_free(slplink->local_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 if (slplink->remote_user != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 g_free(slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 if (slplink->directconn != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 msn_directconn_destroy(slplink->directconn);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 session->slplinks =
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 g_list_remove(session->slplinks, slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 g_free(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 }
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 MsnSlpLink *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 msn_session_find_slplink(MsnSession *session, const char *who)
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 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 GList *l;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 for (l = session->slplinks; l != NULL; l = l->next)
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 slplink = l->data;
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 if (!strcmp(slplink->remote_user, who))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 return slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 MsnSlpLink *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 msn_session_get_slplink(MsnSession *session, const char *username)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 MsnSlpLink *slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 slplink = msn_session_find_slplink(session, username);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 if (slplink == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 slplink = msn_slplink_new(session, username);
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 return slplink;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 }
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 MsnSlpSession *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 msn_slplink_find_slp_session(MsnSlpLink *slplink, long session_id)
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 GList *l;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 MsnSlpSession *slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 for (l = slplink->slp_sessions; l != NULL; l = l->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 slpsession = l->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 if (slpsession->id == session_id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 return slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 }
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 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 MsnSlpCall *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 msn_slplink_find_slp_call(MsnSlpLink *slplink, const char *id)
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 GList *l;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 for (l = slplink->slp_calls; l != NULL; l = l->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 slpcall = l->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 if (!strcmp(slpcall->id, id))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 return slpcall;
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 return NULL;
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 MsnSlpCall *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 GList *l;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145 MsnSlpCall *slpcall;
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 for (l = slplink->slp_calls; l != NULL; l = l->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 slpcall = l->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 if (slpcall->session_id == id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 return slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg)
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 if (slplink->directconn != NULL)
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 msn_directconn_send_msg(slplink->directconn, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 else
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 MsnSwitchBoard *swboard;
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 swboard = msn_session_get_swboard(slplink->session, slplink->remote_user);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 if (swboard == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 if (!g_queue_is_empty(swboard->im_queue) ||
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 !swboard->user_joined)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 msn_switchboard_queue_msg(swboard, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 msn_switchboard_send_msg(swboard, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 void t_ack(MsnCmdProc *cmdproc, MsnCommand *cmd)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 long long real_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 slpmsg = cmd->trans->data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 if (slpmsg->wasted)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 gaim_debug_info("msn", "slpmsg cancelled %p\n", slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 if (slpmsg->slpcall != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 if (slpmsg->slpcall->cb != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 slpmsg->slpcall->cb(slpmsg->slpcall, NULL, -1);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 msn_slpcall_destroy(slpmsg->slpcall);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 msn_slpmsg_destroy(slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 #endif
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 real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 if (slpmsg->offset < real_size)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
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 else
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 /* The whole message has been sent */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 if ((slpmsg->slpcall != NULL) &&
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 (slpmsg->slpcall->cb != NULL))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 slpmsg->slpcall->cb(slpmsg->slpcall, NULL, 0);
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 msn_slpmsg_destroy(slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 }
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231 msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
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 MsnMessage *msg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 long long real_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 size_t len = 0;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 msg = slpmsg->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 real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size;
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 if (slpmsg->offset < real_size)
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 if (slpmsg->fp)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 char data[1202];
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 len = fread(data, 1, sizeof(data), slpmsg->fp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 msn_message_set_bin_data(msg, data, len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 len = slpmsg->size - slpmsg->offset;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 if (len > 1202)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 len = 1202;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 }
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 msg->msnslp_header.offset = slpmsg->offset;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 msg->msnslp_header.length = len;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 #ifdef DEBUG_SLP
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 #ifdef DEBUG_SLP_FILES
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 debug_msg_to_file(msg, TRUE);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 msn_slplink_send_msg(slplink, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 if ((slpmsg->slpcall != NULL) &&
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 (slpmsg->slpcall->progress_cb != NULL))
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 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, len,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 slpmsg->offset);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 slpmsg->offset += len;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 msn_slplink_release_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 MsnMessage *msg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 slpmsg->msg = msg = msn_message_new_msnslp();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 if (slpmsg->flags == 0x0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 msg->msnslp_header.session_id = slpmsg->session_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293 msg->msnslp_header.ack_id = rand() % 0xFFFFFF00;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
295 else if (slpmsg->flags == 0x2)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 msg->msnslp_header.session_id = slpmsg->session_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 msg->msnslp_header.ack_id = slpmsg->ack_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 msg->msnslp_header.ack_size = slpmsg->ack_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
301 else if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
302 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303 MsnSlpSession *slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 slpsession = slpmsg->slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 g_return_if_fail(slpsession != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307 msg->msnslp_header.session_id = slpsession->id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 msg->msnslp_footer.value = slpsession->app_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 msg->msnslp_header.ack_id = rand() % 0xFFFFFF00;
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 else if (slpmsg->flags == 0x100)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 msg->msnslp_header.ack_id = slpmsg->ack_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314 msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 msg->msnslp_header.ack_size = slpmsg->ack_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 msg->msnslp_header.id = slpmsg->id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 msg->msnslp_header.flags = slpmsg->flags;
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 msg->msnslp_header.total_size = slpmsg->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 msn_message_set_attr(msg, "P2P-Dest", slplink->remote_user);
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 msg->ack_cb = t_ack;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 msg->ack_data = slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 msn_slplink_send_msgpart(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332 msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 slpmsg->id = slplink->slp_seq_id++;
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 g_queue_push_head(slplink->slp_msg_queue, slpmsg);
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 msn_slplink_send_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg)
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 slpmsg->id = slplink->slp_seq_id++;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 msn_slplink_release_msg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
346
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 msn_slplink_unleash(MsnSlpLink *slplink)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
351
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 /* Send the queued msgs in the order they came. */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354 while ((slpmsg = g_queue_pop_tail(slplink->slp_msg_queue)) != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 msn_slplink_release_msg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359 msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
362
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363 slpmsg = msn_slpmsg_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 slpmsg->session_id = msg->msnslp_header.session_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366 slpmsg->size = msg->msnslp_header.total_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367 slpmsg->flags = 0x02;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 slpmsg->ack_id = msg->msnslp_header.id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369 slpmsg->ack_sub_id = msg->msnslp_header.ack_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
370 slpmsg->ack_size = msg->msnslp_header.total_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 #ifdef DEBUG_SLP
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373 slpmsg->info = "SLP ACK";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
375
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376 msn_slplink_send_slpmsg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
380 send_file(MsnSlpSession *slpsession)
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 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
383 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
385 slpcall = slpsession->slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
386 slpmsg = msn_slpmsg_new(slpcall->slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
387 slpmsg->flags = 0x1000030;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
388 slpmsg->slpsession = slpsession;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
389 #ifdef DEBUG_SLP
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
390 slpmsg->info = "SLP FILE";
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
391 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392 slpmsg->slpcall = slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393 msn_slpmsg_open_file(slpmsg, gaim_xfer_get_local_filename(slpcall->xfer));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
394
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 gaim_xfer_add(slpcall->xfer);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396 msn_slplink_send_slpmsg(slpcall->slplink, slpmsg);
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
399 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
402 MsnSlpMessage *slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 const char *data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404 gsize offset;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 gsize len;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
407 #ifdef DEBUG_SLP
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 msn_slpmsg_show(msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 #ifdef DEBUG_SLP_FILES
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
412 debug_msg_to_file(msg, FALSE);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
414
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
415 if (msg->msnslp_header.total_size < msg->msnslp_header.length)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
416 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
417 gaim_debug_error("msn", "This can't be good\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
418 g_return_if_reached();
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 slpmsg = NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 data = msn_message_get_bin_data(msg, &len);
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 /*
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425 OVERHEAD!
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 if (msg->msnslp_header.length < msg->msnslp_header.total_size)
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 offset = msg->msnslp_header.offset;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
431 if (offset == 0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 slpmsg = msn_slpmsg_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 slpmsg->id = msg->msnslp_header.id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 slpmsg->session_id = msg->msnslp_header.session_id;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436 slpmsg->size = msg->msnslp_header.total_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 slpmsg->flags = msg->msnslp_header.flags;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 slpmsg->buffer = g_malloc(slpmsg->size);
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 if (slpmsg->session_id)
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 if (slpmsg->slpcall == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 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
444
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 if (slpmsg->slpcall != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 GaimXfer *xfer;
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 xfer = slpmsg->slpcall->xfer;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 if (xfer != NULL)
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 slpmsg->fp =
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 fopen(gaim_xfer_get_local_filename(slpmsg->slpcall->xfer), "w");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461 slpmsg = msn_slplink_message_find(slplink, msg->msnslp_header.id);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464 if (slpmsg != NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 if (slpmsg->fp)
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 /* fseek(slpmsg->fp, offset, SEEK_SET); */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
469 len = fwrite(data, 1, len, slpmsg->fp);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
470 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
471 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473 memcpy(slpmsg->buffer + offset, data, len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
474 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
475 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 else
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 gaim_debug_error("msn", "Couldn't find slpmsg\n");
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 g_return_if_reached();
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482 if ((slpmsg->slpcall != NULL) &&
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 (slpmsg->slpcall->progress_cb != NULL))
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, len, offset);
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
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 #if 0
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489 if (slpmsg->buffer == NULL)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 return;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491 #endif
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
492
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 if (msg->msnslp_header.offset + msg->msnslp_header.length
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 >= msg->msnslp_header.total_size)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 /* All the pieces of the slpmsg have been received */
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499 slpcall = msn_slp_process_msg(slplink, slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 if (slpmsg->flags == 0x100)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503 MsnDirectConn *directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 directconn = slplink->directconn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507 if (!directconn->acked)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508 msn_directconn_send_handshake(directconn);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
510 else if (slpmsg->flags == 0x0 || slpmsg->flags == 0x20 ||
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511 slpmsg->flags == 0x1000030)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513 /* Release all the messages and send the ACK */
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 msn_slplink_send_ack(slplink, msg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 msn_slplink_unleash(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
518
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
519 msn_slpmsg_destroy(slpmsg);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
520
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
521 if (slpcall != NULL && slpcall->wasted)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
522 msn_slp_call_destroy(slpcall);
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 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
525
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
526 MsnSlpMessage *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
527 msn_slplink_message_find(MsnSlpLink *slplink, long id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
528 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
529 GList *e;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
531 for (e = slplink->slp_msgs; e != NULL; e = e->next)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
532 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 MsnSlpMessage *slpmsg = e->data;
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->id == id)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 return slpmsg;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
537 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
538
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 return NULL;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
540 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542 typedef struct
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
543 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
544 guint32 length;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545 guint32 unk1;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
546 guint32 file_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547 guint32 unk2;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
548 guint32 unk3;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 } MsnContextHeader;
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 #define MAX_FILE_NAME_LEN 0x226
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
552
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
553 char *
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554 gen_context(const char *file_name)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 struct stat st;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557 gsize size = 0;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558 MsnContextHeader header;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559 gchar *u8;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 gchar *base, *n;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 gunichar2 *uni;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 glong uni_len;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563 gsize len;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565 if (stat(file_name, &st) == 0)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 size = st.st_size;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 u8 = g_locale_to_utf8(g_basename(file_name), -1, NULL, NULL, NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 uni = g_utf8_to_utf16(u8, -1, NULL, &uni_len, NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 g_free(u8);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572 len = sizeof(MsnContextHeader) + MAX_FILE_NAME_LEN + 4;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
574 header.length = GUINT32_TO_LE(len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
575 header.unk1 = GUINT32_TO_LE(2);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
576 header.file_size = GUINT32_TO_LE(size);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
577 header.unk2 = GUINT32_TO_LE(0);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578 header.unk3 = GUINT32_TO_LE(0);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580 base = n = g_malloc(len + 1);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582 memcpy(n, &header, sizeof(MsnContextHeader));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583 n += sizeof(MsnContextHeader);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585 memset(n, 0x00, MAX_FILE_NAME_LEN);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
586 memcpy(n, uni, uni_len * 2);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
587 n += MAX_FILE_NAME_LEN;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
588
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
589 memset(n, 0xFF, 4);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 n += 4;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 g_free(uni);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594 return gaim_base64_encode(base, len);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595 }
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
597 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
598 msn_slplink_request_ft(MsnSlpLink *slplink, GaimXfer *xfer)
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 {
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
600 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
601 char *context;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602 const char *fn;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 fn = gaim_xfer_get_local_filename(xfer);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606 g_return_if_fail(slplink != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 g_return_if_fail(fn != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
609 slpcall = msn_slp_call_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
610 msn_slp_call_init(slpcall, MSN_SLPCALL_DC);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
611
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
612 slpcall->session_init_cb = send_file;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
613 slpcall->progress_cb = msn_xfer_progress_cb;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
614 slpcall->cb = msn_xfer_finish_cb;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
615 slpcall->xfer = xfer;
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 gaim_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel);
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 xfer->data = slpcall;
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 context = gen_context(fn);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
622
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
623 msn_slp_call_invite(slpcall, "5D3E02AB-6190-11D3-BBBB-00C04F795683", 2,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624 context);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 g_free(context);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
627 }
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 void
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630 msn_slplink_request_object(MsnSlpLink *slplink,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631 const char *info,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
632 MsnSlpCb cb,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633 const MsnObject *obj)
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 MsnSlpCall *slpcall;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
636 char *msnobj_data;
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
637 char *msnobj_base64;
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 g_return_if_fail(slplink != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
640 g_return_if_fail(obj != NULL);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
641
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642 msnobj_data = msn_object_to_string(obj);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643 msnobj_base64 = gaim_base64_encode(msnobj_data, strlen(msnobj_data));
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644 g_free(msnobj_data);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
645
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
646 slpcall = msn_slp_call_new(slplink);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
647 msn_slp_call_init(slpcall, MSN_SLPCALL_ANY);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
648
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
649 slpcall->data_info = g_strdup(info);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650 slpcall->cb = cb;
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 msn_slp_call_invite(slpcall, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6", 1,
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
653 msnobj_base64);
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 g_free(msnobj_base64);
502707ca1836 [gaim-migrate @ 9988]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
656 }