Mercurial > pidgin
annotate src/protocols/oscar/oscar.c @ 5580:86456ec3ca25
[gaim-migrate @ 5984]
More nifty stuff! Accounts now get converted, and other niceties.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 31 May 2003 02:27:03 +0000 |
parents | e0146fcc4718 |
children | 74a0e79ad627 |
rev | line source |
---|---|
2086 | 1 /* |
2 * gaim | |
3 * | |
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx> | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
24 #include <config.h> |
2086 | 25 #endif |
26 | |
3664 | 27 #include <sys/types.h> |
4617 | 28 /* this must happen before sys/socket.h or freebsd won't compile */ |
3664 | 29 |
3630 | 30 #ifndef _WIN32 |
2086 | 31 #include <netdb.h> |
32 #include <netinet/in.h> | |
33 #include <arpa/inet.h> | |
3630 | 34 #include <sys/socket.h> |
35 #include <unistd.h> | |
36 #endif | |
37 | |
38 #include <errno.h> | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
39 #include <ctype.h> |
2086 | 40 #include <string.h> |
41 #include <stdlib.h> | |
42 #include <stdio.h> | |
43 #include <time.h> | |
44 #include <sys/stat.h> | |
3630 | 45 #include <signal.h> |
46 | |
4608 | 47 #include "gaim.h" |
2086 | 48 #include "multi.h" |
49 #include "prpl.h" | |
4373
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4366
diff
changeset
|
50 #include "core.h" |
4889 | 51 #include "proxy.h" |
2086 | 52 #include "aim.h" |
53 | |
3630 | 54 #ifdef _WIN32 |
55 #include "win32dep.h" | |
56 #endif | |
57 | |
2086 | 58 /* constants to identify proto_opts */ |
59 #define USEROPT_AUTH 0 | |
60 #define USEROPT_AUTHPORT 1 | |
61 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
62 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
63 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
64 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
65 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
66 #define UC_AB 0x20 |
3079 | 67 #define UC_WIRELESS 0x40 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
68 |
2086 | 69 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
70 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
71 static GaimPlugin *my_protocol = NULL; |
4249 | 72 |
3630 | 73 /* For win32 compatability */ |
74 G_MODULE_IMPORT int report_idle; | |
75 | |
4811 | 76 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE; |
77 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE; | |
3458 | 78 |
4665 | 79 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
80 static fu8_t features_icq[] = {0x01, 0x06}; | |
2086 | 81 |
82 struct oscar_data { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
83 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
84 aim_conn_t *conn; |
2086 | 85 |
86 guint cnpa; | |
87 guint paspa; | |
3694 | 88 guint emlpa; |
4804 | 89 guint icopa; |
2086 | 90 |
4823 | 91 gboolean iconconnecting; |
92 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
93 GSList *create_rooms; |
2086 | 94 |
95 gboolean conf; | |
96 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
97 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
98 char *email; |
2979 | 99 gboolean setnick; |
100 char *newsn; | |
2086 | 101 gboolean chpass; |
102 char *oldp; | |
103 char *newp; | |
104 | |
105 GSList *oscar_chats; | |
106 GSList *direct_ims; | |
3630 | 107 GSList *file_transfers; |
4738 | 108 GHashTable *buddyinfo; |
4804 | 109 GSList *requesticon; |
2086 | 110 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
111 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
112 gboolean icq; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
113 GSList *evilhack; |
4804 | 114 guint icontimer; |
2993 | 115 |
116 struct { | |
4230 | 117 guint maxwatchers; /* max users who can watch you */ |
2993 | 118 guint maxbuddies; /* max users you can watch */ |
4230 | 119 guint maxgroups; /* max groups in server list */ |
2993 | 120 guint maxpermits; /* max users on permit list */ |
121 guint maxdenies; /* max users on deny list */ | |
122 guint maxsiglen; /* max size (bytes) of profile */ | |
123 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
124 } rights; | |
2086 | 125 }; |
126 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
127 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
128 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
129 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
130 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
131 |
2086 | 132 struct chat_connection { |
133 char *name; | |
134 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
135 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
136 fu16_t instance; |
2086 | 137 int fd; /* this is redundant since we have the conn below */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
138 aim_conn_t *conn; |
2086 | 139 int inpa; |
140 int id; | |
5575 | 141 GaimConnection *gc; /* i hate this. */ |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
142 struct gaim_conversation *cnv; /* bah. */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
143 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
144 int maxvis; |
2086 | 145 }; |
146 | |
147 struct direct_im { | |
5575 | 148 GaimConnection *gc; |
2086 | 149 char name[80]; |
150 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
151 aim_conn_t *conn; |
3008 | 152 gboolean connected; |
2086 | 153 }; |
154 | |
155 struct ask_direct { | |
5575 | 156 GaimConnection *gc; |
2086 | 157 char *sn; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
158 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
159 fu8_t cookie[8]; |
2086 | 160 }; |
161 | |
4738 | 162 /* Various PRPL-specific buddy info that we want to keep track of */ |
163 struct buddyinfo { | |
164 time_t signon; | |
165 int caps; | |
166 gboolean typingnot; | |
167 | |
168 unsigned long ico_len; | |
169 unsigned long ico_csum; | |
170 time_t ico_time; | |
171 gboolean ico_need; | |
172 | |
173 unsigned long ico_me_len; | |
174 unsigned long ico_me_csum; | |
175 time_t ico_me_time; | |
176 gboolean ico_informed; | |
4804 | 177 |
4853 | 178 fu16_t iconcsumlen; |
179 fu8_t iconcsum[30]; | |
2086 | 180 }; |
181 | |
4230 | 182 struct name_data { |
5575 | 183 GaimConnection *gc; |
4230 | 184 gchar *name; |
3453 | 185 gchar *nick; |
3141 | 186 }; |
187 | |
5129 | 188 static char *msgerrreason[] = { |
189 N_("Invalid error"), | |
190 N_("Invalid SNAC"), | |
191 N_("Rate to host"), | |
192 N_("Rate to client"), | |
193 N_("Not logged in"), | |
194 N_("Service unavailable"), | |
195 N_("Service not defined"), | |
196 N_("Obsolete SNAC"), | |
197 N_("Not supported by host"), | |
198 N_("Not supported by client"), | |
199 N_("Refused by client"), | |
200 N_("Reply too big"), | |
201 N_("Responses lost"), | |
202 N_("Request denied"), | |
203 N_("Busted SNAC payload"), | |
204 N_("Insufficient rights"), | |
205 N_("In local permit/deny"), | |
206 N_("Too evil (sender)"), | |
207 N_("Too evil (receiver)"), | |
208 N_("User temporarily unavailable"), | |
209 N_("No match"), | |
210 N_("List overflow"), | |
211 N_("Request ambiguous"), | |
212 N_("Queue full"), | |
213 N_("Not while on AOL") | |
214 }; | |
215 static int msgerrreasonlen = 25; | |
216 | |
217 /* All the libfaim->gaim callback functions */ | |
218 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); | |
219 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); | |
220 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); | |
221 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); | |
222 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); | |
223 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); | |
224 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); | |
225 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); | |
226 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); | |
227 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); | |
228 static int gaim_parse_user_info (aim_session_t *, aim_frame_t *, ...); | |
229 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); | |
230 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); | |
231 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...); | |
232 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...); | |
233 static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...); | |
234 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); | |
235 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); | |
236 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); | |
237 static int gaim_icon_parseicon (aim_session_t *, aim_frame_t *, ...); | |
238 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); | |
239 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); | |
240 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); | |
241 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); | |
242 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); | |
243 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); | |
244 static int gaim_connerr (aim_session_t *, aim_frame_t *, ...); | |
245 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); | |
246 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); | |
247 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); | |
248 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); | |
249 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); | |
250 static int conninitdone_icon (aim_session_t *, aim_frame_t *, ...); | |
251 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); | |
252 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); | |
253 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); | |
254 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); | |
255 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | |
256 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | |
257 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | |
258 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); | |
259 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); | |
260 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); | |
261 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); | |
262 static int gaim_icqalias (aim_session_t *, aim_frame_t *, ...); | |
263 static int gaim_icqinfo (aim_session_t *, aim_frame_t *, ...); | |
264 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); | |
265 #ifndef NOSSI | |
266 static int gaim_ssi_parseerr (aim_session_t *, aim_frame_t *, ...); | |
267 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); | |
268 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
269 static int gaim_ssi_parseack (aim_session_t *, aim_frame_t *, ...); | |
270 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); | |
271 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
272 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
273 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
274 #endif | |
275 | |
276 /* for DirectIM/image transfer */ | |
277 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
278 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
279 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
280 static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...); | |
281 | |
282 /* for file transfer */ | |
283 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
284 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
285 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
286 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
287 | |
288 /* for icons */ | |
289 static gboolean gaim_icon_timerfunc(gpointer data); | |
290 | |
5306 | 291 /* prpl actions - remove this at some point */ |
5575 | 292 static void oscar_set_info(GaimConnection *gc, char *text); |
5306 | 293 |
5149 | 294 int ill_just_write_my_own_damn_round_function(double val) { |
295 if ((val - (int)val) > 0.5) | |
296 return val+1; | |
297 else | |
298 return val; | |
299 } | |
300 | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
301 static void gaim_free_name_data(struct name_data *data) { |
4230 | 302 g_free(data->name); |
303 g_free(data->nick); | |
304 g_free(data); | |
305 } | |
306 | |
5129 | 307 static fu32_t oscar_encoding_check(const char *utf8) |
308 { | |
309 int i = 0; | |
310 fu32_t encodingflag = 0; | |
311 | |
312 /* Determine how we can send this message. Per the warnings elsewhere | |
313 * in this file, these little checks determine the simplest encoding | |
314 * we can use for a given message send using it. */ | |
315 while (utf8[i]) { | |
316 if ((unsigned char)utf8[i] > 0x7f) { | |
317 /* not ASCII! */ | |
318 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
319 break; | |
320 } | |
321 i++; | |
322 } | |
323 while (utf8[i]) { | |
324 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
325 * followed by 0xc0-0xc3 in the second */ | |
326 if ((unsigned char)utf8[i] < 0x80) { | |
327 i++; | |
328 continue; | |
329 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
330 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
331 i += 2; | |
332 continue; | |
333 } | |
334 encodingflag = AIM_IMFLAGS_UNICODE; | |
335 break; | |
336 } | |
337 | |
338 return encodingflag; | |
339 } | |
340 | |
341 static fu32_t oscar_encoding_parse(const char *enc) | |
342 { | |
343 char *charset; | |
344 | |
345 /* If anything goes wrong, fall back on ASCII and print a message */ | |
346 if (enc == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
347 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
348 "Encoding was null, that's odd\n"); |
5129 | 349 return 0; |
350 } | |
351 charset = strstr(enc, "charset="); | |
352 if (charset == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
353 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
354 "No charset specified for info, assuming ASCII\n"); |
5129 | 355 return 0; |
356 } | |
357 charset += 8; | |
358 if (!strcmp(charset, "\"us-ascii\"") || !strcmp(charset, "\"utf-8\"")) { | |
359 /* UTF-8 is our native charset, ASCII is a proper subset */ | |
360 return 0; | |
361 } else if (!strcmp(charset, "\"iso-8859-1\"")) { | |
362 return AIM_IMFLAGS_ISO_8859_1; | |
363 } else if (!strcmp(charset, "\"unicode-2-0\"")) { | |
364 return AIM_IMFLAGS_UNICODE; | |
365 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
366 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
367 "Unrecognized character set '%s', using ASCII\n", charset); |
5129 | 368 return 0; |
369 } | |
370 } | |
371 | |
372 gchar *oscar_encoding_to_utf8(const char *encoding, char *text, int textlen) | |
373 { | |
374 gchar *utf8 = NULL; | |
375 int flags = oscar_encoding_parse(encoding); | |
376 | |
377 switch (flags) { | |
378 case 0: | |
379 utf8 = g_strndup(text, textlen); | |
380 break; | |
381 case AIM_IMFLAGS_ISO_8859_1: | |
382 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
383 break; | |
384 case AIM_IMFLAGS_UNICODE: | |
385 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
386 break; | |
387 } | |
388 | |
389 return utf8; | |
390 } | |
391 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
392 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { |
2086 | 393 GSList *d = od->direct_ims; |
394 struct direct_im *m = NULL; | |
395 | |
396 while (d) { | |
397 m = (struct direct_im *)d->data; | |
4355 | 398 if (!aim_sncmp(who, m->name)) |
4269 | 399 return m; |
2086 | 400 d = d->next; |
401 } | |
402 | |
4269 | 403 return NULL; |
2086 | 404 } |
405 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
406 static char *extract_name(const char *name) { |
4121 | 407 char *tmp, *x; |
2086 | 408 int i, j; |
4120 | 409 |
410 if (!name) | |
4121 | 411 return NULL; |
412 | |
4120 | 413 x = strchr(name, '-'); |
4121 | 414 |
2086 | 415 if (!x) return NULL; |
416 x = strchr(++x, '-'); | |
417 if (!x) return NULL; | |
418 tmp = g_strdup(++x); | |
419 | |
420 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
421 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
422 if (x[i] != '%') { |
2086 | 423 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
424 continue; |
2086 | 425 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
426 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
427 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
428 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 429 } |
430 | |
431 tmp[j] = 0; | |
432 return tmp; | |
433 } | |
434 | |
5575 | 435 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
2086 | 436 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
437 struct chat_connection *c = NULL; | |
438 | |
439 while (g) { | |
440 c = (struct chat_connection *)g->data; | |
441 if (c->id == id) | |
442 break; | |
443 g = g->next; | |
444 c = NULL; | |
445 } | |
446 | |
447 return c; | |
448 } | |
449 | |
5575 | 450 static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
451 aim_conn_t *conn) { |
2086 | 452 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
453 struct chat_connection *c = NULL; | |
454 | |
455 while (g) { | |
456 c = (struct chat_connection *)g->data; | |
457 if (c->conn == conn) | |
458 break; | |
459 g = g->next; | |
460 c = NULL; | |
461 } | |
462 | |
463 return c; | |
464 } | |
465 | |
4617 | 466 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
5575 | 467 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
468 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
469 struct gaim_conversation *cnv; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
470 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
471 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
472 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
473 |
4617 | 474 sn = g_strdup(aim_odc_getsn(conn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
475 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
476 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
477 "%s disconnected Direct IM.\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
478 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
479 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
480 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
481 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
482 |
3008 | 483 if (dim->connected) |
484 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
485 else | |
486 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); | |
487 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
488 if ((cnv = gaim_find_conversation(sn))) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
489 gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
490 |
5579 | 491 gaim_conversation_update_progress(cnv, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
492 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
493 g_free(dim); /* I guess? I don't see it anywhere else... -- mid */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
494 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
495 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
496 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
497 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
498 |
4617 | 499 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
500 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
501 aim_session_t *sess = aim_conn_getsess(conn); |
5575 | 502 GaimConnection *gc = sess ? sess->aux_data : NULL; |
4617 | 503 struct oscar_data *od; |
2086 | 504 |
505 if (!gc) { | |
506 /* gc is null. we return, else we seg SIGSEG on next line. */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
507 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
508 "oscar callback for closed connection (1).\n"); |
2086 | 509 return; |
510 } | |
511 | |
4617 | 512 od = (struct oscar_data *)gc->proto_data; |
2086 | 513 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
514 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 515 /* oh boy. this is probably bad. i guess the only thing we |
516 * can really do is return? */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
517 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
518 "oscar callback for closed connection (2).\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
519 gaim_debug(GAIM_DEBUG_MISC, "oscar", "gc = %p\n", gc); |
2086 | 520 return; |
521 } | |
522 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
523 if (condition & GAIM_INPUT_READ) { |
4617 | 524 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
525 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
526 "got information on rendezvous listener\n"); |
4617 | 527 if (aim_handlerendconnect(od->sess, conn) < 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
528 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
529 "connection error (rendezvous listener)\n"); |
4617 | 530 aim_conn_kill(od->sess, &conn); |
2086 | 531 } |
532 } else { | |
4617 | 533 if (aim_get_command(od->sess, conn) >= 0) { |
534 aim_rxdispatch(od->sess); | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
535 if (od->killme) |
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
536 gaim_connection_destroy(gc); |
2086 | 537 } else { |
538 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 539 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
540 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
541 "major connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
542 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 543 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
544 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
5420 | 545 char *buf; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
546 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
547 "disconnected from chat room %s\n", c->name); |
2086 | 548 c->conn = NULL; |
549 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
550 gaim_input_remove(c->inpa); |
2086 | 551 c->inpa = 0; |
552 c->fd = -1; | |
4617 | 553 aim_conn_kill(od->sess, &conn); |
5420 | 554 buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
555 gaim_notify_error(gc, NULL, buf, NULL); |
5420 | 556 g_free(buf); |
2086 | 557 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 558 if (od->cnpa > 0) |
559 gaim_input_remove(od->cnpa); | |
560 od->cnpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
561 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
562 "removing chatnav input watcher\n"); |
4617 | 563 while (od->create_rooms) { |
564 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
565 g_free(cr->name); |
4617 | 566 od->create_rooms = |
567 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
568 g_free(cr); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
569 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
570 _("Chat is currently unavailable"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
571 NULL); |
2086 | 572 } |
4617 | 573 aim_conn_kill(od->sess, &conn); |
2086 | 574 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 575 if (od->paspa > 0) |
576 gaim_input_remove(od->paspa); | |
577 od->paspa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
578 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
579 "removing authconn input watcher\n"); |
4617 | 580 aim_conn_kill(od->sess, &conn); |
3694 | 581 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 582 if (od->emlpa > 0) |
583 gaim_input_remove(od->emlpa); | |
584 od->emlpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
585 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
586 "removing email input watcher\n"); |
4617 | 587 aim_conn_kill(od->sess, &conn); |
4804 | 588 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
589 if (od->icopa > 0) | |
590 gaim_input_remove(od->icopa); | |
591 od->icopa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
592 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
593 "removing icon input watcher\n"); |
4804 | 594 aim_conn_kill(od->sess, &conn); |
2086 | 595 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
596 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 597 gaim_odc_disconnect(od->sess, conn); |
598 aim_conn_kill(od->sess, &conn); | |
2086 | 599 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
600 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
601 "holy crap! generic connection error! %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
602 conn->type); |
4617 | 603 aim_conn_kill(od->sess, &conn); |
2086 | 604 } |
605 } | |
606 } | |
607 } | |
608 } | |
609 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
610 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
2086 | 611 char *s = g_strdup_vprintf(format, va); |
612 char buf[256]; | |
613 char *t; | |
5575 | 614 GaimConnection *gc = sess->aux_data; |
615 | |
616 g_snprintf(buf, sizeof(buf), "%s %d: ", gaim_account_get_username(gaim_connection_get_account(gc)), level); | |
2086 | 617 t = g_strconcat(buf, s, NULL); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
618 gaim_debug(GAIM_DEBUG_INFO, "oscar", t); |
2086 | 619 if (t[strlen(t)-1] != '\n') |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
620 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
2086 | 621 g_free(t); |
622 g_free(s); | |
623 } | |
624 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
625 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 626 { |
5575 | 627 GaimConnection *gc = data; |
4617 | 628 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
629 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
630 aim_conn_t *conn; |
2086 | 631 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
632 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 633 close(source); |
634 return; | |
635 } | |
636 | |
4617 | 637 od = gc->proto_data; |
638 sess = od->sess; | |
2086 | 639 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 640 |
641 conn->fd = source; | |
2086 | 642 |
643 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
644 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 645 return; |
646 } | |
647 | |
648 aim_conn_completeconnect(sess, conn); | |
4617 | 649 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
650 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
651 "Password sent, waiting for response\n"); |
2086 | 652 } |
653 | |
5575 | 654 static void oscar_login(GaimAccount *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
655 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
656 aim_conn_t *conn; |
2086 | 657 char buf[256]; |
5575 | 658 GaimConnection *gc = gaim_account_get_connection(account); |
4617 | 659 struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1); |
2086 | 660 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
661 gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
662 |
5575 | 663 if (isdigit(*(gaim_account_get_username(account)))) { |
4617 | 664 od->icq = TRUE; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
665 } else { |
2918
4df759d607f3
[gaim-migrate @ 2931]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2916
diff
changeset
|
666 gc->flags |= OPT_CONN_HTML; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
667 gc->flags |= OPT_CONN_AUTO_RESP; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
668 } |
4738 | 669 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
2086 | 670 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
671 sess = g_new0(aim_session_t, 1); |
2086 | 672 |
673 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); | |
674 aim_setdebuggingcb(sess, oscar_debug); | |
675 | |
676 /* we need an immediate queue because we don't use a while-loop to | |
677 * see if things need to be sent. */ | |
678 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); | |
4617 | 679 od->sess = sess; |
2086 | 680 sess->aux_data = gc; |
681 | |
682 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
683 if (conn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
684 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
685 "internal connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
686 gaim_connection_error(gc, _("Unable to login to AIM")); |
2086 | 687 return; |
688 } | |
689 | |
5575 | 690 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account)); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
691 gaim_connection_update_progress(gc, buf, 2, 5); |
2086 | 692 |
4649 | 693 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 694 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
695 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
696 | |
697 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5575 | 698 if (proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
699 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), | |
700 oscar_login_connect, gc) < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
701 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 702 return; |
703 } | |
5575 | 704 aim_request_login(sess, conn, gaim_account_get_username(account)); |
705 } | |
706 | |
707 static void oscar_close(GaimConnection *gc) { | |
4617 | 708 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
709 | |
710 while (od->oscar_chats) { | |
711 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 712 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
713 gaim_input_remove(n->inpa); |
2086 | 714 g_free(n->name); |
715 g_free(n->show); | |
4617 | 716 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 717 g_free(n); |
718 } | |
4617 | 719 while (od->direct_ims) { |
720 struct direct_im *n = od->direct_ims->data; | |
2086 | 721 if (n->watcher > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
722 gaim_input_remove(n->watcher); |
4617 | 723 od->direct_ims = g_slist_remove(od->direct_ims, n); |
2086 | 724 g_free(n); |
725 } | |
4617 | 726 /* BBB */ |
727 while (od->file_transfers) { | |
728 struct gaim_xfer *xfer; | |
729 xfer = (struct gaim_xfer *)od->file_transfers->data; | |
730 gaim_xfer_destroy(xfer); | |
3630 | 731 } |
4804 | 732 while (od->requesticon) { |
733 char *sn = od->requesticon->data; | |
734 od->requesticon = g_slist_remove(od->requesticon, sn); | |
735 free(sn); | |
736 } | |
4738 | 737 g_hash_table_destroy(od->buddyinfo); |
4617 | 738 while (od->evilhack) { |
739 g_free(od->evilhack->data); | |
740 od->evilhack = g_slist_remove(od->evilhack, od->evilhack->data); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
741 } |
4617 | 742 while (od->create_rooms) { |
743 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
744 g_free(cr->name); |
4617 | 745 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
746 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
747 } |
4617 | 748 if (od->email) |
749 g_free(od->email); | |
750 if (od->newp) | |
751 g_free(od->newp); | |
752 if (od->oldp) | |
753 g_free(od->oldp); | |
2086 | 754 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
755 gaim_input_remove(gc->inpa); |
4617 | 756 if (od->cnpa > 0) |
757 gaim_input_remove(od->cnpa); | |
758 if (od->paspa > 0) | |
759 gaim_input_remove(od->paspa); | |
760 if (od->emlpa > 0) | |
761 gaim_input_remove(od->emlpa); | |
4804 | 762 if (od->icopa > 0) |
763 gaim_input_remove(od->icopa); | |
4832 | 764 if (od->icopa > 0) |
765 gaim_input_remove(od->icopa); | |
766 if (od->icontimer) | |
767 g_source_remove(od->icontimer); | |
4617 | 768 aim_session_kill(od->sess); |
769 g_free(od->sess); | |
770 od->sess = NULL; | |
2086 | 771 g_free(gc->proto_data); |
772 gc->proto_data = NULL; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
773 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
2086 | 774 } |
775 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
776 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 777 GaimConnection *gc = data; |
4617 | 778 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
779 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
780 aim_conn_t *bosconn; |
2086 | 781 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
782 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 783 close(source); |
784 return; | |
785 } | |
786 | |
4617 | 787 od = gc->proto_data; |
788 sess = od->sess; | |
789 bosconn = od->conn; | |
4366 | 790 bosconn->fd = source; |
2086 | 791 |
792 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
793 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 794 return; |
795 } | |
796 | |
797 aim_conn_completeconnect(sess, bosconn); | |
4617 | 798 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
799 gaim_connection_update_progress(gc, |
5577
7ed9999926af
[gaim-migrate @ 5981]
Christian Hammond <chipx86@chipx86.com>
parents:
5576
diff
changeset
|
800 _("Connection established, cookie sent"), 4, 5); |
2086 | 801 } |
802 | |
4617 | 803 /* BBB */ |
4656 | 804 /* |
805 * This little area in oscar.c is the nexus of file transfer code, | |
806 * so I wrote a little explanation of what happens. I am such a | |
807 * ninja. | |
808 * | |
809 * The series of events for a file send is: | |
810 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
811 * -User chooses a file and oscar_xfer_init is called. It establishs a | |
812 * listening socket, then asks the remote user to connect to us (and | |
813 * gives them the file name, port, IP, etc.) | |
814 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
815 * in oscar_sendfile_estblsh) | |
816 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
817 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
818 * connection. | |
819 * -We get drunk because file transfer kicks ass. | |
820 * | |
821 * The series of events for a file receive is: | |
822 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
823 * -Gaim user selects file to name and location to save file to and | |
824 * oscar_xfer_init is called | |
825 * -It connects to the remote user using the IP they gave us earlier | |
826 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
827 * them an AIM_CB_OFT_ACK. | |
828 * -They begin to send us lots of raw data. | |
829 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
830 * the connectionn. | |
831 */ | |
832 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
833 | |
834 /* XXX - This function is pretty ugly */ | |
5146 | 835 static void oscar_xfer_init(struct gaim_xfer *xfer) |
4656 | 836 { |
5146 | 837 struct aim_oft_info *oft_info = xfer->data; |
5575 | 838 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 839 struct oscar_data *od = gc->proto_data; |
4656 | 840 |
841 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
842 int i; | |
843 | |
844 xfer->filename = g_path_get_basename(xfer->local_filename); | |
5146 | 845 strncpy(oft_info->fh.name, xfer->filename, 64); |
846 oft_info->fh.totsize = gaim_xfer_get_size(xfer); | |
847 oft_info->fh.size = gaim_xfer_get_size(xfer); | |
848 oft_info->fh.checksum = aim_oft_checksum_file(xfer->local_filename); | |
4656 | 849 |
850 /* | |
5146 | 851 * First try the port specified earlier (5190). If that fails, |
852 * increment by 1 and try again. | |
4656 | 853 */ |
5146 | 854 aim_sendfile_listen(od->sess, oft_info); |
855 for (i=0; (i<5 && !oft_info->conn); i++) { | |
856 xfer->local_port = oft_info->port = oft_info->port + 1; | |
857 aim_sendfile_listen(od->sess, oft_info); | |
4656 | 858 } |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
859 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
860 "port is %d, ip is %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
861 xfer->local_port, oft_info->clientip); |
5146 | 862 if (oft_info->conn) { |
863 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
864 aim_im_sendch2_sendfile_ask(od->sess, oft_info); | |
865 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
4656 | 866 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
867 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
868 _("Unable to establish listener socket.")); |
4656 | 869 /* XXX - The below line causes a crash because the transfer is canceled before the "Ok" callback on the file selection thing exists, I think */ |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
870 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 871 } |
872 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 873 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
874 if (oft_info->conn) { | |
875 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
876 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); | |
5575 | 877 oft_info->conn->fd = xfer->fd = proxy_connect(gaim_connection_get_account(gc), xfer->remote_ip, xfer->remote_port, |
878 oscar_sendfile_connected, xfer); | |
4656 | 879 if (xfer->fd == -1) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
880 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
881 _("Unable to establish file descriptor.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
882 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 883 } |
884 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
885 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
886 _("Unable to create new connection.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
887 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 888 /* Try a different port? Ask them to connect to us? */ |
889 } | |
890 | |
891 } | |
892 } | |
893 | |
5146 | 894 static void oscar_xfer_start(struct gaim_xfer *xfer) |
4656 | 895 { |
5146 | 896 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
897 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_start\n"); |
4656 | 898 /* I'm pretty sure we don't need to do jack here. Nor Jill. */ |
899 } | |
900 | |
5146 | 901 static void oscar_xfer_end(struct gaim_xfer *xfer) |
4656 | 902 { |
5146 | 903 struct aim_oft_info *oft_info = xfer->data; |
5575 | 904 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 905 struct oscar_data *od = gc->proto_data; |
4656 | 906 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
907 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
5146 | 908 |
909 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
910 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | |
911 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); | |
912 } | |
913 | |
914 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
915 aim_oft_destroyinfo(oft_info); | |
4656 | 916 xfer->data = NULL; |
5146 | 917 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 918 } |
919 | |
5146 | 920 static void oscar_xfer_cancel_send(struct gaim_xfer *xfer) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
921 { |
5146 | 922 struct aim_oft_info *oft_info = xfer->data; |
5575 | 923 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 924 struct oscar_data *od = gc->proto_data; |
4763 | 925 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
926 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
927 "AAA - in oscar_xfer_cancel_send\n"); |
5146 | 928 |
929 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
930 | |
931 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
932 aim_oft_destroyinfo(oft_info); | |
4763 | 933 xfer->data = NULL; |
5146 | 934 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
935 } |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
936 |
5146 | 937 static void oscar_xfer_cancel_recv(struct gaim_xfer *xfer) |
4656 | 938 { |
5146 | 939 struct aim_oft_info *oft_info = xfer->data; |
5575 | 940 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 941 struct oscar_data *od = gc->proto_data; |
4656 | 942 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
943 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
944 "AAA - in oscar_xfer_cancel_recv\n"); |
5146 | 945 |
946 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
947 | |
948 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
949 aim_oft_destroyinfo(oft_info); | |
4656 | 950 xfer->data = NULL; |
5146 | 951 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 952 } |
953 | |
5146 | 954 static void oscar_xfer_ack(struct gaim_xfer *xfer, const char *buffer, size_t size) |
4656 | 955 { |
5146 | 956 struct aim_oft_info *oft_info = xfer->data; |
4656 | 957 |
958 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
959 /* | |
960 * If we're done sending, intercept the socket from the core ft code | |
961 * and wait for the other guy to send the "done" OFT packet. | |
962 */ | |
963 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
964 gaim_input_remove(xfer->watcher); | |
5146 | 965 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
4656 | 966 xfer->fd = 0; |
967 gaim_xfer_set_completed(xfer, TRUE); | |
968 } | |
969 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 970 /* Update our rolling checksum. Like Walmart, yo. */ |
971 oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); | |
4656 | 972 } |
973 } | |
974 | |
5146 | 975 static struct gaim_xfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) |
4656 | 976 { |
977 struct gaim_xfer *xfer; | |
5146 | 978 struct aim_oft_info *oft_info; |
4656 | 979 |
980 while (fts) { | |
981 xfer = fts->data; | |
5146 | 982 oft_info = xfer->data; |
983 | |
984 if (oft_info && !strcmp(ck, oft_info->cookie)) | |
4656 | 985 return xfer; |
986 | |
987 fts = g_slist_next(fts); | |
988 } | |
989 | |
990 return NULL; | |
991 } | |
992 | |
5146 | 993 static struct gaim_xfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
4656 | 994 { |
995 struct gaim_xfer *xfer; | |
5146 | 996 struct aim_oft_info *oft_info; |
4656 | 997 |
998 while (fts) { | |
999 xfer = fts->data; | |
5146 | 1000 oft_info = xfer->data; |
1001 | |
1002 if (oft_info && (conn == oft_info->conn)) | |
4656 | 1003 return xfer; |
1004 | |
1005 fts = g_slist_next(fts); | |
1006 } | |
1007 | |
1008 return NULL; | |
1009 } | |
1010 | |
5575 | 1011 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
3630 | 1012 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5146 | 1013 struct gaim_xfer *xfer; |
1014 struct aim_oft_info *oft_info; | |
1015 aim_conn_t *conn; | |
3752 | 1016 |
4617 | 1017 /* You want to send a file to someone else, you're so generous */ |
1018 | |
1019 /* Build the file transfer handle */ | |
5575 | 1020 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
5146 | 1021 if ((conn = aim_conn_findbygroup(od->sess, 0x0004))) |
1022 xfer->local_ip = gaim_getip_from_fd(conn->fd); | |
4617 | 1023 xfer->local_port = 5190; |
1024 | |
5146 | 1025 /* Create the oscar-specific data */ |
1026 oft_info = aim_oft_createinfo(od->sess, NULL, destsn, xfer->local_ip, xfer->local_port, 0, 0, NULL); | |
1027 xfer->data = oft_info; | |
1028 | |
4617 | 1029 /* Setup our I/O op functions */ |
1030 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
1031 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
1032 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1033 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1034 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4656 | 1035 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
4617 | 1036 |
1037 /* Keep track of this transfer for later */ | |
1038 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1039 | |
1040 /* Now perform the request */ | |
1041 gaim_xfer_request(xfer); | |
3630 | 1042 } |
1043 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1044 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1045 va_list ap; |
2704 | 1046 struct aim_authresp_info *info; |
4452 | 1047 int i, rc; |
1048 char *host; int port; | |
5575 | 1049 GaimAccount *account; |
2704 | 1050 aim_conn_t *bosconn; |
2086 | 1051 |
5575 | 1052 GaimConnection *gc = sess->aux_data; |
2086 | 1053 struct oscar_data *od = gc->proto_data; |
4491 | 1054 account = gc->account; |
5575 | 1055 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1056 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1057 va_start(ap, fr); |
2704 | 1058 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 1059 va_end(ap); |
1060 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1061 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1062 "inside auth_resp (Screen name: %s)\n", info->sn); |
2704 | 1063 |
4293 | 1064 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
4056 | 1065 char buf[256]; |
2704 | 1066 switch (info->errorcode) { |
2086 | 1067 case 0x05: |
1068 /* Incorrect nick/password */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1069 gaim_connection_error(gc, _("Incorrect nickname or password.")); |
2086 | 1070 break; |
1071 case 0x11: | |
1072 /* Suspended account */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1073 gaim_connection_error(gc, _("Your account is currently suspended.")); |
2086 | 1074 break; |
3498 | 1075 case 0x14: |
1076 /* service temporarily unavailable */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1077 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); |
3498 | 1078 break; |
2086 | 1079 case 0x18: |
1080 /* connecting too frequently */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1081 gaim_connection_error(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); |
2086 | 1082 break; |
1083 case 0x1c: | |
1084 /* client too old */ | |
4056 | 1085 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), WEBSITE); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1086 gaim_connection_error(gc, buf); |
2086 | 1087 break; |
1088 default: | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1089 gaim_connection_error(gc, _("Authentication Failed")); |
2086 | 1090 break; |
1091 } | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1092 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1093 "Login Error Code 0x%04hx\n", info->errorcode); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1094 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1095 "Error URL: %s\n", info->errorurl); |
2086 | 1096 od->killme = TRUE; |
1097 return 1; | |
1098 } | |
1099 | |
1100 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1101 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1102 "Reg status: %hu\n", info->regstatus); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1103 |
2704 | 1104 if (info->email) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1105 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email: %s\n", info->email); |
2086 | 1106 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1107 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email is NULL\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1108 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1109 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1110 gaim_debug(GAIM_DEBUG_MISC, "oscar", "BOSIP: %s\n", info->bosip); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1111 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1112 "Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1113 aim_conn_kill(sess, &fr->conn); |
2086 | 1114 |
1115 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
1116 if (bosconn == NULL) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1117 gaim_connection_error(gc, _("Internal Error")); |
2086 | 1118 od->killme = TRUE; |
1119 return 0; | |
1120 } | |
1121 | |
4649 | 1122 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1123 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 1124 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
1125 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
1126 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 1127 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 1128 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
1129 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
1130 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
1131 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
1132 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
1133 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 1134 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 1135 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
1136 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
1137 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
1138 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
1139 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 1140 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
2086 | 1141 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0); |
1142 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); | |
1143 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1144 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 1145 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
1146 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
1147 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
1148 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1149 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
1150 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
1151 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1152 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4759 | 1153 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
4624 | 1154 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
4230 | 1155 #ifndef NOSSI |
4642 | 1156 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
2991 | 1157 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
1158 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
1159 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
4230 | 1160 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
1161 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); | |
1162 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | |
1163 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | |
1164 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | |
1165 #endif | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1166 |
2086 | 1167 ((struct oscar_data *)gc->proto_data)->conn = bosconn; |
2704 | 1168 for (i = 0; i < (int)strlen(info->bosip); i++) { |
1169 if (info->bosip[i] == ':') { | |
1170 port = atoi(&(info->bosip[i+1])); | |
2086 | 1171 break; |
1172 } | |
1173 } | |
2704 | 1174 host = g_strndup(info->bosip, i); |
2086 | 1175 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
4634 | 1176 rc = proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
2086 | 1177 g_free(host); |
4366 | 1178 if (rc < 0) { |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1179 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 1180 od->killme = TRUE; |
1181 return 0; | |
1182 } | |
4293 | 1183 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1184 gaim_input_remove(gc->inpa); |
2704 | 1185 |
2086 | 1186 return 1; |
1187 } | |
1188 | |
1189 struct pieceofcrap { | |
5575 | 1190 GaimConnection *gc; |
2086 | 1191 unsigned long offset; |
1192 unsigned long len; | |
1193 char *modname; | |
1194 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1195 aim_conn_t *conn; |
2086 | 1196 unsigned int inpa; |
1197 }; | |
1198 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1199 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 1200 { |
1201 struct pieceofcrap *pos = data; | |
1202 struct oscar_data *od = pos->gc->proto_data; | |
1203 char in = '\0'; | |
1204 int x = 0; | |
1205 unsigned char m[17]; | |
1206 | |
1207 while (read(pos->fd, &in, 1) == 1) { | |
1208 if (in == '\n') | |
1209 x++; | |
1210 else if (in != '\r') | |
1211 x = 0; | |
1212 if (x == 2) | |
1213 break; | |
1214 in = '\0'; | |
1215 } | |
1216 if (in != '\n') { | |
4056 | 1217 char buf[256]; |
1218 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " | |
1219 "this is fixed. Check %s for updates."), WEBSITE); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1220 gaim_notify_warning(pos->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1221 _("Gaim was Unable to get a valid AIM login hash."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1222 buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1223 gaim_input_remove(pos->inpa); |
2086 | 1224 close(pos->fd); |
1225 g_free(pos); | |
1226 return; | |
1227 } | |
1228 read(pos->fd, m, 16); | |
1229 m[16] = '\0'; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1230 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Sending hash: "); |
2086 | 1231 for (x = 0; x < 16; x++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1232 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx ", (unsigned char)m[x]); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1233 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1234 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1235 gaim_input_remove(pos->inpa); |
2086 | 1236 close(pos->fd); |
1237 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
1238 g_free(pos); | |
1239 } | |
1240 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1241 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1242 struct pieceofcrap *pos = data; |
5420 | 1243 gchar *buf; |
2086 | 1244 |
4366 | 1245 pos->fd = source; |
1246 | |
2086 | 1247 if (source < 0) { |
5420 | 1248 buf = g_strdup_printf(_("You may be disconnected shortly. You may want to use TOC until " |
4056 | 1249 "this is fixed. Check %s for updates."), WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1250 gaim_notify_warning(pos->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1251 _("Gaim was Unable to get a valid AIM login hash."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1252 buf); |
5420 | 1253 g_free(buf); |
2086 | 1254 if (pos->modname) |
1255 g_free(pos->modname); | |
1256 g_free(pos); | |
1257 return; | |
1258 } | |
1259 | |
5420 | 1260 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", |
2086 | 1261 pos->offset, pos->len, pos->modname ? pos->modname : ""); |
1262 write(pos->fd, buf, strlen(buf)); | |
5420 | 1263 g_free(buf); |
2086 | 1264 if (pos->modname) |
1265 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1266 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 1267 return; |
1268 } | |
1269 | |
1270 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
1271 #define AIM_MAX_FILE_SIZE 98304 | |
1272 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1273 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1274 va_list ap; |
1275 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1276 fu32_t offset, len; |
2086 | 1277 char *modname; |
1278 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1279 va_start(ap, fr); |
4200 | 1280 offset = va_arg(ap, fu32_t); |
1281 len = va_arg(ap, fu32_t); | |
2086 | 1282 modname = va_arg(ap, char *); |
1283 va_end(ap); | |
1284 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1285 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 1286 "offset: %u, len: %u, file: %s\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1287 offset, len, (modname ? modname : "aim.exe")); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1288 |
2086 | 1289 if (len == 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1290 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len is 0, hashing NULL\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1291 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 1292 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1293 return 1; | |
1294 } | |
1295 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
1296 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
1297 char *buf; | |
1298 int i = 8; | |
1299 if (modname) | |
1300 i += strlen(modname); | |
1301 buf = g_malloc(i); | |
1302 i = 0; | |
1303 if (modname) { | |
1304 memcpy(buf, modname, strlen(modname)); | |
1305 i += strlen(modname); | |
1306 } | |
1307 buf[i++] = offset & 0xff; | |
1308 buf[i++] = (offset >> 8) & 0xff; | |
1309 buf[i++] = (offset >> 16) & 0xff; | |
1310 buf[i++] = (offset >> 24) & 0xff; | |
1311 buf[i++] = len & 0xff; | |
1312 buf[i++] = (len >> 8) & 0xff; | |
1313 buf[i++] = (len >> 16) & 0xff; | |
1314 buf[i++] = (len >> 24) & 0xff; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1315 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len + offset is invalid, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1316 "hashing request\n"); |
2086 | 1317 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1318 g_free(buf); | |
1319 return 1; | |
1320 } | |
1321 */ | |
1322 | |
1323 pos = g_new0(struct pieceofcrap, 1); | |
1324 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1325 pos->conn = fr->conn; |
2086 | 1326 |
1327 pos->offset = offset; | |
1328 pos->len = len; | |
1329 pos->modname = modname ? g_strdup(modname) : NULL; | |
1330 | |
4634 | 1331 if (proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
4056 | 1332 char buf[256]; |
2086 | 1333 if (pos->modname) |
1334 g_free(pos->modname); | |
1335 g_free(pos); | |
4056 | 1336 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " |
1337 "this is fixed. Check %s for updates."), WEBSITE); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1338 gaim_notify_warning(pos->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1339 _("Gaim was Unable to get a valid login hash."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1340 buf); |
2086 | 1341 } |
1342 | |
1343 return 1; | |
1344 } | |
1345 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1346 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1347 char *key; |
1348 va_list ap; | |
5575 | 1349 GaimConnection *gc = sess->aux_data; |
1350 GaimAccount *ac = gaim_connection_get_account(gc); | |
1351 char pass[9]; | |
4617 | 1352 struct oscar_data *od = gc->proto_data; |
2086 | 1353 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1354 va_start(ap, fr); |
2086 | 1355 key = va_arg(ap, char *); |
1356 va_end(ap); | |
1357 | |
5575 | 1358 /* Truncate the password at 8 characters */ |
1359 g_snprintf(pass, sizeof(pass), gaim_account_get_password(ac)); | |
1360 | |
4617 | 1361 if (od->icq) { |
3458 | 1362 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
5575 | 1363 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), pass, &info, key); |
3458 | 1364 } else { |
1365 #if 0 | |
1366 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; | |
1367 #endif | |
1368 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
5575 | 1369 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), pass, &info, key); |
3458 | 1370 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1371 |
2086 | 1372 return 1; |
1373 } | |
1374 | |
2675 | 1375 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1376 GaimConnection *gc = sess->aux_data; |
2647 | 1377 struct chat_connection *chatcon; |
1378 static int id = 1; | |
1379 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1380 aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0); |
2675 | 1381 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
1382 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0); | |
1383 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); | |
1384 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0); | |
1385 | |
2672 | 1386 aim_clientready(sess, fr->conn); |
2675 | 1387 |
2647 | 1388 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
1389 chatcon->id = id; | |
1390 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
1391 | |
1392 return 1; | |
1393 } | |
1394 | |
2675 | 1395 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
1396 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1397 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 1398 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 1399 |
1400 aim_clientready(sess, fr->conn); | |
1401 | |
1402 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1403 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1404 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1405 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1406 |
3694 | 1407 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
1408 | |
1409 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1410 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
1411 | |
1412 aim_email_sendcookies(sess, fr->conn); | |
1413 aim_email_activate(sess, fr->conn); | |
1414 aim_clientready(sess, fr->conn); | |
1415 | |
1416 return 1; | |
1417 } | |
1418 | |
4804 | 1419 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1420 GaimConnection *gc = sess->aux_data; |
4804 | 1421 struct oscar_data *od = gc->proto_data; |
1422 | |
1423 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1424 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | |
1425 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | |
1426 | |
1427 aim_clientready(sess, fr->conn); | |
1428 | |
4823 | 1429 od->iconconnecting = FALSE; |
1430 | |
4804 | 1431 if (od->icontimer) |
1432 g_source_remove(od->icontimer); | |
1433 od->icontimer = g_timeout_add(100, gaim_icon_timerfunc, gc); | |
1434 | |
1435 return 1; | |
1436 } | |
1437 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1438 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1439 GaimConnection *gc = data; |
4617 | 1440 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1441 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1442 aim_conn_t *tstconn; |
2086 | 1443 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1444 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1445 close(source); |
1446 return; | |
1447 } | |
1448 | |
4617 | 1449 od = gc->proto_data; |
1450 sess = od->sess; | |
2086 | 1451 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
4366 | 1452 tstconn->fd = source; |
2086 | 1453 |
1454 if (source < 0) { | |
1455 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1456 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1457 "unable to connect to chatnav server\n"); |
2086 | 1458 return; |
1459 } | |
1460 | |
1461 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1462 od->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1463 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
2086 | 1464 } |
1465 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1466 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1467 { |
5575 | 1468 GaimConnection *gc = data; |
4617 | 1469 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1470 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1471 aim_conn_t *tstconn; |
2086 | 1472 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1473 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1474 close(source); |
1475 return; | |
1476 } | |
1477 | |
4617 | 1478 od = gc->proto_data; |
1479 sess = od->sess; | |
2086 | 1480 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 1481 tstconn->fd = source; |
2086 | 1482 |
1483 if (source < 0) { | |
1484 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1485 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1486 "unable to connect to authorizer\n"); |
2086 | 1487 return; |
1488 } | |
1489 | |
1490 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1491 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1492 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
2086 | 1493 } |
1494 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1495 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1496 { |
1497 struct chat_connection *ccon = data; | |
5575 | 1498 GaimConnection *gc = ccon->gc; |
4617 | 1499 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1500 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1501 aim_conn_t *tstconn; |
2086 | 1502 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1503 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1504 close(source); |
1505 g_free(ccon->show); | |
1506 g_free(ccon->name); | |
1507 g_free(ccon); | |
1508 return; | |
1509 } | |
1510 | |
4617 | 1511 od = gc->proto_data; |
1512 sess = od->sess; | |
2086 | 1513 tstconn = ccon->conn; |
4366 | 1514 tstconn->fd = source; |
2086 | 1515 |
1516 if (source < 0) { | |
1517 aim_conn_kill(sess, &tstconn); | |
1518 g_free(ccon->show); | |
1519 g_free(ccon->name); | |
1520 g_free(ccon); | |
1521 return; | |
1522 } | |
1523 | |
1524 aim_conn_completeconnect(sess, ccon->conn); | |
4617 | 1525 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
1526 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | |
2086 | 1527 } |
1528 | |
3694 | 1529 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1530 GaimConnection *gc = data; |
4617 | 1531 struct oscar_data *od; |
3694 | 1532 aim_session_t *sess; |
1533 aim_conn_t *tstconn; | |
1534 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1535 if (!g_list_find(gaim_connections_get_all(), gc)) { |
3694 | 1536 close(source); |
1537 return; | |
1538 } | |
1539 | |
4617 | 1540 od = gc->proto_data; |
1541 sess = od->sess; | |
3694 | 1542 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
4366 | 1543 tstconn->fd = source; |
3694 | 1544 |
1545 if (source < 0) { | |
1546 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1547 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1548 "unable to connect to email server\n"); |
3694 | 1549 return; |
1550 } | |
1551 | |
1552 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1553 od->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1554 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1555 "email: connected\n"); |
3694 | 1556 } |
1557 | |
4804 | 1558 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1559 GaimConnection *gc = data; |
4804 | 1560 struct oscar_data *od; |
1561 aim_session_t *sess; | |
1562 aim_conn_t *tstconn; | |
1563 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1564 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4804 | 1565 close(source); |
1566 return; | |
1567 } | |
1568 | |
1569 od = gc->proto_data; | |
1570 sess = od->sess; | |
1571 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); | |
1572 tstconn->fd = source; | |
1573 | |
1574 if (source < 0) { | |
1575 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1576 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1577 "unable to connect to icon server\n"); |
4804 | 1578 return; |
1579 } | |
1580 | |
1581 aim_conn_completeconnect(sess, tstconn); | |
1582 od->icopa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1583 gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); |
4804 | 1584 } |
1585 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1586 /* Hrmph. I don't know how to make this look better. --mid */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1587 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1588 GaimConnection *gc = sess->aux_data; |
1589 GaimAccount *account = gaim_connection_get_account(gc); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1590 aim_conn_t *tstconn; |
4452 | 1591 int i; |
2086 | 1592 char *host; |
1593 int port; | |
4821 | 1594 va_list ap; |
1595 struct aim_redirect_data *redir; | |
2086 | 1596 |
5575 | 1597 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1598 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1599 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1600 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1601 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1602 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1603 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1604 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1605 port = atoi(&(redir->ip[i+1])); |
2086 | 1606 break; |
1607 } | |
1608 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1609 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1610 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1611 switch(redir->group) { |
2086 | 1612 case 0x7: /* Authorizer */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1613 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1614 "Reconnecting with authorizor...\n"); |
2086 | 1615 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
1616 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1617 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1618 "unable to reconnect with authorizer\n"); |
2086 | 1619 g_free(host); |
1620 return 1; | |
1621 } | |
4649 | 1622 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1623 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1624 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0); |
1625 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0); | |
1626 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0); | |
1627 | |
1628 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
4634 | 1629 if (proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
2086 | 1630 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1631 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1632 "unable to reconnect with authorizer\n"); |
2086 | 1633 g_free(host); |
1634 return 1; | |
1635 } | |
4293 | 1636 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1637 break; |
1638 | |
2086 | 1639 case 0xd: /* ChatNav */ |
1640 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1641 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1642 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1643 "unable to connect to chatnav server\n"); |
2086 | 1644 g_free(host); |
1645 return 1; | |
1646 } | |
4649 | 1647 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1648 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1649 |
1650 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
4634 | 1651 if (proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
2086 | 1652 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1653 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1654 "unable to connect to chatnav server\n"); |
2086 | 1655 g_free(host); |
1656 return 1; | |
1657 } | |
4293 | 1658 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1659 break; |
1660 | |
1661 case 0xe: { /* Chat */ | |
2086 | 1662 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1663 |
2086 | 1664 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1665 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1666 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1667 "unable to connect to chat server\n"); |
2086 | 1668 g_free(host); |
1669 return 1; | |
1670 } | |
1671 | |
4649 | 1672 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1673 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1674 | |
2086 | 1675 ccon = g_new0(struct chat_connection, 1); |
1676 ccon->conn = tstconn; | |
1677 ccon->gc = gc; | |
1678 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1679 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1680 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1681 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1682 ccon->show = extract_name(redir->chat.room); |
4634 | 1683 |
2086 | 1684 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
4634 | 1685 if (proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
2086 | 1686 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1687 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1688 "unable to connect to chat server\n"); |
2086 | 1689 g_free(host); |
1690 g_free(ccon->show); | |
1691 g_free(ccon->name); | |
1692 g_free(ccon); | |
1693 return 1; | |
1694 } | |
4293 | 1695 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1696 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1697 "Connected to chat room %s exchange %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1698 ccon->name, ccon->exchange); |
4194 | 1699 } break; |
3694 | 1700 |
4804 | 1701 case 0x0010: { /* icon */ |
1702 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1703 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1704 "unable to connect to icon server\n"); |
4804 | 1705 g_free(host); |
1706 return 1; | |
1707 } | |
1708 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); | |
1709 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); | |
1710 | |
1711 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1712 if (proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { | |
1713 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1714 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1715 "unable to connect to icon server\n"); |
4804 | 1716 g_free(host); |
1717 return 1; | |
1718 } | |
1719 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); | |
1720 } break; | |
1721 | |
3694 | 1722 case 0x0018: { /* email */ |
1723 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1724 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1725 "unable to connect to email server\n"); |
3694 | 1726 g_free(host); |
1727 return 1; | |
1728 } | |
4649 | 1729 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
3694 | 1730 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
1731 | |
1732 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
4634 | 1733 if (proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
3694 | 1734 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1735 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1736 "unable to connect to email server\n"); |
3694 | 1737 g_free(host); |
1738 return 1; | |
1739 } | |
4293 | 1740 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
3694 | 1741 } break; |
1742 | |
2086 | 1743 default: /* huh? */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1744 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1745 "got redirect for unknown service 0x%04hx\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1746 redir->group); |
2086 | 1747 break; |
1748 } | |
1749 | |
1750 g_free(host); | |
1751 return 1; | |
1752 } | |
1753 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1754 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1755 GaimConnection *gc = sess->aux_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1756 struct oscar_data *od = gc->proto_data; |
4738 | 1757 struct buddyinfo *bi; |
2993 | 1758 time_t time_idle = 0, signon = 0; |
1759 int type = 0; | |
1760 int caps = 0; | |
2086 | 1761 va_list ap; |
4738 | 1762 aim_userinfo_t *info; |
4194 | 1763 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1764 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1765 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1766 va_end(ap); |
1767 | |
2993 | 1768 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
1769 caps = info->capabilities; | |
3267 | 1770 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
1771 type |= UC_AB; | |
1772 | |
4766 | 1773 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
1774 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
1775 type |= UC_UNCONFIRMED; | |
1776 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
1777 type |= UC_ADMIN; | |
1778 if (info->flags & AIM_FLAG_AOL) | |
1779 type |= UC_AOL; | |
1780 if (info->flags & AIM_FLAG_FREE) | |
1781 type |= UC_NORMAL; | |
1782 if (info->flags & AIM_FLAG_AWAY) | |
1783 type |= UC_UNAVAILABLE; | |
1784 if (info->flags & AIM_FLAG_WIRELESS) | |
1785 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1786 } |
2993 | 1787 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 1788 type = (info->icqinfo.status << 16); |
3013 | 1789 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
1790 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 1791 type |= UC_UNAVAILABLE; |
3013 | 1792 } |
2993 | 1793 } |
1794 | |
1795 if (caps & AIM_CAPS_ICQ) | |
1796 caps ^= AIM_CAPS_ICQ; | |
1797 | |
1798 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 1799 time(&time_idle); |
1800 time_idle -= info->idletime*60; | |
2993 | 1801 } |
1802 | |
1803 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
1804 signon = time(NULL) - info->sessionlen; | |
2086 | 1805 |
5575 | 1806 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
1807 gaim_connection_set_display_name(gc, info->sn); | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1808 |
4738 | 1809 bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn)); |
1810 if (!bi) { | |
1811 bi = g_new0(struct buddyinfo, 1); | |
1812 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi); | |
1813 } | |
1814 bi->signon = info->onlinesince ? info->onlinesince : (info->sessionlen + time(NULL)); | |
4829 | 1815 if (caps) |
1816 bi->caps = caps; | |
4739 | 1817 bi->typingnot = FALSE; |
1818 bi->ico_informed = FALSE; | |
4732 | 1819 |
4804 | 1820 /* Server stored icon stuff */ |
4853 | 1821 if (info->iconcsumlen) { |
1822 char *b16, *saved_b16; | |
1823 struct buddy *b; | |
1824 | |
1825 memcpy(bi->iconcsum, info->iconcsum, info->iconcsumlen); | |
1826 bi->iconcsumlen = info->iconcsumlen; | |
1827 b16 = tobase16(bi->iconcsum, bi->iconcsumlen); | |
1828 b = gaim_find_buddy(gc->account, info->sn); | |
1829 saved_b16 = gaim_buddy_get_setting(b, "icon_checksum"); | |
1830 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { | |
1831 GSList *cur = od->requesticon; | |
1832 while (cur && aim_sncmp((char *)cur->data, info->sn)) | |
1833 cur = cur->next; | |
1834 if (!cur) { | |
1835 od->requesticon = g_slist_append(od->requesticon, strdup(normalize(info->sn))); | |
1836 if (od->icontimer) | |
1837 g_source_remove(od->icontimer); | |
1838 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
1839 } | |
1840 } | |
1841 free(saved_b16); | |
1842 free(b16); | |
1843 } | |
1844 | |
5149 | 1845 serv_got_update(gc, info->sn, 1, ill_just_write_my_own_damn_round_function(info->warnlevel/10.0), signon, time_idle, type); |
2086 | 1846 |
1847 return 1; | |
1848 } | |
1849 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1850 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1851 GaimConnection *gc = sess->aux_data; |
2086 | 1852 va_list ap; |
4739 | 1853 aim_userinfo_t *info; |
2086 | 1854 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1855 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1856 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1857 va_end(ap); |
1858 | |
4732 | 1859 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
2086 | 1860 |
1861 return 1; | |
1862 } | |
1863 | |
3730 | 1864 static void cancel_direct_im(struct ask_direct *d) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1865 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Freeing DirectIM prompts.\n"); |
2086 | 1866 |
1867 g_free(d->sn); | |
1868 g_free(d); | |
1869 } | |
1870 | |
4617 | 1871 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1872 struct direct_im *dim = data; |
5575 | 1873 GaimConnection *gc = dim->gc; |
2086 | 1874 struct oscar_data *od = gc->proto_data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
1875 struct gaim_conversation *cnv; |
2086 | 1876 char buf[256]; |
3008 | 1877 struct sockaddr name; |
1878 socklen_t name_len = 1; | |
1879 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1880 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1881 g_free(dim); |
1882 return; | |
1883 } | |
1884 | |
1885 if (source < 0) { | |
1886 g_free(dim); | |
1887 return; | |
1888 } | |
1889 | |
4366 | 1890 dim->conn->fd = source; |
2086 | 1891 aim_conn_completeconnect(od->sess, dim->conn); |
4491 | 1892 if (!(cnv = gaim_find_conversation(dim->name))) |
1893 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); | |
3008 | 1894 |
1895 /* This is the best way to see if we're connected or not */ | |
1896 if (getpeername(source, &name, &name_len) == 0) { | |
1897 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
1898 dim->connected = TRUE; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
1899 gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); |
3008 | 1900 } |
2086 | 1901 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 1902 |
4617 | 1903 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
2086 | 1904 } |
1905 | |
4617 | 1906 /* BBB */ |
3952 | 1907 /* |
4617 | 1908 * This is called after a remote AIM user has connected to us. We |
1909 * want to do some voodoo with the socket file descriptors, add a | |
1910 * callback or two, and then send the AIM_CB_OFT_PROMPT. | |
3952 | 1911 */ |
4656 | 1912 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1913 GaimConnection *gc = sess->aux_data; |
3630 | 1914 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4617 | 1915 struct gaim_xfer *xfer; |
5146 | 1916 struct aim_oft_info *oft_info; |
3630 | 1917 va_list ap; |
1918 aim_conn_t *conn, *listenerconn; | |
4656 | 1919 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1920 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1921 "AAA - in oscar_sendfile_estblsh\n"); |
3630 | 1922 va_start(ap, fr); |
1923 conn = va_arg(ap, aim_conn_t *); | |
1924 listenerconn = va_arg(ap, aim_conn_t *); | |
1925 va_end(ap); | |
1926 | |
4617 | 1927 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
1928 return 1; | |
1929 | |
5146 | 1930 if (!(oft_info = xfer->data)) |
4617 | 1931 return 1; |
1932 | |
3630 | 1933 /* Stop watching listener conn; watch transfer conn instead */ |
4617 | 1934 gaim_input_remove(xfer->watcher); |
3630 | 1935 aim_conn_kill(sess, &listenerconn); |
1936 | |
5146 | 1937 oft_info->conn = conn; |
1938 xfer->fd = oft_info->conn->fd; | |
1939 | |
1940 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); | |
1941 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); | |
1942 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 1943 |
1944 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 1945 aim_oft_sendheader(sess, AIM_CB_OFT_PROMPT, oft_info); |
3630 | 1946 |
1947 return 0; | |
1948 } | |
1949 | |
3952 | 1950 /* |
4617 | 1951 * This is the gaim callback passed to proxy_connect when connecting to another AIM |
1952 * user in order to transfer a file. | |
3952 | 1953 */ |
4617 | 1954 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition) { |
1955 struct gaim_xfer *xfer; | |
5146 | 1956 struct aim_oft_info *oft_info; |
4656 | 1957 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1958 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1959 "AAA - in oscar_sendfile_connected\n"); |
4617 | 1960 if (!(xfer = data)) |
1961 return; | |
5146 | 1962 if (!(oft_info = xfer->data)) |
3630 | 1963 return; |
4617 | 1964 if (source < 0) |
1965 return; | |
1966 | |
1967 xfer->fd = source; | |
5146 | 1968 oft_info->conn->fd = source; |
1969 | |
1970 aim_conn_completeconnect(oft_info->sess, oft_info->conn); | |
1971 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 1972 |
1973 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 1974 aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); |
4617 | 1975 |
1976 return; | |
3630 | 1977 } |
1978 | |
3952 | 1979 /* |
4617 | 1980 * This is called when a buddy sends us some file info. This happens when they |
1981 * are sending a file to you, and you have just established a connection to them. | |
4650 | 1982 * You should send them the exact same info except use the real cookie. We also |
4617 | 1983 * get like totally ready to like, receive the file, kay? |
3952 | 1984 */ |
4617 | 1985 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1986 GaimConnection *gc = sess->aux_data; |
4617 | 1987 struct oscar_data *od = gc->proto_data; |
1988 struct gaim_xfer *xfer; | |
5146 | 1989 struct aim_oft_info *oft_info; |
4617 | 1990 va_list ap; |
1991 aim_conn_t *conn; | |
1992 fu8_t *cookie; | |
1993 struct aim_fileheader_t *fh; | |
4656 | 1994 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1995 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1996 "AAA - in oscar_sendfile_prompt\n"); |
4617 | 1997 va_start(ap, fr); |
1998 conn = va_arg(ap, aim_conn_t *); | |
1999 cookie = va_arg(ap, fu8_t *); | |
2000 fh = va_arg(ap, struct aim_fileheader_t *); | |
2001 va_end(ap); | |
2002 | |
2003 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2004 return 1; | |
2005 | |
5146 | 2006 if (!(oft_info = xfer->data)) |
4617 | 2007 return 1; |
2008 | |
2009 /* We want to stop listening with a normal thingy */ | |
2010 gaim_input_remove(xfer->watcher); | |
2011 xfer->watcher = 0; | |
2012 | |
5146 | 2013 /* They sent us some information about the file they're sending */ |
2014 memcpy(&oft_info->fh, fh, sizeof(*fh)); | |
2015 | |
2016 /* Fill in the cookie */ | |
2017 memcpy(&oft_info->fh.bcookie, oft_info->cookie, 8); | |
2018 | |
4617 | 2019 /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ |
5146 | 2020 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); |
4617 | 2021 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2022 | |
2023 return 0; | |
3630 | 2024 } |
2025 | |
3952 | 2026 /* |
4657 | 2027 * We are sending a file to someone else. They have just acknowledged our |
4617 | 2028 * prompt, so we want to start sending data like there's no tomorrow. |
3952 | 2029 */ |
4617 | 2030 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2031 GaimConnection *gc = sess->aux_data; |
4617 | 2032 struct oscar_data *od = gc->proto_data; |
2033 struct gaim_xfer *xfer; | |
2034 va_list ap; | |
2035 aim_conn_t *conn; | |
2036 fu8_t *cookie; | |
2037 struct aim_fileheader_t *fh; | |
4656 | 2038 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2039 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_ack\n"); |
4617 | 2040 va_start(ap, fr); |
2041 conn = va_arg(ap, aim_conn_t *); | |
2042 cookie = va_arg(ap, fu8_t *); | |
2043 fh = va_arg(ap, struct aim_fileheader_t *); | |
2044 va_end(ap); | |
2045 | |
2046 if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
2047 return 1; | |
2048 | |
4656 | 2049 /* We want to stop listening with a normal thingy */ |
2050 gaim_input_remove(xfer->watcher); | |
2051 xfer->watcher = 0; | |
2052 | |
4617 | 2053 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2054 | |
2055 return 0; | |
3630 | 2056 } |
4617 | 2057 |
2058 /* | |
2059 * We just sent a file to someone. They said they got it and everything, | |
2060 * so we can close our direct connection and what not. | |
2061 */ | |
2062 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 2063 GaimConnection *gc = sess->aux_data; |
4617 | 2064 struct oscar_data *od = gc->proto_data; |
2065 struct gaim_xfer *xfer; | |
2066 va_list ap; | |
2067 aim_conn_t *conn; | |
2068 fu8_t *cookie; | |
2069 struct aim_fileheader_t *fh; | |
4656 | 2070 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2071 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_done\n"); |
4617 | 2072 va_start(ap, fr); |
2073 conn = va_arg(ap, aim_conn_t *); | |
2074 cookie = va_arg(ap, fu8_t *); | |
2075 fh = va_arg(ap, struct aim_fileheader_t *); | |
2076 va_end(ap); | |
2077 | |
2078 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2079 return 1; | |
2080 | |
4656 | 2081 xfer->fd = conn->fd; |
4617 | 2082 gaim_xfer_end(xfer); |
2083 | |
2084 return 0; | |
2085 } | |
3630 | 2086 |
4244 | 2087 static void accept_direct_im(struct ask_direct *d) { |
5575 | 2088 GaimConnection *gc = d->gc; |
4244 | 2089 struct oscar_data *od; |
2086 | 2090 struct direct_im *dim; |
2945 | 2091 char *host; int port = 4443; |
4366 | 2092 int i, rc; |
2086 | 2093 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2094 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2095 cancel_direct_im(d); |
2096 return; | |
2097 } | |
2098 | |
2099 od = (struct oscar_data *)gc->proto_data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2100 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); |
2086 | 2101 |
2102 dim = find_direct_im(od, d->sn); | |
2103 if (dim) { | |
3730 | 2104 cancel_direct_im(d); /* 40 */ |
4244 | 2105 return; |
2086 | 2106 } |
2107 dim = g_new0(struct direct_im, 1); | |
2108 dim->gc = d->gc; | |
2109 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
2110 | |
4617 | 2111 dim->conn = aim_odc_connect(od->sess, d->sn, NULL, d->cookie); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2112 if (!dim->conn) { |
2086 | 2113 g_free(dim); |
3730 | 2114 cancel_direct_im(d); |
4244 | 2115 return; |
2086 | 2116 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2117 |
2086 | 2118 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
4617 | 2119 gaim_odc_incoming, 0); |
2086 | 2120 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, |
4617 | 2121 gaim_odc_typing, 0); |
3033 | 2122 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
2993 | 2123 gaim_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2124 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2125 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2126 port = atoi(&(d->ip[i+1])); |
2086 | 2127 break; |
2128 } | |
2129 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2130 host = g_strndup(d->ip, i); |
2086 | 2131 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
4634 | 2132 rc = proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
2086 | 2133 g_free(host); |
4366 | 2134 if (rc < 0) { |
2086 | 2135 aim_conn_kill(od->sess, &dim->conn); |
2136 g_free(dim); | |
3730 | 2137 cancel_direct_im(d); |
4244 | 2138 return; |
2086 | 2139 } |
2140 | |
3730 | 2141 cancel_direct_im(d); |
2086 | 2142 |
4244 | 2143 return; |
2086 | 2144 } |
2145 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2146 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
5575 | 2147 GaimConnection *gc = sess->aux_data; |
3600 | 2148 struct oscar_data *od = gc->proto_data; |
4738 | 2149 char *tmp; |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2150 int flags = 0; |
3659 | 2151 int convlen; |
2152 GError *err = NULL; | |
4738 | 2153 struct buddyinfo *bi; |
5575 | 2154 const char *iconfile; |
4738 | 2155 |
2156 bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn)); | |
2157 if (!bi) { | |
2158 bi = g_new0(struct buddyinfo, 1); | |
2159 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(userinfo->sn)), bi); | |
2160 } | |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2161 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2162 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2163 flags |= IM_FLAG_AWAY; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2164 |
4738 | 2165 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
2166 bi->typingnot = TRUE; | |
2167 else | |
2168 bi->typingnot = FALSE; | |
2169 | |
4380 | 2170 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2171 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2172 "%s has an icon\n", userinfo->sn); |
4738 | 2173 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
2174 bi->ico_need = TRUE; | |
2175 bi->ico_len = args->iconlen; | |
2176 bi->ico_csum = args->iconsum; | |
2177 bi->ico_time = args->iconstamp; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2178 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2179 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2180 |
5575 | 2181 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && |
2182 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2183 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2184 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2185 |
5575 | 2186 if (!stat(iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2187 char *buf = g_malloc(st.st_size); |
5575 | 2188 file = fopen(iconfile, "rb"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2189 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
2190 int len = fread(buf, 1, st.st_size, file); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2191 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2192 "Sending buddy icon to %s (%d bytes, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2193 "%lu reported)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2194 userinfo->sn, len, st.st_size); |
4617 | 2195 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, |
2196 st.st_mtime, aimutil_iconsum(buf, st.st_size)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2197 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2198 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2199 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2200 "Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2201 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2202 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2203 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2204 "Can't stat buddy icon file!\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2205 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2206 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2207 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2208 "Character set is %hu %hu\n", args->charset, args->charsubset); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2209 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 2210 /* This message is marked as UNICODE, so we have to |
2211 * convert it to utf-8 before handing it to the gaim core. | |
2212 * This conversion should *never* fail, if it does it | |
2213 * means that either the incoming ICBM is corrupted or | |
4662 | 2214 * there is something we don't understand about it. |
2215 * For the record, AIM Unicode is big-endian UCS-2 */ | |
2216 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2217 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Received UNICODE IM\n"); |
4121 | 2218 |
2219 if (!args->msg || !args->msglen) | |
2220 return 1; | |
4641 | 2221 |
3659 | 2222 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2223 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2224 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2225 "Unicode IM conversion: %s\n", err->message); |
3659 | 2226 tmp = strdup(_("(There was an error receiving this message)")); |
4800 | 2227 g_error_free(err); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2228 } |
3722 | 2229 } else { |
3850 | 2230 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 2231 * unflagged messages, which are ASCII. That's OK because |
2232 * ASCII is a strict subset of ISO-8859-1; this should | |
2233 * help with compatibility with old, broken versions of | |
2234 * gaim (everything before 0.60) and other broken clients | |
2235 * that will happily send ISO-8859-1 without marking it as | |
2236 * such */ | |
4662 | 2237 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2238 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2239 "Received ISO-8859-1 IM\n"); |
4121 | 2240 |
2241 if (!args->msg || !args->msglen) | |
2242 return 1; | |
2243 | |
3659 | 2244 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2245 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2246 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2247 "ISO-8859-1 IM conversion: %s\n", err->message); |
3659 | 2248 tmp = strdup(_("(There was an error receiving this message)")); |
4800 | 2249 g_error_free(err); |
3659 | 2250 } |
3642 | 2251 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2252 |
4333 | 2253 /* strip_linefeed(tmp); */ |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2833
diff
changeset
|
2254 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2255 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2256 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2257 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2258 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2259 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2260 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
5575 | 2261 GaimConnection *gc = sess->aux_data; |
4617 | 2262 struct oscar_data *od = gc->proto_data; |
5575 | 2263 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2264 |
4121 | 2265 if (!args) |
2266 return 0; | |
4194 | 2267 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2268 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2269 "rendezvous with %s, status is %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2270 userinfo->sn, args->status); |
2869 | 2271 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2272 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 2273 char *name; |
5234 | 2274 GHashTable *components; |
2275 | |
4121 | 2276 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
2277 return 1; | |
5234 | 2278 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
2279 g_free); | |
4121 | 2280 name = extract_name(args->info.chat.roominfo.name); |
5234 | 2281 g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name)); |
2282 g_hash_table_replace(components, g_strdup("exchange"), g_strdup_printf("%d", args->info.chat.roominfo.exchange)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2283 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2284 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2285 userinfo->sn, |
2869 | 2286 (char *)args->msg, |
5234 | 2287 components); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2288 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2289 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2290 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
4617 | 2291 /* BBB */ |
2292 if (args->status == AIM_RENDEZVOUS_PROPOSE) { | |
2293 /* Someone wants to send a file (or files) to us */ | |
2294 struct gaim_xfer *xfer; | |
5146 | 2295 struct aim_oft_info *oft_info; |
2296 | |
2297 if (!args->cookie || !args->port || !args->verifiedip || | |
2298 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
4656 | 2299 !args->info.sendfile.totfiles || !args->reqclass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2300 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2301 "%s tried to send you a file with incomplete " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2302 "information.\n", userinfo->sn); |
5146 | 2303 if (args->proxyip) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2304 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2305 "IP for a proxy server was given. Gaim " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2306 "does not support this yet.\n"); |
4617 | 2307 return 1; |
4656 | 2308 } |
4617 | 2309 |
2310 if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { | |
2311 /* last char of the ft req is a star, they are sending us a | |
2312 * directory -- remove the star and trailing slash so we dont save | |
2313 * directories that look like 'dirname\*' -- arl */ | |
2314 char *tmp = strrchr(args->info.sendfile.filename, '\\'); | |
2315 if (tmp && (tmp[1] == '*')) { | |
2316 tmp[0] = '\0'; | |
2317 } | |
2318 } | |
2319 | |
2320 /* Build the file transfer handle */ | |
2321 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); | |
5163 | 2322 xfer->remote_ip = g_strdup(args->verifiedip); |
5146 | 2323 xfer->remote_port = args->port; |
4617 | 2324 gaim_xfer_set_filename(xfer, args->info.sendfile.filename); |
2325 gaim_xfer_set_size(xfer, args->info.sendfile.totsize); | |
5146 | 2326 |
2327 /* Create the oscar-specific data */ | |
5163 | 2328 oft_info = aim_oft_createinfo(od->sess, args->cookie, userinfo->sn, args->clientip, xfer->remote_port, 0, 0, NULL); |
4898 | 2329 if (args->proxyip) |
5146 | 2330 oft_info->proxyip = g_strdup(args->proxyip); |
4898 | 2331 if (args->verifiedip) |
5146 | 2332 oft_info->verifiedip = g_strdup(args->verifiedip); |
2333 xfer->data = oft_info; | |
4617 | 2334 |
2335 /* Setup our I/O op functions */ | |
2336 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
2337 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
2338 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2339 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2340 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4617 | 2341 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
2342 | |
2343 /* | |
2344 * XXX - Should do something with args->msg, args->encoding, and args->language | |
2345 * probably make it apply to all ch2 messages. | |
3752 | 2346 */ |
4617 | 2347 |
2348 /* Keep track of this transfer for later */ | |
2349 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
2350 | |
2351 /* Now perform the request */ | |
2352 gaim_xfer_request(xfer); | |
2353 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { | |
2354 /* The other user wants to cancel a file transfer */ | |
2355 struct gaim_xfer *xfer; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2356 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2357 "AAA - File transfer canceled by remote user\n"); |
4617 | 2358 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, args->cookie))) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2359 gaim_xfer_cancel_remote(xfer); |
4617 | 2360 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
2361 /* | |
2362 * This gets sent by the receiver of a file | |
2363 * as they connect directly to us. If we don't | |
2364 * get this, then maybe a third party connected | |
2365 * to us, and we shouldn't send them anything. | |
2366 */ | |
2367 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2368 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2369 "unknown rendezvous status!\n"); |
3630 | 2370 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2371 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2372 } else if (args->reqclass & AIM_CAPS_VOICE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2373 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
4799 | 2374 set_icon_data(gc, userinfo->sn, args->info.icon.icon, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2375 args->info.icon.length); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2376 } else if (args->reqclass & AIM_CAPS_IMIMAGE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2377 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2378 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2379 |
4212 | 2380 if (!args->verifiedip) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2381 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2382 "directim kill blocked (%s)\n", userinfo->sn); |
4650 | 2383 return 1; |
4212 | 2384 } |
2385 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2386 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2387 "%s received direct im request from %s (%s)\n", |
5575 | 2388 username, userinfo->sn, args->verifiedip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2389 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2390 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2391 d->sn = g_strdup(userinfo->sn); |
2869 | 2392 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2393 memcpy(d->cookie, args->cookie, 8); |
5575 | 2394 g_snprintf(buf, sizeof buf, _("%s has just asked to directly connect to %s"), userinfo->sn, username); |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2395 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2396 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2397 _("This requires a direct connection between " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2398 "the two computers and is necessary for IM " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2399 "Images. Because your IP address will be " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2400 "revealed, this may be considered a privacy " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2401 "risk."), 0, d, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2402 _("Connect"), G_CALLBACK(accept_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2403 _("Cancel"), G_CALLBACK(cancel_direct_im)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2404 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2405 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2406 "Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2407 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2408 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2409 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2410 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2411 |
3453 | 2412 /* |
4230 | 2413 * Authorization Functions |
2414 * Most of these are callbacks from dialogs. They're used by both | |
2415 * methods of authorization (SSI and old-school channel 4 ICBM) | |
3453 | 2416 */ |
4269 | 2417 /* When you ask other people for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2418 static void gaim_auth_request(struct name_data *data, char *msg) { |
5575 | 2419 GaimConnection *gc = data->gc; |
4244 | 2420 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2421 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2422 struct oscar_data *od = gc->proto_data; |
4687 | 2423 struct buddy *buddy = gaim_find_buddy(gc->account, data->name); |
2424 struct group *group = gaim_find_buddys_group(buddy); | |
4244 | 2425 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2426 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2427 "ssi: adding buddy %s to group %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2428 buddy->name, group->name); |
4889 | 2429 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
4269 | 2430 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
4889 | 2431 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
4244 | 2432 } |
4230 | 2433 } |
4337 | 2434 } |
2435 | |
2436 static void gaim_auth_request_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2437 gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2438 NULL, _("Please authorize me!"), TRUE, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2439 _("OK"), G_CALLBACK(gaim_auth_request), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2440 _("Cancel"), G_CALLBACK(gaim_free_name_data), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2441 data); |
4230 | 2442 } |
2443 | |
2444 static void gaim_auth_dontrequest(struct name_data *data) { | |
5575 | 2445 GaimConnection *gc = data->gc; |
4244 | 2446 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2447 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2448 /* struct oscar_data *od = gc->proto_data; */ |
2449 /* XXX - Take the buddy out of our buddy list */ | |
2450 } | |
2451 | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2452 gaim_free_name_data(data); |
4230 | 2453 } |
2454 | |
5575 | 2455 static void gaim_auth_sendrequest(GaimConnection *gc, const char *name) { |
4269 | 2456 struct name_data *data = g_new(struct name_data, 1); |
2457 struct buddy *buddy; | |
2458 gchar *dialog_msg, *nombre; | |
2459 | |
4687 | 2460 buddy = gaim_find_buddy(gc->account, name); |
2461 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
2462 nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); | |
4269 | 2463 else |
4830 | 2464 nombre = NULL; |
2465 | |
2466 dialog_msg = g_strdup_printf(_("The user %s requires authorization before being added to a buddy list. Do you want to send an authorization request?"), (nombre ? nombre : name)); | |
4269 | 2467 data->gc = gc; |
2468 data->name = g_strdup(name); | |
2469 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2470 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2471 gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2472 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2473 _("Request Authorization"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2474 G_CALLBACK(gaim_auth_request_msgprompt), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2475 _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); |
4269 | 2476 |
2477 g_free(dialog_msg); | |
2478 g_free(nombre); | |
2479 } | |
2480 | |
4230 | 2481 /* When other people ask you for authorization */ |
2482 static void gaim_auth_grant(struct name_data *data) { | |
5575 | 2483 GaimConnection *gc = data->gc; |
4244 | 2484 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2485 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2486 struct oscar_data *od = gc->proto_data; |
4236 | 2487 #ifdef NOSSI |
4244 | 2488 struct buddy *buddy; |
2489 gchar message; | |
2490 message = 0; | |
4687 | 2491 buddy = gaim_find_buddy(gc->account, data->name); |
4617 | 2492 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message); |
4687 | 2493 show_got_added(gc, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 2494 #else |
4889 | 2495 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
4230 | 2496 #endif |
4244 | 2497 } |
2498 | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2499 gaim_free_name_data(data); |
3141 | 2500 } |
2501 | |
4230 | 2502 /* When other people ask you for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2503 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
5575 | 2504 GaimConnection *gc = data->gc; |
4244 | 2505 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2506 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2507 struct oscar_data *od = gc->proto_data; |
4230 | 2508 #ifdef NOSSI |
4617 | 2509 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
4230 | 2510 #else |
4889 | 2511 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
4230 | 2512 #endif |
4244 | 2513 } |
4337 | 2514 } |
2515 | |
2516 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2517 gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2518 NULL, _("No reason given."), TRUE, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2519 _("OK"), G_CALLBACK(gaim_auth_dontgrant), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2520 _("Cancel"), G_CALLBACK(gaim_free_name_data), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2521 data); |
3141 | 2522 } |
2523 | |
4230 | 2524 /* When someone sends you contacts */ |
2525 static void gaim_icq_contactadd(struct name_data *data) { | |
5575 | 2526 GaimConnection *gc = data->gc; |
4244 | 2527 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2528 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2529 show_add_buddy(gc, data->name, NULL, data->nick); |
2530 } | |
2531 | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2532 gaim_free_name_data(data); |
3453 | 2533 } |
2534 | |
4075 | 2535 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) { |
5575 | 2536 GaimConnection *gc = sess->aux_data; |
4076 | 2537 gchar **msg1, **msg2; |
2538 GError *err = NULL; | |
2539 int i; | |
2540 | |
4121 | 2541 if (!args->type || !args->msg || !args->uin) |
2542 return 1; | |
4194 | 2543 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2544 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2545 "Received a channel 4 message of type 0x%02hhx.\n", args->type); |
4076 | 2546 |
2547 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 2548 msg1 = g_strsplit(args->msg, "\376", 0); |
4194 | 2549 msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */ |
4076 | 2550 for (i=0; msg1[i]; i++) { |
2551 strip_linefeed(msg1[i]); | |
2552 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); | |
4800 | 2553 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2554 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2555 "Error converting a string from ISO-8859-1 to " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2556 "UTF-8 in oscar ICBM channel 4 parsing\n"); |
4800 | 2557 g_error_free(err); |
2558 } | |
4076 | 2559 } |
2560 msg2[i] = NULL; | |
2561 | |
3952 | 2562 switch (args->type) { |
4173 | 2563 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 2564 if (i >= 1) { |
5556 | 2565 gchar *uin = g_strdup_printf("%u", args->uin); |
4076 | 2566 if (t) { /* This is an offline message */ |
2567 /* I think this timestamp is in UTC, or something */ | |
2568 serv_got_im(gc, uin, msg2[0], 0, t, -1); | |
2569 } else { /* This is a message from MacICQ/Miranda */ | |
2570 serv_got_im(gc, uin, msg2[0], 0, time(NULL), -1); | |
2571 } | |
2572 g_free(uin); | |
4075 | 2573 } |
3316 | 2574 } break; |
2575 | |
4173 | 2576 case 0x04: { /* Someone sent you a URL */ |
4076 | 2577 if (i >= 2) { |
5556 | 2578 gchar *uin = g_strdup_printf("%u", args->uin); |
4076 | 2579 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", msg2[1], msg2[0]); |
3453 | 2580 serv_got_im(gc, uin, message, 0, time(NULL), -1); |
2581 g_free(uin); | |
2582 g_free(message); | |
2583 } | |
2584 } break; | |
2585 | |
4173 | 2586 case 0x06: { /* Someone requested authorization */ |
4076 | 2587 if (i >= 6) { |
4230 | 2588 struct name_data *data = g_new(struct name_data, 1); |
5556 | 2589 gchar *dialog_msg = g_strdup_printf(_("The user %u wants to add you to their buddy list for the following reason:\n%s"), args->uin, msg2[5] ? msg2[5] : _("No reason given.")); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2590 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5556 | 2591 "Received an authorization request from UIN %u\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2592 args->uin); |
4076 | 2593 data->gc = gc; |
5556 | 2594 data->name = g_strdup_printf("%u", args->uin); |
4230 | 2595 data->nick = NULL; |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2596 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2597 gaim_request_action(gc, NULL, _("Authorization Request"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2598 dialog_msg, 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2599 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2600 G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2601 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2602 G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4076 | 2603 g_free(dialog_msg); |
2604 } | |
3141 | 2605 } break; |
2606 | |
4173 | 2607 case 0x07: { /* Someone has denied you authorization */ |
4076 | 2608 if (i >= 1) { |
5556 | 2609 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2610 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2611 dialog_msg); |
4076 | 2612 g_free(dialog_msg); |
2613 } | |
3141 | 2614 } break; |
2615 | |
4173 | 2616 case 0x08: { /* Someone has granted you authorization */ |
5556 | 2617 gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your contact list."), args->uin); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2618 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2619 dialog_msg); |
3141 | 2620 g_free(dialog_msg); |
2621 } break; | |
2622 | |
4333 | 2623 case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
2624 if (i >= 5) { | |
2625 gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2626 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); |
4333 | 2627 g_free(dialog_msg); |
2628 } | |
2629 } break; | |
2630 | |
4173 | 2631 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 2632 if (i >= 6) { |
4194 | 2633 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2634 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); |
4076 | 2635 g_free(dialog_msg); |
2636 } | |
4075 | 2637 } break; |
2638 | |
4173 | 2639 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 2640 if (i >= 6) { |
4308 | 2641 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ email from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2642 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg); |
4076 | 2643 g_free(dialog_msg); |
2644 } | |
4075 | 2645 } break; |
2646 | |
4173 | 2647 case 0x12: { |
3141 | 2648 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
4173 | 2649 /* Someone added you to their contact list? */ |
3141 | 2650 } break; |
2651 | |
4173 | 2652 case 0x13: { /* Someone has sent you some ICQ contacts */ |
3453 | 2653 int i, num; |
2654 gchar **text; | |
4173 | 2655 text = g_strsplit(args->msg, "\376", 0); |
3453 | 2656 if (text) { |
2657 num = 0; | |
2658 for (i=0; i<strlen(text[0]); i++) | |
2659 num = num*10 + text[0][i]-48; | |
2660 for (i=0; i<num; i++) { | |
4230 | 2661 struct name_data *data = g_new(struct name_data, 1); |
5556 | 2662 gchar *message = g_strdup_printf(_("ICQ user %u has sent you a contact: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); |
3453 | 2663 data->gc = gc; |
4790 | 2664 data->name = g_strdup(text[i*2+1]); |
2665 data->nick = g_strdup(text[i*2+2]); | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2666 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2667 gaim_request_action(gc, NULL, message, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2668 _("Do you want to add this contact " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2669 "to your Buddy List?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2670 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2671 _("Add"), G_CALLBACK(gaim_icq_contactadd), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2672 _("Decline"), G_CALLBACK(gaim_free_name_data)); |
3453 | 2673 g_free(message); |
2674 } | |
2675 g_strfreev(text); | |
2676 } | |
2677 } break; | |
2678 | |
4173 | 2679 case 0x1a: { /* Someone has sent you a greeting card or requested contacts? */ |
3453 | 2680 /* This is boring and silly. */ |
2681 } break; | |
2682 | |
3141 | 2683 default: { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2684 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2685 "Received a channel 4 message of unknown type " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2686 "(type 0x%02hhx).\n", args->type); |
3141 | 2687 } break; |
2688 } | |
2689 | |
4076 | 2690 g_strfreev(msg1); |
2691 g_strfreev(msg2); | |
2692 | |
3141 | 2693 return 1; |
2694 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2695 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2696 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 2697 fu16_t channel; |
2698 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2699 aim_userinfo_t *userinfo; |
2086 | 2700 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2701 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2702 va_start(ap, fr); |
4200 | 2703 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2704 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 2705 |
3141 | 2706 switch (channel) { |
2707 case 1: { /* standard message */ | |
2708 struct aim_incomingim_ch1_args *args; | |
2709 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
2710 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
2711 } break; | |
2712 | |
2713 case 2: { /* rendevous */ | |
2714 struct aim_incomingim_ch2_args *args; | |
2715 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
2716 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
2717 } break; | |
2718 | |
2719 case 4: { /* ICQ */ | |
2720 struct aim_incomingim_ch4_args *args; | |
2721 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 2722 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 2723 } break; |
2724 | |
2725 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2726 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2727 "ICBM received on unsupported channel (channel " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2728 "0x%04hx).", channel); |
3141 | 2729 } break; |
2086 | 2730 } |
2731 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2732 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2733 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2734 return ret; |
2086 | 2735 } |
2736 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2737 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
5420 | 2738 char *buf; |
2086 | 2739 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2740 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2741 aim_userinfo_t *userinfo; |
2086 | 2742 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2743 va_start(ap, fr); |
4200 | 2744 chan = (fu16_t)va_arg(ap, unsigned int); |
2745 userinfo = va_arg(ap, aim_userinfo_t *); | |
2746 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
2747 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 2748 va_end(ap); |
2749 | |
2750 switch(reason) { | |
5420 | 2751 case 0: /* Invalid (0) */ |
2752 buf = g_strdup_printf( | |
2753 ngettext( | |
4276 | 2754 "You missed %hu message from %s because it was invalid.", |
2755 "You missed %hu messages from %s because they were invalid.", | |
2756 nummissed), | |
4282 | 2757 nummissed, |
2758 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2759 break; |
5420 | 2760 case 1: /* Message too large */ |
2761 buf = g_strdup_printf( | |
2762 ngettext( | |
4276 | 2763 "You missed %hu message from %s because it was too large.", |
2764 "You missed %hu messages from %s because they were too large.", | |
2765 nummissed), | |
4282 | 2766 nummissed, |
2767 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2768 break; |
5420 | 2769 case 2: /* Rate exceeded */ |
2770 buf = g_strdup_printf( | |
2771 ngettext( | |
4276 | 2772 "You missed %hu message from %s because the rate limit has been exceeded.", |
2773 "You missed %hu messages from %s because the rate limit has been exceeded.", | |
2774 nummissed), | |
4282 | 2775 nummissed, |
2776 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2777 break; |
5420 | 2778 case 3: /* Evil Sender */ |
2779 buf = g_strdup_printf( | |
2780 ngettext( | |
4276 | 2781 "You missed %hu message from %s because he/she was too evil.", |
2782 "You missed %hu messages from %s because he/she was too evil.", | |
2783 nummissed), | |
4282 | 2784 nummissed, |
2785 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2786 break; |
5420 | 2787 case 4: /* Evil Receiver */ |
2788 buf = g_strdup_printf( | |
2789 ngettext( | |
4276 | 2790 "You missed %hu message from %s because you are too evil.", |
2791 "You missed %hu messages from %s because you are too evil.", | |
2792 nummissed), | |
4282 | 2793 nummissed, |
2794 userinfo->sn); | |
2086 | 2795 break; |
2796 default: | |
5420 | 2797 buf = g_strdup_printf( |
2798 ngettext( | |
4276 | 2799 "You missed %hu message from %s for an unknown reason.", |
2800 "You missed %hu messages from %s for an unknown reason.", | |
2801 nummissed), | |
4282 | 2802 nummissed, |
2803 userinfo->sn); | |
2086 | 2804 break; |
2805 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2806 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 2807 g_free(buf); |
2086 | 2808 |
2809 return 1; | |
2810 } | |
2811 | |
3212 | 2812 static char *gaim_icq_status(int state) { |
2813 /* Make a cute little string that shows the status of the dude or dudet */ | |
2814 if (state & AIM_ICQ_STATE_CHAT) | |
4342 | 2815 return g_strdup_printf(_("Free For Chat")); |
3212 | 2816 else if (state & AIM_ICQ_STATE_DND) |
4342 | 2817 return g_strdup_printf(_("Do Not Disturb")); |
3212 | 2818 else if (state & AIM_ICQ_STATE_OUT) |
4342 | 2819 return g_strdup_printf(_("Not Available")); |
3212 | 2820 else if (state & AIM_ICQ_STATE_BUSY) |
4342 | 2821 return g_strdup_printf(_("Occupied")); |
3212 | 2822 else if (state & AIM_ICQ_STATE_AWAY) |
4342 | 2823 return g_strdup_printf(_("Away")); |
3212 | 2824 else if (state & AIM_ICQ_STATE_WEBAWARE) |
4342 | 2825 return g_strdup_printf(_("Web Aware")); |
3212 | 2826 else if (state & AIM_ICQ_STATE_INVISIBLE) |
4342 | 2827 return g_strdup_printf(_("Invisible")); |
3212 | 2828 else |
4342 | 2829 return g_strdup_printf(_("Online")); |
3212 | 2830 } |
2831 | |
4194 | 2832 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
5575 | 2833 GaimConnection *gc = sess->aux_data; |
4617 | 2834 struct oscar_data *od = gc->proto_data; |
2835 | |
2836 /* BBB */ | |
3630 | 2837 switch (reason) { |
4151 | 2838 case 3: { /* Decline sendfile. */ |
4617 | 2839 struct gaim_xfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2840 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2841 "AAA - Other user declined file transfer\n"); |
4617 | 2842 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2843 gaim_xfer_cancel_remote(xfer); |
4151 | 2844 } break; |
2845 | |
2846 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2847 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2848 "Received an unknown rendezvous client auto-response " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2849 "from %s. Type 0x%04hx\n", who, reason); |
4151 | 2850 } |
3630 | 2851 |
2852 } | |
2853 | |
2854 return 0; | |
2855 } | |
2856 | |
4194 | 2857 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
5575 | 2858 GaimConnection *gc = sess->aux_data; |
4151 | 2859 |
2860 switch(reason) { | |
2861 case 0x0003: { /* Reply from an ICQ status message request */ | |
2862 char *status_msg = gaim_icq_status(state); | |
2863 char *dialog_msg, **splitmsg; | |
2864 struct oscar_data *od = gc->proto_data; | |
2865 GSList *l = od->evilhack; | |
2866 gboolean evilhack = FALSE; | |
2867 | |
2868 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
2869 splitmsg = g_strsplit(msg, "\r\n", 0); | |
2870 | |
2871 /* If who is in od->evilhack, then we're just getting the away message, otherwise this | |
2872 * will just get appended to the info box (which is already showing). */ | |
2873 while (l) { | |
2874 char *x = l->data; | |
2875 if (!strcmp(x, normalize(who))) { | |
2876 evilhack = TRUE; | |
2877 g_free(x); | |
2878 od->evilhack = g_slist_remove(od->evilhack, x); | |
2879 break; | |
2880 } | |
2881 l = l->next; | |
2882 } | |
2883 | |
2884 if (evilhack) | |
4344 | 2885 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); |
4151 | 2886 else |
4344 | 2887 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<HR>%s"), status_msg, g_strjoinv("<BR>", splitmsg)); |
4151 | 2888 g_show_info_text(gc, who, 2, dialog_msg, NULL); |
2889 | |
2890 g_free(status_msg); | |
2891 g_free(dialog_msg); | |
2892 g_strfreev(splitmsg); | |
2893 } break; | |
2894 | |
2895 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2896 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2897 "Received an unknown client auto-response from %s. " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2898 "Type 0x%04hx\n", who, reason); |
4151 | 2899 } break; |
2900 } /* end of switch */ | |
2901 | |
2902 return 0; | |
2903 } | |
2904 | |
3212 | 2905 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
2906 va_list ap; | |
2907 fu16_t chan, reason; | |
2908 char *who; | |
2909 | |
2910 va_start(ap, fr); | |
4200 | 2911 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2912 who = va_arg(ap, char *); |
4200 | 2913 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2914 |
3952 | 2915 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 2916 char *cookie = va_arg(ap, char *); |
4151 | 2917 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 2918 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 2919 fu32_t state = 0; |
4151 | 2920 char *msg = NULL; |
2921 if (reason == 0x0003) { | |
4200 | 2922 state = va_arg(ap, fu32_t); |
4151 | 2923 msg = va_arg(ap, char *); |
2924 } | |
2925 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
2926 } | |
3952 | 2927 |
3212 | 2928 va_end(ap); |
2929 | |
2930 return 1; | |
2931 } | |
2932 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2933 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2934 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2935 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2936 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2937 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2938 va_start(ap, fr); |
4199 | 2939 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2940 va_end(ap); |
2941 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2942 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2943 "snac threw error (reason 0x%04hx: %s)\n", reason, |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2944 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2086 | 2945 |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2946 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
5411 | 2947 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2948 gaim_notify_error(sess->aux_data, NULL, m, NULL); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2949 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2950 |
2086 | 2951 return 1; |
2952 } | |
2953 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2954 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4617 | 2955 #if 0 |
5575 | 2956 GaimConnection *gc = sess->aux_data; |
4617 | 2957 struct oscar_data *od = gc->proto_data; |
2958 struct gaim_xfer *xfer; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2959 #endif |
4617 | 2960 va_list ap; |
2961 fu16_t reason; | |
2962 char *data, *buf; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2963 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2964 va_start(ap, fr); |
4617 | 2965 reason = (fu16_t)va_arg(ap, unsigned int); |
3752 | 2966 data = va_arg(ap, char *); |
2086 | 2967 va_end(ap); |
2968 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2969 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2970 "Message error with data %s and reason %hu\n", data, reason); |
4617 | 2971 |
2972 /* BBB */ | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2973 #if 0 |
4617 | 2974 /* If this was a file transfer request, data is a cookie */ |
2975 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) { | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2976 gaim_xfer_cancel_remote(xfer); |
3630 | 2977 return 1; |
2978 } | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2979 #endif |
3630 | 2980 |
4617 | 2981 /* Data is assumed to be the destination sn */ |
2982 buf = g_strdup_printf(_("Your message to %s did not get sent:"), data); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2983 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2984 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
4617 | 2985 g_free(buf); |
2086 | 2986 |
2987 return 1; | |
2988 } | |
2989 | |
3595 | 2990 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2991 GaimConnection *gc = sess->aux_data; |
3595 | 2992 va_list ap; |
2993 fu16_t type1, type2; | |
2994 char *sn; | |
2995 | |
2996 va_start(ap, fr); | |
4199 | 2997 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 2998 sn = va_arg(ap, char *); |
4199 | 2999 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3000 va_end(ap); |
3001 | |
3002 switch (type2) { | |
3003 case 0x0000: { /* Text has been cleared */ | |
3004 serv_got_typing_stopped(gc, sn); | |
3005 } break; | |
3006 | |
3007 case 0x0001: { /* Paused typing */ | |
3768 | 3008 serv_got_typing(gc, sn, 0, TYPED); |
3595 | 3009 } break; |
3010 | |
3011 case 0x0002: { /* Typing */ | |
3768 | 3012 serv_got_typing(gc, sn, 0, TYPING); |
3595 | 3013 } break; |
3014 | |
3015 default: { | |
5435 | 3016 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2); |
3595 | 3017 } break; |
3018 } | |
3019 | |
3020 return 1; | |
3021 } | |
3022 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3023 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5420 | 3024 char *buf; |
2086 | 3025 va_list ap; |
5420 | 3026 fu16_t reason; |
2086 | 3027 char *destn; |
3028 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3029 va_start(ap, fr); |
4199 | 3030 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3031 destn = va_arg(ap, char *); |
3032 va_end(ap); | |
3033 | |
5420 | 3034 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3035 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3036 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
5420 | 3037 g_free(buf); |
2086 | 3038 |
3039 return 1; | |
3040 } | |
3041 | |
3042 static char *images(int flags) { | |
3043 static char buf[1024]; | |
3101 | 3044 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
2679 | 3045 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
2086 | 3046 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
3047 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
3101 | 3048 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
2086 | 3049 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
3079 | 3050 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
3051 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); | |
2086 | 3052 return buf; |
3053 } | |
3054 | |
3101 | 3055 |
2920 | 3056 static char *caps_string(guint caps) |
3057 { | |
3058 static char buf[512], *tmp; | |
3059 int count = 0, i = 0; | |
3060 guint bit = 1; | |
4742 | 3061 |
3062 if (!caps) { | |
4744 | 3063 return NULL; |
4743 | 3064 } else while (bit <= 0x20000) { |
2920 | 3065 if (bit & caps) { |
3066 switch (bit) { | |
3067 case 0x1: | |
3068 tmp = _("Buddy Icon"); | |
3069 break; | |
3070 case 0x2: | |
3071 tmp = _("Voice"); | |
3072 break; | |
3073 case 0x4: | |
4898 | 3074 tmp = _("Direct IM"); |
2920 | 3075 break; |
3076 case 0x8: | |
3077 tmp = _("Chat"); | |
3078 break; | |
3079 case 0x10: | |
3080 tmp = _("Get File"); | |
3081 break; | |
3082 case 0x20: | |
3083 tmp = _("Send File"); | |
3084 break; | |
3085 case 0x40: | |
3086 case 0x200: | |
3087 tmp = _("Games"); | |
3088 break; | |
3089 case 0x80: | |
4898 | 3090 tmp = _("Add-Ins"); |
2920 | 3091 break; |
3092 case 0x100: | |
3093 tmp = _("Send Buddy List"); | |
3094 break; | |
3095 case 0x400: | |
3096 tmp = _("EveryBuddy Bug"); | |
3097 break; | |
3098 case 0x800: | |
3099 tmp = _("AP User"); | |
3100 break; | |
3101 case 0x1000: | |
3102 tmp = _("ICQ RTF"); | |
3103 break; | |
3104 case 0x2000: | |
3105 tmp = _("Nihilist"); | |
3106 break; | |
3107 case 0x4000: | |
3108 tmp = _("ICQ Server Relay"); | |
3109 break; | |
3110 case 0x8000: | |
3111 tmp = _("ICQ Unknown"); | |
3112 break; | |
3113 case 0x10000: | |
3114 tmp = _("Trillian Encryption"); | |
3115 break; | |
4742 | 3116 case 0x20000: |
3117 tmp = _("ICQ UTF8"); | |
3118 break; | |
2920 | 3119 default: |
3120 tmp = NULL; | |
3121 break; | |
3122 } | |
3123 if (tmp) | |
3124 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
3125 tmp); | |
3126 count++; | |
3127 } | |
3128 bit <<= 1; | |
3129 } | |
4744 | 3130 return buf; |
2920 | 3131 } |
3132 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3133 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3134 GaimConnection *gc = sess->aux_data; |
4791 | 3135 struct oscar_data *od = gc->proto_data; |
5420 | 3136 gchar *header; |
4791 | 3137 GSList *l = od->evilhack; |
3138 gboolean evilhack = FALSE; | |
3139 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; | |
3140 va_list ap; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3141 aim_userinfo_t *info; |
4791 | 3142 fu16_t infotype; |
4151 | 3143 char *text_enc = NULL, *text = NULL, *utf8 = NULL; |
3144 int text_len; | |
5575 | 3145 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); |
2086 | 3146 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3147 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3148 info = va_arg(ap, aim_userinfo_t *); |
4199 | 3149 infotype = (fu16_t) va_arg(ap, unsigned int); |
4151 | 3150 text_enc = va_arg(ap, char *); |
3151 text = va_arg(ap, char *); | |
3152 text_len = va_arg(ap, int); | |
2086 | 3153 va_end(ap); |
3154 | |
4151 | 3155 if (text_len > 0) { |
5129 | 3156 if (!(utf8 = oscar_encoding_to_utf8(text_enc, text, text_len))) { |
4791 | 3157 utf8 = g_strdup(_("<i>Unable to display information because it was sent in an unknown encoding.</i>")); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3158 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3159 "Encountered an unknown encoding while parsing userinfo\n"); |
4151 | 3160 } |
3161 } | |
3162 | |
2993 | 3163 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) { |
4834 | 3164 onlinesince = g_strdup_printf(_("Online Since : <b>%s</b><br>\n"), |
5556 | 3165 asctime(localtime((time_t *)&info->onlinesince))); |
2993 | 3166 } |
3167 | |
3168 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { | |
4834 | 3169 membersince = g_strdup_printf(_("Member Since : <b>%s</b><br>\n"), |
5556 | 3170 asctime(localtime((time_t *)&info->membersince))); |
2993 | 3171 } |
3172 | |
3173 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
4426 | 3174 gchar *itime = sec_to_text(info->idletime*60); |
4834 | 3175 idle = g_strdup_printf(_("Idle : <b>%s</b>"), itime); |
4426 | 3176 g_free(itime); |
2993 | 3177 } else |
4834 | 3178 idle = g_strdup(_("Idle: <b>Active</b>")); |
2993 | 3179 |
5420 | 3180 header = g_strdup_printf(_("Username : <b>%s</b> %s <br>\n" |
4791 | 3181 "Warning Level : <b>%d %%</b><br>\n" |
2086 | 3182 "%s" |
2993 | 3183 "%s" |
4344 | 3184 "%s\n" |
4791 | 3185 "<hr>\n"), |
2086 | 3186 info->sn, images(info->flags), |
5149 | 3187 ill_just_write_my_own_damn_round_function(info->warnlevel/10.0), |
2993 | 3188 onlinesince ? onlinesince : "", |
3189 membersince ? membersince : "", | |
3190 idle ? idle : ""); | |
3191 | |
3192 g_free(onlinesince); | |
3193 g_free(membersince); | |
3194 g_free(idle); | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
3195 |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3196 while (l) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3197 char *x = l->data; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3198 if (!strcmp(x, normalize(info->sn))) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3199 evilhack = TRUE; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3200 g_free(x); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3201 od->evilhack = g_slist_remove(od->evilhack, x); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3202 break; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3203 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3204 l = l->next; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3205 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3206 |
2920 | 3207 if (infotype == AIM_GETINFO_AWAYMESSAGE) { |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3208 if (evilhack) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3209 g_show_info_text(gc, info->sn, 2, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3210 header, |
5575 | 3211 (utf8 && *utf8) ? away_subs(utf8, username) : |
4207 | 3212 _("<i>User has no away message</i>"), NULL); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3213 } else { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3214 g_show_info_text(gc, info->sn, 0, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3215 header, |
5575 | 3216 (utf8 && *utf8) ? away_subs(utf8, username) : NULL, |
4791 | 3217 (utf8 && *utf8) ? "<hr>" : NULL, |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3218 NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3219 } |
2920 | 3220 } else if (infotype == AIM_GETINFO_CAPABILITIES) { |
3221 g_show_info_text(gc, info->sn, 2, | |
3222 header, | |
3223 "<i>", _("Client Capabilities: "), | |
3224 caps_string(info->capabilities), | |
3225 "</i>", | |
3226 NULL); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3227 } else { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3228 g_show_info_text(gc, info->sn, 1, |
5575 | 3229 (utf8 && *utf8) ? away_subs(utf8, username) : _("<i>No Information Provided</i>"), |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3230 NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3231 } |
2086 | 3232 |
5420 | 3233 g_free(header); |
4151 | 3234 g_free(utf8); |
3235 | |
2086 | 3236 return 1; |
3237 } | |
3238 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3239 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3240 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3241 fu16_t id; |
2086 | 3242 va_list ap; |
3243 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3244 va_start(ap, fr); |
4199 | 3245 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3246 msg = va_arg(ap, char *); |
3247 va_end(ap); | |
3248 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3249 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3250 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
3251 if (id < 4) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3252 gaim_notify_warning(sess->aux_data, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3253 _("Your AIM connection may be lost."), NULL); |
2086 | 3254 |
3255 return 1; | |
3256 } | |
3257 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3258 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3259 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3260 fu16_t type; |
5575 | 3261 GaimConnection *gc = sess->aux_data; |
4617 | 3262 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 3263 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3264 va_start(ap, fr); |
4199 | 3265 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3266 |
3267 switch(type) { | |
3268 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3269 fu8_t maxrooms; |
2086 | 3270 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3271 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3272 |
4199 | 3273 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 3274 exchangecount = va_arg(ap, int); |
3275 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
3276 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3277 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3278 "chat info: Chat Rights:\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3279 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3280 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3281 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3282 "chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3283 for (i = 0; i < exchangecount; i++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3284 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3285 "chat info: \t\t%hu %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3286 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
4617 | 3287 while (od->create_rooms) { |
3288 struct create_room *cr = od->create_rooms->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3289 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3290 "creating room %s\n", cr->name); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3291 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3292 g_free(cr->name); |
4617 | 3293 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3294 g_free(cr); |
2086 | 3295 } |
3296 } | |
3297 break; | |
3298 case 0x0008: { | |
3299 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3300 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3301 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3302 fu32_t createtime; |
2086 | 3303 |
3304 fqcn = va_arg(ap, char *); | |
4200 | 3305 instance = (fu16_t)va_arg(ap, unsigned int); |
3306 exchange = (fu16_t)va_arg(ap, unsigned int); | |
3307 flags = (fu16_t)va_arg(ap, unsigned int); | |
3308 createtime = va_arg(ap, fu32_t); | |
3309 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3310 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
3311 createperms = (fu8_t)va_arg(ap, unsigned int); | |
3312 unknown = (fu16_t)va_arg(ap, unsigned int); | |
3313 name = va_arg(ap, char *); | |
3314 ck = va_arg(ap, char *); | |
4194 | 3315 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3316 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3317 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", |
2086 | 3318 fqcn, |
3319 exchange, instance, flags, | |
3320 createtime, | |
3321 maxmsglen, maxoccupancy, createperms, unknown, | |
3322 name, ck); | |
4617 | 3323 aim_chat_join(od->sess, od->conn, exchange, ck, instance); |
2086 | 3324 } |
3325 break; | |
3326 default: | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3327 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3328 "chatnav info: unknown type (%04hx)\n", type); |
2086 | 3329 break; |
3330 } | |
4194 | 3331 |
3332 va_end(ap); | |
3333 | |
2086 | 3334 return 1; |
3335 } | |
3336 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3337 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3338 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3339 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3340 aim_userinfo_t *info; |
5575 | 3341 GaimConnection *g = sess->aux_data; |
2086 | 3342 |
3343 struct chat_connection *c = NULL; | |
3344 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3345 va_start(ap, fr); |
2086 | 3346 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3347 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3348 va_end(ap); |
3349 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3350 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3351 if (!c) |
3352 return 1; | |
3353 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3354 for (i = 0; i < count; i++) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
3355 gaim_chat_add_user(GAIM_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3356 |
3357 return 1; | |
3358 } | |
3359 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3360 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3361 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3362 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3363 aim_userinfo_t *info; |
5575 | 3364 GaimConnection *g = sess->aux_data; |
2086 | 3365 |
3366 struct chat_connection *c = NULL; | |
3367 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3368 va_start(ap, fr); |
2086 | 3369 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3370 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3371 va_end(ap); |
3372 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3373 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3374 if (!c) |
3375 return 1; | |
3376 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3377 for (i = 0; i < count; i++) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
3378 gaim_chat_remove_user(GAIM_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3379 |
3380 return 1; | |
3381 } | |
3382 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3383 static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3384 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3385 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3386 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3387 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3388 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3389 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3390 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3391 fu32_t creationtime; |
5575 | 3392 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3393 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3394 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3395 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3396 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3397 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3398 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3399 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3400 roomdesc = va_arg(ap, char *); |
4200 | 3401 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
3402 creationtime = va_arg(ap, fu32_t); | |
3403 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3404 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
3405 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
3406 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3407 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3408 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3409 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3410 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3411 maxmsglen, maxvisiblemsglen); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3412 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3413 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3414 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3415 |
2086 | 3416 return 1; |
3417 } | |
3418 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3419 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3420 GaimConnection *gc = sess->aux_data; |
2086 | 3421 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3422 aim_userinfo_t *info; |
2086 | 3423 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3424 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
2086 | 3425 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3426 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3427 info = va_arg(ap, aim_userinfo_t *); |
4194 | 3428 msg = va_arg(ap, char *); |
3429 va_end(ap); | |
2086 | 3430 |
4269 | 3431 serv_got_chat_in(gc, ccon->id, info->sn, 0, msg, time((time_t)NULL)); |
2086 | 3432 |
3433 return 1; | |
3434 } | |
3435 | |
3694 | 3436 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
3437 va_list ap; | |
5575 | 3438 GaimConnection *gc = sess->aux_data; |
3694 | 3439 struct aim_emailinfo *emailinfo; |
3725 | 3440 int havenewmail; |
3694 | 3441 |
3442 va_start(ap, fr); | |
3443 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 3444 havenewmail = va_arg(ap, int); |
3694 | 3445 va_end(ap); |
3446 | |
3725 | 3447 if (emailinfo) { |
5575 | 3448 gchar *to = g_strdup_printf("%s@%s", gaim_account_get_username(gaim_connection_get_account(gc)), emailinfo->domain); |
5542 | 3449 if (emailinfo->unread && havenewmail) |
3450 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); | |
5537 | 3451 g_free(to); |
3694 | 3452 } |
3453 | |
3454 return 1; | |
3455 } | |
3456 | |
4804 | 3457 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3458 GaimConnection *gc = sess->aux_data; |
4804 | 3459 struct oscar_data *od = gc->proto_data; |
3460 char *sn; | |
3461 | |
3462 sn = od->requesticon->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3463 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3464 "removing %s from hash table\n", sn); |
4804 | 3465 od->requesticon = g_slist_remove(od->requesticon, sn); |
3466 free(sn); | |
3467 | |
3468 if (od->icontimer) | |
3469 g_source_remove(od->icontimer); | |
3470 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
3471 | |
3472 return 1; | |
3473 } | |
3474 | |
3475 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 3476 GaimConnection *gc = sess->aux_data; |
4804 | 3477 struct oscar_data *od = gc->proto_data; |
3478 GSList *cur; | |
3479 va_list ap; | |
3480 char *sn; | |
4853 | 3481 fu8_t *iconcsum, *icon; |
3482 fu16_t iconcsumlen, iconlen; | |
4804 | 3483 |
3484 va_start(ap, fr); | |
3485 sn = va_arg(ap, char *); | |
4853 | 3486 iconcsum = va_arg(ap, fu8_t *); |
3487 iconcsumlen = va_arg(ap, int); | |
4804 | 3488 icon = va_arg(ap, fu8_t *); |
3489 iconlen = va_arg(ap, int); | |
3490 va_end(ap); | |
3491 | |
4853 | 3492 if (iconlen > 0) { |
3493 char *b16; | |
5129 | 3494 struct buddy *b = gaim_find_buddy(gc->account, sn); |
4804 | 3495 set_icon_data(gc, sn, icon, iconlen); |
4853 | 3496 b16 = tobase16(iconcsum, iconcsumlen); |
5129 | 3497 if (b16) { |
3498 gaim_buddy_set_setting(b, "icon_checksum", b16); | |
3499 gaim_blist_save(); | |
5125 | 3500 free(b16); |
5129 | 3501 } |
4853 | 3502 } |
4804 | 3503 |
3504 cur = od->requesticon; | |
3505 while (cur) { | |
3506 char *cursn = cur->data; | |
3507 if (!aim_sncmp(cursn, sn)) { | |
3508 od->requesticon = g_slist_remove(od->requesticon, cursn); | |
3509 free(cursn); | |
3510 cur = od->requesticon; | |
3511 } else | |
3512 cur = cur->next; | |
3513 } | |
3514 | |
3515 if (od->icontimer) | |
3516 g_source_remove(od->icontimer); | |
3517 od->icontimer = g_timeout_add(250, gaim_icon_timerfunc, gc); | |
3518 | |
3519 return 1; | |
3520 } | |
3521 | |
3522 static gboolean gaim_icon_timerfunc(gpointer data) { | |
5575 | 3523 GaimConnection *gc = data; |
4804 | 3524 struct oscar_data *od = gc->proto_data; |
3525 struct buddyinfo *bi; | |
3526 aim_conn_t *conn; | |
3527 | |
3528 if (!od->requesticon) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3529 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3530 "no more icons to request\n"); |
4804 | 3531 return FALSE; |
3532 } | |
3533 | |
3534 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | |
4823 | 3535 if (!conn && !od->iconconnecting) { |
4804 | 3536 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); |
4823 | 3537 od->iconconnecting = TRUE; |
4804 | 3538 return FALSE; |
3539 } | |
3540 | |
3541 bi = g_hash_table_lookup(od->buddyinfo, (char *)od->requesticon->data); | |
4853 | 3542 if (bi && (bi->iconcsumlen > 0)) { |
4889 | 3543 aim_icon_request(od->sess, od->requesticon->data, bi->iconcsum, bi->iconcsumlen); |
4804 | 3544 return FALSE; |
3545 } else { | |
3546 char *sn = od->requesticon->data; | |
3547 od->requesticon = g_slist_remove(od->requesticon, sn); | |
3548 free(sn); | |
3549 } | |
3550 | |
3551 return TRUE; | |
3552 } | |
3553 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3554 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3555 * Recieved in response to an IM sent with the AIM_IMFLAGS_ACK option. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3556 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3557 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3558 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3559 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3560 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3561 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3562 va_start(ap, fr); |
4199 | 3563 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3564 sn = va_arg(ap, char *); |
3565 va_end(ap); | |
3566 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3567 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sent message to %s.\n", sn); |
2086 | 3568 |
3569 return 1; | |
3570 } | |
3571 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3572 static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3573 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3574 "invalid", |
4194 | 3575 "change", |
3576 "warning", | |
3577 "limit", | |
3578 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3579 }; |
2086 | 3580 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3581 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3582 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3583 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3584 va_start(ap, fr); |
4200 | 3585 code = (fu16_t)va_arg(ap, unsigned int); |
3586 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
3587 windowsize = va_arg(ap, fu32_t); | |
3588 clear = va_arg(ap, fu32_t); | |
3589 alert = va_arg(ap, fu32_t); | |
3590 limit = va_arg(ap, fu32_t); | |
3591 disconnect = va_arg(ap, fu32_t); | |
3592 currentavg = va_arg(ap, fu32_t); | |
3593 maxavg = va_arg(ap, fu32_t); | |
2086 | 3594 va_end(ap); |
3595 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3596 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3597 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " |
3598 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", | |
2086 | 3599 (code < 5) ? codes[code] : codes[0], |
3600 rateclass, | |
3601 currentavg, maxavg, | |
3602 alert, clear, | |
3603 limit, disconnect, | |
3604 windowsize); | |
3605 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3606 /* XXX fix these values */ |
2086 | 3607 if (code == AIM_RATE_CODE_CHANGE) { |
3608 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3609 aim_conn_setlatency(fr->conn, 0); |
2086 | 3610 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3611 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
3612 } else if (code == AIM_RATE_CODE_LIMIT) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3613 gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3614 _("The last message was not sent because you " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3615 "are over the rate limit. Please wait 10 " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3616 "seconds and try again.")); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3617 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 3618 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3619 aim_conn_setlatency(fr->conn, 0); |
2086 | 3620 } |
3621 | |
3622 return 1; | |
3623 } | |
3624 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3625 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3626 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3627 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3628 aim_userinfo_t *userinfo; |
5575 | 3629 GaimConnection *gc = sess->aux_data; |
2086 | 3630 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3631 va_start(ap, fr); |
4199 | 3632 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3633 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3634 va_end(ap); |
3635 | |
5149 | 3636 serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, ill_just_write_my_own_damn_round_function(newevil/10.0)); |
2086 | 3637 |
3638 return 1; | |
3639 } | |
3640 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3641 static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3642 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3643 aim_userinfo_t *info; |
5575 | 3644 GaimConnection *gc = sess->aux_data; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3645 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3646 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3647 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3648 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3649 |
5149 | 3650 gc->evil = ill_just_write_my_own_damn_round_function(info->warnlevel/10.0); |
4841 | 3651 |
3652 if (info->onlinesince) | |
3653 gc->login_time_official = info->onlinesince; | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3654 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3655 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3656 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3657 |
4649 | 3658 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3659 GaimConnection *gc = sess->aux_data; |
4666 | 3660 struct oscar_data *od = gc->proto_data; |
4649 | 3661 va_list ap; |
3662 fu16_t code; | |
3663 char *msg; | |
3664 | |
3665 va_start(ap, fr); | |
3666 code = (fu16_t)va_arg(ap, int); | |
3667 msg = va_arg(ap, char *); | |
3668 va_end(ap); | |
3669 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3670 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3671 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); |
4649 | 3672 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { |
4651 | 3673 if (code == 0x0001) { |
5579 | 3674 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); |
4651 | 3675 } else { |
5579 | 3676 gaim_connection_error(gc, _("You have been signed off for an unknown reason.")); |
4651 | 3677 } |
4666 | 3678 od->killme = TRUE; |
4649 | 3679 } |
3680 | |
3681 return 1; | |
3682 } | |
3683 | |
2675 | 3684 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3685 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3686 aim_reqpersonalinfo(sess, fr->conn); |
4230 | 3687 |
3688 #ifndef NOSSI | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3689 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting ssi list\n"); |
4889 | 3690 aim_ssi_reqrights(sess); |
3691 aim_ssi_reqdata(sess, sess->ssi.timestamp, sess->ssi.numitems); | |
4230 | 3692 #endif |
3693 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3694 aim_bos_reqlocaterights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3695 aim_bos_reqbuddyrights(sess, fr->conn); |
4617 | 3696 aim_im_reqparams(sess); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3697 aim_bos_reqrights(sess, fr->conn); |
4230 | 3698 |
3699 #ifdef NOSSI | |
3700 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); | |
3701 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
3702 #endif | |
2086 | 3703 |
3704 return 1; | |
3705 } | |
3706 | |
2675 | 3707 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3708 GaimConnection *gc = sess->aux_data; |
2647 | 3709 struct oscar_data *od = gc->proto_data; |
3710 | |
2672 | 3711 aim_clientready(sess, fr->conn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3712 gaim_debug(GAIM_DEBUG_INFO, "oscar", "connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3713 |
2647 | 3714 if (od->chpass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3715 gaim_debug(GAIM_DEBUG_INFO, "oscar", "changing password\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3716 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 3717 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3718 od->oldp = NULL; |
2647 | 3719 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3720 od->newp = NULL; |
2647 | 3721 od->chpass = FALSE; |
3722 } | |
2979 | 3723 if (od->setnick) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3724 gaim_debug(GAIM_DEBUG_INFO, "oscar", "formatting screenname\n"); |
2979 | 3725 aim_admin_setnick(sess, fr->conn, od->newsn); |
3726 g_free(od->newsn); | |
3727 od->newsn = NULL; | |
3728 od->setnick = FALSE; | |
3729 } | |
2647 | 3730 if (od->conf) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3731 gaim_debug(GAIM_DEBUG_INFO, "oscar", "confirming account\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3732 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 3733 od->conf = FALSE; |
3734 } | |
3735 if (od->reqemail) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3736 gaim_debug(GAIM_DEBUG_INFO, "oscar", "requesting email\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3737 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 3738 od->reqemail = FALSE; |
3739 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3740 if (od->setemail) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3741 gaim_debug(GAIM_DEBUG_INFO, "oscar", "setting email\n"); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3742 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3743 g_free(od->email); |
5497 | 3744 od->email = NULL; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3745 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3746 } |
2647 | 3747 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3748 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3749 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3750 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3751 static int gaim_icbm_param_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3752 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3753 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3754 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3755 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3756 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3757 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3758 |
4194 | 3759 /* XXX - evidently this crashes on solaris. i have no clue why |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3760 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " |
5556 | 3761 "max sender evil = %f, max receiver evil = %f, min msg interval = %u\n", |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3762 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3763 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3764 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
3765 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3766 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3767 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 3768 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3769 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3770 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3771 |
4617 | 3772 aim_im_setparams(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3773 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3774 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3775 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3776 |
2993 | 3777 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3778 { | |
5575 | 3779 GaimConnection *gc = sess->aux_data; |
4617 | 3780 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5306 | 3781 va_list ap; |
3782 fu16_t maxsiglen; | |
2993 | 3783 |
3784 va_start(ap, fr); | |
4199 | 3785 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 3786 va_end(ap); |
3787 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3788 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3789 "locate rights: max sig len = %d\n", maxsiglen); |
2993 | 3790 |
4617 | 3791 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; |
3792 | |
3793 if (od->icq) | |
4151 | 3794 aim_bos_setprofile(sess, fr->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); |
5301 | 3795 else |
3796 oscar_set_info(gc, gc->account->user_info); | |
2993 | 3797 |
3798 return 1; | |
3799 } | |
3800 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3801 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3802 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3803 fu16_t maxbuddies, maxwatchers; |
5575 | 3804 GaimConnection *gc = sess->aux_data; |
4617 | 3805 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3806 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3807 va_start(ap, fr); |
4199 | 3808 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3809 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3810 va_end(ap); |
3811 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3812 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3813 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 3814 |
4617 | 3815 od->rights.maxbuddies = (guint)maxbuddies; |
3816 od->rights.maxwatchers = (guint)maxwatchers; | |
2993 | 3817 |
2086 | 3818 return 1; |
3819 } | |
3820 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3821 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3822 fu16_t maxpermits, maxdenies; |
2086 | 3823 va_list ap; |
5575 | 3824 GaimConnection *gc = sess->aux_data; |
4617 | 3825 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 3826 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3827 va_start(ap, fr); |
4199 | 3828 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3829 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3830 va_end(ap); |
3831 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3832 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3833 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 3834 |
4617 | 3835 od->rights.maxpermits = (guint)maxpermits; |
3836 od->rights.maxdenies = (guint)maxdenies; | |
2993 | 3837 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
3838 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2993 | 3839 serv_finish_login(gc); |
3840 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3841 gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n"); |
2993 | 3842 |
2672 | 3843 aim_clientready(sess, fr->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3844 |
4617 | 3845 /* XXX - Should call aim_bos_setidle with 0x0000 */ |
3846 | |
4664 | 3847 if (od->icq) { |
3848 aim_icq_reqofflinemsgs(sess); | |
3849 aim_icq_hideip(sess); | |
3850 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3851 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3852 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 3853 if (sess->authinfo->email) |
3854 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 3855 |
3856 return 1; | |
3857 } | |
3858 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3859 static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3860 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3861 struct aim_icq_offlinemsg *msg; |
4075 | 3862 struct aim_incomingim_ch4_args args; |
3863 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3864 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3865 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3866 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3867 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3868 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3869 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3870 "Received offline message. Converting to channel 4 ICBM...\n"); |
4075 | 3871 args.uin = msg->sender; |
3872 args.type = msg->type; | |
4173 | 3873 args.flags = msg->flags; |
4076 | 3874 args.msglen = msg->msglen; |
4075 | 3875 args.msg = msg->msg; |
3876 t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); | |
3877 incomingim_chan4(sess, fr->conn, NULL, &args, t); | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3878 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3879 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3880 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3881 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3882 static int gaim_offlinemsgdone(aim_session_t *sess, aim_frame_t *fr, ...) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3883 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3884 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3885 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3886 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3887 |
4624 | 3888 static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3889 { |
5575 | 3890 GaimConnection *gc = sess->aux_data; |
4819 | 3891 gchar *buf, *tmp, *utf8; |
4624 | 3892 gchar who[16]; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3893 va_list ap; |
4151 | 3894 struct aim_icq_info *info; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3895 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3896 va_start(ap, fr); |
4151 | 3897 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3898 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3899 |
4664 | 3900 if (!info->uin) |
3901 return 0; | |
3902 | |
5556 | 3903 g_snprintf(who, sizeof(who), "%u", info->uin); |
4820 | 3904 buf = g_strdup_printf("<b>%s</b> %s", _("UIN:"), who); |
4819 | 3905 if (info->nick && info->nick[0] && (utf8 = gaim_try_conv_to_utf8(info->nick))) { |
3906 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Nick:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
3907 } | |
3908 if (info->first && info->first[0] && (utf8 = gaim_try_conv_to_utf8(info->first))) { | |
3909 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("First Name:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
3910 } | |
3911 if (info->last && info->last[0] && (utf8 = gaim_try_conv_to_utf8(info->last))) { | |
3912 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Last Name:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
3913 } | |
3914 if (info->email && info->email[0] && (utf8 = gaim_try_conv_to_utf8(info->email))) { | |
3915 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Email Address:"), "</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); | |
4625 | 3916 } |
3917 if (info->numaddresses && info->email2) { | |
3918 int i; | |
3919 for (i = 0; i < info->numaddresses; i++) { | |
4819 | 3920 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_try_conv_to_utf8(info->email2[i]))) { |
3921 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Email Address:"), "</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); | |
4643 | 3922 } |
4625 | 3923 } |
4624 | 3924 } |
4819 | 3925 if (info->mobile && info->mobile[0] && (utf8 = gaim_try_conv_to_utf8(info->mobile))) { |
3926 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Mobile Phone:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4625 | 3927 } |
3928 if (info->gender) { | |
4819 | 3929 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Gender:"), "</b> ", info->gender==1 ? _("Female") : _("Male"), NULL); g_free(tmp); |
4151 | 3930 } |
4624 | 3931 if (info->birthyear || info->birthmonth || info->birthday) { |
4627 | 3932 char date[30]; |
3933 struct tm tm; | |
3934 tm.tm_mday = (int)info->birthday; | |
3935 tm.tm_mon = (int)info->birthmonth-1; | |
3936 tm.tm_year = (int)info->birthyear-1900; | |
4628 | 3937 strftime(date, sizeof(date), "%x", &tm); |
4819 | 3938 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Birthday:"), "</b> ", date, NULL); g_free(tmp); |
4151 | 3939 } |
4624 | 3940 if (info->age) { |
3941 char age[5]; | |
3942 snprintf(age, sizeof(age), "%hhd", info->age); | |
4819 | 3943 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Age:"), "</b> ", age, NULL); g_free(tmp); |
3944 } | |
3945 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_try_conv_to_utf8(info->personalwebpage))) { | |
3946 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Personal Web Page:"), "</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); | |
3947 } | |
3948 if (info->info && info->info[0] && (utf8 = gaim_try_conv_to_utf8(info->info))) { | |
3949 tmp = buf; buf = g_strconcat(tmp, "<hr><b>", _("Additional Information:"), "</b><br>", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3950 } |
3951 tmp = buf; buf = g_strconcat(tmp, "<hr>\n", NULL); g_free(tmp); | |
4641 | 3952 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
4819 | 3953 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Home Address:"), "</b>", NULL); g_free(tmp); |
3954 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_try_conv_to_utf8(info->homeaddr))) { | |
3955 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3956 } |
4819 | 3957 if (info->homecity && info->homecity[0] && (utf8 = gaim_try_conv_to_utf8(info->homecity))) { |
3958 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3959 } |
4819 | 3960 if (info->homestate && info->homestate[0] && (utf8 = gaim_try_conv_to_utf8(info->homestate))) { |
3961 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3962 } |
4819 | 3963 if (info->homezip && info->homezip[0] && (utf8 = gaim_try_conv_to_utf8(info->homezip))) { |
3964 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3965 } |
3966 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 3967 } |
4641 | 3968 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
4819 | 3969 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Address:"), "</b>", NULL); g_free(tmp); |
3970 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_try_conv_to_utf8(info->workaddr))) { | |
3971 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3972 } |
4819 | 3973 if (info->workcity && info->workcity[0] && (utf8 = gaim_try_conv_to_utf8(info->workcity))) { |
3974 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3975 } |
4819 | 3976 if (info->workstate && info->workstate[0] && (utf8 = gaim_try_conv_to_utf8(info->workstate))) { |
3977 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3978 } |
4819 | 3979 if (info->workzip && info->workzip[0] && (utf8 = gaim_try_conv_to_utf8(info->workzip))) { |
3980 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3981 } |
3982 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
3983 } | |
4641 | 3984 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
4819 | 3985 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Information:"), "</b>", NULL); g_free(tmp); |
3986 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_try_conv_to_utf8(info->workcompany))) { | |
3987 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Company:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3988 } |
4819 | 3989 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_try_conv_to_utf8(info->workdivision))) { |
3990 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Division:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3991 } |
4819 | 3992 if (info->workposition && info->workposition[0] && (utf8 = gaim_try_conv_to_utf8(info->workposition))) { |
3993 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Position:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3994 } |
4819 | 3995 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_try_conv_to_utf8(info->workwebpage))) { |
3996 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Web Page:"), "</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); | |
4624 | 3997 } |
3998 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 3999 } |
4000 | |
4001 g_show_info_text(gc, who, 2, buf, NULL); | |
4002 g_free(buf); | |
4003 | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4004 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4005 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4006 |
4759 | 4007 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
4008 { | |
5575 | 4009 GaimConnection *gc = sess->aux_data; |
4820 | 4010 gchar who[16], *utf8; |
4759 | 4011 struct buddy *b; |
4012 va_list ap; | |
4013 struct aim_icq_info *info; | |
4014 | |
4015 va_start(ap, fr); | |
4016 info = va_arg(ap, struct aim_icq_info *); | |
4017 va_end(ap); | |
4018 | |
4822 | 4019 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_try_conv_to_utf8(info->nick))) { |
5556 | 4020 g_snprintf(who, sizeof(who), "%u", info->uin); |
4820 | 4021 serv_got_alias(gc, who, utf8); |
4759 | 4022 if ((b = gaim_find_buddy(gc->account, who))) { |
4820 | 4023 gaim_buddy_set_setting(b, "servernick", utf8); |
4759 | 4024 gaim_blist_save(); |
4025 } | |
4820 | 4026 g_free(utf8); |
4759 | 4027 } |
4028 | |
4029 return 1; | |
4030 } | |
4031 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4032 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4033 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4034 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4035 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4036 va_list ap; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4037 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4038 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4039 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4040 url = va_arg(ap, char *); |
4199 | 4041 wid = (fu16_t) va_arg(ap, int); |
4042 hei = (fu16_t) va_arg(ap, int); | |
4043 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4044 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4045 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4046 serv_got_popup(msg, url, wid, hei); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4047 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4048 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4049 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4050 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4051 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { |
5420 | 4052 GString *buf; |
2086 | 4053 va_list ap; |
4054 char *address, *SNs; | |
4055 int i, num; | |
4056 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4057 va_start(ap, fr); |
2086 | 4058 address = va_arg(ap, char *); |
4059 num = va_arg(ap, int); | |
4060 SNs = va_arg(ap, char *); | |
4061 va_end(ap); | |
4062 | |
5420 | 4063 buf = g_string_new(""); |
4064 g_string_printf(buf, _("<B>%s has the following screen names:</B><BR>"), address); | |
2086 | 4065 for (i = 0; i < num; i++) |
5420 | 4066 g_string_append_printf(buf, "%s<br>", &SNs[i * (MAXSNLEN + 1)]); |
4067 g_show_info_text(NULL, NULL, 2, buf->str, NULL); | |
4068 g_string_free(buf, TRUE); | |
2086 | 4069 |
4070 return 1; | |
4071 } | |
4072 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4073 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4074 va_list ap; |
4075 char *address; | |
5420 | 4076 char *buf; |
2086 | 4077 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4078 va_start(ap, fr); |
2086 | 4079 address = va_arg(ap, char *); |
4080 va_end(ap); | |
4081 | |
5420 | 4082 buf = g_strdup_printf(_("No results found for email address %s"), address); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4083 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 4084 g_free(buf); |
2086 | 4085 |
4086 return 1; | |
4087 } | |
4088 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4089 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4090 fu16_t status; |
2086 | 4091 va_list ap; |
4092 char msg[256]; | |
5575 | 4093 GaimConnection *gc = sess->aux_data; |
2086 | 4094 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4095 va_start(ap, fr); |
4199 | 4096 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 4097 va_end(ap); |
4098 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4099 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4100 "account confirmation returned status 0x%04x (%s)\n", status, |
3912 | 4101 status ? "unknown" : "email sent"); |
4102 if (!status) { | |
5302 | 4103 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
5575 | 4104 gaim_account_get_username(gaim_connection_get_account(gc))); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4105 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
2086 | 4106 } |
4107 | |
4108 return 1; | |
4109 } | |
4110 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4111 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4112 GaimConnection *gc = sess->aux_data; |
2086 | 4113 va_list ap; |
3912 | 4114 fu16_t perms, err; |
4115 char *url, *sn, *email; | |
4116 int change; | |
2086 | 4117 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4118 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4119 change = va_arg(ap, int); |
4199 | 4120 perms = (fu16_t) va_arg(ap, unsigned int); |
4121 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 4122 url = va_arg(ap, char *); |
4123 sn = va_arg(ap, char *); | |
4124 email = va_arg(ap, char *); | |
2086 | 4125 va_end(ap); |
4126 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4127 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4128 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
3912 | 4129 change ? "change" : "request", perms, err, url, sn, email); |
4130 | |
4131 if (err && url) { | |
4132 char *dialog_msg; | |
4133 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
4134 switch (err) { | |
4135 case 0x0001: { | |
4136 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
4137 } break; | |
4138 case 0x0006: { | |
4139 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
4140 } break; | |
4141 case 0x000b: { | |
4142 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
4143 } break; | |
4144 case 0x001d: { | |
4145 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because there is already a request pending for this screen name."), err); | |
4146 } break; | |
4147 case 0x0021: { | |
4148 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address has too many screen names associated with it."), err); | |
4149 } break; | |
4150 case 0x0023: { | |
4151 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
4152 } break; | |
4153 default: { | |
4154 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
4155 } break; | |
4156 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4157 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); |
3912 | 4158 g_free(dialog_top); |
4159 g_free(dialog_msg); | |
4160 return 1; | |
4161 } | |
4162 | |
4163 if (sn) { | |
4585 | 4164 char *dialog_msg = g_strdup_printf(_("Your screen name is currently formatted as follows:\n%s"), sn); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4165 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4166 g_free(dialog_msg); |
4167 } | |
4168 | |
4169 if (email) { | |
5575 | 4170 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), |
4171 gaim_account_get_username(gaim_connection_get_account(gc)), email); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4172 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4173 g_free(dialog_msg); |
2086 | 4174 } |
4175 | |
4176 return 1; | |
4177 } | |
4178 | |
5575 | 4179 static void oscar_keepalive(GaimConnection *gc) { |
4617 | 4180 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4181 aim_flap_nop(od->sess, od->conn); | |
2086 | 4182 } |
4183 | |
5575 | 4184 static int oscar_send_typing(GaimConnection *gc, char *name, int typing) { |
4617 | 4185 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4186 struct direct_im *dim = find_direct_im(od, name); | |
3595 | 4187 if (dim) |
4870 | 4188 if (typing == TYPING) |
4189 aim_odc_send_typing(od->sess, dim->conn, 0x0002); | |
4190 else if (typing == TYPED) | |
4191 aim_odc_send_typing(od->sess, dim->conn, 0x0001); | |
4192 else | |
4193 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
3595 | 4194 else { |
5300 | 4195 /* Don't send if this turkey is in our deny list */ |
4196 GSList *list; | |
4197 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); | |
4198 if (!list) { | |
4199 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name)); | |
4200 if (bi && bi->typingnot) { | |
4201 if (typing == TYPING) | |
4202 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); | |
4203 else if (typing == TYPED) | |
4204 aim_im_sendmtn(od->sess, 0x0001, name, 0x0001); | |
4205 else | |
4206 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); | |
4207 } | |
3595 | 4208 } |
4209 } | |
2993 | 4210 return 0; |
4211 } | |
5575 | 4212 static void oscar_ask_direct_im(GaimConnection *gc, const char *name); |
4213 | |
4214 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, int len, int imflags) { | |
4617 | 4215 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4216 struct direct_im *dim = find_direct_im(od, name); | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4217 int ret = 0; |
3659 | 4218 GError *err = NULL; |
5575 | 4219 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); |
3458 | 4220 |
4838 | 4221 if (dim && dim->connected) { |
4222 /* If we're directly connected, send a direct IM */ | |
4223 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ | |
4870 | 4224 if (imflags & IM_FLAG_AWAY) |
4225 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0, 1); | |
4226 else | |
4227 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0, 0); | |
3044 | 4228 } else if (len != -1) { |
4229 /* Trying to send an IM image outside of a direct connection. */ | |
4230 oscar_ask_direct_im(gc, name); | |
4838 | 4231 ret = -ENOTCONN; |
2086 | 4232 } else { |
4738 | 4233 struct buddyinfo *bi; |
3008 | 4234 struct aim_sendimext_args args; |
4235 struct stat st; | |
4151 | 4236 int len; |
4269 | 4237 |
4738 | 4238 bi = g_hash_table_lookup(od->buddyinfo, normalize(name)); |
4239 if (!bi) { | |
4240 bi = g_new0(struct buddyinfo, 1); | |
4241 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(name)), bi); | |
4242 } | |
4243 | |
3008 | 4244 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
4665 | 4245 if (od->icq) { |
4246 args.features = features_icq; | |
4247 args.featureslen = sizeof(features_icq); | |
3008 | 4248 args.flags |= AIM_IMFLAGS_OFFLINE; |
4665 | 4249 } else { |
4250 args.features = features_aim; | |
4251 args.featureslen = sizeof(features_aim); | |
4972 | 4252 |
4253 if (imflags & IM_FLAG_AWAY) | |
4254 args.flags |= AIM_IMFLAGS_AWAY; | |
4665 | 4255 } |
4269 | 4256 |
4738 | 4257 if (bi->ico_need) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4258 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4259 "Sending buddy icon request with message\n"); |
3008 | 4260 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4738 | 4261 bi->ico_need = FALSE; |
3008 | 4262 } |
4269 | 4263 |
5575 | 4264 if (iconfile && !stat(iconfile, &st)) { |
4265 FILE *file = fopen(iconfile, "r"); | |
3008 | 4266 if (file) { |
4267 char *buf = g_malloc(st.st_size); | |
4268 fread(buf, 1, st.st_size, file); | |
4269 | 4269 |
3008 | 4270 args.iconlen = st.st_size; |
4617 | 4271 args.iconsum = aimutil_iconsum(buf, st.st_size); |
3008 | 4272 args.iconstamp = st.st_mtime; |
4273 | |
4738 | 4274 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) |
4275 bi->ico_informed = FALSE; | |
4276 | |
4277 if (!bi->ico_informed) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4278 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4279 "Claiming to have a buddy icon\n"); |
4738 | 4280 args.flags |= AIM_IMFLAGS_HASICON; |
4281 bi->ico_me_len = args.iconlen; | |
4282 bi->ico_me_csum = args.iconsum; | |
4283 bi->ico_me_time = args.iconstamp; | |
4284 bi->ico_informed = TRUE; | |
4285 } | |
4286 | |
3008 | 4287 fclose(file); |
4288 g_free(buf); | |
2086 | 4289 } |
4290 } | |
4269 | 4291 |
3008 | 4292 args.destsn = name; |
4269 | 4293 |
3642 | 4294 len = strlen(message); |
5129 | 4295 args.flags |= oscar_encoding_check(message); |
3642 | 4296 if (args.flags & AIM_IMFLAGS_UNICODE) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4297 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode IM\n"); |
4662 | 4298 args.charset = 0x0002; |
4665 | 4299 args.charsubset = 0x0000; |
3659 | 4300 args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
4301 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4302 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4303 "Error converting a unicode message: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4304 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4305 "This really shouldn't happen!\n"); |
3659 | 4306 /* We really shouldn't try to send the |
4307 * IM now, but I'm not sure what to do */ | |
4800 | 4308 g_error_free(err); |
3659 | 4309 } |
3850 | 4310 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4311 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4312 "Sending ISO-8859-1 IM\n"); |
4662 | 4313 args.charset = 0x0003; |
4665 | 4314 args.charsubset = 0x0000; |
3659 | 4315 args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
4316 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4317 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4318 "conversion error: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4319 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4320 "Someone tell Ethan his 8859-1 detection is wrong\n"); |
3642 | 4321 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
4322 len = strlen(message); | |
4800 | 4323 g_error_free(err); |
3659 | 4324 args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
4325 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4326 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4327 "Error in unicode fallback: %s\n", err->message); |
4800 | 4328 g_error_free(err); |
3659 | 4329 } |
3642 | 4330 } |
4331 } else { | |
4662 | 4332 args.charset = 0x0000; |
4333 args.charsubset = 0x0000; | |
3642 | 4334 args.msg = message; |
4335 } | |
4336 args.msglen = len; | |
4269 | 4337 |
4617 | 4338 ret = aim_im_sendch1_ext(od->sess, &args); |
2086 | 4339 } |
4838 | 4340 |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4341 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4342 return 1; |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4343 return ret; |
2086 | 4344 } |
4345 | |
5575 | 4346 static void oscar_get_info(GaimConnection *g, const char *name) { |
4617 | 4347 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4348 if (od->icq) | |
4624 | 4349 aim_icq_getallinfo(od->sess, name); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4350 else |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4351 /* people want the away message on the top, so we get the away message |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4352 * first and then get the regular info, since it's too difficult to |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4353 * insert in the middle. i hate people. */ |
4617 | 4354 aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4355 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4356 |
5575 | 4357 static void oscar_get_away(GaimConnection *g, const char *who) { |
4617 | 4358 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4359 if (od->icq) { | |
4687 | 4360 struct buddy *budlight = gaim_find_buddy(g->account, who); |
3212 | 4361 if (budlight) |
3595 | 4362 if ((budlight->uc & 0xffff0000) >> 16) |
4687 | 4363 aim_im_sendch2_geticqaway(od->sess, who, (budlight->uc & 0xffff0000) >> 16); |
3212 | 4364 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4365 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4366 "Error: The user %s has no status message, therefore not requesting.\n", who); |
3212 | 4367 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4368 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4369 "Error: Could not find %s in local contact list, therefore unable to request status message.\n", who); |
3212 | 4370 } else |
4617 | 4371 aim_getinfo(od->sess, od->conn, who, AIM_GETINFO_GENERALINFO); |
2086 | 4372 } |
4373 | |
5575 | 4374 static void oscar_set_dir(GaimConnection *g, const char *first, const char *middle, const char *last, |
3466 | 4375 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4617 | 4376 /* XXX - some of these things are wrong, but i'm lazy */ |
4377 struct oscar_data *od = (struct oscar_data *)g->proto_data; | |
4378 aim_setdirectoryinfo(od->sess, od->conn, first, middle, last, | |
2086 | 4379 maiden, NULL, NULL, city, state, NULL, 0, web); |
4380 } | |
4381 | |
5575 | 4382 static void oscar_set_idle(GaimConnection *gc, int time) { |
5129 | 4383 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4617 | 4384 aim_bos_setidle(od->sess, od->conn, time); |
2086 | 4385 } |
4386 | |
5575 | 4387 static void oscar_set_info(GaimConnection *gc, char *text) { |
5129 | 4388 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4389 fu32_t flags = 0; | |
4390 char *msg = NULL; | |
4391 int msglen = 0; | |
2993 | 4392 |
4617 | 4393 if (od->rights.maxsiglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4394 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4395 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4396 "profile before the login procedure completed. " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4397 "Your profile remains unset; try setting it " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4398 "again when you are fully connected.")); |
4617 | 4399 |
4400 if (od->icq) | |
4401 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); | |
4151 | 4402 else { |
5129 | 4403 if (!text) { |
4404 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_aim); | |
4405 return; | |
4406 } | |
4407 | |
4408 flags = oscar_encoding_check(text); | |
4409 if (flags & AIM_IMFLAGS_UNICODE) { | |
4410 msg = g_convert(text, strlen(text), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
4411 aim_bos_setprofile(od->sess, od->conn, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); | |
4412 g_free(msg); | |
4413 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
4414 msg = g_convert(text, strlen(text), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
4415 aim_bos_setprofile(od->sess, od->conn, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); | |
4416 g_free(msg); | |
4151 | 4417 } else { |
5129 | 4418 msglen = strlen(text); |
4419 aim_bos_setprofile(od->sess, od->conn, "us-ascii", text, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); | |
4151 | 4420 } |
5129 | 4421 |
4422 if (msglen > od->rights.maxsiglen) { | |
4423 gchar *errstr; | |
4424 errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. " | |
4425 "Gaim has truncated it for you."), od->rights.maxsiglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4426 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); |
5129 | 4427 g_free(errstr); |
4428 } | |
4429 | |
4430 } | |
2993 | 4431 |
4432 return; | |
2086 | 4433 } |
4434 | |
5575 | 4435 static void oscar_set_away_aim(GaimConnection *gc, struct oscar_data *od, const char *text) |
2993 | 4436 { |
5129 | 4437 fu32_t flags = 0; |
4438 char *msg = NULL; | |
4439 int msglen = 0; | |
2993 | 4440 |
4441 if (od->rights.maxawaymsglen == 0) | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4442 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4443 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4444 "away message before the login procedure " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4445 "completed. You remain in a \"present\" " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4446 "state; try setting it again when you are " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4447 "fully connected.")); |
5129 | 4448 |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4449 if (gc->away) { |
2993 | 4450 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4451 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4452 } |
2993 | 4453 |
5129 | 4454 if (!text) { |
4151 | 4455 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, "", 0, caps_aim); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4456 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4457 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4458 |
5129 | 4459 flags = oscar_encoding_check(text); |
4460 if (flags & AIM_IMFLAGS_UNICODE) { | |
4461 msg = g_convert(text, strlen(text), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
4462 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "unicode-2-0", msg, | |
4463 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); | |
4464 g_free(msg); | |
4465 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
4466 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
4467 msg = g_convert(text, strlen(text), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
4468 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "iso-8859-1", msg, | |
4469 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); | |
4470 g_free(msg); | |
4471 gc->away = g_strndup(text, od->rights.maxawaymsglen); | |
4472 } else { | |
4473 msglen = strlen(text); | |
4474 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", text, | |
4475 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); | |
4476 gc->away = g_strndup(text, od->rights.maxawaymsglen); | |
4477 } | |
4478 | |
4479 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 4480 gchar *errstr; |
4481 | |
5129 | 4482 errstr = g_strdup_printf(_("The maximum away message length of %d bytes has been exceeded. " |
3427 | 4483 "Gaim has truncated it and set you away."), od->rights.maxawaymsglen); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4484 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); |
2993 | 4485 g_free(errstr); |
4486 } | |
4487 | |
4488 return; | |
4489 } | |
4490 | |
5575 | 4491 static void oscar_set_away_icq(GaimConnection *gc, struct oscar_data *od, const char *state, const char *message) |
2993 | 4492 { |
5575 | 4493 GaimAccount *account = gaim_connection_get_account(gc); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4494 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4495 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4496 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4497 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4498 |
4342 | 4499 if (strcmp(state, _("Invisible"))) { |
5575 | 4500 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
4501 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); | |
4502 account->perm_deny = 4; | |
4342 | 4503 } else { |
5542 | 4504 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)) |
4889 | 4505 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); |
5575 | 4506 account->perm_deny = 3; |
4342 | 4507 } |
4508 | |
4509 if (!strcmp(state, _("Online"))) | |
4901 | 4510 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 4511 else if (!strcmp(state, _("Away"))) { |
4901 | 4512 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4513 gc->away = g_strdup(""); |
4342 | 4514 } else if (!strcmp(state, _("Do Not Disturb"))) { |
4901 | 4515 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4516 gc->away = g_strdup(""); |
4342 | 4517 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 4518 aim_setextstatus(od->sess, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4519 gc->away = g_strdup(""); |
4342 | 4520 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 4521 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4522 gc->away = g_strdup(""); |
4342 | 4523 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 4524 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4525 gc->away = g_strdup(""); |
4342 | 4526 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 4527 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4528 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4529 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 4530 if (message) { |
4901 | 4531 aim_setextstatus(od->sess, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4532 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4533 } else { |
4901 | 4534 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4535 } |
2086 | 4536 } |
2993 | 4537 |
4538 return; | |
4539 } | |
4540 | |
5575 | 4541 static void oscar_set_away(GaimConnection *gc, char *state, char *message) |
2993 | 4542 { |
4543 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4544 | |
4545 if (od->icq) | |
4546 oscar_set_away_icq(gc, od, state, message); | |
4547 else | |
4548 oscar_set_away_aim(gc, od, message); | |
4549 | |
4550 return; | |
2086 | 4551 } |
4552 | |
5575 | 4553 static void oscar_warn(GaimConnection *gc, char *name, int anon) { |
4617 | 4554 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4555 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); | |
2086 | 4556 } |
4557 | |
5575 | 4558 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, |
3466 | 4559 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
4617 | 4560 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 4561 if (strlen(email)) |
4617 | 4562 aim_usersearch_address(od->sess, od->conn, email); |
2086 | 4563 } |
4564 | |
5575 | 4565 static void oscar_add_buddy(GaimConnection *gc, const char *name) { |
4230 | 4566 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4567 #ifdef NOSSI | |
4568 aim_add_buddy(od->sess, od->conn, name); | |
4569 #else | |
4570 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | |
4687 | 4571 struct buddy *buddy = gaim_find_buddy(gc->account, name); |
4572 struct group *group = gaim_find_buddys_group(buddy); | |
4230 | 4573 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4574 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4575 "ssi: adding buddy %s to group %s\n", name, group->name); |
4889 | 4576 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4577 } |
4578 } | |
4579 #endif | |
4759 | 4580 if (od->icq) |
4581 aim_icq_getalias(od->sess, name); | |
4230 | 4582 } |
4583 | |
5575 | 4584 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
4230 | 4585 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4586 #ifdef NOSSI | |
4587 char buf[MSG_LEN]; | |
4588 int n=0; | |
4589 while (buddies) { | |
4590 if (n > MSG_LEN - 18) { | |
4591 aim_bos_setbuddylist(od->sess, od->conn, buf); | |
4592 n = 0; | |
3092 | 4593 } |
4230 | 4594 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); |
4595 buddies = buddies->next; | |
4596 } | |
4597 aim_bos_setbuddylist(od->sess, od->conn, buf); | |
4598 #else | |
4599 if (od->sess->ssi.received_data) { | |
4600 while (buddies) { | |
4687 | 4601 struct buddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data); |
4602 struct group *group = gaim_find_buddys_group(buddy); | |
4230 | 4603 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4604 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4605 "ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name); |
4889 | 4606 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4607 } |
4608 buddies = buddies->next; | |
4609 } | |
4610 } | |
4611 #endif | |
4612 } | |
4613 | |
5575 | 4614 static void oscar_remove_buddy(GaimConnection *gc, char *name, char *group) { |
4230 | 4615 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4616 #ifdef NOSSI | |
4617 aim_remove_buddy(od->sess, od->conn, name); | |
4618 #else | |
4619 if (od->sess->ssi.received_data) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4620 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4621 "ssi: deleting buddy %s from group %s\n", name, group); |
4889 | 4622 aim_ssi_delbuddy(od->sess, name, group); |
4230 | 4623 } |
4624 #endif | |
4625 } | |
4626 | |
5575 | 4627 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
4230 | 4628 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4629 #ifdef NOSSI | |
4630 GList *cur; | |
4631 for (cur=buddies; cur; cur=cur->next) | |
4632 aim_remove_buddy(od->sess, od->conn, cur->data); | |
4633 #else | |
4634 if (od->sess->ssi.received_data) { | |
3092 | 4635 while (buddies) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4636 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4637 "ssi: deleting buddy %s from group %s\n", (char *)buddies->data, group); |
4889 | 4638 aim_ssi_delbuddy(od->sess, buddies->data, group); |
3092 | 4639 buddies = buddies->next; |
4640 } | |
4230 | 4641 } |
4642 #endif | |
4643 } | |
4644 | |
4645 #ifndef NOSSI | |
5575 | 4646 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
4269 | 4647 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4303 | 4648 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4649 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4650 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 4651 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 4652 } |
4653 } | |
4654 | |
5575 | 4655 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
4269 | 4656 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4657 if (od->sess->ssi.received_data) { | |
4658 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
4659 if (gname) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4660 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4661 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4889 | 4662 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 4663 } |
4664 } | |
4665 } | |
4666 | |
5575 | 4667 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { |
4230 | 4668 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4669 | |
4670 if (od->sess->ssi.received_data) { | |
4671 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | |
4672 oscar_remove_buddies(g, members, old_group); | |
4673 oscar_add_buddies(g, members); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4674 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4675 "ssi: moved all buddies from group %s to %s\n", old_group, new_group); |
4230 | 4676 } else { |
4889 | 4677 aim_ssi_rename_group(od->sess, old_group, new_group); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4678 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4679 "ssi: renamed group %s to %s\n", old_group, new_group); |
2995 | 4680 } |
4681 } | |
4682 } | |
4683 | |
4642 | 4684 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4685 GaimConnection *gc = sess->aux_data; |
4642 | 4686 struct oscar_data *od = gc->proto_data; |
4687 va_list ap; | |
4688 fu16_t reason; | |
4689 | |
4690 va_start(ap, fr); | |
4691 reason = (fu16_t)va_arg(ap, unsigned int); | |
4692 va_end(ap); | |
4693 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4694 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); |
4642 | 4695 |
4696 if (reason == 0x0005) { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4697 gaim_notify_error(gc, NULL, _("Unable To Retrive Buddy List"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4698 _("Gaim was temporarily unable to retrive your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours.")); |
4642 | 4699 } |
4700 | |
4701 /* Activate SSI */ | |
4702 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4703 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4704 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4705 "ssi: activating server-stored buddy list\n"); |
4642 | 4706 aim_ssi_enable(od->sess); |
4707 | |
4708 return 1; | |
4709 } | |
4710 | |
2991 | 4711 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4712 GaimConnection *gc = sess->aux_data; |
4230 | 4713 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4714 int numtypes, i; | |
4715 fu16_t *maxitems; | |
2991 | 4716 va_list ap; |
4717 | |
4718 va_start(ap, fr); | |
4230 | 4719 numtypes = va_arg(ap, int); |
4720 maxitems = va_arg(ap, fu16_t *); | |
2991 | 4721 va_end(ap); |
4722 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4723 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ssi rights:"); |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4724 |
4230 | 4725 for (i=0; i<numtypes; i++) |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4726 gaim_debug(GAIM_DEBUG_MISC, NULL, " max type 0x%04x=%hd,", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4727 i, maxitems[i]); |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4728 |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4729 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
4230 | 4730 |
4731 if (numtypes >= 0) | |
4732 od->rights.maxbuddies = maxitems[0]; | |
4733 if (numtypes >= 1) | |
4734 od->rights.maxgroups = maxitems[1]; | |
4735 if (numtypes >= 2) | |
4736 od->rights.maxpermits = maxitems[2]; | |
4737 if (numtypes >= 3) | |
4738 od->rights.maxdenies = maxitems[3]; | |
2991 | 4739 |
4740 return 1; | |
4741 } | |
4742 | |
4743 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4744 GaimConnection *gc = sess->aux_data; |
4745 GaimAccount *account = gaim_connection_get_account(gc); | |
4230 | 4746 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 4747 struct aim_ssi_item *curitem; |
2991 | 4748 int tmp; |
4778 | 4749 gboolean export = FALSE; |
4617 | 4750 /* XXX - use these? |
4230 | 4751 va_list ap; |
4752 | |
4753 va_start(ap, fr); | |
4754 fmtver = (fu16_t)va_arg(ap, int); | |
4755 numitems = (fu16_t)va_arg(ap, int); | |
4756 items = va_arg(ap, struct aim_ssi_item); | |
4757 timestamp = va_arg(ap, fu32_t); | |
4758 va_end(ap); */ | |
2991 | 4759 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4760 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4761 "ssi: syncing local list and server list\n"); |
2991 | 4762 |
4763 /* Clean the buddy list */ | |
4889 | 4764 aim_ssi_cleanlist(sess); |
2991 | 4765 |
4766 /* Add from server list to local list */ | |
4230 | 4767 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
2991 | 4768 switch (curitem->type) { |
4230 | 4769 case 0x0000: { /* Buddy */ |
4251 | 4770 if (curitem->name) { |
4292 | 4771 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
4458 | 4772 char *gname_utf8 = gaim_try_conv_to_utf8(gname); |
4282 | 4773 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
4458 | 4774 char *alias_utf8 = gaim_try_conv_to_utf8(alias); |
4687 | 4775 struct buddy *buddy = gaim_find_buddy(gc->account, curitem->name); |
4458 | 4776 /* Should gname be freed here? -- elb */ |
4754 | 4777 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 4778 free(alias); |
4282 | 4779 if (buddy) { |
4292 | 4780 /* Get server stored alias */ |
4705 | 4781 if (alias_utf8) { |
4782 g_free(buddy->alias); | |
4783 buddy->alias = g_strdup(alias_utf8); | |
4784 } | |
4282 | 4785 } else { |
4687 | 4786 struct group *g; |
4787 buddy = gaim_buddy_new(gc->account, curitem->name, alias_utf8); | |
5146 | 4788 |
4754 | 4789 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 4790 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 4791 gaim_blist_add_group(g, NULL); |
4792 } | |
5146 | 4793 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4794 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4795 "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
4687 | 4796 gaim_blist_add_buddy(buddy, g, NULL); |
4778 | 4797 export = TRUE; |
4251 | 4798 } |
4458 | 4799 free(gname_utf8); |
4800 free(alias_utf8); | |
2991 | 4801 } |
4230 | 4802 } break; |
4803 | |
4804 case 0x0001: { /* Group */ | |
4282 | 4805 /* Shouldn't add empty groups */ |
4230 | 4806 } break; |
4807 | |
4808 case 0x0002: { /* Permit buddy */ | |
2991 | 4809 if (curitem->name) { |
4230 | 4810 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 4811 GSList *list; |
5575 | 4812 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4813 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4814 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4815 "ssi: adding permit buddy %s to local list\n", curitem->name); |
5575 | 4816 gaim_privacy_permit_add(account, curitem->name); |
2991 | 4817 build_allow_list(); |
4778 | 4818 export = TRUE; |
2991 | 4819 } |
4820 } | |
4230 | 4821 } break; |
4822 | |
4823 case 0x0003: { /* Deny buddy */ | |
2991 | 4824 if (curitem->name) { |
4825 GSList *list; | |
5575 | 4826 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4827 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4828 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4829 "ssi: adding deny buddy %s to local list\n", curitem->name); |
5575 | 4830 gaim_privacy_deny_add(account, curitem->name); |
2991 | 4831 build_block_list(); |
4778 | 4832 export = TRUE; |
2991 | 4833 } |
4834 } | |
4230 | 4835 } break; |
4836 | |
4837 case 0x0004: { /* Permit/deny setting */ | |
2991 | 4838 if (curitem->data) { |
4839 fu8_t permdeny; | |
5575 | 4840 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != account->perm_deny)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4841 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5575 | 4842 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
4843 account->perm_deny = permdeny; | |
4844 if (od->icq && account->perm_deny == 0x03) { | |
4342 | 4845 serv_set_away(gc, "Invisible", ""); |
4846 } | |
4778 | 4847 export = TRUE; |
2991 | 4848 } |
4849 } | |
4230 | 4850 } break; |
4851 | |
4852 case 0x0005: { /* Presence setting */ | |
3109 | 4853 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 4854 } break; |
2991 | 4855 } /* End of switch on curitem->type */ |
4856 } /* End of for loop */ | |
4230 | 4857 |
4858 /* If changes were made, then flush buddy list to file */ | |
4778 | 4859 if (export) |
4349 | 4860 gaim_blist_save(); |
2991 | 4861 |
4759 | 4862 { /* Add from local list to server list */ |
4863 GaimBlistNode *gnode, *bnode; | |
4864 struct group *group; | |
4865 struct buddy *buddy; | |
4866 struct gaim_buddy_list *blist; | |
3017 | 4867 GSList *cur; |
4868 | |
2991 | 4869 /* Buddies */ |
4759 | 4870 if ((blist = gaim_get_blist())) |
4871 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
5234 | 4872 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
4873 continue; | |
4759 | 4874 group = (struct group *)gnode; |
4875 for (bnode = gnode->child; bnode; bnode = bnode->next) { | |
5234 | 4876 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) |
4877 continue; | |
4759 | 4878 buddy = (struct buddy *)bnode; |
4879 if (buddy->account == gc->account) { | |
4880 gchar *servernick = gaim_buddy_get_setting(buddy, "servernick"); | |
4881 if (servernick) { | |
4882 serv_got_alias(gc, buddy->name, servernick); | |
4883 g_free(servernick); | |
4884 } | |
4885 if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) { | |
4886 /* Store local alias on server */ | |
4887 char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name); | |
4783 | 4888 if (!alias && buddy->alias && strlen(buddy->alias)) |
4889 | 4889 aim_ssi_aliasbuddy(sess, group->name, buddy->name, buddy->alias); |
4759 | 4890 free(alias); |
4891 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4892 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4893 "ssi: adding buddy %s from local list to server list\n", buddy->name); |
4889 | 4894 aim_ssi_addbuddy(sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4759 | 4895 } |
4349 | 4896 } |
4230 | 4897 } |
4292 | 4898 } |
2991 | 4899 /* Permit list */ |
4491 | 4900 if (gc->account->permit) { |
4901 for (cur=gc->account->permit; cur; cur=cur->next) | |
4230 | 4902 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4903 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4904 "ssi: adding permit %s from local list to server list\n", (char *)cur->data); |
4889 | 4905 aim_ssi_addpermit(sess, cur->data); |
4230 | 4906 } |
2991 | 4907 } |
4908 | |
4909 /* Deny list */ | |
4491 | 4910 if (gc->account->deny) { |
4911 for (cur=gc->account->deny; cur; cur=cur->next) | |
4230 | 4912 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4913 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4914 "ssi: adding deny %s from local list to server list\n", (char *)cur->data); |
4889 | 4915 aim_ssi_adddeny(sess, cur->data); |
4230 | 4916 } |
2991 | 4917 } |
3109 | 4918 /* Presence settings (idle time visibility) */ |
4230 | 4919 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) |
3109 | 4920 if (report_idle && !(tmp & 0x400)) |
4889 | 4921 aim_ssi_setpresence(sess, tmp | 0x400); |
4778 | 4922 } /* end adding buddies from local list to server list */ |
4923 | |
4901 | 4924 /* Set our ICQ status */ |
4925 if (od->icq && !gc->away) { | |
4926 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); | |
4927 } | |
4928 | |
4342 | 4929 /* Activate SSI */ |
4930 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4931 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4932 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4933 "ssi: activating server-stored buddy list\n"); |
4642 | 4934 aim_ssi_enable(sess); |
4342 | 4935 |
2991 | 4936 return 1; |
2086 | 4937 } |
4230 | 4938 |
4939 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4940 GaimConnection *gc = sess->aux_data; |
4230 | 4941 va_list ap; |
4942 struct aim_ssi_tmp *retval; | |
4943 | |
4944 va_start(ap, fr); | |
4945 retval = va_arg(ap, struct aim_ssi_tmp *); | |
4946 va_end(ap); | |
4947 | |
4948 while (retval) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4949 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4950 "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack, retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item"); |
4230 | 4951 |
4952 if (retval->ack != 0xffff) | |
4953 switch (retval->ack) { | |
4954 case 0x0000: { /* added successfully */ | |
4955 } break; | |
4956 | |
4829 | 4957 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
4958 gchar *buf; | |
4959 buf = g_strdup_printf(_("Could not add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)"))); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4960 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4829 | 4961 g_free(buf); |
4962 } | |
4963 | |
4230 | 4964 case 0x000e: { /* contact requires authorization */ |
4828 | 4965 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 4966 gaim_auth_sendrequest(gc, retval->name); |
4230 | 4967 } break; |
4968 | |
4969 default: { /* La la la */ | |
5197 | 4970 gchar *buf; |
5402 | 4971 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
4972 buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason. The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)"))); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4973 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5197 | 4974 g_free(buf); |
5402 | 4975 /* XXX - Should remove buddy from local list */ |
4230 | 4976 } break; |
4977 } | |
4978 | |
4979 retval = retval->next; | |
4980 } | |
4981 | |
4982 return 1; | |
4983 } | |
4984 | |
4985 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4986 GaimConnection *gc = sess->aux_data; |
4230 | 4987 va_list ap; |
4988 char *sn, *msg; | |
4236 | 4989 gchar *dialog_msg, *nombre; |
4230 | 4990 struct name_data *data; |
4236 | 4991 struct buddy *buddy; |
4230 | 4992 |
4993 va_start(ap, fr); | |
4994 sn = va_arg(ap, char *); | |
4995 msg = va_arg(ap, char *); | |
4996 va_end(ap); | |
4997 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4998 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4999 "ssi: %s has given you permission to add him to your buddy list\n", sn); |
4230 | 5000 |
4687 | 5001 buddy = gaim_find_buddy(gc->account, sn); |
5002 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5003 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5004 else |
5005 nombre = g_strdup(sn); | |
5006 | |
5007 dialog_msg = g_strdup_printf(_("The user %s has given you permission to add you to their buddy list. Do you want to add them?"), nombre); | |
4230 | 5008 data = g_new(struct name_data, 1); |
5009 data->gc = gc; | |
5010 data->name = g_strdup(sn); | |
5011 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5012 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5013 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5014 0, data, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5015 G_CALLBACK(gaim_icq_contactadd), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5016 G_CALLBACK(gaim_free_name_data)); |
4236 | 5017 |
4230 | 5018 g_free(dialog_msg); |
4236 | 5019 g_free(nombre); |
4230 | 5020 |
5021 return 1; | |
5022 } | |
5023 | |
5024 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5025 GaimConnection *gc = sess->aux_data; |
4230 | 5026 va_list ap; |
5027 char *sn, *msg; | |
4236 | 5028 gchar *dialog_msg, *nombre; |
4230 | 5029 struct name_data *data; |
4236 | 5030 struct buddy *buddy; |
4230 | 5031 |
5032 va_start(ap, fr); | |
5033 sn = va_arg(ap, char *); | |
5034 msg = va_arg(ap, char *); | |
5035 va_end(ap); | |
5036 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5037 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5038 "ssi: received authorization request from %s\n", sn); |
4230 | 5039 |
4687 | 5040 buddy = gaim_find_buddy(gc->account, sn); |
5041 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5042 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5043 else |
5044 nombre = g_strdup(sn); | |
5045 | |
4337 | 5046 dialog_msg = g_strdup_printf(_("The user %s wants to add you to their buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); |
4230 | 5047 data = g_new(struct name_data, 1); |
5048 data->gc = gc; | |
5049 data->name = g_strdup(sn); | |
5050 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5051 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5052 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5053 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5054 _("Authorize"), G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5055 _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4236 | 5056 |
4230 | 5057 g_free(dialog_msg); |
4236 | 5058 g_free(nombre); |
4230 | 5059 |
5060 return 1; | |
5061 } | |
5062 | |
5063 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5064 GaimConnection *gc = sess->aux_data; |
4230 | 5065 va_list ap; |
5066 char *sn, *msg; | |
4236 | 5067 gchar *dialog_msg, *nombre; |
4230 | 5068 fu8_t reply; |
4236 | 5069 struct buddy *buddy; |
4230 | 5070 |
5071 va_start(ap, fr); | |
5072 sn = va_arg(ap, char *); | |
5073 reply = (fu8_t)va_arg(ap, int); | |
5074 msg = va_arg(ap, char *); | |
5075 va_end(ap); | |
5076 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5077 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5078 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4236 | 5079 |
4687 | 5080 buddy = gaim_find_buddy(gc->account, sn); |
5081 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5082 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5083 else |
5084 nombre = g_strdup(sn); | |
5085 | |
4230 | 5086 if (reply) { |
5087 /* Granted */ | |
4236 | 5088 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your contact list."), nombre); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5089 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); |
4230 | 5090 } else { |
5091 /* Denied */ | |
4236 | 5092 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your contact list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5093 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); |
4230 | 5094 } |
5095 g_free(dialog_msg); | |
4236 | 5096 g_free(nombre); |
4230 | 5097 |
5098 return 1; | |
5099 } | |
5100 | |
5101 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5102 GaimConnection *gc = sess->aux_data; |
4230 | 5103 va_list ap; |
5104 char *sn; | |
4236 | 5105 struct buddy *buddy; |
4230 | 5106 |
5107 va_start(ap, fr); | |
5108 sn = va_arg(ap, char *); | |
5109 va_end(ap); | |
5110 | |
4687 | 5111 buddy = gaim_find_buddy(gc->account, sn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5112 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5113 "ssi: %s added you to their buddy list\n", sn); |
4687 | 5114 show_got_added(gc, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 5115 |
5116 return 1; | |
5117 } | |
4269 | 5118 #endif |
2086 | 5119 |
5575 | 5120 static GList *oscar_chat_info(GaimConnection *gc) { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5121 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5122 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5123 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5124 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5125 pce->label = _("Join what group:"); |
5234 | 5126 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5127 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5128 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5129 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5130 pce->label = _("Exchange:"); |
5234 | 5131 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5132 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5133 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5134 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5135 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5136 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5137 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5138 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5139 |
5575 | 5140 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { |
4617 | 5141 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5142 aim_conn_t *cur; |
5234 | 5143 char *name, *exchange; |
5144 | |
5145 name = g_hash_table_lookup(data, "room"); | |
5146 exchange = g_hash_table_lookup(data, "exchange"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5147 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5148 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5149 "Attempting to join chat room %s.\n", name); |
4617 | 5150 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5151 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5152 "chatnav exists, creating room\n"); |
5234 | 5153 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); |
2086 | 5154 } else { |
5155 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5156 struct create_room *cr = g_new0(struct create_room, 1); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5157 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5158 "chatnav does not exist, opening chatnav\n"); |
5234 | 5159 cr->exchange = atoi(exchange); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5160 cr->name = g_strdup(name); |
4617 | 5161 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5162 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 5163 } |
5164 } | |
5165 | |
5575 | 5166 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { |
4617 | 5167 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2086 | 5168 struct chat_connection *ccon = find_oscar_chat(g, id); |
5169 | |
5170 if (!ccon) | |
5171 return; | |
5172 | |
4617 | 5173 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
2086 | 5174 ccon->exchange, ccon->name, 0x0); |
5175 } | |
5176 | |
5575 | 5177 static void oscar_chat_leave(GaimConnection *g, int id) { |
4617 | 5178 struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL; |
2086 | 5179 GSList *bcs = g->buddy_chats; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5180 struct gaim_conversation *b = NULL; |
2086 | 5181 struct chat_connection *c = NULL; |
5182 int count = 0; | |
5183 | |
5184 while (bcs) { | |
5185 count++; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5186 b = (struct gaim_conversation *)bcs->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5187 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 5188 break; |
5189 bcs = bcs->next; | |
5190 b = NULL; | |
5191 } | |
5192 | |
5193 if (!b) | |
5194 return; | |
5195 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5196 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5197 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); |
2086 | 5198 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5199 c = find_oscar_chat(g, gaim_chat_get_id(GAIM_CHAT(b))); |
2086 | 5200 if (c != NULL) { |
4617 | 5201 if (od) |
5202 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 5203 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5204 gaim_input_remove(c->inpa); |
4617 | 5205 if (g && od->sess) |
5206 aim_conn_kill(od->sess, &c->conn); | |
2086 | 5207 g_free(c->name); |
5208 g_free(c->show); | |
5209 g_free(c); | |
5210 } | |
5211 /* we do this because with Oscar it doesn't tell us we left */ | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5212 serv_got_chat_left(g, gaim_chat_get_id(GAIM_CHAT(b))); |
2086 | 5213 } |
5214 | |
5575 | 5215 static int oscar_chat_send(GaimConnection *g, int id, char *message) { |
4617 | 5216 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2086 | 5217 GSList *bcs = g->buddy_chats; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5218 struct gaim_conversation *b = NULL; |
2086 | 5219 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5220 char *buf, *buf2; |
2086 | 5221 int i, j; |
5222 | |
5223 while (bcs) { | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5224 b = (struct gaim_conversation *)bcs->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5225 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 5226 break; |
5227 bcs = bcs->next; | |
5228 b = NULL; | |
5229 } | |
5230 if (!b) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5231 return -EINVAL; |
2086 | 5232 |
4617 | 5233 bcs = od->oscar_chats; |
2086 | 5234 while (bcs) { |
5235 c = (struct chat_connection *)bcs->data; | |
5236 if (b == c->cnv) | |
5237 break; | |
5238 bcs = bcs->next; | |
5239 c = NULL; | |
5240 } | |
5241 if (!c) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5242 return -EINVAL; |
2086 | 5243 |
5244 buf = g_malloc(strlen(message) * 4 + 1); | |
5245 for (i = 0, j = 0; i < strlen(message); i++) { | |
5246 if (message[i] == '\n') { | |
5247 buf[j++] = '<'; | |
5248 buf[j++] = 'B'; | |
5249 buf[j++] = 'R'; | |
5250 buf[j++] = '>'; | |
5251 } else { | |
5252 buf[j++] = message[i]; | |
5253 } | |
5254 } | |
5255 buf[j] = '\0'; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5256 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5257 if (strlen(buf) > c->maxlen) |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5258 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5259 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5260 buf2 = strip_html(buf); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5261 if (strlen(buf2) > c->maxvis) { |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5262 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5263 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5264 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5265 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5266 |
4617 | 5267 aim_chat_send_im(od->sess, c->conn, 0, buf, strlen(buf)); |
2086 | 5268 g_free(buf); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5269 return 0; |
2086 | 5270 } |
5271 | |
5575 | 5272 static const char *oscar_list_icon(GaimAccount *a, struct buddy *b) { |
4766 | 5273 if (!b || (b && b->name && b->name[0] == '+')) { |
4687 | 5274 if (isdigit(a->username[0])) |
5275 return "icq"; | |
5276 else | |
5277 return "aim"; | |
5278 } | |
5279 | |
5280 if (isdigit(b->name[0])) | |
5281 return "icq"; | |
5282 return "aim"; | |
5283 } | |
5284 | |
4690 | 5285 static void oscar_list_emblems(struct buddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 5286 { |
5287 char *emblems[4] = {NULL,NULL,NULL,NULL}; | |
5288 int i = 0; | |
5289 | |
5131 | 5290 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5575 | 5291 GaimAccount *account; |
5292 GaimConnection *gc; | |
5131 | 5293 struct oscar_data *od; |
5294 char *gname; | |
5295 if ((b->name) && (account = b->account) && (gc = account->gc) && | |
5296 (od = gc->proto_data) && (od->sess->ssi.received_data) && | |
5297 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && | |
5298 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
5299 emblems[i++] = "notauthorized"; | |
5300 } else { | |
5301 emblems[i++] = "offline"; | |
5302 } | |
5303 } | |
4916 | 5304 |
4766 | 5305 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 5306 int uc = b->uc >> 16; |
4766 | 5307 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 5308 emblems[i++] = "invisible"; |
4766 | 5309 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 5310 emblems[i++] = "freeforchat"; |
4766 | 5311 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 5312 emblems[i++] = "dnd"; |
4766 | 5313 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 5314 emblems[i++] = "na"; |
4766 | 5315 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 5316 emblems[i++] = "occupied"; |
4766 | 5317 else if (uc & AIM_ICQ_STATE_AWAY) |
5318 emblems[i++] = "away"; | |
5319 } else { | |
5320 if (b->uc & UC_UNAVAILABLE) | |
5321 emblems[i++] = "away"; | |
5322 } | |
4687 | 5323 if (b->uc & UC_WIRELESS) |
5324 emblems[i++] = "wireless"; | |
5325 if (b->uc & UC_AOL) | |
5326 emblems[i++] = "aol"; | |
5327 if (b->uc & UC_ADMIN) | |
5328 emblems[i++] = "admin"; | |
5329 if (b->uc & UC_AB && i < 4) | |
5330 emblems[i++] = "activebuddy"; | |
4766 | 5331 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
5332 emblems[i++] = "unconfirmed"; */ | |
4687 | 5333 *se = emblems[0]; |
5334 *sw = emblems[1]; | |
5335 *nw = emblems[2]; | |
5336 *ne = emblems[3]; | |
5337 } | |
5338 | |
5131 | 5339 static char *oscar_tooltip_text(struct buddy *b) { |
5575 | 5340 GaimConnection *gc = b->account->gc; |
5131 | 5341 struct oscar_data *od = gc->proto_data; |
5342 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); | |
5343 gchar *tmp, *yay = g_strdup(""); | |
5344 | |
5345 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
5346 if (isdigit(b->name[0])) { | |
5347 char *tmp, *status; | |
5348 status = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
5349 tmp = yay; | |
5350 yay = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); | |
5351 g_free(tmp); | |
5352 g_free(status); | |
5353 } | |
5354 | |
5355 if (bi) { | |
5356 char *tstr = sec_to_text(time(NULL) - bi->signon + | |
5357 (gc->login_time_official ? gc->login_time_official - gc->login_time : 0)); | |
5358 tmp = yay; | |
5359 yay = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL); | |
5360 free(tmp); | |
5361 free(tstr); | |
5362 | |
5363 if (bi->caps) { | |
5364 char *caps = caps_string(bi->caps); | |
5365 tmp = yay; | |
5366 yay = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); | |
5367 free(tmp); | |
5368 } | |
5369 } | |
5370 } else { | |
5371 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
5372 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { | |
5373 tmp = yay; | |
5374 yay = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); | |
5375 g_free(tmp); | |
5376 } else { | |
5377 tmp = yay; | |
5378 yay = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); | |
5379 g_free(tmp); | |
5380 } | |
5381 } | |
5382 | |
5383 /* remove the trailing newline character */ | |
5384 if (yay) | |
5385 yay[strlen(yay)-1] = '\0'; | |
5386 return yay; | |
5387 } | |
5388 | |
5167 | 5389 static char *oscar_status_text(struct buddy *b) { |
5575 | 5390 GaimConnection *gc = b->account->gc; |
5167 | 5391 struct oscar_data *od = gc->proto_data; |
5392 gchar *ret = NULL; | |
5393 | |
5394 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | |
5395 if (isdigit(b->name[0])) | |
5396 ret = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
5397 else | |
5398 ret = g_strdup(_("Away")); | |
5399 } else if (!GAIM_BUDDY_IS_ONLINE(b)) { | |
5400 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
5401 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) | |
5402 ret = g_strdup(_("Not Authorized")); | |
5403 else | |
5404 ret = g_strdup(_("Offline")); | |
5405 } | |
5406 | |
5407 return ret; | |
5408 } | |
5409 | |
3952 | 5410 /* |
4617 | 5411 * We have just established a socket with the other dude, so set up some handlers. |
3952 | 5412 */ |
4617 | 5413 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5414 GaimConnection *gc = sess->aux_data; |
2086 | 5415 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5416 struct gaim_conversation *cnv; |
2086 | 5417 struct direct_im *dim; |
5418 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5419 char *sn; |
4617 | 5420 va_list ap; |
5421 aim_conn_t *newconn, *listenerconn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5422 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5423 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5424 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5425 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 5426 va_end(ap); |
5427 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5428 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5429 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5430 |
4617 | 5431 sn = g_strdup(aim_odc_getsn(newconn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5432 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5433 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5434 "DirectIM: initiate success to %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5435 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5436 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5437 if (!(cnv = gaim_find_conversation(sn))) |
4491 | 5438 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5439 gaim_input_remove(dim->watcher); |
2086 | 5440 dim->conn = newconn; |
4617 | 5441 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
3008 | 5442 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5443 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5444 g_free(sn); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5445 gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); |
2086 | 5446 |
4617 | 5447 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); |
5448 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
5449 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_update_ui, 0); | |
5450 | |
2993 | 5451 return 1; |
5452 } | |
5453 | |
5454 static int gaim_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5455 va_list ap; | |
5456 char *sn; | |
5457 double percent; | |
5575 | 5458 GaimConnection *gc = sess->aux_data; |
2993 | 5459 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5460 struct gaim_conversation *c; |
2993 | 5461 struct direct_im *dim; |
5462 | |
5463 va_start(ap, fr); | |
5464 sn = va_arg(ap, char *); | |
5465 percent = va_arg(ap, double); | |
5466 va_end(ap); | |
5467 | |
2994 | 5468 if (!(dim = find_direct_im(od, sn))) |
5469 return 1; | |
3059 | 5470 if (dim->watcher) { |
5471 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
5472 dim->watcher = 0; | |
5473 } | |
3044 | 5474 while (gtk_events_pending()) |
5475 gtk_main_iteration(); | |
5476 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5477 if ((c = gaim_find_conversation(sn))) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5478 gaim_conversation_update_progress(c, percent); |
2993 | 5479 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
5480 oscar_callback, dim->conn); | |
2086 | 5481 |
5482 return 1; | |
5483 } | |
5484 | |
4617 | 5485 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5486 GaimConnection *gc = sess->aux_data; |
4870 | 5487 int imflags = 0; |
2086 | 5488 va_list ap; |
4870 | 5489 char *sn, *msg; |
5490 int len, encoding, isawaymsg; | |
2086 | 5491 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5492 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5493 sn = va_arg(ap, char *); |
2086 | 5494 msg = va_arg(ap, char *); |
2993 | 5495 len = va_arg(ap, int); |
3952 | 5496 encoding = va_arg(ap, int); |
4870 | 5497 isawaymsg = va_arg(ap, int); |
2086 | 5498 va_end(ap); |
5499 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5500 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5501 "Got DirectIM message from %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5502 |
4870 | 5503 if (isawaymsg) |
5504 imflags |= IM_FLAG_AWAY; | |
5505 | |
4617 | 5506 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
4870 | 5507 serv_got_im(gc, sn, msg, imflags, time(NULL), len); |
2086 | 5508 |
5509 return 1; | |
5510 } | |
5511 | |
4617 | 5512 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 5513 va_list ap; |
5514 char *sn; | |
2993 | 5515 int typing; |
5575 | 5516 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5517 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5518 va_start(ap, fr); |
2086 | 5519 sn = va_arg(ap, char *); |
2993 | 5520 typing = va_arg(ap, int); |
2086 | 5521 va_end(ap); |
5522 | |
4870 | 5523 if (typing == 0x0002) { |
2993 | 5524 /* I had to leave this. It's just too funny. It reminds me of my sister. */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5525 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5526 "ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); |
4342 | 5527 serv_got_typing(gc, sn, 0, TYPING); |
4870 | 5528 } else if (typing == 0x0001) |
5529 serv_got_typing(gc, sn, 0, TYPED); | |
5530 else | |
4342 | 5531 serv_got_typing_stopped(gc, sn); |
2086 | 5532 return 1; |
5533 } | |
5534 | |
5535 struct ask_do_dir_im { | |
5536 char *who; | |
5575 | 5537 GaimConnection *gc; |
2086 | 5538 }; |
5539 | |
3730 | 5540 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5136 | 5541 g_free(data->who); |
2086 | 5542 g_free(data); |
5543 } | |
5544 | |
3730 | 5545 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5575 | 5546 GaimConnection *gc = data->gc; |
4244 | 5547 struct oscar_data *od; |
2086 | 5548 struct direct_im *dim; |
5549 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
5550 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5136 | 5551 g_free(data->who); |
4244 | 5552 g_free(data); |
5553 return; | |
5554 } | |
5555 | |
5556 od = (struct oscar_data *)gc->proto_data; | |
5557 | |
2086 | 5558 dim = find_direct_im(od, data->who); |
5559 if (dim) { | |
3008 | 5560 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
5561 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
5562 gaim_input_remove(dim->watcher); | |
5563 g_free(dim); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5564 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5565 "Gave up on old direct IM, trying again\n"); |
3008 | 5566 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5567 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); |
5136 | 5568 g_free(data->who); |
4244 | 5569 g_free(data); |
3008 | 5570 return; |
5571 } | |
2086 | 5572 } |
5573 dim = g_new0(struct direct_im, 1); | |
5574 dim->gc = gc; | |
5575 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
5576 | |
4617 | 5577 dim->conn = aim_odc_initiate(od->sess, data->who); |
2086 | 5578 if (dim->conn != NULL) { |
5579 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5580 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 5581 oscar_callback, dim->conn); |
4617 | 5582 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
5583 gaim_odc_initiate, 0); | |
2086 | 5584 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5585 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL); |
2086 | 5586 g_free(dim); |
5587 } | |
4244 | 5588 |
5136 | 5589 g_free(data->who); |
4244 | 5590 g_free(data); |
2086 | 5591 } |
5592 | |
5575 | 5593 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
5420 | 5594 gchar *buf; |
2086 | 5595 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
5136 | 5596 data->who = g_strdup(who); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
5597 data->gc = gc; |
5420 | 5598 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), who); |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5599 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5600 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5601 _("Because this reveals your IP address, it " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5602 "may be considered a privacy risk. Do you " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5603 "wish to continue?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5604 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5605 _("Connect"), G_CALLBACK(oscar_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5606 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
5420 | 5607 g_free(buf); |
2086 | 5608 } |
5609 | |
5575 | 5610 static void oscar_set_permit_deny(GaimConnection *gc) { |
5611 GaimAccount *account = gaim_connection_get_account(gc); | |
2086 | 5612 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4230 | 5613 #ifdef NOSSI |
4770 | 5614 GSList *list, *g = gaim_blist_groups(), *g1; |
4230 | 5615 char buf[MAXMSGLEN]; |
5616 int at; | |
5617 | |
5575 | 5618 switch(account->perm_deny) { |
4687 | 5619 case 1: |
5575 | 5620 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
4230 | 5621 break; |
5622 case 2: | |
5575 | 5623 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
4230 | 5624 break; |
5625 case 3: | |
5575 | 5626 list = account->permit; |
4230 | 5627 at = 0; |
5628 while (list) { | |
5629 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
5630 list = list->next; | |
5631 } | |
5632 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
5633 break; | |
5634 case 4: | |
5575 | 5635 list = account->deny; |
4230 | 5636 at = 0; |
5637 while (list) { | |
5638 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
5639 list = list->next; | |
5640 } | |
5641 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
5642 break; | |
5643 case 5: | |
4770 | 5644 g1 = g; |
4230 | 5645 at = 0; |
4770 | 5646 while (g1) { |
5647 list = gaim_blist_members((struct group *)g->data); | |
5648 GSList list1 = list; | |
5649 while (list1) { | |
5650 struct buddy *b = list1->data; | |
5575 | 5651 if(b->account == account) |
4349 | 5652 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); |
4770 | 5653 list1 = list1->next; |
2995 | 5654 } |
4770 | 5655 g_slist_free(list); |
5656 g1 = g1->next; | |
4349 | 5657 } |
4770 | 5658 g_slist_free(g); |
4230 | 5659 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); |
5660 break; | |
5661 default: | |
5662 break; | |
2086 | 5663 } |
4230 | 5664 signoff_blocked(gc); |
5665 #else | |
5666 if (od->sess->ssi.received_data) | |
5575 | 5667 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); |
4230 | 5668 #endif |
2086 | 5669 } |
5670 | |
5575 | 5671 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
4269 | 5672 #ifdef NOSSI |
4491 | 5673 if (gc->account->permdeny == 3) |
4269 | 5674 oscar_set_permit_deny(gc); |
5675 #else | |
2991 | 5676 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5677 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); |
4230 | 5678 if (od->sess->ssi.received_data) |
4889 | 5679 aim_ssi_addpermit(od->sess, who); |
4230 | 5680 #endif |
2086 | 5681 } |
5682 | |
5575 | 5683 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
4269 | 5684 #ifdef NOSSI |
4491 | 5685 if (gc->account->permdeny == 4) |
4269 | 5686 oscar_set_permit_deny(gc); |
5687 #else | |
2991 | 5688 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5689 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); |
4230 | 5690 if (od->sess->ssi.received_data) |
4889 | 5691 aim_ssi_adddeny(od->sess, who); |
4230 | 5692 #endif |
2086 | 5693 } |
5694 | |
5575 | 5695 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
4269 | 5696 #ifdef NOSSI |
4491 | 5697 if (gc->account->permdeny == 3) |
4269 | 5698 oscar_set_permit_deny(gc); |
5699 #else | |
2991 | 5700 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5701 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); |
4230 | 5702 if (od->sess->ssi.received_data) |
4889 | 5703 aim_ssi_delpermit(od->sess, who); |
4230 | 5704 #endif |
2086 | 5705 } |
5706 | |
5575 | 5707 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
4269 | 5708 #ifdef NOSSI |
4491 | 5709 if (gc->account->permdeny == 4) |
4269 | 5710 oscar_set_permit_deny(gc); |
5711 #else | |
2991 | 5712 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5713 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); |
4230 | 5714 if (od->sess->ssi.received_data) |
4889 | 5715 aim_ssi_deldeny(od->sess, who); |
4230 | 5716 #endif |
2086 | 5717 } |
5718 | |
5575 | 5719 static GList *oscar_away_states(GaimConnection *gc) |
2086 | 5720 { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5721 struct oscar_data *od = gc->proto_data; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5722 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5723 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5724 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5725 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5726 |
4333 | 5727 m = g_list_append(m, _("Online")); |
5728 m = g_list_append(m, _("Away")); | |
5729 m = g_list_append(m, _("Do Not Disturb")); | |
5730 m = g_list_append(m, _("Not Available")); | |
5731 m = g_list_append(m, _("Occupied")); | |
5732 m = g_list_append(m, _("Free For Chat")); | |
5733 m = g_list_append(m, _("Invisible")); | |
5734 | |
5735 return m; | |
5736 } | |
5737 | |
5575 | 5738 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
4333 | 5739 struct oscar_data *od = gc->proto_data; |
5740 GList *m = NULL; | |
5741 struct proto_buddy_menu *pbm; | |
5742 | |
5743 if (od->icq) { | |
4624 | 5744 #if 0 |
4333 | 5745 pbm = g_new0(struct proto_buddy_menu, 1); |
5746 pbm->label = _("Get Status Msg"); | |
4969 | 5747 pbm->callback = oscar_get_icqstatusmsg; |
4333 | 5748 pbm->gc = gc; |
5749 m = g_list_append(m, pbm); | |
4624 | 5750 #endif |
4333 | 5751 } else { |
4687 | 5752 struct buddy *b = gaim_find_buddy(gc->account, who); |
4356 | 5753 |
5575 | 5754 if ((aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who)) && GAIM_BUDDY_IS_ONLINE(b)) { |
4333 | 5755 pbm = g_new0(struct proto_buddy_menu, 1); |
5756 pbm->label = _("Direct IM"); | |
5757 pbm->callback = oscar_ask_direct_im; | |
5758 pbm->gc = gc; | |
5759 m = g_list_append(m, pbm); | |
4650 | 5760 |
4333 | 5761 pbm = g_new0(struct proto_buddy_menu, 1); |
5762 pbm->label = _("Send File"); | |
4617 | 5763 pbm->callback = oscar_ask_sendfile; |
4333 | 5764 pbm->gc = gc; |
5765 m = g_list_append(m, pbm); | |
4826 | 5766 #if 0 |
5767 pbm = g_new0(struct proto_buddy_menu, 1); | |
5768 pbm->label = _("Get File"); | |
5769 pbm->callback = oscar_ask_getfile; | |
5770 pbm->gc = gc; | |
5771 m = g_list_append(m, pbm); | |
5772 #endif | |
4333 | 5773 } |
5131 | 5774 } |
5197 | 5775 |
5131 | 5776 if (od->sess->ssi.received_data) { |
5777 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); | |
5778 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { | |
5779 pbm = g_new0(struct proto_buddy_menu, 1); | |
5780 pbm->label = _("Re-request Authorization"); | |
5781 pbm->callback = gaim_auth_sendrequest; | |
5782 pbm->gc = gc; | |
5783 m = g_list_append(m, pbm); | |
4333 | 5784 } |
4916 | 5785 } |
5786 | |
4333 | 5787 return m; |
5788 } | |
5789 | |
5575 | 5790 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
4333 | 5791 struct oscar_data *od = gc->proto_data; |
5575 | 5792 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
4333 | 5793 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
5794 od->setnick = TRUE; | |
5795 od->newsn = g_strdup(nick); | |
5796 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5797 } else { | |
5798 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
5799 } | |
5800 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5801 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5802 _("Screenname formatting can change only capitalization and whitespace.")); |
4333 | 5803 } |
5804 } | |
5805 | |
5575 | 5806 static void oscar_show_format_screenname(GaimConnection *gc) |
4333 | 5807 { |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5808 gaim_request_input(gc, NULL, _("New screenname formatting:"), NULL, |
5575 | 5809 gaim_connection_get_display_name(gc), FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5810 _("OK"), G_CALLBACK(oscar_format_screenname), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5811 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5812 gc); |
4333 | 5813 } |
5814 | |
5575 | 5815 static void oscar_confirm_account(GaimConnection *gc) |
4333 | 5816 { |
5817 struct oscar_data *od = gc->proto_data; | |
5818 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | |
5819 | |
5820 if (conn) { | |
5821 aim_admin_reqconfirm(od->sess, conn); | |
5822 } else { | |
5823 od->conf = TRUE; | |
5824 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5825 } | |
5826 } | |
5827 | |
5575 | 5828 static void oscar_show_email(GaimConnection *gc) |
4333 | 5829 { |
5830 struct oscar_data *od = gc->proto_data; | |
5831 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | |
5832 | |
5833 if (conn) { | |
5834 aim_admin_getinfo(od->sess, conn, 0x11); | |
5835 } else { | |
5836 od->reqemail = TRUE; | |
5837 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5838 } | |
5839 } | |
5840 | |
5575 | 5841 static void oscar_change_email(GaimConnection *gc, const char *email) |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5842 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5843 struct oscar_data *od = gc->proto_data; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5844 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5845 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5846 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5847 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5848 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5849 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5850 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5851 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5852 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5853 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5854 |
5575 | 5855 static void oscar_show_change_email(GaimConnection *gc) |
4333 | 5856 { |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5857 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, FALSE, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5858 _("OK"), G_CALLBACK(oscar_change_email), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5859 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5860 gc); |
4333 | 5861 } |
5862 | |
5575 | 5863 static void oscar_show_awaitingauth(GaimConnection *gc) |
4333 | 5864 { |
2979 | 5865 struct oscar_data *od = gc->proto_data; |
4333 | 5866 gchar *nombre, *text, *tmp; |
4785 | 5867 GaimBlistNode *gnode,*bnode; |
4333 | 5868 int num=0; |
5869 | |
5870 text = g_strdup(_("You are awaiting authorization from the following buddies:<BR>")); | |
5871 | |
4785 | 5872 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
5873 struct group *group = (struct group *)gnode; | |
5874 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
5875 continue; | |
5876 for (bnode = gnode->child; bnode; bnode = bnode->next) { | |
5877 struct buddy *buddy = (struct buddy *)bnode; | |
5878 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
5879 continue; | |
4491 | 5880 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { |
4687 | 5881 if (gaim_get_buddy_alias_only(buddy)) |
5882 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
4333 | 5883 else |
4337 | 5884 nombre = g_strdup_printf(" %s", buddy->name); |
4333 | 5885 tmp = g_strdup_printf("%s<BR>%s", text, nombre); |
5886 g_free(text); | |
5887 text = tmp; | |
5888 g_free(nombre); | |
5889 num++; | |
5890 } | |
2979 | 5891 } |
4333 | 5892 } |
5893 | |
5894 if (!num) { | |
5895 tmp = g_strdup_printf("%s<BR>%s", text, _("<i>you are not waiting for authorization</i>")); | |
5896 g_free(text); | |
5897 text = tmp; | |
2979 | 5898 } |
4333 | 5899 |
4959 | 5900 tmp = g_strdup_printf(_("%s<BR><BR>You can re-request authorization from these buddies by right-clicking on them and clicking \"Re-request authorization.\""), text); |
4333 | 5901 g_free(text); |
5902 text = tmp; | |
5575 | 5903 g_show_info_text(gc, gaim_account_get_username(gaim_connection_get_account(gc)), 2, text, NULL); |
4333 | 5904 g_free(text); |
2979 | 5905 } |
5906 | |
5575 | 5907 static void oscar_show_chpassurl(GaimConnection *gc) |
4333 | 5908 { |
5909 struct oscar_data *od = gc->proto_data; | |
5575 | 5910 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); |
5517 | 5911 open_url(NULL, substituted); |
5912 g_free(substituted); | |
4333 | 5913 } |
5914 | |
5575 | 5915 static GList *oscar_actions(GaimConnection *gc) |
2086 | 5916 { |
5917 struct oscar_data *od = gc->proto_data; | |
4333 | 5918 struct proto_actions_menu *pam; |
5919 GList *m = NULL; | |
5920 | |
5921 pam = g_new0(struct proto_actions_menu, 1); | |
5922 pam->label = _("Set User Info"); | |
5923 pam->callback = show_set_info; | |
5924 pam->gc = gc; | |
5925 m = g_list_append(m, pam); | |
5926 | |
5238 | 5927 pam = g_new0(struct proto_actions_menu, 1); |
5928 pam->label = _("Change Password"); | |
5929 pam->callback = show_change_passwd; | |
5930 pam->gc = gc; | |
5931 m = g_list_append(m, pam); | |
4617 | 5932 |
5933 if (od->sess->authinfo->chpassurl) { | |
5934 pam = g_new0(struct proto_actions_menu, 1); | |
5935 pam->label = _("Change Password (URL)"); | |
5936 pam->callback = oscar_show_chpassurl; | |
5937 pam->gc = gc; | |
5938 m = g_list_append(m, pam); | |
5939 } | |
5940 | |
5238 | 5941 if (!od->icq) { |
4617 | 5942 /* AIM actions */ |
5943 m = g_list_append(m, NULL); | |
4333 | 5944 |
5945 pam = g_new0(struct proto_actions_menu, 1); | |
5946 pam->label = _("Format Screenname"); | |
5947 pam->callback = oscar_show_format_screenname; | |
5948 pam->gc = gc; | |
5949 m = g_list_append(m, pam); | |
5950 | |
5951 pam = g_new0(struct proto_actions_menu, 1); | |
5952 pam->label = _("Confirm Account"); | |
5953 pam->callback = oscar_confirm_account; | |
5954 pam->gc = gc; | |
5955 m = g_list_append(m, pam); | |
5956 | |
5957 pam = g_new0(struct proto_actions_menu, 1); | |
5958 pam->label = _("Display Current Registered Address"); | |
5959 pam->callback = oscar_show_email; | |
5960 pam->gc = gc; | |
5961 m = g_list_append(m, pam); | |
5962 | |
5963 pam = g_new0(struct proto_actions_menu, 1); | |
5964 pam->label = _("Change Current Registered Address"); | |
5965 pam->callback = oscar_show_change_email; | |
5966 pam->gc = gc; | |
5967 m = g_list_append(m, pam); | |
2086 | 5968 } |
4333 | 5969 |
5970 m = g_list_append(m, NULL); | |
5971 | |
5972 pam = g_new0(struct proto_actions_menu, 1); | |
5973 pam->label = _("Show Buddies Awaiting Authorization"); | |
5974 pam->callback = oscar_show_awaitingauth; | |
5975 pam->gc = gc; | |
5976 m = g_list_append(m, pam); | |
5977 | |
2086 | 5978 m = g_list_append(m, NULL); |
4333 | 5979 |
5980 pam = g_new0(struct proto_actions_menu, 1); | |
5981 pam->label = _("Search for Buddy by Email"); | |
5982 pam->callback = show_find_email; | |
5983 pam->gc = gc; | |
5984 m = g_list_append(m, pam); | |
5985 | |
4336 | 5986 /* pam = g_new0(struct proto_actions_menu, 1); |
4333 | 5987 pam->label = _("Search for Buddy by Information"); |
5988 pam->callback = show_find_info; | |
5989 pam->gc = gc; | |
4336 | 5990 m = g_list_append(m, pam); */ |
2086 | 5991 |
5992 return m; | |
5993 } | |
5994 | |
5575 | 5995 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2086 | 5996 { |
5997 struct oscar_data *od = gc->proto_data; | |
4617 | 5998 |
5999 if (od->icq) { | |
6000 aim_icq_changepasswd(od->sess, new); | |
2086 | 6001 } else { |
4617 | 6002 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6003 if (conn) { | |
6004 aim_admin_changepasswd(od->sess, conn, new, old); | |
6005 } else { | |
6006 od->chpass = TRUE; | |
6007 od->oldp = g_strdup(old); | |
6008 od->newp = g_strdup(new); | |
6009 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6010 } | |
2086 | 6011 } |
6012 } | |
6013 | |
5575 | 6014 static void oscar_convo_closed(GaimConnection *gc, char *who) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6015 { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6016 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6017 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6018 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6019 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6020 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6021 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6022 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6023 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6024 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6025 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6026 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6027 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6028 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6029 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6030 GAIM_PROTO_OSCAR, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6031 OPT_PROTO_MAIL_CHECK | OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6032 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6033 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6034 oscar_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6035 oscar_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6036 oscar_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6037 oscar_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6038 oscar_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6039 oscar_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6040 oscar_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6041 oscar_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6042 oscar_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6043 oscar_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6044 oscar_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6045 oscar_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6046 oscar_send_typing, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6047 oscar_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6048 oscar_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6049 oscar_get_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6050 oscar_set_dir, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6051 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6052 oscar_dir_search, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6053 oscar_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6054 oscar_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6055 oscar_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6056 oscar_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6057 oscar_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6058 oscar_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6059 oscar_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6060 oscar_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6061 oscar_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6062 oscar_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6063 oscar_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6064 oscar_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6065 oscar_join_chat, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6066 oscar_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6067 oscar_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6068 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6069 oscar_chat_send, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6070 oscar_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6071 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6072 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6073 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6074 #ifndef NOSSI |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6075 oscar_alias_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6076 oscar_move_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6077 oscar_rename_group, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6078 #else |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6079 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6080 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6081 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6082 #endif |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6083 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6084 oscar_convo_closed, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6085 NULL |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6086 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6087 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6088 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6089 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6090 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6091 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6092 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6093 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6094 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6095 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6096 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6097 "prpl-oscar", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6098 "AIM/ICQ", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6099 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6100 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6101 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6102 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6103 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6104 NULL, /**< author */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6105 WEBSITE, /**< homepage */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6106 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6107 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6108 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6109 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6110 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6111 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6112 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6113 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6114 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6115 static void |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6116 __init_plugin(GaimPlugin *plugin) |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6117 { |
3572 | 6118 struct proto_user_opt *puo; |
2086 | 6119 |
3572 | 6120 puo = g_new0(struct proto_user_opt, 1); |
5388 | 6121 puo->label = g_strdup(_("Auth Host:")); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6122 puo->def = g_strdup("login.oscar.aol.com"); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6123 puo->pos = USEROPT_AUTH; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6124 prpl_info.user_opts = g_list_append(prpl_info.user_opts, puo); |
3572 | 6125 |
6126 puo = g_new0(struct proto_user_opt, 1); | |
5388 | 6127 puo->label = g_strdup(_("Auth Port:")); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6128 puo->def = g_strdup("5190"); |
5208
0a6912730d56
[gaim-migrate @ 5576]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
6129 puo->pos = USEROPT_AUTHPORT; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6130 prpl_info.user_opts = g_list_append(prpl_info.user_opts, puo); |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6131 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6132 my_protocol = plugin; |
2086 | 6133 } |
6134 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6135 GAIM_INIT_PLUGIN(oscar, __init_plugin, info); |