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