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