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