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