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