Mercurial > pidgin
annotate src/protocols/oscar/oscar.c @ 7489:8f05bdc08faf
[gaim-migrate @ 8102]
This will produce better logs. I'm going to try to get even *better* logs
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 13 Nov 2003 00:48:05 +0000 |
parents | 3c21f3084ff0 |
children | d29c2f50ac24 |
rev | line source |
---|---|
2086 | 1 /* |
2 * gaim | |
3 * | |
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
6302 | 5 * Some code copyright (C) 1999-2001, Eric Warmenhoven |
6 * Some code copyright (C) 2001-2003, Sean Egan | |
7 * Some code copyright (C) 2001-2003, Mark Doliner <thekingant@users.sourceforge.net> | |
8 * | |
9 * Most libfaim code copyright (C) 1998-2001 Adam Fritzler <afritz@auk.cx> | |
10 * Some libfaim code copyright (C) 2001-2003 Mark Doliner <thekingant@users.sourceforge.net> | |
2086 | 11 * |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 * | |
26 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
27 #include "internal.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
28 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
29 #include "account.h" |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
30 #include "accountopt.h" |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
31 #include "buddyicon.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
32 #include "conversation.h" |
7083
3100a6e03644
[gaim-migrate @ 7648]
Christian Hammond <chipx86@chipx86.com>
parents:
7082
diff
changeset
|
33 #include "core.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
34 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
35 #include "ft.h" |
6982 | 36 #include "imgstore.h" |
2086 | 37 #include "multi.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
38 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
39 #include "privacy.h" |
2086 | 40 #include "prpl.h" |
4889 | 41 #include "proxy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
42 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
43 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
44 |
2086 | 45 #include "aim.h" |
5842 | 46 #include "md5.h" |
2086 | 47 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
48 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
49 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
50 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
51 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
52 #define UC_AB 0x20 |
3079 | 53 #define UC_WIRELESS 0x40 |
6318 | 54 #define UC_HIPTOP 0x80 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
55 |
2086 | 56 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
57 | |
7283 | 58 #define OSCAR_CONNECT_STEPS 6 |
59 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
60 static GaimPlugin *my_protocol = NULL; |
4249 | 61 |
7376 | 62 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; |
63 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; | |
3458 | 64 |
4665 | 65 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
66 static fu8_t features_icq[] = {0x01, 0x06}; | |
2086 | 67 |
7283 | 68 typedef struct _OscarData OscarData; |
69 struct _OscarData { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
70 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
71 aim_conn_t *conn; |
2086 | 72 |
73 guint cnpa; | |
74 guint paspa; | |
3694 | 75 guint emlpa; |
4804 | 76 guint icopa; |
2086 | 77 |
4823 | 78 gboolean iconconnecting; |
5842 | 79 gboolean set_icon; |
4823 | 80 |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
81 GSList *create_rooms; |
2086 | 82 |
83 gboolean conf; | |
84 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
85 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
86 char *email; |
2979 | 87 gboolean setnick; |
88 char *newsn; | |
2086 | 89 gboolean chpass; |
90 char *oldp; | |
91 char *newp; | |
5842 | 92 |
2086 | 93 GSList *oscar_chats; |
94 GSList *direct_ims; | |
3630 | 95 GSList *file_transfers; |
4738 | 96 GHashTable *buddyinfo; |
4804 | 97 GSList *requesticon; |
2086 | 98 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
99 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
100 gboolean icq; |
4804 | 101 guint icontimer; |
5968 | 102 guint getblisttimer; |
2993 | 103 |
104 struct { | |
4230 | 105 guint maxwatchers; /* max users who can watch you */ |
2993 | 106 guint maxbuddies; /* max users you can watch */ |
4230 | 107 guint maxgroups; /* max groups in server list */ |
2993 | 108 guint maxpermits; /* max users on permit list */ |
109 guint maxdenies; /* max users on deny list */ | |
110 guint maxsiglen; /* max size (bytes) of profile */ | |
111 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
112 } rights; | |
2086 | 113 }; |
114 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
115 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
116 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
117 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
118 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
119 |
2086 | 120 struct chat_connection { |
121 char *name; | |
122 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
123 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
124 fu16_t instance; |
2086 | 125 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
|
126 aim_conn_t *conn; |
2086 | 127 int inpa; |
128 int id; | |
5575 | 129 GaimConnection *gc; /* i hate this. */ |
5679 | 130 GaimConversation *cnv; /* bah. */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
131 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
132 int maxvis; |
2086 | 133 }; |
134 | |
135 struct direct_im { | |
5575 | 136 GaimConnection *gc; |
2086 | 137 char name[80]; |
138 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
139 aim_conn_t *conn; |
3008 | 140 gboolean connected; |
2086 | 141 }; |
142 | |
143 struct ask_direct { | |
5575 | 144 GaimConnection *gc; |
2086 | 145 char *sn; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
146 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
147 fu8_t cookie[8]; |
2086 | 148 }; |
149 | |
7011 | 150 /* |
151 * Various PRPL-specific buddy info that we want to keep track of | |
152 * Some other info is maintained by locate.c, and I'd like to move | |
153 * the rest of this to libfaim, mostly im.c | |
154 */ | |
4738 | 155 struct buddyinfo { |
156 gboolean typingnot; | |
6292 | 157 gchar *availmsg; |
6857 | 158 fu32_t ipaddr; |
5836 | 159 |
160 unsigned long ico_me_len; | |
161 unsigned long ico_me_csum; | |
162 time_t ico_me_time; | |
163 gboolean ico_informed; | |
4738 | 164 |
165 unsigned long ico_len; | |
166 unsigned long ico_csum; | |
167 time_t ico_time; | |
168 gboolean ico_need; | |
7406 | 169 gboolean ico_sent; |
2086 | 170 }; |
171 | |
4230 | 172 struct name_data { |
5575 | 173 GaimConnection *gc; |
4230 | 174 gchar *name; |
3453 | 175 gchar *nick; |
3141 | 176 }; |
177 | |
5129 | 178 static char *msgerrreason[] = { |
179 N_("Invalid error"), | |
180 N_("Invalid SNAC"), | |
181 N_("Rate to host"), | |
182 N_("Rate to client"), | |
183 N_("Not logged in"), | |
184 N_("Service unavailable"), | |
185 N_("Service not defined"), | |
186 N_("Obsolete SNAC"), | |
187 N_("Not supported by host"), | |
188 N_("Not supported by client"), | |
189 N_("Refused by client"), | |
190 N_("Reply too big"), | |
191 N_("Responses lost"), | |
192 N_("Request denied"), | |
193 N_("Busted SNAC payload"), | |
194 N_("Insufficient rights"), | |
195 N_("In local permit/deny"), | |
196 N_("Too evil (sender)"), | |
197 N_("Too evil (receiver)"), | |
198 N_("User temporarily unavailable"), | |
199 N_("No match"), | |
200 N_("List overflow"), | |
201 N_("Request ambiguous"), | |
202 N_("Queue full"), | |
203 N_("Not while on AOL") | |
204 }; | |
205 static int msgerrreasonlen = 25; | |
206 | |
207 /* All the libfaim->gaim callback functions */ | |
208 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); | |
209 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); | |
210 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); | |
211 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); | |
212 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); | |
213 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); | |
214 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); | |
215 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); | |
216 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); | |
217 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); | |
7011 | 218 static int gaim_parse_userinfo (aim_session_t *, aim_frame_t *, ...); |
5129 | 219 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); |
220 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
221 static int gaim_conv_chat_join (aim_session_t *, aim_frame_t *, ...); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
222 static int gaim_conv_chat_leave (aim_session_t *, aim_frame_t *, ...); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
223 static int gaim_conv_chat_info_update (aim_session_t *, aim_frame_t *, ...); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
224 static int gaim_conv_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); |
5129 | 225 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); |
226 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); | |
227 static int gaim_icon_parseicon (aim_session_t *, aim_frame_t *, ...); | |
5844 | 228 static int oscar_icon_req (aim_session_t *, aim_frame_t *, ...); |
5129 | 229 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
230 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); | |
231 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); | |
232 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); | |
233 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); | |
234 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); | |
235 static int gaim_connerr (aim_session_t *, aim_frame_t *, ...); | |
236 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); | |
237 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); | |
238 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); | |
239 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); | |
240 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); | |
241 static int conninitdone_icon (aim_session_t *, aim_frame_t *, ...); | |
242 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); | |
243 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); | |
244 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); | |
245 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); | |
246 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | |
247 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | |
248 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | |
249 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); | |
250 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); | |
251 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); | |
252 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); | |
253 static int gaim_icqalias (aim_session_t *, aim_frame_t *, ...); | |
254 static int gaim_icqinfo (aim_session_t *, aim_frame_t *, ...); | |
255 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); | |
256 #ifndef NOSSI | |
257 static int gaim_ssi_parseerr (aim_session_t *, aim_frame_t *, ...); | |
258 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); | |
259 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
260 static int gaim_ssi_parseack (aim_session_t *, aim_frame_t *, ...); | |
261 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); | |
262 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
263 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
264 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
265 #endif | |
266 | |
267 /* for DirectIM/image transfer */ | |
268 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
269 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
270 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
6982 | 271 static int gaim_odc_update_ui (aim_session_t *, aim_frame_t *, ...); |
5129 | 272 |
273 /* for file transfer */ | |
274 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
275 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
276 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
277 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
278 | |
279 /* for icons */ | |
280 static gboolean gaim_icon_timerfunc(gpointer data); | |
281 | |
5306 | 282 /* prpl actions - remove this at some point */ |
7282 | 283 /* Because I don't like forward declarations? I think that was why... */ |
5954 | 284 static void oscar_set_info(GaimConnection *gc, const char *text); |
5306 | 285 |
5836 | 286 static void oscar_free_name_data(struct name_data *data) { |
4230 | 287 g_free(data->name); |
288 g_free(data->nick); | |
289 g_free(data); | |
290 } | |
291 | |
5836 | 292 static void oscar_free_buddyinfo(void *data) { |
293 struct buddyinfo *bi = data; | |
6292 | 294 g_free(bi->availmsg); |
5836 | 295 g_free(bi); |
296 } | |
297 | |
5129 | 298 static fu32_t oscar_encoding_check(const char *utf8) |
299 { | |
300 int i = 0; | |
301 fu32_t encodingflag = 0; | |
302 | |
303 /* Determine how we can send this message. Per the warnings elsewhere | |
304 * in this file, these little checks determine the simplest encoding | |
305 * we can use for a given message send using it. */ | |
306 while (utf8[i]) { | |
307 if ((unsigned char)utf8[i] > 0x7f) { | |
308 /* not ASCII! */ | |
309 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
310 break; | |
311 } | |
312 i++; | |
313 } | |
314 while (utf8[i]) { | |
315 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
316 * followed by 0xc0-0xc3 in the second */ | |
317 if ((unsigned char)utf8[i] < 0x80) { | |
318 i++; | |
319 continue; | |
320 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
321 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
322 i += 2; | |
323 continue; | |
324 } | |
325 encodingflag = AIM_IMFLAGS_UNICODE; | |
326 break; | |
327 } | |
328 | |
329 return encodingflag; | |
330 } | |
331 | |
332 static fu32_t oscar_encoding_parse(const char *enc) | |
333 { | |
334 char *charset; | |
335 | |
336 /* If anything goes wrong, fall back on ASCII and print a message */ | |
337 if (enc == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
338 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
339 "Encoding was null, that's odd\n"); |
5129 | 340 return 0; |
341 } | |
342 charset = strstr(enc, "charset="); | |
343 if (charset == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
344 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
345 "No charset specified for info, assuming ASCII\n"); |
5129 | 346 return 0; |
347 } | |
348 charset += 8; | |
349 if (!strcmp(charset, "\"us-ascii\"") || !strcmp(charset, "\"utf-8\"")) { | |
350 /* UTF-8 is our native charset, ASCII is a proper subset */ | |
351 return 0; | |
352 } else if (!strcmp(charset, "\"iso-8859-1\"")) { | |
353 return AIM_IMFLAGS_ISO_8859_1; | |
354 } else if (!strcmp(charset, "\"unicode-2-0\"")) { | |
355 return AIM_IMFLAGS_UNICODE; | |
356 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
357 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
358 "Unrecognized character set '%s', using ASCII\n", charset); |
5129 | 359 return 0; |
360 } | |
361 } | |
362 | |
363 gchar *oscar_encoding_to_utf8(const char *encoding, char *text, int textlen) | |
364 { | |
365 gchar *utf8 = NULL; | |
366 int flags = oscar_encoding_parse(encoding); | |
367 | |
368 switch (flags) { | |
369 case 0: | |
370 utf8 = g_strndup(text, textlen); | |
371 break; | |
372 case AIM_IMFLAGS_ISO_8859_1: | |
373 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
374 break; | |
375 case AIM_IMFLAGS_UNICODE: | |
376 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
377 break; | |
378 } | |
379 | |
380 return utf8; | |
381 } | |
382 | |
7283 | 383 static struct direct_im *find_direct_im(OscarData *od, const char *who) { |
2086 | 384 GSList *d = od->direct_ims; |
385 struct direct_im *m = NULL; | |
386 | |
387 while (d) { | |
388 m = (struct direct_im *)d->data; | |
4355 | 389 if (!aim_sncmp(who, m->name)) |
4269 | 390 return m; |
2086 | 391 d = d->next; |
392 } | |
393 | |
4269 | 394 return NULL; |
2086 | 395 } |
396 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
397 static char *extract_name(const char *name) { |
4121 | 398 char *tmp, *x; |
2086 | 399 int i, j; |
4120 | 400 |
401 if (!name) | |
4121 | 402 return NULL; |
403 | |
4120 | 404 x = strchr(name, '-'); |
4121 | 405 |
2086 | 406 if (!x) return NULL; |
407 x = strchr(++x, '-'); | |
408 if (!x) return NULL; | |
409 tmp = g_strdup(++x); | |
410 | |
411 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
412 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
413 if (x[i] != '%') { |
2086 | 414 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
415 continue; |
2086 | 416 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
417 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
418 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
419 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 420 } |
421 | |
422 tmp[j] = 0; | |
423 return tmp; | |
424 } | |
425 | |
5575 | 426 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
7283 | 427 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 428 struct chat_connection *c = NULL; |
429 | |
430 while (g) { | |
431 c = (struct chat_connection *)g->data; | |
432 if (c->id == id) | |
433 break; | |
434 g = g->next; | |
435 c = NULL; | |
436 } | |
437 | |
438 return c; | |
439 } | |
440 | |
5575 | 441 static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
442 aim_conn_t *conn) { |
7283 | 443 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 444 struct chat_connection *c = NULL; |
445 | |
446 while (g) { | |
447 c = (struct chat_connection *)g->data; | |
448 if (c->conn == conn) | |
449 break; | |
450 g = g->next; | |
451 c = NULL; | |
452 } | |
453 | |
454 return c; | |
455 } | |
456 | |
4617 | 457 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
5575 | 458 GaimConnection *gc = sess->aux_data; |
7283 | 459 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 460 GaimConversation *cnv; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
461 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
462 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
463 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
464 |
4617 | 465 sn = g_strdup(aim_odc_getsn(conn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
466 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
467 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
468 "%s disconnected Direct IM.\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
469 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
470 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
471 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
472 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
473 |
3008 | 474 if (dim->connected) |
475 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
476 else | |
477 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); | |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
478 |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
479 cnv = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
480 if (cnv) |
6982 | 481 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
482 |
5579 | 483 gaim_conversation_update_progress(cnv, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
484 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
485 g_free(dim); /* I guess? I don't see it anywhere else... -- mid */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
486 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
487 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
488 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
489 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
490 |
4617 | 491 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
492 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
493 aim_session_t *sess = aim_conn_getsess(conn); |
5575 | 494 GaimConnection *gc = sess ? sess->aux_data : NULL; |
7283 | 495 OscarData *od; |
2086 | 496 |
497 if (!gc) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
498 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
499 "oscar callback for closed connection (1).\n"); |
2086 | 500 return; |
501 } | |
502 | |
7283 | 503 od = (OscarData *)gc->proto_data; |
2086 | 504 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
505 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 506 /* oh boy. this is probably bad. i guess the only thing we |
507 * can really do is return? */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
508 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
509 "oscar callback for closed connection (2).\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
510 gaim_debug(GAIM_DEBUG_MISC, "oscar", "gc = %p\n", gc); |
2086 | 511 return; |
512 } | |
513 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
514 if (condition & GAIM_INPUT_READ) { |
4617 | 515 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
516 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
517 "got information on rendezvous listener\n"); |
4617 | 518 if (aim_handlerendconnect(od->sess, conn) < 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
519 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
520 "connection error (rendezvous listener)\n"); |
4617 | 521 aim_conn_kill(od->sess, &conn); |
2086 | 522 } |
523 } else { | |
4617 | 524 if (aim_get_command(od->sess, conn) >= 0) { |
525 aim_rxdispatch(od->sess); | |
6029 | 526 if (od->killme) { |
527 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Waiting to be destroyed\n"); | |
528 return; | |
529 } | |
2086 | 530 } else { |
531 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 532 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
533 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
534 "major connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
535 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 536 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
537 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
5420 | 538 char *buf; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
539 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
540 "disconnected from chat room %s\n", c->name); |
2086 | 541 c->conn = NULL; |
542 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
543 gaim_input_remove(c->inpa); |
2086 | 544 c->inpa = 0; |
545 c->fd = -1; | |
4617 | 546 aim_conn_kill(od->sess, &conn); |
5420 | 547 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
|
548 gaim_notify_error(gc, NULL, buf, NULL); |
5420 | 549 g_free(buf); |
2086 | 550 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 551 if (od->cnpa > 0) |
552 gaim_input_remove(od->cnpa); | |
553 od->cnpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
554 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
555 "removing chatnav input watcher\n"); |
4617 | 556 while (od->create_rooms) { |
557 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
558 g_free(cr->name); |
4617 | 559 od->create_rooms = |
560 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
561 g_free(cr); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
562 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
563 _("Chat is currently unavailable"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
564 NULL); |
2086 | 565 } |
4617 | 566 aim_conn_kill(od->sess, &conn); |
2086 | 567 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 568 if (od->paspa > 0) |
569 gaim_input_remove(od->paspa); | |
570 od->paspa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
571 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
572 "removing authconn input watcher\n"); |
4617 | 573 aim_conn_kill(od->sess, &conn); |
3694 | 574 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 575 if (od->emlpa > 0) |
576 gaim_input_remove(od->emlpa); | |
577 od->emlpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
578 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
579 "removing email input watcher\n"); |
4617 | 580 aim_conn_kill(od->sess, &conn); |
4804 | 581 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
582 if (od->icopa > 0) | |
583 gaim_input_remove(od->icopa); | |
584 od->icopa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
585 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
586 "removing icon input watcher\n"); |
4804 | 587 aim_conn_kill(od->sess, &conn); |
2086 | 588 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
589 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 590 gaim_odc_disconnect(od->sess, conn); |
591 aim_conn_kill(od->sess, &conn); | |
2086 | 592 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
593 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
594 "holy crap! generic connection error! %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
595 conn->type); |
4617 | 596 aim_conn_kill(od->sess, &conn); |
2086 | 597 } |
598 } | |
599 } | |
600 } | |
601 } | |
602 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
603 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
5575 | 604 GaimConnection *gc = sess->aux_data; |
7285 | 605 gchar *s = g_strdup_vprintf(format, va); |
606 gchar *buf; | |
607 | |
608 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s); | |
609 gaim_debug(GAIM_DEBUG_INFO, "oscar", buf); | |
610 if (buf[strlen(buf)-1] != '\n') | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
611 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
7285 | 612 g_free(buf); |
2086 | 613 g_free(s); |
614 } | |
615 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
616 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 617 { |
5575 | 618 GaimConnection *gc = data; |
7283 | 619 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
620 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
621 aim_conn_t *conn; |
2086 | 622 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
623 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 624 close(source); |
625 return; | |
626 } | |
627 | |
4617 | 628 od = gc->proto_data; |
629 sess = od->sess; | |
2086 | 630 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 631 conn->fd = source; |
2086 | 632 |
633 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
634 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 635 return; |
636 } | |
637 | |
638 aim_conn_completeconnect(sess, conn); | |
4617 | 639 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
7282 | 640 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); |
641 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
642 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
7282 | 643 "Screen name sent, waiting for response\n"); |
7283 | 644 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); |
2086 | 645 } |
646 | |
5575 | 647 static void oscar_login(GaimAccount *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
648 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
649 aim_conn_t *conn; |
5575 | 650 GaimConnection *gc = gaim_account_get_connection(account); |
7283 | 651 OscarData *od = gc->proto_data = g_new0(OscarData, 1); |
2086 | 652 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
653 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
|
654 |
5575 | 655 if (isdigit(*(gaim_account_get_username(account)))) { |
4617 | 656 od->icq = TRUE; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
657 } else { |
6622 | 658 gc->flags |= GAIM_CONNECTION_HTML; |
659 gc->flags |= GAIM_CONNECTION_AUTO_RESP; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
660 } |
5836 | 661 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
2086 | 662 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
663 sess = g_new0(aim_session_t, 1); |
7285 | 664 aim_session_init(sess, TRUE, 0); |
2086 | 665 aim_setdebuggingcb(sess, oscar_debug); |
7282 | 666 /* |
667 * We need an immediate queue because we don't use a while-loop | |
668 * to see if things need to be sent. | |
669 */ | |
2086 | 670 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); |
4617 | 671 od->sess = sess; |
2086 | 672 sess->aux_data = gc; |
673 | |
674 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
675 if (conn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
676 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
677 "internal connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
678 gaim_connection_error(gc, _("Unable to login to AIM")); |
2086 | 679 return; |
680 } | |
681 | |
4649 | 682 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 683 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
684 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
685 | |
686 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
687 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
5575 | 688 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
689 oscar_login_connect, gc) < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
690 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 691 return; |
692 } | |
7282 | 693 |
7283 | 694 gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); |
5575 | 695 } |
696 | |
697 static void oscar_close(GaimConnection *gc) { | |
7283 | 698 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 699 |
700 while (od->oscar_chats) { | |
701 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 702 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
703 gaim_input_remove(n->inpa); |
2086 | 704 g_free(n->name); |
705 g_free(n->show); | |
4617 | 706 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 707 g_free(n); |
708 } | |
4617 | 709 while (od->direct_ims) { |
710 struct direct_im *n = od->direct_ims->data; | |
2086 | 711 if (n->watcher > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
712 gaim_input_remove(n->watcher); |
4617 | 713 od->direct_ims = g_slist_remove(od->direct_ims, n); |
2086 | 714 g_free(n); |
715 } | |
4617 | 716 /* BBB */ |
717 while (od->file_transfers) { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
718 GaimXfer *xfer; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
719 xfer = (GaimXfer *)od->file_transfers->data; |
4617 | 720 gaim_xfer_destroy(xfer); |
3630 | 721 } |
4804 | 722 while (od->requesticon) { |
723 char *sn = od->requesticon->data; | |
724 od->requesticon = g_slist_remove(od->requesticon, sn); | |
725 free(sn); | |
726 } | |
4738 | 727 g_hash_table_destroy(od->buddyinfo); |
4617 | 728 while (od->create_rooms) { |
729 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
730 g_free(cr->name); |
4617 | 731 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
732 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
733 } |
4617 | 734 if (od->email) |
735 g_free(od->email); | |
736 if (od->newp) | |
737 g_free(od->newp); | |
738 if (od->oldp) | |
739 g_free(od->oldp); | |
2086 | 740 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
741 gaim_input_remove(gc->inpa); |
4617 | 742 if (od->cnpa > 0) |
743 gaim_input_remove(od->cnpa); | |
744 if (od->paspa > 0) | |
745 gaim_input_remove(od->paspa); | |
746 if (od->emlpa > 0) | |
747 gaim_input_remove(od->emlpa); | |
4804 | 748 if (od->icopa > 0) |
749 gaim_input_remove(od->icopa); | |
6907 | 750 if (od->icontimer > 0) |
4832 | 751 g_source_remove(od->icontimer); |
5968 | 752 if (od->getblisttimer) |
753 g_source_remove(od->getblisttimer); | |
4617 | 754 aim_session_kill(od->sess); |
755 g_free(od->sess); | |
756 od->sess = NULL; | |
2086 | 757 g_free(gc->proto_data); |
758 gc->proto_data = NULL; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
759 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
2086 | 760 } |
761 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
762 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 763 GaimConnection *gc = data; |
7283 | 764 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
765 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
766 aim_conn_t *bosconn; |
2086 | 767 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
768 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 769 close(source); |
770 return; | |
771 } | |
772 | |
4617 | 773 od = gc->proto_data; |
774 sess = od->sess; | |
775 bosconn = od->conn; | |
4366 | 776 bosconn->fd = source; |
2086 | 777 |
778 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
779 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 780 return; |
781 } | |
782 | |
783 aim_conn_completeconnect(sess, bosconn); | |
4617 | 784 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
7283 | 785 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
786 gaim_connection_update_progress(gc, |
7283 | 787 _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); |
2086 | 788 } |
789 | |
4617 | 790 /* BBB */ |
4656 | 791 /* |
792 * This little area in oscar.c is the nexus of file transfer code, | |
793 * so I wrote a little explanation of what happens. I am such a | |
794 * ninja. | |
795 * | |
796 * The series of events for a file send is: | |
797 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
798 * -User chooses a file and oscar_xfer_init is called. It establishs a | |
799 * listening socket, then asks the remote user to connect to us (and | |
800 * gives them the file name, port, IP, etc.) | |
801 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
802 * in oscar_sendfile_estblsh) | |
803 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
804 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
805 * connection. | |
806 * -We get drunk because file transfer kicks ass. | |
807 * | |
808 * The series of events for a file receive is: | |
809 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
810 * -Gaim user selects file to name and location to save file to and | |
811 * oscar_xfer_init is called | |
812 * -It connects to the remote user using the IP they gave us earlier | |
813 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
814 * them an AIM_CB_OFT_ACK. | |
815 * -They begin to send us lots of raw data. | |
816 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
817 * the connectionn. | |
818 */ | |
819 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
820 | |
821 /* XXX - This function is pretty ugly */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
822 static void oscar_xfer_init(GaimXfer *xfer) |
4656 | 823 { |
5146 | 824 struct aim_oft_info *oft_info = xfer->data; |
5575 | 825 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 826 OscarData *od = gc->proto_data; |
4656 | 827 |
828 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
829 int i; | |
830 | |
831 xfer->filename = g_path_get_basename(xfer->local_filename); | |
5146 | 832 strncpy(oft_info->fh.name, xfer->filename, 64); |
833 oft_info->fh.totsize = gaim_xfer_get_size(xfer); | |
834 oft_info->fh.size = gaim_xfer_get_size(xfer); | |
835 oft_info->fh.checksum = aim_oft_checksum_file(xfer->local_filename); | |
4656 | 836 |
837 /* | |
5146 | 838 * First try the port specified earlier (5190). If that fails, |
839 * increment by 1 and try again. | |
4656 | 840 */ |
5146 | 841 aim_sendfile_listen(od->sess, oft_info); |
842 for (i=0; (i<5 && !oft_info->conn); i++) { | |
843 xfer->local_port = oft_info->port = oft_info->port + 1; | |
844 aim_sendfile_listen(od->sess, oft_info); | |
4656 | 845 } |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
846 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
847 "port is %d, ip is %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
848 xfer->local_port, oft_info->clientip); |
5146 | 849 if (oft_info->conn) { |
850 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
851 aim_im_sendch2_sendfile_ask(od->sess, oft_info); | |
852 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
4656 | 853 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
854 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
855 _("Unable to establish listener socket.")); |
4656 | 856 /* 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
|
857 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 858 } |
859 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 860 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
861 if (oft_info->conn) { | |
862 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
863 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
|
864 oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc), xfer->remote_ip, xfer->remote_port, |
5575 | 865 oscar_sendfile_connected, xfer); |
4656 | 866 if (xfer->fd == -1) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
867 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
868 _("Unable to establish file descriptor.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
869 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 870 } |
871 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
872 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
873 _("Unable to create new connection.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
874 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 875 /* Try a different port? Ask them to connect to us? */ |
876 } | |
877 | |
878 } | |
879 } | |
880 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
881 static void oscar_xfer_start(GaimXfer *xfer) |
4656 | 882 { |
5146 | 883 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
884 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_start\n"); |
4656 | 885 /* I'm pretty sure we don't need to do jack here. Nor Jill. */ |
886 } | |
887 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
888 static void oscar_xfer_end(GaimXfer *xfer) |
4656 | 889 { |
5146 | 890 struct aim_oft_info *oft_info = xfer->data; |
5575 | 891 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 892 OscarData *od = gc->proto_data; |
4656 | 893 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
894 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
5146 | 895 |
896 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
897 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | |
898 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); | |
899 } | |
900 | |
901 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
902 aim_oft_destroyinfo(oft_info); | |
4656 | 903 xfer->data = NULL; |
5146 | 904 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 905 } |
906 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
907 static void oscar_xfer_cancel_send(GaimXfer *xfer) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
908 { |
5146 | 909 struct aim_oft_info *oft_info = xfer->data; |
5575 | 910 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 911 OscarData *od = gc->proto_data; |
4763 | 912 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
913 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
914 "AAA - in oscar_xfer_cancel_send\n"); |
5146 | 915 |
916 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
917 | |
918 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
919 aim_oft_destroyinfo(oft_info); | |
4763 | 920 xfer->data = NULL; |
5146 | 921 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
922 } |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
923 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
924 static void oscar_xfer_cancel_recv(GaimXfer *xfer) |
4656 | 925 { |
5146 | 926 struct aim_oft_info *oft_info = xfer->data; |
5575 | 927 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 928 OscarData *od = gc->proto_data; |
4656 | 929 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
930 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
931 "AAA - in oscar_xfer_cancel_recv\n"); |
5146 | 932 |
933 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
934 | |
935 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
936 aim_oft_destroyinfo(oft_info); | |
4656 | 937 xfer->data = NULL; |
5146 | 938 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 939 } |
940 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
941 static void oscar_xfer_ack(GaimXfer *xfer, const char *buffer, size_t size) |
4656 | 942 { |
5146 | 943 struct aim_oft_info *oft_info = xfer->data; |
4656 | 944 |
945 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
946 /* | |
947 * If we're done sending, intercept the socket from the core ft code | |
948 * and wait for the other guy to send the "done" OFT packet. | |
949 */ | |
950 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
951 gaim_input_remove(xfer->watcher); | |
5146 | 952 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
4656 | 953 xfer->fd = 0; |
954 gaim_xfer_set_completed(xfer, TRUE); | |
955 } | |
956 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 957 /* Update our rolling checksum. Like Walmart, yo. */ |
958 oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); | |
4656 | 959 } |
960 } | |
961 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
962 static GaimXfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) |
4656 | 963 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
964 GaimXfer *xfer; |
5146 | 965 struct aim_oft_info *oft_info; |
4656 | 966 |
967 while (fts) { | |
968 xfer = fts->data; | |
5146 | 969 oft_info = xfer->data; |
970 | |
971 if (oft_info && !strcmp(ck, oft_info->cookie)) | |
4656 | 972 return xfer; |
973 | |
974 fts = g_slist_next(fts); | |
975 } | |
976 | |
977 return NULL; | |
978 } | |
979 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
980 static GaimXfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
4656 | 981 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
982 GaimXfer *xfer; |
5146 | 983 struct aim_oft_info *oft_info; |
4656 | 984 |
985 while (fts) { | |
986 xfer = fts->data; | |
5146 | 987 oft_info = xfer->data; |
988 | |
989 if (oft_info && (conn == oft_info->conn)) | |
4656 | 990 return xfer; |
991 | |
992 fts = g_slist_next(fts); | |
993 } | |
994 | |
995 return NULL; | |
996 } | |
997 | |
5575 | 998 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
7283 | 999 OscarData *od = (OscarData *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1000 GaimXfer *xfer; |
5146 | 1001 struct aim_oft_info *oft_info; |
3752 | 1002 |
4617 | 1003 /* You want to send a file to someone else, you're so generous */ |
1004 | |
1005 /* Build the file transfer handle */ | |
5575 | 1006 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
4617 | 1007 xfer->local_port = 5190; |
1008 | |
5146 | 1009 /* Create the oscar-specific data */ |
1010 oft_info = aim_oft_createinfo(od->sess, NULL, destsn, xfer->local_ip, xfer->local_port, 0, 0, NULL); | |
1011 xfer->data = oft_info; | |
1012 | |
4617 | 1013 /* Setup our I/O op functions */ |
1014 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
1015 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
1016 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1017 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1018 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4656 | 1019 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
4617 | 1020 |
1021 /* Keep track of this transfer for later */ | |
1022 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1023 | |
1024 /* Now perform the request */ | |
1025 gaim_xfer_request(xfer); | |
3630 | 1026 } |
1027 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1028 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
6029 | 1029 GaimConnection *gc = sess->aux_data; |
7283 | 1030 OscarData *od = gc->proto_data; |
6029 | 1031 GaimAccount *account = gc->account; |
1032 aim_conn_t *bosconn; | |
1033 char *host; int port; | |
1034 int i, rc; | |
2086 | 1035 va_list ap; |
2704 | 1036 struct aim_authresp_info *info; |
6029 | 1037 |
5575 | 1038 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1039 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1040 va_start(ap, fr); |
2704 | 1041 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 1042 va_end(ap); |
1043 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1044 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1045 "inside auth_resp (Screen name: %s)\n", info->sn); |
2704 | 1046 |
4293 | 1047 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
4056 | 1048 char buf[256]; |
2704 | 1049 switch (info->errorcode) { |
2086 | 1050 case 0x05: |
1051 /* Incorrect nick/password */ | |
6498 | 1052 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1053 gaim_connection_error(gc, _("Incorrect nickname or password.")); |
2086 | 1054 break; |
1055 case 0x11: | |
1056 /* Suspended account */ | |
6498 | 1057 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1058 gaim_connection_error(gc, _("Your account is currently suspended.")); |
2086 | 1059 break; |
3498 | 1060 case 0x14: |
1061 /* service temporarily unavailable */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1062 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); |
3498 | 1063 break; |
2086 | 1064 case 0x18: |
1065 /* connecting too frequently */ | |
6498 | 1066 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1067 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 | 1068 break; |
1069 case 0x1c: | |
1070 /* client too old */ | |
6498 | 1071 gc->wants_to_die = TRUE; |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
1072 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), GAIM_WEBSITE); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1073 gaim_connection_error(gc, buf); |
2086 | 1074 break; |
1075 default: | |
6623 | 1076 gaim_connection_error(gc, _("Authentication failed")); |
2086 | 1077 break; |
1078 } | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1079 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1080 "Login Error Code 0x%04hx\n", info->errorcode); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1081 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1082 "Error URL: %s\n", info->errorurl); |
2086 | 1083 od->killme = TRUE; |
1084 return 1; | |
1085 } | |
1086 | |
1087 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1088 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1089 "Reg status: %hu\n", info->regstatus); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1090 |
2704 | 1091 if (info->email) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1092 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email: %s\n", info->email); |
2086 | 1093 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1094 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email is NULL\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1095 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1096 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1097 gaim_debug(GAIM_DEBUG_MISC, "oscar", "BOSIP: %s\n", info->bosip); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1098 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1099 "Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1100 aim_conn_kill(sess, &fr->conn); |
2086 | 1101 |
1102 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
1103 if (bosconn == NULL) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1104 gaim_connection_error(gc, _("Internal Error")); |
2086 | 1105 od->killme = TRUE; |
1106 return 0; | |
1107 } | |
1108 | |
4649 | 1109 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1110 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 1111 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
1112 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
1113 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 1114 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 1115 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
1116 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
1117 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
1118 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
1119 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
1120 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 1121 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 1122 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
1123 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
1124 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
1125 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
1126 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 1127 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
7011 | 1128 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_userinfo, 0); |
2086 | 1129 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); |
1130 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
1131 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 1132 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
1133 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
1134 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
1135 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1136 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
5844 | 1137 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0021, oscar_icon_req,0); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
1138 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
1139 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
1140 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4759 | 1141 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
4624 | 1142 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
4230 | 1143 #ifndef NOSSI |
4642 | 1144 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
2991 | 1145 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
1146 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
1147 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
4230 | 1148 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
1149 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); | |
1150 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | |
1151 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | |
1152 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | |
1153 #endif | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1154 |
7283 | 1155 od->conn = bosconn; |
2704 | 1156 for (i = 0; i < (int)strlen(info->bosip); i++) { |
1157 if (info->bosip[i] == ':') { | |
1158 port = atoi(&(info->bosip[i+1])); | |
2086 | 1159 break; |
1160 } | |
1161 } | |
2704 | 1162 host = g_strndup(info->bosip, i); |
2086 | 1163 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1164 rc = gaim_proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
2086 | 1165 g_free(host); |
4366 | 1166 if (rc < 0) { |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1167 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 1168 od->killme = TRUE; |
1169 return 0; | |
1170 } | |
4293 | 1171 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1172 gaim_input_remove(gc->inpa); |
2704 | 1173 |
7283 | 1174 gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); |
7282 | 1175 |
2086 | 1176 return 1; |
1177 } | |
1178 | |
7285 | 1179 /* XXX - Should use gaim_url_fetch for the below stuff */ |
2086 | 1180 struct pieceofcrap { |
5575 | 1181 GaimConnection *gc; |
2086 | 1182 unsigned long offset; |
1183 unsigned long len; | |
1184 char *modname; | |
1185 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1186 aim_conn_t *conn; |
2086 | 1187 unsigned int inpa; |
1188 }; | |
1189 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1190 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 1191 { |
1192 struct pieceofcrap *pos = data; | |
7283 | 1193 OscarData *od = pos->gc->proto_data; |
2086 | 1194 char in = '\0'; |
1195 int x = 0; | |
1196 unsigned char m[17]; | |
1197 | |
1198 while (read(pos->fd, &in, 1) == 1) { | |
1199 if (in == '\n') | |
1200 x++; | |
1201 else if (in != '\r') | |
1202 x = 0; | |
1203 if (x == 2) | |
1204 break; | |
1205 in = '\0'; | |
1206 } | |
1207 if (in != '\n') { | |
4056 | 1208 char buf[256]; |
1209 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
1210 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1211 gaim_notify_warning(pos->gc, NULL, |
7422 | 1212 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1213 buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1214 gaim_input_remove(pos->inpa); |
2086 | 1215 close(pos->fd); |
1216 g_free(pos); | |
1217 return; | |
1218 } | |
1219 read(pos->fd, m, 16); | |
1220 m[16] = '\0'; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1221 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Sending hash: "); |
2086 | 1222 for (x = 0; x < 16; x++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1223 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx ", (unsigned char)m[x]); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1224 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1225 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1226 gaim_input_remove(pos->inpa); |
2086 | 1227 close(pos->fd); |
1228 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
1229 g_free(pos); | |
1230 } | |
1231 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1232 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1233 struct pieceofcrap *pos = data; |
5420 | 1234 gchar *buf; |
2086 | 1235 |
4366 | 1236 pos->fd = source; |
1237 | |
2086 | 1238 if (source < 0) { |
5420 | 1239 buf = g_strdup_printf(_("You may be disconnected shortly. You may want to use TOC until " |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
1240 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1241 gaim_notify_warning(pos->gc, NULL, |
7422 | 1242 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1243 buf); |
5420 | 1244 g_free(buf); |
2086 | 1245 if (pos->modname) |
1246 g_free(pos->modname); | |
1247 g_free(pos); | |
1248 return; | |
1249 } | |
1250 | |
5420 | 1251 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", |
2086 | 1252 pos->offset, pos->len, pos->modname ? pos->modname : ""); |
1253 write(pos->fd, buf, strlen(buf)); | |
5420 | 1254 g_free(buf); |
2086 | 1255 if (pos->modname) |
1256 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1257 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 1258 return; |
1259 } | |
1260 | |
1261 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
1262 #define AIM_MAX_FILE_SIZE 98304 | |
1263 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1264 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1265 va_list ap; |
1266 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1267 fu32_t offset, len; |
2086 | 1268 char *modname; |
1269 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1270 va_start(ap, fr); |
4200 | 1271 offset = va_arg(ap, fu32_t); |
1272 len = va_arg(ap, fu32_t); | |
2086 | 1273 modname = va_arg(ap, char *); |
1274 va_end(ap); | |
1275 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1276 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 1277 "offset: %u, len: %u, file: %s\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1278 offset, len, (modname ? modname : "aim.exe")); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1279 |
2086 | 1280 if (len == 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1281 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len is 0, hashing NULL\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1282 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 1283 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1284 return 1; | |
1285 } | |
1286 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
1287 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
1288 char *buf; | |
1289 int i = 8; | |
1290 if (modname) | |
1291 i += strlen(modname); | |
1292 buf = g_malloc(i); | |
1293 i = 0; | |
1294 if (modname) { | |
1295 memcpy(buf, modname, strlen(modname)); | |
1296 i += strlen(modname); | |
1297 } | |
1298 buf[i++] = offset & 0xff; | |
1299 buf[i++] = (offset >> 8) & 0xff; | |
1300 buf[i++] = (offset >> 16) & 0xff; | |
1301 buf[i++] = (offset >> 24) & 0xff; | |
1302 buf[i++] = len & 0xff; | |
1303 buf[i++] = (len >> 8) & 0xff; | |
1304 buf[i++] = (len >> 16) & 0xff; | |
1305 buf[i++] = (len >> 24) & 0xff; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1306 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len + offset is invalid, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1307 "hashing request\n"); |
2086 | 1308 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1309 g_free(buf); | |
1310 return 1; | |
1311 } | |
1312 */ | |
1313 | |
1314 pos = g_new0(struct pieceofcrap, 1); | |
1315 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1316 pos->conn = fr->conn; |
2086 | 1317 |
1318 pos->offset = offset; | |
1319 pos->len = len; | |
1320 pos->modname = modname ? g_strdup(modname) : NULL; | |
1321 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1322 if (gaim_proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
4056 | 1323 char buf[256]; |
2086 | 1324 if (pos->modname) |
1325 g_free(pos->modname); | |
1326 g_free(pos); | |
4056 | 1327 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
1328 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1329 gaim_notify_warning(pos->gc, NULL, |
7422 | 1330 _("Gaim was unable to get a valid login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1331 buf); |
2086 | 1332 } |
1333 | |
1334 return 1; | |
1335 } | |
1336 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1337 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1338 GaimConnection *gc = sess->aux_data; |
7283 | 1339 OscarData *od = gc->proto_data; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1340 GaimAccount *account = gaim_connection_get_account(gc); |
5575 | 1341 GaimAccount *ac = gaim_connection_get_account(gc); |
7282 | 1342 #if 0 |
1343 struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; | |
1344 #endif | |
7011 | 1345 va_list ap; |
1346 char *key; | |
2086 | 1347 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1348 va_start(ap, fr); |
2086 | 1349 key = va_arg(ap, char *); |
1350 va_end(ap); | |
1351 | |
4617 | 1352 if (od->icq) { |
3458 | 1353 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1354 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1355 gaim_account_get_password(account), &info, key); |
3458 | 1356 } else { |
1357 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1358 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1359 gaim_account_get_password(account), &info, key); |
3458 | 1360 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1361 |
7283 | 1362 gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); |
7282 | 1363 |
2086 | 1364 return 1; |
1365 } | |
1366 | |
2675 | 1367 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1368 GaimConnection *gc = sess->aux_data; |
2647 | 1369 struct chat_connection *chatcon; |
1370 static int id = 1; | |
1371 | |
6905 | 1372 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, 0x0001, gaim_parse_genericerr, 0); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
1373 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_conv_chat_join, 0); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
1374 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_conv_chat_leave, 0); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
1375 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_conv_chat_info_update, 0); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
1376 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0); |
2675 | 1377 |
2672 | 1378 aim_clientready(sess, fr->conn); |
2675 | 1379 |
2647 | 1380 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
1381 chatcon->id = id; | |
1382 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
1383 | |
1384 return 1; | |
1385 } | |
1386 | |
2675 | 1387 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
1388 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1389 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 1390 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 1391 |
1392 aim_clientready(sess, fr->conn); | |
1393 | |
1394 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1395 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1396 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1397 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1398 |
3694 | 1399 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
1400 | |
1401 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1402 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
1403 | |
7282 | 1404 aim_email_sendcookies(sess); |
1405 aim_email_activate(sess); | |
3694 | 1406 aim_clientready(sess, fr->conn); |
1407 | |
1408 return 1; | |
1409 } | |
1410 | |
4804 | 1411 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1412 GaimConnection *gc = sess->aux_data; |
7283 | 1413 OscarData *od = gc->proto_data; |
4804 | 1414 |
1415 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1416 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | |
1417 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | |
1418 | |
1419 aim_clientready(sess, fr->conn); | |
1420 | |
4823 | 1421 od->iconconnecting = FALSE; |
1422 | |
4804 | 1423 if (od->icontimer) |
1424 g_source_remove(od->icontimer); | |
1425 od->icontimer = g_timeout_add(100, gaim_icon_timerfunc, gc); | |
1426 | |
1427 return 1; | |
1428 } | |
1429 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1430 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1431 GaimConnection *gc = data; |
7283 | 1432 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1433 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1434 aim_conn_t *tstconn; |
2086 | 1435 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1436 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1437 close(source); |
1438 return; | |
1439 } | |
1440 | |
4617 | 1441 od = gc->proto_data; |
1442 sess = od->sess; | |
2086 | 1443 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
4366 | 1444 tstconn->fd = source; |
2086 | 1445 |
1446 if (source < 0) { | |
1447 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1448 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1449 "unable to connect to chatnav server\n"); |
2086 | 1450 return; |
1451 } | |
1452 | |
1453 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1454 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
|
1455 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
2086 | 1456 } |
1457 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1458 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1459 { |
5575 | 1460 GaimConnection *gc = data; |
7283 | 1461 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1462 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1463 aim_conn_t *tstconn; |
2086 | 1464 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1465 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1466 close(source); |
1467 return; | |
1468 } | |
1469 | |
4617 | 1470 od = gc->proto_data; |
1471 sess = od->sess; | |
2086 | 1472 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 1473 tstconn->fd = source; |
2086 | 1474 |
1475 if (source < 0) { | |
1476 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1477 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1478 "unable to connect to authorizer\n"); |
2086 | 1479 return; |
1480 } | |
1481 | |
1482 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1483 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
6905 | 1484 gaim_debug(GAIM_DEBUG_INFO, "oscar", "admin: connected\n"); |
2086 | 1485 } |
1486 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1487 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1488 { |
1489 struct chat_connection *ccon = data; | |
5575 | 1490 GaimConnection *gc = ccon->gc; |
7283 | 1491 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1492 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1493 aim_conn_t *tstconn; |
2086 | 1494 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1495 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1496 close(source); |
1497 g_free(ccon->show); | |
1498 g_free(ccon->name); | |
1499 g_free(ccon); | |
1500 return; | |
1501 } | |
1502 | |
4617 | 1503 od = gc->proto_data; |
1504 sess = od->sess; | |
2086 | 1505 tstconn = ccon->conn; |
4366 | 1506 tstconn->fd = source; |
2086 | 1507 |
1508 if (source < 0) { | |
1509 aim_conn_kill(sess, &tstconn); | |
1510 g_free(ccon->show); | |
1511 g_free(ccon->name); | |
1512 g_free(ccon); | |
1513 return; | |
1514 } | |
1515 | |
1516 aim_conn_completeconnect(sess, ccon->conn); | |
4617 | 1517 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
1518 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | |
2086 | 1519 } |
1520 | |
3694 | 1521 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1522 GaimConnection *gc = data; |
7283 | 1523 OscarData *od; |
3694 | 1524 aim_session_t *sess; |
1525 aim_conn_t *tstconn; | |
1526 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1527 if (!g_list_find(gaim_connections_get_all(), gc)) { |
3694 | 1528 close(source); |
1529 return; | |
1530 } | |
1531 | |
4617 | 1532 od = gc->proto_data; |
1533 sess = od->sess; | |
3694 | 1534 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
4366 | 1535 tstconn->fd = source; |
3694 | 1536 |
1537 if (source < 0) { | |
1538 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1539 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1540 "unable to connect to email server\n"); |
3694 | 1541 return; |
1542 } | |
1543 | |
1544 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1545 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
|
1546 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1547 "email: connected\n"); |
3694 | 1548 } |
1549 | |
4804 | 1550 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1551 GaimConnection *gc = data; |
7283 | 1552 OscarData *od; |
4804 | 1553 aim_session_t *sess; |
1554 aim_conn_t *tstconn; | |
1555 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1556 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4804 | 1557 close(source); |
1558 return; | |
1559 } | |
1560 | |
1561 od = gc->proto_data; | |
1562 sess = od->sess; | |
1563 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); | |
1564 tstconn->fd = source; | |
1565 | |
1566 if (source < 0) { | |
1567 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1568 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1569 "unable to connect to icon server\n"); |
4804 | 1570 return; |
1571 } | |
1572 | |
1573 aim_conn_completeconnect(sess, tstconn); | |
1574 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
|
1575 gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); |
4804 | 1576 } |
1577 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1578 /* 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
|
1579 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1580 GaimConnection *gc = sess->aux_data; |
1581 GaimAccount *account = gaim_connection_get_account(gc); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1582 aim_conn_t *tstconn; |
4452 | 1583 int i; |
2086 | 1584 char *host; |
1585 int port; | |
4821 | 1586 va_list ap; |
1587 struct aim_redirect_data *redir; | |
2086 | 1588 |
5575 | 1589 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1590 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1591 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1592 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1593 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1594 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1595 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1596 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1597 port = atoi(&(redir->ip[i+1])); |
2086 | 1598 break; |
1599 } | |
1600 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1601 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1602 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1603 switch(redir->group) { |
2086 | 1604 case 0x7: /* Authorizer */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1605 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1606 "Reconnecting with authorizor...\n"); |
2086 | 1607 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
1608 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1609 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1610 "unable to reconnect with authorizer\n"); |
2086 | 1611 g_free(host); |
1612 return 1; | |
1613 } | |
4649 | 1614 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1615 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1616 |
1617 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1618 if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
2086 | 1619 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1620 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1621 "unable to reconnect with authorizer\n"); |
2086 | 1622 g_free(host); |
1623 return 1; | |
1624 } | |
4293 | 1625 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1626 break; |
1627 | |
2086 | 1628 case 0xd: /* ChatNav */ |
1629 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1630 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1631 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1632 "unable to connect to chatnav server\n"); |
2086 | 1633 g_free(host); |
1634 return 1; | |
1635 } | |
4649 | 1636 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1637 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1638 |
1639 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1640 if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
2086 | 1641 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1642 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1643 "unable to connect to chatnav server\n"); |
2086 | 1644 g_free(host); |
1645 return 1; | |
1646 } | |
4293 | 1647 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1648 break; |
1649 | |
1650 case 0xe: { /* Chat */ | |
2086 | 1651 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1652 |
2086 | 1653 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1654 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1655 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1656 "unable to connect to chat server\n"); |
2086 | 1657 g_free(host); |
1658 return 1; | |
1659 } | |
1660 | |
4649 | 1661 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1662 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1663 | |
2086 | 1664 ccon = g_new0(struct chat_connection, 1); |
1665 ccon->conn = tstconn; | |
1666 ccon->gc = gc; | |
1667 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1668 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1669 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1670 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1671 ccon->show = extract_name(redir->chat.room); |
4634 | 1672 |
2086 | 1673 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1674 if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
2086 | 1675 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1676 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1677 "unable to connect to chat server\n"); |
2086 | 1678 g_free(host); |
1679 g_free(ccon->show); | |
1680 g_free(ccon->name); | |
1681 g_free(ccon); | |
1682 return 1; | |
1683 } | |
4293 | 1684 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1685 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1686 "Connected to chat room %s exchange %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1687 ccon->name, ccon->exchange); |
4194 | 1688 } break; |
3694 | 1689 |
4804 | 1690 case 0x0010: { /* icon */ |
1691 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1692 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1693 "unable to connect to icon server\n"); |
4804 | 1694 g_free(host); |
1695 return 1; | |
1696 } | |
1697 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); | |
1698 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); | |
1699 | |
1700 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1701 if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { |
4804 | 1702 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1703 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1704 "unable to connect to icon server\n"); |
4804 | 1705 g_free(host); |
1706 return 1; | |
1707 } | |
1708 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); | |
1709 } break; | |
1710 | |
3694 | 1711 case 0x0018: { /* email */ |
1712 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1713 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1714 "unable to connect to email server\n"); |
3694 | 1715 g_free(host); |
1716 return 1; | |
1717 } | |
4649 | 1718 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
3694 | 1719 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
1720 | |
1721 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1722 if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
3694 | 1723 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1724 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1725 "unable to connect to email server\n"); |
3694 | 1726 g_free(host); |
1727 return 1; | |
1728 } | |
4293 | 1729 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
3694 | 1730 } break; |
1731 | |
2086 | 1732 default: /* huh? */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1733 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1734 "got redirect for unknown service 0x%04hx\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1735 redir->group); |
2086 | 1736 break; |
1737 } | |
1738 | |
1739 g_free(host); | |
1740 return 1; | |
1741 } | |
1742 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1743 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1744 GaimConnection *gc = sess->aux_data; |
7283 | 1745 OscarData *od = gc->proto_data; |
4738 | 1746 struct buddyinfo *bi; |
2993 | 1747 time_t time_idle = 0, signon = 0; |
1748 int type = 0; | |
1749 int caps = 0; | |
2086 | 1750 va_list ap; |
4738 | 1751 aim_userinfo_t *info; |
4194 | 1752 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1753 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1754 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1755 va_end(ap); |
1756 | |
2993 | 1757 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
1758 caps = info->capabilities; | |
3267 | 1759 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
1760 type |= UC_AB; | |
6318 | 1761 if (caps & AIM_CAPS_HIPTOP) |
1762 type |= UC_HIPTOP; | |
3267 | 1763 |
4766 | 1764 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
1765 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
1766 type |= UC_UNCONFIRMED; | |
1767 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
1768 type |= UC_ADMIN; | |
1769 if (info->flags & AIM_FLAG_AOL) | |
1770 type |= UC_AOL; | |
1771 if (info->flags & AIM_FLAG_FREE) | |
1772 type |= UC_NORMAL; | |
1773 if (info->flags & AIM_FLAG_AWAY) | |
1774 type |= UC_UNAVAILABLE; | |
1775 if (info->flags & AIM_FLAG_WIRELESS) | |
1776 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1777 } |
2993 | 1778 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 1779 type = (info->icqinfo.status << 16); |
3013 | 1780 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
1781 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 1782 type |= UC_UNAVAILABLE; |
3013 | 1783 } |
2993 | 1784 } |
1785 | |
7141 | 1786 if (caps & AIM_CAPS_ICQ_DIRECT) |
1787 caps ^= AIM_CAPS_ICQ_DIRECT; | |
2993 | 1788 |
1789 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 1790 time(&time_idle); |
1791 time_idle -= info->idletime*60; | |
2993 | 1792 } |
1793 | |
5836 | 1794 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
1795 signon = info->onlinesince; | |
1796 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
2993 | 1797 signon = time(NULL) - info->sessionlen; |
2086 | 1798 |
5575 | 1799 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
1800 gaim_connection_set_display_name(gc, info->sn); | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1801 |
7261 | 1802 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
4738 | 1803 if (!bi) { |
1804 bi = g_new0(struct buddyinfo, 1); | |
7261 | 1805 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, info->sn)), bi); |
4738 | 1806 } |
4739 | 1807 bi->typingnot = FALSE; |
1808 bi->ico_informed = FALSE; | |
6857 | 1809 bi->ipaddr = info->icqinfo.ipaddr; |
1810 | |
1811 /* Available message stuff */ | |
6292 | 1812 free(bi->availmsg); |
7011 | 1813 if (info->avail != NULL) |
1814 if (info->avail_encoding) { | |
1815 gchar *enc = g_strdup_printf("charset=\"%s\"", info->avail_encoding); | |
1816 bi->availmsg = oscar_encoding_to_utf8(enc, info->avail, info->avail_len); | |
6292 | 1817 g_free(enc); |
1818 } else { | |
1819 /* No explicit encoding means utf8. Yay. */ | |
7011 | 1820 bi->availmsg = g_strdup(info->avail); |
6292 | 1821 } |
5837 | 1822 else |
6292 | 1823 bi->availmsg = NULL; |
4732 | 1824 |
4804 | 1825 /* Server stored icon stuff */ |
4853 | 1826 if (info->iconcsumlen) { |
7125 | 1827 const char *filename = NULL, *saved_b16 = NULL; |
1828 char *b16 = NULL; | |
7093 | 1829 GaimBuddy *b = NULL; |
4853 | 1830 |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
1831 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); |
4853 | 1832 b = gaim_find_buddy(gc->account, info->sn); |
7093 | 1833 /* |
1834 * If for some reason the checksum is valid, but cached file is not.. | |
1835 * we want to know. | |
1836 */ | |
1837 filename = gaim_buddy_get_setting(b, "buddy_icon"); | |
1838 if (filename != NULL) { | |
1839 if (g_file_test(filename, G_FILE_TEST_EXISTS)) | |
1840 saved_b16 = gaim_buddy_get_setting(b, "icon_checksum"); | |
1841 } else | |
1842 saved_b16 = NULL; | |
7054
7c04a0775918
[gaim-migrate @ 7617]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7045
diff
changeset
|
1843 |
4853 | 1844 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { |
1845 GSList *cur = od->requesticon; | |
1846 while (cur && aim_sncmp((char *)cur->data, info->sn)) | |
1847 cur = cur->next; | |
1848 if (!cur) { | |
7475 | 1849 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn))); |
4853 | 1850 if (od->icontimer) |
1851 g_source_remove(od->icontimer); | |
1852 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
1853 } | |
1854 } | |
6053 | 1855 g_free(b16); |
4853 | 1856 } |
1857 | |
5628 | 1858 serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); |
2086 | 1859 |
1860 return 1; | |
1861 } | |
1862 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1863 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1864 GaimConnection *gc = sess->aux_data; |
7283 | 1865 OscarData *od = gc->proto_data; |
2086 | 1866 va_list ap; |
4739 | 1867 aim_userinfo_t *info; |
2086 | 1868 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1869 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1870 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1871 va_end(ap); |
1872 | |
4732 | 1873 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
2086 | 1874 |
7261 | 1875 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
5837 | 1876 |
2086 | 1877 return 1; |
1878 } | |
1879 | |
3730 | 1880 static void cancel_direct_im(struct ask_direct *d) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1881 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Freeing DirectIM prompts.\n"); |
2086 | 1882 |
1883 g_free(d->sn); | |
1884 g_free(d); | |
1885 } | |
1886 | |
4617 | 1887 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1888 struct direct_im *dim = data; |
5575 | 1889 GaimConnection *gc = dim->gc; |
7283 | 1890 OscarData *od = gc->proto_data; |
5679 | 1891 GaimConversation *cnv; |
2086 | 1892 char buf[256]; |
3008 | 1893 struct sockaddr name; |
1894 socklen_t name_len = 1; | |
1895 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1896 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1897 g_free(dim); |
1898 return; | |
1899 } | |
1900 | |
1901 if (source < 0) { | |
1902 g_free(dim); | |
1903 return; | |
1904 } | |
1905 | |
4366 | 1906 dim->conn->fd = source; |
2086 | 1907 aim_conn_completeconnect(od->sess, dim->conn); |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
1908 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); |
3008 | 1909 |
1910 /* This is the best way to see if we're connected or not */ | |
1911 if (getpeername(source, &name, &name_len) == 0) { | |
1912 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
1913 dim->connected = TRUE; | |
6982 | 1914 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
3008 | 1915 } |
2086 | 1916 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 1917 |
4617 | 1918 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
2086 | 1919 } |
1920 | |
4617 | 1921 /* BBB */ |
3952 | 1922 /* |
4617 | 1923 * This is called after a remote AIM user has connected to us. We |
1924 * want to do some voodoo with the socket file descriptors, add a | |
1925 * callback or two, and then send the AIM_CB_OFT_PROMPT. | |
3952 | 1926 */ |
4656 | 1927 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1928 GaimConnection *gc = sess->aux_data; |
7283 | 1929 OscarData *od = (OscarData *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1930 GaimXfer *xfer; |
5146 | 1931 struct aim_oft_info *oft_info; |
3630 | 1932 va_list ap; |
1933 aim_conn_t *conn, *listenerconn; | |
4656 | 1934 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1935 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1936 "AAA - in oscar_sendfile_estblsh\n"); |
3630 | 1937 va_start(ap, fr); |
1938 conn = va_arg(ap, aim_conn_t *); | |
1939 listenerconn = va_arg(ap, aim_conn_t *); | |
1940 va_end(ap); | |
1941 | |
4617 | 1942 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
1943 return 1; | |
1944 | |
5146 | 1945 if (!(oft_info = xfer->data)) |
4617 | 1946 return 1; |
1947 | |
3630 | 1948 /* Stop watching listener conn; watch transfer conn instead */ |
4617 | 1949 gaim_input_remove(xfer->watcher); |
3630 | 1950 aim_conn_kill(sess, &listenerconn); |
1951 | |
5146 | 1952 oft_info->conn = conn; |
1953 xfer->fd = oft_info->conn->fd; | |
1954 | |
1955 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); | |
1956 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); | |
1957 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 1958 |
1959 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 1960 aim_oft_sendheader(sess, AIM_CB_OFT_PROMPT, oft_info); |
3630 | 1961 |
1962 return 0; | |
1963 } | |
1964 | |
3952 | 1965 /* |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1966 * This is the gaim callback passed to gaim_proxy_connect when connecting to another AIM |
4617 | 1967 * user in order to transfer a file. |
3952 | 1968 */ |
4617 | 1969 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition) { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1970 GaimXfer *xfer; |
5146 | 1971 struct aim_oft_info *oft_info; |
4656 | 1972 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1973 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1974 "AAA - in oscar_sendfile_connected\n"); |
4617 | 1975 if (!(xfer = data)) |
1976 return; | |
5146 | 1977 if (!(oft_info = xfer->data)) |
3630 | 1978 return; |
4617 | 1979 if (source < 0) |
1980 return; | |
1981 | |
1982 xfer->fd = source; | |
5146 | 1983 oft_info->conn->fd = source; |
1984 | |
1985 aim_conn_completeconnect(oft_info->sess, oft_info->conn); | |
1986 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 1987 |
1988 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 1989 aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); |
4617 | 1990 |
1991 return; | |
3630 | 1992 } |
1993 | |
3952 | 1994 /* |
4617 | 1995 * This is called when a buddy sends us some file info. This happens when they |
1996 * are sending a file to you, and you have just established a connection to them. | |
4650 | 1997 * You should send them the exact same info except use the real cookie. We also |
4617 | 1998 * get like totally ready to like, receive the file, kay? |
3952 | 1999 */ |
4617 | 2000 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2001 GaimConnection *gc = sess->aux_data; |
7283 | 2002 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2003 GaimXfer *xfer; |
5146 | 2004 struct aim_oft_info *oft_info; |
4617 | 2005 va_list ap; |
2006 aim_conn_t *conn; | |
2007 fu8_t *cookie; | |
2008 struct aim_fileheader_t *fh; | |
4656 | 2009 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2010 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2011 "AAA - in oscar_sendfile_prompt\n"); |
4617 | 2012 va_start(ap, fr); |
2013 conn = va_arg(ap, aim_conn_t *); | |
2014 cookie = va_arg(ap, fu8_t *); | |
2015 fh = va_arg(ap, struct aim_fileheader_t *); | |
2016 va_end(ap); | |
2017 | |
2018 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2019 return 1; | |
2020 | |
5146 | 2021 if (!(oft_info = xfer->data)) |
4617 | 2022 return 1; |
2023 | |
2024 /* We want to stop listening with a normal thingy */ | |
2025 gaim_input_remove(xfer->watcher); | |
2026 xfer->watcher = 0; | |
2027 | |
5146 | 2028 /* They sent us some information about the file they're sending */ |
2029 memcpy(&oft_info->fh, fh, sizeof(*fh)); | |
2030 | |
2031 /* Fill in the cookie */ | |
2032 memcpy(&oft_info->fh.bcookie, oft_info->cookie, 8); | |
2033 | |
4617 | 2034 /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ |
5146 | 2035 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); |
4617 | 2036 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2037 | |
2038 return 0; | |
3630 | 2039 } |
2040 | |
3952 | 2041 /* |
4657 | 2042 * We are sending a file to someone else. They have just acknowledged our |
4617 | 2043 * prompt, so we want to start sending data like there's no tomorrow. |
3952 | 2044 */ |
4617 | 2045 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2046 GaimConnection *gc = sess->aux_data; |
7283 | 2047 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2048 GaimXfer *xfer; |
4617 | 2049 va_list ap; |
2050 aim_conn_t *conn; | |
2051 fu8_t *cookie; | |
2052 struct aim_fileheader_t *fh; | |
4656 | 2053 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2054 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_ack\n"); |
4617 | 2055 va_start(ap, fr); |
2056 conn = va_arg(ap, aim_conn_t *); | |
2057 cookie = va_arg(ap, fu8_t *); | |
2058 fh = va_arg(ap, struct aim_fileheader_t *); | |
2059 va_end(ap); | |
2060 | |
2061 if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
2062 return 1; | |
2063 | |
4656 | 2064 /* We want to stop listening with a normal thingy */ |
2065 gaim_input_remove(xfer->watcher); | |
2066 xfer->watcher = 0; | |
2067 | |
4617 | 2068 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2069 | |
2070 return 0; | |
3630 | 2071 } |
4617 | 2072 |
2073 /* | |
2074 * We just sent a file to someone. They said they got it and everything, | |
2075 * so we can close our direct connection and what not. | |
2076 */ | |
2077 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 2078 GaimConnection *gc = sess->aux_data; |
7283 | 2079 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2080 GaimXfer *xfer; |
4617 | 2081 va_list ap; |
2082 aim_conn_t *conn; | |
2083 fu8_t *cookie; | |
2084 struct aim_fileheader_t *fh; | |
4656 | 2085 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2086 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_done\n"); |
4617 | 2087 va_start(ap, fr); |
2088 conn = va_arg(ap, aim_conn_t *); | |
2089 cookie = va_arg(ap, fu8_t *); | |
2090 fh = va_arg(ap, struct aim_fileheader_t *); | |
2091 va_end(ap); | |
2092 | |
2093 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2094 return 1; | |
2095 | |
4656 | 2096 xfer->fd = conn->fd; |
4617 | 2097 gaim_xfer_end(xfer); |
2098 | |
2099 return 0; | |
2100 } | |
3630 | 2101 |
4244 | 2102 static void accept_direct_im(struct ask_direct *d) { |
5575 | 2103 GaimConnection *gc = d->gc; |
7283 | 2104 OscarData *od; |
2086 | 2105 struct direct_im *dim; |
2945 | 2106 char *host; int port = 4443; |
4366 | 2107 int i, rc; |
2086 | 2108 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2109 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2110 cancel_direct_im(d); |
2111 return; | |
2112 } | |
2113 | |
7283 | 2114 od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2115 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); |
2086 | 2116 |
2117 dim = find_direct_im(od, d->sn); | |
2118 if (dim) { | |
3730 | 2119 cancel_direct_im(d); /* 40 */ |
4244 | 2120 return; |
2086 | 2121 } |
2122 dim = g_new0(struct direct_im, 1); | |
2123 dim->gc = d->gc; | |
2124 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
2125 | |
4617 | 2126 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
|
2127 if (!dim->conn) { |
2086 | 2128 g_free(dim); |
3730 | 2129 cancel_direct_im(d); |
4244 | 2130 return; |
2086 | 2131 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2132 |
2086 | 2133 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
4617 | 2134 gaim_odc_incoming, 0); |
2086 | 2135 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, |
4617 | 2136 gaim_odc_typing, 0); |
3033 | 2137 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
6982 | 2138 gaim_odc_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2139 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2140 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2141 port = atoi(&(d->ip[i+1])); |
2086 | 2142 break; |
2143 } | |
2144 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2145 host = g_strndup(d->ip, i); |
2086 | 2146 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2147 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
2086 | 2148 g_free(host); |
4366 | 2149 if (rc < 0) { |
2086 | 2150 aim_conn_kill(od->sess, &dim->conn); |
2151 g_free(dim); | |
3730 | 2152 cancel_direct_im(d); |
4244 | 2153 return; |
2086 | 2154 } |
2155 | |
3730 | 2156 cancel_direct_im(d); |
2086 | 2157 |
4244 | 2158 return; |
2086 | 2159 } |
2160 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2161 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
5575 | 2162 GaimConnection *gc = sess->aux_data; |
7283 | 2163 OscarData *od = gc->proto_data; |
7475 | 2164 gchar *tmp; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
2165 GaimConvImFlags flags = 0; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
2166 gsize convlen; |
3659 | 2167 GError *err = NULL; |
4738 | 2168 struct buddyinfo *bi; |
5575 | 2169 const char *iconfile; |
4738 | 2170 |
7261 | 2171 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, userinfo->sn)); |
4738 | 2172 if (!bi) { |
2173 bi = g_new0(struct buddyinfo, 1); | |
7261 | 2174 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, userinfo->sn)), bi); |
4738 | 2175 } |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2176 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2177 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
2178 flags |= GAIM_CONV_IM_AUTO_RESP; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2179 |
4738 | 2180 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
2181 bi->typingnot = TRUE; | |
2182 else | |
2183 bi->typingnot = FALSE; | |
2184 | |
4380 | 2185 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
|
2186 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2187 "%s has an icon\n", userinfo->sn); |
4738 | 2188 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
2189 bi->ico_need = TRUE; | |
2190 bi->ico_len = args->iconlen; | |
2191 bi->ico_csum = args->iconsum; | |
2192 bi->ico_time = args->iconstamp; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2193 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2194 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2195 |
5575 | 2196 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && |
7406 | 2197 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2198 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2199 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2200 |
5575 | 2201 if (!stat(iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2202 char *buf = g_malloc(st.st_size); |
5575 | 2203 file = fopen(iconfile, "rb"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2204 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
2205 int len = fread(buf, 1, st.st_size, file); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2206 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2207 "Sending buddy icon to %s (%d bytes, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2208 "%lu reported)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2209 userinfo->sn, len, st.st_size); |
4617 | 2210 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, |
2211 st.st_mtime, aimutil_iconsum(buf, st.st_size)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2212 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2213 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2214 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2215 "Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2216 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2217 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2218 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2219 "Can't stat buddy icon file!\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2220 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2221 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2222 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2223 "Character set is %hu %hu\n", args->charset, args->charsubset); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2224 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 2225 /* This message is marked as UNICODE, so we have to |
2226 * convert it to utf-8 before handing it to the gaim core. | |
2227 * This conversion should *never* fail, if it does it | |
2228 * means that either the incoming ICBM is corrupted or | |
4662 | 2229 * there is something we don't understand about it. |
2230 * For the record, AIM Unicode is big-endian UCS-2 */ | |
2231 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2232 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Received UNICODE IM\n"); |
4121 | 2233 |
2234 if (!args->msg || !args->msglen) | |
2235 return 1; | |
4641 | 2236 |
3659 | 2237 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2238 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2239 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2240 "Unicode IM conversion: %s\n", err->message); |
7475 | 2241 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 2242 g_error_free(err); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2243 } |
3722 | 2244 } else { |
3850 | 2245 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 2246 * unflagged messages, which are ASCII. That's OK because |
2247 * ASCII is a strict subset of ISO-8859-1; this should | |
2248 * help with compatibility with old, broken versions of | |
2249 * gaim (everything before 0.60) and other broken clients | |
2250 * that will happily send ISO-8859-1 without marking it as | |
2251 * such */ | |
4662 | 2252 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2253 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2254 "Received ISO-8859-1 IM\n"); |
4121 | 2255 |
2256 if (!args->msg || !args->msglen) | |
2257 return 1; | |
2258 | |
3659 | 2259 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2260 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2261 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2262 "ISO-8859-1 IM conversion: %s\n", err->message); |
7475 | 2263 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 2264 g_error_free(err); |
3659 | 2265 } |
3642 | 2266 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2267 |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7475
diff
changeset
|
2268 /* gaim_str_strip_cr(tmp); */ |
6982 | 2269 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2270 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2271 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2272 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2273 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2274 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2275 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
5575 | 2276 GaimConnection *gc = sess->aux_data; |
7283 | 2277 OscarData *od = gc->proto_data; |
5575 | 2278 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
|
2279 |
4121 | 2280 if (!args) |
2281 return 0; | |
4194 | 2282 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2283 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2284 "rendezvous with %s, status is %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2285 userinfo->sn, args->status); |
2869 | 2286 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2287 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 2288 char *name; |
5234 | 2289 GHashTable *components; |
2290 | |
4121 | 2291 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
2292 return 1; | |
5234 | 2293 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
2294 g_free); | |
4121 | 2295 name = extract_name(args->info.chat.roominfo.name); |
5234 | 2296 g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name)); |
2297 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
|
2298 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2299 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2300 userinfo->sn, |
6059 | 2301 args->msg, |
5234 | 2302 components); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2303 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2304 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2305 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
4617 | 2306 /* BBB */ |
2307 if (args->status == AIM_RENDEZVOUS_PROPOSE) { | |
2308 /* Someone wants to send a file (or files) to us */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2309 GaimXfer *xfer; |
5146 | 2310 struct aim_oft_info *oft_info; |
2311 | |
2312 if (!args->cookie || !args->port || !args->verifiedip || | |
2313 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
4656 | 2314 !args->info.sendfile.totfiles || !args->reqclass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2315 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2316 "%s tried to send you a file with incomplete " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2317 "information.\n", userinfo->sn); |
5146 | 2318 if (args->proxyip) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2319 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2320 "IP for a proxy server was given. Gaim " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2321 "does not support this yet.\n"); |
4617 | 2322 return 1; |
4656 | 2323 } |
4617 | 2324 |
2325 if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { | |
2326 /* last char of the ft req is a star, they are sending us a | |
2327 * directory -- remove the star and trailing slash so we dont save | |
2328 * directories that look like 'dirname\*' -- arl */ | |
2329 char *tmp = strrchr(args->info.sendfile.filename, '\\'); | |
2330 if (tmp && (tmp[1] == '*')) { | |
2331 tmp[0] = '\0'; | |
2332 } | |
2333 } | |
2334 | |
2335 /* Build the file transfer handle */ | |
2336 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); | |
5163 | 2337 xfer->remote_ip = g_strdup(args->verifiedip); |
5146 | 2338 xfer->remote_port = args->port; |
4617 | 2339 gaim_xfer_set_filename(xfer, args->info.sendfile.filename); |
2340 gaim_xfer_set_size(xfer, args->info.sendfile.totsize); | |
5146 | 2341 |
2342 /* Create the oscar-specific data */ | |
5163 | 2343 oft_info = aim_oft_createinfo(od->sess, args->cookie, userinfo->sn, args->clientip, xfer->remote_port, 0, 0, NULL); |
4898 | 2344 if (args->proxyip) |
5146 | 2345 oft_info->proxyip = g_strdup(args->proxyip); |
4898 | 2346 if (args->verifiedip) |
5146 | 2347 oft_info->verifiedip = g_strdup(args->verifiedip); |
2348 xfer->data = oft_info; | |
4617 | 2349 |
2350 /* Setup our I/O op functions */ | |
2351 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
2352 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
2353 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2354 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2355 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4617 | 2356 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
2357 | |
2358 /* | |
2359 * XXX - Should do something with args->msg, args->encoding, and args->language | |
2360 * probably make it apply to all ch2 messages. | |
3752 | 2361 */ |
4617 | 2362 |
2363 /* Keep track of this transfer for later */ | |
2364 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
2365 | |
2366 /* Now perform the request */ | |
2367 gaim_xfer_request(xfer); | |
2368 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { | |
2369 /* The other user wants to cancel a file transfer */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2370 GaimXfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2371 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2372 "AAA - File transfer canceled by remote user\n"); |
4617 | 2373 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
|
2374 gaim_xfer_cancel_remote(xfer); |
4617 | 2375 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
2376 /* | |
2377 * This gets sent by the receiver of a file | |
2378 * as they connect directly to us. If we don't | |
2379 * get this, then maybe a third party connected | |
2380 * to us, and we shouldn't send them anything. | |
2381 */ | |
2382 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2383 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2384 "unknown rendezvous status!\n"); |
3630 | 2385 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2386 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2387 } else if (args->reqclass & AIM_CAPS_VOICE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2388 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2389 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2390 userinfo->sn, args->info.icon.icon, |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2391 args->info.icon.length); |
6871 | 2392 } else if (args->reqclass & AIM_CAPS_DIRECTIM) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2393 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2394 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2395 |
4212 | 2396 if (!args->verifiedip) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2397 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2398 "directim kill blocked (%s)\n", userinfo->sn); |
4650 | 2399 return 1; |
4212 | 2400 } |
2401 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2402 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2403 "%s received direct im request from %s (%s)\n", |
5575 | 2404 username, userinfo->sn, args->verifiedip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2405 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2406 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2407 d->sn = g_strdup(userinfo->sn); |
2869 | 2408 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2409 memcpy(d->cookie, args->cookie, 8); |
5575 | 2410 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
|
2411 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2412 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2413 _("This requires a direct connection between " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2414 "the two computers and is necessary for IM " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2415 "Images. Because your IP address will be " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2416 "revealed, this may be considered a privacy " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2417 "risk."), 0, d, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2418 _("Connect"), G_CALLBACK(accept_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2419 _("Cancel"), G_CALLBACK(cancel_direct_im)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2420 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2421 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2422 "Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2423 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2424 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2425 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2426 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2427 |
3453 | 2428 /* |
4230 | 2429 * Authorization Functions |
2430 * Most of these are callbacks from dialogs. They're used by both | |
2431 * methods of authorization (SSI and old-school channel 4 ICBM) | |
3453 | 2432 */ |
4269 | 2433 /* When you ask other people for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2434 static void gaim_auth_request(struct name_data *data, char *msg) { |
5575 | 2435 GaimConnection *gc = data->gc; |
4244 | 2436 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2437 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2438 OscarData *od = gc->proto_data; |
6695 | 2439 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); |
2440 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4244 | 2441 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2442 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2443 "ssi: adding buddy %s to group %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2444 buddy->name, group->name); |
4889 | 2445 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
4269 | 2446 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
4889 | 2447 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
4244 | 2448 } |
4230 | 2449 } |
4337 | 2450 } |
2451 | |
2452 static void gaim_auth_request_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2453 gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2454 NULL, _("Please authorize me!"), TRUE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2455 _("OK"), G_CALLBACK(gaim_auth_request), |
5836 | 2456 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2457 data); |
4230 | 2458 } |
2459 | |
2460 static void gaim_auth_dontrequest(struct name_data *data) { | |
5575 | 2461 GaimConnection *gc = data->gc; |
4244 | 2462 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2463 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2464 /* OscarData *od = gc->proto_data; */ |
4244 | 2465 /* XXX - Take the buddy out of our buddy list */ |
2466 } | |
2467 | |
5836 | 2468 oscar_free_name_data(data); |
4230 | 2469 } |
2470 | |
5575 | 2471 static void gaim_auth_sendrequest(GaimConnection *gc, const char *name) { |
4269 | 2472 struct name_data *data = g_new(struct name_data, 1); |
6695 | 2473 GaimBuddy *buddy; |
4269 | 2474 gchar *dialog_msg, *nombre; |
2475 | |
4687 | 2476 buddy = gaim_find_buddy(gc->account, name); |
2477 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
2478 nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); | |
4269 | 2479 else |
4830 | 2480 nombre = NULL; |
2481 | |
2482 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 | 2483 data->gc = gc; |
2484 data->name = g_strdup(name); | |
2485 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2486 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2487 gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2488 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2489 _("Request Authorization"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2490 G_CALLBACK(gaim_auth_request_msgprompt), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2491 _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); |
4269 | 2492 |
2493 g_free(dialog_msg); | |
2494 g_free(nombre); | |
2495 } | |
2496 | |
4230 | 2497 /* When other people ask you for authorization */ |
2498 static void gaim_auth_grant(struct name_data *data) { | |
5575 | 2499 GaimConnection *gc = data->gc; |
4244 | 2500 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2501 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2502 OscarData *od = gc->proto_data; |
4236 | 2503 #ifdef NOSSI |
6695 | 2504 GaimBuddy *buddy; |
4244 | 2505 gchar message; |
2506 message = 0; | |
4687 | 2507 buddy = gaim_find_buddy(gc->account, data->name); |
4617 | 2508 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
7011
diff
changeset
|
2509 gaim_account_notify_added(gc->account, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 2510 #else |
4889 | 2511 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
4230 | 2512 #endif |
4244 | 2513 } |
2514 | |
5836 | 2515 oscar_free_name_data(data); |
3141 | 2516 } |
2517 | |
4230 | 2518 /* When other people ask you for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2519 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
5575 | 2520 GaimConnection *gc = data->gc; |
4244 | 2521 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2522 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2523 OscarData *od = gc->proto_data; |
4230 | 2524 #ifdef NOSSI |
4617 | 2525 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
4230 | 2526 #else |
4889 | 2527 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
4230 | 2528 #endif |
4244 | 2529 } |
4337 | 2530 } |
2531 | |
2532 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2533 gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2534 NULL, _("No reason given."), TRUE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2535 _("OK"), G_CALLBACK(gaim_auth_dontgrant), |
5836 | 2536 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2537 data); |
3141 | 2538 } |
2539 | |
7023 | 2540 /* When someone sends you buddies */ |
2541 static void gaim_icq_buddyadd(struct name_data *data) { | |
5575 | 2542 GaimConnection *gc = data->gc; |
4244 | 2543 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2544 if (g_list_find(gaim_connections_get_all(), gc)) { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7054
diff
changeset
|
2545 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick); |
4244 | 2546 } |
2547 | |
5836 | 2548 oscar_free_name_data(data); |
3453 | 2549 } |
2550 | |
4075 | 2551 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 | 2552 GaimConnection *gc = sess->aux_data; |
4076 | 2553 gchar **msg1, **msg2; |
2554 GError *err = NULL; | |
6051 | 2555 int i, numtoks; |
4076 | 2556 |
4121 | 2557 if (!args->type || !args->msg || !args->uin) |
2558 return 1; | |
4194 | 2559 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2560 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2561 "Received a channel 4 message of type 0x%02hhx.\n", args->type); |
4076 | 2562 |
2563 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 2564 msg1 = g_strsplit(args->msg, "\376", 0); |
6051 | 2565 for (numtoks=0; msg1[numtoks]; numtoks++); |
2566 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); | |
4076 | 2567 for (i=0; msg1[i]; i++) { |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7475
diff
changeset
|
2568 gaim_str_strip_cr(msg1[i]); |
4076 | 2569 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); |
4800 | 2570 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2571 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2572 "Error converting a string from ISO-8859-1 to " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2573 "UTF-8 in oscar ICBM channel 4 parsing\n"); |
4800 | 2574 g_error_free(err); |
2575 } | |
4076 | 2576 } |
2577 msg2[i] = NULL; | |
2578 | |
3952 | 2579 switch (args->type) { |
4173 | 2580 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 2581 if (i >= 1) { |
5556 | 2582 gchar *uin = g_strdup_printf("%u", args->uin); |
4076 | 2583 if (t) { /* This is an offline message */ |
2584 /* I think this timestamp is in UTC, or something */ | |
6982 | 2585 serv_got_im(gc, uin, msg2[0], 0, t); |
4076 | 2586 } else { /* This is a message from MacICQ/Miranda */ |
6982 | 2587 serv_got_im(gc, uin, msg2[0], 0, time(NULL)); |
4076 | 2588 } |
2589 g_free(uin); | |
4075 | 2590 } |
3316 | 2591 } break; |
2592 | |
4173 | 2593 case 0x04: { /* Someone sent you a URL */ |
4076 | 2594 if (i >= 2) { |
7385 | 2595 if (msg2[1] != NULL) { |
2596 gchar *uin = g_strdup_printf("%u", args->uin); | |
2597 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", | |
2598 msg2[1], | |
2599 (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]); | |
2600 serv_got_im(gc, uin, message, 0, time(NULL)); | |
2601 g_free(uin); | |
2602 g_free(message); | |
2603 } | |
3453 | 2604 } |
2605 } break; | |
2606 | |
4173 | 2607 case 0x06: { /* Someone requested authorization */ |
4076 | 2608 if (i >= 6) { |
4230 | 2609 struct name_data *data = g_new(struct name_data, 1); |
5556 | 2610 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
|
2611 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5556 | 2612 "Received an authorization request from UIN %u\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2613 args->uin); |
4076 | 2614 data->gc = gc; |
5556 | 2615 data->name = g_strdup_printf("%u", args->uin); |
4230 | 2616 data->nick = NULL; |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2617 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2618 gaim_request_action(gc, NULL, _("Authorization Request"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2619 dialog_msg, 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2620 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2621 G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2622 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2623 G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4076 | 2624 g_free(dialog_msg); |
2625 } | |
3141 | 2626 } break; |
2627 | |
4173 | 2628 case 0x07: { /* Someone has denied you authorization */ |
4076 | 2629 if (i >= 1) { |
7023 | 2630 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2631 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2632 dialog_msg); |
4076 | 2633 g_free(dialog_msg); |
2634 } | |
3141 | 2635 } break; |
2636 | |
4173 | 2637 case 0x08: { /* Someone has granted you authorization */ |
7023 | 2638 gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2639 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2640 dialog_msg); |
3141 | 2641 g_free(dialog_msg); |
2642 } break; | |
2643 | |
4333 | 2644 case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
2645 if (i >= 5) { | |
2646 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
|
2647 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); |
4333 | 2648 g_free(dialog_msg); |
2649 } | |
2650 } break; | |
2651 | |
4173 | 2652 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 2653 if (i >= 6) { |
4194 | 2654 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
|
2655 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); |
4076 | 2656 g_free(dialog_msg); |
2657 } | |
4075 | 2658 } break; |
2659 | |
4173 | 2660 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 2661 if (i >= 6) { |
4308 | 2662 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
|
2663 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg); |
4076 | 2664 g_free(dialog_msg); |
2665 } | |
4075 | 2666 } break; |
2667 | |
4173 | 2668 case 0x12: { |
3141 | 2669 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
7023 | 2670 /* Someone added you to their buddy list? */ |
3141 | 2671 } break; |
2672 | |
7023 | 2673 case 0x13: { /* Someone has sent you some ICQ buddies */ |
3453 | 2674 int i, num; |
2675 gchar **text; | |
4173 | 2676 text = g_strsplit(args->msg, "\376", 0); |
3453 | 2677 if (text) { |
2678 num = 0; | |
2679 for (i=0; i<strlen(text[0]); i++) | |
2680 num = num*10 + text[0][i]-48; | |
2681 for (i=0; i<num; i++) { | |
4230 | 2682 struct name_data *data = g_new(struct name_data, 1); |
7023 | 2683 gchar *message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); |
3453 | 2684 data->gc = gc; |
4790 | 2685 data->name = g_strdup(text[i*2+1]); |
2686 data->nick = g_strdup(text[i*2+2]); | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2687 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2688 gaim_request_action(gc, NULL, message, |
7023 | 2689 _("Do you want to add this buddy " |
2690 "to your buddy list?"), | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2691 0, data, 2, |
7023 | 2692 _("Add"), G_CALLBACK(gaim_icq_buddyadd), |
5836 | 2693 _("Decline"), G_CALLBACK(oscar_free_name_data)); |
3453 | 2694 g_free(message); |
2695 } | |
2696 g_strfreev(text); | |
2697 } | |
2698 } break; | |
2699 | |
7023 | 2700 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */ |
3453 | 2701 /* This is boring and silly. */ |
2702 } break; | |
2703 | |
3141 | 2704 default: { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2705 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2706 "Received a channel 4 message of unknown type " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2707 "(type 0x%02hhx).\n", args->type); |
3141 | 2708 } break; |
2709 } | |
2710 | |
4076 | 2711 g_strfreev(msg1); |
2712 g_strfreev(msg2); | |
2713 | |
3141 | 2714 return 1; |
2715 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2716 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2717 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 2718 fu16_t channel; |
2719 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2720 aim_userinfo_t *userinfo; |
2086 | 2721 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2722 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2723 va_start(ap, fr); |
4200 | 2724 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2725 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 2726 |
3141 | 2727 switch (channel) { |
2728 case 1: { /* standard message */ | |
2729 struct aim_incomingim_ch1_args *args; | |
2730 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
2731 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
2732 } break; | |
2733 | |
2734 case 2: { /* rendevous */ | |
2735 struct aim_incomingim_ch2_args *args; | |
2736 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
2737 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
2738 } break; | |
2739 | |
2740 case 4: { /* ICQ */ | |
2741 struct aim_incomingim_ch4_args *args; | |
2742 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 2743 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 2744 } break; |
2745 | |
2746 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2747 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2748 "ICBM received on unsupported channel (channel " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2749 "0x%04hx).", channel); |
3141 | 2750 } break; |
2086 | 2751 } |
2752 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2753 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2754 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2755 return ret; |
2086 | 2756 } |
2757 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2758 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
5420 | 2759 char *buf; |
2086 | 2760 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2761 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2762 aim_userinfo_t *userinfo; |
2086 | 2763 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2764 va_start(ap, fr); |
4200 | 2765 chan = (fu16_t)va_arg(ap, unsigned int); |
2766 userinfo = va_arg(ap, aim_userinfo_t *); | |
2767 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
2768 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 2769 va_end(ap); |
2770 | |
2771 switch(reason) { | |
5420 | 2772 case 0: /* Invalid (0) */ |
2773 buf = g_strdup_printf( | |
2774 ngettext( | |
4276 | 2775 "You missed %hu message from %s because it was invalid.", |
2776 "You missed %hu messages from %s because they were invalid.", | |
2777 nummissed), | |
4282 | 2778 nummissed, |
2779 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2780 break; |
5420 | 2781 case 1: /* Message too large */ |
2782 buf = g_strdup_printf( | |
2783 ngettext( | |
4276 | 2784 "You missed %hu message from %s because it was too large.", |
2785 "You missed %hu messages from %s because they were too large.", | |
2786 nummissed), | |
4282 | 2787 nummissed, |
2788 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2789 break; |
5420 | 2790 case 2: /* Rate exceeded */ |
2791 buf = g_strdup_printf( | |
2792 ngettext( | |
4276 | 2793 "You missed %hu message from %s because the rate limit has been exceeded.", |
2794 "You missed %hu messages from %s because the rate limit has been exceeded.", | |
2795 nummissed), | |
4282 | 2796 nummissed, |
2797 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2798 break; |
5420 | 2799 case 3: /* Evil Sender */ |
2800 buf = g_strdup_printf( | |
2801 ngettext( | |
4276 | 2802 "You missed %hu message from %s because he/she was too evil.", |
2803 "You missed %hu messages from %s because he/she was too evil.", | |
2804 nummissed), | |
4282 | 2805 nummissed, |
2806 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2807 break; |
5420 | 2808 case 4: /* Evil Receiver */ |
2809 buf = g_strdup_printf( | |
2810 ngettext( | |
4276 | 2811 "You missed %hu message from %s because you are too evil.", |
2812 "You missed %hu messages from %s because you are too evil.", | |
2813 nummissed), | |
4282 | 2814 nummissed, |
2815 userinfo->sn); | |
2086 | 2816 break; |
2817 default: | |
5420 | 2818 buf = g_strdup_printf( |
2819 ngettext( | |
4276 | 2820 "You missed %hu message from %s for an unknown reason.", |
2821 "You missed %hu messages from %s for an unknown reason.", | |
2822 nummissed), | |
4282 | 2823 nummissed, |
2824 userinfo->sn); | |
2086 | 2825 break; |
2826 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2827 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 2828 g_free(buf); |
2086 | 2829 |
2830 return 1; | |
2831 } | |
2832 | |
3212 | 2833 static char *gaim_icq_status(int state) { |
2834 /* Make a cute little string that shows the status of the dude or dudet */ | |
2835 if (state & AIM_ICQ_STATE_CHAT) | |
4342 | 2836 return g_strdup_printf(_("Free For Chat")); |
3212 | 2837 else if (state & AIM_ICQ_STATE_DND) |
4342 | 2838 return g_strdup_printf(_("Do Not Disturb")); |
3212 | 2839 else if (state & AIM_ICQ_STATE_OUT) |
4342 | 2840 return g_strdup_printf(_("Not Available")); |
3212 | 2841 else if (state & AIM_ICQ_STATE_BUSY) |
4342 | 2842 return g_strdup_printf(_("Occupied")); |
3212 | 2843 else if (state & AIM_ICQ_STATE_AWAY) |
4342 | 2844 return g_strdup_printf(_("Away")); |
3212 | 2845 else if (state & AIM_ICQ_STATE_WEBAWARE) |
4342 | 2846 return g_strdup_printf(_("Web Aware")); |
3212 | 2847 else if (state & AIM_ICQ_STATE_INVISIBLE) |
4342 | 2848 return g_strdup_printf(_("Invisible")); |
3212 | 2849 else |
4342 | 2850 return g_strdup_printf(_("Online")); |
3212 | 2851 } |
2852 | |
4194 | 2853 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
5575 | 2854 GaimConnection *gc = sess->aux_data; |
7283 | 2855 OscarData *od = gc->proto_data; |
4617 | 2856 |
2857 /* BBB */ | |
3630 | 2858 switch (reason) { |
4151 | 2859 case 3: { /* Decline sendfile. */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2860 GaimXfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2861 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2862 "AAA - Other user declined file transfer\n"); |
4617 | 2863 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
|
2864 gaim_xfer_cancel_remote(xfer); |
4151 | 2865 } break; |
2866 | |
2867 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2868 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2869 "Received an unknown rendezvous client auto-response " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2870 "from %s. Type 0x%04hx\n", who, reason); |
4151 | 2871 } |
3630 | 2872 |
2873 } | |
2874 | |
2875 return 0; | |
2876 } | |
2877 | |
4194 | 2878 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
5575 | 2879 GaimConnection *gc = sess->aux_data; |
4151 | 2880 |
2881 switch(reason) { | |
2882 case 0x0003: { /* Reply from an ICQ status message request */ | |
2883 char *status_msg = gaim_icq_status(state); | |
2884 char *dialog_msg, **splitmsg; | |
2885 | |
2886 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
2887 splitmsg = g_strsplit(msg, "\r\n", 0); | |
2888 | |
7011 | 2889 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); |
7032 | 2890 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, dialog_msg, NULL, NULL); |
4151 | 2891 |
2892 g_free(status_msg); | |
2893 g_free(dialog_msg); | |
2894 g_strfreev(splitmsg); | |
2895 } break; | |
2896 | |
2897 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2898 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2899 "Received an unknown client auto-response from %s. " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2900 "Type 0x%04hx\n", who, reason); |
4151 | 2901 } break; |
2902 } /* end of switch */ | |
2903 | |
2904 return 0; | |
2905 } | |
2906 | |
3212 | 2907 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
2908 va_list ap; | |
2909 fu16_t chan, reason; | |
2910 char *who; | |
2911 | |
2912 va_start(ap, fr); | |
4200 | 2913 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2914 who = va_arg(ap, char *); |
4200 | 2915 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2916 |
3952 | 2917 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 2918 char *cookie = va_arg(ap, char *); |
4151 | 2919 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 2920 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 2921 fu32_t state = 0; |
4151 | 2922 char *msg = NULL; |
2923 if (reason == 0x0003) { | |
4200 | 2924 state = va_arg(ap, fu32_t); |
4151 | 2925 msg = va_arg(ap, char *); |
2926 } | |
2927 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
2928 } | |
3952 | 2929 |
3212 | 2930 va_end(ap); |
2931 | |
2932 return 1; | |
2933 } | |
2934 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2935 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2936 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2937 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2938 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2939 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2940 va_start(ap, fr); |
4199 | 2941 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2942 va_end(ap); |
2943 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2944 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2945 "snac threw error (reason 0x%04hx: %s)\n", reason, |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2946 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2086 | 2947 |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2948 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
5411 | 2949 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2950 gaim_notify_error(sess->aux_data, NULL, m, NULL); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2951 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2952 |
2086 | 2953 return 1; |
2954 } | |
2955 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2956 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4617 | 2957 #if 0 |
5575 | 2958 GaimConnection *gc = sess->aux_data; |
7283 | 2959 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2960 GaimXfer *xfer; |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2961 #endif |
4617 | 2962 va_list ap; |
2963 fu16_t reason; | |
2964 char *data, *buf; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2965 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2966 va_start(ap, fr); |
4617 | 2967 reason = (fu16_t)va_arg(ap, unsigned int); |
3752 | 2968 data = va_arg(ap, char *); |
2086 | 2969 va_end(ap); |
2970 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2971 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2972 "Message error with data %s and reason %hu\n", data, reason); |
4617 | 2973 |
2974 /* BBB */ | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2975 #if 0 |
4617 | 2976 /* If this was a file transfer request, data is a cookie */ |
2977 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) { | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2978 gaim_xfer_cancel_remote(xfer); |
3630 | 2979 return 1; |
2980 } | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2981 #endif |
3630 | 2982 |
4617 | 2983 /* Data is assumed to be the destination sn */ |
2984 buf = g_strdup_printf(_("Your message to %s did not get sent:"), data); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2985 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2986 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
4617 | 2987 g_free(buf); |
2086 | 2988 |
2989 return 1; | |
2990 } | |
2991 | |
3595 | 2992 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2993 GaimConnection *gc = sess->aux_data; |
3595 | 2994 va_list ap; |
2995 fu16_t type1, type2; | |
2996 char *sn; | |
2997 | |
2998 va_start(ap, fr); | |
4199 | 2999 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3000 sn = va_arg(ap, char *); |
4199 | 3001 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3002 va_end(ap); |
3003 | |
3004 switch (type2) { | |
3005 case 0x0000: { /* Text has been cleared */ | |
3006 serv_got_typing_stopped(gc, sn); | |
3007 } break; | |
3008 | |
3009 case 0x0001: { /* Paused typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3010 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
3595 | 3011 } break; |
3012 | |
3013 case 0x0002: { /* Typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3014 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
3595 | 3015 } break; |
3016 | |
3017 default: { | |
5435 | 3018 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2); |
3595 | 3019 } break; |
3020 } | |
3021 | |
3022 return 1; | |
3023 } | |
3024 | |
7141 | 3025 /* |
3026 * We get this error when there was an error in the locate family. This | |
7259 | 3027 * happens when you request info of someone who is offline. |
7141 | 3028 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3029 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
7259 | 3030 gchar *buf; |
2086 | 3031 va_list ap; |
5420 | 3032 fu16_t reason; |
2086 | 3033 char *destn; |
3034 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3035 va_start(ap, fr); |
4199 | 3036 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3037 destn = va_arg(ap, char *); |
3038 va_end(ap); | |
3039 | |
5420 | 3040 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3041 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3042 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
5420 | 3043 g_free(buf); |
2086 | 3044 |
3045 return 1; | |
3046 } | |
3047 | |
6982 | 3048 #if 0 |
2086 | 3049 static char *images(int flags) { |
3050 static char buf[1024]; | |
3101 | 3051 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
2679 | 3052 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
2086 | 3053 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
3054 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
3101 | 3055 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
2086 | 3056 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
3079 | 3057 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
3058 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); | |
2086 | 3059 return buf; |
3060 } | |
6982 | 3061 #endif |
3101 | 3062 |
2920 | 3063 static char *caps_string(guint caps) |
3064 { | |
3065 static char buf[512], *tmp; | |
3066 int count = 0, i = 0; | |
3067 guint bit = 1; | |
4742 | 3068 |
3069 if (!caps) { | |
4744 | 3070 return NULL; |
6318 | 3071 } else while (bit <= AIM_CAPS_LAST) { |
2920 | 3072 if (bit & caps) { |
3073 switch (bit) { | |
6871 | 3074 case AIM_CAPS_BUDDYICON: |
2920 | 3075 tmp = _("Buddy Icon"); |
3076 break; | |
6871 | 3077 case AIM_CAPS_VOICE: |
2920 | 3078 tmp = _("Voice"); |
3079 break; | |
6871 | 3080 case AIM_CAPS_DIRECTIM: |
7141 | 3081 tmp = _("AIM Direct IM"); |
2920 | 3082 break; |
6871 | 3083 case AIM_CAPS_CHAT: |
2920 | 3084 tmp = _("Chat"); |
3085 break; | |
6871 | 3086 case AIM_CAPS_GETFILE: |
2920 | 3087 tmp = _("Get File"); |
3088 break; | |
6871 | 3089 case AIM_CAPS_SENDFILE: |
2920 | 3090 tmp = _("Send File"); |
3091 break; | |
6871 | 3092 case AIM_CAPS_GAMES: |
3093 case AIM_CAPS_GAMES2: | |
2920 | 3094 tmp = _("Games"); |
3095 break; | |
6871 | 3096 case AIM_CAPS_SAVESTOCKS: |
4898 | 3097 tmp = _("Add-Ins"); |
2920 | 3098 break; |
6871 | 3099 case AIM_CAPS_SENDBUDDYLIST: |
2920 | 3100 tmp = _("Send Buddy List"); |
3101 break; | |
7141 | 3102 case AIM_CAPS_ICQ_DIRECT: |
3103 tmp = _("ICQ Direct Connect"); | |
2920 | 3104 break; |
6871 | 3105 case AIM_CAPS_APINFO: |
2920 | 3106 tmp = _("AP User"); |
3107 break; | |
6871 | 3108 case AIM_CAPS_ICQRTF: |
2920 | 3109 tmp = _("ICQ RTF"); |
3110 break; | |
6871 | 3111 case AIM_CAPS_EMPTY: |
2920 | 3112 tmp = _("Nihilist"); |
3113 break; | |
6871 | 3114 case AIM_CAPS_ICQSERVERRELAY: |
2920 | 3115 tmp = _("ICQ Server Relay"); |
3116 break; | |
6871 | 3117 case AIM_CAPS_ICQUTF8OLD: |
3118 tmp = _("Old ICQ UTF8"); | |
2920 | 3119 break; |
6871 | 3120 case AIM_CAPS_TRILLIANCRYPT: |
2920 | 3121 tmp = _("Trillian Encryption"); |
3122 break; | |
6871 | 3123 case AIM_CAPS_ICQUTF8: |
4742 | 3124 tmp = _("ICQ UTF8"); |
3125 break; | |
6318 | 3126 case AIM_CAPS_HIPTOP: |
3127 tmp = _("Hiptop"); | |
3128 break; | |
6871 | 3129 case AIM_CAPS_SECUREIM: |
7334 | 3130 tmp = _("Security Enabled"); |
6871 | 3131 break; |
2920 | 3132 default: |
3133 tmp = NULL; | |
3134 break; | |
3135 } | |
3136 if (tmp) | |
3137 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
3138 tmp); | |
3139 count++; | |
3140 } | |
3141 bit <<= 1; | |
3142 } | |
4744 | 3143 return buf; |
2920 | 3144 } |
3145 | |
7011 | 3146 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3147 GaimConnection *gc = sess->aux_data; |
7011 | 3148 GString *text; |
7162 | 3149 gchar *info_utf8 = NULL, *away_utf8 = NULL; |
3150 const char *final = NULL; | |
4791 | 3151 va_list ap; |
7011 | 3152 aim_userinfo_t *userinfo; |
2086 | 3153 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3154 va_start(ap, fr); |
7011 | 3155 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3156 va_end(ap); |
3157 | |
7011 | 3158 text = g_string_new(""); |
3159 g_string_append_printf(text, _("Username: <b>%s</b><br>\n"), userinfo->sn); | |
3160 g_string_append_printf(text, _("Warning Level: <b>%d%%</b><br>\n"), (int)((userinfo->warnlevel/10.0) + 0.5)); | |
3161 | |
3162 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
3163 g_string_append_printf(text, _("Online Since: <b>%s</b><br>\n"), | |
3164 asctime(localtime((time_t *)&userinfo->onlinesince))); | |
3165 | |
3166 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
3167 g_string_append_printf(text, _("Member Since: <b>%s</b><br>\n"), | |
3168 asctime(localtime((time_t *)&userinfo->membersince))); | |
3169 | |
3170 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3171 gchar *itime = gaim_str_seconds_to_string(userinfo->idletime*60); |
7011 | 3172 g_string_append_printf(text, _("Idle: <b>%s</b>"), itime); |
4426 | 3173 g_free(itime); |
2993 | 3174 } else |
7011 | 3175 g_string_append_printf(text, _("Idle: <b>Active</b>")); |
3176 | |
3177 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
3178 away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len); | |
3179 if (away_utf8 != NULL) { | |
7129 | 3180 g_string_append_printf(text, "<hr>%s", away_utf8); |
7011 | 3181 g_free(away_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3182 } |
7011 | 3183 } |
3184 | |
3185 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { | |
3186 info_utf8 = oscar_encoding_to_utf8(userinfo->info_encoding, userinfo->info, userinfo->info_len); | |
3187 if (info_utf8 != NULL) { | |
7129 | 3188 g_string_append_printf(text, "<hr>%s", info_utf8); |
7011 | 3189 g_free(info_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3190 } |
7011 | 3191 } |
3192 | |
7164 | 3193 final = gaim_str_sub_away_formatters(text->str, gaim_account_get_username(gaim_connection_get_account(gc))); |
7011 | 3194 g_string_free(text, TRUE); |
7091 | 3195 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, final, NULL, NULL); |
4151 | 3196 |
2086 | 3197 return 1; |
3198 } | |
3199 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3200 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3201 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3202 fu16_t id; |
2086 | 3203 va_list ap; |
3204 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3205 va_start(ap, fr); |
4199 | 3206 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3207 msg = va_arg(ap, char *); |
3208 va_end(ap); | |
3209 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3210 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3211 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
3212 if (id < 4) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3213 gaim_notify_warning(sess->aux_data, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3214 _("Your AIM connection may be lost."), NULL); |
2086 | 3215 |
3216 return 1; | |
3217 } | |
3218 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3219 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3220 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3221 fu16_t type; |
5575 | 3222 GaimConnection *gc = sess->aux_data; |
7283 | 3223 OscarData *od = (OscarData *)gc->proto_data; |
2086 | 3224 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3225 va_start(ap, fr); |
4199 | 3226 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3227 |
3228 switch(type) { | |
3229 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3230 fu8_t maxrooms; |
2086 | 3231 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3232 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3233 |
4199 | 3234 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 3235 exchangecount = va_arg(ap, int); |
3236 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
3237 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3238 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3239 "chat info: Chat Rights:\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3240 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3241 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3242 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3243 "chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3244 for (i = 0; i < exchangecount; i++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3245 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3246 "chat info: \t\t%hu %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3247 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
4617 | 3248 while (od->create_rooms) { |
3249 struct create_room *cr = od->create_rooms->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3250 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3251 "creating room %s\n", cr->name); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3252 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3253 g_free(cr->name); |
4617 | 3254 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3255 g_free(cr); |
2086 | 3256 } |
3257 } | |
3258 break; | |
3259 case 0x0008: { | |
3260 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3261 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3262 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3263 fu32_t createtime; |
2086 | 3264 |
3265 fqcn = va_arg(ap, char *); | |
4200 | 3266 instance = (fu16_t)va_arg(ap, unsigned int); |
3267 exchange = (fu16_t)va_arg(ap, unsigned int); | |
3268 flags = (fu16_t)va_arg(ap, unsigned int); | |
3269 createtime = va_arg(ap, fu32_t); | |
3270 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3271 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
3272 createperms = (fu8_t)va_arg(ap, unsigned int); | |
3273 unknown = (fu16_t)va_arg(ap, unsigned int); | |
3274 name = va_arg(ap, char *); | |
3275 ck = va_arg(ap, char *); | |
4194 | 3276 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3277 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3278 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", |
2086 | 3279 fqcn, |
3280 exchange, instance, flags, | |
3281 createtime, | |
3282 maxmsglen, maxoccupancy, createperms, unknown, | |
3283 name, ck); | |
4617 | 3284 aim_chat_join(od->sess, od->conn, exchange, ck, instance); |
2086 | 3285 } |
3286 break; | |
3287 default: | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3288 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3289 "chatnav info: unknown type (%04hx)\n", type); |
2086 | 3290 break; |
3291 } | |
4194 | 3292 |
3293 va_end(ap); | |
3294 | |
2086 | 3295 return 1; |
3296 } | |
3297 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3298 static int gaim_conv_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3299 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3300 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3301 aim_userinfo_t *info; |
5575 | 3302 GaimConnection *g = sess->aux_data; |
2086 | 3303 |
3304 struct chat_connection *c = NULL; | |
3305 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3306 va_start(ap, fr); |
2086 | 3307 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3308 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3309 va_end(ap); |
3310 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3311 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3312 if (!c) |
3313 return 1; | |
3314 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3315 for (i = 0; i < count; i++) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3316 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3317 |
3318 return 1; | |
3319 } | |
3320 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3321 static int gaim_conv_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3322 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3323 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3324 aim_userinfo_t *info; |
5575 | 3325 GaimConnection *g = sess->aux_data; |
2086 | 3326 |
3327 struct chat_connection *c = NULL; | |
3328 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3329 va_start(ap, fr); |
2086 | 3330 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3331 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3332 va_end(ap); |
3333 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3334 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3335 if (!c) |
3336 return 1; | |
3337 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3338 for (i = 0; i < count; i++) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3339 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3340 |
3341 return 1; | |
3342 } | |
3343 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3344 static int gaim_conv_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
|
3345 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3346 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3347 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3348 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3349 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3350 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3351 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3352 fu32_t creationtime; |
5575 | 3353 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3354 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
|
3355 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3356 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3357 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3358 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3359 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3360 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3361 roomdesc = va_arg(ap, char *); |
4200 | 3362 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
3363 creationtime = va_arg(ap, fu32_t); | |
3364 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3365 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
3366 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
3367 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3368 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3369 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3370 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3371 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3372 maxmsglen, maxvisiblemsglen); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3373 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3374 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3375 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3376 |
2086 | 3377 return 1; |
3378 } | |
3379 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3380 static int gaim_conv_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3381 GaimConnection *gc = sess->aux_data; |
2086 | 3382 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3383 aim_userinfo_t *info; |
2086 | 3384 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3385 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
2086 | 3386 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3387 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3388 info = va_arg(ap, aim_userinfo_t *); |
4194 | 3389 msg = va_arg(ap, char *); |
3390 va_end(ap); | |
2086 | 3391 |
4269 | 3392 serv_got_chat_in(gc, ccon->id, info->sn, 0, msg, time((time_t)NULL)); |
2086 | 3393 |
3394 return 1; | |
3395 } | |
3396 | |
3694 | 3397 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
3398 va_list ap; | |
5575 | 3399 GaimConnection *gc = sess->aux_data; |
3694 | 3400 struct aim_emailinfo *emailinfo; |
3725 | 3401 int havenewmail; |
7297 | 3402 char *alertitle, *alerturl; |
3694 | 3403 |
3404 va_start(ap, fr); | |
3405 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 3406 havenewmail = va_arg(ap, int); |
7301 | 3407 alertitle = va_arg(ap, char *); |
3408 alerturl = va_arg(ap, char *); | |
3694 | 3409 va_end(ap); |
3410 | |
5628 | 3411 if (emailinfo && gaim_account_get_check_mail(gc->account)) { |
5575 | 3412 gchar *to = g_strdup_printf("%s@%s", gaim_account_get_username(gaim_connection_get_account(gc)), emailinfo->domain); |
5542 | 3413 if (emailinfo->unread && havenewmail) |
3414 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); | |
5537 | 3415 g_free(to); |
3694 | 3416 } |
7297 | 3417 |
7301 | 3418 if (alertitle) |
7313 | 3419 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); |
3694 | 3420 |
3421 return 1; | |
3422 } | |
3423 | |
4804 | 3424 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3425 GaimConnection *gc = sess->aux_data; |
7283 | 3426 OscarData *od = gc->proto_data; |
4804 | 3427 char *sn; |
3428 | |
3429 sn = od->requesticon->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3430 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3431 "removing %s from hash table\n", sn); |
4804 | 3432 od->requesticon = g_slist_remove(od->requesticon, sn); |
3433 free(sn); | |
3434 | |
3435 if (od->icontimer) | |
3436 g_source_remove(od->icontimer); | |
3437 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
3438 | |
3439 return 1; | |
3440 } | |
3441 | |
3442 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 3443 GaimConnection *gc = sess->aux_data; |
7283 | 3444 OscarData *od = gc->proto_data; |
4804 | 3445 GSList *cur; |
3446 va_list ap; | |
3447 char *sn; | |
4853 | 3448 fu8_t *iconcsum, *icon; |
3449 fu16_t iconcsumlen, iconlen; | |
4804 | 3450 |
3451 va_start(ap, fr); | |
3452 sn = va_arg(ap, char *); | |
4853 | 3453 iconcsum = va_arg(ap, fu8_t *); |
3454 iconcsumlen = va_arg(ap, int); | |
4804 | 3455 icon = va_arg(ap, fu8_t *); |
3456 iconlen = va_arg(ap, int); | |
3457 va_end(ap); | |
3458 | |
4853 | 3459 if (iconlen > 0) { |
3460 char *b16; | |
6695 | 3461 GaimBuddy *b = gaim_find_buddy(gc->account, sn); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3462 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3463 sn, icon, iconlen); |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
3464 b16 = gaim_base16_encode(iconcsum, iconcsumlen); |
5129 | 3465 if (b16) { |
3466 gaim_buddy_set_setting(b, "icon_checksum", b16); | |
3467 gaim_blist_save(); | |
7162 | 3468 g_free(b16); |
5129 | 3469 } |
4853 | 3470 } |
4804 | 3471 |
3472 cur = od->requesticon; | |
3473 while (cur) { | |
3474 char *cursn = cur->data; | |
3475 if (!aim_sncmp(cursn, sn)) { | |
3476 od->requesticon = g_slist_remove(od->requesticon, cursn); | |
3477 free(cursn); | |
3478 cur = od->requesticon; | |
3479 } else | |
3480 cur = cur->next; | |
3481 } | |
3482 | |
3483 if (od->icontimer) | |
3484 g_source_remove(od->icontimer); | |
3485 od->icontimer = g_timeout_add(250, gaim_icon_timerfunc, gc); | |
3486 | |
3487 return 1; | |
3488 } | |
3489 | |
3490 static gboolean gaim_icon_timerfunc(gpointer data) { | |
5575 | 3491 GaimConnection *gc = data; |
7283 | 3492 OscarData *od = gc->proto_data; |
7011 | 3493 aim_userinfo_t *userinfo; |
4804 | 3494 aim_conn_t *conn; |
3495 | |
3496 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | |
5892 | 3497 if (!conn) { |
3498 if (!od->iconconnecting) { | |
3499 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
3500 od->iconconnecting = TRUE; | |
3501 } | |
4804 | 3502 return FALSE; |
3503 } | |
3504 | |
5842 | 3505 if (od->set_icon) { |
6039 | 3506 struct stat st; |
3507 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
3508 if (iconfile == NULL) { | |
3509 /* Set an empty icon, or something */ | |
3510 } else if (!stat(iconfile, &st)) { | |
3511 char *buf = g_malloc(st.st_size); | |
3512 FILE *file = fopen(iconfile, "rb"); | |
3513 if (file) { | |
3514 fread(buf, 1, st.st_size, file); | |
3515 fclose(file); | |
3516 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
3517 "Uploading icon to icon server\n"); | |
6879 | 3518 aim_bart_upload(od->sess, buf, st.st_size); |
5842 | 3519 } else |
3520 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6039 | 3521 "Can't open buddy icon file!\n"); |
3522 g_free(buf); | |
3523 } else { | |
3524 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
3525 "Can't stat buddy icon file!\n"); | |
5842 | 3526 } |
3527 od->set_icon = FALSE; | |
3528 } | |
3529 | |
3530 if (!od->requesticon) { | |
3531 gaim_debug(GAIM_DEBUG_MISC, "oscar", | |
3532 "no more icons to request\n"); | |
3533 return FALSE; | |
3534 } | |
3535 | |
7045 | 3536 userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data); |
7011 | 3537 if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) { |
3538 aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen); | |
4804 | 3539 return FALSE; |
3540 } else { | |
3541 char *sn = od->requesticon->data; | |
3542 od->requesticon = g_slist_remove(od->requesticon, sn); | |
3543 free(sn); | |
3544 } | |
3545 | |
3546 return TRUE; | |
3547 } | |
3548 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3549 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3550 * 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
|
3551 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3552 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3553 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3554 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3555 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3556 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3557 va_start(ap, fr); |
4199 | 3558 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3559 sn = va_arg(ap, char *); |
3560 va_end(ap); | |
3561 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3562 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sent message to %s.\n", sn); |
2086 | 3563 |
3564 return 1; | |
3565 } | |
3566 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3567 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
|
3568 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3569 "invalid", |
4194 | 3570 "change", |
3571 "warning", | |
3572 "limit", | |
3573 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3574 }; |
2086 | 3575 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3576 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3577 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3578 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3579 va_start(ap, fr); |
4200 | 3580 code = (fu16_t)va_arg(ap, unsigned int); |
3581 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
3582 windowsize = va_arg(ap, fu32_t); | |
3583 clear = va_arg(ap, fu32_t); | |
3584 alert = va_arg(ap, fu32_t); | |
3585 limit = va_arg(ap, fu32_t); | |
3586 disconnect = va_arg(ap, fu32_t); | |
3587 currentavg = va_arg(ap, fu32_t); | |
3588 maxavg = va_arg(ap, fu32_t); | |
2086 | 3589 va_end(ap); |
3590 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3591 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3592 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " |
3593 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", | |
2086 | 3594 (code < 5) ? codes[code] : codes[0], |
3595 rateclass, | |
3596 currentavg, maxavg, | |
3597 alert, clear, | |
3598 limit, disconnect, | |
3599 windowsize); | |
3600 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3601 /* XXX fix these values */ |
2086 | 3602 if (code == AIM_RATE_CODE_CHANGE) { |
3603 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3604 aim_conn_setlatency(fr->conn, 0); |
2086 | 3605 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3606 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
3607 } else if (code == AIM_RATE_CODE_LIMIT) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3608 gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."), |
6040 | 3609 _("The last action you attempted could not be " |
3610 "performed because you are over the rate limit. " | |
3611 "Please wait 10 seconds and try again.")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3612 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 3613 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3614 aim_conn_setlatency(fr->conn, 0); |
2086 | 3615 } |
3616 | |
3617 return 1; | |
3618 } | |
3619 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3620 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3621 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3622 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3623 aim_userinfo_t *userinfo; |
5575 | 3624 GaimConnection *gc = sess->aux_data; |
2086 | 3625 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3626 va_start(ap, fr); |
4199 | 3627 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3628 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3629 va_end(ap); |
3630 | |
7111 | 3631 serv_got_eviled(gc, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); |
2086 | 3632 |
3633 return 1; | |
3634 } | |
3635 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3636 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
|
3637 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3638 aim_userinfo_t *info; |
5575 | 3639 GaimConnection *gc = sess->aux_data; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3640 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3641 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3642 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3643 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3644 |
5628 | 3645 gc->evil = (info->warnlevel/10.0) + 0.5; |
4841 | 3646 |
3647 if (info->onlinesince) | |
3648 gc->login_time_official = info->onlinesince; | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3649 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3650 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3651 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3652 |
4649 | 3653 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3654 GaimConnection *gc = sess->aux_data; |
7283 | 3655 OscarData *od = gc->proto_data; |
4649 | 3656 va_list ap; |
3657 fu16_t code; | |
3658 char *msg; | |
3659 | |
3660 va_start(ap, fr); | |
3661 code = (fu16_t)va_arg(ap, int); | |
3662 msg = va_arg(ap, char *); | |
3663 va_end(ap); | |
3664 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3665 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3666 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); |
4649 | 3667 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { |
4651 | 3668 if (code == 0x0001) { |
6113 | 3669 gc->wants_to_die = TRUE; |
5579 | 3670 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); |
4651 | 3671 } else { |
5579 | 3672 gaim_connection_error(gc, _("You have been signed off for an unknown reason.")); |
4651 | 3673 } |
4666 | 3674 od->killme = TRUE; |
4649 | 3675 } |
3676 | |
3677 return 1; | |
3678 } | |
3679 | |
2675 | 3680 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
7283 | 3681 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3682 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3683 aim_reqpersonalinfo(sess, fr->conn); |
4230 | 3684 |
3685 #ifndef NOSSI | |
7334 | 3686 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting rights and list\n"); |
4889 | 3687 aim_ssi_reqrights(sess); |
6350 | 3688 aim_ssi_reqdata(sess); |
4230 | 3689 #endif |
3690 | |
7011 | 3691 aim_locate_reqrights(sess); |
7285 | 3692 aim_buddylist_reqrights(sess, fr->conn); |
4617 | 3693 aim_im_reqparams(sess); |
7334 | 3694 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */ |
4230 | 3695 |
3696 #ifdef NOSSI | |
7334 | 3697 gaim_debug(GAIM_DEBUG_INFO, "oscar", "bos: requesting rights\n"); |
3698 aim_bos_reqrights(sess, fr->conn); | |
4230 | 3699 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
3700 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
3701 #endif | |
2086 | 3702 |
7283 | 3703 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); |
3704 | |
2086 | 3705 return 1; |
3706 } | |
3707 | |
2675 | 3708 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3709 GaimConnection *gc = sess->aux_data; |
7283 | 3710 OscarData *od = gc->proto_data; |
2647 | 3711 |
6905 | 3712 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); |
3713 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); | |
3714 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); | |
3715 | |
2672 | 3716 aim_clientready(sess, fr->conn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3717 gaim_debug(GAIM_DEBUG_INFO, "oscar", "connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3718 |
2647 | 3719 if (od->chpass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3720 gaim_debug(GAIM_DEBUG_INFO, "oscar", "changing password\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3721 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 3722 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3723 od->oldp = NULL; |
2647 | 3724 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3725 od->newp = NULL; |
2647 | 3726 od->chpass = FALSE; |
3727 } | |
2979 | 3728 if (od->setnick) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3729 gaim_debug(GAIM_DEBUG_INFO, "oscar", "formatting screenname\n"); |
2979 | 3730 aim_admin_setnick(sess, fr->conn, od->newsn); |
3731 g_free(od->newsn); | |
3732 od->newsn = NULL; | |
3733 od->setnick = FALSE; | |
3734 } | |
2647 | 3735 if (od->conf) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3736 gaim_debug(GAIM_DEBUG_INFO, "oscar", "confirming account\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3737 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 3738 od->conf = FALSE; |
3739 } | |
3740 if (od->reqemail) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3741 gaim_debug(GAIM_DEBUG_INFO, "oscar", "requesting email\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3742 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 3743 od->reqemail = FALSE; |
3744 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3745 if (od->setemail) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3746 gaim_debug(GAIM_DEBUG_INFO, "oscar", "setting email\n"); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3747 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3748 g_free(od->email); |
5497 | 3749 od->email = NULL; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3750 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3751 } |
2647 | 3752 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3753 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3754 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3755 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3756 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
|
3757 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3758 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3759 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3760 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3761 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3762 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3763 |
4194 | 3764 /* 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
|
3765 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " |
5556 | 3766 "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
|
3767 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3768 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3769 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
3770 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3771 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3772 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 3773 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3774 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3775 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3776 |
4617 | 3777 aim_im_setparams(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3778 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3779 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3780 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3781 |
2993 | 3782 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3783 { | |
5575 | 3784 GaimConnection *gc = sess->aux_data; |
7283 | 3785 OscarData *od = (OscarData *)gc->proto_data; |
5306 | 3786 va_list ap; |
3787 fu16_t maxsiglen; | |
2993 | 3788 |
3789 va_start(ap, fr); | |
4199 | 3790 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 3791 va_end(ap); |
3792 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3793 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3794 "locate rights: max sig len = %d\n", maxsiglen); |
2993 | 3795 |
4617 | 3796 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; |
3797 | |
3798 if (od->icq) | |
7334 | 3799 aim_locate_setcaps(od->sess, caps_icq); |
5301 | 3800 else |
7334 | 3801 aim_locate_setcaps(od->sess, caps_aim); |
3802 oscar_set_info(gc, gc->account->user_info); | |
2993 | 3803 |
3804 return 1; | |
3805 } | |
3806 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3807 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
|
3808 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3809 fu16_t maxbuddies, maxwatchers; |
5575 | 3810 GaimConnection *gc = sess->aux_data; |
7283 | 3811 OscarData *od = (OscarData *)gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3812 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3813 va_start(ap, fr); |
4199 | 3814 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3815 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3816 va_end(ap); |
3817 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3818 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3819 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 3820 |
4617 | 3821 od->rights.maxbuddies = (guint)maxbuddies; |
3822 od->rights.maxwatchers = (guint)maxwatchers; | |
2993 | 3823 |
2086 | 3824 return 1; |
3825 } | |
3826 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3827 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3828 GaimConnection *gc = sess->aux_data; |
7283 | 3829 OscarData *od = (OscarData *)gc->proto_data; |
7334 | 3830 va_list ap; |
3831 fu16_t maxpermits, maxdenies; | |
2086 | 3832 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3833 va_start(ap, fr); |
4199 | 3834 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3835 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3836 va_end(ap); |
3837 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3838 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3839 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 3840 |
4617 | 3841 od->rights.maxpermits = (guint)maxpermits; |
3842 od->rights.maxdenies = (guint)maxdenies; | |
2993 | 3843 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
3844 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2993 | 3845 serv_finish_login(gc); |
3846 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3847 gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n"); |
2993 | 3848 |
2672 | 3849 aim_clientready(sess, fr->conn); |
5948 | 3850 aim_srv_setavailmsg(sess, NULL); |
7474 | 3851 aim_srv_setidle(sess, 0); |
4617 | 3852 |
4664 | 3853 if (od->icq) { |
3854 aim_icq_reqofflinemsgs(sess); | |
3855 aim_icq_hideip(sess); | |
3856 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3857 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3858 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 3859 if (sess->authinfo->email) |
3860 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 3861 |
3862 return 1; | |
3863 } | |
3864 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3865 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
|
3866 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3867 struct aim_icq_offlinemsg *msg; |
4075 | 3868 struct aim_incomingim_ch4_args args; |
3869 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3870 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3871 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3872 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3873 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3874 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3875 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3876 "Received offline message. Converting to channel 4 ICBM...\n"); |
4075 | 3877 args.uin = msg->sender; |
3878 args.type = msg->type; | |
4173 | 3879 args.flags = msg->flags; |
4076 | 3880 args.msglen = msg->msglen; |
4075 | 3881 args.msg = msg->msg; |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3882 t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); |
4075 | 3883 incomingim_chan4(sess, fr->conn, NULL, &args, t); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3884 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3885 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3886 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3887 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3888 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
|
3889 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3890 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3891 return 1; |
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 |
7388 | 3894 #if 0 |
3895 /* | |
7465 | 3896 * Update, 2003-11-09: |
3897 * Joseph S. Myers, a gcc dude, fixed this for gcc 3.4! Rock on! | |
3898 * | |
7388 | 3899 * It may not be my place to do this, but... |
3900 * I feel pretty strongly that the "last 2 digits" warning is ridiculously | |
3901 * stupid, and should not exist for % switches (%x in our case) that request | |
3902 * a year in the preferred representation for the current locale. For that | |
3903 * reason I've chosen to not use this workaround (n., see kluge). | |
3904 * | |
3905 * I have a date. I want to show it to the user in the "preferred" way. | |
3906 * Whether that displays a 2 digit year is perfectly fine--after all, it's | |
3907 * what the locale wanted. | |
3908 * | |
3909 * If I have a necessity for a full representation of the year in the current | |
3910 * locale, then I'll use a switch that returns a full representation of the | |
3911 * year. | |
3912 * | |
3913 * If you think the preferred locale should show 4 digits instead of 2 digits | |
3914 * (because you're anal, or whatever), then change the f***ing locale. | |
3915 * | |
3916 * I guess the bottom line is--I'm trying to show a date to the user how they | |
3917 * prefer to see it, why the hell does gcc want me to change that? | |
7389 | 3918 * |
3919 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3190 | |
3920 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8714 | |
7388 | 3921 */ |
3922 | |
3923 /* | |
3924 * This function was recommended by the STRFTIME(3) man page to remove the | |
7386 | 3925 * "last 2 digits" warning. |
3926 */ | |
3927 static size_t my_strftime(char *s, size_t max, const char *fmt, | |
3928 const struct tm *tm) | |
3929 { | |
3930 return strftime(s, max, fmt, tm); | |
3931 } | |
7388 | 3932 #endif |
7386 | 3933 |
4624 | 3934 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
|
3935 { |
5575 | 3936 GaimConnection *gc = sess->aux_data; |
4819 | 3937 gchar *buf, *tmp, *utf8; |
4624 | 3938 gchar who[16]; |
6873 | 3939 GaimBuddy *buddy; |
3940 gchar *primary; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3941 va_list ap; |
4151 | 3942 struct aim_icq_info *info; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3943 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3944 va_start(ap, fr); |
4151 | 3945 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3946 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3947 |
4664 | 3948 if (!info->uin) |
3949 return 0; | |
3950 | |
5556 | 3951 g_snprintf(who, sizeof(who), "%u", info->uin); |
6623 | 3952 buf = g_strdup_printf("<b>%s:</b> %s", _("UIN"), who); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3953 if (info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { |
6623 | 3954 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Nick"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 3955 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3956 if (info->first && info->first[0] && (utf8 = gaim_utf8_try_convert(info->first))) { |
6623 | 3957 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("First Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 3958 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3959 if (info->last && info->last[0] && (utf8 = gaim_utf8_try_convert(info->last))) { |
6623 | 3960 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Last Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 3961 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3962 if (info->email && info->email[0] && (utf8 = gaim_utf8_try_convert(info->email))) { |
6623 | 3963 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 | 3964 } |
3965 if (info->numaddresses && info->email2) { | |
3966 int i; | |
3967 for (i = 0; i < info->numaddresses; i++) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3968 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_utf8_try_convert(info->email2[i]))) { |
6623 | 3969 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 | 3970 } |
4625 | 3971 } |
4624 | 3972 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3973 if (info->mobile && info->mobile[0] && (utf8 = gaim_utf8_try_convert(info->mobile))) { |
6623 | 3974 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Mobile Phone"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4625 | 3975 } |
3976 if (info->gender) { | |
6623 | 3977 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Gender"), ":</b> ", info->gender==1 ? _("Female") : _("Male"), NULL); g_free(tmp); |
4151 | 3978 } |
4624 | 3979 if (info->birthyear || info->birthmonth || info->birthday) { |
4627 | 3980 char date[30]; |
3981 struct tm tm; | |
3982 tm.tm_mday = (int)info->birthday; | |
3983 tm.tm_mon = (int)info->birthmonth-1; | |
3984 tm.tm_year = (int)info->birthyear-1900; | |
7388 | 3985 strftime(date, sizeof(date), "%x", &tm); |
6623 | 3986 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Birthday"), ":</b> ", date, NULL); g_free(tmp); |
4151 | 3987 } |
4624 | 3988 if (info->age) { |
3989 char age[5]; | |
3990 snprintf(age, sizeof(age), "%hhd", info->age); | |
6623 | 3991 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Age"), ":</b> ", age, NULL); g_free(tmp); |
4819 | 3992 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3993 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_utf8_try_convert(info->personalwebpage))) { |
6623 | 3994 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Personal Web Page"), ":</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); |
4819 | 3995 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3996 if (info->info && info->info[0] && (utf8 = gaim_utf8_try_convert(info->info))) { |
6623 | 3997 tmp = buf; buf = g_strconcat(tmp, "<hr><b>", _("Additional Information"), ":</b><br>", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3998 } |
3999 tmp = buf; buf = g_strconcat(tmp, "<hr>\n", NULL); g_free(tmp); | |
4641 | 4000 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
6623 | 4001 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Home Address"), ":</b>", NULL); g_free(tmp); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4002 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_utf8_try_convert(info->homeaddr))) { |
6623 | 4003 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4004 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4005 if (info->homecity && info->homecity[0] && (utf8 = gaim_utf8_try_convert(info->homecity))) { |
6623 | 4006 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4007 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4008 if (info->homestate && info->homestate[0] && (utf8 = gaim_utf8_try_convert(info->homestate))) { |
6623 | 4009 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4010 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4011 if (info->homezip && info->homezip[0] && (utf8 = gaim_utf8_try_convert(info->homezip))) { |
6623 | 4012 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4013 } |
4014 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 4015 } |
4641 | 4016 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
6623 | 4017 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Address"), ":</b>", NULL); g_free(tmp); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4018 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_utf8_try_convert(info->workaddr))) { |
6623 | 4019 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4020 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4021 if (info->workcity && info->workcity[0] && (utf8 = gaim_utf8_try_convert(info->workcity))) { |
6623 | 4022 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4023 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4024 if (info->workstate && info->workstate[0] && (utf8 = gaim_utf8_try_convert(info->workstate))) { |
6623 | 4025 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4026 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4027 if (info->workzip && info->workzip[0] && (utf8 = gaim_utf8_try_convert(info->workzip))) { |
6623 | 4028 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4029 } |
4030 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4031 } | |
4641 | 4032 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
6623 | 4033 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Information"), ":</b>", NULL); g_free(tmp); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4034 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_utf8_try_convert(info->workcompany))) { |
6623 | 4035 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Company"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4036 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4037 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_utf8_try_convert(info->workdivision))) { |
6623 | 4038 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Division"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4039 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4040 if (info->workposition && info->workposition[0] && (utf8 = gaim_utf8_try_convert(info->workposition))) { |
6623 | 4041 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Position"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4042 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4043 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_utf8_try_convert(info->workwebpage))) { |
6623 | 4044 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 | 4045 } |
4046 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 4047 } |
4048 | |
6873 | 4049 buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); |
4050 primary = g_strdup_printf(_("ICQ Info for %s"), gaim_get_buddy_alias(buddy)); | |
4051 gaim_notify_formatted(gc, NULL, primary, NULL, buf, NULL, NULL); | |
4052 g_free(primary); | |
4151 | 4053 g_free(buf); |
4054 | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4055 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4056 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4057 |
4759 | 4058 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
4059 { | |
5575 | 4060 GaimConnection *gc = sess->aux_data; |
4820 | 4061 gchar who[16], *utf8; |
6695 | 4062 GaimBuddy *b; |
4759 | 4063 va_list ap; |
4064 struct aim_icq_info *info; | |
4065 | |
4066 va_start(ap, fr); | |
4067 info = va_arg(ap, struct aim_icq_info *); | |
4068 va_end(ap); | |
4069 | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4070 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { |
5556 | 4071 g_snprintf(who, sizeof(who), "%u", info->uin); |
4820 | 4072 serv_got_alias(gc, who, utf8); |
4759 | 4073 if ((b = gaim_find_buddy(gc->account, who))) { |
4820 | 4074 gaim_buddy_set_setting(b, "servernick", utf8); |
4759 | 4075 gaim_blist_save(); |
4076 } | |
4820 | 4077 g_free(utf8); |
4759 | 4078 } |
4079 | |
4080 return 1; | |
4081 } | |
4082 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4083 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4084 { |
7032 | 4085 GaimConnection *gc = sess->aux_data; |
4086 gchar *text; | |
4087 va_list ap; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4088 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4089 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4090 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4091 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4092 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4093 url = va_arg(ap, char *); |
4199 | 4094 wid = (fu16_t) va_arg(ap, int); |
4095 hei = (fu16_t) va_arg(ap, int); | |
4096 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4097 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4098 |
7032 | 4099 text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url); |
4100 gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); | |
4101 g_free(text); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4102 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4103 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4104 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4105 |
7032 | 4106 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) |
4107 { | |
6873 | 4108 GaimConnection *gc = sess->aux_data; |
4109 gchar *secondary; | |
4110 GString *text; | |
4111 int i, num; | |
2086 | 4112 va_list ap; |
6873 | 4113 char *email, *SNs; |
2086 | 4114 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4115 va_start(ap, fr); |
6873 | 4116 email = va_arg(ap, char *); |
2086 | 4117 num = va_arg(ap, int); |
4118 SNs = va_arg(ap, char *); | |
4119 va_end(ap); | |
4120 | |
6873 | 4121 secondary = g_strdup_printf(_("The following screennames are associated with %s"), email); |
4122 text = g_string_new(""); | |
2086 | 4123 for (i = 0; i < num; i++) |
6873 | 4124 g_string_append_printf(text, "%s<br>", &SNs[i * (MAXSNLEN + 1)]); |
4125 gaim_notify_formatted(gc, NULL, _("Search Results"), secondary, text->str, NULL, NULL); | |
4126 | |
4127 g_free(secondary); | |
4128 g_string_free(text, TRUE); | |
2086 | 4129 |
4130 return 1; | |
4131 } | |
4132 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4133 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4134 va_list ap; |
6873 | 4135 char *email; |
5420 | 4136 char *buf; |
2086 | 4137 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4138 va_start(ap, fr); |
6873 | 4139 email = va_arg(ap, char *); |
2086 | 4140 va_end(ap); |
4141 | |
6873 | 4142 buf = g_strdup_printf(_("No results found for email address %s"), email); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4143 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 4144 g_free(buf); |
2086 | 4145 |
4146 return 1; | |
4147 } | |
4148 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4149 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
6873 | 4150 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4151 fu16_t status; |
2086 | 4152 va_list ap; |
4153 char msg[256]; | |
4154 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4155 va_start(ap, fr); |
4199 | 4156 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 4157 va_end(ap); |
4158 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4159 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4160 "account confirmation returned status 0x%04x (%s)\n", status, |
3912 | 4161 status ? "unknown" : "email sent"); |
4162 if (!status) { | |
5302 | 4163 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
5575 | 4164 gaim_account_get_username(gaim_connection_get_account(gc))); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4165 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
2086 | 4166 } |
4167 | |
4168 return 1; | |
4169 } | |
4170 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4171 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4172 GaimConnection *gc = sess->aux_data; |
2086 | 4173 va_list ap; |
3912 | 4174 fu16_t perms, err; |
4175 char *url, *sn, *email; | |
4176 int change; | |
2086 | 4177 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4178 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4179 change = va_arg(ap, int); |
4199 | 4180 perms = (fu16_t) va_arg(ap, unsigned int); |
4181 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 4182 url = va_arg(ap, char *); |
4183 sn = va_arg(ap, char *); | |
4184 email = va_arg(ap, char *); | |
2086 | 4185 va_end(ap); |
4186 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4187 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4188 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
3912 | 4189 change ? "change" : "request", perms, err, url, sn, email); |
4190 | |
4191 if (err && url) { | |
4192 char *dialog_msg; | |
4193 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
4194 switch (err) { | |
4195 case 0x0001: { | |
4196 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
4197 } break; | |
4198 case 0x0006: { | |
4199 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
4200 } break; | |
4201 case 0x000b: { | |
4202 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
4203 } break; | |
4204 case 0x001d: { | |
4205 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); | |
4206 } break; | |
4207 case 0x0021: { | |
4208 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); | |
4209 } break; | |
4210 case 0x0023: { | |
4211 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
4212 } break; | |
4213 default: { | |
4214 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
4215 } break; | |
4216 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4217 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); |
3912 | 4218 g_free(dialog_top); |
4219 g_free(dialog_msg); | |
4220 return 1; | |
4221 } | |
4222 | |
4223 if (sn) { | |
4585 | 4224 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
|
4225 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4226 g_free(dialog_msg); |
4227 } | |
4228 | |
4229 if (email) { | |
5575 | 4230 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), |
4231 gaim_account_get_username(gaim_connection_get_account(gc)), email); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4232 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4233 g_free(dialog_msg); |
2086 | 4234 } |
4235 | |
4236 return 1; | |
4237 } | |
4238 | |
5575 | 4239 static void oscar_keepalive(GaimConnection *gc) { |
7283 | 4240 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4241 aim_flap_nop(od->sess, od->conn); |
2086 | 4242 } |
4243 | |
6059 | 4244 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { |
7283 | 4245 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4246 struct direct_im *dim = find_direct_im(od, name); |
3595 | 4247 if (dim) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4248 if (typing == GAIM_TYPING) |
4870 | 4249 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4250 else if (typing == GAIM_TYPED) |
4870 | 4251 aim_odc_send_typing(od->sess, dim->conn, 0x0001); |
4252 else | |
4253 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
3595 | 4254 else { |
5300 | 4255 /* Don't send if this turkey is in our deny list */ |
4256 GSList *list; | |
4257 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); | |
4258 if (!list) { | |
7261 | 4259 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
5300 | 4260 if (bi && bi->typingnot) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4261 if (typing == GAIM_TYPING) |
5300 | 4262 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4263 else if (typing == GAIM_TYPED) |
5300 | 4264 aim_im_sendmtn(od->sess, 0x0001, name, 0x0001); |
4265 else | |
4266 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); | |
4267 } | |
3595 | 4268 } |
4269 } | |
2993 | 4270 return 0; |
4271 } | |
5575 | 4272 static void oscar_ask_direct_im(GaimConnection *gc, const char *name); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4273 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4274 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4275 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { |
7283 | 4276 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4277 struct direct_im *dim = find_direct_im(od, name); |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4278 int ret = 0; |
3659 | 4279 GError *err = NULL; |
5575 | 4280 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
4281 char *tmpmsg = NULL; |
3458 | 4282 |
4838 | 4283 if (dim && dim->connected) { |
4284 /* If we're directly connected, send a direct IM */ | |
6982 | 4285 ret = gaim_odc_send_im(od->sess, dim->conn, message, imflags); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4286 } else if (imflags & GAIM_CONV_IM_IMAGES) { |
3044 | 4287 /* Trying to send an IM image outside of a direct connection. */ |
4288 oscar_ask_direct_im(gc, name); | |
4838 | 4289 ret = -ENOTCONN; |
2086 | 4290 } else { |
4738 | 4291 struct buddyinfo *bi; |
3008 | 4292 struct aim_sendimext_args args; |
4293 struct stat st; | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4294 gsize len; |
4269 | 4295 |
7261 | 4296 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
4738 | 4297 if (!bi) { |
4298 bi = g_new0(struct buddyinfo, 1); | |
7261 | 4299 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi); |
4738 | 4300 } |
4301 | |
3008 | 4302 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
4665 | 4303 if (od->icq) { |
4304 args.features = features_icq; | |
4305 args.featureslen = sizeof(features_icq); | |
3008 | 4306 args.flags |= AIM_IMFLAGS_OFFLINE; |
4665 | 4307 } else { |
4308 args.features = features_aim; | |
4309 args.featureslen = sizeof(features_aim); | |
4972 | 4310 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4311 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
4972 | 4312 args.flags |= AIM_IMFLAGS_AWAY; |
4665 | 4313 } |
4269 | 4314 |
4738 | 4315 if (bi->ico_need) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4316 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4317 "Sending buddy icon request with message\n"); |
3008 | 4318 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4738 | 4319 bi->ico_need = FALSE; |
3008 | 4320 } |
4269 | 4321 |
5575 | 4322 if (iconfile && !stat(iconfile, &st)) { |
4323 FILE *file = fopen(iconfile, "r"); | |
3008 | 4324 if (file) { |
4325 char *buf = g_malloc(st.st_size); | |
4326 fread(buf, 1, st.st_size, file); | |
6039 | 4327 fclose(file); |
4269 | 4328 |
3008 | 4329 args.iconlen = st.st_size; |
4617 | 4330 args.iconsum = aimutil_iconsum(buf, st.st_size); |
3008 | 4331 args.iconstamp = st.st_mtime; |
4332 | |
7406 | 4333 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { |
4738 | 4334 bi->ico_informed = FALSE; |
7406 | 4335 bi->ico_sent = FALSE; |
4336 } | |
4738 | 4337 |
4338 if (!bi->ico_informed) { | |
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 "Claiming to have a buddy icon\n"); |
4738 | 4341 args.flags |= AIM_IMFLAGS_HASICON; |
4342 bi->ico_me_len = args.iconlen; | |
4343 bi->ico_me_csum = args.iconsum; | |
4344 bi->ico_me_time = args.iconstamp; | |
4345 bi->ico_informed = TRUE; | |
4346 } | |
4347 | |
3008 | 4348 g_free(buf); |
2086 | 4349 } |
4350 } | |
4269 | 4351 |
3008 | 4352 args.destsn = name; |
4269 | 4353 |
6310 | 4354 /* For ICQ send newlines as CR/LF, for AIM send newlines as <BR> */ |
4355 if (isdigit(name[0])) | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4356 tmpmsg = gaim_str_add_cr(message); |
6310 | 4357 else |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4358 tmpmsg = gaim_strdup_withhtml(message); |
6310 | 4359 len = strlen(tmpmsg); |
4360 | |
4361 args.flags |= oscar_encoding_check(tmpmsg); | |
3642 | 4362 if (args.flags & AIM_IMFLAGS_UNICODE) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4363 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode IM\n"); |
4662 | 4364 args.charset = 0x0002; |
4665 | 4365 args.charsubset = 0x0000; |
6310 | 4366 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
3659 | 4367 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4368 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4369 "Error converting a unicode message: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4370 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4371 "This really shouldn't happen!\n"); |
3659 | 4372 /* We really shouldn't try to send the |
4373 * IM now, but I'm not sure what to do */ | |
4800 | 4374 g_error_free(err); |
3659 | 4375 } |
3850 | 4376 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4377 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4378 "Sending ISO-8859-1 IM\n"); |
4662 | 4379 args.charset = 0x0003; |
4665 | 4380 args.charsubset = 0x0000; |
6310 | 4381 args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
3659 | 4382 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4383 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4384 "conversion error: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4385 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4386 "Someone tell Ethan his 8859-1 detection is wrong\n"); |
3642 | 4387 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
6310 | 4388 len = strlen(tmpmsg); |
4800 | 4389 g_error_free(err); |
6310 | 4390 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
3659 | 4391 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4392 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4393 "Error in unicode fallback: %s\n", err->message); |
4800 | 4394 g_error_free(err); |
3659 | 4395 } |
3642 | 4396 } |
4397 } else { | |
4662 | 4398 args.charset = 0x0000; |
4399 args.charsubset = 0x0000; | |
6310 | 4400 args.msg = tmpmsg; |
3642 | 4401 } |
4402 args.msglen = len; | |
4269 | 4403 |
4617 | 4404 ret = aim_im_sendch1_ext(od->sess, &args); |
2086 | 4405 } |
4838 | 4406 |
6310 | 4407 g_free(tmpmsg); |
4408 | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4409 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4410 return 1; |
6310 | 4411 |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4412 return ret; |
2086 | 4413 } |
4414 | |
7011 | 4415 static void oscar_get_info(GaimConnection *gc, const char *name) { |
7283 | 4416 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 4417 |
7173 | 4418 if (od->icq && isdigit(name[0])) |
4624 | 4419 aim_icq_getallinfo(od->sess, name); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4420 else |
7235 | 4421 aim_locate_getinfoshort(od->sess, name, 0x00000003); |
7011 | 4422 } |
4423 | |
4424 static void oscar_get_away(GaimConnection *gc, const char *who) { | |
7283 | 4425 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4426 if (od->icq) { |
7011 | 4427 GaimBuddy *budlight = gaim_find_buddy(gc->account, who); |
3212 | 4428 if (budlight) |
3595 | 4429 if ((budlight->uc & 0xffff0000) >> 16) |
4687 | 4430 aim_im_sendch2_geticqaway(od->sess, who, (budlight->uc & 0xffff0000) >> 16); |
3212 | 4431 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4432 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4433 "Error: The user %s has no status message, therefore not requesting.\n", who); |
3212 | 4434 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4435 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
7023 | 4436 "Error: Could not find %s in local buddy list, therefore unable to request status message.\n", who); |
3212 | 4437 } else |
7011 | 4438 aim_locate_getinfoshort(od->sess, who, 0x00000002); |
4439 } | |
4440 | |
4441 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, | |
3466 | 4442 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4617 | 4443 /* XXX - some of these things are wrong, but i'm lazy */ |
7283 | 4444 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 4445 aim_locate_setdirinfo(od->sess, first, middle, last, |
2086 | 4446 maiden, NULL, NULL, city, state, NULL, 0, web); |
4447 } | |
4448 | |
5575 | 4449 static void oscar_set_idle(GaimConnection *gc, int time) { |
7283 | 4450 OscarData *od = (OscarData *)gc->proto_data; |
7474 | 4451 aim_srv_setidle(od->sess, time); |
2086 | 4452 } |
4453 | |
5954 | 4454 static void oscar_set_info(GaimConnection *gc, const char *text) { |
7283 | 4455 OscarData *od = (OscarData *)gc->proto_data; |
5129 | 4456 fu32_t flags = 0; |
6019 | 4457 char *text_html = NULL; |
5129 | 4458 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4459 gsize msglen = 0; |
2993 | 4460 |
4617 | 4461 if (od->rights.maxsiglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4462 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4463 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4464 "profile before the login procedure completed. " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4465 "Your profile remains unset; try setting it " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4466 "again when you are fully connected.")); |
4617 | 4467 |
7334 | 4468 if (!text) { |
4469 aim_locate_setprofile(od->sess, NULL, "", 0, NULL, NULL, 0); | |
4470 return; | |
4471 } | |
6019 | 4472 |
7334 | 4473 text_html = gaim_strdup_withhtml(text); |
4474 flags = oscar_encoding_check(text_html); | |
4475 if (flags & AIM_IMFLAGS_UNICODE) { | |
4476 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
4477 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4478 g_free(msg); | |
4479 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
4480 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
4481 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4482 g_free(msg); | |
4483 } else { | |
4484 msglen = strlen(text_html); | |
4485 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4486 } | |
4487 | |
4488 if (msglen > od->rights.maxsiglen) { | |
4489 gchar *errstr; | |
4490 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " | |
4491 "has been exceeded. Gaim has truncated it for you.", | |
4492 "The maximum profile length of %d bytes " | |
4493 "has been exceeded. Gaim has truncated it for you.", | |
4494 od->rights.maxsiglen), od->rights.maxsiglen); | |
4495 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); | |
4496 g_free(errstr); | |
4497 } | |
4498 | |
4499 g_free(text_html); | |
2993 | 4500 |
4501 return; | |
2086 | 4502 } |
4503 | |
7283 | 4504 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *text) |
2993 | 4505 { |
5129 | 4506 fu32_t flags = 0; |
6019 | 4507 gchar *text_html = NULL; |
5129 | 4508 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4509 gsize msglen = 0; |
2993 | 4510 |
4511 if (od->rights.maxawaymsglen == 0) | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4512 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4513 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4514 "away message before the login procedure " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4515 "completed. You remain in a \"present\" " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4516 "state; try setting it again when you are " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4517 "fully connected.")); |
5129 | 4518 |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4519 if (gc->away) { |
2993 | 4520 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4521 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4522 } |
2993 | 4523 |
5129 | 4524 if (!text) { |
7334 | 4525 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4526 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4527 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4528 |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4529 text_html = gaim_strdup_withhtml(text); |
6019 | 4530 flags = oscar_encoding_check(text_html); |
5129 | 4531 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 4532 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
7011 | 4533 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, |
7334 | 4534 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 4535 g_free(msg); |
4536 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
4537 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 4538 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
7011 | 4539 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, |
7334 | 4540 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 4541 g_free(msg); |
6019 | 4542 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4543 } else { |
6019 | 4544 msglen = strlen(text_html); |
7011 | 4545 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, |
7334 | 4546 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
6019 | 4547 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4548 } |
4549 | |
4550 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 4551 gchar *errstr; |
4552 | |
6308 | 4553 errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " |
4554 "has been exceeded. Gaim has truncated it for you.", | |
4555 "The maximum away message length of %d bytes " | |
4556 "has been exceeded. Gaim has truncated it for you.", | |
4557 od->rights.maxawaymsglen), od->rights.maxawaymsglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4558 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); |
2993 | 4559 g_free(errstr); |
4560 } | |
6019 | 4561 |
4562 g_free(text_html); | |
2993 | 4563 return; |
4564 } | |
4565 | |
7283 | 4566 static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message) |
2993 | 4567 { |
5575 | 4568 GaimAccount *account = gaim_connection_get_account(gc); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4569 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4570 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4571 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4572 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4573 |
4342 | 4574 if (strcmp(state, _("Invisible"))) { |
5575 | 4575 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
4576 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); | |
4577 account->perm_deny = 4; | |
4342 | 4578 } else { |
5542 | 4579 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)) |
4889 | 4580 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); |
5575 | 4581 account->perm_deny = 3; |
4342 | 4582 } |
4583 | |
4584 if (!strcmp(state, _("Online"))) | |
4901 | 4585 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 4586 else if (!strcmp(state, _("Away"))) { |
4901 | 4587 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4588 gc->away = g_strdup(""); |
4342 | 4589 } else if (!strcmp(state, _("Do Not Disturb"))) { |
4901 | 4590 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
|
4591 gc->away = g_strdup(""); |
4342 | 4592 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 4593 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
|
4594 gc->away = g_strdup(""); |
4342 | 4595 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 4596 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
|
4597 gc->away = g_strdup(""); |
4342 | 4598 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 4599 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4600 gc->away = g_strdup(""); |
4342 | 4601 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 4602 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4603 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4604 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 4605 if (message) { |
4901 | 4606 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
|
4607 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4608 } else { |
4901 | 4609 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4610 } |
2086 | 4611 } |
2993 | 4612 |
4613 return; | |
4614 } | |
4615 | |
6059 | 4616 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) |
2993 | 4617 { |
7283 | 4618 OscarData *od = (OscarData *)gc->proto_data; |
2993 | 4619 |
4620 if (od->icq) | |
4621 oscar_set_away_icq(gc, od, state, message); | |
4622 else | |
4623 oscar_set_away_aim(gc, od, message); | |
4624 | |
4625 return; | |
2086 | 4626 } |
4627 | |
6059 | 4628 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { |
7283 | 4629 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4630 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); |
2086 | 4631 } |
4632 | |
5575 | 4633 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, |
3466 | 4634 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
7283 | 4635 OscarData *od = (OscarData *)gc->proto_data; |
2086 | 4636 if (strlen(email)) |
6879 | 4637 aim_search_address(od->sess, od->conn, email); |
2086 | 4638 } |
4639 | |
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4640 static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { |
7283 | 4641 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4642 #ifdef NOSSI |
4643 aim_add_buddy(od->sess, od->conn, name); | |
4644 #else | |
4645 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | |
6695 | 4646 GaimBuddy *buddy = gaim_find_buddy(gc->account, name); |
4647 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4230 | 4648 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4649 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4650 "ssi: adding buddy %s to group %s\n", name, group->name); |
4889 | 4651 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4652 } |
4653 } | |
4654 #endif | |
4759 | 4655 if (od->icq) |
4656 aim_icq_getalias(od->sess, name); | |
4230 | 4657 } |
4658 | |
5575 | 4659 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
7283 | 4660 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4661 #ifdef NOSSI |
4662 char buf[MSG_LEN]; | |
4663 int n=0; | |
4664 while (buddies) { | |
4665 if (n > MSG_LEN - 18) { | |
7285 | 4666 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 4667 n = 0; |
3092 | 4668 } |
4230 | 4669 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); |
4670 buddies = buddies->next; | |
4671 } | |
7285 | 4672 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 4673 #else |
4674 if (od->sess->ssi.received_data) { | |
4675 while (buddies) { | |
7334 | 4676 oscar_add_buddy(gc, (const char *)buddies->data, NULL); |
4230 | 4677 buddies = buddies->next; |
4678 } | |
4679 } | |
4680 #endif | |
4681 } | |
4682 | |
6059 | 4683 static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { |
7283 | 4684 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4685 #ifdef NOSSI |
4686 aim_remove_buddy(od->sess, od->conn, name); | |
4687 #else | |
4688 if (od->sess->ssi.received_data) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4689 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4690 "ssi: deleting buddy %s from group %s\n", name, group); |
4889 | 4691 aim_ssi_delbuddy(od->sess, name, group); |
4230 | 4692 } |
4693 #endif | |
4694 } | |
4695 | |
5575 | 4696 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
7283 | 4697 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4698 #ifdef NOSSI |
4699 GList *cur; | |
4700 for (cur=buddies; cur; cur=cur->next) | |
4701 aim_remove_buddy(od->sess, od->conn, cur->data); | |
4702 #else | |
4703 if (od->sess->ssi.received_data) { | |
3092 | 4704 while (buddies) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4705 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4706 "ssi: deleting buddy %s from group %s\n", (char *)buddies->data, group); |
4889 | 4707 aim_ssi_delbuddy(od->sess, buddies->data, group); |
3092 | 4708 buddies = buddies->next; |
4709 } | |
4230 | 4710 } |
4711 #endif | |
4712 } | |
4713 | |
4714 #ifndef NOSSI | |
5575 | 4715 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
7283 | 4716 OscarData *od = (OscarData *)gc->proto_data; |
4303 | 4717 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
|
4718 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4719 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 4720 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 4721 } |
4722 } | |
4723 | |
5575 | 4724 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
7283 | 4725 OscarData *od = (OscarData *)gc->proto_data; |
4269 | 4726 if (od->sess->ssi.received_data) { |
4727 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
4728 if (gname) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4729 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4730 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4889 | 4731 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 4732 } |
4733 } | |
4734 } | |
4735 | |
5575 | 4736 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { |
7283 | 4737 OscarData *od = (OscarData *)g->proto_data; |
4230 | 4738 |
4739 if (od->sess->ssi.received_data) { | |
4740 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | |
4741 oscar_remove_buddies(g, members, old_group); | |
4742 oscar_add_buddies(g, members); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4743 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4744 "ssi: moved all buddies from group %s to %s\n", old_group, new_group); |
4230 | 4745 } else { |
4889 | 4746 aim_ssi_rename_group(od->sess, old_group, new_group); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4747 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4748 "ssi: renamed group %s to %s\n", old_group, new_group); |
2995 | 4749 } |
4750 } | |
4751 } | |
4752 | |
5968 | 4753 static gboolean gaim_ssi_rerequestdata(gpointer data) { |
4754 aim_session_t *sess = data; | |
6350 | 4755 aim_ssi_reqdata(sess); |
5968 | 4756 return FALSE; |
4757 } | |
4758 | |
4642 | 4759 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4760 GaimConnection *gc = sess->aux_data; |
7283 | 4761 OscarData *od = gc->proto_data; |
4642 | 4762 va_list ap; |
4763 fu16_t reason; | |
4764 | |
4765 va_start(ap, fr); | |
4766 reason = (fu16_t)va_arg(ap, unsigned int); | |
4767 va_end(ap); | |
4768 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4769 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); |
4642 | 4770 |
4771 if (reason == 0x0005) { | |
5892 | 4772 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), |
5828 | 4773 _("Gaim was temporarily unable to retrieve your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours.")); |
5968 | 4774 od->getblisttimer = g_timeout_add(300000, gaim_ssi_rerequestdata, od->sess); |
4642 | 4775 } |
4776 | |
4777 /* Activate SSI */ | |
4778 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4779 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
5968 | 4780 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: activating server-stored buddy list\n"); |
4642 | 4781 aim_ssi_enable(od->sess); |
4782 | |
4783 return 1; | |
4784 } | |
4785 | |
2991 | 4786 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4787 GaimConnection *gc = sess->aux_data; |
7283 | 4788 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4789 int numtypes, i; |
4790 fu16_t *maxitems; | |
2991 | 4791 va_list ap; |
4792 | |
4793 va_start(ap, fr); | |
4230 | 4794 numtypes = va_arg(ap, int); |
4795 maxitems = va_arg(ap, fu16_t *); | |
2991 | 4796 va_end(ap); |
4797 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4798 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ssi rights:"); |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4799 |
4230 | 4800 for (i=0; i<numtypes; i++) |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4801 gaim_debug(GAIM_DEBUG_MISC, NULL, " max type 0x%04x=%hd,", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4802 i, maxitems[i]); |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4803 |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4804 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
4230 | 4805 |
4806 if (numtypes >= 0) | |
4807 od->rights.maxbuddies = maxitems[0]; | |
4808 if (numtypes >= 1) | |
4809 od->rights.maxgroups = maxitems[1]; | |
4810 if (numtypes >= 2) | |
4811 od->rights.maxpermits = maxitems[2]; | |
4812 if (numtypes >= 3) | |
4813 od->rights.maxdenies = maxitems[3]; | |
2991 | 4814 |
4815 return 1; | |
4816 } | |
4817 | |
4818 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4819 GaimConnection *gc = sess->aux_data; |
4820 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 4821 OscarData *od = (OscarData *)gc->proto_data; |
2995 | 4822 struct aim_ssi_item *curitem; |
2991 | 4823 int tmp; |
4778 | 4824 gboolean export = FALSE; |
4617 | 4825 /* XXX - use these? |
4230 | 4826 va_list ap; |
4827 | |
4828 va_start(ap, fr); | |
4829 fmtver = (fu16_t)va_arg(ap, int); | |
4830 numitems = (fu16_t)va_arg(ap, int); | |
4831 items = va_arg(ap, struct aim_ssi_item); | |
4832 timestamp = va_arg(ap, fu32_t); | |
4833 va_end(ap); */ | |
2991 | 4834 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4835 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4836 "ssi: syncing local list and server list\n"); |
2991 | 4837 |
4838 /* Clean the buddy list */ | |
4889 | 4839 aim_ssi_cleanlist(sess); |
2991 | 4840 |
4841 /* Add from server list to local list */ | |
4230 | 4842 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
7328 | 4843 if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL))) |
2991 | 4844 switch (curitem->type) { |
4230 | 4845 case 0x0000: { /* Buddy */ |
4251 | 4846 if (curitem->name) { |
4292 | 4847 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
7166 | 4848 char *gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; |
4282 | 4849 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
7166 | 4850 char *alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; |
6695 | 4851 GaimBuddy *buddy = gaim_find_buddy(gc->account, curitem->name); |
4458 | 4852 /* Should gname be freed here? -- elb */ |
4754 | 4853 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 4854 free(alias); |
4282 | 4855 if (buddy) { |
4292 | 4856 /* Get server stored alias */ |
4705 | 4857 if (alias_utf8) { |
4858 g_free(buddy->alias); | |
4859 buddy->alias = g_strdup(alias_utf8); | |
4860 } | |
4282 | 4861 } else { |
6695 | 4862 GaimGroup *g; |
4687 | 4863 buddy = gaim_buddy_new(gc->account, curitem->name, alias_utf8); |
5146 | 4864 |
4754 | 4865 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 4866 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 4867 gaim_blist_add_group(g, NULL); |
4868 } | |
5146 | 4869 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4870 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4871 "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
6695 | 4872 gaim_blist_add_buddy(buddy, NULL, g, NULL); |
4778 | 4873 export = TRUE; |
4251 | 4874 } |
7162 | 4875 g_free(gname_utf8); |
4876 g_free(alias_utf8); | |
2991 | 4877 } |
4230 | 4878 } break; |
4879 | |
4880 case 0x0001: { /* Group */ | |
4282 | 4881 /* Shouldn't add empty groups */ |
4230 | 4882 } break; |
4883 | |
4884 case 0x0002: { /* Permit buddy */ | |
2991 | 4885 if (curitem->name) { |
4230 | 4886 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 4887 GSList *list; |
5575 | 4888 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4889 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4890 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4891 "ssi: adding permit buddy %s to local list\n", curitem->name); |
6400
588e88bcdac5
[gaim-migrate @ 6905]
Christian Hammond <chipx86@chipx86.com>
parents:
6378
diff
changeset
|
4892 gaim_privacy_permit_add(account, curitem->name, TRUE); |
4778 | 4893 export = TRUE; |
2991 | 4894 } |
4895 } | |
4230 | 4896 } break; |
4897 | |
4898 case 0x0003: { /* Deny buddy */ | |
2991 | 4899 if (curitem->name) { |
4900 GSList *list; | |
5575 | 4901 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4902 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4903 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4904 "ssi: adding deny buddy %s to local list\n", curitem->name); |
6400
588e88bcdac5
[gaim-migrate @ 6905]
Christian Hammond <chipx86@chipx86.com>
parents:
6378
diff
changeset
|
4905 gaim_privacy_deny_add(account, curitem->name, TRUE); |
4778 | 4906 export = TRUE; |
2991 | 4907 } |
4908 } | |
4230 | 4909 } break; |
4910 | |
4911 case 0x0004: { /* Permit/deny setting */ | |
2991 | 4912 if (curitem->data) { |
4913 fu8_t permdeny; | |
5575 | 4914 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
|
4915 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5575 | 4916 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
4917 account->perm_deny = permdeny; | |
4918 if (od->icq && account->perm_deny == 0x03) { | |
4342 | 4919 serv_set_away(gc, "Invisible", ""); |
4920 } | |
4778 | 4921 export = TRUE; |
2991 | 4922 } |
4923 } | |
4230 | 4924 } break; |
4925 | |
4926 case 0x0005: { /* Presence setting */ | |
3109 | 4927 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 4928 } break; |
2991 | 4929 } /* End of switch on curitem->type */ |
4930 } /* End of for loop */ | |
4230 | 4931 |
4932 /* If changes were made, then flush buddy list to file */ | |
4778 | 4933 if (export) |
4349 | 4934 gaim_blist_save(); |
2991 | 4935 |
4759 | 4936 { /* Add from local list to server list */ |
6695 | 4937 GaimBlistNode *gnode, *cnode, *bnode; |
4938 GaimGroup *group; | |
4939 GaimBuddy *buddy; | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
4940 GaimBuddyList *blist; |
3017 | 4941 GSList *cur; |
4942 | |
2991 | 4943 /* Buddies */ |
4759 | 4944 if ((blist = gaim_get_blist())) |
4945 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
5234 | 4946 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
4947 continue; | |
6695 | 4948 group = (GaimGroup *)gnode; |
4949 for (cnode = gnode->child; cnode; cnode = cnode->next) { | |
4950 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
5234 | 4951 continue; |
6695 | 4952 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
4953 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
4954 continue; | |
4955 buddy = (GaimBuddy *)bnode; | |
4956 if (buddy->account == gc->account) { | |
7125 | 4957 const char *servernick = gaim_buddy_get_setting(buddy, "servernick"); |
4958 if (servernick) | |
6695 | 4959 serv_got_alias(gc, buddy->name, servernick); |
7125 | 4960 |
6695 | 4961 if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) { |
4962 /* Store local alias on server */ | |
4963 char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name); | |
4964 if (!alias && buddy->alias && strlen(buddy->alias)) | |
4965 aim_ssi_aliasbuddy(sess, group->name, buddy->name, buddy->alias); | |
4966 free(alias); | |
4967 } else { | |
4968 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
4969 "ssi: adding buddy %s from local list to server list\n", buddy->name); | |
4970 aim_ssi_addbuddy(sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); | |
4971 } | |
4759 | 4972 } |
4349 | 4973 } |
4230 | 4974 } |
4292 | 4975 } |
6695 | 4976 |
2991 | 4977 /* Permit list */ |
4491 | 4978 if (gc->account->permit) { |
4979 for (cur=gc->account->permit; cur; cur=cur->next) | |
4230 | 4980 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
|
4981 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
6695 | 4982 "ssi: adding permit %s from local list to server list\n", (char *)cur->data); |
4889 | 4983 aim_ssi_addpermit(sess, cur->data); |
4230 | 4984 } |
2991 | 4985 } |
4986 | |
4987 /* Deny list */ | |
4491 | 4988 if (gc->account->deny) { |
4989 for (cur=gc->account->deny; cur; cur=cur->next) | |
4230 | 4990 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
|
4991 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
6695 | 4992 "ssi: adding deny %s from local list to server list\n", (char *)cur->data); |
4889 | 4993 aim_ssi_adddeny(sess, cur->data); |
4230 | 4994 } |
2991 | 4995 } |
3109 | 4996 /* Presence settings (idle time visibility) */ |
4230 | 4997 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) |
5631 | 4998 if (!(tmp & 0x400)) |
4889 | 4999 aim_ssi_setpresence(sess, tmp | 0x400); |
4778 | 5000 } /* end adding buddies from local list to server list */ |
5001 | |
4901 | 5002 /* Set our ICQ status */ |
5003 if (od->icq && !gc->away) { | |
5004 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); | |
5005 } | |
5006 | |
4342 | 5007 /* Activate SSI */ |
5008 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
5009 /* 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
|
5010 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5011 "ssi: activating server-stored buddy list\n"); |
4642 | 5012 aim_ssi_enable(sess); |
4342 | 5013 |
2991 | 5014 return 1; |
2086 | 5015 } |
4230 | 5016 |
5017 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5018 GaimConnection *gc = sess->aux_data; |
4230 | 5019 va_list ap; |
5020 struct aim_ssi_tmp *retval; | |
5021 | |
5022 va_start(ap, fr); | |
5023 retval = va_arg(ap, struct aim_ssi_tmp *); | |
5024 va_end(ap); | |
5025 | |
5026 while (retval) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5027 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5028 "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 | 5029 |
5030 if (retval->ack != 0xffff) | |
5031 switch (retval->ack) { | |
5032 case 0x0000: { /* added successfully */ | |
5033 } break; | |
5034 | |
4829 | 5035 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
5036 gchar *buf; | |
5037 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
|
5038 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4829 | 5039 g_free(buf); |
5040 } | |
5041 | |
7023 | 5042 case 0x000e: { /* buddy requires authorization */ |
4828 | 5043 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 5044 gaim_auth_sendrequest(gc, retval->name); |
4230 | 5045 } break; |
5046 | |
5047 default: { /* La la la */ | |
5197 | 5048 gchar *buf; |
5402 | 5049 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
5050 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
|
5051 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5197 | 5052 g_free(buf); |
5402 | 5053 /* XXX - Should remove buddy from local list */ |
4230 | 5054 } break; |
5055 } | |
5056 | |
5057 retval = retval->next; | |
5058 } | |
5059 | |
5060 return 1; | |
5061 } | |
5062 | |
5063 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5064 GaimConnection *gc = sess->aux_data; |
4230 | 5065 va_list ap; |
5066 char *sn, *msg; | |
4236 | 5067 gchar *dialog_msg, *nombre; |
4230 | 5068 struct name_data *data; |
6695 | 5069 GaimBuddy *buddy; |
4230 | 5070 |
5071 va_start(ap, fr); | |
5072 sn = va_arg(ap, char *); | |
5073 msg = va_arg(ap, char *); | |
5074 va_end(ap); | |
5075 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5076 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5077 "ssi: %s has given you permission to add him to your buddy list\n", sn); |
4230 | 5078 |
4687 | 5079 buddy = gaim_find_buddy(gc->account, sn); |
5080 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5081 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5082 else |
5083 nombre = g_strdup(sn); | |
5084 | |
5085 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 | 5086 data = g_new(struct name_data, 1); |
5087 data->gc = gc; | |
5088 data->name = g_strdup(sn); | |
5089 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5090 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5091 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5092 0, data, |
7023 | 5093 G_CALLBACK(gaim_icq_buddyadd), |
5836 | 5094 G_CALLBACK(oscar_free_name_data)); |
4236 | 5095 |
4230 | 5096 g_free(dialog_msg); |
4236 | 5097 g_free(nombre); |
4230 | 5098 |
5099 return 1; | |
5100 } | |
5101 | |
5102 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5103 GaimConnection *gc = sess->aux_data; |
4230 | 5104 va_list ap; |
5105 char *sn, *msg; | |
4236 | 5106 gchar *dialog_msg, *nombre; |
4230 | 5107 struct name_data *data; |
6695 | 5108 GaimBuddy *buddy; |
4230 | 5109 |
5110 va_start(ap, fr); | |
5111 sn = va_arg(ap, char *); | |
5112 msg = va_arg(ap, char *); | |
5113 va_end(ap); | |
5114 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5115 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5116 "ssi: received authorization request from %s\n", sn); |
4230 | 5117 |
4687 | 5118 buddy = gaim_find_buddy(gc->account, sn); |
5119 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5120 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5121 else |
5122 nombre = g_strdup(sn); | |
5123 | |
4337 | 5124 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 | 5125 data = g_new(struct name_data, 1); |
5126 data->gc = gc; | |
5127 data->name = g_strdup(sn); | |
5128 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5129 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5130 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5131 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5132 _("Authorize"), G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5133 _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4236 | 5134 |
4230 | 5135 g_free(dialog_msg); |
4236 | 5136 g_free(nombre); |
4230 | 5137 |
5138 return 1; | |
5139 } | |
5140 | |
5141 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5142 GaimConnection *gc = sess->aux_data; |
4230 | 5143 va_list ap; |
5144 char *sn, *msg; | |
4236 | 5145 gchar *dialog_msg, *nombre; |
4230 | 5146 fu8_t reply; |
6695 | 5147 GaimBuddy *buddy; |
4230 | 5148 |
5149 va_start(ap, fr); | |
5150 sn = va_arg(ap, char *); | |
5151 reply = (fu8_t)va_arg(ap, int); | |
5152 msg = va_arg(ap, char *); | |
5153 va_end(ap); | |
5154 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5155 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5156 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4236 | 5157 |
4687 | 5158 buddy = gaim_find_buddy(gc->account, sn); |
5159 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5160 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5161 else |
5162 nombre = g_strdup(sn); | |
5163 | |
4230 | 5164 if (reply) { |
5165 /* Granted */ | |
7023 | 5166 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5167 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); |
4230 | 5168 } else { |
5169 /* Denied */ | |
7023 | 5170 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5171 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); |
4230 | 5172 } |
5173 g_free(dialog_msg); | |
4236 | 5174 g_free(nombre); |
4230 | 5175 |
5176 return 1; | |
5177 } | |
5178 | |
5179 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5180 GaimConnection *gc = sess->aux_data; |
4230 | 5181 va_list ap; |
5182 char *sn; | |
6695 | 5183 GaimBuddy *buddy; |
4230 | 5184 |
5185 va_start(ap, fr); | |
5186 sn = va_arg(ap, char *); | |
5187 va_end(ap); | |
5188 | |
4687 | 5189 buddy = gaim_find_buddy(gc->account, sn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5190 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5191 "ssi: %s added you to their buddy list\n", sn); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
7011
diff
changeset
|
5192 gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 5193 |
5194 return 1; | |
5195 } | |
4269 | 5196 #endif |
2086 | 5197 |
5575 | 5198 static GList *oscar_chat_info(GaimConnection *gc) { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5199 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5200 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5201 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5202 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5203 pce->label = _("Join what group:"); |
5234 | 5204 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5205 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5206 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5207 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5208 pce->label = _("Exchange:"); |
5234 | 5209 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5210 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5211 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5212 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5213 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5214 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5215 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5216 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5217 |
5575 | 5218 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { |
7283 | 5219 OscarData *od = (OscarData *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5220 aim_conn_t *cur; |
5234 | 5221 char *name, *exchange; |
5222 | |
5223 name = g_hash_table_lookup(data, "room"); | |
5224 exchange = g_hash_table_lookup(data, "exchange"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5225 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5226 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5227 "Attempting to join chat room %s.\n", name); |
4617 | 5228 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
|
5229 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5230 "chatnav exists, creating room\n"); |
5234 | 5231 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); |
2086 | 5232 } else { |
5233 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5234 struct create_room *cr = g_new0(struct create_room, 1); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5235 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5236 "chatnav does not exist, opening chatnav\n"); |
5234 | 5237 cr->exchange = atoi(exchange); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5238 cr->name = g_strdup(name); |
4617 | 5239 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5240 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 5241 } |
5242 } | |
5243 | |
5575 | 5244 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { |
7283 | 5245 OscarData *od = (OscarData *)g->proto_data; |
2086 | 5246 struct chat_connection *ccon = find_oscar_chat(g, id); |
5247 | |
5248 if (!ccon) | |
5249 return; | |
5250 | |
4617 | 5251 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
2086 | 5252 ccon->exchange, ccon->name, 0x0); |
5253 } | |
5254 | |
5575 | 5255 static void oscar_chat_leave(GaimConnection *g, int id) { |
7283 | 5256 OscarData *od = g ? (OscarData *)g->proto_data : NULL; |
2086 | 5257 GSList *bcs = g->buddy_chats; |
5679 | 5258 GaimConversation *b = NULL; |
2086 | 5259 struct chat_connection *c = NULL; |
5260 int count = 0; | |
5261 | |
5262 while (bcs) { | |
5263 count++; | |
5679 | 5264 b = (GaimConversation *)bcs->data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5265 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))) |
2086 | 5266 break; |
5267 bcs = bcs->next; | |
5268 b = NULL; | |
5269 } | |
5270 | |
5271 if (!b) | |
5272 return; | |
5273 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5274 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5275 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); |
2086 | 5276 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5277 c = find_oscar_chat(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 5278 if (c != NULL) { |
4617 | 5279 if (od) |
5280 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 5281 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5282 gaim_input_remove(c->inpa); |
4617 | 5283 if (g && od->sess) |
5284 aim_conn_kill(od->sess, &c->conn); | |
2086 | 5285 g_free(c->name); |
5286 g_free(c->show); | |
5287 g_free(c); | |
5288 } | |
5289 /* we do this because with Oscar it doesn't tell us we left */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5290 serv_got_chat_left(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 5291 } |
5292 | |
6059 | 5293 static int oscar_chat_send(GaimConnection *g, int id, const char *message) { |
7283 | 5294 OscarData *od = (OscarData *)g->proto_data; |
2086 | 5295 GSList *bcs = g->buddy_chats; |
5679 | 5296 GaimConversation *b = NULL; |
2086 | 5297 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5298 char *buf, *buf2; |
2086 | 5299 int i, j; |
5300 | |
5301 while (bcs) { | |
5679 | 5302 b = (GaimConversation *)bcs->data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5303 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))) |
2086 | 5304 break; |
5305 bcs = bcs->next; | |
5306 b = NULL; | |
5307 } | |
5308 if (!b) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5309 return -EINVAL; |
2086 | 5310 |
4617 | 5311 bcs = od->oscar_chats; |
2086 | 5312 while (bcs) { |
5313 c = (struct chat_connection *)bcs->data; | |
5314 if (b == c->cnv) | |
5315 break; | |
5316 bcs = bcs->next; | |
5317 c = NULL; | |
5318 } | |
5319 if (!c) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5320 return -EINVAL; |
2086 | 5321 |
5322 buf = g_malloc(strlen(message) * 4 + 1); | |
5323 for (i = 0, j = 0; i < strlen(message); i++) { | |
5324 if (message[i] == '\n') { | |
5325 buf[j++] = '<'; | |
5326 buf[j++] = 'B'; | |
5327 buf[j++] = 'R'; | |
5328 buf[j++] = '>'; | |
5329 } else { | |
5330 buf[j++] = message[i]; | |
5331 } | |
5332 } | |
5333 buf[j] = '\0'; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5334 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5335 if (strlen(buf) > c->maxlen) |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5336 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5337 |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7093
diff
changeset
|
5338 buf2 = gaim_markup_strip_html(buf); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5339 if (strlen(buf2) > c->maxvis) { |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5340 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5341 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5342 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5343 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5344 |
4617 | 5345 aim_chat_send_im(od->sess, c->conn, 0, buf, strlen(buf)); |
2086 | 5346 g_free(buf); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5347 return 0; |
2086 | 5348 } |
5349 | |
6695 | 5350 static const char *oscar_list_icon(GaimAccount *a, GaimBuddy *b) { |
4766 | 5351 if (!b || (b && b->name && b->name[0] == '+')) { |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5352 if (a != NULL && isdigit(*gaim_account_get_username(a))) |
4687 | 5353 return "icq"; |
5354 else | |
5355 return "aim"; | |
5356 } | |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5357 |
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5358 if (b != NULL && isdigit(b->name[0])) |
4687 | 5359 return "icq"; |
5360 return "aim"; | |
5361 } | |
5362 | |
6695 | 5363 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 5364 { |
7334 | 5365 GaimAccount *account = NULL; |
5366 GaimConnection *gc = NULL; | |
5367 OscarData *od = NULL; | |
4687 | 5368 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
5369 int i = 0; | |
7334 | 5370 aim_userinfo_t *userinfo = NULL; |
5371 | |
5372 if (b != NULL) | |
5373 account = b->account; | |
5374 if (account != NULL) | |
5375 gc = account->gc; | |
5376 if (gc != NULL) | |
5377 od = gc->proto_data; | |
4687 | 5378 |
5131 | 5379 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5380 char *gname; | |
7334 | 5381 if ((b->name) && (od) && (od->sess->ssi.received_data) && |
5131 | 5382 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
5383 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
5384 emblems[i++] = "notauthorized"; | |
5385 } else { | |
5386 emblems[i++] = "offline"; | |
5387 } | |
5388 } | |
4916 | 5389 |
4766 | 5390 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 5391 int uc = b->uc >> 16; |
4766 | 5392 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 5393 emblems[i++] = "invisible"; |
4766 | 5394 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 5395 emblems[i++] = "freeforchat"; |
4766 | 5396 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 5397 emblems[i++] = "dnd"; |
4766 | 5398 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 5399 emblems[i++] = "na"; |
4766 | 5400 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 5401 emblems[i++] = "occupied"; |
4766 | 5402 else if (uc & AIM_ICQ_STATE_AWAY) |
5403 emblems[i++] = "away"; | |
5404 } else { | |
5405 if (b->uc & UC_UNAVAILABLE) | |
5406 emblems[i++] = "away"; | |
5407 } | |
4687 | 5408 if (b->uc & UC_WIRELESS) |
5409 emblems[i++] = "wireless"; | |
5410 if (b->uc & UC_AOL) | |
5411 emblems[i++] = "aol"; | |
5412 if (b->uc & UC_ADMIN) | |
5413 emblems[i++] = "admin"; | |
5414 if (b->uc & UC_AB && i < 4) | |
5415 emblems[i++] = "activebuddy"; | |
6318 | 5416 if (b->uc & UC_HIPTOP && i < 4) |
5417 emblems[i++] = "hiptop"; | |
4766 | 5418 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
5419 emblems[i++] = "unconfirmed"; */ | |
7334 | 5420 |
5421 if ((i < 4) && (od != NULL)) { | |
5422 userinfo = aim_locate_finduserinfo(od->sess, b->name); | |
5423 if ((userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_SECUREIM)) | |
5424 emblems[i++] = "secure"; | |
5425 } | |
5426 | |
4687 | 5427 *se = emblems[0]; |
5428 *sw = emblems[1]; | |
5429 *nw = emblems[2]; | |
5430 *ne = emblems[3]; | |
5431 } | |
5432 | |
6695 | 5433 static char *oscar_tooltip_text(GaimBuddy *b) { |
5575 | 5434 GaimConnection *gc = b->account->gc; |
7283 | 5435 OscarData *od = gc->proto_data; |
7261 | 5436 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
7045 | 5437 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); |
7011 | 5438 gchar *tmp = NULL, *ret = g_strdup(""); |
5131 | 5439 |
5440 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
5441 if (isdigit(b->name[0])) { | |
7011 | 5442 char *status; |
5131 | 5443 status = gaim_icq_status((b->uc & 0xffff0000) >> 16); |
7011 | 5444 tmp = ret; |
5445 ret = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); | |
5131 | 5446 g_free(tmp); |
5447 g_free(status); | |
5448 } | |
5449 | |
7011 | 5450 if (userinfo != NULL) { |
7162 | 5451 char *tstr = gaim_str_seconds_to_string(time(NULL) - userinfo->onlinesince + |
5131 | 5452 (gc->login_time_official ? gc->login_time_official - gc->login_time : 0)); |
7011 | 5453 tmp = ret; |
5454 ret = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL); | |
7162 | 5455 g_free(tmp); |
5456 g_free(tstr); | |
7011 | 5457 } |
5458 | |
5459 if ((bi != NULL) && (bi->ipaddr)) { | |
7283 | 5460 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", |
7011 | 5461 (bi->ipaddr & 0xff000000) >> 24, |
5462 (bi->ipaddr & 0x00ff0000) >> 16, | |
5463 (bi->ipaddr & 0x0000ff00) >> 8, | |
5464 (bi->ipaddr & 0x000000ff)); | |
5465 tmp = ret; | |
5466 ret = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL); | |
7162 | 5467 g_free(tmp); |
5468 g_free(tstr); | |
7011 | 5469 } |
5470 | |
5471 if ((userinfo != NULL) && (userinfo->capabilities)) { | |
5472 char *caps = caps_string(userinfo->capabilities); | |
5473 tmp = ret; | |
5474 ret = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); | |
7162 | 5475 g_free(tmp); |
7011 | 5476 } |
5477 | |
5478 if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) { | |
5479 gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5480 tmp = ret; | |
5481 ret = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL); | |
7162 | 5482 g_free(tmp); |
7011 | 5483 g_free(escaped); |
5484 } | |
5485 | |
5486 if ((userinfo != NULL) && (userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
5487 gchar *away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len); | |
5488 if (away_utf8 != NULL) { | |
7091 | 5489 gchar *tmp1, *tmp2; |
7162 | 5490 const char *tmp3; |
7091 | 5491 tmp1 = gaim_strreplace(away_utf8, "<BR>", "\n"); |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7093
diff
changeset
|
5492 tmp2 = gaim_markup_strip_html(tmp1); |
7091 | 5493 g_free(tmp1); |
7235 | 5494 tmp1 = g_markup_escape_text(tmp2, strlen(tmp2)); |
7091 | 5495 g_free(tmp2); |
7235 | 5496 tmp3 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); |
5497 g_free(tmp1); | |
7011 | 5498 tmp = ret; |
7162 | 5499 ret = g_strconcat(tmp, _("<b>Away Message:</b> "), tmp3, "\n", NULL); |
5500 g_free(tmp); | |
7011 | 5501 g_free(away_utf8); |
5836 | 5502 } |
5131 | 5503 } |
5504 } else { | |
5505 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
5506 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { | |
7011 | 5507 tmp = ret; |
5508 ret = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); | |
5131 | 5509 g_free(tmp); |
5510 } else { | |
7011 | 5511 tmp = ret; |
5512 ret = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); | |
5131 | 5513 g_free(tmp); |
5514 } | |
5515 } | |
5516 | |
5517 /* remove the trailing newline character */ | |
7011 | 5518 if (ret) |
5519 ret[strlen(ret)-1] = '\0'; | |
5520 return ret; | |
5131 | 5521 } |
5522 | |
6695 | 5523 static char *oscar_status_text(GaimBuddy *b) { |
5575 | 5524 GaimConnection *gc = b->account->gc; |
7283 | 5525 OscarData *od = gc->proto_data; |
5167 | 5526 gchar *ret = NULL; |
5527 | |
5528 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | |
5529 if (isdigit(b->name[0])) | |
5530 ret = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
7038 | 5531 else |
5532 ret = g_strdup(_("Away")); | |
5836 | 5533 } else if (GAIM_BUDDY_IS_ONLINE(b)) { |
7261 | 5534 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
6292 | 5535 if (bi->availmsg) |
5536 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5836 | 5537 } else { |
5167 | 5538 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); |
5539 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) | |
5540 ret = g_strdup(_("Not Authorized")); | |
5541 else | |
5542 ret = g_strdup(_("Offline")); | |
5543 } | |
5544 | |
5545 return ret; | |
5546 } | |
5547 | |
5842 | 5548 |
5844 | 5549 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5842 | 5550 GaimConnection *gc = sess->aux_data; |
7283 | 5551 OscarData *od = gc->proto_data; |
5892 | 5552 va_list ap; |
5842 | 5553 fu16_t type; |
5892 | 5554 fu8_t flags = 0, length = 0; |
5555 char *md5 = NULL; | |
5556 | |
7334 | 5557 |
5842 | 5558 va_start(ap, fr); |
5559 type = va_arg(ap, int); | |
5892 | 5560 |
5561 switch(type) { | |
5562 case 0x0000: | |
5563 case 0x0001: { | |
5564 flags = va_arg(ap, int); | |
5565 length = va_arg(ap, int); | |
5566 md5 = va_arg(ap, char *); | |
5567 | |
5568 if (flags == 0x41) { | |
5569 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
5570 od->iconconnecting = TRUE; | |
5571 od->set_icon = TRUE; | |
5572 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
5573 } else { | |
6039 | 5574 struct stat st; |
5575 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
5576 if (iconfile == NULL) { | |
5577 /* Set an empty icon, or something */ | |
5578 } else if (!stat(iconfile, &st)) { | |
5579 char *buf = g_malloc(st.st_size); | |
5580 FILE *file = fopen(iconfile, "rb"); | |
5581 if (file) { | |
5582 fread(buf, 1, st.st_size, file); | |
5583 fclose(file); | |
5584 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5585 "Uploading icon to icon server\n"); | |
6879 | 5586 aim_bart_upload(od->sess, buf, st.st_size); |
5892 | 5587 } else |
5588 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6039 | 5589 "Can't open buddy icon file!\n"); |
5590 g_free(buf); | |
5591 } else { | |
5592 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5593 "Can't stat buddy icon file!\n"); | |
5892 | 5594 } |
5595 } | |
5893 | 5596 } else if (flags == 0x81) |
5597 aim_ssi_seticon(od->sess, md5, length); | |
5892 | 5598 } break; |
5599 | |
5600 case 0x0002: { /* We just set an "available" message? */ | |
5601 } break; | |
5602 } | |
5603 | |
5842 | 5604 va_end(ap); |
5844 | 5605 |
5606 return 0; | |
5842 | 5607 } |
5892 | 5608 |
3952 | 5609 /* |
4617 | 5610 * We have just established a socket with the other dude, so set up some handlers. |
3952 | 5611 */ |
4617 | 5612 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5613 GaimConnection *gc = sess->aux_data; |
7283 | 5614 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 5615 GaimConversation *cnv; |
2086 | 5616 struct direct_im *dim; |
5617 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5618 char *sn; |
4617 | 5619 va_list ap; |
5620 aim_conn_t *newconn, *listenerconn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5621 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5622 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5623 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5624 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 5625 va_end(ap); |
5626 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5627 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5628 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5629 |
4617 | 5630 sn = g_strdup(aim_odc_getsn(newconn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5631 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5632 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5633 "DirectIM: initiate success to %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5634 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5635 |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5636 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
|
5637 gaim_input_remove(dim->watcher); |
2086 | 5638 dim->conn = newconn; |
4617 | 5639 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
3008 | 5640 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5641 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5642 g_free(sn); |
6982 | 5643 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
2086 | 5644 |
4617 | 5645 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); |
5646 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
6982 | 5647 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_odc_update_ui, 0); |
4617 | 5648 |
2993 | 5649 return 1; |
5650 } | |
5651 | |
6982 | 5652 /* |
5653 * This is called when each chunk of an image is received. It can be used to | |
5654 * update a progress bar, or to eat lots of dry cat food. Wet cat food is | |
5655 * nasty, you sicko. | |
5656 */ | |
5657 static int gaim_odc_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
2993 | 5658 va_list ap; |
5659 char *sn; | |
5660 double percent; | |
5575 | 5661 GaimConnection *gc = sess->aux_data; |
7283 | 5662 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 5663 GaimConversation *c; |
2993 | 5664 struct direct_im *dim; |
5665 | |
5666 va_start(ap, fr); | |
5667 sn = va_arg(ap, char *); | |
5668 percent = va_arg(ap, double); | |
5669 va_end(ap); | |
6873 | 5670 |
2994 | 5671 if (!(dim = find_direct_im(od, sn))) |
5672 return 1; | |
3059 | 5673 if (dim->watcher) { |
5674 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
5675 dim->watcher = 0; | |
5676 } | |
6982 | 5677 /* XXX is this really necessary? */ |
7082
25a616f16b6c
[gaim-migrate @ 7647]
Christian Hammond <chipx86@chipx86.com>
parents:
7080
diff
changeset
|
5678 gaim_core_mainloop_finish_events(); |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5679 |
6982 | 5680 c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
6873 | 5681 if (c != NULL) |
5682 gaim_conversation_update_progress(c, percent); | |
2993 | 5683 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
5684 oscar_callback, dim->conn); | |
2086 | 5685 |
5686 return 1; | |
5687 } | |
5688 | |
6982 | 5689 /* |
5690 * This is called after a direct IM has been received in its entirety. This | |
5691 * function is passed a long chunk of data which contains the IM with any | |
5692 * data chunks (images) appended to it. | |
5693 * | |
5694 * This function rips out all the data chunks and creates an imgstore for | |
5695 * each one. In order to do this, it first goes through the IM and takes | |
5696 * out all the IMG tags. When doing so, it rewrites the original IMG tag | |
5697 * with one compatable with the imgstore Gaim core code. For each one, we | |
5698 * then read in chunks of data from the end of the message and actually | |
5699 * create the img store using the given data. | |
5700 * | |
5701 * For somewhat easy reference, here's a sample message | |
5702 * (without the whitespace and asterisks): | |
5703 * | |
5704 * <HTML><BODY BGCOLOR="#ffffff"> | |
5705 * <FONT LANG="0"> | |
5706 * This is a really stupid picture:<BR> | |
5707 * <IMG SRC="Sample.jpg" ID="1" WIDTH="283" HEIGHT="212" DATASIZE="9894"><BR> | |
5708 * Yeah it is<BR> | |
5709 * Here is another one:<BR> | |
5710 * <IMG SRC="Soap Bubbles.bmp" ID="2" WIDTH="256" HEIGHT="256" DATASIZE="65978"> | |
5711 * </FONT> | |
5712 * </BODY></HTML> | |
5713 * <BINARY> | |
5714 * <DATA ID="1" SIZE="9894">datadatadatadata</DATA> | |
5715 * <DATA ID="2" SIZE="65978">datadatadatadata</DATA> | |
5716 * </BINARY> | |
5717 */ | |
4617 | 5718 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5719 GaimConnection *gc = sess->aux_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5720 GaimConvImFlags imflags = 0; |
6982 | 5721 GString *newmsg = g_string_new(""); |
5722 GSList *images = NULL; | |
2086 | 5723 va_list ap; |
6982 | 5724 const char *sn, *msg, *msgend, *binary; |
5725 size_t len; | |
5726 int encoding, isawaymsg; | |
2086 | 5727 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5728 va_start(ap, fr); |
6982 | 5729 sn = va_arg(ap, const char *); |
5730 msg = va_arg(ap, const char *); | |
5731 len = va_arg(ap, size_t); | |
3952 | 5732 encoding = va_arg(ap, int); |
4870 | 5733 isawaymsg = va_arg(ap, int); |
2086 | 5734 va_end(ap); |
6982 | 5735 msgend = msg + len; |
2086 | 5736 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5737 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5738 "Got DirectIM message from %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5739 |
4870 | 5740 if (isawaymsg) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5741 imflags |= GAIM_CONV_IM_AUTO_RESP; |
4870 | 5742 |
6982 | 5743 /* message has a binary trailer */ |
5744 if ((binary = gaim_strcasestr(msg, "<binary>"))) { | |
5745 GData *attribs; | |
5746 const char *tmp, *start, *end, *last = NULL; | |
5747 | |
5748 tmp = msg; | |
5749 | |
5750 /* for each valid image tag... */ | |
5751 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
5752 const char *id, *src, *datasize; | |
5753 const char *tag = NULL, *data = NULL; | |
5754 size_t size; | |
5755 int imgid = 0; | |
5756 | |
5757 /* update the location of the last img tag */ | |
5758 last = end; | |
5759 | |
5760 /* grab attributes */ | |
5761 id = g_datalist_get_data(&attribs, "id"); | |
5762 src = g_datalist_get_data(&attribs, "src"); | |
5763 datasize = g_datalist_get_data(&attribs, "datasize"); | |
5764 | |
5765 /* if we have id & datasize, build the data tag */ | |
5766 if (id && datasize) | |
5767 tag = g_strdup_printf("<data id=\"%s\" size=\"%s\">", id, datasize); | |
5768 | |
5769 /* if we have a tag, find the start of the data */ | |
5770 if (tag && (data = gaim_strcasestr(binary, tag))) | |
5771 data += strlen(tag); | |
5772 | |
5773 /* check the data is here and store it */ | |
5774 if (data + (size = atoi(datasize)) <= msgend) | |
5775 imgid = gaim_imgstore_add(data, size, src); | |
5776 | |
5777 /* if we have a stored image... */ | |
5778 if (imgid) { | |
5779 /* append the message up to the tag */ | |
5780 newmsg = g_string_append_len(newmsg, tmp, start - tmp); | |
5781 | |
5782 /* write the new image tag */ | |
5783 g_string_append_printf(newmsg, "<IMG ID=\"%d\">", imgid); | |
5784 | |
5785 /* and record the image number */ | |
5786 images = g_slist_append(images, GINT_TO_POINTER(imgid)); | |
5787 } else { | |
5788 /* otherwise, copy up to the end of the tag */ | |
5789 newmsg = g_string_append_len(newmsg, tmp, (end + 1) - tmp); | |
5790 } | |
5791 | |
5792 /* clear the attribute list */ | |
5793 g_datalist_clear(&attribs); | |
5794 | |
5795 /* continue from the end of the tag */ | |
5796 tmp = end + 1; | |
5797 } | |
5798 | |
5799 /* append any remaining message data (without the > :-) */ | |
5800 if (last++ && (last < binary)) | |
5801 newmsg = g_string_append_len(newmsg, last, binary - last); | |
5802 | |
5803 /* set the flag if we caught any images */ | |
5804 if (images) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5805 imflags |= GAIM_CONV_IM_IMAGES; |
6982 | 5806 } else { |
5807 g_string_append_len(newmsg, msg, len); | |
5808 } | |
5809 | |
4617 | 5810 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
6982 | 5811 serv_got_im(gc, sn, newmsg->str, imflags, time(NULL)); |
5812 | |
5813 /* free up the message */ | |
5814 g_string_free(newmsg, TRUE); | |
5815 | |
5816 /* unref any images we allocated */ | |
5817 if (images) { | |
5818 GSList *tmp; | |
5819 int id; | |
5820 | |
5821 for (tmp = images; tmp != NULL; tmp = tmp->next) { | |
5822 id = GPOINTER_TO_INT(tmp->data); | |
5823 gaim_imgstore_unref(id); | |
5824 } | |
5825 | |
5826 g_slist_free(images); | |
5827 } | |
2086 | 5828 |
5829 return 1; | |
5830 } | |
5831 | |
4617 | 5832 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 5833 va_list ap; |
5834 char *sn; | |
2993 | 5835 int typing; |
5575 | 5836 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5837 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5838 va_start(ap, fr); |
2086 | 5839 sn = va_arg(ap, char *); |
2993 | 5840 typing = va_arg(ap, int); |
2086 | 5841 va_end(ap); |
5842 | |
4870 | 5843 if (typing == 0x0002) { |
2993 | 5844 /* 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
|
5845 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5846 "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
|
5847 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
4870 | 5848 } else if (typing == 0x0001) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5849 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
4870 | 5850 else |
4342 | 5851 serv_got_typing_stopped(gc, sn); |
2086 | 5852 return 1; |
5853 } | |
5854 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5855 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimConvImFlags imflags) { |
6982 | 5856 char *buf; |
5857 size_t len; | |
5858 int ret; | |
5859 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5860 if (imflags & GAIM_CONV_IM_IMAGES) { |
6982 | 5861 GString *msg = g_string_new(""); |
5862 GString *data = g_string_new("<BINARY>"); | |
5863 GData *attribs; | |
5864 const char *tmp, *start, *end, *last = NULL; | |
5865 int oscar_id = 0; | |
5866 | |
5867 tmp = message; | |
5868 | |
5869 /* for each valid IMG tag... */ | |
5870 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
5871 GaimStoredImage *image = NULL; | |
5872 const char *id; | |
5873 | |
5874 last = end; | |
5875 id = g_datalist_get_data(&attribs, "id"); | |
5876 | |
5877 /* ... if it refers to a valid gaim image ... */ | |
5878 if (id && (image = gaim_imgstore_get(atoi(id)))) { | |
5879 /* ... append the message from start to the tag ... */ | |
5880 msg = g_string_append_len(msg, tmp, start - tmp); | |
5881 oscar_id++; | |
5882 | |
5883 /* ... insert a new img tag with the oscar id ... */ | |
5884 if (image->filename) | |
5885 g_string_append_printf(msg, | |
5886 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
7386 | 5887 image->filename, oscar_id, (int)image->size); |
6982 | 5888 else |
5889 g_string_append_printf(msg, | |
5890 "<IMG ID=\"%d\" DATASIZE=\"%d\">", | |
7386 | 5891 oscar_id, (int)image->size); |
6982 | 5892 |
5893 /* ... and append the data to the binary section ... */ | |
5894 g_string_append_printf(data, "<DATA ID=\"%d\" SIZE=\"%d\">", | |
7386 | 5895 oscar_id, (int)image->size); |
6982 | 5896 data = g_string_append_len(data, image->data, image->size); |
5897 data = g_string_append(data, "</DATA>"); | |
5898 } else { | |
5899 /* ... otherwise, allow the possibly invalid img tag through. */ | |
5900 /* should we do something else? */ | |
5901 msg = g_string_append_len(msg, tmp, (end + 1) - tmp); | |
5902 } | |
5903 | |
5904 g_datalist_clear(&attribs); | |
5905 | |
5906 /* continue from the end of the tag */ | |
5907 tmp = end + 1; | |
5908 } | |
5909 | |
5910 /* append any remaining message data (without the > :-) */ | |
5911 if (last++ && *last) | |
5912 msg = g_string_append(msg, last); | |
5913 | |
5914 /* if we inserted any images in the binary section, append it */ | |
5915 if (oscar_id) { | |
5916 msg = g_string_append_len(msg, data->str, data->len); | |
5917 msg = g_string_append(msg, "</BINARY>"); | |
5918 } | |
5919 | |
5920 len = msg->len; | |
5921 buf = msg->str; | |
5922 g_string_free(msg, FALSE); | |
5923 g_string_free(data, TRUE); | |
5924 } else { | |
5925 len = strlen(message); | |
5926 buf = g_memdup(message, len+1); | |
5927 } | |
5928 | |
5929 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5930 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
6982 | 5931 ret = aim_odc_send_im(sess, conn, buf, len, 0, 1); |
5932 else | |
5933 ret = aim_odc_send_im(sess, conn, buf, len, 0, 0); | |
5934 | |
5935 g_free(buf); | |
5936 | |
5937 return ret; | |
5938 } | |
5939 | |
2086 | 5940 struct ask_do_dir_im { |
5941 char *who; | |
5575 | 5942 GaimConnection *gc; |
2086 | 5943 }; |
5944 | |
3730 | 5945 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5136 | 5946 g_free(data->who); |
2086 | 5947 g_free(data); |
5948 } | |
5949 | |
3730 | 5950 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5575 | 5951 GaimConnection *gc = data->gc; |
7283 | 5952 OscarData *od; |
2086 | 5953 struct direct_im *dim; |
5954 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
5955 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5136 | 5956 g_free(data->who); |
4244 | 5957 g_free(data); |
5958 return; | |
5959 } | |
5960 | |
7283 | 5961 od = (OscarData *)gc->proto_data; |
4244 | 5962 |
2086 | 5963 dim = find_direct_im(od, data->who); |
5964 if (dim) { | |
3008 | 5965 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
5966 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
5967 gaim_input_remove(dim->watcher); | |
5968 g_free(dim); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5969 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5970 "Gave up on old direct IM, trying again\n"); |
3008 | 5971 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5972 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); |
5136 | 5973 g_free(data->who); |
4244 | 5974 g_free(data); |
3008 | 5975 return; |
5976 } | |
2086 | 5977 } |
5978 dim = g_new0(struct direct_im, 1); | |
5979 dim->gc = gc; | |
5980 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
5981 | |
4617 | 5982 dim->conn = aim_odc_initiate(od->sess, data->who); |
2086 | 5983 if (dim->conn != NULL) { |
5984 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5985 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 5986 oscar_callback, dim->conn); |
4617 | 5987 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
5988 gaim_odc_initiate, 0); | |
2086 | 5989 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5990 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL); |
2086 | 5991 g_free(dim); |
5992 } | |
4244 | 5993 |
5136 | 5994 g_free(data->who); |
4244 | 5995 g_free(data); |
2086 | 5996 } |
5997 | |
5575 | 5998 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
5420 | 5999 gchar *buf; |
2086 | 6000 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
5136 | 6001 data->who = g_strdup(who); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
6002 data->gc = gc; |
5420 | 6003 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
|
6004 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6005 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6006 _("Because this reveals your IP address, it " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6007 "may be considered a privacy risk. Do you " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6008 "wish to continue?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6009 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6010 _("Connect"), G_CALLBACK(oscar_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6011 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
5420 | 6012 g_free(buf); |
2086 | 6013 } |
6014 | |
5575 | 6015 static void oscar_set_permit_deny(GaimConnection *gc) { |
6016 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 6017 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 6018 #ifdef NOSSI |
4770 | 6019 GSList *list, *g = gaim_blist_groups(), *g1; |
4230 | 6020 char buf[MAXMSGLEN]; |
6021 int at; | |
6022 | |
5575 | 6023 switch(account->perm_deny) { |
4687 | 6024 case 1: |
5575 | 6025 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
4230 | 6026 break; |
6027 case 2: | |
5575 | 6028 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
4230 | 6029 break; |
6030 case 3: | |
5575 | 6031 list = account->permit; |
4230 | 6032 at = 0; |
6033 while (list) { | |
6034 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6035 list = list->next; | |
6036 } | |
6037 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
6038 break; | |
6039 case 4: | |
5575 | 6040 list = account->deny; |
4230 | 6041 at = 0; |
6042 while (list) { | |
6043 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6044 list = list->next; | |
6045 } | |
6046 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
6047 break; | |
6048 case 5: | |
4770 | 6049 g1 = g; |
4230 | 6050 at = 0; |
4770 | 6051 while (g1) { |
6052 list = gaim_blist_members((struct group *)g->data); | |
6053 GSList list1 = list; | |
6054 while (list1) { | |
6055 struct buddy *b = list1->data; | |
5575 | 6056 if(b->account == account) |
4349 | 6057 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); |
4770 | 6058 list1 = list1->next; |
2995 | 6059 } |
4770 | 6060 g_slist_free(list); |
6061 g1 = g1->next; | |
4349 | 6062 } |
4770 | 6063 g_slist_free(g); |
4230 | 6064 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); |
6065 break; | |
6066 default: | |
6067 break; | |
2086 | 6068 } |
4230 | 6069 signoff_blocked(gc); |
6070 #else | |
6071 if (od->sess->ssi.received_data) | |
5575 | 6072 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); |
4230 | 6073 #endif |
2086 | 6074 } |
6075 | |
5575 | 6076 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
4269 | 6077 #ifdef NOSSI |
4491 | 6078 if (gc->account->permdeny == 3) |
4269 | 6079 oscar_set_permit_deny(gc); |
6080 #else | |
7283 | 6081 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6082 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); |
4230 | 6083 if (od->sess->ssi.received_data) |
4889 | 6084 aim_ssi_addpermit(od->sess, who); |
4230 | 6085 #endif |
2086 | 6086 } |
6087 | |
5575 | 6088 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
4269 | 6089 #ifdef NOSSI |
4491 | 6090 if (gc->account->permdeny == 4) |
4269 | 6091 oscar_set_permit_deny(gc); |
6092 #else | |
7283 | 6093 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6094 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); |
4230 | 6095 if (od->sess->ssi.received_data) |
4889 | 6096 aim_ssi_adddeny(od->sess, who); |
4230 | 6097 #endif |
2086 | 6098 } |
6099 | |
5575 | 6100 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
4269 | 6101 #ifdef NOSSI |
4491 | 6102 if (gc->account->permdeny == 3) |
4269 | 6103 oscar_set_permit_deny(gc); |
6104 #else | |
7283 | 6105 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6106 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); |
4230 | 6107 if (od->sess->ssi.received_data) |
4889 | 6108 aim_ssi_delpermit(od->sess, who); |
4230 | 6109 #endif |
2086 | 6110 } |
6111 | |
5575 | 6112 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
4269 | 6113 #ifdef NOSSI |
4491 | 6114 if (gc->account->permdeny == 4) |
4269 | 6115 oscar_set_permit_deny(gc); |
6116 #else | |
7283 | 6117 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6118 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); |
4230 | 6119 if (od->sess->ssi.received_data) |
4889 | 6120 aim_ssi_deldeny(od->sess, who); |
4230 | 6121 #endif |
2086 | 6122 } |
6123 | |
5575 | 6124 static GList *oscar_away_states(GaimConnection *gc) |
2086 | 6125 { |
7283 | 6126 OscarData *od = gc->proto_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6127 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6128 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6129 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6130 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6131 |
4333 | 6132 m = g_list_append(m, _("Online")); |
6133 m = g_list_append(m, _("Away")); | |
6134 m = g_list_append(m, _("Do Not Disturb")); | |
6135 m = g_list_append(m, _("Not Available")); | |
6136 m = g_list_append(m, _("Occupied")); | |
6137 m = g_list_append(m, _("Free For Chat")); | |
6138 m = g_list_append(m, _("Invisible")); | |
6139 | |
6140 return m; | |
6141 } | |
6142 | |
7172 | 6143 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { |
7283 | 6144 OscarData *od = data->gc->proto_data; |
7172 | 6145 GaimBuddy *b; |
6146 GaimGroup *g; | |
6147 | |
6148 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { | |
6149 oscar_free_name_data(data); | |
6150 return; | |
6151 } | |
6152 | |
6153 if (!(g = gaim_find_buddys_group(b))) { | |
6154 oscar_free_name_data(data); | |
6155 return; | |
6156 } | |
6157 | |
6158 aim_ssi_editcomment(od->sess, g->name, data->name, text); | |
6159 oscar_free_name_data(data); | |
6160 } | |
6161 | |
6162 static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { | |
7283 | 6163 OscarData *od = gc->proto_data; |
7172 | 6164 struct name_data *data = g_new(struct name_data, 1); |
6165 GaimBuddy *b; | |
6166 GaimGroup *g; | |
6167 char *comment; | |
6168 gchar *comment_utf8; | |
6169 | |
6170 if (!(b = gaim_find_buddy(gaim_connection_get_account(gc), name))) | |
6171 return; | |
6172 if (!(g = gaim_find_buddys_group(b))) | |
6173 return; | |
6174 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, name); | |
6175 comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; | |
6176 | |
6177 data->gc = gc; | |
6178 data->name = g_strdup(name); | |
6179 data->nick = NULL; | |
6180 | |
6181 gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, | |
6182 comment_utf8, TRUE, FALSE, | |
6183 _("OK"), G_CALLBACK(oscar_ssi_editcomment), | |
6184 _("Cancel"), G_CALLBACK(oscar_free_name_data), | |
6185 data); | |
6186 | |
6187 free(comment); | |
6188 g_free(comment_utf8); | |
6189 } | |
6190 | |
5575 | 6191 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
7283 | 6192 OscarData *od = gc->proto_data; |
4333 | 6193 GList *m = NULL; |
6194 struct proto_buddy_menu *pbm; | |
6195 | |
7172 | 6196 pbm = g_new0(struct proto_buddy_menu, 1); |
6197 pbm->label = _("Edit Buddy Comment"); | |
6198 pbm->callback = oscar_buddycb_edit_comment; | |
6199 pbm->gc = gc; | |
6200 m = g_list_append(m, pbm); | |
6201 | |
4333 | 6202 if (od->icq) { |
4624 | 6203 #if 0 |
4333 | 6204 pbm = g_new0(struct proto_buddy_menu, 1); |
6205 pbm->label = _("Get Status Msg"); | |
4969 | 6206 pbm->callback = oscar_get_icqstatusmsg; |
4333 | 6207 pbm->gc = gc; |
6208 m = g_list_append(m, pbm); | |
4624 | 6209 #endif |
4333 | 6210 } else { |
6695 | 6211 GaimBuddy *b = gaim_find_buddy(gc->account, who); |
7011 | 6212 aim_userinfo_t *userinfo; |
5975 | 6213 |
6214 if (b) | |
7045 | 6215 userinfo = aim_locate_finduserinfo(od->sess, b->name); |
7011 | 6216 |
6217 if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { | |
6218 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { | |
5917 | 6219 pbm = g_new0(struct proto_buddy_menu, 1); |
6220 pbm->label = _("Direct IM"); | |
6221 pbm->callback = oscar_ask_direct_im; | |
6222 pbm->gc = gc; | |
6223 m = g_list_append(m, pbm); | |
6224 } | |
6225 | |
7011 | 6226 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { |
5917 | 6227 pbm = g_new0(struct proto_buddy_menu, 1); |
6228 pbm->label = _("Send File"); | |
6229 pbm->callback = oscar_ask_sendfile; | |
6230 pbm->gc = gc; | |
6231 m = g_list_append(m, pbm); | |
6232 } | |
4826 | 6233 #if 0 |
7011 | 6234 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
5917 | 6235 pbm = g_new0(struct proto_buddy_menu, 1); |
6236 pbm->label = _("Get File"); | |
6237 pbm->callback = oscar_ask_getfile; | |
6238 pbm->gc = gc; | |
6239 m = g_list_append(m, pbm); | |
6240 } | |
4826 | 6241 #endif |
4333 | 6242 } |
5131 | 6243 } |
5197 | 6244 |
5131 | 6245 if (od->sess->ssi.received_data) { |
6246 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); | |
6247 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { | |
6248 pbm = g_new0(struct proto_buddy_menu, 1); | |
6873 | 6249 pbm->label = _("Re-request Authorization"); |
5131 | 6250 pbm->callback = gaim_auth_sendrequest; |
6251 pbm->gc = gc; | |
6252 m = g_list_append(m, pbm); | |
4333 | 6253 } |
4916 | 6254 } |
6255 | |
4333 | 6256 return m; |
6257 } | |
6258 | |
5575 | 6259 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
7283 | 6260 OscarData *od = gc->proto_data; |
5575 | 6261 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
4333 | 6262 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
6263 od->setnick = TRUE; | |
6264 od->newsn = g_strdup(nick); | |
6265 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6266 } else { | |
6267 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
6268 } | |
6269 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6270 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6271 _("Screenname formatting can change only capitalization and whitespace.")); |
4333 | 6272 } |
6273 } | |
6274 | |
5575 | 6275 static void oscar_show_format_screenname(GaimConnection *gc) |
4333 | 6276 { |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6277 gaim_request_input(gc, NULL, _("New screenname formatting:"), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6278 gaim_connection_get_display_name(gc), FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6279 _("OK"), G_CALLBACK(oscar_format_screenname), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6280 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6281 gc); |
4333 | 6282 } |
6283 | |
5575 | 6284 static void oscar_confirm_account(GaimConnection *gc) |
4333 | 6285 { |
7283 | 6286 OscarData *od = gc->proto_data; |
4333 | 6287 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6288 | |
6289 if (conn) { | |
6290 aim_admin_reqconfirm(od->sess, conn); | |
6291 } else { | |
6292 od->conf = TRUE; | |
6293 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6294 } | |
6295 } | |
6296 | |
5575 | 6297 static void oscar_show_email(GaimConnection *gc) |
4333 | 6298 { |
7283 | 6299 OscarData *od = gc->proto_data; |
4333 | 6300 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6301 | |
6302 if (conn) { | |
6303 aim_admin_getinfo(od->sess, conn, 0x11); | |
6304 } else { | |
6305 od->reqemail = TRUE; | |
6306 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6307 } | |
6308 } | |
6309 | |
5575 | 6310 static void oscar_change_email(GaimConnection *gc, const char *email) |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6311 { |
7283 | 6312 OscarData *od = gc->proto_data; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6313 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
|
6314 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6315 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6316 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6317 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6318 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6319 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6320 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6321 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6322 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6323 |
5575 | 6324 static void oscar_show_change_email(GaimConnection *gc) |
4333 | 6325 { |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6326 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, |
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6327 FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6328 _("OK"), G_CALLBACK(oscar_change_email), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6329 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6330 gc); |
4333 | 6331 } |
6332 | |
5575 | 6333 static void oscar_show_awaitingauth(GaimConnection *gc) |
4333 | 6334 { |
7283 | 6335 OscarData *od = gc->proto_data; |
4333 | 6336 gchar *nombre, *text, *tmp; |
6695 | 6337 GaimBlistNode *gnode, *cnode, *bnode; |
4333 | 6338 int num=0; |
6339 | |
6873 | 6340 text = g_strdup(""); |
4333 | 6341 |
4785 | 6342 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
6695 | 6343 GaimGroup *group = (GaimGroup *)gnode; |
4785 | 6344 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
6345 continue; | |
6695 | 6346 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
6347 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 6348 continue; |
6695 | 6349 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
6350 GaimBuddy *buddy = (GaimBuddy *)bnode; | |
6351 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
6352 continue; | |
6353 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { | |
6354 if (gaim_get_buddy_alias_only(buddy)) | |
6355 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
6356 else | |
6357 nombre = g_strdup_printf(" %s", buddy->name); | |
6873 | 6358 tmp = g_strdup_printf("%s%s<br>", text, nombre); |
6695 | 6359 g_free(text); |
6360 text = tmp; | |
6361 g_free(nombre); | |
6362 num++; | |
6363 } | |
4333 | 6364 } |
2979 | 6365 } |
4333 | 6366 } |
6367 | |
6368 if (!num) { | |
6369 g_free(text); | |
6873 | 6370 text = g_strdup(_("<i>you are not waiting for authorization</i>")); |
6371 } | |
6372 | |
6373 gaim_notify_formatted(gc, NULL, _("You are awaiting authorization from " | |
6374 "the following buddies"), _("You can re-request " | |
6375 "authorization from these buddies by " | |
6376 "right-clicking on them and selecting " | |
6377 "\"Re-request Authorization.\""), text, NULL, NULL); | |
4333 | 6378 g_free(text); |
2979 | 6379 } |
6380 | |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6381 static void search_by_email_cb(GaimConnection *gc, const char *email) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6382 { |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6383 serv_dir_search(gc, "", "", "", "", "", "", "", email); |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6384 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6385 |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6386 static void oscar_show_find_email(GaimConnection *gc) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6387 { |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6388 gaim_request_input(gc, _("Find Buddy by E-mail"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6389 _("Search for a buddy by e-mail address"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6390 _("Type the e-mail address of the buddy you are " |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6391 "searching for."), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6392 NULL, FALSE, FALSE, |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6393 _("Search"), G_CALLBACK(search_by_email_cb), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6394 _("Cancel"), NULL, gc); |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6395 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6396 |
7366 | 6397 #if 0 |
5917 | 6398 static void oscar_setavailmsg(GaimConnection *gc, char *text) { |
7283 | 6399 OscarData *od = (OscarData *)gc->proto_data; |
5917 | 6400 |
7334 | 6401 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
5917 | 6402 aim_srv_setavailmsg(od->sess, text); |
6403 } | |
6404 | |
6405 static void oscar_show_setavailmsg(GaimConnection *gc) | |
6406 { | |
7313 | 6407 gaim_request_input(gc, NULL, _("Available Message:"), NULL, |
6408 _("I'm doing work and hoping for a distraction--IM me!"), | |
6409 TRUE, FALSE, | |
5917 | 6410 _("OK"), G_CALLBACK(oscar_setavailmsg), |
6411 _("Cancel"), NULL, | |
6412 gc); | |
6413 } | |
7366 | 6414 #endif |
5917 | 6415 |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6416 static void oscar_show_set_info(GaimConnection *gc) |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6417 { |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6418 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6419 } |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6420 |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6421 static void oscar_change_pass(GaimConnection *gc) |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6422 { |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6423 gaim_account_request_change_password(gaim_connection_get_account(gc)); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6424 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6425 |
5575 | 6426 static void oscar_show_chpassurl(GaimConnection *gc) |
4333 | 6427 { |
7283 | 6428 OscarData *od = gc->proto_data; |
5575 | 6429 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6400
diff
changeset
|
6430 gaim_notify_uri(gc, substituted); |
5517 | 6431 g_free(substituted); |
4333 | 6432 } |
6433 | |
7026 | 6434 static void oscar_show_imforwardingurl(GaimConnection *gc) |
6435 { | |
6436 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); | |
6437 } | |
6438 | |
5842 | 6439 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) |
6440 { | |
7283 | 6441 OscarData *od = gc->proto_data; |
5844 | 6442 aim_session_t *sess = od->sess; |
5842 | 6443 FILE *file; |
6444 struct stat st; | |
5844 | 6445 |
6039 | 6446 if (iconfile == NULL) { |
6447 /* Set an empty icon, or something */ | |
6448 } else if (!stat(iconfile, &st)) { | |
5842 | 6449 char *buf = g_malloc(st.st_size); |
6450 file = fopen(iconfile, "rb"); | |
6451 if (file) { | |
6052 | 6452 md5_state_t *state; |
6039 | 6453 char md5[16]; |
5842 | 6454 int len = fread(buf, 1, st.st_size, file); |
6039 | 6455 fclose(file); |
6052 | 6456 state = g_malloc(sizeof(md5_state_t)); |
5842 | 6457 md5_init(state); |
6458 md5_append(state, buf, len); | |
6459 md5_finish(state, md5); | |
6460 g_free(state); | |
6461 aim_ssi_seticon(sess, md5, 16); | |
6462 } else | |
6463 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6464 "Can't open buddy icon file!\n"); | |
6465 g_free(buf); | |
6466 } else | |
6467 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6468 "Can't stat buddy icon file!\n"); | |
6469 } | |
6470 | |
6471 | |
5575 | 6472 static GList *oscar_actions(GaimConnection *gc) |
2086 | 6473 { |
7283 | 6474 OscarData *od = gc->proto_data; |
4333 | 6475 struct proto_actions_menu *pam; |
6476 GList *m = NULL; | |
6477 | |
6478 pam = g_new0(struct proto_actions_menu, 1); | |
6479 pam->label = _("Set User Info"); | |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6480 pam->callback = oscar_show_set_info; |
4333 | 6481 pam->gc = gc; |
6482 m = g_list_append(m, pam); | |
6483 | |
7366 | 6484 #if 0 |
5917 | 6485 pam = g_new0(struct proto_actions_menu, 1); |
6486 pam->label = _("Set Available Message"); | |
6487 pam->callback = oscar_show_setavailmsg; | |
6488 pam->gc = gc; | |
6489 m = g_list_append(m, pam); | |
7366 | 6490 #endif |
5917 | 6491 |
5238 | 6492 pam = g_new0(struct proto_actions_menu, 1); |
6493 pam->label = _("Change Password"); | |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6494 pam->callback = oscar_change_pass; |
5238 | 6495 pam->gc = gc; |
6496 m = g_list_append(m, pam); | |
4617 | 6497 |
6498 if (od->sess->authinfo->chpassurl) { | |
6499 pam = g_new0(struct proto_actions_menu, 1); | |
6500 pam->label = _("Change Password (URL)"); | |
6501 pam->callback = oscar_show_chpassurl; | |
6502 pam->gc = gc; | |
6503 m = g_list_append(m, pam); | |
6504 } | |
6505 | |
7026 | 6506 if (od->sess->authinfo->chpassurl) { |
6507 pam = g_new0(struct proto_actions_menu, 1); | |
6508 pam->label = _("Configure IM Forwarding (URL)"); | |
6509 pam->callback = oscar_show_imforwardingurl; | |
6510 pam->gc = gc; | |
6511 m = g_list_append(m, pam); | |
6512 } | |
6513 | |
5238 | 6514 if (!od->icq) { |
4617 | 6515 /* AIM actions */ |
6516 m = g_list_append(m, NULL); | |
4333 | 6517 |
5917 | 6518 pam = g_new0(struct proto_actions_menu, 1); |
4333 | 6519 pam->label = _("Format Screenname"); |
5844 | 6520 pam->callback = oscar_show_format_screenname; |
4333 | 6521 pam->gc = gc; |
6522 m = g_list_append(m, pam); | |
6523 | |
6524 pam = g_new0(struct proto_actions_menu, 1); | |
6525 pam->label = _("Confirm Account"); | |
6526 pam->callback = oscar_confirm_account; | |
6527 pam->gc = gc; | |
6528 m = g_list_append(m, pam); | |
6529 | |
6530 pam = g_new0(struct proto_actions_menu, 1); | |
6531 pam->label = _("Display Current Registered Address"); | |
6532 pam->callback = oscar_show_email; | |
6533 pam->gc = gc; | |
6534 m = g_list_append(m, pam); | |
6535 | |
6536 pam = g_new0(struct proto_actions_menu, 1); | |
6537 pam->label = _("Change Current Registered Address"); | |
6538 pam->callback = oscar_show_change_email; | |
6539 pam->gc = gc; | |
6540 m = g_list_append(m, pam); | |
2086 | 6541 } |
4333 | 6542 |
6543 m = g_list_append(m, NULL); | |
6544 | |
6545 pam = g_new0(struct proto_actions_menu, 1); | |
6546 pam->label = _("Show Buddies Awaiting Authorization"); | |
6547 pam->callback = oscar_show_awaitingauth; | |
6548 pam->gc = gc; | |
6549 m = g_list_append(m, pam); | |
6550 | |
2086 | 6551 m = g_list_append(m, NULL); |
4333 | 6552 |
6553 pam = g_new0(struct proto_actions_menu, 1); | |
6554 pam->label = _("Search for Buddy by Email"); | |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6555 pam->callback = oscar_show_find_email; |
4333 | 6556 pam->gc = gc; |
6557 m = g_list_append(m, pam); | |
6558 | |
4336 | 6559 /* pam = g_new0(struct proto_actions_menu, 1); |
4333 | 6560 pam->label = _("Search for Buddy by Information"); |
6561 pam->callback = show_find_info; | |
6562 pam->gc = gc; | |
4336 | 6563 m = g_list_append(m, pam); */ |
2086 | 6564 |
6565 return m; | |
6566 } | |
6567 | |
5575 | 6568 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2086 | 6569 { |
7283 | 6570 OscarData *od = gc->proto_data; |
4617 | 6571 |
6572 if (od->icq) { | |
6573 aim_icq_changepasswd(od->sess, new); | |
2086 | 6574 } else { |
4617 | 6575 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6576 if (conn) { | |
6577 aim_admin_changepasswd(od->sess, conn, new, old); | |
6578 } else { | |
6579 od->chpass = TRUE; | |
6580 od->oldp = g_strdup(old); | |
6581 od->newp = g_strdup(new); | |
6582 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6583 } | |
2086 | 6584 } |
6585 } | |
6586 | |
6059 | 6587 static void oscar_convo_closed(GaimConnection *gc, const char *who) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6588 { |
7283 | 6589 OscarData *od = gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6590 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6591 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6592 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6593 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6594 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6595 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6596 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6597 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6598 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6599 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6600 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6601 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6602 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6603 GAIM_PROTO_OSCAR, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6604 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
|
6605 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6606 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6607 oscar_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6608 oscar_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6609 oscar_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6610 oscar_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6611 oscar_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6612 oscar_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6613 oscar_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6614 oscar_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6615 oscar_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6616 oscar_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6617 oscar_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6618 oscar_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6619 oscar_send_typing, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6620 oscar_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6621 oscar_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6622 oscar_get_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6623 oscar_set_dir, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6624 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6625 oscar_dir_search, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6626 oscar_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6627 oscar_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6628 oscar_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6629 oscar_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6630 oscar_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6631 oscar_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6632 oscar_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6633 oscar_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6634 oscar_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6635 oscar_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6636 oscar_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6637 oscar_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6638 oscar_join_chat, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6639 oscar_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6640 oscar_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6641 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6642 oscar_chat_send, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6643 oscar_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6644 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6645 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6646 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6647 #ifndef NOSSI |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6648 oscar_alias_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6649 oscar_move_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6650 oscar_rename_group, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6651 #else |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6652 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6653 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6654 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6655 #endif |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6656 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6657 oscar_convo_closed, |
5842 | 6658 NULL, |
6659 oscar_set_icon | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6660 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6661 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6662 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6663 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6664 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6665 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6666 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6667 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6668 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6669 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6670 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6671 "prpl-oscar", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6672 "AIM/ICQ", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6673 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6674 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6675 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6676 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6677 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6678 NULL, /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
6679 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6680 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6681 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6682 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6683 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6684 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6685 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6686 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6687 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6688 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6689 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6690 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6691 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6692 GaimAccountOption *option; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6693 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6694 option = gaim_account_option_string_new(_("Auth host"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6695 "login.oscar.aol.com"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6696 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6697 option); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6698 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6699 option = gaim_account_option_int_new(_("Auth port"), "port", 5190); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6700 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6701 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6702 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6703 my_protocol = plugin; |
2086 | 6704 } |
6705 | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6706 GAIM_INIT_PLUGIN(oscar, init_plugin, info); |