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