Mercurial > pidgin.yaz
annotate src/protocols/oscar/oscar.c @ 6035:8c44020a958e
[gaim-migrate @ 6485]
gaim_request_input() now takes a masked bool, which, if enabled, masks the
text on the entry field so that it cannot be seen. Good for password input
requests, and what do you know, that's why this is written!
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 05 Jul 2003 21:54:19 +0000 |
parents | 38999b6b1838 |
children | 4543f56f6fc3 |
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 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
22 #include "internal.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
23 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
24 #include "account.h" |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
25 #include "accountopt.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
26 #include "conversation.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
27 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
28 #include "ft.h" |
2086 | 29 #include "multi.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
30 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
31 #include "privacy.h" |
2086 | 32 #include "prpl.h" |
4889 | 33 #include "proxy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
34 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
35 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
36 |
2086 | 37 #include "aim.h" |
5842 | 38 #include "md5.h" |
2086 | 39 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
40 /* XXX */ |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
41 #include "gaim.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
42 #include "ui.h" |
3630 | 43 |
2086 | 44 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
45 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
46 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
47 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
48 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
49 #define UC_AB 0x20 |
3079 | 50 #define UC_WIRELESS 0x40 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
51 |
2086 | 52 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
53 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
54 static GaimPlugin *my_protocol = NULL; |
4249 | 55 |
4811 | 56 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE; |
57 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE; | |
3458 | 58 |
4665 | 59 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
60 static fu8_t features_icq[] = {0x01, 0x06}; | |
2086 | 61 |
62 struct oscar_data { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
63 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
64 aim_conn_t *conn; |
2086 | 65 |
66 guint cnpa; | |
67 guint paspa; | |
3694 | 68 guint emlpa; |
4804 | 69 guint icopa; |
2086 | 70 |
4823 | 71 gboolean iconconnecting; |
5842 | 72 gboolean set_icon; |
4823 | 73 |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
74 GSList *create_rooms; |
2086 | 75 |
76 gboolean conf; | |
77 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
78 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
79 char *email; |
2979 | 80 gboolean setnick; |
81 char *newsn; | |
2086 | 82 gboolean chpass; |
83 char *oldp; | |
84 char *newp; | |
5842 | 85 |
2086 | 86 GSList *oscar_chats; |
87 GSList *direct_ims; | |
3630 | 88 GSList *file_transfers; |
4738 | 89 GHashTable *buddyinfo; |
4804 | 90 GSList *requesticon; |
2086 | 91 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
92 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
93 gboolean icq; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
94 GSList *evilhack; |
4804 | 95 guint icontimer; |
5968 | 96 guint getblisttimer; |
2993 | 97 |
98 struct { | |
4230 | 99 guint maxwatchers; /* max users who can watch you */ |
2993 | 100 guint maxbuddies; /* max users you can watch */ |
4230 | 101 guint maxgroups; /* max groups in server list */ |
2993 | 102 guint maxpermits; /* max users on permit list */ |
103 guint maxdenies; /* max users on deny list */ | |
104 guint maxsiglen; /* max size (bytes) of profile */ | |
105 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
106 } rights; | |
2086 | 107 }; |
108 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
109 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
110 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
111 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
112 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
113 |
2086 | 114 struct chat_connection { |
115 char *name; | |
116 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
117 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
118 fu16_t instance; |
2086 | 119 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
|
120 aim_conn_t *conn; |
2086 | 121 int inpa; |
122 int id; | |
5575 | 123 GaimConnection *gc; /* i hate this. */ |
5679 | 124 GaimConversation *cnv; /* bah. */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
125 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
126 int maxvis; |
2086 | 127 }; |
128 | |
129 struct direct_im { | |
5575 | 130 GaimConnection *gc; |
2086 | 131 char name[80]; |
132 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
133 aim_conn_t *conn; |
3008 | 134 gboolean connected; |
2086 | 135 }; |
136 | |
137 struct ask_direct { | |
5575 | 138 GaimConnection *gc; |
2086 | 139 char *sn; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
140 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
141 fu8_t cookie[8]; |
2086 | 142 }; |
143 | |
4738 | 144 /* Various PRPL-specific buddy info that we want to keep track of */ |
145 struct buddyinfo { | |
146 time_t signon; | |
147 int caps; | |
148 gboolean typingnot; | |
5836 | 149 gchar *availablemsg; |
150 | |
151 unsigned long ico_me_len; | |
152 unsigned long ico_me_csum; | |
153 time_t ico_me_time; | |
154 gboolean ico_informed; | |
4738 | 155 |
156 unsigned long ico_len; | |
157 unsigned long ico_csum; | |
158 time_t ico_time; | |
159 gboolean ico_need; | |
160 | |
4853 | 161 fu16_t iconcsumlen; |
5836 | 162 fu8_t *iconcsum; |
2086 | 163 }; |
164 | |
4230 | 165 struct name_data { |
5575 | 166 GaimConnection *gc; |
4230 | 167 gchar *name; |
3453 | 168 gchar *nick; |
3141 | 169 }; |
170 | |
5129 | 171 static char *msgerrreason[] = { |
172 N_("Invalid error"), | |
173 N_("Invalid SNAC"), | |
174 N_("Rate to host"), | |
175 N_("Rate to client"), | |
176 N_("Not logged in"), | |
177 N_("Service unavailable"), | |
178 N_("Service not defined"), | |
179 N_("Obsolete SNAC"), | |
180 N_("Not supported by host"), | |
181 N_("Not supported by client"), | |
182 N_("Refused by client"), | |
183 N_("Reply too big"), | |
184 N_("Responses lost"), | |
185 N_("Request denied"), | |
186 N_("Busted SNAC payload"), | |
187 N_("Insufficient rights"), | |
188 N_("In local permit/deny"), | |
189 N_("Too evil (sender)"), | |
190 N_("Too evil (receiver)"), | |
191 N_("User temporarily unavailable"), | |
192 N_("No match"), | |
193 N_("List overflow"), | |
194 N_("Request ambiguous"), | |
195 N_("Queue full"), | |
196 N_("Not while on AOL") | |
197 }; | |
198 static int msgerrreasonlen = 25; | |
199 | |
200 /* All the libfaim->gaim callback functions */ | |
201 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); | |
202 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); | |
203 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); | |
204 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); | |
205 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); | |
206 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); | |
207 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); | |
208 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); | |
209 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); | |
210 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); | |
211 static int gaim_parse_user_info (aim_session_t *, aim_frame_t *, ...); | |
212 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); | |
213 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); | |
214 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...); | |
215 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...); | |
216 static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...); | |
217 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); | |
218 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); | |
219 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); | |
220 static int gaim_icon_parseicon (aim_session_t *, aim_frame_t *, ...); | |
5844 | 221 static int oscar_icon_req (aim_session_t *, aim_frame_t *, ...); |
5129 | 222 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
223 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); | |
224 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); | |
225 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); | |
226 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); | |
227 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); | |
228 static int gaim_connerr (aim_session_t *, aim_frame_t *, ...); | |
229 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); | |
230 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); | |
231 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); | |
232 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); | |
233 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); | |
234 static int conninitdone_icon (aim_session_t *, aim_frame_t *, ...); | |
235 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); | |
236 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); | |
237 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); | |
238 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); | |
239 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | |
240 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | |
241 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | |
242 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); | |
243 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); | |
244 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); | |
245 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); | |
246 static int gaim_icqalias (aim_session_t *, aim_frame_t *, ...); | |
247 static int gaim_icqinfo (aim_session_t *, aim_frame_t *, ...); | |
248 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); | |
249 #ifndef NOSSI | |
250 static int gaim_ssi_parseerr (aim_session_t *, aim_frame_t *, ...); | |
251 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); | |
252 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
253 static int gaim_ssi_parseack (aim_session_t *, aim_frame_t *, ...); | |
254 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); | |
255 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
256 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
257 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
258 #endif | |
259 | |
260 /* for DirectIM/image transfer */ | |
261 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
262 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
263 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
264 static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...); | |
265 | |
266 /* for file transfer */ | |
267 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
268 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
269 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
270 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
271 | |
272 /* for icons */ | |
273 static gboolean gaim_icon_timerfunc(gpointer data); | |
274 | |
5306 | 275 /* prpl actions - remove this at some point */ |
5954 | 276 static void oscar_set_info(GaimConnection *gc, const char *text); |
5306 | 277 |
5836 | 278 static void oscar_free_name_data(struct name_data *data) { |
4230 | 279 g_free(data->name); |
280 g_free(data->nick); | |
281 g_free(data); | |
282 } | |
283 | |
5836 | 284 static void oscar_free_buddyinfo(void *data) { |
285 struct buddyinfo *bi = data; | |
286 g_free(bi->availablemsg); | |
287 g_free(bi->iconcsum); | |
288 g_free(bi); | |
289 } | |
290 | |
5129 | 291 static fu32_t oscar_encoding_check(const char *utf8) |
292 { | |
293 int i = 0; | |
294 fu32_t encodingflag = 0; | |
295 | |
296 /* Determine how we can send this message. Per the warnings elsewhere | |
297 * in this file, these little checks determine the simplest encoding | |
298 * we can use for a given message send using it. */ | |
299 while (utf8[i]) { | |
300 if ((unsigned char)utf8[i] > 0x7f) { | |
301 /* not ASCII! */ | |
302 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
303 break; | |
304 } | |
305 i++; | |
306 } | |
307 while (utf8[i]) { | |
308 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
309 * followed by 0xc0-0xc3 in the second */ | |
310 if ((unsigned char)utf8[i] < 0x80) { | |
311 i++; | |
312 continue; | |
313 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
314 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
315 i += 2; | |
316 continue; | |
317 } | |
318 encodingflag = AIM_IMFLAGS_UNICODE; | |
319 break; | |
320 } | |
321 | |
322 return encodingflag; | |
323 } | |
324 | |
325 static fu32_t oscar_encoding_parse(const char *enc) | |
326 { | |
327 char *charset; | |
328 | |
329 /* If anything goes wrong, fall back on ASCII and print a message */ | |
330 if (enc == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
331 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
332 "Encoding was null, that's odd\n"); |
5129 | 333 return 0; |
334 } | |
335 charset = strstr(enc, "charset="); | |
336 if (charset == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
337 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
338 "No charset specified for info, assuming ASCII\n"); |
5129 | 339 return 0; |
340 } | |
341 charset += 8; | |
342 if (!strcmp(charset, "\"us-ascii\"") || !strcmp(charset, "\"utf-8\"")) { | |
343 /* UTF-8 is our native charset, ASCII is a proper subset */ | |
344 return 0; | |
345 } else if (!strcmp(charset, "\"iso-8859-1\"")) { | |
346 return AIM_IMFLAGS_ISO_8859_1; | |
347 } else if (!strcmp(charset, "\"unicode-2-0\"")) { | |
348 return AIM_IMFLAGS_UNICODE; | |
349 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
350 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
351 "Unrecognized character set '%s', using ASCII\n", charset); |
5129 | 352 return 0; |
353 } | |
354 } | |
355 | |
356 gchar *oscar_encoding_to_utf8(const char *encoding, char *text, int textlen) | |
357 { | |
358 gchar *utf8 = NULL; | |
359 int flags = oscar_encoding_parse(encoding); | |
360 | |
361 switch (flags) { | |
362 case 0: | |
363 utf8 = g_strndup(text, textlen); | |
364 break; | |
365 case AIM_IMFLAGS_ISO_8859_1: | |
366 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
367 break; | |
368 case AIM_IMFLAGS_UNICODE: | |
369 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
370 break; | |
371 } | |
372 | |
373 return utf8; | |
374 } | |
375 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
376 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { |
2086 | 377 GSList *d = od->direct_ims; |
378 struct direct_im *m = NULL; | |
379 | |
380 while (d) { | |
381 m = (struct direct_im *)d->data; | |
4355 | 382 if (!aim_sncmp(who, m->name)) |
4269 | 383 return m; |
2086 | 384 d = d->next; |
385 } | |
386 | |
4269 | 387 return NULL; |
2086 | 388 } |
389 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
390 static char *extract_name(const char *name) { |
4121 | 391 char *tmp, *x; |
2086 | 392 int i, j; |
4120 | 393 |
394 if (!name) | |
4121 | 395 return NULL; |
396 | |
4120 | 397 x = strchr(name, '-'); |
4121 | 398 |
2086 | 399 if (!x) return NULL; |
400 x = strchr(++x, '-'); | |
401 if (!x) return NULL; | |
402 tmp = g_strdup(++x); | |
403 | |
404 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
405 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
406 if (x[i] != '%') { |
2086 | 407 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
408 continue; |
2086 | 409 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
410 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
411 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
412 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 413 } |
414 | |
415 tmp[j] = 0; | |
416 return tmp; | |
417 } | |
418 | |
5575 | 419 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
2086 | 420 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
421 struct chat_connection *c = NULL; | |
422 | |
423 while (g) { | |
424 c = (struct chat_connection *)g->data; | |
425 if (c->id == id) | |
426 break; | |
427 g = g->next; | |
428 c = NULL; | |
429 } | |
430 | |
431 return c; | |
432 } | |
433 | |
5575 | 434 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
|
435 aim_conn_t *conn) { |
2086 | 436 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
437 struct chat_connection *c = NULL; | |
438 | |
439 while (g) { | |
440 c = (struct chat_connection *)g->data; | |
441 if (c->conn == conn) | |
442 break; | |
443 g = g->next; | |
444 c = NULL; | |
445 } | |
446 | |
447 return c; | |
448 } | |
449 | |
4617 | 450 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
5575 | 451 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
452 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5679 | 453 GaimConversation *cnv; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
454 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
455 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
456 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
457 |
4617 | 458 sn = g_strdup(aim_odc_getsn(conn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
459 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
460 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
461 "%s disconnected Direct IM.\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
462 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
463 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
464 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
465 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
466 |
3008 | 467 if (dim->connected) |
468 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
469 else | |
470 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); | |
471 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
472 if ((cnv = gaim_find_conversation(sn))) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
473 gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
474 |
5579 | 475 gaim_conversation_update_progress(cnv, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
476 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
477 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
|
478 g_free(sn); |
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 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
481 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
482 |
4617 | 483 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
484 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
485 aim_session_t *sess = aim_conn_getsess(conn); |
5575 | 486 GaimConnection *gc = sess ? sess->aux_data : NULL; |
4617 | 487 struct oscar_data *od; |
2086 | 488 |
489 if (!gc) { | |
490 /* 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
|
491 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
492 "oscar callback for closed connection (1).\n"); |
2086 | 493 return; |
494 } | |
495 | |
4617 | 496 od = (struct oscar_data *)gc->proto_data; |
2086 | 497 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
498 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 499 /* oh boy. this is probably bad. i guess the only thing we |
500 * can really do is return? */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
501 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
502 "oscar callback for closed connection (2).\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
503 gaim_debug(GAIM_DEBUG_MISC, "oscar", "gc = %p\n", gc); |
2086 | 504 return; |
505 } | |
506 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
507 if (condition & GAIM_INPUT_READ) { |
4617 | 508 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
509 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
510 "got information on rendezvous listener\n"); |
4617 | 511 if (aim_handlerendconnect(od->sess, conn) < 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
512 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
513 "connection error (rendezvous listener)\n"); |
4617 | 514 aim_conn_kill(od->sess, &conn); |
2086 | 515 } |
516 } else { | |
4617 | 517 if (aim_get_command(od->sess, conn) >= 0) { |
518 aim_rxdispatch(od->sess); | |
6029 | 519 if (od->killme) { |
520 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Waiting to be destroyed\n"); | |
521 return; | |
522 } | |
2086 | 523 } else { |
524 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 525 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
526 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
527 "major connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
528 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 529 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
530 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
5420 | 531 char *buf; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
532 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
533 "disconnected from chat room %s\n", c->name); |
2086 | 534 c->conn = NULL; |
535 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
536 gaim_input_remove(c->inpa); |
2086 | 537 c->inpa = 0; |
538 c->fd = -1; | |
4617 | 539 aim_conn_kill(od->sess, &conn); |
5420 | 540 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
|
541 gaim_notify_error(gc, NULL, buf, NULL); |
5420 | 542 g_free(buf); |
2086 | 543 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 544 if (od->cnpa > 0) |
545 gaim_input_remove(od->cnpa); | |
546 od->cnpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
547 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
548 "removing chatnav input watcher\n"); |
4617 | 549 while (od->create_rooms) { |
550 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
551 g_free(cr->name); |
4617 | 552 od->create_rooms = |
553 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
554 g_free(cr); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
555 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
556 _("Chat is currently unavailable"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
557 NULL); |
2086 | 558 } |
4617 | 559 aim_conn_kill(od->sess, &conn); |
2086 | 560 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 561 if (od->paspa > 0) |
562 gaim_input_remove(od->paspa); | |
563 od->paspa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
564 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
565 "removing authconn input watcher\n"); |
4617 | 566 aim_conn_kill(od->sess, &conn); |
3694 | 567 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 568 if (od->emlpa > 0) |
569 gaim_input_remove(od->emlpa); | |
570 od->emlpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
571 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
572 "removing email input watcher\n"); |
4617 | 573 aim_conn_kill(od->sess, &conn); |
4804 | 574 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
575 if (od->icopa > 0) | |
576 gaim_input_remove(od->icopa); | |
577 od->icopa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
578 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
579 "removing icon input watcher\n"); |
4804 | 580 aim_conn_kill(od->sess, &conn); |
2086 | 581 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
582 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 583 gaim_odc_disconnect(od->sess, conn); |
584 aim_conn_kill(od->sess, &conn); | |
2086 | 585 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
586 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
587 "holy crap! generic connection error! %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
588 conn->type); |
4617 | 589 aim_conn_kill(od->sess, &conn); |
2086 | 590 } |
591 } | |
592 } | |
593 } | |
594 } | |
595 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
596 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
2086 | 597 char *s = g_strdup_vprintf(format, va); |
598 char buf[256]; | |
599 char *t; | |
5575 | 600 GaimConnection *gc = sess->aux_data; |
601 | |
602 g_snprintf(buf, sizeof(buf), "%s %d: ", gaim_account_get_username(gaim_connection_get_account(gc)), level); | |
2086 | 603 t = g_strconcat(buf, s, NULL); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
604 gaim_debug(GAIM_DEBUG_INFO, "oscar", t); |
2086 | 605 if (t[strlen(t)-1] != '\n') |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
606 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
2086 | 607 g_free(t); |
608 g_free(s); | |
609 } | |
610 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
611 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 612 { |
5575 | 613 GaimConnection *gc = data; |
4617 | 614 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
615 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
616 aim_conn_t *conn; |
2086 | 617 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
618 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 619 close(source); |
620 return; | |
621 } | |
622 | |
4617 | 623 od = gc->proto_data; |
624 sess = od->sess; | |
2086 | 625 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 626 |
627 conn->fd = source; | |
2086 | 628 |
629 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
630 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 631 return; |
632 } | |
633 | |
634 aim_conn_completeconnect(sess, conn); | |
4617 | 635 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
|
636 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
637 "Password sent, waiting for response\n"); |
2086 | 638 } |
639 | |
5575 | 640 static void oscar_login(GaimAccount *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
641 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
642 aim_conn_t *conn; |
2086 | 643 char buf[256]; |
5575 | 644 GaimConnection *gc = gaim_account_get_connection(account); |
4617 | 645 struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1); |
2086 | 646 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
647 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
|
648 |
5575 | 649 if (isdigit(*(gaim_account_get_username(account)))) { |
4617 | 650 od->icq = TRUE; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
651 } else { |
2918
4df759d607f3
[gaim-migrate @ 2931]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2916
diff
changeset
|
652 gc->flags |= OPT_CONN_HTML; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
653 gc->flags |= OPT_CONN_AUTO_RESP; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
654 } |
5836 | 655 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
2086 | 656 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
657 sess = g_new0(aim_session_t, 1); |
2086 | 658 |
659 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); | |
660 aim_setdebuggingcb(sess, oscar_debug); | |
661 | |
662 /* we need an immediate queue because we don't use a while-loop to | |
663 * see if things need to be sent. */ | |
664 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); | |
4617 | 665 od->sess = sess; |
2086 | 666 sess->aux_data = gc; |
667 | |
668 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
669 if (conn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
670 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
671 "internal connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
672 gaim_connection_error(gc, _("Unable to login to AIM")); |
2086 | 673 return; |
674 } | |
675 | |
5575 | 676 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
|
677 gaim_connection_update_progress(gc, buf, 2, 5); |
2086 | 678 |
4649 | 679 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 680 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
681 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
682 | |
683 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
684 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
5575 | 685 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
686 oscar_login_connect, gc) < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
687 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 688 return; |
689 } | |
5575 | 690 aim_request_login(sess, conn, gaim_account_get_username(account)); |
691 } | |
692 | |
693 static void oscar_close(GaimConnection *gc) { | |
4617 | 694 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
695 | |
696 while (od->oscar_chats) { | |
697 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 698 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
699 gaim_input_remove(n->inpa); |
2086 | 700 g_free(n->name); |
701 g_free(n->show); | |
4617 | 702 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 703 g_free(n); |
704 } | |
4617 | 705 while (od->direct_ims) { |
706 struct direct_im *n = od->direct_ims->data; | |
2086 | 707 if (n->watcher > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
708 gaim_input_remove(n->watcher); |
4617 | 709 od->direct_ims = g_slist_remove(od->direct_ims, n); |
2086 | 710 g_free(n); |
711 } | |
4617 | 712 /* BBB */ |
713 while (od->file_transfers) { | |
714 struct gaim_xfer *xfer; | |
715 xfer = (struct gaim_xfer *)od->file_transfers->data; | |
716 gaim_xfer_destroy(xfer); | |
3630 | 717 } |
4804 | 718 while (od->requesticon) { |
719 char *sn = od->requesticon->data; | |
720 od->requesticon = g_slist_remove(od->requesticon, sn); | |
721 free(sn); | |
722 } | |
4738 | 723 g_hash_table_destroy(od->buddyinfo); |
4617 | 724 while (od->evilhack) { |
725 g_free(od->evilhack->data); | |
726 od->evilhack = g_slist_remove(od->evilhack, od->evilhack->data); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
727 } |
4617 | 728 while (od->create_rooms) { |
729 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
730 g_free(cr->name); |
4617 | 731 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
732 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
733 } |
4617 | 734 if (od->email) |
735 g_free(od->email); | |
736 if (od->newp) | |
737 g_free(od->newp); | |
738 if (od->oldp) | |
739 g_free(od->oldp); | |
2086 | 740 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
741 gaim_input_remove(gc->inpa); |
4617 | 742 if (od->cnpa > 0) |
743 gaim_input_remove(od->cnpa); | |
744 if (od->paspa > 0) | |
745 gaim_input_remove(od->paspa); | |
746 if (od->emlpa > 0) | |
747 gaim_input_remove(od->emlpa); | |
4804 | 748 if (od->icopa > 0) |
749 gaim_input_remove(od->icopa); | |
4832 | 750 if (od->icopa > 0) |
751 gaim_input_remove(od->icopa); | |
752 if (od->icontimer) | |
753 g_source_remove(od->icontimer); | |
5968 | 754 if (od->getblisttimer) |
755 g_source_remove(od->getblisttimer); | |
4617 | 756 aim_session_kill(od->sess); |
757 g_free(od->sess); | |
758 od->sess = NULL; | |
2086 | 759 g_free(gc->proto_data); |
760 gc->proto_data = NULL; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
761 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
2086 | 762 } |
763 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
764 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 765 GaimConnection *gc = data; |
4617 | 766 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
767 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
768 aim_conn_t *bosconn; |
2086 | 769 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
770 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 771 close(source); |
772 return; | |
773 } | |
774 | |
4617 | 775 od = gc->proto_data; |
776 sess = od->sess; | |
777 bosconn = od->conn; | |
4366 | 778 bosconn->fd = source; |
2086 | 779 |
780 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
781 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 782 return; |
783 } | |
784 | |
785 aim_conn_completeconnect(sess, bosconn); | |
4617 | 786 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
|
787 gaim_connection_update_progress(gc, |
5577
7ed9999926af
[gaim-migrate @ 5981]
Christian Hammond <chipx86@chipx86.com>
parents:
5576
diff
changeset
|
788 _("Connection established, cookie sent"), 4, 5); |
2086 | 789 } |
790 | |
4617 | 791 /* BBB */ |
4656 | 792 /* |
793 * This little area in oscar.c is the nexus of file transfer code, | |
794 * so I wrote a little explanation of what happens. I am such a | |
795 * ninja. | |
796 * | |
797 * The series of events for a file send is: | |
798 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
799 * -User chooses a file and oscar_xfer_init is called. It establishs a | |
800 * listening socket, then asks the remote user to connect to us (and | |
801 * gives them the file name, port, IP, etc.) | |
802 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
803 * in oscar_sendfile_estblsh) | |
804 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
805 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
806 * connection. | |
807 * -We get drunk because file transfer kicks ass. | |
808 * | |
809 * The series of events for a file receive is: | |
810 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
811 * -Gaim user selects file to name and location to save file to and | |
812 * oscar_xfer_init is called | |
813 * -It connects to the remote user using the IP they gave us earlier | |
814 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
815 * them an AIM_CB_OFT_ACK. | |
816 * -They begin to send us lots of raw data. | |
817 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
818 * the connectionn. | |
819 */ | |
820 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
821 | |
822 /* XXX - This function is pretty ugly */ | |
5146 | 823 static void oscar_xfer_init(struct gaim_xfer *xfer) |
4656 | 824 { |
5146 | 825 struct aim_oft_info *oft_info = xfer->data; |
5575 | 826 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 827 struct oscar_data *od = gc->proto_data; |
4656 | 828 |
829 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
830 int i; | |
831 | |
832 xfer->filename = g_path_get_basename(xfer->local_filename); | |
5146 | 833 strncpy(oft_info->fh.name, xfer->filename, 64); |
834 oft_info->fh.totsize = gaim_xfer_get_size(xfer); | |
835 oft_info->fh.size = gaim_xfer_get_size(xfer); | |
836 oft_info->fh.checksum = aim_oft_checksum_file(xfer->local_filename); | |
4656 | 837 |
838 /* | |
5146 | 839 * First try the port specified earlier (5190). If that fails, |
840 * increment by 1 and try again. | |
4656 | 841 */ |
5146 | 842 aim_sendfile_listen(od->sess, oft_info); |
843 for (i=0; (i<5 && !oft_info->conn); i++) { | |
844 xfer->local_port = oft_info->port = oft_info->port + 1; | |
845 aim_sendfile_listen(od->sess, oft_info); | |
4656 | 846 } |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
847 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
848 "port is %d, ip is %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
849 xfer->local_port, oft_info->clientip); |
5146 | 850 if (oft_info->conn) { |
851 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
852 aim_im_sendch2_sendfile_ask(od->sess, oft_info); | |
853 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
4656 | 854 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
855 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
856 _("Unable to establish listener socket.")); |
4656 | 857 /* 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
|
858 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 859 } |
860 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 861 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
862 if (oft_info->conn) { | |
863 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
864 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
|
865 oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc), xfer->remote_ip, xfer->remote_port, |
5575 | 866 oscar_sendfile_connected, xfer); |
4656 | 867 if (xfer->fd == -1) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
868 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
869 _("Unable to establish file descriptor.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
870 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 871 } |
872 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
873 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
874 _("Unable to create new connection.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
875 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 876 /* Try a different port? Ask them to connect to us? */ |
877 } | |
878 | |
879 } | |
880 } | |
881 | |
5146 | 882 static void oscar_xfer_start(struct gaim_xfer *xfer) |
4656 | 883 { |
5146 | 884 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
885 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_start\n"); |
4656 | 886 /* I'm pretty sure we don't need to do jack here. Nor Jill. */ |
887 } | |
888 | |
5146 | 889 static void oscar_xfer_end(struct gaim_xfer *xfer) |
4656 | 890 { |
5146 | 891 struct aim_oft_info *oft_info = xfer->data; |
5575 | 892 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 893 struct oscar_data *od = gc->proto_data; |
4656 | 894 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
895 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
5146 | 896 |
897 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
898 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | |
899 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); | |
900 } | |
901 | |
902 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
903 aim_oft_destroyinfo(oft_info); | |
4656 | 904 xfer->data = NULL; |
5146 | 905 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 906 } |
907 | |
5146 | 908 static void oscar_xfer_cancel_send(struct gaim_xfer *xfer) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
909 { |
5146 | 910 struct aim_oft_info *oft_info = xfer->data; |
5575 | 911 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 912 struct oscar_data *od = gc->proto_data; |
4763 | 913 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
914 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
915 "AAA - in oscar_xfer_cancel_send\n"); |
5146 | 916 |
917 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
918 | |
919 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
920 aim_oft_destroyinfo(oft_info); | |
4763 | 921 xfer->data = NULL; |
5146 | 922 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
923 } |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
924 |
5146 | 925 static void oscar_xfer_cancel_recv(struct gaim_xfer *xfer) |
4656 | 926 { |
5146 | 927 struct aim_oft_info *oft_info = xfer->data; |
5575 | 928 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 929 struct oscar_data *od = gc->proto_data; |
4656 | 930 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
931 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
932 "AAA - in oscar_xfer_cancel_recv\n"); |
5146 | 933 |
934 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
935 | |
936 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
937 aim_oft_destroyinfo(oft_info); | |
4656 | 938 xfer->data = NULL; |
5146 | 939 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 940 } |
941 | |
5146 | 942 static void oscar_xfer_ack(struct gaim_xfer *xfer, const char *buffer, size_t size) |
4656 | 943 { |
5146 | 944 struct aim_oft_info *oft_info = xfer->data; |
4656 | 945 |
946 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
947 /* | |
948 * If we're done sending, intercept the socket from the core ft code | |
949 * and wait for the other guy to send the "done" OFT packet. | |
950 */ | |
951 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
952 gaim_input_remove(xfer->watcher); | |
5146 | 953 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
4656 | 954 xfer->fd = 0; |
955 gaim_xfer_set_completed(xfer, TRUE); | |
956 } | |
957 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 958 /* Update our rolling checksum. Like Walmart, yo. */ |
959 oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); | |
4656 | 960 } |
961 } | |
962 | |
5146 | 963 static struct gaim_xfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) |
4656 | 964 { |
965 struct gaim_xfer *xfer; | |
5146 | 966 struct aim_oft_info *oft_info; |
4656 | 967 |
968 while (fts) { | |
969 xfer = fts->data; | |
5146 | 970 oft_info = xfer->data; |
971 | |
972 if (oft_info && !strcmp(ck, oft_info->cookie)) | |
4656 | 973 return xfer; |
974 | |
975 fts = g_slist_next(fts); | |
976 } | |
977 | |
978 return NULL; | |
979 } | |
980 | |
5146 | 981 static struct gaim_xfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
4656 | 982 { |
983 struct gaim_xfer *xfer; | |
5146 | 984 struct aim_oft_info *oft_info; |
4656 | 985 |
986 while (fts) { | |
987 xfer = fts->data; | |
5146 | 988 oft_info = xfer->data; |
989 | |
990 if (oft_info && (conn == oft_info->conn)) | |
4656 | 991 return xfer; |
992 | |
993 fts = g_slist_next(fts); | |
994 } | |
995 | |
996 return NULL; | |
997 } | |
998 | |
5575 | 999 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
3630 | 1000 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5146 | 1001 struct gaim_xfer *xfer; |
1002 struct aim_oft_info *oft_info; | |
1003 aim_conn_t *conn; | |
3752 | 1004 |
4617 | 1005 /* You want to send a file to someone else, you're so generous */ |
1006 | |
1007 /* Build the file transfer handle */ | |
5575 | 1008 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
5146 | 1009 if ((conn = aim_conn_findbygroup(od->sess, 0x0004))) |
1010 xfer->local_ip = gaim_getip_from_fd(conn->fd); | |
4617 | 1011 xfer->local_port = 5190; |
1012 | |
5146 | 1013 /* Create the oscar-specific data */ |
1014 oft_info = aim_oft_createinfo(od->sess, NULL, destsn, xfer->local_ip, xfer->local_port, 0, 0, NULL); | |
1015 xfer->data = oft_info; | |
1016 | |
4617 | 1017 /* Setup our I/O op functions */ |
1018 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
1019 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
1020 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1021 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1022 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4656 | 1023 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
4617 | 1024 |
1025 /* Keep track of this transfer for later */ | |
1026 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1027 | |
1028 /* Now perform the request */ | |
1029 gaim_xfer_request(xfer); | |
3630 | 1030 } |
1031 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1032 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
6029 | 1033 GaimConnection *gc = sess->aux_data; |
1034 struct oscar_data *od = gc->proto_data; | |
1035 GaimAccount *account = gc->account; | |
1036 aim_conn_t *bosconn; | |
1037 char *host; int port; | |
1038 int i, rc; | |
2086 | 1039 va_list ap; |
2704 | 1040 struct aim_authresp_info *info; |
6029 | 1041 |
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:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2437 NULL, _("Please authorize me!"), TRUE, FALSE, |
5493
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:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2517 NULL, _("No reason given."), TRUE, FALSE, |
5493
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); |
5948 | 3724 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi? */ |
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 |
5954 | 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); |
5948 | 3871 aim_srv_setavailmsg(sess, NULL); |
5917 | 3872 aim_bos_setidle(sess, fr->conn, 0); |
4617 | 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 | |
5954 | 4414 static void oscar_set_info(GaimConnection *gc, const char *text) { |
5129 | 4415 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4416 fu32_t flags = 0; | |
6019 | 4417 char *text_html = NULL; |
5129 | 4418 char *msg = NULL; |
4419 int msglen = 0; | |
2993 | 4420 |
4617 | 4421 if (od->rights.maxsiglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4422 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4423 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4424 "profile before the login procedure completed. " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4425 "Your profile remains unset; try setting it " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4426 "again when you are fully connected.")); |
4617 | 4427 |
4428 if (od->icq) | |
4429 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); | |
4151 | 4430 else { |
5129 | 4431 if (!text) { |
4432 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_aim); | |
4433 return; | |
4434 } | |
6019 | 4435 |
4436 text_html = strdup_withhtml(text); | |
4437 flags = oscar_encoding_check(text_html); | |
5129 | 4438 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 4439 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
5129 | 4440 aim_bos_setprofile(od->sess, od->conn, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); |
4441 g_free(msg); | |
4442 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 4443 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
5129 | 4444 aim_bos_setprofile(od->sess, od->conn, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); |
4445 g_free(msg); | |
4151 | 4446 } else { |
6019 | 4447 msglen = strlen(text_html); |
4448 aim_bos_setprofile(od->sess, od->conn, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); | |
4151 | 4449 } |
5129 | 4450 |
4451 if (msglen > od->rights.maxsiglen) { | |
4452 gchar *errstr; | |
4453 errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. " | |
4454 "Gaim has truncated it for you."), od->rights.maxsiglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4455 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); |
5129 | 4456 g_free(errstr); |
4457 } | |
4458 | |
6019 | 4459 g_free(text_html); |
4460 | |
5129 | 4461 } |
2993 | 4462 |
4463 return; | |
2086 | 4464 } |
4465 | |
5575 | 4466 static void oscar_set_away_aim(GaimConnection *gc, struct oscar_data *od, const char *text) |
2993 | 4467 { |
5129 | 4468 fu32_t flags = 0; |
6019 | 4469 gchar *text_html = NULL; |
5129 | 4470 char *msg = NULL; |
4471 int msglen = 0; | |
2993 | 4472 |
4473 if (od->rights.maxawaymsglen == 0) | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4474 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4475 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4476 "away message before the login procedure " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4477 "completed. You remain in a \"present\" " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4478 "state; try setting it again when you are " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4479 "fully connected.")); |
5129 | 4480 |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4481 if (gc->away) { |
2993 | 4482 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4483 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4484 } |
2993 | 4485 |
5129 | 4486 if (!text) { |
4151 | 4487 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
|
4488 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4489 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4490 |
6019 | 4491 flags = oscar_encoding_check(text_html); |
5129 | 4492 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 4493 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
5129 | 4494 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "unicode-2-0", msg, |
4495 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); | |
4496 g_free(msg); | |
4497 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
4498 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 4499 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
5129 | 4500 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "iso-8859-1", msg, |
4501 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); | |
4502 g_free(msg); | |
6019 | 4503 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4504 } else { |
6019 | 4505 msglen = strlen(text_html); |
4506 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", text_html, | |
5129 | 4507 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); |
6019 | 4508 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4509 } |
4510 | |
4511 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 4512 gchar *errstr; |
4513 | |
5129 | 4514 errstr = g_strdup_printf(_("The maximum away message length of %d bytes has been exceeded. " |
3427 | 4515 "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
|
4516 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); |
2993 | 4517 g_free(errstr); |
4518 } | |
6019 | 4519 |
4520 g_free(text_html); | |
2993 | 4521 return; |
4522 } | |
4523 | |
5575 | 4524 static void oscar_set_away_icq(GaimConnection *gc, struct oscar_data *od, const char *state, const char *message) |
2993 | 4525 { |
5575 | 4526 GaimAccount *account = gaim_connection_get_account(gc); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4527 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4528 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4529 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4530 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4531 |
4342 | 4532 if (strcmp(state, _("Invisible"))) { |
5575 | 4533 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
4534 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); | |
4535 account->perm_deny = 4; | |
4342 | 4536 } else { |
5542 | 4537 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)) |
4889 | 4538 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); |
5575 | 4539 account->perm_deny = 3; |
4342 | 4540 } |
4541 | |
4542 if (!strcmp(state, _("Online"))) | |
4901 | 4543 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 4544 else if (!strcmp(state, _("Away"))) { |
4901 | 4545 aim_setextstatus(od->sess, 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, _("Do Not Disturb"))) { |
4901 | 4548 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
|
4549 gc->away = g_strdup(""); |
4342 | 4550 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 4551 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
|
4552 gc->away = g_strdup(""); |
4342 | 4553 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 4554 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
|
4555 gc->away = g_strdup(""); |
4342 | 4556 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 4557 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4558 gc->away = g_strdup(""); |
4342 | 4559 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 4560 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4561 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4562 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 4563 if (message) { |
4901 | 4564 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
|
4565 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4566 } else { |
4901 | 4567 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4568 } |
2086 | 4569 } |
2993 | 4570 |
4571 return; | |
4572 } | |
4573 | |
5575 | 4574 static void oscar_set_away(GaimConnection *gc, char *state, char *message) |
2993 | 4575 { |
4576 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4577 | |
4578 if (od->icq) | |
4579 oscar_set_away_icq(gc, od, state, message); | |
4580 else | |
4581 oscar_set_away_aim(gc, od, message); | |
4582 | |
4583 return; | |
2086 | 4584 } |
4585 | |
5575 | 4586 static void oscar_warn(GaimConnection *gc, char *name, int anon) { |
4617 | 4587 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4588 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); | |
2086 | 4589 } |
4590 | |
5575 | 4591 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, |
3466 | 4592 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
4617 | 4593 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 4594 if (strlen(email)) |
4617 | 4595 aim_usersearch_address(od->sess, od->conn, email); |
2086 | 4596 } |
4597 | |
5575 | 4598 static void oscar_add_buddy(GaimConnection *gc, const char *name) { |
4230 | 4599 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4600 #ifdef NOSSI | |
4601 aim_add_buddy(od->sess, od->conn, name); | |
4602 #else | |
4603 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | |
4687 | 4604 struct buddy *buddy = gaim_find_buddy(gc->account, name); |
4605 struct group *group = gaim_find_buddys_group(buddy); | |
4230 | 4606 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4607 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4608 "ssi: adding buddy %s to group %s\n", name, group->name); |
4889 | 4609 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4610 } |
4611 } | |
4612 #endif | |
4759 | 4613 if (od->icq) |
4614 aim_icq_getalias(od->sess, name); | |
4230 | 4615 } |
4616 | |
5575 | 4617 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
4230 | 4618 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4619 #ifdef NOSSI | |
4620 char buf[MSG_LEN]; | |
4621 int n=0; | |
4622 while (buddies) { | |
4623 if (n > MSG_LEN - 18) { | |
4624 aim_bos_setbuddylist(od->sess, od->conn, buf); | |
4625 n = 0; | |
3092 | 4626 } |
4230 | 4627 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); |
4628 buddies = buddies->next; | |
4629 } | |
4630 aim_bos_setbuddylist(od->sess, od->conn, buf); | |
4631 #else | |
4632 if (od->sess->ssi.received_data) { | |
4633 while (buddies) { | |
4687 | 4634 struct buddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data); |
4635 struct group *group = gaim_find_buddys_group(buddy); | |
4230 | 4636 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4637 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4638 "ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name); |
4889 | 4639 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4640 } |
4641 buddies = buddies->next; | |
4642 } | |
4643 } | |
4644 #endif | |
4645 } | |
4646 | |
5575 | 4647 static void oscar_remove_buddy(GaimConnection *gc, char *name, char *group) { |
4230 | 4648 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4649 #ifdef NOSSI | |
4650 aim_remove_buddy(od->sess, od->conn, name); | |
4651 #else | |
4652 if (od->sess->ssi.received_data) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4653 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4654 "ssi: deleting buddy %s from group %s\n", name, group); |
4889 | 4655 aim_ssi_delbuddy(od->sess, name, group); |
4230 | 4656 } |
4657 #endif | |
4658 } | |
4659 | |
5575 | 4660 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
4230 | 4661 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4662 #ifdef NOSSI | |
4663 GList *cur; | |
4664 for (cur=buddies; cur; cur=cur->next) | |
4665 aim_remove_buddy(od->sess, od->conn, cur->data); | |
4666 #else | |
4667 if (od->sess->ssi.received_data) { | |
3092 | 4668 while (buddies) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4669 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4670 "ssi: deleting buddy %s from group %s\n", (char *)buddies->data, group); |
4889 | 4671 aim_ssi_delbuddy(od->sess, buddies->data, group); |
3092 | 4672 buddies = buddies->next; |
4673 } | |
4230 | 4674 } |
4675 #endif | |
4676 } | |
4677 | |
4678 #ifndef NOSSI | |
5575 | 4679 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
4269 | 4680 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4303 | 4681 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
|
4682 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4683 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 4684 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 4685 } |
4686 } | |
4687 | |
5575 | 4688 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
4269 | 4689 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4690 if (od->sess->ssi.received_data) { | |
4691 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
4692 if (gname) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4693 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4694 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4889 | 4695 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 4696 } |
4697 } | |
4698 } | |
4699 | |
5575 | 4700 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { |
4230 | 4701 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4702 | |
4703 if (od->sess->ssi.received_data) { | |
4704 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | |
4705 oscar_remove_buddies(g, members, old_group); | |
4706 oscar_add_buddies(g, members); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4707 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4708 "ssi: moved all buddies from group %s to %s\n", old_group, new_group); |
4230 | 4709 } else { |
4889 | 4710 aim_ssi_rename_group(od->sess, old_group, new_group); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4711 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4712 "ssi: renamed group %s to %s\n", old_group, new_group); |
2995 | 4713 } |
4714 } | |
4715 } | |
4716 | |
5968 | 4717 static gboolean gaim_ssi_rerequestdata(gpointer data) { |
4718 aim_session_t *sess = data; | |
4719 aim_ssi_reqdata(sess, sess->ssi.timestamp, sess->ssi.numitems); | |
4720 return FALSE; | |
4721 } | |
4722 | |
4642 | 4723 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4724 GaimConnection *gc = sess->aux_data; |
4642 | 4725 struct oscar_data *od = gc->proto_data; |
4726 va_list ap; | |
4727 fu16_t reason; | |
4728 | |
4729 va_start(ap, fr); | |
4730 reason = (fu16_t)va_arg(ap, unsigned int); | |
4731 va_end(ap); | |
4732 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4733 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); |
4642 | 4734 |
4735 if (reason == 0x0005) { | |
5892 | 4736 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), |
5828 | 4737 _("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.")); |
5968 | 4738 od->getblisttimer = g_timeout_add(300000, gaim_ssi_rerequestdata, od->sess); |
4642 | 4739 } |
4740 | |
4741 /* Activate SSI */ | |
4742 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4743 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
5968 | 4744 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: activating server-stored buddy list\n"); |
4642 | 4745 aim_ssi_enable(od->sess); |
4746 | |
4747 return 1; | |
4748 } | |
4749 | |
2991 | 4750 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4751 GaimConnection *gc = sess->aux_data; |
4230 | 4752 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4753 int numtypes, i; | |
4754 fu16_t *maxitems; | |
2991 | 4755 va_list ap; |
4756 | |
4757 va_start(ap, fr); | |
4230 | 4758 numtypes = va_arg(ap, int); |
4759 maxitems = va_arg(ap, fu16_t *); | |
2991 | 4760 va_end(ap); |
4761 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4762 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ssi rights:"); |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4763 |
4230 | 4764 for (i=0; i<numtypes; i++) |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4765 gaim_debug(GAIM_DEBUG_MISC, NULL, " max type 0x%04x=%hd,", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4766 i, maxitems[i]); |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4767 |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4768 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
4230 | 4769 |
4770 if (numtypes >= 0) | |
4771 od->rights.maxbuddies = maxitems[0]; | |
4772 if (numtypes >= 1) | |
4773 od->rights.maxgroups = maxitems[1]; | |
4774 if (numtypes >= 2) | |
4775 od->rights.maxpermits = maxitems[2]; | |
4776 if (numtypes >= 3) | |
4777 od->rights.maxdenies = maxitems[3]; | |
2991 | 4778 |
4779 return 1; | |
4780 } | |
4781 | |
4782 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4783 GaimConnection *gc = sess->aux_data; |
4784 GaimAccount *account = gaim_connection_get_account(gc); | |
4230 | 4785 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 4786 struct aim_ssi_item *curitem; |
2991 | 4787 int tmp; |
4778 | 4788 gboolean export = FALSE; |
4617 | 4789 /* XXX - use these? |
4230 | 4790 va_list ap; |
4791 | |
4792 va_start(ap, fr); | |
4793 fmtver = (fu16_t)va_arg(ap, int); | |
4794 numitems = (fu16_t)va_arg(ap, int); | |
4795 items = va_arg(ap, struct aim_ssi_item); | |
4796 timestamp = va_arg(ap, fu32_t); | |
4797 va_end(ap); */ | |
2991 | 4798 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4799 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4800 "ssi: syncing local list and server list\n"); |
2991 | 4801 |
4802 /* Clean the buddy list */ | |
4889 | 4803 aim_ssi_cleanlist(sess); |
2991 | 4804 |
4805 /* Add from server list to local list */ | |
4230 | 4806 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
2991 | 4807 switch (curitem->type) { |
4230 | 4808 case 0x0000: { /* Buddy */ |
4251 | 4809 if (curitem->name) { |
4292 | 4810 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
4458 | 4811 char *gname_utf8 = gaim_try_conv_to_utf8(gname); |
4282 | 4812 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
4458 | 4813 char *alias_utf8 = gaim_try_conv_to_utf8(alias); |
4687 | 4814 struct buddy *buddy = gaim_find_buddy(gc->account, curitem->name); |
4458 | 4815 /* Should gname be freed here? -- elb */ |
4754 | 4816 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 4817 free(alias); |
4282 | 4818 if (buddy) { |
4292 | 4819 /* Get server stored alias */ |
4705 | 4820 if (alias_utf8) { |
4821 g_free(buddy->alias); | |
4822 buddy->alias = g_strdup(alias_utf8); | |
4823 } | |
4282 | 4824 } else { |
4687 | 4825 struct group *g; |
4826 buddy = gaim_buddy_new(gc->account, curitem->name, alias_utf8); | |
5146 | 4827 |
4754 | 4828 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 4829 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 4830 gaim_blist_add_group(g, NULL); |
4831 } | |
5146 | 4832 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4833 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4834 "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
4687 | 4835 gaim_blist_add_buddy(buddy, g, NULL); |
4778 | 4836 export = TRUE; |
4251 | 4837 } |
4458 | 4838 free(gname_utf8); |
4839 free(alias_utf8); | |
2991 | 4840 } |
4230 | 4841 } break; |
4842 | |
4843 case 0x0001: { /* Group */ | |
4282 | 4844 /* Shouldn't add empty groups */ |
4230 | 4845 } break; |
4846 | |
4847 case 0x0002: { /* Permit buddy */ | |
2991 | 4848 if (curitem->name) { |
4230 | 4849 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 4850 GSList *list; |
5575 | 4851 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4852 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4853 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4854 "ssi: adding permit buddy %s to local list\n", curitem->name); |
5575 | 4855 gaim_privacy_permit_add(account, curitem->name); |
2991 | 4856 build_allow_list(); |
4778 | 4857 export = TRUE; |
2991 | 4858 } |
4859 } | |
4230 | 4860 } break; |
4861 | |
4862 case 0x0003: { /* Deny buddy */ | |
2991 | 4863 if (curitem->name) { |
4864 GSList *list; | |
5575 | 4865 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4866 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4867 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4868 "ssi: adding deny buddy %s to local list\n", curitem->name); |
5575 | 4869 gaim_privacy_deny_add(account, curitem->name); |
2991 | 4870 build_block_list(); |
4778 | 4871 export = TRUE; |
2991 | 4872 } |
4873 } | |
4230 | 4874 } break; |
4875 | |
4876 case 0x0004: { /* Permit/deny setting */ | |
2991 | 4877 if (curitem->data) { |
4878 fu8_t permdeny; | |
5575 | 4879 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
|
4880 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5575 | 4881 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
4882 account->perm_deny = permdeny; | |
4883 if (od->icq && account->perm_deny == 0x03) { | |
4342 | 4884 serv_set_away(gc, "Invisible", ""); |
4885 } | |
4778 | 4886 export = TRUE; |
2991 | 4887 } |
4888 } | |
4230 | 4889 } break; |
4890 | |
4891 case 0x0005: { /* Presence setting */ | |
3109 | 4892 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 4893 } break; |
2991 | 4894 } /* End of switch on curitem->type */ |
4895 } /* End of for loop */ | |
4230 | 4896 |
4897 /* If changes were made, then flush buddy list to file */ | |
4778 | 4898 if (export) |
4349 | 4899 gaim_blist_save(); |
2991 | 4900 |
4759 | 4901 { /* Add from local list to server list */ |
4902 GaimBlistNode *gnode, *bnode; | |
4903 struct group *group; | |
4904 struct buddy *buddy; | |
4905 struct gaim_buddy_list *blist; | |
3017 | 4906 GSList *cur; |
4907 | |
2991 | 4908 /* Buddies */ |
4759 | 4909 if ((blist = gaim_get_blist())) |
4910 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
5234 | 4911 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
4912 continue; | |
4759 | 4913 group = (struct group *)gnode; |
4914 for (bnode = gnode->child; bnode; bnode = bnode->next) { | |
5234 | 4915 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) |
4916 continue; | |
4759 | 4917 buddy = (struct buddy *)bnode; |
4918 if (buddy->account == gc->account) { | |
4919 gchar *servernick = gaim_buddy_get_setting(buddy, "servernick"); | |
4920 if (servernick) { | |
4921 serv_got_alias(gc, buddy->name, servernick); | |
4922 g_free(servernick); | |
4923 } | |
4924 if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) { | |
4925 /* Store local alias on server */ | |
4926 char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name); | |
4783 | 4927 if (!alias && buddy->alias && strlen(buddy->alias)) |
4889 | 4928 aim_ssi_aliasbuddy(sess, group->name, buddy->name, buddy->alias); |
4759 | 4929 free(alias); |
4930 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4931 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4932 "ssi: adding buddy %s from local list to server list\n", buddy->name); |
4889 | 4933 aim_ssi_addbuddy(sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4759 | 4934 } |
4349 | 4935 } |
4230 | 4936 } |
4292 | 4937 } |
2991 | 4938 /* Permit list */ |
4491 | 4939 if (gc->account->permit) { |
4940 for (cur=gc->account->permit; cur; cur=cur->next) | |
4230 | 4941 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
|
4942 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4943 "ssi: adding permit %s from local list to server list\n", (char *)cur->data); |
4889 | 4944 aim_ssi_addpermit(sess, cur->data); |
4230 | 4945 } |
2991 | 4946 } |
4947 | |
4948 /* Deny list */ | |
4491 | 4949 if (gc->account->deny) { |
4950 for (cur=gc->account->deny; cur; cur=cur->next) | |
4230 | 4951 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
|
4952 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4953 "ssi: adding deny %s from local list to server list\n", (char *)cur->data); |
4889 | 4954 aim_ssi_adddeny(sess, cur->data); |
4230 | 4955 } |
2991 | 4956 } |
3109 | 4957 /* Presence settings (idle time visibility) */ |
4230 | 4958 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) |
5631 | 4959 if (!(tmp & 0x400)) |
4889 | 4960 aim_ssi_setpresence(sess, tmp | 0x400); |
4778 | 4961 } /* end adding buddies from local list to server list */ |
4962 | |
4901 | 4963 /* Set our ICQ status */ |
4964 if (od->icq && !gc->away) { | |
4965 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); | |
4966 } | |
4967 | |
4342 | 4968 /* Activate SSI */ |
4969 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4970 /* 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
|
4971 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4972 "ssi: activating server-stored buddy list\n"); |
4642 | 4973 aim_ssi_enable(sess); |
4342 | 4974 |
2991 | 4975 return 1; |
2086 | 4976 } |
4230 | 4977 |
4978 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4979 GaimConnection *gc = sess->aux_data; |
4230 | 4980 va_list ap; |
4981 struct aim_ssi_tmp *retval; | |
4982 | |
4983 va_start(ap, fr); | |
4984 retval = va_arg(ap, struct aim_ssi_tmp *); | |
4985 va_end(ap); | |
4986 | |
4987 while (retval) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4988 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4989 "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 | 4990 |
4991 if (retval->ack != 0xffff) | |
4992 switch (retval->ack) { | |
4993 case 0x0000: { /* added successfully */ | |
4994 } break; | |
4995 | |
4829 | 4996 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
4997 gchar *buf; | |
4998 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
|
4999 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4829 | 5000 g_free(buf); |
5001 } | |
5002 | |
4230 | 5003 case 0x000e: { /* contact requires authorization */ |
4828 | 5004 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 5005 gaim_auth_sendrequest(gc, retval->name); |
4230 | 5006 } break; |
5007 | |
5008 default: { /* La la la */ | |
5197 | 5009 gchar *buf; |
5402 | 5010 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
5011 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
|
5012 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5197 | 5013 g_free(buf); |
5402 | 5014 /* XXX - Should remove buddy from local list */ |
4230 | 5015 } break; |
5016 } | |
5017 | |
5018 retval = retval->next; | |
5019 } | |
5020 | |
5021 return 1; | |
5022 } | |
5023 | |
5024 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5025 GaimConnection *gc = sess->aux_data; |
4230 | 5026 va_list ap; |
5027 char *sn, *msg; | |
4236 | 5028 gchar *dialog_msg, *nombre; |
4230 | 5029 struct name_data *data; |
4236 | 5030 struct buddy *buddy; |
4230 | 5031 |
5032 va_start(ap, fr); | |
5033 sn = va_arg(ap, char *); | |
5034 msg = va_arg(ap, char *); | |
5035 va_end(ap); | |
5036 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5037 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5038 "ssi: %s has given you permission to add him to your buddy list\n", sn); |
4230 | 5039 |
4687 | 5040 buddy = gaim_find_buddy(gc->account, sn); |
5041 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5042 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5043 else |
5044 nombre = g_strdup(sn); | |
5045 | |
5046 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 | 5047 data = g_new(struct name_data, 1); |
5048 data->gc = gc; | |
5049 data->name = g_strdup(sn); | |
5050 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5051 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5052 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5053 0, data, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5054 G_CALLBACK(gaim_icq_contactadd), |
5836 | 5055 G_CALLBACK(oscar_free_name_data)); |
4236 | 5056 |
4230 | 5057 g_free(dialog_msg); |
4236 | 5058 g_free(nombre); |
4230 | 5059 |
5060 return 1; | |
5061 } | |
5062 | |
5063 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5064 GaimConnection *gc = sess->aux_data; |
4230 | 5065 va_list ap; |
5066 char *sn, *msg; | |
4236 | 5067 gchar *dialog_msg, *nombre; |
4230 | 5068 struct name_data *data; |
4236 | 5069 struct buddy *buddy; |
4230 | 5070 |
5071 va_start(ap, fr); | |
5072 sn = va_arg(ap, char *); | |
5073 msg = va_arg(ap, char *); | |
5074 va_end(ap); | |
5075 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5076 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5077 "ssi: received authorization request from %s\n", sn); |
4230 | 5078 |
4687 | 5079 buddy = gaim_find_buddy(gc->account, sn); |
5080 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5081 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5082 else |
5083 nombre = g_strdup(sn); | |
5084 | |
4337 | 5085 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 | 5086 data = g_new(struct name_data, 1); |
5087 data->gc = gc; | |
5088 data->name = g_strdup(sn); | |
5089 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5090 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5091 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5092 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5093 _("Authorize"), G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5094 _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4236 | 5095 |
4230 | 5096 g_free(dialog_msg); |
4236 | 5097 g_free(nombre); |
4230 | 5098 |
5099 return 1; | |
5100 } | |
5101 | |
5102 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5103 GaimConnection *gc = sess->aux_data; |
4230 | 5104 va_list ap; |
5105 char *sn, *msg; | |
4236 | 5106 gchar *dialog_msg, *nombre; |
4230 | 5107 fu8_t reply; |
4236 | 5108 struct buddy *buddy; |
4230 | 5109 |
5110 va_start(ap, fr); | |
5111 sn = va_arg(ap, char *); | |
5112 reply = (fu8_t)va_arg(ap, int); | |
5113 msg = va_arg(ap, char *); | |
5114 va_end(ap); | |
5115 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5116 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5117 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4236 | 5118 |
4687 | 5119 buddy = gaim_find_buddy(gc->account, sn); |
5120 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5121 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5122 else |
5123 nombre = g_strdup(sn); | |
5124 | |
4230 | 5125 if (reply) { |
5126 /* Granted */ | |
4236 | 5127 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
|
5128 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); |
4230 | 5129 } else { |
5130 /* Denied */ | |
4236 | 5131 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
|
5132 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); |
4230 | 5133 } |
5134 g_free(dialog_msg); | |
4236 | 5135 g_free(nombre); |
4230 | 5136 |
5137 return 1; | |
5138 } | |
5139 | |
5140 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5141 GaimConnection *gc = sess->aux_data; |
4230 | 5142 va_list ap; |
5143 char *sn; | |
4236 | 5144 struct buddy *buddy; |
4230 | 5145 |
5146 va_start(ap, fr); | |
5147 sn = va_arg(ap, char *); | |
5148 va_end(ap); | |
5149 | |
4687 | 5150 buddy = gaim_find_buddy(gc->account, sn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5151 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5152 "ssi: %s added you to their buddy list\n", sn); |
4687 | 5153 show_got_added(gc, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 5154 |
5155 return 1; | |
5156 } | |
4269 | 5157 #endif |
2086 | 5158 |
5575 | 5159 static GList *oscar_chat_info(GaimConnection *gc) { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5160 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5161 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5162 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5163 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5164 pce->label = _("Join what group:"); |
5234 | 5165 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5166 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5167 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5168 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5169 pce->label = _("Exchange:"); |
5234 | 5170 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5171 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5172 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5173 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5174 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5175 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5176 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5177 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5178 |
5575 | 5179 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { |
4617 | 5180 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5181 aim_conn_t *cur; |
5234 | 5182 char *name, *exchange; |
5183 | |
5184 name = g_hash_table_lookup(data, "room"); | |
5185 exchange = g_hash_table_lookup(data, "exchange"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5186 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5187 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5188 "Attempting to join chat room %s.\n", name); |
4617 | 5189 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
|
5190 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5191 "chatnav exists, creating room\n"); |
5234 | 5192 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); |
2086 | 5193 } else { |
5194 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5195 struct create_room *cr = g_new0(struct create_room, 1); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5196 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5197 "chatnav does not exist, opening chatnav\n"); |
5234 | 5198 cr->exchange = atoi(exchange); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5199 cr->name = g_strdup(name); |
4617 | 5200 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5201 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 5202 } |
5203 } | |
5204 | |
5575 | 5205 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { |
4617 | 5206 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2086 | 5207 struct chat_connection *ccon = find_oscar_chat(g, id); |
5208 | |
5209 if (!ccon) | |
5210 return; | |
5211 | |
4617 | 5212 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
2086 | 5213 ccon->exchange, ccon->name, 0x0); |
5214 } | |
5215 | |
5575 | 5216 static void oscar_chat_leave(GaimConnection *g, int id) { |
4617 | 5217 struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL; |
2086 | 5218 GSList *bcs = g->buddy_chats; |
5679 | 5219 GaimConversation *b = NULL; |
2086 | 5220 struct chat_connection *c = NULL; |
5221 int count = 0; | |
5222 | |
5223 while (bcs) { | |
5224 count++; | |
5679 | 5225 b = (GaimConversation *)bcs->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5226 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 5227 break; |
5228 bcs = bcs->next; | |
5229 b = NULL; | |
5230 } | |
5231 | |
5232 if (!b) | |
5233 return; | |
5234 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5235 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5236 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); |
2086 | 5237 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5238 c = find_oscar_chat(g, gaim_chat_get_id(GAIM_CHAT(b))); |
2086 | 5239 if (c != NULL) { |
4617 | 5240 if (od) |
5241 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 5242 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5243 gaim_input_remove(c->inpa); |
4617 | 5244 if (g && od->sess) |
5245 aim_conn_kill(od->sess, &c->conn); | |
2086 | 5246 g_free(c->name); |
5247 g_free(c->show); | |
5248 g_free(c); | |
5249 } | |
5250 /* 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
|
5251 serv_got_chat_left(g, gaim_chat_get_id(GAIM_CHAT(b))); |
2086 | 5252 } |
5253 | |
5575 | 5254 static int oscar_chat_send(GaimConnection *g, int id, char *message) { |
4617 | 5255 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2086 | 5256 GSList *bcs = g->buddy_chats; |
5679 | 5257 GaimConversation *b = NULL; |
2086 | 5258 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5259 char *buf, *buf2; |
2086 | 5260 int i, j; |
5261 | |
5262 while (bcs) { | |
5679 | 5263 b = (GaimConversation *)bcs->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5264 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 5265 break; |
5266 bcs = bcs->next; | |
5267 b = NULL; | |
5268 } | |
5269 if (!b) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5270 return -EINVAL; |
2086 | 5271 |
4617 | 5272 bcs = od->oscar_chats; |
2086 | 5273 while (bcs) { |
5274 c = (struct chat_connection *)bcs->data; | |
5275 if (b == c->cnv) | |
5276 break; | |
5277 bcs = bcs->next; | |
5278 c = NULL; | |
5279 } | |
5280 if (!c) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5281 return -EINVAL; |
2086 | 5282 |
5283 buf = g_malloc(strlen(message) * 4 + 1); | |
5284 for (i = 0, j = 0; i < strlen(message); i++) { | |
5285 if (message[i] == '\n') { | |
5286 buf[j++] = '<'; | |
5287 buf[j++] = 'B'; | |
5288 buf[j++] = 'R'; | |
5289 buf[j++] = '>'; | |
5290 } else { | |
5291 buf[j++] = message[i]; | |
5292 } | |
5293 } | |
5294 buf[j] = '\0'; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5295 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5296 if (strlen(buf) > c->maxlen) |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5297 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5298 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5299 buf2 = strip_html(buf); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5300 if (strlen(buf2) > c->maxvis) { |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5301 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5302 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5303 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5304 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5305 |
4617 | 5306 aim_chat_send_im(od->sess, c->conn, 0, buf, strlen(buf)); |
2086 | 5307 g_free(buf); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5308 return 0; |
2086 | 5309 } |
5310 | |
5575 | 5311 static const char *oscar_list_icon(GaimAccount *a, struct buddy *b) { |
4766 | 5312 if (!b || (b && b->name && b->name[0] == '+')) { |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5313 if (a != NULL && isdigit(*gaim_account_get_username(a))) |
4687 | 5314 return "icq"; |
5315 else | |
5316 return "aim"; | |
5317 } | |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5318 |
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5319 if (b != NULL && isdigit(b->name[0])) |
4687 | 5320 return "icq"; |
5321 return "aim"; | |
5322 } | |
5323 | |
4690 | 5324 static void oscar_list_emblems(struct buddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 5325 { |
5326 char *emblems[4] = {NULL,NULL,NULL,NULL}; | |
5327 int i = 0; | |
5328 | |
5131 | 5329 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5575 | 5330 GaimAccount *account; |
5331 GaimConnection *gc; | |
5131 | 5332 struct oscar_data *od; |
5333 char *gname; | |
5334 if ((b->name) && (account = b->account) && (gc = account->gc) && | |
5335 (od = gc->proto_data) && (od->sess->ssi.received_data) && | |
5336 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && | |
5337 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
5338 emblems[i++] = "notauthorized"; | |
5339 } else { | |
5340 emblems[i++] = "offline"; | |
5341 } | |
5342 } | |
4916 | 5343 |
4766 | 5344 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 5345 int uc = b->uc >> 16; |
4766 | 5346 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 5347 emblems[i++] = "invisible"; |
4766 | 5348 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 5349 emblems[i++] = "freeforchat"; |
4766 | 5350 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 5351 emblems[i++] = "dnd"; |
4766 | 5352 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 5353 emblems[i++] = "na"; |
4766 | 5354 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 5355 emblems[i++] = "occupied"; |
4766 | 5356 else if (uc & AIM_ICQ_STATE_AWAY) |
5357 emblems[i++] = "away"; | |
5358 } else { | |
5359 if (b->uc & UC_UNAVAILABLE) | |
5360 emblems[i++] = "away"; | |
5361 } | |
4687 | 5362 if (b->uc & UC_WIRELESS) |
5363 emblems[i++] = "wireless"; | |
5364 if (b->uc & UC_AOL) | |
5365 emblems[i++] = "aol"; | |
5366 if (b->uc & UC_ADMIN) | |
5367 emblems[i++] = "admin"; | |
5368 if (b->uc & UC_AB && i < 4) | |
5369 emblems[i++] = "activebuddy"; | |
4766 | 5370 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
5371 emblems[i++] = "unconfirmed"; */ | |
4687 | 5372 *se = emblems[0]; |
5373 *sw = emblems[1]; | |
5374 *nw = emblems[2]; | |
5375 *ne = emblems[3]; | |
5376 } | |
5377 | |
5131 | 5378 static char *oscar_tooltip_text(struct buddy *b) { |
5575 | 5379 GaimConnection *gc = b->account->gc; |
5131 | 5380 struct oscar_data *od = gc->proto_data; |
5381 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); | |
5382 gchar *tmp, *yay = g_strdup(""); | |
5383 | |
5384 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
5385 if (isdigit(b->name[0])) { | |
5386 char *tmp, *status; | |
5387 status = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
5388 tmp = yay; | |
5389 yay = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); | |
5390 g_free(tmp); | |
5391 g_free(status); | |
5392 } | |
5393 | |
5394 if (bi) { | |
5395 char *tstr = sec_to_text(time(NULL) - bi->signon + | |
5396 (gc->login_time_official ? gc->login_time_official - gc->login_time : 0)); | |
5397 tmp = yay; | |
5398 yay = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL); | |
5399 free(tmp); | |
5400 free(tstr); | |
5401 | |
5402 if (bi->caps) { | |
5403 char *caps = caps_string(bi->caps); | |
5404 tmp = yay; | |
5405 yay = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); | |
5406 free(tmp); | |
5407 } | |
5836 | 5408 |
5948 | 5409 if (bi->availablemsg && !(b->uc & UC_UNAVAILABLE)) { |
5836 | 5410 tmp = yay; |
5411 yay = g_strconcat(tmp, _("<b>Available:</b> "), bi->availablemsg, "\n", NULL); | |
5412 free(tmp); | |
5413 } | |
5131 | 5414 } |
5415 } else { | |
5416 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
5417 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { | |
5418 tmp = yay; | |
5419 yay = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); | |
5420 g_free(tmp); | |
5421 } else { | |
5422 tmp = yay; | |
5423 yay = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); | |
5424 g_free(tmp); | |
5425 } | |
5426 } | |
5427 | |
5428 /* remove the trailing newline character */ | |
5429 if (yay) | |
5430 yay[strlen(yay)-1] = '\0'; | |
5431 return yay; | |
5432 } | |
5433 | |
5167 | 5434 static char *oscar_status_text(struct buddy *b) { |
5575 | 5435 GaimConnection *gc = b->account->gc; |
5167 | 5436 struct oscar_data *od = gc->proto_data; |
5437 gchar *ret = NULL; | |
5438 | |
5439 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | |
5440 if (isdigit(b->name[0])) | |
5441 ret = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
5442 else | |
5443 ret = g_strdup(_("Away")); | |
5836 | 5444 } else if (GAIM_BUDDY_IS_ONLINE(b)) { |
5445 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); | |
5446 if (bi->availablemsg) | |
5447 ret = g_strdup(bi->availablemsg); | |
5448 } else { | |
5167 | 5449 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); |
5450 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) | |
5451 ret = g_strdup(_("Not Authorized")); | |
5452 else | |
5453 ret = g_strdup(_("Offline")); | |
5454 } | |
5455 | |
5456 return ret; | |
5457 } | |
5458 | |
5842 | 5459 |
5844 | 5460 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5842 | 5461 GaimConnection *gc = sess->aux_data; |
5462 struct oscar_data *od = gc->proto_data; | |
5892 | 5463 va_list ap; |
5842 | 5464 fu16_t type; |
5892 | 5465 fu8_t flags = 0, length = 0; |
5466 char *md5 = NULL; | |
5467 | |
5842 | 5468 va_start(ap, fr); |
5469 type = va_arg(ap, int); | |
5892 | 5470 |
5471 switch(type) { | |
5472 case 0x0000: | |
5473 case 0x0001: { | |
5474 flags = va_arg(ap, int); | |
5475 length = va_arg(ap, int); | |
5476 md5 = va_arg(ap, char *); | |
5477 | |
5478 if (flags == 0x41) { | |
5479 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
5480 od->iconconnecting = TRUE; | |
5481 od->set_icon = TRUE; | |
5482 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
5483 } else { | |
5484 const char *iconfile; | |
5485 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)))) { | |
5486 FILE *file; | |
5487 struct stat st; | |
5488 | |
5489 if (!stat(iconfile, &st)) { | |
5490 char *buf = g_malloc(st.st_size); | |
5491 file = fopen(iconfile, "rb"); | |
5492 if (file) { | |
5493 fread(buf, 1, st.st_size, file); | |
5494 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5495 "Uploading icon to icon server\n"); | |
5496 aim_icon_upload(od->sess, buf, st.st_size); | |
5497 fclose(file); | |
5498 } else | |
5499 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5500 "Can't open buddy icon file!\n"); | |
5501 g_free(buf); | |
5502 } else | |
5503 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5504 "Can't stat buddy icon file!\n"); | |
5505 } | |
5506 } | |
5893 | 5507 } else if (flags == 0x81) |
5508 aim_ssi_seticon(od->sess, md5, length); | |
5892 | 5509 } break; |
5510 | |
5511 case 0x0002: { /* We just set an "available" message? */ | |
5512 } break; | |
5513 } | |
5514 | |
5842 | 5515 va_end(ap); |
5844 | 5516 |
5517 return 0; | |
5842 | 5518 } |
5892 | 5519 |
3952 | 5520 /* |
4617 | 5521 * We have just established a socket with the other dude, so set up some handlers. |
3952 | 5522 */ |
4617 | 5523 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5524 GaimConnection *gc = sess->aux_data; |
2086 | 5525 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5679 | 5526 GaimConversation *cnv; |
2086 | 5527 struct direct_im *dim; |
5528 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5529 char *sn; |
4617 | 5530 va_list ap; |
5531 aim_conn_t *newconn, *listenerconn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5532 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5533 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5534 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5535 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 5536 va_end(ap); |
5537 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5538 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5539 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5540 |
4617 | 5541 sn = g_strdup(aim_odc_getsn(newconn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5542 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5543 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5544 "DirectIM: initiate success to %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5545 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5546 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5547 if (!(cnv = gaim_find_conversation(sn))) |
4491 | 5548 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
|
5549 gaim_input_remove(dim->watcher); |
2086 | 5550 dim->conn = newconn; |
4617 | 5551 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
3008 | 5552 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5553 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5554 g_free(sn); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5555 gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); |
2086 | 5556 |
4617 | 5557 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); |
5558 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
5559 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_update_ui, 0); | |
5560 | |
2993 | 5561 return 1; |
5562 } | |
5563 | |
5564 static int gaim_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5565 va_list ap; | |
5566 char *sn; | |
5567 double percent; | |
5575 | 5568 GaimConnection *gc = sess->aux_data; |
2993 | 5569 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5679 | 5570 GaimConversation *c; |
2993 | 5571 struct direct_im *dim; |
5572 | |
5573 va_start(ap, fr); | |
5574 sn = va_arg(ap, char *); | |
5575 percent = va_arg(ap, double); | |
5576 va_end(ap); | |
5577 | |
2994 | 5578 if (!(dim = find_direct_im(od, sn))) |
5579 return 1; | |
3059 | 5580 if (dim->watcher) { |
5581 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
5582 dim->watcher = 0; | |
5583 } | |
3044 | 5584 while (gtk_events_pending()) |
5585 gtk_main_iteration(); | |
5586 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5587 if ((c = gaim_find_conversation(sn))) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5588 gaim_conversation_update_progress(c, percent); |
2993 | 5589 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
5590 oscar_callback, dim->conn); | |
2086 | 5591 |
5592 return 1; | |
5593 } | |
5594 | |
4617 | 5595 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5596 GaimConnection *gc = sess->aux_data; |
4870 | 5597 int imflags = 0; |
2086 | 5598 va_list ap; |
4870 | 5599 char *sn, *msg; |
5600 int len, encoding, isawaymsg; | |
2086 | 5601 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5602 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5603 sn = va_arg(ap, char *); |
2086 | 5604 msg = va_arg(ap, char *); |
2993 | 5605 len = va_arg(ap, int); |
3952 | 5606 encoding = va_arg(ap, int); |
4870 | 5607 isawaymsg = va_arg(ap, int); |
2086 | 5608 va_end(ap); |
5609 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5610 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5611 "Got DirectIM message from %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5612 |
4870 | 5613 if (isawaymsg) |
5614 imflags |= IM_FLAG_AWAY; | |
5615 | |
4617 | 5616 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
4870 | 5617 serv_got_im(gc, sn, msg, imflags, time(NULL), len); |
2086 | 5618 |
5619 return 1; | |
5620 } | |
5621 | |
4617 | 5622 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 5623 va_list ap; |
5624 char *sn; | |
2993 | 5625 int typing; |
5575 | 5626 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5627 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5628 va_start(ap, fr); |
2086 | 5629 sn = va_arg(ap, char *); |
2993 | 5630 typing = va_arg(ap, int); |
2086 | 5631 va_end(ap); |
5632 | |
4870 | 5633 if (typing == 0x0002) { |
2993 | 5634 /* 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
|
5635 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5636 "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
|
5637 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
4870 | 5638 } else if (typing == 0x0001) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5639 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
4870 | 5640 else |
4342 | 5641 serv_got_typing_stopped(gc, sn); |
2086 | 5642 return 1; |
5643 } | |
5644 | |
5645 struct ask_do_dir_im { | |
5646 char *who; | |
5575 | 5647 GaimConnection *gc; |
2086 | 5648 }; |
5649 | |
3730 | 5650 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5136 | 5651 g_free(data->who); |
2086 | 5652 g_free(data); |
5653 } | |
5654 | |
3730 | 5655 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5575 | 5656 GaimConnection *gc = data->gc; |
4244 | 5657 struct oscar_data *od; |
2086 | 5658 struct direct_im *dim; |
5659 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
5660 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5136 | 5661 g_free(data->who); |
4244 | 5662 g_free(data); |
5663 return; | |
5664 } | |
5665 | |
5666 od = (struct oscar_data *)gc->proto_data; | |
5667 | |
2086 | 5668 dim = find_direct_im(od, data->who); |
5669 if (dim) { | |
3008 | 5670 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
5671 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
5672 gaim_input_remove(dim->watcher); | |
5673 g_free(dim); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5674 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5675 "Gave up on old direct IM, trying again\n"); |
3008 | 5676 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5677 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); |
5136 | 5678 g_free(data->who); |
4244 | 5679 g_free(data); |
3008 | 5680 return; |
5681 } | |
2086 | 5682 } |
5683 dim = g_new0(struct direct_im, 1); | |
5684 dim->gc = gc; | |
5685 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
5686 | |
4617 | 5687 dim->conn = aim_odc_initiate(od->sess, data->who); |
2086 | 5688 if (dim->conn != NULL) { |
5689 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5690 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 5691 oscar_callback, dim->conn); |
4617 | 5692 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
5693 gaim_odc_initiate, 0); | |
2086 | 5694 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5695 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL); |
2086 | 5696 g_free(dim); |
5697 } | |
4244 | 5698 |
5136 | 5699 g_free(data->who); |
4244 | 5700 g_free(data); |
2086 | 5701 } |
5702 | |
5575 | 5703 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
5420 | 5704 gchar *buf; |
2086 | 5705 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
5136 | 5706 data->who = g_strdup(who); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
5707 data->gc = gc; |
5420 | 5708 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
|
5709 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5710 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5711 _("Because this reveals your IP address, it " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5712 "may be considered a privacy risk. Do you " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5713 "wish to continue?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5714 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5715 _("Connect"), G_CALLBACK(oscar_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5716 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
5420 | 5717 g_free(buf); |
2086 | 5718 } |
5719 | |
5575 | 5720 static void oscar_set_permit_deny(GaimConnection *gc) { |
5721 GaimAccount *account = gaim_connection_get_account(gc); | |
2086 | 5722 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4230 | 5723 #ifdef NOSSI |
4770 | 5724 GSList *list, *g = gaim_blist_groups(), *g1; |
4230 | 5725 char buf[MAXMSGLEN]; |
5726 int at; | |
5727 | |
5575 | 5728 switch(account->perm_deny) { |
4687 | 5729 case 1: |
5575 | 5730 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
4230 | 5731 break; |
5732 case 2: | |
5575 | 5733 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
4230 | 5734 break; |
5735 case 3: | |
5575 | 5736 list = account->permit; |
4230 | 5737 at = 0; |
5738 while (list) { | |
5739 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
5740 list = list->next; | |
5741 } | |
5742 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
5743 break; | |
5744 case 4: | |
5575 | 5745 list = account->deny; |
4230 | 5746 at = 0; |
5747 while (list) { | |
5748 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
5749 list = list->next; | |
5750 } | |
5751 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
5752 break; | |
5753 case 5: | |
4770 | 5754 g1 = g; |
4230 | 5755 at = 0; |
4770 | 5756 while (g1) { |
5757 list = gaim_blist_members((struct group *)g->data); | |
5758 GSList list1 = list; | |
5759 while (list1) { | |
5760 struct buddy *b = list1->data; | |
5575 | 5761 if(b->account == account) |
4349 | 5762 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); |
4770 | 5763 list1 = list1->next; |
2995 | 5764 } |
4770 | 5765 g_slist_free(list); |
5766 g1 = g1->next; | |
4349 | 5767 } |
4770 | 5768 g_slist_free(g); |
4230 | 5769 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); |
5770 break; | |
5771 default: | |
5772 break; | |
2086 | 5773 } |
4230 | 5774 signoff_blocked(gc); |
5775 #else | |
5776 if (od->sess->ssi.received_data) | |
5575 | 5777 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); |
4230 | 5778 #endif |
2086 | 5779 } |
5780 | |
5575 | 5781 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
4269 | 5782 #ifdef NOSSI |
4491 | 5783 if (gc->account->permdeny == 3) |
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 permit\n"); |
4230 | 5788 if (od->sess->ssi.received_data) |
4889 | 5789 aim_ssi_addpermit(od->sess, who); |
4230 | 5790 #endif |
2086 | 5791 } |
5792 | |
5575 | 5793 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
4269 | 5794 #ifdef NOSSI |
4491 | 5795 if (gc->account->permdeny == 4) |
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 add a deny\n"); |
4230 | 5800 if (od->sess->ssi.received_data) |
4889 | 5801 aim_ssi_adddeny(od->sess, who); |
4230 | 5802 #endif |
2086 | 5803 } |
5804 | |
5575 | 5805 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
4269 | 5806 #ifdef NOSSI |
4491 | 5807 if (gc->account->permdeny == 3) |
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 permit\n"); |
4230 | 5812 if (od->sess->ssi.received_data) |
4889 | 5813 aim_ssi_delpermit(od->sess, who); |
4230 | 5814 #endif |
2086 | 5815 } |
5816 | |
5575 | 5817 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
4269 | 5818 #ifdef NOSSI |
4491 | 5819 if (gc->account->permdeny == 4) |
4269 | 5820 oscar_set_permit_deny(gc); |
5821 #else | |
2991 | 5822 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5823 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); |
4230 | 5824 if (od->sess->ssi.received_data) |
4889 | 5825 aim_ssi_deldeny(od->sess, who); |
4230 | 5826 #endif |
2086 | 5827 } |
5828 | |
5575 | 5829 static GList *oscar_away_states(GaimConnection *gc) |
2086 | 5830 { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5831 struct oscar_data *od = gc->proto_data; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5832 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5833 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5834 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5835 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5836 |
4333 | 5837 m = g_list_append(m, _("Online")); |
5838 m = g_list_append(m, _("Away")); | |
5839 m = g_list_append(m, _("Do Not Disturb")); | |
5840 m = g_list_append(m, _("Not Available")); | |
5841 m = g_list_append(m, _("Occupied")); | |
5842 m = g_list_append(m, _("Free For Chat")); | |
5843 m = g_list_append(m, _("Invisible")); | |
5844 | |
5845 return m; | |
5846 } | |
5847 | |
5575 | 5848 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
4333 | 5849 struct oscar_data *od = gc->proto_data; |
5850 GList *m = NULL; | |
5851 struct proto_buddy_menu *pbm; | |
5852 | |
5853 if (od->icq) { | |
4624 | 5854 #if 0 |
4333 | 5855 pbm = g_new0(struct proto_buddy_menu, 1); |
5856 pbm->label = _("Get Status Msg"); | |
4969 | 5857 pbm->callback = oscar_get_icqstatusmsg; |
4333 | 5858 pbm->gc = gc; |
5859 m = g_list_append(m, pbm); | |
4624 | 5860 #endif |
4333 | 5861 } else { |
4687 | 5862 struct buddy *b = gaim_find_buddy(gc->account, who); |
5975 | 5863 struct buddyinfo *bi; |
5864 | |
5865 if (b) | |
5866 bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); | |
5917 | 5867 |
5868 if (b && bi && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { | |
5869 if (bi->caps & AIM_CAPS_IMIMAGE) { | |
5870 pbm = g_new0(struct proto_buddy_menu, 1); | |
5871 pbm->label = _("Direct IM"); | |
5872 pbm->callback = oscar_ask_direct_im; | |
5873 pbm->gc = gc; | |
5874 m = g_list_append(m, pbm); | |
5875 } | |
5876 | |
5877 if (bi->caps & AIM_CAPS_SENDFILE) { | |
5878 pbm = g_new0(struct proto_buddy_menu, 1); | |
5879 pbm->label = _("Send File"); | |
5880 pbm->callback = oscar_ask_sendfile; | |
5881 pbm->gc = gc; | |
5882 m = g_list_append(m, pbm); | |
5883 } | |
4826 | 5884 #if 0 |
5917 | 5885 if (bi->caps & AIM_CAPS_GETFILE) { |
5886 pbm = g_new0(struct proto_buddy_menu, 1); | |
5887 pbm->label = _("Get File"); | |
5888 pbm->callback = oscar_ask_getfile; | |
5889 pbm->gc = gc; | |
5890 m = g_list_append(m, pbm); | |
5891 } | |
4826 | 5892 #endif |
4333 | 5893 } |
5131 | 5894 } |
5197 | 5895 |
5131 | 5896 if (od->sess->ssi.received_data) { |
5897 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); | |
5898 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { | |
5899 pbm = g_new0(struct proto_buddy_menu, 1); | |
5900 pbm->label = _("Re-request Authorization"); | |
5901 pbm->callback = gaim_auth_sendrequest; | |
5902 pbm->gc = gc; | |
5903 m = g_list_append(m, pbm); | |
4333 | 5904 } |
4916 | 5905 } |
5906 | |
4333 | 5907 return m; |
5908 } | |
5909 | |
5575 | 5910 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
4333 | 5911 struct oscar_data *od = gc->proto_data; |
5575 | 5912 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
4333 | 5913 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
5914 od->setnick = TRUE; | |
5915 od->newsn = g_strdup(nick); | |
5916 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5917 } else { | |
5918 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
5919 } | |
5920 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5921 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5922 _("Screenname formatting can change only capitalization and whitespace.")); |
4333 | 5923 } |
5924 } | |
5925 | |
5575 | 5926 static void oscar_show_format_screenname(GaimConnection *gc) |
4333 | 5927 { |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5928 gaim_request_input(gc, NULL, _("New screenname formatting:"), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
5929 gaim_connection_get_display_name(gc), FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5930 _("OK"), G_CALLBACK(oscar_format_screenname), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5931 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5932 gc); |
4333 | 5933 } |
5934 | |
5575 | 5935 static void oscar_confirm_account(GaimConnection *gc) |
4333 | 5936 { |
5937 struct oscar_data *od = gc->proto_data; | |
5938 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | |
5939 | |
5940 if (conn) { | |
5941 aim_admin_reqconfirm(od->sess, conn); | |
5942 } else { | |
5943 od->conf = TRUE; | |
5944 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5945 } | |
5946 } | |
5947 | |
5575 | 5948 static void oscar_show_email(GaimConnection *gc) |
4333 | 5949 { |
5950 struct oscar_data *od = gc->proto_data; | |
5951 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | |
5952 | |
5953 if (conn) { | |
5954 aim_admin_getinfo(od->sess, conn, 0x11); | |
5955 } else { | |
5956 od->reqemail = TRUE; | |
5957 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5958 } | |
5959 } | |
5960 | |
5575 | 5961 static void oscar_change_email(GaimConnection *gc, const char *email) |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5962 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5963 struct oscar_data *od = gc->proto_data; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5964 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
|
5965 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5966 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5967 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5968 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5969 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5970 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5971 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5972 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5973 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5974 |
5575 | 5975 static void oscar_show_change_email(GaimConnection *gc) |
4333 | 5976 { |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
5977 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, |
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
5978 FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5979 _("OK"), G_CALLBACK(oscar_change_email), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5980 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
5981 gc); |
4333 | 5982 } |
5983 | |
5575 | 5984 static void oscar_show_awaitingauth(GaimConnection *gc) |
4333 | 5985 { |
2979 | 5986 struct oscar_data *od = gc->proto_data; |
4333 | 5987 gchar *nombre, *text, *tmp; |
4785 | 5988 GaimBlistNode *gnode,*bnode; |
4333 | 5989 int num=0; |
5990 | |
5991 text = g_strdup(_("You are awaiting authorization from the following buddies:<BR>")); | |
5992 | |
4785 | 5993 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
5994 struct group *group = (struct group *)gnode; | |
5995 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
5996 continue; | |
5997 for (bnode = gnode->child; bnode; bnode = bnode->next) { | |
5998 struct buddy *buddy = (struct buddy *)bnode; | |
5999 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
6000 continue; | |
4491 | 6001 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { |
4687 | 6002 if (gaim_get_buddy_alias_only(buddy)) |
6003 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
4333 | 6004 else |
4337 | 6005 nombre = g_strdup_printf(" %s", buddy->name); |
4333 | 6006 tmp = g_strdup_printf("%s<BR>%s", text, nombre); |
6007 g_free(text); | |
6008 text = tmp; | |
6009 g_free(nombre); | |
6010 num++; | |
6011 } | |
2979 | 6012 } |
4333 | 6013 } |
6014 | |
6015 if (!num) { | |
6016 tmp = g_strdup_printf("%s<BR>%s", text, _("<i>you are not waiting for authorization</i>")); | |
6017 g_free(text); | |
6018 text = tmp; | |
2979 | 6019 } |
4333 | 6020 |
4959 | 6021 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 | 6022 g_free(text); |
6023 text = tmp; | |
5575 | 6024 g_show_info_text(gc, gaim_account_get_username(gaim_connection_get_account(gc)), 2, text, NULL); |
4333 | 6025 g_free(text); |
2979 | 6026 } |
6027 | |
5975 | 6028 #if 0 |
5917 | 6029 static void oscar_setavailmsg(GaimConnection *gc, char *text) { |
6030 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
6031 | |
6032 aim_srv_setavailmsg(od->sess, text); | |
6033 } | |
6034 | |
6035 static void oscar_show_setavailmsg(GaimConnection *gc) | |
6036 { | |
6037 gaim_request_input(gc, NULL, _("Available Message:"), | |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6038 NULL, _("Please talk to me, I'm lonely! (and single)"), TRUE, FALSE, |
5917 | 6039 _("OK"), G_CALLBACK(oscar_setavailmsg), |
6040 _("Cancel"), NULL, | |
6041 gc); | |
6042 } | |
5975 | 6043 #endif |
5917 | 6044 |
5575 | 6045 static void oscar_show_chpassurl(GaimConnection *gc) |
4333 | 6046 { |
6047 struct oscar_data *od = gc->proto_data; | |
5575 | 6048 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); |
5517 | 6049 open_url(NULL, substituted); |
6050 g_free(substituted); | |
4333 | 6051 } |
6052 | |
5842 | 6053 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) |
6054 { | |
5844 | 6055 struct oscar_data *od = gc->proto_data; |
6056 aim_session_t *sess = od->sess; | |
5842 | 6057 FILE *file; |
6058 struct stat st; | |
5844 | 6059 |
5842 | 6060 if (!stat(iconfile, &st)) { |
6061 char *buf = g_malloc(st.st_size); | |
6062 file = fopen(iconfile, "rb"); | |
6063 if (file) { | |
6064 int len = fread(buf, 1, st.st_size, file); | |
6065 char md5[16]; | |
6066 md5_state_t *state = g_malloc(sizeof(md5_state_t)); | |
6067 md5_init(state); | |
6068 md5_append(state, buf, len); | |
6069 md5_finish(state, md5); | |
6070 fclose(file); | |
6071 g_free(state); | |
6072 aim_ssi_seticon(sess, md5, 16); | |
6073 } else | |
6074 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6075 "Can't open buddy icon file!\n"); | |
6076 g_free(buf); | |
6077 } else | |
6078 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6079 "Can't stat buddy icon file!\n"); | |
6080 } | |
6081 | |
6082 | |
5575 | 6083 static GList *oscar_actions(GaimConnection *gc) |
2086 | 6084 { |
6085 struct oscar_data *od = gc->proto_data; | |
4333 | 6086 struct proto_actions_menu *pam; |
6087 GList *m = NULL; | |
6088 | |
6089 pam = g_new0(struct proto_actions_menu, 1); | |
6090 pam->label = _("Set User Info"); | |
6091 pam->callback = show_set_info; | |
6092 pam->gc = gc; | |
6093 m = g_list_append(m, pam); | |
6094 | |
5917 | 6095 #if 0 |
6096 pam = g_new0(struct proto_actions_menu, 1); | |
6097 pam->label = _("Set Available Message"); | |
6098 pam->callback = oscar_show_setavailmsg; | |
6099 pam->gc = gc; | |
6100 m = g_list_append(m, pam); | |
6101 #endif | |
6102 | |
5238 | 6103 pam = g_new0(struct proto_actions_menu, 1); |
6104 pam->label = _("Change Password"); | |
6105 pam->callback = show_change_passwd; | |
6106 pam->gc = gc; | |
6107 m = g_list_append(m, pam); | |
4617 | 6108 |
6109 if (od->sess->authinfo->chpassurl) { | |
6110 pam = g_new0(struct proto_actions_menu, 1); | |
6111 pam->label = _("Change Password (URL)"); | |
6112 pam->callback = oscar_show_chpassurl; | |
6113 pam->gc = gc; | |
6114 m = g_list_append(m, pam); | |
6115 } | |
6116 | |
5238 | 6117 if (!od->icq) { |
4617 | 6118 /* AIM actions */ |
6119 m = g_list_append(m, NULL); | |
4333 | 6120 |
5917 | 6121 pam = g_new0(struct proto_actions_menu, 1); |
4333 | 6122 pam->label = _("Format Screenname"); |
5844 | 6123 pam->callback = oscar_show_format_screenname; |
4333 | 6124 pam->gc = gc; |
6125 m = g_list_append(m, pam); | |
6126 | |
6127 pam = g_new0(struct proto_actions_menu, 1); | |
6128 pam->label = _("Confirm Account"); | |
6129 pam->callback = oscar_confirm_account; | |
6130 pam->gc = gc; | |
6131 m = g_list_append(m, pam); | |
6132 | |
6133 pam = g_new0(struct proto_actions_menu, 1); | |
6134 pam->label = _("Display Current Registered Address"); | |
6135 pam->callback = oscar_show_email; | |
6136 pam->gc = gc; | |
6137 m = g_list_append(m, pam); | |
6138 | |
6139 pam = g_new0(struct proto_actions_menu, 1); | |
6140 pam->label = _("Change Current Registered Address"); | |
6141 pam->callback = oscar_show_change_email; | |
6142 pam->gc = gc; | |
6143 m = g_list_append(m, pam); | |
2086 | 6144 } |
4333 | 6145 |
6146 m = g_list_append(m, NULL); | |
6147 | |
6148 pam = g_new0(struct proto_actions_menu, 1); | |
6149 pam->label = _("Show Buddies Awaiting Authorization"); | |
6150 pam->callback = oscar_show_awaitingauth; | |
6151 pam->gc = gc; | |
6152 m = g_list_append(m, pam); | |
6153 | |
2086 | 6154 m = g_list_append(m, NULL); |
4333 | 6155 |
6156 pam = g_new0(struct proto_actions_menu, 1); | |
6157 pam->label = _("Search for Buddy by Email"); | |
6158 pam->callback = show_find_email; | |
6159 pam->gc = gc; | |
6160 m = g_list_append(m, pam); | |
6161 | |
4336 | 6162 /* pam = g_new0(struct proto_actions_menu, 1); |
4333 | 6163 pam->label = _("Search for Buddy by Information"); |
6164 pam->callback = show_find_info; | |
6165 pam->gc = gc; | |
4336 | 6166 m = g_list_append(m, pam); */ |
2086 | 6167 |
6168 return m; | |
6169 } | |
6170 | |
5575 | 6171 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2086 | 6172 { |
6173 struct oscar_data *od = gc->proto_data; | |
4617 | 6174 |
6175 if (od->icq) { | |
6176 aim_icq_changepasswd(od->sess, new); | |
2086 | 6177 } else { |
4617 | 6178 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6179 if (conn) { | |
6180 aim_admin_changepasswd(od->sess, conn, new, old); | |
6181 } else { | |
6182 od->chpass = TRUE; | |
6183 od->oldp = g_strdup(old); | |
6184 od->newp = g_strdup(new); | |
6185 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6186 } | |
2086 | 6187 } |
6188 } | |
6189 | |
5575 | 6190 static void oscar_convo_closed(GaimConnection *gc, char *who) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6191 { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6192 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6193 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6194 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6195 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6196 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6197 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6198 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6199 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6200 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6201 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6202 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6203 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6204 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6205 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6206 GAIM_PROTO_OSCAR, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6207 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
|
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 oscar_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6211 oscar_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6212 oscar_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6213 oscar_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6214 oscar_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6215 oscar_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6216 oscar_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6217 oscar_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6218 oscar_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6219 oscar_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6220 oscar_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6221 oscar_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6222 oscar_send_typing, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6223 oscar_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6224 oscar_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6225 oscar_get_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6226 oscar_set_dir, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6227 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6228 oscar_dir_search, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6229 oscar_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6230 oscar_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6231 oscar_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6232 oscar_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6233 oscar_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6234 oscar_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6235 oscar_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6236 oscar_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6237 oscar_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6238 oscar_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6239 oscar_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6240 oscar_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6241 oscar_join_chat, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6242 oscar_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6243 oscar_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6244 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6245 oscar_chat_send, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6246 oscar_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6247 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6248 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6249 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6250 #ifndef NOSSI |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6251 oscar_alias_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6252 oscar_move_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6253 oscar_rename_group, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6254 #else |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6255 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6256 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6257 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6258 #endif |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6259 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6260 oscar_convo_closed, |
5842 | 6261 NULL, |
6262 oscar_set_icon | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6263 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6264 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6265 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6266 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6267 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6268 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6269 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6270 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6271 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6272 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6273 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6274 "prpl-oscar", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6275 "AIM/ICQ", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6276 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6277 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6278 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6279 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6280 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6281 NULL, /**< author */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6282 WEBSITE, /**< homepage */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6283 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6284 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6285 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6286 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6287 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6288 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6289 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6290 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6291 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6292 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6293 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6294 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6295 GaimAccountOption *option; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6296 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6297 option = gaim_account_option_string_new(_("Auth host"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6298 "login.oscar.aol.com"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6299 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6300 option); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6301 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6302 option = gaim_account_option_int_new(_("Auth port"), "port", 5190); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6303 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6304 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6305 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6306 my_protocol = plugin; |
2086 | 6307 } |
6308 | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6309 GAIM_INIT_PLUGIN(oscar, init_plugin, info); |