Mercurial > pidgin.yaz
annotate src/protocols/oscar/oscar.c @ 8282:ab35a0bec13a
[gaim-migrate @ 9006]
" This works around the crash on trying to send a file
that's too big, by giving an error. It also makes Gaim
not crash on canceling the send right there.
It doesn't fix the crash on the server doing whatever
it did to make us crash. Someone should send me a
backtrace of trying to send say a 2meg file without
this patch." --Tim Ringenbach
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Tue, 17 Feb 2004 18:45:25 +0000 |
parents | f24172f53650 |
children | ef881489396e |
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 | |
8151 | 7 * Some code copyright (C) 2001-2004, Mark Doliner <thekingant@users.sourceforge.net> |
6302 | 8 * |
9 * Most libfaim code copyright (C) 1998-2001 Adam Fritzler <afritz@auk.cx> | |
8151 | 10 * Some libfaim code copyright (C) 2001-2004 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" |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8227
diff
changeset
|
38 #include "network.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
39 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
40 #include "privacy.h" |
2086 | 41 #include "prpl.h" |
4889 | 42 #include "proxy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
43 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
44 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
45 |
2086 | 46 #include "aim.h" |
5842 | 47 #include "md5.h" |
2086 | 48 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
49 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
50 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
51 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
52 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
53 #define UC_AB 0x20 |
3079 | 54 #define UC_WIRELESS 0x40 |
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 *, ...); | |
8227 | 261 static int gaim_ssi_parseadd (aim_session_t *, aim_frame_t *, ...); |
5129 | 262 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); |
263 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
264 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
265 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
266 #endif | |
267 | |
268 /* for DirectIM/image transfer */ | |
269 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
270 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
271 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
6982 | 272 static int gaim_odc_update_ui (aim_session_t *, aim_frame_t *, ...); |
5129 | 273 |
274 /* for file transfer */ | |
275 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
276 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
277 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
278 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
279 | |
280 /* for icons */ | |
281 static gboolean gaim_icon_timerfunc(gpointer data); | |
282 | |
8076 | 283 /* remove these at some point? */ |
7282 | 284 /* Because I don't like forward declarations? I think that was why... */ |
5954 | 285 static void oscar_set_info(GaimConnection *gc, const char *text); |
8076 | 286 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message); |
5306 | 287 |
5836 | 288 static void oscar_free_name_data(struct name_data *data) { |
4230 | 289 g_free(data->name); |
290 g_free(data->nick); | |
291 g_free(data); | |
292 } | |
293 | |
5836 | 294 static void oscar_free_buddyinfo(void *data) { |
295 struct buddyinfo *bi = data; | |
6292 | 296 g_free(bi->availmsg); |
5836 | 297 g_free(bi); |
298 } | |
299 | |
5129 | 300 static fu32_t oscar_encoding_check(const char *utf8) |
301 { | |
302 int i = 0; | |
303 fu32_t encodingflag = 0; | |
304 | |
305 /* Determine how we can send this message. Per the warnings elsewhere | |
306 * in this file, these little checks determine the simplest encoding | |
307 * we can use for a given message send using it. */ | |
308 while (utf8[i]) { | |
309 if ((unsigned char)utf8[i] > 0x7f) { | |
310 /* not ASCII! */ | |
311 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
312 break; | |
313 } | |
314 i++; | |
315 } | |
316 while (utf8[i]) { | |
317 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
318 * followed by 0xc0-0xc3 in the second */ | |
319 if ((unsigned char)utf8[i] < 0x80) { | |
320 i++; | |
321 continue; | |
322 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
323 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
324 i += 2; | |
325 continue; | |
326 } | |
327 encodingflag = AIM_IMFLAGS_UNICODE; | |
328 break; | |
329 } | |
330 | |
331 return encodingflag; | |
332 } | |
333 | |
8225 | 334 /* |
335 * Take a string of the form charset="bleh" where bleh is | |
336 * one of us-ascii, utf-8, iso-8859-1, or unicode-2-0, and | |
337 * return a newly allocated string containing bleh. | |
338 */ | |
339 static gchar *oscar_encoding_extract(const char *encoding) | |
5129 | 340 { |
8225 | 341 gchar *ret = NULL; |
342 char *begin, *end; | |
343 | |
344 /* Make sure encoding begings with charset= */ | |
345 if (strncmp(encoding, "text/aolrtf; charset=", 21)) | |
346 return NULL; | |
347 | |
348 begin = strchr(encoding, '"'); | |
349 end = strrchr(encoding, '"'); | |
350 | |
351 if ((begin == NULL) || (end == NULL) || (begin >= end)) | |
352 return NULL; | |
353 | |
354 ret = g_strndup(begin+1, (end-1) - begin); | |
355 | |
356 return ret; | |
357 } | |
358 | |
359 /* | |
360 * Return the flag specifying the given encoding. | |
361 */ | |
362 static fu32_t oscar_encoding_parse(const char *encoding) | |
363 { | |
364 if ((encoding == NULL) || encoding[0] == '\0') { | |
365 gaim_debug(GAIM_DEBUG_WARNING, "oscar", "Empty encoding, assuming ASCII\n"); | |
5129 | 366 return 0; |
367 } | |
8225 | 368 |
369 if (!strcmp(encoding, "us-ascii") || !strcmp(encoding, "utf-8")) { | |
370 /* UTF-8 is our native encoding, ASCII is a proper subset */ | |
5129 | 371 return 0; |
8225 | 372 } else if (!strcmp(encoding, "iso-8859-1")) { |
5129 | 373 return AIM_IMFLAGS_ISO_8859_1; |
8225 | 374 } else if (!strcmp(encoding, "unicode-2-0")) { |
5129 | 375 return AIM_IMFLAGS_UNICODE; |
376 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
377 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
8250 | 378 "Unrecognized character encoding '%s', attempting to convert to utf8 anyway\n", encoding); |
379 return 99; | |
5129 | 380 } |
381 } | |
382 | |
8233 | 383 gchar *oscar_encoding_to_utf8(const char *encoding, const char *text, int textlen) |
5129 | 384 { |
385 gchar *utf8 = NULL; | |
386 int flags = oscar_encoding_parse(encoding); | |
387 | |
388 switch (flags) { | |
389 case 0: | |
8250 | 390 utf8 = g_convert(text, textlen, "UTF-8", "UTF-8", NULL, NULL, NULL); |
5129 | 391 break; |
392 case AIM_IMFLAGS_ISO_8859_1: | |
393 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
394 break; | |
395 case AIM_IMFLAGS_UNICODE: | |
396 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
397 break; | |
8250 | 398 case 99: |
399 utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL); | |
400 if (utf8 == NULL) { | |
401 utf8 = g_convert(text, textlen, "UTF-8", "UTF-8", NULL, NULL, NULL); | |
402 } | |
403 break; | |
5129 | 404 } |
405 | |
406 return utf8; | |
407 } | |
408 | |
7283 | 409 static struct direct_im *find_direct_im(OscarData *od, const char *who) { |
2086 | 410 GSList *d = od->direct_ims; |
411 struct direct_im *m = NULL; | |
412 | |
413 while (d) { | |
414 m = (struct direct_im *)d->data; | |
4355 | 415 if (!aim_sncmp(who, m->name)) |
4269 | 416 return m; |
2086 | 417 d = d->next; |
418 } | |
419 | |
4269 | 420 return NULL; |
2086 | 421 } |
422 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
423 static char *extract_name(const char *name) { |
4121 | 424 char *tmp, *x; |
2086 | 425 int i, j; |
4120 | 426 |
427 if (!name) | |
4121 | 428 return NULL; |
429 | |
4120 | 430 x = strchr(name, '-'); |
4121 | 431 |
2086 | 432 if (!x) return NULL; |
433 x = strchr(++x, '-'); | |
434 if (!x) return NULL; | |
435 tmp = g_strdup(++x); | |
436 | |
437 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
438 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
439 if (x[i] != '%') { |
2086 | 440 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
441 continue; |
2086 | 442 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
443 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
444 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
445 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 446 } |
447 | |
448 tmp[j] = 0; | |
449 return tmp; | |
450 } | |
451 | |
5575 | 452 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
7283 | 453 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 454 struct chat_connection *c = NULL; |
455 | |
456 while (g) { | |
457 c = (struct chat_connection *)g->data; | |
458 if (c->id == id) | |
459 break; | |
460 g = g->next; | |
461 c = NULL; | |
462 } | |
463 | |
464 return c; | |
465 } | |
466 | |
5575 | 467 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
|
468 aim_conn_t *conn) { |
7283 | 469 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 470 struct chat_connection *c = NULL; |
471 | |
472 while (g) { | |
473 c = (struct chat_connection *)g->data; | |
474 if (c->conn == conn) | |
475 break; | |
476 g = g->next; | |
477 c = NULL; | |
478 } | |
479 | |
480 return c; | |
481 } | |
482 | |
8219 | 483 static struct chat_connection *find_oscar_chat_by_conv(GaimConnection *gc, |
484 GaimConversation *conv) { | |
485 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; | |
486 struct chat_connection *c = NULL; | |
487 | |
488 while (g) { | |
489 c = (struct chat_connection *)g->data; | |
490 if (c->cnv == conv) | |
491 break; | |
492 g = g->next; | |
493 c = NULL; | |
494 } | |
495 | |
496 return c; | |
497 } | |
498 | |
4617 | 499 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
5575 | 500 GaimConnection *gc = sess->aux_data; |
7283 | 501 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 502 GaimConversation *cnv; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
503 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
504 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
505 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
506 |
4617 | 507 sn = g_strdup(aim_odc_getsn(conn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
508 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
509 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
510 "%s disconnected Direct IM.\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
511 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
512 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
513 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
514 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
515 |
3008 | 516 if (dim->connected) |
517 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
518 else | |
519 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
|
520 |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
521 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
|
522 if (cnv) |
6982 | 523 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
|
524 |
5579 | 525 gaim_conversation_update_progress(cnv, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
526 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
527 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
|
528 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
529 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
530 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
531 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
532 |
4617 | 533 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
534 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
535 aim_session_t *sess = aim_conn_getsess(conn); |
5575 | 536 GaimConnection *gc = sess ? sess->aux_data : NULL; |
7283 | 537 OscarData *od; |
2086 | 538 |
539 if (!gc) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
540 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
541 "oscar callback for closed connection (1).\n"); |
2086 | 542 return; |
543 } | |
544 | |
7283 | 545 od = (OscarData *)gc->proto_data; |
2086 | 546 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
547 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 548 /* oh boy. this is probably bad. i guess the only thing we |
549 * can really do is return? */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
550 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
551 "oscar callback for closed connection (2).\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
552 gaim_debug(GAIM_DEBUG_MISC, "oscar", "gc = %p\n", gc); |
2086 | 553 return; |
554 } | |
555 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
556 if (condition & GAIM_INPUT_READ) { |
4617 | 557 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
558 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
559 "got information on rendezvous listener\n"); |
4617 | 560 if (aim_handlerendconnect(od->sess, conn) < 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
561 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
562 "connection error (rendezvous listener)\n"); |
4617 | 563 aim_conn_kill(od->sess, &conn); |
2086 | 564 } |
565 } else { | |
4617 | 566 if (aim_get_command(od->sess, conn) >= 0) { |
567 aim_rxdispatch(od->sess); | |
6029 | 568 if (od->killme) { |
569 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Waiting to be destroyed\n"); | |
570 return; | |
571 } | |
2086 | 572 } else { |
573 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 574 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
575 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
576 "major connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
577 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 578 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
579 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
5420 | 580 char *buf; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
581 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
582 "disconnected from chat room %s\n", c->name); |
2086 | 583 c->conn = NULL; |
584 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
585 gaim_input_remove(c->inpa); |
2086 | 586 c->inpa = 0; |
587 c->fd = -1; | |
4617 | 588 aim_conn_kill(od->sess, &conn); |
5420 | 589 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
|
590 gaim_notify_error(gc, NULL, buf, NULL); |
5420 | 591 g_free(buf); |
2086 | 592 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 593 if (od->cnpa > 0) |
594 gaim_input_remove(od->cnpa); | |
595 od->cnpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
596 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
597 "removing chatnav input watcher\n"); |
4617 | 598 while (od->create_rooms) { |
599 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
600 g_free(cr->name); |
4617 | 601 od->create_rooms = |
602 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
603 g_free(cr); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
604 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
605 _("Chat is currently unavailable"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
606 NULL); |
2086 | 607 } |
4617 | 608 aim_conn_kill(od->sess, &conn); |
2086 | 609 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 610 if (od->paspa > 0) |
611 gaim_input_remove(od->paspa); | |
612 od->paspa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
613 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
614 "removing authconn input watcher\n"); |
4617 | 615 aim_conn_kill(od->sess, &conn); |
3694 | 616 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 617 if (od->emlpa > 0) |
618 gaim_input_remove(od->emlpa); | |
619 od->emlpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
620 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
621 "removing email input watcher\n"); |
4617 | 622 aim_conn_kill(od->sess, &conn); |
4804 | 623 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
624 if (od->icopa > 0) | |
625 gaim_input_remove(od->icopa); | |
626 od->icopa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
627 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
628 "removing icon input watcher\n"); |
4804 | 629 aim_conn_kill(od->sess, &conn); |
2086 | 630 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
631 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 632 gaim_odc_disconnect(od->sess, conn); |
633 aim_conn_kill(od->sess, &conn); | |
2086 | 634 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
635 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
636 "holy crap! generic connection error! %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
637 conn->type); |
4617 | 638 aim_conn_kill(od->sess, &conn); |
2086 | 639 } |
640 } | |
641 } | |
642 } | |
643 } | |
644 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
645 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
5575 | 646 GaimConnection *gc = sess->aux_data; |
7285 | 647 gchar *s = g_strdup_vprintf(format, va); |
648 gchar *buf; | |
649 | |
650 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s); | |
651 gaim_debug(GAIM_DEBUG_INFO, "oscar", buf); | |
652 if (buf[strlen(buf)-1] != '\n') | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
653 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
7285 | 654 g_free(buf); |
2086 | 655 g_free(s); |
656 } | |
657 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
658 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 659 { |
5575 | 660 GaimConnection *gc = data; |
7283 | 661 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
662 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
663 aim_conn_t *conn; |
2086 | 664 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
665 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 666 close(source); |
667 return; | |
668 } | |
669 | |
4617 | 670 od = gc->proto_data; |
671 sess = od->sess; | |
2086 | 672 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 673 conn->fd = source; |
2086 | 674 |
675 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
676 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 677 return; |
678 } | |
679 | |
680 aim_conn_completeconnect(sess, conn); | |
4617 | 681 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
7282 | 682 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); |
683 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
684 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
7282 | 685 "Screen name sent, waiting for response\n"); |
7283 | 686 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); |
2086 | 687 } |
688 | |
5575 | 689 static void oscar_login(GaimAccount *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
690 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
691 aim_conn_t *conn; |
5575 | 692 GaimConnection *gc = gaim_account_get_connection(account); |
7283 | 693 OscarData *od = gc->proto_data = g_new0(OscarData, 1); |
2086 | 694 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
695 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
|
696 |
5575 | 697 if (isdigit(*(gaim_account_get_username(account)))) { |
4617 | 698 od->icq = TRUE; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
699 } else { |
6622 | 700 gc->flags |= GAIM_CONNECTION_HTML; |
701 gc->flags |= GAIM_CONNECTION_AUTO_RESP; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
702 } |
5836 | 703 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
2086 | 704 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
705 sess = g_new0(aim_session_t, 1); |
7285 | 706 aim_session_init(sess, TRUE, 0); |
2086 | 707 aim_setdebuggingcb(sess, oscar_debug); |
7282 | 708 /* |
709 * We need an immediate queue because we don't use a while-loop | |
710 * to see if things need to be sent. | |
711 */ | |
2086 | 712 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); |
4617 | 713 od->sess = sess; |
2086 | 714 sess->aux_data = gc; |
715 | |
716 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
717 if (conn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
718 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
719 "internal connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
720 gaim_connection_error(gc, _("Unable to login to AIM")); |
2086 | 721 return; |
722 } | |
723 | |
4649 | 724 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 725 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
726 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
727 | |
728 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
729 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
5575 | 730 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
731 oscar_login_connect, gc) < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
732 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 733 return; |
734 } | |
7282 | 735 |
7283 | 736 gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); |
5575 | 737 } |
738 | |
739 static void oscar_close(GaimConnection *gc) { | |
7283 | 740 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 741 |
742 while (od->oscar_chats) { | |
743 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 744 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
745 gaim_input_remove(n->inpa); |
2086 | 746 g_free(n->name); |
747 g_free(n->show); | |
4617 | 748 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 749 g_free(n); |
750 } | |
4617 | 751 while (od->direct_ims) { |
752 struct direct_im *n = od->direct_ims->data; | |
2086 | 753 if (n->watcher > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
754 gaim_input_remove(n->watcher); |
4617 | 755 od->direct_ims = g_slist_remove(od->direct_ims, n); |
2086 | 756 g_free(n); |
757 } | |
4617 | 758 /* BBB */ |
759 while (od->file_transfers) { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
760 GaimXfer *xfer; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
761 xfer = (GaimXfer *)od->file_transfers->data; |
7805 | 762 gaim_xfer_cancel_local(xfer); |
3630 | 763 } |
4804 | 764 while (od->requesticon) { |
765 char *sn = od->requesticon->data; | |
766 od->requesticon = g_slist_remove(od->requesticon, sn); | |
767 free(sn); | |
768 } | |
4738 | 769 g_hash_table_destroy(od->buddyinfo); |
4617 | 770 while (od->create_rooms) { |
771 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
772 g_free(cr->name); |
4617 | 773 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
774 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
775 } |
4617 | 776 if (od->email) |
777 g_free(od->email); | |
778 if (od->newp) | |
779 g_free(od->newp); | |
780 if (od->oldp) | |
781 g_free(od->oldp); | |
2086 | 782 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
783 gaim_input_remove(gc->inpa); |
4617 | 784 if (od->cnpa > 0) |
785 gaim_input_remove(od->cnpa); | |
786 if (od->paspa > 0) | |
787 gaim_input_remove(od->paspa); | |
788 if (od->emlpa > 0) | |
789 gaim_input_remove(od->emlpa); | |
4804 | 790 if (od->icopa > 0) |
791 gaim_input_remove(od->icopa); | |
6907 | 792 if (od->icontimer > 0) |
4832 | 793 g_source_remove(od->icontimer); |
5968 | 794 if (od->getblisttimer) |
795 g_source_remove(od->getblisttimer); | |
4617 | 796 aim_session_kill(od->sess); |
797 g_free(od->sess); | |
798 od->sess = NULL; | |
2086 | 799 g_free(gc->proto_data); |
800 gc->proto_data = NULL; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
801 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
2086 | 802 } |
803 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
804 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 805 GaimConnection *gc = data; |
7283 | 806 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
807 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
808 aim_conn_t *bosconn; |
2086 | 809 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
810 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 811 close(source); |
812 return; | |
813 } | |
814 | |
4617 | 815 od = gc->proto_data; |
816 sess = od->sess; | |
817 bosconn = od->conn; | |
4366 | 818 bosconn->fd = source; |
2086 | 819 |
820 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
821 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 822 return; |
823 } | |
824 | |
825 aim_conn_completeconnect(sess, bosconn); | |
4617 | 826 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
7283 | 827 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
828 gaim_connection_update_progress(gc, |
7283 | 829 _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); |
2086 | 830 } |
831 | |
4617 | 832 /* BBB */ |
4656 | 833 /* |
834 * This little area in oscar.c is the nexus of file transfer code, | |
835 * so I wrote a little explanation of what happens. I am such a | |
836 * ninja. | |
837 * | |
838 * The series of events for a file send is: | |
839 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
840 * -User chooses a file and oscar_xfer_init is called. It establishs a | |
841 * listening socket, then asks the remote user to connect to us (and | |
842 * gives them the file name, port, IP, etc.) | |
843 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
844 * in oscar_sendfile_estblsh) | |
845 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
846 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
847 * connection. | |
848 * -We get drunk because file transfer kicks ass. | |
849 * | |
850 * The series of events for a file receive is: | |
851 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
852 * -Gaim user selects file to name and location to save file to and | |
853 * oscar_xfer_init is called | |
854 * -It connects to the remote user using the IP they gave us earlier | |
855 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
856 * them an AIM_CB_OFT_ACK. | |
857 * -They begin to send us lots of raw data. | |
858 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
859 * the connectionn. | |
860 */ | |
861 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
862 | |
863 /* XXX - This function is pretty ugly */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
864 static void oscar_xfer_init(GaimXfer *xfer) |
4656 | 865 { |
5146 | 866 struct aim_oft_info *oft_info = xfer->data; |
5575 | 867 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 868 OscarData *od = gc->proto_data; |
4656 | 869 |
870 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
8240 | 871 int listenfd; |
4656 | 872 |
873 xfer->filename = g_path_get_basename(xfer->local_filename); | |
5146 | 874 strncpy(oft_info->fh.name, xfer->filename, 64); |
875 oft_info->fh.totsize = gaim_xfer_get_size(xfer); | |
876 oft_info->fh.size = gaim_xfer_get_size(xfer); | |
877 oft_info->fh.checksum = aim_oft_checksum_file(xfer->local_filename); | |
4656 | 878 |
8240 | 879 /* Create a listening socket and an associated libfaim conn */ |
8246 | 880 if ((listenfd = gaim_network_listen_range(5190, 5199)) < 0) |
8240 | 881 return; |
882 xfer->local_port = gaim_network_get_port_from_fd(listenfd); | |
883 oft_info->port = xfer->local_port; | |
884 aim_sendfile_listen(od->sess, oft_info, listenfd); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
885 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
886 "port is %d, ip is %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
887 xfer->local_port, oft_info->clientip); |
5146 | 888 if (oft_info->conn) { |
889 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
890 aim_im_sendch2_sendfile_ask(od->sess, oft_info); | |
891 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
4656 | 892 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
893 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
894 _("Unable to establish listener socket.")); |
4656 | 895 /* 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
|
896 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 897 } |
898 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 899 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
900 if (oft_info->conn) { | |
901 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
902 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
|
903 oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc), xfer->remote_ip, xfer->remote_port, |
5575 | 904 oscar_sendfile_connected, xfer); |
4656 | 905 if (xfer->fd == -1) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
906 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
907 _("Unable to establish file descriptor.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
908 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 909 } |
910 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
911 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
912 _("Unable to create new connection.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
913 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 914 /* Try a different port? Ask them to connect to us? */ |
915 } | |
916 | |
917 } | |
918 } | |
919 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
920 static void oscar_xfer_start(GaimXfer *xfer) |
4656 | 921 { |
5146 | 922 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
923 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_start\n"); |
4656 | 924 /* I'm pretty sure we don't need to do jack here. Nor Jill. */ |
925 } | |
926 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
927 static void oscar_xfer_end(GaimXfer *xfer) |
4656 | 928 { |
5146 | 929 struct aim_oft_info *oft_info = xfer->data; |
5575 | 930 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 931 OscarData *od = gc->proto_data; |
4656 | 932 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
933 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
5146 | 934 |
935 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
936 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | |
937 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); | |
938 } | |
939 | |
940 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
941 aim_oft_destroyinfo(oft_info); | |
4656 | 942 xfer->data = NULL; |
5146 | 943 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 944 } |
945 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
946 static void oscar_xfer_cancel_send(GaimXfer *xfer) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
947 { |
5146 | 948 struct aim_oft_info *oft_info = xfer->data; |
5575 | 949 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 950 OscarData *od = gc->proto_data; |
4763 | 951 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
952 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
953 "AAA - in oscar_xfer_cancel_send\n"); |
5146 | 954 |
955 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
956 | |
957 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
958 aim_oft_destroyinfo(oft_info); | |
4763 | 959 xfer->data = NULL; |
5146 | 960 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
961 } |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
962 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
963 static void oscar_xfer_cancel_recv(GaimXfer *xfer) |
4656 | 964 { |
5146 | 965 struct aim_oft_info *oft_info = xfer->data; |
5575 | 966 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 967 OscarData *od = gc->proto_data; |
4656 | 968 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
969 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
970 "AAA - in oscar_xfer_cancel_recv\n"); |
5146 | 971 |
972 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
973 | |
974 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
975 aim_oft_destroyinfo(oft_info); | |
4656 | 976 xfer->data = NULL; |
5146 | 977 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 978 } |
979 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
980 static void oscar_xfer_ack(GaimXfer *xfer, const char *buffer, size_t size) |
4656 | 981 { |
5146 | 982 struct aim_oft_info *oft_info = xfer->data; |
4656 | 983 |
984 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
985 /* | |
986 * If we're done sending, intercept the socket from the core ft code | |
987 * and wait for the other guy to send the "done" OFT packet. | |
988 */ | |
989 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
990 gaim_input_remove(xfer->watcher); | |
5146 | 991 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
4656 | 992 xfer->fd = 0; |
993 gaim_xfer_set_completed(xfer, TRUE); | |
994 } | |
995 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 996 /* Update our rolling checksum. Like Walmart, yo. */ |
997 oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); | |
4656 | 998 } |
999 } | |
1000 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1001 static GaimXfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) |
4656 | 1002 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1003 GaimXfer *xfer; |
5146 | 1004 struct aim_oft_info *oft_info; |
4656 | 1005 |
1006 while (fts) { | |
1007 xfer = fts->data; | |
5146 | 1008 oft_info = xfer->data; |
1009 | |
1010 if (oft_info && !strcmp(ck, oft_info->cookie)) | |
4656 | 1011 return xfer; |
1012 | |
1013 fts = g_slist_next(fts); | |
1014 } | |
1015 | |
1016 return NULL; | |
1017 } | |
1018 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1019 static GaimXfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
4656 | 1020 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1021 GaimXfer *xfer; |
5146 | 1022 struct aim_oft_info *oft_info; |
4656 | 1023 |
1024 while (fts) { | |
1025 xfer = fts->data; | |
5146 | 1026 oft_info = xfer->data; |
1027 | |
1028 if (oft_info && (conn == oft_info->conn)) | |
4656 | 1029 return xfer; |
1030 | |
1031 fts = g_slist_next(fts); | |
1032 } | |
1033 | |
1034 return NULL; | |
1035 } | |
1036 | |
5575 | 1037 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
7283 | 1038 OscarData *od = (OscarData *)gc->proto_data; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8227
diff
changeset
|
1039 GaimAccount *account = gaim_connection_get_account(gc); |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1040 GaimXfer *xfer; |
5146 | 1041 struct aim_oft_info *oft_info; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8227
diff
changeset
|
1042 const char *ip; |
3752 | 1043 |
4617 | 1044 /* You want to send a file to someone else, you're so generous */ |
1045 | |
1046 /* Build the file transfer handle */ | |
5575 | 1047 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
4617 | 1048 |
5146 | 1049 /* Create the oscar-specific data */ |
8240 | 1050 ip = gaim_network_get_ip_for_account(account, od->conn ? od->conn->fd : -1); |
1051 oft_info = aim_oft_createinfo(od->sess, NULL, destsn, ip, 0, 0, 0, NULL); | |
5146 | 1052 xfer->data = oft_info; |
1053 | |
4617 | 1054 /* Setup our I/O op functions */ |
1055 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
1056 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
1057 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1058 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1059 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4656 | 1060 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
4617 | 1061 |
1062 /* Keep track of this transfer for later */ | |
1063 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1064 | |
1065 /* Now perform the request */ | |
1066 gaim_xfer_request(xfer); | |
3630 | 1067 } |
1068 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1069 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
6029 | 1070 GaimConnection *gc = sess->aux_data; |
7283 | 1071 OscarData *od = gc->proto_data; |
6029 | 1072 GaimAccount *account = gc->account; |
1073 aim_conn_t *bosconn; | |
1074 char *host; int port; | |
1075 int i, rc; | |
2086 | 1076 va_list ap; |
2704 | 1077 struct aim_authresp_info *info; |
6029 | 1078 |
5575 | 1079 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1080 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1081 va_start(ap, fr); |
2704 | 1082 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 1083 va_end(ap); |
1084 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1085 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1086 "inside auth_resp (Screen name: %s)\n", info->sn); |
2704 | 1087 |
4293 | 1088 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
4056 | 1089 char buf[256]; |
2704 | 1090 switch (info->errorcode) { |
2086 | 1091 case 0x05: |
1092 /* Incorrect nick/password */ | |
6498 | 1093 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1094 gaim_connection_error(gc, _("Incorrect nickname or password.")); |
2086 | 1095 break; |
1096 case 0x11: | |
1097 /* Suspended account */ | |
6498 | 1098 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1099 gaim_connection_error(gc, _("Your account is currently suspended.")); |
2086 | 1100 break; |
3498 | 1101 case 0x14: |
1102 /* service temporarily unavailable */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1103 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); |
3498 | 1104 break; |
2086 | 1105 case 0x18: |
1106 /* connecting too frequently */ | |
6498 | 1107 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1108 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 | 1109 break; |
1110 case 0x1c: | |
1111 /* client too old */ | |
6498 | 1112 gc->wants_to_die = TRUE; |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
1113 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
|
1114 gaim_connection_error(gc, buf); |
2086 | 1115 break; |
1116 default: | |
6623 | 1117 gaim_connection_error(gc, _("Authentication failed")); |
2086 | 1118 break; |
1119 } | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1120 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1121 "Login Error Code 0x%04hx\n", info->errorcode); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1122 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1123 "Error URL: %s\n", info->errorurl); |
2086 | 1124 od->killme = TRUE; |
1125 return 1; | |
1126 } | |
1127 | |
1128 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1129 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1130 "Reg status: %hu\n", info->regstatus); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1131 |
2704 | 1132 if (info->email) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1133 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email: %s\n", info->email); |
2086 | 1134 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1135 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email is NULL\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1136 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1137 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1138 gaim_debug(GAIM_DEBUG_MISC, "oscar", "BOSIP: %s\n", info->bosip); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1139 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1140 "Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1141 aim_conn_kill(sess, &fr->conn); |
2086 | 1142 |
1143 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
1144 if (bosconn == NULL) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1145 gaim_connection_error(gc, _("Internal Error")); |
2086 | 1146 od->killme = TRUE; |
1147 return 0; | |
1148 } | |
1149 | |
4649 | 1150 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1151 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 1152 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
1153 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
1154 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 1155 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 1156 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
1157 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
1158 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
1159 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
1160 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
1161 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 1162 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 1163 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
1164 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
1165 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
1166 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
1167 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 1168 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
7011 | 1169 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_userinfo, 0); |
2086 | 1170 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); |
1171 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
|
1172 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 1173 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
1174 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
1175 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
1176 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1177 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
5844 | 1178 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
|
1179 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
|
1180 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
|
1181 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4759 | 1182 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
4624 | 1183 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
4230 | 1184 #ifndef NOSSI |
4642 | 1185 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
2991 | 1186 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
1187 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
1188 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
4230 | 1189 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
8227 | 1190 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADD, gaim_ssi_parseadd, 0); |
4230 | 1191 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); |
1192 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | |
1193 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | |
1194 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | |
1195 #endif | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1196 |
7283 | 1197 od->conn = bosconn; |
2704 | 1198 for (i = 0; i < (int)strlen(info->bosip); i++) { |
1199 if (info->bosip[i] == ':') { | |
1200 port = atoi(&(info->bosip[i+1])); | |
2086 | 1201 break; |
1202 } | |
1203 } | |
2704 | 1204 host = g_strndup(info->bosip, i); |
2086 | 1205 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1206 rc = gaim_proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
2086 | 1207 g_free(host); |
4366 | 1208 if (rc < 0) { |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1209 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 1210 od->killme = TRUE; |
1211 return 0; | |
1212 } | |
4293 | 1213 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1214 gaim_input_remove(gc->inpa); |
2704 | 1215 |
7283 | 1216 gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); |
7282 | 1217 |
2086 | 1218 return 1; |
1219 } | |
1220 | |
7285 | 1221 /* XXX - Should use gaim_url_fetch for the below stuff */ |
2086 | 1222 struct pieceofcrap { |
5575 | 1223 GaimConnection *gc; |
2086 | 1224 unsigned long offset; |
1225 unsigned long len; | |
1226 char *modname; | |
1227 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1228 aim_conn_t *conn; |
2086 | 1229 unsigned int inpa; |
1230 }; | |
1231 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1232 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 1233 { |
1234 struct pieceofcrap *pos = data; | |
7283 | 1235 OscarData *od = pos->gc->proto_data; |
2086 | 1236 char in = '\0'; |
1237 int x = 0; | |
1238 unsigned char m[17]; | |
1239 | |
1240 while (read(pos->fd, &in, 1) == 1) { | |
1241 if (in == '\n') | |
1242 x++; | |
1243 else if (in != '\r') | |
1244 x = 0; | |
1245 if (x == 2) | |
1246 break; | |
1247 in = '\0'; | |
1248 } | |
1249 if (in != '\n') { | |
4056 | 1250 char buf[256]; |
1251 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
|
1252 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1253 gaim_notify_warning(pos->gc, NULL, |
7422 | 1254 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1255 buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1256 gaim_input_remove(pos->inpa); |
2086 | 1257 close(pos->fd); |
1258 g_free(pos); | |
1259 return; | |
1260 } | |
1261 read(pos->fd, m, 16); | |
1262 m[16] = '\0'; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1263 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Sending hash: "); |
2086 | 1264 for (x = 0; x < 16; x++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1265 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx ", (unsigned char)m[x]); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1266 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1267 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1268 gaim_input_remove(pos->inpa); |
2086 | 1269 close(pos->fd); |
1270 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
1271 g_free(pos); | |
1272 } | |
1273 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1274 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1275 struct pieceofcrap *pos = data; |
5420 | 1276 gchar *buf; |
2086 | 1277 |
4366 | 1278 pos->fd = source; |
1279 | |
2086 | 1280 if (source < 0) { |
5420 | 1281 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
|
1282 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1283 gaim_notify_warning(pos->gc, NULL, |
7422 | 1284 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1285 buf); |
5420 | 1286 g_free(buf); |
2086 | 1287 if (pos->modname) |
1288 g_free(pos->modname); | |
1289 g_free(pos); | |
1290 return; | |
1291 } | |
1292 | |
5420 | 1293 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", |
2086 | 1294 pos->offset, pos->len, pos->modname ? pos->modname : ""); |
1295 write(pos->fd, buf, strlen(buf)); | |
5420 | 1296 g_free(buf); |
2086 | 1297 if (pos->modname) |
1298 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1299 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 1300 return; |
1301 } | |
1302 | |
1303 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
1304 #define AIM_MAX_FILE_SIZE 98304 | |
1305 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1306 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1307 va_list ap; |
1308 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1309 fu32_t offset, len; |
2086 | 1310 char *modname; |
1311 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1312 va_start(ap, fr); |
4200 | 1313 offset = va_arg(ap, fu32_t); |
1314 len = va_arg(ap, fu32_t); | |
2086 | 1315 modname = va_arg(ap, char *); |
1316 va_end(ap); | |
1317 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1318 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 1319 "offset: %u, len: %u, file: %s\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1320 offset, len, (modname ? modname : "aim.exe")); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1321 |
2086 | 1322 if (len == 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1323 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
|
1324 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 1325 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1326 return 1; | |
1327 } | |
1328 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
1329 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
1330 char *buf; | |
1331 int i = 8; | |
1332 if (modname) | |
1333 i += strlen(modname); | |
1334 buf = g_malloc(i); | |
1335 i = 0; | |
1336 if (modname) { | |
1337 memcpy(buf, modname, strlen(modname)); | |
1338 i += strlen(modname); | |
1339 } | |
1340 buf[i++] = offset & 0xff; | |
1341 buf[i++] = (offset >> 8) & 0xff; | |
1342 buf[i++] = (offset >> 16) & 0xff; | |
1343 buf[i++] = (offset >> 24) & 0xff; | |
1344 buf[i++] = len & 0xff; | |
1345 buf[i++] = (len >> 8) & 0xff; | |
1346 buf[i++] = (len >> 16) & 0xff; | |
1347 buf[i++] = (len >> 24) & 0xff; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1348 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len + offset is invalid, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1349 "hashing request\n"); |
2086 | 1350 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1351 g_free(buf); | |
1352 return 1; | |
1353 } | |
1354 */ | |
1355 | |
1356 pos = g_new0(struct pieceofcrap, 1); | |
1357 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1358 pos->conn = fr->conn; |
2086 | 1359 |
1360 pos->offset = offset; | |
1361 pos->len = len; | |
1362 pos->modname = modname ? g_strdup(modname) : NULL; | |
1363 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1364 if (gaim_proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
4056 | 1365 char buf[256]; |
2086 | 1366 if (pos->modname) |
1367 g_free(pos->modname); | |
1368 g_free(pos); | |
4056 | 1369 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
|
1370 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1371 gaim_notify_warning(pos->gc, NULL, |
7422 | 1372 _("Gaim was unable to get a valid login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1373 buf); |
2086 | 1374 } |
1375 | |
1376 return 1; | |
1377 } | |
1378 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1379 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1380 GaimConnection *gc = sess->aux_data; |
7283 | 1381 OscarData *od = gc->proto_data; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1382 GaimAccount *account = gaim_connection_get_account(gc); |
5575 | 1383 GaimAccount *ac = gaim_connection_get_account(gc); |
7282 | 1384 #if 0 |
1385 struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; | |
1386 #endif | |
7011 | 1387 va_list ap; |
1388 char *key; | |
2086 | 1389 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1390 va_start(ap, fr); |
2086 | 1391 key = va_arg(ap, char *); |
1392 va_end(ap); | |
1393 | |
4617 | 1394 if (od->icq) { |
3458 | 1395 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1396 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1397 gaim_account_get_password(account), &info, key); |
3458 | 1398 } else { |
1399 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1400 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1401 gaim_account_get_password(account), &info, key); |
3458 | 1402 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1403 |
7283 | 1404 gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); |
7282 | 1405 |
2086 | 1406 return 1; |
1407 } | |
1408 | |
2675 | 1409 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1410 GaimConnection *gc = sess->aux_data; |
2647 | 1411 struct chat_connection *chatcon; |
1412 static int id = 1; | |
1413 | |
6905 | 1414 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
|
1415 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
|
1416 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
|
1417 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
|
1418 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0); |
2675 | 1419 |
2672 | 1420 aim_clientready(sess, fr->conn); |
2675 | 1421 |
2647 | 1422 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
1423 chatcon->id = id; | |
1424 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
1425 | |
1426 return 1; | |
1427 } | |
1428 | |
2675 | 1429 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
1430 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1431 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 1432 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 1433 |
1434 aim_clientready(sess, fr->conn); | |
1435 | |
1436 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1437 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1438 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1439 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1440 |
3694 | 1441 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
1442 | |
1443 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1444 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
1445 | |
7282 | 1446 aim_email_sendcookies(sess); |
1447 aim_email_activate(sess); | |
3694 | 1448 aim_clientready(sess, fr->conn); |
1449 | |
1450 return 1; | |
1451 } | |
1452 | |
4804 | 1453 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1454 GaimConnection *gc = sess->aux_data; |
7283 | 1455 OscarData *od = gc->proto_data; |
4804 | 1456 |
1457 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1458 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | |
1459 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | |
1460 | |
1461 aim_clientready(sess, fr->conn); | |
1462 | |
4823 | 1463 od->iconconnecting = FALSE; |
1464 | |
4804 | 1465 if (od->icontimer) |
1466 g_source_remove(od->icontimer); | |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
1467 od->icontimer = gaim_timeout_add(100, gaim_icon_timerfunc, gc); |
4804 | 1468 |
1469 return 1; | |
1470 } | |
1471 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1472 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1473 GaimConnection *gc = data; |
7283 | 1474 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1475 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1476 aim_conn_t *tstconn; |
2086 | 1477 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1478 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1479 close(source); |
1480 return; | |
1481 } | |
1482 | |
4617 | 1483 od = gc->proto_data; |
1484 sess = od->sess; | |
2086 | 1485 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
4366 | 1486 tstconn->fd = source; |
2086 | 1487 |
1488 if (source < 0) { | |
1489 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1490 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1491 "unable to connect to chatnav server\n"); |
2086 | 1492 return; |
1493 } | |
1494 | |
1495 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1496 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
|
1497 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
2086 | 1498 } |
1499 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1500 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1501 { |
5575 | 1502 GaimConnection *gc = data; |
7283 | 1503 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1504 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1505 aim_conn_t *tstconn; |
2086 | 1506 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1507 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1508 close(source); |
1509 return; | |
1510 } | |
1511 | |
4617 | 1512 od = gc->proto_data; |
1513 sess = od->sess; | |
2086 | 1514 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 1515 tstconn->fd = source; |
2086 | 1516 |
1517 if (source < 0) { | |
1518 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1519 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1520 "unable to connect to authorizer\n"); |
2086 | 1521 return; |
1522 } | |
1523 | |
1524 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1525 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
6905 | 1526 gaim_debug(GAIM_DEBUG_INFO, "oscar", "admin: connected\n"); |
2086 | 1527 } |
1528 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1529 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1530 { |
1531 struct chat_connection *ccon = data; | |
5575 | 1532 GaimConnection *gc = ccon->gc; |
7283 | 1533 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1534 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1535 aim_conn_t *tstconn; |
2086 | 1536 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1537 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1538 close(source); |
1539 g_free(ccon->show); | |
1540 g_free(ccon->name); | |
1541 g_free(ccon); | |
1542 return; | |
1543 } | |
1544 | |
4617 | 1545 od = gc->proto_data; |
1546 sess = od->sess; | |
2086 | 1547 tstconn = ccon->conn; |
4366 | 1548 tstconn->fd = source; |
2086 | 1549 |
1550 if (source < 0) { | |
1551 aim_conn_kill(sess, &tstconn); | |
1552 g_free(ccon->show); | |
1553 g_free(ccon->name); | |
1554 g_free(ccon); | |
1555 return; | |
1556 } | |
1557 | |
1558 aim_conn_completeconnect(sess, ccon->conn); | |
4617 | 1559 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
1560 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | |
2086 | 1561 } |
1562 | |
3694 | 1563 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1564 GaimConnection *gc = data; |
7283 | 1565 OscarData *od; |
3694 | 1566 aim_session_t *sess; |
1567 aim_conn_t *tstconn; | |
1568 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1569 if (!g_list_find(gaim_connections_get_all(), gc)) { |
3694 | 1570 close(source); |
1571 return; | |
1572 } | |
1573 | |
4617 | 1574 od = gc->proto_data; |
1575 sess = od->sess; | |
3694 | 1576 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
4366 | 1577 tstconn->fd = source; |
3694 | 1578 |
1579 if (source < 0) { | |
1580 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1581 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1582 "unable to connect to email server\n"); |
3694 | 1583 return; |
1584 } | |
1585 | |
1586 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1587 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
|
1588 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1589 "email: connected\n"); |
3694 | 1590 } |
1591 | |
4804 | 1592 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1593 GaimConnection *gc = data; |
7283 | 1594 OscarData *od; |
4804 | 1595 aim_session_t *sess; |
1596 aim_conn_t *tstconn; | |
1597 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1598 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4804 | 1599 close(source); |
1600 return; | |
1601 } | |
1602 | |
1603 od = gc->proto_data; | |
1604 sess = od->sess; | |
1605 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); | |
1606 tstconn->fd = source; | |
1607 | |
1608 if (source < 0) { | |
1609 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1610 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1611 "unable to connect to icon server\n"); |
4804 | 1612 return; |
1613 } | |
1614 | |
1615 aim_conn_completeconnect(sess, tstconn); | |
1616 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
|
1617 gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); |
4804 | 1618 } |
1619 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1620 /* 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
|
1621 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1622 GaimConnection *gc = sess->aux_data; |
1623 GaimAccount *account = gaim_connection_get_account(gc); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1624 aim_conn_t *tstconn; |
4452 | 1625 int i; |
2086 | 1626 char *host; |
1627 int port; | |
4821 | 1628 va_list ap; |
1629 struct aim_redirect_data *redir; | |
2086 | 1630 |
5575 | 1631 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1632 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1633 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1634 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1635 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1636 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1637 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1638 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1639 port = atoi(&(redir->ip[i+1])); |
2086 | 1640 break; |
1641 } | |
1642 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1643 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1644 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1645 switch(redir->group) { |
2086 | 1646 case 0x7: /* Authorizer */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1647 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1648 "Reconnecting with authorizor...\n"); |
2086 | 1649 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
1650 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1651 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1652 "unable to reconnect with authorizer\n"); |
2086 | 1653 g_free(host); |
1654 return 1; | |
1655 } | |
4649 | 1656 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1657 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1658 |
1659 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1660 if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
2086 | 1661 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1662 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1663 "unable to reconnect with authorizer\n"); |
2086 | 1664 g_free(host); |
1665 return 1; | |
1666 } | |
4293 | 1667 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1668 break; |
1669 | |
2086 | 1670 case 0xd: /* ChatNav */ |
1671 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1672 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1673 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1674 "unable to connect to chatnav server\n"); |
2086 | 1675 g_free(host); |
1676 return 1; | |
1677 } | |
4649 | 1678 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1679 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1680 |
1681 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1682 if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
2086 | 1683 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1684 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1685 "unable to connect to chatnav server\n"); |
2086 | 1686 g_free(host); |
1687 return 1; | |
1688 } | |
4293 | 1689 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1690 break; |
1691 | |
1692 case 0xe: { /* Chat */ | |
2086 | 1693 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1694 |
2086 | 1695 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1696 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1697 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1698 "unable to connect to chat server\n"); |
2086 | 1699 g_free(host); |
1700 return 1; | |
1701 } | |
1702 | |
4649 | 1703 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1704 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1705 | |
2086 | 1706 ccon = g_new0(struct chat_connection, 1); |
1707 ccon->conn = tstconn; | |
1708 ccon->gc = gc; | |
1709 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1710 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1711 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1712 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1713 ccon->show = extract_name(redir->chat.room); |
4634 | 1714 |
2086 | 1715 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1716 if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
2086 | 1717 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1718 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1719 "unable to connect to chat server\n"); |
2086 | 1720 g_free(host); |
1721 g_free(ccon->show); | |
1722 g_free(ccon->name); | |
1723 g_free(ccon); | |
1724 return 1; | |
1725 } | |
4293 | 1726 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1727 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1728 "Connected to chat room %s exchange %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1729 ccon->name, ccon->exchange); |
4194 | 1730 } break; |
3694 | 1731 |
4804 | 1732 case 0x0010: { /* icon */ |
1733 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1734 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1735 "unable to connect to icon server\n"); |
4804 | 1736 g_free(host); |
1737 return 1; | |
1738 } | |
1739 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); | |
1740 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); | |
1741 | |
1742 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1743 if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { |
4804 | 1744 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1745 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1746 "unable to connect to icon server\n"); |
4804 | 1747 g_free(host); |
1748 return 1; | |
1749 } | |
1750 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); | |
1751 } break; | |
1752 | |
3694 | 1753 case 0x0018: { /* email */ |
1754 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1755 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1756 "unable to connect to email server\n"); |
3694 | 1757 g_free(host); |
1758 return 1; | |
1759 } | |
4649 | 1760 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
3694 | 1761 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
1762 | |
1763 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1764 if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
3694 | 1765 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1766 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1767 "unable to connect to email server\n"); |
3694 | 1768 g_free(host); |
1769 return 1; | |
1770 } | |
4293 | 1771 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
3694 | 1772 } break; |
1773 | |
2086 | 1774 default: /* huh? */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1775 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1776 "got redirect for unknown service 0x%04hx\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1777 redir->group); |
2086 | 1778 break; |
1779 } | |
1780 | |
1781 g_free(host); | |
1782 return 1; | |
1783 } | |
1784 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1785 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1786 GaimConnection *gc = sess->aux_data; |
7283 | 1787 OscarData *od = gc->proto_data; |
4738 | 1788 struct buddyinfo *bi; |
2993 | 1789 time_t time_idle = 0, signon = 0; |
1790 int type = 0; | |
1791 int caps = 0; | |
2086 | 1792 va_list ap; |
4738 | 1793 aim_userinfo_t *info; |
4194 | 1794 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1795 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1796 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1797 va_end(ap); |
1798 | |
2993 | 1799 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
1800 caps = info->capabilities; | |
3267 | 1801 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
1802 type |= UC_AB; | |
1803 | |
4766 | 1804 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
1805 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
1806 type |= UC_UNCONFIRMED; | |
1807 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
1808 type |= UC_ADMIN; | |
1809 if (info->flags & AIM_FLAG_AOL) | |
1810 type |= UC_AOL; | |
1811 if (info->flags & AIM_FLAG_FREE) | |
1812 type |= UC_NORMAL; | |
1813 if (info->flags & AIM_FLAG_AWAY) | |
1814 type |= UC_UNAVAILABLE; | |
1815 if (info->flags & AIM_FLAG_WIRELESS) | |
1816 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1817 } |
2993 | 1818 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 1819 type = (info->icqinfo.status << 16); |
3013 | 1820 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
1821 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 1822 type |= UC_UNAVAILABLE; |
3013 | 1823 } |
2993 | 1824 } |
1825 | |
7141 | 1826 if (caps & AIM_CAPS_ICQ_DIRECT) |
1827 caps ^= AIM_CAPS_ICQ_DIRECT; | |
2993 | 1828 |
1829 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 1830 time(&time_idle); |
1831 time_idle -= info->idletime*60; | |
2993 | 1832 } |
1833 | |
5836 | 1834 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
1835 signon = info->onlinesince; | |
1836 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
2993 | 1837 signon = time(NULL) - info->sessionlen; |
2086 | 1838 |
5575 | 1839 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
1840 gaim_connection_set_display_name(gc, info->sn); | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1841 |
7261 | 1842 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
4738 | 1843 if (!bi) { |
1844 bi = g_new0(struct buddyinfo, 1); | |
7261 | 1845 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, info->sn)), bi); |
4738 | 1846 } |
4739 | 1847 bi->typingnot = FALSE; |
1848 bi->ico_informed = FALSE; | |
6857 | 1849 bi->ipaddr = info->icqinfo.ipaddr; |
1850 | |
1851 /* Available message stuff */ | |
6292 | 1852 free(bi->availmsg); |
7011 | 1853 if (info->avail != NULL) |
8225 | 1854 bi->availmsg = oscar_encoding_to_utf8(info->avail_encoding, info->avail, info->avail_len); |
5837 | 1855 else |
6292 | 1856 bi->availmsg = NULL; |
4732 | 1857 |
4804 | 1858 /* Server stored icon stuff */ |
4853 | 1859 if (info->iconcsumlen) { |
7125 | 1860 const char *filename = NULL, *saved_b16 = NULL; |
1861 char *b16 = NULL; | |
7093 | 1862 GaimBuddy *b = NULL; |
4853 | 1863 |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
1864 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); |
4853 | 1865 b = gaim_find_buddy(gc->account, info->sn); |
7093 | 1866 /* |
1867 * If for some reason the checksum is valid, but cached file is not.. | |
1868 * we want to know. | |
1869 */ | |
7693 | 1870 filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon"); |
7093 | 1871 if (filename != NULL) { |
1872 if (g_file_test(filename, G_FILE_TEST_EXISTS)) | |
7693 | 1873 saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b, |
1874 "icon_checksum"); | |
7093 | 1875 } else |
1876 saved_b16 = NULL; | |
7054
7c04a0775918
[gaim-migrate @ 7617]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7045
diff
changeset
|
1877 |
4853 | 1878 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { |
1879 GSList *cur = od->requesticon; | |
1880 while (cur && aim_sncmp((char *)cur->data, info->sn)) | |
1881 cur = cur->next; | |
1882 if (!cur) { | |
7475 | 1883 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn))); |
4853 | 1884 if (od->icontimer) |
1885 g_source_remove(od->icontimer); | |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
1886 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); |
4853 | 1887 } |
1888 } | |
6053 | 1889 g_free(b16); |
4853 | 1890 } |
1891 | |
5628 | 1892 serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); |
2086 | 1893 |
1894 return 1; | |
1895 } | |
1896 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1897 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1898 GaimConnection *gc = sess->aux_data; |
7283 | 1899 OscarData *od = gc->proto_data; |
2086 | 1900 va_list ap; |
4739 | 1901 aim_userinfo_t *info; |
2086 | 1902 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1903 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1904 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1905 va_end(ap); |
1906 | |
4732 | 1907 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
2086 | 1908 |
7261 | 1909 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
5837 | 1910 |
2086 | 1911 return 1; |
1912 } | |
1913 | |
3730 | 1914 static void cancel_direct_im(struct ask_direct *d) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1915 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Freeing DirectIM prompts.\n"); |
2086 | 1916 |
1917 g_free(d->sn); | |
1918 g_free(d); | |
1919 } | |
1920 | |
4617 | 1921 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1922 struct direct_im *dim = data; |
5575 | 1923 GaimConnection *gc = dim->gc; |
7283 | 1924 OscarData *od = gc->proto_data; |
5679 | 1925 GaimConversation *cnv; |
2086 | 1926 char buf[256]; |
3008 | 1927 struct sockaddr name; |
1928 socklen_t name_len = 1; | |
1929 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1930 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1931 g_free(dim); |
1932 return; | |
1933 } | |
1934 | |
1935 if (source < 0) { | |
1936 g_free(dim); | |
1937 return; | |
1938 } | |
1939 | |
4366 | 1940 dim->conn->fd = source; |
2086 | 1941 aim_conn_completeconnect(od->sess, dim->conn); |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
1942 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); |
3008 | 1943 |
1944 /* This is the best way to see if we're connected or not */ | |
1945 if (getpeername(source, &name, &name_len) == 0) { | |
1946 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
1947 dim->connected = TRUE; | |
6982 | 1948 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
3008 | 1949 } |
2086 | 1950 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 1951 |
4617 | 1952 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
2086 | 1953 } |
1954 | |
4617 | 1955 /* BBB */ |
3952 | 1956 /* |
4617 | 1957 * This is called after a remote AIM user has connected to us. We |
1958 * want to do some voodoo with the socket file descriptors, add a | |
1959 * callback or two, and then send the AIM_CB_OFT_PROMPT. | |
3952 | 1960 */ |
4656 | 1961 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1962 GaimConnection *gc = sess->aux_data; |
7283 | 1963 OscarData *od = (OscarData *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1964 GaimXfer *xfer; |
5146 | 1965 struct aim_oft_info *oft_info; |
3630 | 1966 va_list ap; |
1967 aim_conn_t *conn, *listenerconn; | |
4656 | 1968 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1969 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1970 "AAA - in oscar_sendfile_estblsh\n"); |
3630 | 1971 va_start(ap, fr); |
1972 conn = va_arg(ap, aim_conn_t *); | |
1973 listenerconn = va_arg(ap, aim_conn_t *); | |
1974 va_end(ap); | |
1975 | |
4617 | 1976 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
1977 return 1; | |
1978 | |
5146 | 1979 if (!(oft_info = xfer->data)) |
4617 | 1980 return 1; |
1981 | |
3630 | 1982 /* Stop watching listener conn; watch transfer conn instead */ |
4617 | 1983 gaim_input_remove(xfer->watcher); |
3630 | 1984 aim_conn_kill(sess, &listenerconn); |
1985 | |
5146 | 1986 oft_info->conn = conn; |
1987 xfer->fd = oft_info->conn->fd; | |
1988 | |
1989 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); | |
1990 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); | |
1991 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 1992 |
1993 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 1994 aim_oft_sendheader(sess, AIM_CB_OFT_PROMPT, oft_info); |
3630 | 1995 |
1996 return 0; | |
1997 } | |
1998 | |
3952 | 1999 /* |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2000 * This is the gaim callback passed to gaim_proxy_connect when connecting to another AIM |
4617 | 2001 * user in order to transfer a file. |
3952 | 2002 */ |
4617 | 2003 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
|
2004 GaimXfer *xfer; |
5146 | 2005 struct aim_oft_info *oft_info; |
4656 | 2006 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2007 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2008 "AAA - in oscar_sendfile_connected\n"); |
4617 | 2009 if (!(xfer = data)) |
2010 return; | |
5146 | 2011 if (!(oft_info = xfer->data)) |
3630 | 2012 return; |
4617 | 2013 if (source < 0) |
2014 return; | |
2015 | |
2016 xfer->fd = source; | |
5146 | 2017 oft_info->conn->fd = source; |
2018 | |
2019 aim_conn_completeconnect(oft_info->sess, oft_info->conn); | |
2020 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 2021 |
2022 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 2023 aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); |
4617 | 2024 |
2025 return; | |
3630 | 2026 } |
2027 | |
3952 | 2028 /* |
4617 | 2029 * This is called when a buddy sends us some file info. This happens when they |
2030 * are sending a file to you, and you have just established a connection to them. | |
4650 | 2031 * You should send them the exact same info except use the real cookie. We also |
4617 | 2032 * get like totally ready to like, receive the file, kay? |
3952 | 2033 */ |
4617 | 2034 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2035 GaimConnection *gc = sess->aux_data; |
7283 | 2036 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2037 GaimXfer *xfer; |
5146 | 2038 struct aim_oft_info *oft_info; |
4617 | 2039 va_list ap; |
2040 aim_conn_t *conn; | |
2041 fu8_t *cookie; | |
2042 struct aim_fileheader_t *fh; | |
4656 | 2043 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2044 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2045 "AAA - in oscar_sendfile_prompt\n"); |
4617 | 2046 va_start(ap, fr); |
2047 conn = va_arg(ap, aim_conn_t *); | |
2048 cookie = va_arg(ap, fu8_t *); | |
2049 fh = va_arg(ap, struct aim_fileheader_t *); | |
2050 va_end(ap); | |
2051 | |
2052 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2053 return 1; | |
2054 | |
5146 | 2055 if (!(oft_info = xfer->data)) |
4617 | 2056 return 1; |
2057 | |
2058 /* We want to stop listening with a normal thingy */ | |
2059 gaim_input_remove(xfer->watcher); | |
2060 xfer->watcher = 0; | |
2061 | |
5146 | 2062 /* They sent us some information about the file they're sending */ |
2063 memcpy(&oft_info->fh, fh, sizeof(*fh)); | |
2064 | |
2065 /* Fill in the cookie */ | |
2066 memcpy(&oft_info->fh.bcookie, oft_info->cookie, 8); | |
2067 | |
4617 | 2068 /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ |
5146 | 2069 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); |
4617 | 2070 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2071 | |
2072 return 0; | |
3630 | 2073 } |
2074 | |
3952 | 2075 /* |
4657 | 2076 * We are sending a file to someone else. They have just acknowledged our |
4617 | 2077 * prompt, so we want to start sending data like there's no tomorrow. |
3952 | 2078 */ |
4617 | 2079 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2080 GaimConnection *gc = sess->aux_data; |
7283 | 2081 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2082 GaimXfer *xfer; |
4617 | 2083 va_list ap; |
2084 aim_conn_t *conn; | |
2085 fu8_t *cookie; | |
2086 struct aim_fileheader_t *fh; | |
4656 | 2087 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2088 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_ack\n"); |
4617 | 2089 va_start(ap, fr); |
2090 conn = va_arg(ap, aim_conn_t *); | |
2091 cookie = va_arg(ap, fu8_t *); | |
2092 fh = va_arg(ap, struct aim_fileheader_t *); | |
2093 va_end(ap); | |
2094 | |
2095 if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
2096 return 1; | |
2097 | |
4656 | 2098 /* We want to stop listening with a normal thingy */ |
2099 gaim_input_remove(xfer->watcher); | |
2100 xfer->watcher = 0; | |
2101 | |
4617 | 2102 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2103 | |
2104 return 0; | |
3630 | 2105 } |
4617 | 2106 |
2107 /* | |
2108 * We just sent a file to someone. They said they got it and everything, | |
2109 * so we can close our direct connection and what not. | |
2110 */ | |
2111 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 2112 GaimConnection *gc = sess->aux_data; |
7283 | 2113 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2114 GaimXfer *xfer; |
4617 | 2115 va_list ap; |
2116 aim_conn_t *conn; | |
2117 fu8_t *cookie; | |
2118 struct aim_fileheader_t *fh; | |
4656 | 2119 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2120 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_done\n"); |
4617 | 2121 va_start(ap, fr); |
2122 conn = va_arg(ap, aim_conn_t *); | |
2123 cookie = va_arg(ap, fu8_t *); | |
2124 fh = va_arg(ap, struct aim_fileheader_t *); | |
2125 va_end(ap); | |
2126 | |
2127 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2128 return 1; | |
2129 | |
4656 | 2130 xfer->fd = conn->fd; |
4617 | 2131 gaim_xfer_end(xfer); |
2132 | |
2133 return 0; | |
2134 } | |
3630 | 2135 |
4244 | 2136 static void accept_direct_im(struct ask_direct *d) { |
5575 | 2137 GaimConnection *gc = d->gc; |
7283 | 2138 OscarData *od; |
2086 | 2139 struct direct_im *dim; |
8240 | 2140 char *host; int port = 5190; |
4366 | 2141 int i, rc; |
2086 | 2142 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2143 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2144 cancel_direct_im(d); |
2145 return; | |
2146 } | |
2147 | |
7283 | 2148 od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2149 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); |
2086 | 2150 |
2151 dim = find_direct_im(od, d->sn); | |
2152 if (dim) { | |
3730 | 2153 cancel_direct_im(d); /* 40 */ |
4244 | 2154 return; |
2086 | 2155 } |
2156 dim = g_new0(struct direct_im, 1); | |
2157 dim->gc = d->gc; | |
2158 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
2159 | |
4617 | 2160 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
|
2161 if (!dim->conn) { |
2086 | 2162 g_free(dim); |
3730 | 2163 cancel_direct_im(d); |
4244 | 2164 return; |
2086 | 2165 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2166 |
2086 | 2167 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
4617 | 2168 gaim_odc_incoming, 0); |
2086 | 2169 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, |
4617 | 2170 gaim_odc_typing, 0); |
3033 | 2171 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
6982 | 2172 gaim_odc_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2173 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2174 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2175 port = atoi(&(d->ip[i+1])); |
2086 | 2176 break; |
2177 } | |
2178 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2179 host = g_strndup(d->ip, i); |
2086 | 2180 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2181 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
2086 | 2182 g_free(host); |
4366 | 2183 if (rc < 0) { |
2086 | 2184 aim_conn_kill(od->sess, &dim->conn); |
2185 g_free(dim); | |
3730 | 2186 cancel_direct_im(d); |
4244 | 2187 return; |
2086 | 2188 } |
2189 | |
3730 | 2190 cancel_direct_im(d); |
2086 | 2191 |
4244 | 2192 return; |
2086 | 2193 } |
2194 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2195 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
5575 | 2196 GaimConnection *gc = sess->aux_data; |
7283 | 2197 OscarData *od = gc->proto_data; |
7475 | 2198 gchar *tmp; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
2199 GaimConvImFlags flags = 0; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
2200 gsize convlen; |
3659 | 2201 GError *err = NULL; |
4738 | 2202 struct buddyinfo *bi; |
5575 | 2203 const char *iconfile; |
4738 | 2204 |
7261 | 2205 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, userinfo->sn)); |
4738 | 2206 if (!bi) { |
2207 bi = g_new0(struct buddyinfo, 1); | |
7261 | 2208 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, userinfo->sn)), bi); |
4738 | 2209 } |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2210 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2211 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
2212 flags |= GAIM_CONV_IM_AUTO_RESP; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2213 |
4738 | 2214 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
2215 bi->typingnot = TRUE; | |
2216 else | |
2217 bi->typingnot = FALSE; | |
2218 | |
4380 | 2219 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
|
2220 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2221 "%s has an icon\n", userinfo->sn); |
4738 | 2222 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
2223 bi->ico_need = TRUE; | |
2224 bi->ico_len = args->iconlen; | |
2225 bi->ico_csum = args->iconsum; | |
2226 bi->ico_time = args->iconstamp; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2227 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2228 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2229 |
5575 | 2230 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && |
7406 | 2231 (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
|
2232 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2233 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2234 |
5575 | 2235 if (!stat(iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2236 char *buf = g_malloc(st.st_size); |
5575 | 2237 file = fopen(iconfile, "rb"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2238 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
2239 int len = fread(buf, 1, st.st_size, file); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2240 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2241 "Sending buddy icon to %s (%d bytes, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2242 "%lu reported)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2243 userinfo->sn, len, st.st_size); |
4617 | 2244 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, |
2245 st.st_mtime, aimutil_iconsum(buf, st.st_size)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2246 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2247 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2248 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2249 "Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2250 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2251 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2252 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2253 "Can't stat buddy icon file!\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2254 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2255 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2256 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2257 "Character set is %hu %hu\n", args->charset, args->charsubset); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2258 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 2259 /* This message is marked as UNICODE, so we have to |
2260 * convert it to utf-8 before handing it to the gaim core. | |
2261 * This conversion should *never* fail, if it does it | |
2262 * means that either the incoming ICBM is corrupted or | |
4662 | 2263 * there is something we don't understand about it. |
2264 * For the record, AIM Unicode is big-endian UCS-2 */ | |
2265 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2266 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Received UNICODE IM\n"); |
4121 | 2267 |
2268 if (!args->msg || !args->msglen) | |
2269 return 1; | |
4641 | 2270 |
3659 | 2271 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2272 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2273 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2274 "Unicode IM conversion: %s\n", err->message); |
7475 | 2275 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 2276 g_error_free(err); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2277 } |
3722 | 2278 } else { |
3850 | 2279 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 2280 * unflagged messages, which are ASCII. That's OK because |
2281 * ASCII is a strict subset of ISO-8859-1; this should | |
2282 * help with compatibility with old, broken versions of | |
2283 * gaim (everything before 0.60) and other broken clients | |
2284 * that will happily send ISO-8859-1 without marking it as | |
2285 * such */ | |
4662 | 2286 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2287 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2288 "Received ISO-8859-1 IM\n"); |
4121 | 2289 |
2290 if (!args->msg || !args->msglen) | |
2291 return 1; | |
2292 | |
3659 | 2293 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2294 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2295 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2296 "ISO-8859-1 IM conversion: %s\n", err->message); |
7475 | 2297 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 2298 g_error_free(err); |
3659 | 2299 } |
3642 | 2300 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2301 |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7475
diff
changeset
|
2302 /* gaim_str_strip_cr(tmp); */ |
6982 | 2303 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2304 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2305 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2306 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2307 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2308 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2309 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
5575 | 2310 GaimConnection *gc = sess->aux_data; |
7283 | 2311 OscarData *od = gc->proto_data; |
5575 | 2312 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
|
2313 |
4121 | 2314 if (!args) |
2315 return 0; | |
4194 | 2316 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2317 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2318 "rendezvous with %s, status is %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2319 userinfo->sn, args->status); |
2869 | 2320 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2321 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 2322 char *name; |
5234 | 2323 GHashTable *components; |
2324 | |
4121 | 2325 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
2326 return 1; | |
5234 | 2327 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
2328 g_free); | |
4121 | 2329 name = extract_name(args->info.chat.roominfo.name); |
5234 | 2330 g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name)); |
2331 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
|
2332 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2333 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2334 userinfo->sn, |
6059 | 2335 args->msg, |
5234 | 2336 components); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2337 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2338 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2339 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
4617 | 2340 /* BBB */ |
2341 if (args->status == AIM_RENDEZVOUS_PROPOSE) { | |
2342 /* Someone wants to send a file (or files) to us */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2343 GaimXfer *xfer; |
5146 | 2344 struct aim_oft_info *oft_info; |
2345 | |
2346 if (!args->cookie || !args->port || !args->verifiedip || | |
2347 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
4656 | 2348 !args->info.sendfile.totfiles || !args->reqclass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2349 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2350 "%s tried to send you a file with incomplete " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2351 "information.\n", userinfo->sn); |
5146 | 2352 if (args->proxyip) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2353 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2354 "IP for a proxy server was given. Gaim " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2355 "does not support this yet.\n"); |
4617 | 2356 return 1; |
4656 | 2357 } |
4617 | 2358 |
2359 if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { | |
2360 /* last char of the ft req is a star, they are sending us a | |
2361 * directory -- remove the star and trailing slash so we dont save | |
2362 * directories that look like 'dirname\*' -- arl */ | |
2363 char *tmp = strrchr(args->info.sendfile.filename, '\\'); | |
2364 if (tmp && (tmp[1] == '*')) { | |
2365 tmp[0] = '\0'; | |
2366 } | |
2367 } | |
2368 | |
2369 /* Build the file transfer handle */ | |
2370 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); | |
5163 | 2371 xfer->remote_ip = g_strdup(args->verifiedip); |
5146 | 2372 xfer->remote_port = args->port; |
4617 | 2373 gaim_xfer_set_filename(xfer, args->info.sendfile.filename); |
2374 gaim_xfer_set_size(xfer, args->info.sendfile.totsize); | |
5146 | 2375 |
2376 /* Create the oscar-specific data */ | |
5163 | 2377 oft_info = aim_oft_createinfo(od->sess, args->cookie, userinfo->sn, args->clientip, xfer->remote_port, 0, 0, NULL); |
4898 | 2378 if (args->proxyip) |
5146 | 2379 oft_info->proxyip = g_strdup(args->proxyip); |
4898 | 2380 if (args->verifiedip) |
5146 | 2381 oft_info->verifiedip = g_strdup(args->verifiedip); |
2382 xfer->data = oft_info; | |
4617 | 2383 |
2384 /* Setup our I/O op functions */ | |
2385 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
2386 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
2387 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2388 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2389 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4617 | 2390 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
2391 | |
2392 /* | |
2393 * XXX - Should do something with args->msg, args->encoding, and args->language | |
2394 * probably make it apply to all ch2 messages. | |
3752 | 2395 */ |
4617 | 2396 |
2397 /* Keep track of this transfer for later */ | |
2398 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
2399 | |
2400 /* Now perform the request */ | |
2401 gaim_xfer_request(xfer); | |
2402 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { | |
2403 /* The other user wants to cancel a file transfer */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2404 GaimXfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2405 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2406 "AAA - File transfer canceled by remote user\n"); |
4617 | 2407 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
|
2408 gaim_xfer_cancel_remote(xfer); |
4617 | 2409 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
2410 /* | |
2411 * This gets sent by the receiver of a file | |
2412 * as they connect directly to us. If we don't | |
2413 * get this, then maybe a third party connected | |
2414 * to us, and we shouldn't send them anything. | |
2415 */ | |
2416 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2417 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2418 "unknown rendezvous status!\n"); |
3630 | 2419 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2420 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
8092 | 2421 } else if (args->reqclass & AIM_CAPS_TALK) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2422 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2423 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2424 userinfo->sn, args->info.icon.icon, |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2425 args->info.icon.length); |
6871 | 2426 } else if (args->reqclass & AIM_CAPS_DIRECTIM) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2427 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2428 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2429 |
4212 | 2430 if (!args->verifiedip) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2431 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2432 "directim kill blocked (%s)\n", userinfo->sn); |
4650 | 2433 return 1; |
4212 | 2434 } |
2435 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2436 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2437 "%s received direct im request from %s (%s)\n", |
5575 | 2438 username, userinfo->sn, args->verifiedip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2439 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2440 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2441 d->sn = g_strdup(userinfo->sn); |
2869 | 2442 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2443 memcpy(d->cookie, args->cookie, 8); |
5575 | 2444 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
|
2445 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2446 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2447 _("This requires a direct connection between " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2448 "the two computers and is necessary for IM " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2449 "Images. Because your IP address will be " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2450 "revealed, this may be considered a privacy " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2451 "risk."), 0, d, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2452 _("Connect"), G_CALLBACK(accept_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2453 _("Cancel"), G_CALLBACK(cancel_direct_im)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2454 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2455 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2456 "Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2457 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2458 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2459 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2460 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2461 |
3453 | 2462 /* |
4230 | 2463 * Authorization Functions |
2464 * Most of these are callbacks from dialogs. They're used by both | |
2465 * methods of authorization (SSI and old-school channel 4 ICBM) | |
3453 | 2466 */ |
4269 | 2467 /* When you ask other people for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2468 static void gaim_auth_request(struct name_data *data, char *msg) { |
5575 | 2469 GaimConnection *gc = data->gc; |
4244 | 2470 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2471 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2472 OscarData *od = gc->proto_data; |
6695 | 2473 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); |
2474 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4244 | 2475 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2476 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2477 "ssi: adding buddy %s to group %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2478 buddy->name, group->name); |
4889 | 2479 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
4269 | 2480 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
4889 | 2481 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
4244 | 2482 } |
4230 | 2483 } |
4337 | 2484 } |
2485 | |
2486 static void gaim_auth_request_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2487 gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2488 NULL, _("Please authorize me!"), TRUE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2489 _("OK"), G_CALLBACK(gaim_auth_request), |
5836 | 2490 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2491 data); |
4230 | 2492 } |
2493 | |
2494 static void gaim_auth_dontrequest(struct name_data *data) { | |
5575 | 2495 GaimConnection *gc = data->gc; |
4244 | 2496 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2497 if (g_list_find(gaim_connections_get_all(), gc)) { |
8151 | 2498 /* Remove from local list */ |
2499 GaimBuddy *b = gaim_find_buddy(gaim_connection_get_account(gc), data->name); | |
2500 gaim_blist_remove_buddy(b); | |
4244 | 2501 } |
2502 | |
5836 | 2503 oscar_free_name_data(data); |
4230 | 2504 } |
2505 | |
5575 | 2506 static void gaim_auth_sendrequest(GaimConnection *gc, const char *name) { |
4269 | 2507 struct name_data *data = g_new(struct name_data, 1); |
6695 | 2508 GaimBuddy *buddy; |
4269 | 2509 gchar *dialog_msg, *nombre; |
2510 | |
4687 | 2511 buddy = gaim_find_buddy(gc->account, name); |
2512 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
2513 nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); | |
4269 | 2514 else |
4830 | 2515 nombre = NULL; |
2516 | |
2517 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 | 2518 data->gc = gc; |
2519 data->name = g_strdup(name); | |
2520 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2521 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2522 gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2523 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2524 _("Request Authorization"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2525 G_CALLBACK(gaim_auth_request_msgprompt), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2526 _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); |
4269 | 2527 |
2528 g_free(dialog_msg); | |
2529 g_free(nombre); | |
2530 } | |
2531 | |
4230 | 2532 /* When other people ask you for authorization */ |
2533 static void gaim_auth_grant(struct name_data *data) { | |
5575 | 2534 GaimConnection *gc = data->gc; |
4244 | 2535 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2536 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2537 OscarData *od = gc->proto_data; |
4236 | 2538 #ifdef NOSSI |
6695 | 2539 GaimBuddy *buddy; |
4244 | 2540 gchar message; |
2541 message = 0; | |
4687 | 2542 buddy = gaim_find_buddy(gc->account, data->name); |
4617 | 2543 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
|
2544 gaim_account_notify_added(gc->account, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 2545 #else |
4889 | 2546 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
4230 | 2547 #endif |
4244 | 2548 } |
2549 | |
5836 | 2550 oscar_free_name_data(data); |
3141 | 2551 } |
2552 | |
4230 | 2553 /* When other people ask you for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2554 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
5575 | 2555 GaimConnection *gc = data->gc; |
4244 | 2556 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2557 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2558 OscarData *od = gc->proto_data; |
4230 | 2559 #ifdef NOSSI |
4617 | 2560 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
4230 | 2561 #else |
4889 | 2562 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
4230 | 2563 #endif |
4244 | 2564 } |
4337 | 2565 } |
2566 | |
2567 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2568 gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2569 NULL, _("No reason given."), TRUE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2570 _("OK"), G_CALLBACK(gaim_auth_dontgrant), |
5836 | 2571 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2572 data); |
3141 | 2573 } |
2574 | |
7023 | 2575 /* When someone sends you buddies */ |
2576 static void gaim_icq_buddyadd(struct name_data *data) { | |
5575 | 2577 GaimConnection *gc = data->gc; |
4244 | 2578 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2579 if (g_list_find(gaim_connections_get_all(), gc)) { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7054
diff
changeset
|
2580 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick); |
4244 | 2581 } |
2582 | |
5836 | 2583 oscar_free_name_data(data); |
3453 | 2584 } |
2585 | |
4075 | 2586 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 | 2587 GaimConnection *gc = sess->aux_data; |
4076 | 2588 gchar **msg1, **msg2; |
2589 GError *err = NULL; | |
6051 | 2590 int i, numtoks; |
4076 | 2591 |
4121 | 2592 if (!args->type || !args->msg || !args->uin) |
2593 return 1; | |
4194 | 2594 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2595 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2596 "Received a channel 4 message of type 0x%02hhx.\n", args->type); |
4076 | 2597 |
2598 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 2599 msg1 = g_strsplit(args->msg, "\376", 0); |
6051 | 2600 for (numtoks=0; msg1[numtoks]; numtoks++); |
2601 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); | |
4076 | 2602 for (i=0; msg1[i]; i++) { |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7475
diff
changeset
|
2603 gaim_str_strip_cr(msg1[i]); |
4076 | 2604 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); |
4800 | 2605 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2606 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2607 "Error converting a string from ISO-8859-1 to " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2608 "UTF-8 in oscar ICBM channel 4 parsing\n"); |
4800 | 2609 g_error_free(err); |
2610 } | |
4076 | 2611 } |
2612 msg2[i] = NULL; | |
2613 | |
3952 | 2614 switch (args->type) { |
4173 | 2615 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 2616 if (i >= 1) { |
5556 | 2617 gchar *uin = g_strdup_printf("%u", args->uin); |
4076 | 2618 if (t) { /* This is an offline message */ |
2619 /* I think this timestamp is in UTC, or something */ | |
6982 | 2620 serv_got_im(gc, uin, msg2[0], 0, t); |
4076 | 2621 } else { /* This is a message from MacICQ/Miranda */ |
6982 | 2622 serv_got_im(gc, uin, msg2[0], 0, time(NULL)); |
4076 | 2623 } |
2624 g_free(uin); | |
4075 | 2625 } |
3316 | 2626 } break; |
2627 | |
4173 | 2628 case 0x04: { /* Someone sent you a URL */ |
4076 | 2629 if (i >= 2) { |
7385 | 2630 if (msg2[1] != NULL) { |
2631 gchar *uin = g_strdup_printf("%u", args->uin); | |
2632 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", | |
2633 msg2[1], | |
2634 (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]); | |
2635 serv_got_im(gc, uin, message, 0, time(NULL)); | |
2636 g_free(uin); | |
2637 g_free(message); | |
2638 } | |
3453 | 2639 } |
2640 } break; | |
2641 | |
4173 | 2642 case 0x06: { /* Someone requested authorization */ |
4076 | 2643 if (i >= 6) { |
4230 | 2644 struct name_data *data = g_new(struct name_data, 1); |
5556 | 2645 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
|
2646 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5556 | 2647 "Received an authorization request from UIN %u\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2648 args->uin); |
4076 | 2649 data->gc = gc; |
5556 | 2650 data->name = g_strdup_printf("%u", args->uin); |
4230 | 2651 data->nick = NULL; |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2652 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2653 gaim_request_action(gc, NULL, _("Authorization Request"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2654 dialog_msg, 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2655 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2656 G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2657 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2658 G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4076 | 2659 g_free(dialog_msg); |
2660 } | |
3141 | 2661 } break; |
2662 | |
4173 | 2663 case 0x07: { /* Someone has denied you authorization */ |
4076 | 2664 if (i >= 1) { |
7023 | 2665 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
|
2666 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2667 dialog_msg); |
4076 | 2668 g_free(dialog_msg); |
2669 } | |
3141 | 2670 } break; |
2671 | |
4173 | 2672 case 0x08: { /* Someone has granted you authorization */ |
7023 | 2673 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
|
2674 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2675 dialog_msg); |
3141 | 2676 g_free(dialog_msg); |
2677 } break; | |
2678 | |
4333 | 2679 case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
2680 if (i >= 5) { | |
2681 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
|
2682 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); |
4333 | 2683 g_free(dialog_msg); |
2684 } | |
2685 } break; | |
2686 | |
4173 | 2687 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 2688 if (i >= 6) { |
4194 | 2689 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
|
2690 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); |
4076 | 2691 g_free(dialog_msg); |
2692 } | |
4075 | 2693 } break; |
2694 | |
4173 | 2695 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 2696 if (i >= 6) { |
4308 | 2697 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
|
2698 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg); |
4076 | 2699 g_free(dialog_msg); |
2700 } | |
4075 | 2701 } break; |
2702 | |
4173 | 2703 case 0x12: { |
3141 | 2704 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
7023 | 2705 /* Someone added you to their buddy list? */ |
3141 | 2706 } break; |
2707 | |
7023 | 2708 case 0x13: { /* Someone has sent you some ICQ buddies */ |
7631 | 2709 guint i, num; |
3453 | 2710 gchar **text; |
4173 | 2711 text = g_strsplit(args->msg, "\376", 0); |
3453 | 2712 if (text) { |
2713 num = 0; | |
2714 for (i=0; i<strlen(text[0]); i++) | |
2715 num = num*10 + text[0][i]-48; | |
2716 for (i=0; i<num; i++) { | |
4230 | 2717 struct name_data *data = g_new(struct name_data, 1); |
7023 | 2718 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 | 2719 data->gc = gc; |
4790 | 2720 data->name = g_strdup(text[i*2+1]); |
2721 data->nick = g_strdup(text[i*2+2]); | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2722 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2723 gaim_request_action(gc, NULL, message, |
7023 | 2724 _("Do you want to add this buddy " |
2725 "to your buddy list?"), | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2726 0, data, 2, |
7023 | 2727 _("Add"), G_CALLBACK(gaim_icq_buddyadd), |
5836 | 2728 _("Decline"), G_CALLBACK(oscar_free_name_data)); |
3453 | 2729 g_free(message); |
2730 } | |
2731 g_strfreev(text); | |
2732 } | |
2733 } break; | |
2734 | |
7023 | 2735 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */ |
3453 | 2736 /* This is boring and silly. */ |
2737 } break; | |
2738 | |
3141 | 2739 default: { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2740 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2741 "Received a channel 4 message of unknown type " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2742 "(type 0x%02hhx).\n", args->type); |
3141 | 2743 } break; |
2744 } | |
2745 | |
4076 | 2746 g_strfreev(msg1); |
2747 g_strfreev(msg2); | |
2748 | |
3141 | 2749 return 1; |
2750 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2751 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2752 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 2753 fu16_t channel; |
2754 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2755 aim_userinfo_t *userinfo; |
2086 | 2756 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2757 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2758 va_start(ap, fr); |
4200 | 2759 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2760 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 2761 |
3141 | 2762 switch (channel) { |
2763 case 1: { /* standard message */ | |
2764 struct aim_incomingim_ch1_args *args; | |
2765 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
2766 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
2767 } break; | |
2768 | |
2769 case 2: { /* rendevous */ | |
2770 struct aim_incomingim_ch2_args *args; | |
2771 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
2772 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
2773 } break; | |
2774 | |
2775 case 4: { /* ICQ */ | |
2776 struct aim_incomingim_ch4_args *args; | |
2777 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 2778 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 2779 } break; |
2780 | |
2781 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2782 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2783 "ICBM received on unsupported channel (channel " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2784 "0x%04hx).", channel); |
3141 | 2785 } break; |
2086 | 2786 } |
2787 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2788 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2789 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2790 return ret; |
2086 | 2791 } |
2792 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2793 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
5420 | 2794 char *buf; |
2086 | 2795 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2796 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2797 aim_userinfo_t *userinfo; |
2086 | 2798 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2799 va_start(ap, fr); |
4200 | 2800 chan = (fu16_t)va_arg(ap, unsigned int); |
2801 userinfo = va_arg(ap, aim_userinfo_t *); | |
2802 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
2803 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 2804 va_end(ap); |
2805 | |
2806 switch(reason) { | |
5420 | 2807 case 0: /* Invalid (0) */ |
2808 buf = g_strdup_printf( | |
2809 ngettext( | |
4276 | 2810 "You missed %hu message from %s because it was invalid.", |
2811 "You missed %hu messages from %s because they were invalid.", | |
2812 nummissed), | |
4282 | 2813 nummissed, |
2814 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2815 break; |
5420 | 2816 case 1: /* Message too large */ |
2817 buf = g_strdup_printf( | |
2818 ngettext( | |
4276 | 2819 "You missed %hu message from %s because it was too large.", |
2820 "You missed %hu messages from %s because they were too large.", | |
2821 nummissed), | |
4282 | 2822 nummissed, |
2823 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2824 break; |
5420 | 2825 case 2: /* Rate exceeded */ |
2826 buf = g_strdup_printf( | |
2827 ngettext( | |
4276 | 2828 "You missed %hu message from %s because the rate limit has been exceeded.", |
2829 "You missed %hu messages from %s because the rate limit has been exceeded.", | |
2830 nummissed), | |
4282 | 2831 nummissed, |
2832 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2833 break; |
5420 | 2834 case 3: /* Evil Sender */ |
2835 buf = g_strdup_printf( | |
2836 ngettext( | |
4276 | 2837 "You missed %hu message from %s because he/she was too evil.", |
2838 "You missed %hu messages from %s because he/she was too evil.", | |
2839 nummissed), | |
4282 | 2840 nummissed, |
2841 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2842 break; |
5420 | 2843 case 4: /* Evil Receiver */ |
2844 buf = g_strdup_printf( | |
2845 ngettext( | |
4276 | 2846 "You missed %hu message from %s because you are too evil.", |
2847 "You missed %hu messages from %s because you are too evil.", | |
2848 nummissed), | |
4282 | 2849 nummissed, |
2850 userinfo->sn); | |
2086 | 2851 break; |
2852 default: | |
5420 | 2853 buf = g_strdup_printf( |
2854 ngettext( | |
4276 | 2855 "You missed %hu message from %s for an unknown reason.", |
2856 "You missed %hu messages from %s for an unknown reason.", | |
2857 nummissed), | |
4282 | 2858 nummissed, |
2859 userinfo->sn); | |
2086 | 2860 break; |
2861 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2862 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 2863 g_free(buf); |
2086 | 2864 |
2865 return 1; | |
2866 } | |
2867 | |
3212 | 2868 static char *gaim_icq_status(int state) { |
2869 /* Make a cute little string that shows the status of the dude or dudet */ | |
2870 if (state & AIM_ICQ_STATE_CHAT) | |
4342 | 2871 return g_strdup_printf(_("Free For Chat")); |
3212 | 2872 else if (state & AIM_ICQ_STATE_DND) |
4342 | 2873 return g_strdup_printf(_("Do Not Disturb")); |
3212 | 2874 else if (state & AIM_ICQ_STATE_OUT) |
4342 | 2875 return g_strdup_printf(_("Not Available")); |
3212 | 2876 else if (state & AIM_ICQ_STATE_BUSY) |
4342 | 2877 return g_strdup_printf(_("Occupied")); |
3212 | 2878 else if (state & AIM_ICQ_STATE_AWAY) |
4342 | 2879 return g_strdup_printf(_("Away")); |
3212 | 2880 else if (state & AIM_ICQ_STATE_WEBAWARE) |
4342 | 2881 return g_strdup_printf(_("Web Aware")); |
3212 | 2882 else if (state & AIM_ICQ_STATE_INVISIBLE) |
4342 | 2883 return g_strdup_printf(_("Invisible")); |
3212 | 2884 else |
4342 | 2885 return g_strdup_printf(_("Online")); |
3212 | 2886 } |
2887 | |
4194 | 2888 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
5575 | 2889 GaimConnection *gc = sess->aux_data; |
7283 | 2890 OscarData *od = gc->proto_data; |
4617 | 2891 |
2892 /* BBB */ | |
3630 | 2893 switch (reason) { |
4151 | 2894 case 3: { /* Decline sendfile. */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2895 GaimXfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2896 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2897 "AAA - Other user declined file transfer\n"); |
4617 | 2898 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
|
2899 gaim_xfer_cancel_remote(xfer); |
4151 | 2900 } break; |
2901 | |
2902 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2903 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2904 "Received an unknown rendezvous client auto-response " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2905 "from %s. Type 0x%04hx\n", who, reason); |
4151 | 2906 } |
3630 | 2907 |
2908 } | |
2909 | |
2910 return 0; | |
2911 } | |
2912 | |
4194 | 2913 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
5575 | 2914 GaimConnection *gc = sess->aux_data; |
4151 | 2915 |
2916 switch(reason) { | |
2917 case 0x0003: { /* Reply from an ICQ status message request */ | |
2918 char *status_msg = gaim_icq_status(state); | |
2919 char *dialog_msg, **splitmsg; | |
2920 | |
2921 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
2922 splitmsg = g_strsplit(msg, "\r\n", 0); | |
2923 | |
7011 | 2924 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); |
7032 | 2925 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, dialog_msg, NULL, NULL); |
4151 | 2926 |
2927 g_free(status_msg); | |
2928 g_free(dialog_msg); | |
2929 g_strfreev(splitmsg); | |
2930 } break; | |
2931 | |
2932 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2933 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2934 "Received an unknown client auto-response from %s. " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2935 "Type 0x%04hx\n", who, reason); |
4151 | 2936 } break; |
2937 } /* end of switch */ | |
2938 | |
2939 return 0; | |
2940 } | |
2941 | |
3212 | 2942 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
2943 va_list ap; | |
2944 fu16_t chan, reason; | |
2945 char *who; | |
2946 | |
2947 va_start(ap, fr); | |
4200 | 2948 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2949 who = va_arg(ap, char *); |
4200 | 2950 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2951 |
3952 | 2952 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 2953 char *cookie = va_arg(ap, char *); |
4151 | 2954 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 2955 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 2956 fu32_t state = 0; |
4151 | 2957 char *msg = NULL; |
2958 if (reason == 0x0003) { | |
4200 | 2959 state = va_arg(ap, fu32_t); |
4151 | 2960 msg = va_arg(ap, char *); |
2961 } | |
2962 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
2963 } | |
3952 | 2964 |
3212 | 2965 va_end(ap); |
2966 | |
2967 return 1; | |
2968 } | |
2969 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2970 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2971 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2972 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2973 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2974 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2975 va_start(ap, fr); |
4199 | 2976 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2977 va_end(ap); |
2978 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2979 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2980 "snac threw error (reason 0x%04hx: %s)\n", reason, |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2981 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2086 | 2982 |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2983 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
5411 | 2984 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2985 gaim_notify_error(sess->aux_data, NULL, m, NULL); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2986 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2987 |
2086 | 2988 return 1; |
2989 } | |
2990 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2991 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4617 | 2992 #if 0 |
5575 | 2993 GaimConnection *gc = sess->aux_data; |
7283 | 2994 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2995 GaimXfer *xfer; |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2996 #endif |
4617 | 2997 va_list ap; |
2998 fu16_t reason; | |
2999 char *data, *buf; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3000 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3001 va_start(ap, fr); |
4617 | 3002 reason = (fu16_t)va_arg(ap, unsigned int); |
3752 | 3003 data = va_arg(ap, char *); |
2086 | 3004 va_end(ap); |
3005 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3006 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3007 "Message error with data %s and reason %hu\n", data, reason); |
4617 | 3008 |
3009 /* BBB */ | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3010 #if 0 |
4617 | 3011 /* If this was a file transfer request, data is a cookie */ |
3012 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
|
3013 gaim_xfer_cancel_remote(xfer); |
3630 | 3014 return 1; |
3015 } | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3016 #endif |
3630 | 3017 |
4617 | 3018 /* Data is assumed to be the destination sn */ |
3019 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
|
3020 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3021 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
4617 | 3022 g_free(buf); |
2086 | 3023 |
3024 return 1; | |
3025 } | |
3026 | |
3595 | 3027 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3028 GaimConnection *gc = sess->aux_data; |
3595 | 3029 va_list ap; |
3030 fu16_t type1, type2; | |
3031 char *sn; | |
3032 | |
3033 va_start(ap, fr); | |
4199 | 3034 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3035 sn = va_arg(ap, char *); |
4199 | 3036 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3037 va_end(ap); |
3038 | |
3039 switch (type2) { | |
3040 case 0x0000: { /* Text has been cleared */ | |
3041 serv_got_typing_stopped(gc, sn); | |
3042 } break; | |
3043 | |
3044 case 0x0001: { /* Paused typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3045 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
3595 | 3046 } break; |
3047 | |
3048 case 0x0002: { /* Typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3049 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
3595 | 3050 } break; |
3051 | |
3052 default: { | |
5435 | 3053 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 | 3054 } break; |
3055 } | |
3056 | |
3057 return 1; | |
3058 } | |
3059 | |
7141 | 3060 /* |
3061 * We get this error when there was an error in the locate family. This | |
7259 | 3062 * happens when you request info of someone who is offline. |
7141 | 3063 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3064 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
7259 | 3065 gchar *buf; |
2086 | 3066 va_list ap; |
5420 | 3067 fu16_t reason; |
2086 | 3068 char *destn; |
3069 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3070 va_start(ap, fr); |
4199 | 3071 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3072 destn = va_arg(ap, char *); |
3073 va_end(ap); | |
3074 | |
7781 | 3075 if (destn == NULL) |
7793 | 3076 return 1; |
3077 | |
3078 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); | |
7781 | 3079 |
3080 gaim_notify_error(sess->aux_data, NULL, buf, | |
3081 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); | |
3082 g_free(buf); | |
2086 | 3083 |
3084 return 1; | |
3085 } | |
3086 | |
6982 | 3087 #if 0 |
2086 | 3088 static char *images(int flags) { |
3089 static char buf[1024]; | |
3101 | 3090 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
2679 | 3091 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
2086 | 3092 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
3093 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
3101 | 3094 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
2086 | 3095 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
3079 | 3096 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
3097 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); | |
2086 | 3098 return buf; |
3099 } | |
6982 | 3100 #endif |
3101 | 3101 |
2920 | 3102 static char *caps_string(guint caps) |
3103 { | |
3104 static char buf[512], *tmp; | |
3105 int count = 0, i = 0; | |
3106 guint bit = 1; | |
4742 | 3107 |
3108 if (!caps) { | |
4744 | 3109 return NULL; |
6318 | 3110 } else while (bit <= AIM_CAPS_LAST) { |
2920 | 3111 if (bit & caps) { |
3112 switch (bit) { | |
6871 | 3113 case AIM_CAPS_BUDDYICON: |
2920 | 3114 tmp = _("Buddy Icon"); |
3115 break; | |
8092 | 3116 case AIM_CAPS_TALK: |
2920 | 3117 tmp = _("Voice"); |
3118 break; | |
6871 | 3119 case AIM_CAPS_DIRECTIM: |
7141 | 3120 tmp = _("AIM Direct IM"); |
2920 | 3121 break; |
6871 | 3122 case AIM_CAPS_CHAT: |
2920 | 3123 tmp = _("Chat"); |
3124 break; | |
6871 | 3125 case AIM_CAPS_GETFILE: |
2920 | 3126 tmp = _("Get File"); |
3127 break; | |
6871 | 3128 case AIM_CAPS_SENDFILE: |
2920 | 3129 tmp = _("Send File"); |
3130 break; | |
6871 | 3131 case AIM_CAPS_GAMES: |
3132 case AIM_CAPS_GAMES2: | |
2920 | 3133 tmp = _("Games"); |
3134 break; | |
8092 | 3135 case AIM_CAPS_ADDINS: |
4898 | 3136 tmp = _("Add-Ins"); |
2920 | 3137 break; |
6871 | 3138 case AIM_CAPS_SENDBUDDYLIST: |
2920 | 3139 tmp = _("Send Buddy List"); |
3140 break; | |
7141 | 3141 case AIM_CAPS_ICQ_DIRECT: |
3142 tmp = _("ICQ Direct Connect"); | |
2920 | 3143 break; |
6871 | 3144 case AIM_CAPS_APINFO: |
2920 | 3145 tmp = _("AP User"); |
3146 break; | |
6871 | 3147 case AIM_CAPS_ICQRTF: |
2920 | 3148 tmp = _("ICQ RTF"); |
3149 break; | |
6871 | 3150 case AIM_CAPS_EMPTY: |
2920 | 3151 tmp = _("Nihilist"); |
3152 break; | |
6871 | 3153 case AIM_CAPS_ICQSERVERRELAY: |
2920 | 3154 tmp = _("ICQ Server Relay"); |
3155 break; | |
6871 | 3156 case AIM_CAPS_ICQUTF8OLD: |
3157 tmp = _("Old ICQ UTF8"); | |
2920 | 3158 break; |
6871 | 3159 case AIM_CAPS_TRILLIANCRYPT: |
2920 | 3160 tmp = _("Trillian Encryption"); |
3161 break; | |
6871 | 3162 case AIM_CAPS_ICQUTF8: |
4742 | 3163 tmp = _("ICQ UTF8"); |
3164 break; | |
6318 | 3165 case AIM_CAPS_HIPTOP: |
3166 tmp = _("Hiptop"); | |
3167 break; | |
6871 | 3168 case AIM_CAPS_SECUREIM: |
7334 | 3169 tmp = _("Security Enabled"); |
6871 | 3170 break; |
7582 | 3171 case AIM_CAPS_VIDEO: |
3172 tmp = _("Video Chat"); | |
3173 break; | |
8092 | 3174 /* Not actually sure about this one... WinAIM doesn't show anything */ |
7945 | 3175 case AIM_CAPS_ICHATAV: |
3176 tmp = _("iChat AV"); | |
3177 break; | |
8092 | 3178 case AIM_CAPS_LIVEVIDEO: |
3179 tmp = _("Live Video"); | |
3180 break; | |
3181 case AIM_CAPS_CAMERA: | |
3182 tmp = _("Camera"); | |
3183 break; | |
2920 | 3184 default: |
3185 tmp = NULL; | |
3186 break; | |
3187 } | |
3188 if (tmp) | |
3189 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
3190 tmp); | |
3191 count++; | |
3192 } | |
3193 bit <<= 1; | |
3194 } | |
4744 | 3195 return buf; |
2920 | 3196 } |
3197 | |
7011 | 3198 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3199 GaimConnection *gc = sess->aux_data; |
7011 | 3200 GString *text; |
7162 | 3201 gchar *info_utf8 = NULL, *away_utf8 = NULL; |
3202 const char *final = NULL; | |
4791 | 3203 va_list ap; |
7011 | 3204 aim_userinfo_t *userinfo; |
2086 | 3205 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3206 va_start(ap, fr); |
7011 | 3207 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3208 va_end(ap); |
3209 | |
7011 | 3210 text = g_string_new(""); |
3211 g_string_append_printf(text, _("Username: <b>%s</b><br>\n"), userinfo->sn); | |
3212 g_string_append_printf(text, _("Warning Level: <b>%d%%</b><br>\n"), (int)((userinfo->warnlevel/10.0) + 0.5)); | |
3213 | |
3214 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
3215 g_string_append_printf(text, _("Online Since: <b>%s</b><br>\n"), | |
3216 asctime(localtime((time_t *)&userinfo->onlinesince))); | |
3217 | |
3218 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
3219 g_string_append_printf(text, _("Member Since: <b>%s</b><br>\n"), | |
3220 asctime(localtime((time_t *)&userinfo->membersince))); | |
3221 | |
3222 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3223 gchar *itime = gaim_str_seconds_to_string(userinfo->idletime*60); |
7011 | 3224 g_string_append_printf(text, _("Idle: <b>%s</b>"), itime); |
4426 | 3225 g_free(itime); |
2993 | 3226 } else |
7011 | 3227 g_string_append_printf(text, _("Idle: <b>Active</b>")); |
3228 | |
3229 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
8225 | 3230 gchar *charset = oscar_encoding_extract(userinfo->away_encoding); |
3231 away_utf8 = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len); | |
3232 g_free(charset); | |
7011 | 3233 if (away_utf8 != NULL) { |
7129 | 3234 g_string_append_printf(text, "<hr>%s", away_utf8); |
7011 | 3235 g_free(away_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3236 } |
7011 | 3237 } |
3238 | |
3239 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { | |
8225 | 3240 gchar *charset = oscar_encoding_extract(userinfo->info_encoding); |
3241 info_utf8 = oscar_encoding_to_utf8(charset, userinfo->info, userinfo->info_len); | |
3242 g_free(charset); | |
7011 | 3243 if (info_utf8 != NULL) { |
7129 | 3244 g_string_append_printf(text, "<hr>%s", info_utf8); |
7011 | 3245 g_free(info_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3246 } |
7011 | 3247 } |
3248 | |
7164 | 3249 final = gaim_str_sub_away_formatters(text->str, gaim_account_get_username(gaim_connection_get_account(gc))); |
7011 | 3250 g_string_free(text, TRUE); |
7091 | 3251 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, final, NULL, NULL); |
4151 | 3252 |
2086 | 3253 return 1; |
3254 } | |
3255 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3256 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3257 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3258 fu16_t id; |
2086 | 3259 va_list ap; |
3260 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3261 va_start(ap, fr); |
4199 | 3262 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3263 msg = va_arg(ap, char *); |
3264 va_end(ap); | |
3265 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3266 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3267 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
3268 if (id < 4) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3269 gaim_notify_warning(sess->aux_data, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3270 _("Your AIM connection may be lost."), NULL); |
2086 | 3271 |
3272 return 1; | |
3273 } | |
3274 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3275 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3276 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3277 fu16_t type; |
5575 | 3278 GaimConnection *gc = sess->aux_data; |
7283 | 3279 OscarData *od = (OscarData *)gc->proto_data; |
2086 | 3280 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3281 va_start(ap, fr); |
4199 | 3282 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3283 |
3284 switch(type) { | |
3285 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3286 fu8_t maxrooms; |
2086 | 3287 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3288 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3289 |
4199 | 3290 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 3291 exchangecount = va_arg(ap, int); |
3292 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
3293 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3294 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3295 "chat info: Chat Rights:\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3296 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3297 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3298 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3299 "chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3300 for (i = 0; i < exchangecount; i++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3301 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3302 "chat info: \t\t%hu %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3303 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
4617 | 3304 while (od->create_rooms) { |
3305 struct create_room *cr = od->create_rooms->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3306 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3307 "creating room %s\n", cr->name); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3308 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3309 g_free(cr->name); |
4617 | 3310 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3311 g_free(cr); |
2086 | 3312 } |
3313 } | |
3314 break; | |
3315 case 0x0008: { | |
3316 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3317 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3318 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3319 fu32_t createtime; |
2086 | 3320 |
3321 fqcn = va_arg(ap, char *); | |
4200 | 3322 instance = (fu16_t)va_arg(ap, unsigned int); |
3323 exchange = (fu16_t)va_arg(ap, unsigned int); | |
3324 flags = (fu16_t)va_arg(ap, unsigned int); | |
3325 createtime = va_arg(ap, fu32_t); | |
3326 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3327 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
3328 createperms = (fu8_t)va_arg(ap, unsigned int); | |
3329 unknown = (fu16_t)va_arg(ap, unsigned int); | |
3330 name = va_arg(ap, char *); | |
3331 ck = va_arg(ap, char *); | |
4194 | 3332 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3333 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3334 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", |
2086 | 3335 fqcn, |
3336 exchange, instance, flags, | |
3337 createtime, | |
3338 maxmsglen, maxoccupancy, createperms, unknown, | |
3339 name, ck); | |
4617 | 3340 aim_chat_join(od->sess, od->conn, exchange, ck, instance); |
2086 | 3341 } |
3342 break; | |
3343 default: | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3344 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3345 "chatnav info: unknown type (%04hx)\n", type); |
2086 | 3346 break; |
3347 } | |
4194 | 3348 |
3349 va_end(ap); | |
3350 | |
2086 | 3351 return 1; |
3352 } | |
3353 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3354 static int gaim_conv_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3355 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3356 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3357 aim_userinfo_t *info; |
5575 | 3358 GaimConnection *g = sess->aux_data; |
2086 | 3359 |
3360 struct chat_connection *c = NULL; | |
3361 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3362 va_start(ap, fr); |
2086 | 3363 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3364 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3365 va_end(ap); |
3366 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3367 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3368 if (!c) |
3369 return 1; | |
3370 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3371 for (i = 0; i < count; i++) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3372 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3373 |
3374 return 1; | |
3375 } | |
3376 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3377 static int gaim_conv_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3378 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3379 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3380 aim_userinfo_t *info; |
5575 | 3381 GaimConnection *g = sess->aux_data; |
2086 | 3382 |
3383 struct chat_connection *c = NULL; | |
3384 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3385 va_start(ap, fr); |
2086 | 3386 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3387 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3388 va_end(ap); |
3389 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3390 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3391 if (!c) |
3392 return 1; | |
3393 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3394 for (i = 0; i < count; i++) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3395 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3396 |
3397 return 1; | |
3398 } | |
3399 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3400 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
|
3401 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3402 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3403 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3404 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3405 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3406 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3407 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3408 fu32_t creationtime; |
5575 | 3409 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3410 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
|
3411 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3412 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3413 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3414 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3415 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3416 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3417 roomdesc = va_arg(ap, char *); |
4200 | 3418 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
3419 creationtime = va_arg(ap, fu32_t); | |
3420 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3421 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
3422 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
3423 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3424 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3425 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3426 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3427 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3428 maxmsglen, maxvisiblemsglen); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3429 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3430 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3431 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3432 |
2086 | 3433 return 1; |
3434 } | |
3435 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3436 static int gaim_conv_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3437 GaimConnection *gc = sess->aux_data; |
8225 | 3438 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
3439 gchar *utf8; | |
2086 | 3440 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3441 aim_userinfo_t *info; |
8225 | 3442 int len; |
2086 | 3443 char *msg; |
8219 | 3444 char *charset; |
2086 | 3445 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3446 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3447 info = va_arg(ap, aim_userinfo_t *); |
8219 | 3448 len = va_arg(ap, int); |
4194 | 3449 msg = va_arg(ap, char *); |
8219 | 3450 charset = va_arg(ap, char *); |
4194 | 3451 va_end(ap); |
2086 | 3452 |
8225 | 3453 utf8 = oscar_encoding_to_utf8(charset, msg, len); |
3454 serv_got_chat_in(gc, ccon->id, info->sn, 0, utf8, time((time_t)NULL)); | |
3455 g_free(utf8); | |
2086 | 3456 |
3457 return 1; | |
3458 } | |
3459 | |
3694 | 3460 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
3461 va_list ap; | |
5575 | 3462 GaimConnection *gc = sess->aux_data; |
3694 | 3463 struct aim_emailinfo *emailinfo; |
3725 | 3464 int havenewmail; |
7297 | 3465 char *alertitle, *alerturl; |
3694 | 3466 |
3467 va_start(ap, fr); | |
3468 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 3469 havenewmail = va_arg(ap, int); |
7301 | 3470 alertitle = va_arg(ap, char *); |
3471 alerturl = va_arg(ap, char *); | |
3694 | 3472 va_end(ap); |
3473 | |
5628 | 3474 if (emailinfo && gaim_account_get_check_mail(gc->account)) { |
5575 | 3475 gchar *to = g_strdup_printf("%s@%s", gaim_account_get_username(gaim_connection_get_account(gc)), emailinfo->domain); |
5542 | 3476 if (emailinfo->unread && havenewmail) |
3477 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); | |
5537 | 3478 g_free(to); |
3694 | 3479 } |
7297 | 3480 |
7301 | 3481 if (alertitle) |
7313 | 3482 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); |
3694 | 3483 |
3484 return 1; | |
3485 } | |
3486 | |
4804 | 3487 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3488 GaimConnection *gc = sess->aux_data; |
7283 | 3489 OscarData *od = gc->proto_data; |
4804 | 3490 char *sn; |
3491 | |
3492 sn = od->requesticon->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3493 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3494 "removing %s from hash table\n", sn); |
4804 | 3495 od->requesticon = g_slist_remove(od->requesticon, sn); |
3496 free(sn); | |
3497 | |
3498 if (od->icontimer) | |
3499 g_source_remove(od->icontimer); | |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
3500 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); |
4804 | 3501 |
3502 return 1; | |
3503 } | |
3504 | |
3505 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 3506 GaimConnection *gc = sess->aux_data; |
7283 | 3507 OscarData *od = gc->proto_data; |
4804 | 3508 GSList *cur; |
3509 va_list ap; | |
3510 char *sn; | |
4853 | 3511 fu8_t *iconcsum, *icon; |
3512 fu16_t iconcsumlen, iconlen; | |
4804 | 3513 |
3514 va_start(ap, fr); | |
3515 sn = va_arg(ap, char *); | |
4853 | 3516 iconcsum = va_arg(ap, fu8_t *); |
3517 iconcsumlen = va_arg(ap, int); | |
4804 | 3518 icon = va_arg(ap, fu8_t *); |
3519 iconlen = va_arg(ap, int); | |
3520 va_end(ap); | |
3521 | |
4853 | 3522 if (iconlen > 0) { |
3523 char *b16; | |
6695 | 3524 GaimBuddy *b = gaim_find_buddy(gc->account, sn); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3525 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3526 sn, icon, iconlen); |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
3527 b16 = gaim_base16_encode(iconcsum, iconcsumlen); |
5129 | 3528 if (b16) { |
7693 | 3529 gaim_blist_node_set_string((GaimBlistNode*)b, "icon_checksum", b16); |
5129 | 3530 gaim_blist_save(); |
7162 | 3531 g_free(b16); |
5129 | 3532 } |
4853 | 3533 } |
4804 | 3534 |
3535 cur = od->requesticon; | |
3536 while (cur) { | |
3537 char *cursn = cur->data; | |
3538 if (!aim_sncmp(cursn, sn)) { | |
3539 od->requesticon = g_slist_remove(od->requesticon, cursn); | |
3540 free(cursn); | |
3541 cur = od->requesticon; | |
3542 } else | |
3543 cur = cur->next; | |
3544 } | |
3545 | |
3546 if (od->icontimer) | |
3547 g_source_remove(od->icontimer); | |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
3548 od->icontimer = gaim_timeout_add(250, gaim_icon_timerfunc, gc); |
4804 | 3549 |
3550 return 1; | |
3551 } | |
3552 | |
3553 static gboolean gaim_icon_timerfunc(gpointer data) { | |
5575 | 3554 GaimConnection *gc = data; |
7283 | 3555 OscarData *od = gc->proto_data; |
7011 | 3556 aim_userinfo_t *userinfo; |
4804 | 3557 aim_conn_t *conn; |
3558 | |
3559 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | |
5892 | 3560 if (!conn) { |
3561 if (!od->iconconnecting) { | |
3562 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
3563 od->iconconnecting = TRUE; | |
3564 } | |
4804 | 3565 return FALSE; |
3566 } | |
3567 | |
5842 | 3568 if (od->set_icon) { |
6039 | 3569 struct stat st; |
3570 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
3571 if (iconfile == NULL) { | |
3572 /* Set an empty icon, or something */ | |
3573 } else if (!stat(iconfile, &st)) { | |
3574 char *buf = g_malloc(st.st_size); | |
3575 FILE *file = fopen(iconfile, "rb"); | |
3576 if (file) { | |
3577 fread(buf, 1, st.st_size, file); | |
3578 fclose(file); | |
3579 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
3580 "Uploading icon to icon server\n"); | |
6879 | 3581 aim_bart_upload(od->sess, buf, st.st_size); |
5842 | 3582 } else |
3583 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6039 | 3584 "Can't open buddy icon file!\n"); |
3585 g_free(buf); | |
3586 } else { | |
3587 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
3588 "Can't stat buddy icon file!\n"); | |
5842 | 3589 } |
3590 od->set_icon = FALSE; | |
3591 } | |
3592 | |
3593 if (!od->requesticon) { | |
3594 gaim_debug(GAIM_DEBUG_MISC, "oscar", | |
3595 "no more icons to request\n"); | |
3596 return FALSE; | |
3597 } | |
3598 | |
7045 | 3599 userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data); |
7011 | 3600 if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) { |
3601 aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen); | |
4804 | 3602 return FALSE; |
3603 } else { | |
3604 char *sn = od->requesticon->data; | |
3605 od->requesticon = g_slist_remove(od->requesticon, sn); | |
3606 free(sn); | |
3607 } | |
3608 | |
3609 return TRUE; | |
3610 } | |
3611 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3612 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3613 * 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
|
3614 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3615 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3616 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3617 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3618 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3619 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3620 va_start(ap, fr); |
4199 | 3621 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3622 sn = va_arg(ap, char *); |
3623 va_end(ap); | |
3624 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3625 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sent message to %s.\n", sn); |
2086 | 3626 |
3627 return 1; | |
3628 } | |
3629 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3630 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
|
3631 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3632 "invalid", |
4194 | 3633 "change", |
3634 "warning", | |
3635 "limit", | |
3636 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3637 }; |
2086 | 3638 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3639 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3640 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3641 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3642 va_start(ap, fr); |
4200 | 3643 code = (fu16_t)va_arg(ap, unsigned int); |
3644 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
3645 windowsize = va_arg(ap, fu32_t); | |
3646 clear = va_arg(ap, fu32_t); | |
3647 alert = va_arg(ap, fu32_t); | |
3648 limit = va_arg(ap, fu32_t); | |
3649 disconnect = va_arg(ap, fu32_t); | |
3650 currentavg = va_arg(ap, fu32_t); | |
3651 maxavg = va_arg(ap, fu32_t); | |
2086 | 3652 va_end(ap); |
3653 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3654 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3655 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " |
3656 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", | |
2086 | 3657 (code < 5) ? codes[code] : codes[0], |
3658 rateclass, | |
3659 currentavg, maxavg, | |
3660 alert, clear, | |
3661 limit, disconnect, | |
3662 windowsize); | |
3663 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3664 /* XXX fix these values */ |
2086 | 3665 if (code == AIM_RATE_CODE_CHANGE) { |
3666 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3667 aim_conn_setlatency(fr->conn, 0); |
2086 | 3668 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3669 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
3670 } else if (code == AIM_RATE_CODE_LIMIT) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3671 gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."), |
6040 | 3672 _("The last action you attempted could not be " |
3673 "performed because you are over the rate limit. " | |
3674 "Please wait 10 seconds and try again.")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3675 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 3676 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3677 aim_conn_setlatency(fr->conn, 0); |
2086 | 3678 } |
3679 | |
3680 return 1; | |
3681 } | |
3682 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3683 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3684 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3685 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3686 aim_userinfo_t *userinfo; |
5575 | 3687 GaimConnection *gc = sess->aux_data; |
2086 | 3688 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3689 va_start(ap, fr); |
4199 | 3690 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3691 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3692 va_end(ap); |
3693 | |
7111 | 3694 serv_got_eviled(gc, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); |
2086 | 3695 |
3696 return 1; | |
3697 } | |
3698 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3699 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
|
3700 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3701 aim_userinfo_t *info; |
5575 | 3702 GaimConnection *gc = sess->aux_data; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3703 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3704 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3705 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3706 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3707 |
5628 | 3708 gc->evil = (info->warnlevel/10.0) + 0.5; |
4841 | 3709 |
7872 | 3710 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
4841 | 3711 gc->login_time_official = info->onlinesince; |
7872 | 3712 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
3713 gc->login_time_official = time(NULL) - info->sessionlen; | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3714 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3715 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3716 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3717 |
4649 | 3718 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3719 GaimConnection *gc = sess->aux_data; |
7283 | 3720 OscarData *od = gc->proto_data; |
4649 | 3721 va_list ap; |
3722 fu16_t code; | |
3723 char *msg; | |
3724 | |
3725 va_start(ap, fr); | |
3726 code = (fu16_t)va_arg(ap, int); | |
3727 msg = va_arg(ap, char *); | |
3728 va_end(ap); | |
3729 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3730 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3731 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); |
4649 | 3732 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { |
4651 | 3733 if (code == 0x0001) { |
6113 | 3734 gc->wants_to_die = TRUE; |
5579 | 3735 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); |
4651 | 3736 } else { |
5579 | 3737 gaim_connection_error(gc, _("You have been signed off for an unknown reason.")); |
4651 | 3738 } |
4666 | 3739 od->killme = TRUE; |
4649 | 3740 } |
3741 | |
3742 return 1; | |
3743 } | |
3744 | |
2675 | 3745 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
7283 | 3746 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3747 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3748 aim_reqpersonalinfo(sess, fr->conn); |
4230 | 3749 |
3750 #ifndef NOSSI | |
7334 | 3751 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting rights and list\n"); |
4889 | 3752 aim_ssi_reqrights(sess); |
6350 | 3753 aim_ssi_reqdata(sess); |
4230 | 3754 #endif |
3755 | |
7011 | 3756 aim_locate_reqrights(sess); |
7285 | 3757 aim_buddylist_reqrights(sess, fr->conn); |
4617 | 3758 aim_im_reqparams(sess); |
7334 | 3759 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */ |
4230 | 3760 |
3761 #ifdef NOSSI | |
7334 | 3762 gaim_debug(GAIM_DEBUG_INFO, "oscar", "bos: requesting rights\n"); |
3763 aim_bos_reqrights(sess, fr->conn); | |
4230 | 3764 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
3765 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
3766 #endif | |
2086 | 3767 |
7283 | 3768 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); |
3769 | |
2086 | 3770 return 1; |
3771 } | |
3772 | |
2675 | 3773 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3774 GaimConnection *gc = sess->aux_data; |
7283 | 3775 OscarData *od = gc->proto_data; |
2647 | 3776 |
6905 | 3777 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); |
3778 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); | |
3779 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); | |
3780 | |
2672 | 3781 aim_clientready(sess, fr->conn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3782 gaim_debug(GAIM_DEBUG_INFO, "oscar", "connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3783 |
2647 | 3784 if (od->chpass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3785 gaim_debug(GAIM_DEBUG_INFO, "oscar", "changing password\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3786 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 3787 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3788 od->oldp = NULL; |
2647 | 3789 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3790 od->newp = NULL; |
2647 | 3791 od->chpass = FALSE; |
3792 } | |
2979 | 3793 if (od->setnick) { |
8152 | 3794 gaim_debug(GAIM_DEBUG_INFO, "oscar", "formatting screen name\n"); |
2979 | 3795 aim_admin_setnick(sess, fr->conn, od->newsn); |
3796 g_free(od->newsn); | |
3797 od->newsn = NULL; | |
3798 od->setnick = FALSE; | |
3799 } | |
2647 | 3800 if (od->conf) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3801 gaim_debug(GAIM_DEBUG_INFO, "oscar", "confirming account\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3802 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 3803 od->conf = FALSE; |
3804 } | |
3805 if (od->reqemail) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3806 gaim_debug(GAIM_DEBUG_INFO, "oscar", "requesting email\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3807 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 3808 od->reqemail = FALSE; |
3809 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3810 if (od->setemail) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3811 gaim_debug(GAIM_DEBUG_INFO, "oscar", "setting email\n"); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3812 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3813 g_free(od->email); |
5497 | 3814 od->email = NULL; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3815 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3816 } |
2647 | 3817 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3818 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3819 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3820 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3821 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
|
3822 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3823 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3824 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3825 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3826 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3827 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3828 |
4194 | 3829 /* 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
|
3830 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " |
5556 | 3831 "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
|
3832 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3833 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3834 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
3835 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3836 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3837 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 3838 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3839 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3840 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3841 |
4617 | 3842 aim_im_setparams(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3843 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3844 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3845 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3846 |
2993 | 3847 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3848 { | |
5575 | 3849 GaimConnection *gc = sess->aux_data; |
7283 | 3850 OscarData *od = (OscarData *)gc->proto_data; |
5306 | 3851 va_list ap; |
3852 fu16_t maxsiglen; | |
2993 | 3853 |
3854 va_start(ap, fr); | |
4199 | 3855 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 3856 va_end(ap); |
3857 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3858 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3859 "locate rights: max sig len = %d\n", maxsiglen); |
2993 | 3860 |
4617 | 3861 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; |
3862 | |
3863 if (od->icq) | |
7334 | 3864 aim_locate_setcaps(od->sess, caps_icq); |
5301 | 3865 else |
7334 | 3866 aim_locate_setcaps(od->sess, caps_aim); |
3867 oscar_set_info(gc, gc->account->user_info); | |
2993 | 3868 |
3869 return 1; | |
3870 } | |
3871 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3872 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
|
3873 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3874 fu16_t maxbuddies, maxwatchers; |
5575 | 3875 GaimConnection *gc = sess->aux_data; |
7283 | 3876 OscarData *od = (OscarData *)gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3877 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3878 va_start(ap, fr); |
4199 | 3879 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3880 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3881 va_end(ap); |
3882 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3883 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3884 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 3885 |
4617 | 3886 od->rights.maxbuddies = (guint)maxbuddies; |
3887 od->rights.maxwatchers = (guint)maxwatchers; | |
2993 | 3888 |
2086 | 3889 return 1; |
3890 } | |
3891 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3892 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3893 GaimConnection *gc = sess->aux_data; |
7283 | 3894 OscarData *od = (OscarData *)gc->proto_data; |
7334 | 3895 va_list ap; |
3896 fu16_t maxpermits, maxdenies; | |
2086 | 3897 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3898 va_start(ap, fr); |
4199 | 3899 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3900 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3901 va_end(ap); |
3902 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3903 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3904 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 3905 |
4617 | 3906 od->rights.maxpermits = (guint)maxpermits; |
3907 od->rights.maxdenies = (guint)maxdenies; | |
2993 | 3908 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
3909 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2993 | 3910 serv_finish_login(gc); |
3911 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3912 gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n"); |
2993 | 3913 |
2672 | 3914 aim_clientready(sess, fr->conn); |
5948 | 3915 aim_srv_setavailmsg(sess, NULL); |
7474 | 3916 aim_srv_setidle(sess, 0); |
4617 | 3917 |
4664 | 3918 if (od->icq) { |
3919 aim_icq_reqofflinemsgs(sess); | |
3920 aim_icq_hideip(sess); | |
3921 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3922 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3923 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 3924 if (sess->authinfo->email) |
3925 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 3926 |
3927 return 1; | |
3928 } | |
3929 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3930 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
|
3931 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3932 struct aim_icq_offlinemsg *msg; |
4075 | 3933 struct aim_incomingim_ch4_args args; |
3934 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3935 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3936 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3937 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3938 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3939 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3940 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3941 "Received offline message. Converting to channel 4 ICBM...\n"); |
4075 | 3942 args.uin = msg->sender; |
3943 args.type = msg->type; | |
4173 | 3944 args.flags = msg->flags; |
4076 | 3945 args.msglen = msg->msglen; |
4075 | 3946 args.msg = msg->msg; |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3947 t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); |
4075 | 3948 incomingim_chan4(sess, fr->conn, NULL, &args, t); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3949 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3950 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3951 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3952 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3953 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
|
3954 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3955 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3956 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3957 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3958 |
7388 | 3959 #if 0 |
3960 /* | |
7465 | 3961 * Update, 2003-11-09: |
3962 * Joseph S. Myers, a gcc dude, fixed this for gcc 3.4! Rock on! | |
3963 * | |
7388 | 3964 * It may not be my place to do this, but... |
3965 * I feel pretty strongly that the "last 2 digits" warning is ridiculously | |
3966 * stupid, and should not exist for % switches (%x in our case) that request | |
3967 * a year in the preferred representation for the current locale. For that | |
3968 * reason I've chosen to not use this workaround (n., see kluge). | |
3969 * | |
3970 * I have a date. I want to show it to the user in the "preferred" way. | |
3971 * Whether that displays a 2 digit year is perfectly fine--after all, it's | |
3972 * what the locale wanted. | |
3973 * | |
3974 * If I have a necessity for a full representation of the year in the current | |
3975 * locale, then I'll use a switch that returns a full representation of the | |
3976 * year. | |
3977 * | |
3978 * If you think the preferred locale should show 4 digits instead of 2 digits | |
3979 * (because you're anal, or whatever), then change the f***ing locale. | |
3980 * | |
3981 * I guess the bottom line is--I'm trying to show a date to the user how they | |
3982 * prefer to see it, why the hell does gcc want me to change that? | |
7389 | 3983 * |
3984 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3190 | |
3985 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8714 | |
7388 | 3986 */ |
3987 | |
3988 /* | |
3989 * This function was recommended by the STRFTIME(3) man page to remove the | |
7386 | 3990 * "last 2 digits" warning. |
3991 */ | |
3992 static size_t my_strftime(char *s, size_t max, const char *fmt, | |
3993 const struct tm *tm) | |
3994 { | |
3995 return strftime(s, max, fmt, tm); | |
3996 } | |
7388 | 3997 #endif |
7386 | 3998 |
4624 | 3999 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
|
4000 { |
5575 | 4001 GaimConnection *gc = sess->aux_data; |
4819 | 4002 gchar *buf, *tmp, *utf8; |
4624 | 4003 gchar who[16]; |
6873 | 4004 GaimBuddy *buddy; |
4005 gchar *primary; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4006 va_list ap; |
4151 | 4007 struct aim_icq_info *info; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4008 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4009 va_start(ap, fr); |
4151 | 4010 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4011 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4012 |
4664 | 4013 if (!info->uin) |
4014 return 0; | |
4015 | |
5556 | 4016 g_snprintf(who, sizeof(who), "%u", info->uin); |
6623 | 4017 buf = g_strdup_printf("<b>%s:</b> %s", _("UIN"), who); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4018 if (info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { |
6623 | 4019 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Nick"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 4020 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4021 if (info->first && info->first[0] && (utf8 = gaim_utf8_try_convert(info->first))) { |
6623 | 4022 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("First Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 4023 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4024 if (info->last && info->last[0] && (utf8 = gaim_utf8_try_convert(info->last))) { |
6623 | 4025 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Last Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 4026 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4027 if (info->email && info->email[0] && (utf8 = gaim_utf8_try_convert(info->email))) { |
6623 | 4028 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 | 4029 } |
4030 if (info->numaddresses && info->email2) { | |
4031 int i; | |
4032 for (i = 0; i < info->numaddresses; i++) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4033 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_utf8_try_convert(info->email2[i]))) { |
6623 | 4034 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 | 4035 } |
4625 | 4036 } |
4624 | 4037 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4038 if (info->mobile && info->mobile[0] && (utf8 = gaim_utf8_try_convert(info->mobile))) { |
6623 | 4039 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Mobile Phone"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4625 | 4040 } |
4041 if (info->gender) { | |
6623 | 4042 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Gender"), ":</b> ", info->gender==1 ? _("Female") : _("Male"), NULL); g_free(tmp); |
4151 | 4043 } |
4624 | 4044 if (info->birthyear || info->birthmonth || info->birthday) { |
4627 | 4045 char date[30]; |
4046 struct tm tm; | |
4047 tm.tm_mday = (int)info->birthday; | |
4048 tm.tm_mon = (int)info->birthmonth-1; | |
4049 tm.tm_year = (int)info->birthyear-1900; | |
7388 | 4050 strftime(date, sizeof(date), "%x", &tm); |
6623 | 4051 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Birthday"), ":</b> ", date, NULL); g_free(tmp); |
4151 | 4052 } |
4624 | 4053 if (info->age) { |
4054 char age[5]; | |
4055 snprintf(age, sizeof(age), "%hhd", info->age); | |
6623 | 4056 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Age"), ":</b> ", age, NULL); g_free(tmp); |
4819 | 4057 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4058 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_utf8_try_convert(info->personalwebpage))) { |
6623 | 4059 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 | 4060 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4061 if (info->info && info->info[0] && (utf8 = gaim_utf8_try_convert(info->info))) { |
6623 | 4062 tmp = buf; buf = g_strconcat(tmp, "<hr><b>", _("Additional Information"), ":</b><br>", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4063 } |
4064 tmp = buf; buf = g_strconcat(tmp, "<hr>\n", NULL); g_free(tmp); | |
4641 | 4065 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
6623 | 4066 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
|
4067 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_utf8_try_convert(info->homeaddr))) { |
6623 | 4068 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4069 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4070 if (info->homecity && info->homecity[0] && (utf8 = gaim_utf8_try_convert(info->homecity))) { |
6623 | 4071 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4072 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4073 if (info->homestate && info->homestate[0] && (utf8 = gaim_utf8_try_convert(info->homestate))) { |
6623 | 4074 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4075 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4076 if (info->homezip && info->homezip[0] && (utf8 = gaim_utf8_try_convert(info->homezip))) { |
6623 | 4077 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4078 } |
4079 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 4080 } |
4641 | 4081 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
6623 | 4082 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
|
4083 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_utf8_try_convert(info->workaddr))) { |
6623 | 4084 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4085 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4086 if (info->workcity && info->workcity[0] && (utf8 = gaim_utf8_try_convert(info->workcity))) { |
6623 | 4087 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4088 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4089 if (info->workstate && info->workstate[0] && (utf8 = gaim_utf8_try_convert(info->workstate))) { |
6623 | 4090 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4091 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4092 if (info->workzip && info->workzip[0] && (utf8 = gaim_utf8_try_convert(info->workzip))) { |
6623 | 4093 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4094 } |
4095 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4096 } | |
4641 | 4097 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
6623 | 4098 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
|
4099 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_utf8_try_convert(info->workcompany))) { |
6623 | 4100 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Company"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4101 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4102 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_utf8_try_convert(info->workdivision))) { |
6623 | 4103 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Division"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4104 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4105 if (info->workposition && info->workposition[0] && (utf8 = gaim_utf8_try_convert(info->workposition))) { |
6623 | 4106 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Position"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4107 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4108 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_utf8_try_convert(info->workwebpage))) { |
6623 | 4109 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 | 4110 } |
4111 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 4112 } |
4113 | |
6873 | 4114 buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); |
4115 primary = g_strdup_printf(_("ICQ Info for %s"), gaim_get_buddy_alias(buddy)); | |
4116 gaim_notify_formatted(gc, NULL, primary, NULL, buf, NULL, NULL); | |
4117 g_free(primary); | |
4151 | 4118 g_free(buf); |
4119 | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4120 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4121 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4122 |
4759 | 4123 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
4124 { | |
5575 | 4125 GaimConnection *gc = sess->aux_data; |
4820 | 4126 gchar who[16], *utf8; |
6695 | 4127 GaimBuddy *b; |
4759 | 4128 va_list ap; |
4129 struct aim_icq_info *info; | |
4130 | |
4131 va_start(ap, fr); | |
4132 info = va_arg(ap, struct aim_icq_info *); | |
4133 va_end(ap); | |
4134 | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4135 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { |
5556 | 4136 g_snprintf(who, sizeof(who), "%u", info->uin); |
4820 | 4137 serv_got_alias(gc, who, utf8); |
4759 | 4138 if ((b = gaim_find_buddy(gc->account, who))) { |
7693 | 4139 gaim_blist_node_set_string((GaimBlistNode*)b, "servernick", utf8); |
4759 | 4140 gaim_blist_save(); |
4141 } | |
4820 | 4142 g_free(utf8); |
4759 | 4143 } |
4144 | |
4145 return 1; | |
4146 } | |
4147 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4148 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
|
4149 { |
7032 | 4150 GaimConnection *gc = sess->aux_data; |
4151 gchar *text; | |
4152 va_list ap; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4153 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4154 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4155 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4156 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4157 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4158 url = va_arg(ap, char *); |
4199 | 4159 wid = (fu16_t) va_arg(ap, int); |
4160 hei = (fu16_t) va_arg(ap, int); | |
4161 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4162 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4163 |
7032 | 4164 text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url); |
4165 gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); | |
4166 g_free(text); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4167 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4168 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4169 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4170 |
7032 | 4171 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) |
4172 { | |
6873 | 4173 GaimConnection *gc = sess->aux_data; |
4174 gchar *secondary; | |
4175 GString *text; | |
4176 int i, num; | |
2086 | 4177 va_list ap; |
6873 | 4178 char *email, *SNs; |
2086 | 4179 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4180 va_start(ap, fr); |
6873 | 4181 email = va_arg(ap, char *); |
2086 | 4182 num = va_arg(ap, int); |
4183 SNs = va_arg(ap, char *); | |
4184 va_end(ap); | |
4185 | |
8152 | 4186 secondary = g_strdup_printf(_("The following screen names are associated with %s"), email); |
6873 | 4187 text = g_string_new(""); |
2086 | 4188 for (i = 0; i < num; i++) |
6873 | 4189 g_string_append_printf(text, "%s<br>", &SNs[i * (MAXSNLEN + 1)]); |
4190 gaim_notify_formatted(gc, NULL, _("Search Results"), secondary, text->str, NULL, NULL); | |
4191 | |
4192 g_free(secondary); | |
4193 g_string_free(text, TRUE); | |
2086 | 4194 |
4195 return 1; | |
4196 } | |
4197 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4198 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4199 va_list ap; |
6873 | 4200 char *email; |
5420 | 4201 char *buf; |
2086 | 4202 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4203 va_start(ap, fr); |
6873 | 4204 email = va_arg(ap, char *); |
2086 | 4205 va_end(ap); |
4206 | |
6873 | 4207 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
|
4208 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 4209 g_free(buf); |
2086 | 4210 |
4211 return 1; | |
4212 } | |
4213 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4214 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
6873 | 4215 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4216 fu16_t status; |
2086 | 4217 va_list ap; |
4218 char msg[256]; | |
4219 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4220 va_start(ap, fr); |
4199 | 4221 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 4222 va_end(ap); |
4223 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4224 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4225 "account confirmation returned status 0x%04x (%s)\n", status, |
3912 | 4226 status ? "unknown" : "email sent"); |
4227 if (!status) { | |
5302 | 4228 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
5575 | 4229 gaim_account_get_username(gaim_connection_get_account(gc))); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4230 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
2086 | 4231 } |
4232 | |
4233 return 1; | |
4234 } | |
4235 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4236 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4237 GaimConnection *gc = sess->aux_data; |
2086 | 4238 va_list ap; |
3912 | 4239 fu16_t perms, err; |
4240 char *url, *sn, *email; | |
4241 int change; | |
2086 | 4242 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4243 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4244 change = va_arg(ap, int); |
4199 | 4245 perms = (fu16_t) va_arg(ap, unsigned int); |
4246 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 4247 url = va_arg(ap, char *); |
4248 sn = va_arg(ap, char *); | |
4249 email = va_arg(ap, char *); | |
2086 | 4250 va_end(ap); |
4251 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4252 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4253 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
3912 | 4254 change ? "change" : "request", perms, err, url, sn, email); |
4255 | |
4256 if (err && url) { | |
4257 char *dialog_msg; | |
4258 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
4259 switch (err) { | |
4260 case 0x0001: { | |
4261 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
4262 } break; | |
4263 case 0x0006: { | |
4264 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
4265 } break; | |
4266 case 0x000b: { | |
4267 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
4268 } break; | |
4269 case 0x001d: { | |
4270 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); | |
4271 } break; | |
4272 case 0x0021: { | |
4273 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); | |
4274 } break; | |
4275 case 0x0023: { | |
4276 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
4277 } break; | |
4278 default: { | |
4279 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
4280 } break; | |
4281 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4282 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); |
3912 | 4283 g_free(dialog_top); |
4284 g_free(dialog_msg); | |
4285 return 1; | |
4286 } | |
4287 | |
4288 if (sn) { | |
4585 | 4289 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
|
4290 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4291 g_free(dialog_msg); |
4292 } | |
4293 | |
4294 if (email) { | |
5575 | 4295 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), |
4296 gaim_account_get_username(gaim_connection_get_account(gc)), email); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4297 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4298 g_free(dialog_msg); |
2086 | 4299 } |
4300 | |
4301 return 1; | |
4302 } | |
4303 | |
5575 | 4304 static void oscar_keepalive(GaimConnection *gc) { |
7283 | 4305 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4306 aim_flap_nop(od->sess, od->conn); |
2086 | 4307 } |
4308 | |
6059 | 4309 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { |
7283 | 4310 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4311 struct direct_im *dim = find_direct_im(od, name); |
3595 | 4312 if (dim) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4313 if (typing == GAIM_TYPING) |
4870 | 4314 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4315 else if (typing == GAIM_TYPED) |
4870 | 4316 aim_odc_send_typing(od->sess, dim->conn, 0x0001); |
4317 else | |
4318 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
3595 | 4319 else { |
5300 | 4320 /* Don't send if this turkey is in our deny list */ |
4321 GSList *list; | |
4322 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); | |
4323 if (!list) { | |
7261 | 4324 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
5300 | 4325 if (bi && bi->typingnot) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4326 if (typing == GAIM_TYPING) |
5300 | 4327 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4328 else if (typing == GAIM_TYPED) |
5300 | 4329 aim_im_sendmtn(od->sess, 0x0001, name, 0x0001); |
4330 else | |
4331 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); | |
4332 } | |
3595 | 4333 } |
4334 } | |
2993 | 4335 return 0; |
4336 } | |
5575 | 4337 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
|
4338 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
|
4339 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4340 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { |
7283 | 4341 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4342 struct direct_im *dim = find_direct_im(od, name); |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4343 int ret = 0; |
3659 | 4344 GError *err = NULL; |
5575 | 4345 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
|
4346 char *tmpmsg = NULL; |
3458 | 4347 |
4838 | 4348 if (dim && dim->connected) { |
4349 /* If we're directly connected, send a direct IM */ | |
6982 | 4350 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
|
4351 } else if (imflags & GAIM_CONV_IM_IMAGES) { |
3044 | 4352 /* Trying to send an IM image outside of a direct connection. */ |
4353 oscar_ask_direct_im(gc, name); | |
4838 | 4354 ret = -ENOTCONN; |
2086 | 4355 } else { |
4738 | 4356 struct buddyinfo *bi; |
3008 | 4357 struct aim_sendimext_args args; |
4358 struct stat st; | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4359 gsize len; |
4269 | 4360 |
7261 | 4361 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
4738 | 4362 if (!bi) { |
4363 bi = g_new0(struct buddyinfo, 1); | |
7261 | 4364 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi); |
4738 | 4365 } |
4366 | |
3008 | 4367 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
4665 | 4368 if (od->icq) { |
4369 args.features = features_icq; | |
4370 args.featureslen = sizeof(features_icq); | |
3008 | 4371 args.flags |= AIM_IMFLAGS_OFFLINE; |
4665 | 4372 } else { |
4373 args.features = features_aim; | |
4374 args.featureslen = sizeof(features_aim); | |
4972 | 4375 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4376 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
4972 | 4377 args.flags |= AIM_IMFLAGS_AWAY; |
4665 | 4378 } |
4269 | 4379 |
4738 | 4380 if (bi->ico_need) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4381 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4382 "Sending buddy icon request with message\n"); |
3008 | 4383 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4738 | 4384 bi->ico_need = FALSE; |
3008 | 4385 } |
4269 | 4386 |
5575 | 4387 if (iconfile && !stat(iconfile, &st)) { |
4388 FILE *file = fopen(iconfile, "r"); | |
3008 | 4389 if (file) { |
4390 char *buf = g_malloc(st.st_size); | |
4391 fread(buf, 1, st.st_size, file); | |
6039 | 4392 fclose(file); |
4269 | 4393 |
3008 | 4394 args.iconlen = st.st_size; |
4617 | 4395 args.iconsum = aimutil_iconsum(buf, st.st_size); |
3008 | 4396 args.iconstamp = st.st_mtime; |
4397 | |
7406 | 4398 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { |
4738 | 4399 bi->ico_informed = FALSE; |
7406 | 4400 bi->ico_sent = FALSE; |
4401 } | |
4738 | 4402 |
4403 if (!bi->ico_informed) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4404 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4405 "Claiming to have a buddy icon\n"); |
4738 | 4406 args.flags |= AIM_IMFLAGS_HASICON; |
4407 bi->ico_me_len = args.iconlen; | |
4408 bi->ico_me_csum = args.iconsum; | |
4409 bi->ico_me_time = args.iconstamp; | |
4410 bi->ico_informed = TRUE; | |
4411 } | |
4412 | |
3008 | 4413 g_free(buf); |
2086 | 4414 } |
4415 } | |
4269 | 4416 |
3008 | 4417 args.destsn = name; |
4269 | 4418 |
6310 | 4419 /* For ICQ send newlines as CR/LF, for AIM send newlines as <BR> */ |
4420 if (isdigit(name[0])) | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4421 tmpmsg = gaim_str_add_cr(message); |
6310 | 4422 else |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4423 tmpmsg = gaim_strdup_withhtml(message); |
6310 | 4424 len = strlen(tmpmsg); |
4425 | |
4426 args.flags |= oscar_encoding_check(tmpmsg); | |
3642 | 4427 if (args.flags & AIM_IMFLAGS_UNICODE) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4428 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode IM\n"); |
4662 | 4429 args.charset = 0x0002; |
4665 | 4430 args.charsubset = 0x0000; |
6310 | 4431 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
3659 | 4432 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4433 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4434 "Error converting a unicode message: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4435 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4436 "This really shouldn't happen!\n"); |
3659 | 4437 /* We really shouldn't try to send the |
4438 * IM now, but I'm not sure what to do */ | |
4800 | 4439 g_error_free(err); |
3659 | 4440 } |
3850 | 4441 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4442 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4443 "Sending ISO-8859-1 IM\n"); |
4662 | 4444 args.charset = 0x0003; |
4665 | 4445 args.charsubset = 0x0000; |
6310 | 4446 args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
3659 | 4447 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4448 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4449 "conversion error: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4450 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4451 "Someone tell Ethan his 8859-1 detection is wrong\n"); |
3642 | 4452 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
6310 | 4453 len = strlen(tmpmsg); |
4800 | 4454 g_error_free(err); |
6310 | 4455 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
3659 | 4456 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4457 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4458 "Error in unicode fallback: %s\n", err->message); |
4800 | 4459 g_error_free(err); |
3659 | 4460 } |
3642 | 4461 } |
4462 } else { | |
4662 | 4463 args.charset = 0x0000; |
4464 args.charsubset = 0x0000; | |
6310 | 4465 args.msg = tmpmsg; |
3642 | 4466 } |
4467 args.msglen = len; | |
4269 | 4468 |
4617 | 4469 ret = aim_im_sendch1_ext(od->sess, &args); |
2086 | 4470 } |
4838 | 4471 |
6310 | 4472 g_free(tmpmsg); |
4473 | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4474 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4475 return 1; |
6310 | 4476 |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4477 return ret; |
2086 | 4478 } |
4479 | |
7011 | 4480 static void oscar_get_info(GaimConnection *gc, const char *name) { |
7283 | 4481 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 4482 |
7173 | 4483 if (od->icq && isdigit(name[0])) |
4624 | 4484 aim_icq_getallinfo(od->sess, name); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4485 else |
7235 | 4486 aim_locate_getinfoshort(od->sess, name, 0x00000003); |
7011 | 4487 } |
4488 | |
4489 static void oscar_get_away(GaimConnection *gc, const char *who) { | |
7283 | 4490 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4491 if (od->icq) { |
7011 | 4492 GaimBuddy *budlight = gaim_find_buddy(gc->account, who); |
3212 | 4493 if (budlight) |
3595 | 4494 if ((budlight->uc & 0xffff0000) >> 16) |
4687 | 4495 aim_im_sendch2_geticqaway(od->sess, who, (budlight->uc & 0xffff0000) >> 16); |
3212 | 4496 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4497 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4498 "Error: The user %s has no status message, therefore not requesting.\n", who); |
3212 | 4499 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4500 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
7023 | 4501 "Error: Could not find %s in local buddy list, therefore unable to request status message.\n", who); |
3212 | 4502 } else |
7011 | 4503 aim_locate_getinfoshort(od->sess, who, 0x00000002); |
4504 } | |
4505 | |
4506 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, | |
3466 | 4507 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4617 | 4508 /* XXX - some of these things are wrong, but i'm lazy */ |
7283 | 4509 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 4510 aim_locate_setdirinfo(od->sess, first, middle, last, |
2086 | 4511 maiden, NULL, NULL, city, state, NULL, 0, web); |
4512 } | |
4513 | |
5575 | 4514 static void oscar_set_idle(GaimConnection *gc, int time) { |
7283 | 4515 OscarData *od = (OscarData *)gc->proto_data; |
7474 | 4516 aim_srv_setidle(od->sess, time); |
2086 | 4517 } |
4518 | |
5954 | 4519 static void oscar_set_info(GaimConnection *gc, const char *text) { |
7283 | 4520 OscarData *od = (OscarData *)gc->proto_data; |
5129 | 4521 fu32_t flags = 0; |
6019 | 4522 char *text_html = NULL; |
5129 | 4523 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4524 gsize msglen = 0; |
2993 | 4525 |
4617 | 4526 if (od->rights.maxsiglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4527 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4528 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4529 "profile before the login procedure completed. " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4530 "Your profile remains unset; try setting it " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4531 "again when you are fully connected.")); |
4617 | 4532 |
7334 | 4533 if (!text) { |
4534 aim_locate_setprofile(od->sess, NULL, "", 0, NULL, NULL, 0); | |
4535 return; | |
4536 } | |
6019 | 4537 |
7334 | 4538 text_html = gaim_strdup_withhtml(text); |
4539 flags = oscar_encoding_check(text_html); | |
4540 if (flags & AIM_IMFLAGS_UNICODE) { | |
4541 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
4542 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4543 g_free(msg); | |
4544 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
4545 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
4546 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4547 g_free(msg); | |
4548 } else { | |
4549 msglen = strlen(text_html); | |
4550 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4551 } | |
4552 | |
4553 if (msglen > od->rights.maxsiglen) { | |
4554 gchar *errstr; | |
4555 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " | |
4556 "has been exceeded. Gaim has truncated it for you.", | |
4557 "The maximum profile length of %d bytes " | |
4558 "has been exceeded. Gaim has truncated it for you.", | |
4559 od->rights.maxsiglen), od->rights.maxsiglen); | |
4560 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); | |
4561 g_free(errstr); | |
4562 } | |
4563 | |
4564 g_free(text_html); | |
2993 | 4565 |
4566 return; | |
2086 | 4567 } |
4568 | |
8257 | 4569 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *state, const char *text) |
2993 | 4570 { |
5129 | 4571 fu32_t flags = 0; |
6019 | 4572 gchar *text_html = NULL; |
5129 | 4573 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4574 gsize msglen = 0; |
2993 | 4575 |
8257 | 4576 if (!strcmp(state, _("Visible"))) { |
4577 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); | |
4578 return; | |
4579 } else if (!strcmp(state, _("Invisible"))) { | |
4580 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); | |
4581 return; | |
4582 } /* else... */ | |
4583 | |
4584 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); | |
4585 | |
2993 | 4586 if (od->rights.maxawaymsglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4587 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4588 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4589 "away message before the login procedure " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4590 "completed. You remain in a \"present\" " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4591 "state; try setting it again when you are " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4592 "fully connected.")); |
5129 | 4593 |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4594 if (gc->away) { |
2993 | 4595 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4596 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4597 } |
2993 | 4598 |
5129 | 4599 if (!text) { |
7334 | 4600 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4601 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4602 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4603 |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4604 text_html = gaim_strdup_withhtml(text); |
6019 | 4605 flags = oscar_encoding_check(text_html); |
5129 | 4606 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 4607 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
7011 | 4608 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, |
7334 | 4609 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 4610 g_free(msg); |
4611 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
4612 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 4613 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
7011 | 4614 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, |
7334 | 4615 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 4616 g_free(msg); |
6019 | 4617 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4618 } else { |
6019 | 4619 msglen = strlen(text_html); |
7011 | 4620 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, |
7334 | 4621 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
6019 | 4622 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4623 } |
4624 | |
4625 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 4626 gchar *errstr; |
4627 | |
6308 | 4628 errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " |
4629 "has been exceeded. Gaim has truncated it for you.", | |
4630 "The maximum away message length of %d bytes " | |
4631 "has been exceeded. Gaim has truncated it for you.", | |
4632 od->rights.maxawaymsglen), od->rights.maxawaymsglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4633 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); |
2993 | 4634 g_free(errstr); |
4635 } | |
6019 | 4636 |
4637 g_free(text_html); | |
8257 | 4638 |
2993 | 4639 return; |
4640 } | |
4641 | |
7283 | 4642 static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message) |
2993 | 4643 { |
5575 | 4644 GaimAccount *account = gaim_connection_get_account(gc); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4645 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4646 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4647 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4648 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4649 |
8265 | 4650 if (strcmp(state, _("Invisible"))) |
5575 | 4651 account->perm_deny = 4; |
8265 | 4652 else |
5575 | 4653 account->perm_deny = 3; |
8265 | 4654 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
4655 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); | |
4342 | 4656 |
4657 if (!strcmp(state, _("Online"))) | |
4901 | 4658 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 4659 else if (!strcmp(state, _("Away"))) { |
4901 | 4660 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4661 gc->away = g_strdup(""); |
4342 | 4662 } else if (!strcmp(state, _("Do Not Disturb"))) { |
4901 | 4663 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
|
4664 gc->away = g_strdup(""); |
4342 | 4665 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 4666 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
|
4667 gc->away = g_strdup(""); |
4342 | 4668 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 4669 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
|
4670 gc->away = g_strdup(""); |
4342 | 4671 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 4672 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4673 gc->away = g_strdup(""); |
4342 | 4674 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 4675 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4676 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4677 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 4678 if (message) { |
4901 | 4679 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
|
4680 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4681 } else { |
4901 | 4682 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4683 } |
2086 | 4684 } |
2993 | 4685 |
4686 return; | |
4687 } | |
4688 | |
6059 | 4689 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) |
2993 | 4690 { |
7283 | 4691 OscarData *od = (OscarData *)gc->proto_data; |
2993 | 4692 |
4693 if (od->icq) | |
4694 oscar_set_away_icq(gc, od, state, message); | |
4695 else | |
8257 | 4696 oscar_set_away_aim(gc, od, state, message); |
2993 | 4697 |
4698 return; | |
2086 | 4699 } |
4700 | |
6059 | 4701 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { |
7283 | 4702 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4703 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); |
2086 | 4704 } |
4705 | |
5575 | 4706 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, |
3466 | 4707 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
7283 | 4708 OscarData *od = (OscarData *)gc->proto_data; |
2086 | 4709 if (strlen(email)) |
6879 | 4710 aim_search_address(od->sess, od->conn, email); |
2086 | 4711 } |
4712 | |
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4713 static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { |
7283 | 4714 OscarData *od = (OscarData *)gc->proto_data; |
8150 | 4715 GaimBuddy *b; |
4716 | |
4717 if (g == NULL) { | |
4718 /* If we were called from oscar_add_buddies... */ | |
4719 b = gaim_find_buddy(gaim_connection_get_account(gc), name); | |
4720 g = gaim_find_buddys_group(b); | |
4721 } else | |
4722 b = gaim_find_buddy_in_group(gaim_connection_get_account(gc), name, g); | |
8092 | 4723 |
4724 if (!aim_snvalid(name)) { | |
4725 gchar *buf; | |
8150 | 4726 buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), name); |
8092 | 4727 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4728 g_free(buf); | |
8150 | 4729 |
4730 /* Remove from local list */ | |
4731 gaim_blist_remove_buddy(b); | |
4732 | |
8092 | 4733 return; |
4734 } | |
4735 | |
4230 | 4736 #ifdef NOSSI |
8143 | 4737 aim_buddylist_addbuddy(od->sess, od->conn, name); |
4230 | 4738 #else |
4739 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | |
8150 | 4740 if (b && g) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4741 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
8150 | 4742 "ssi: adding buddy %s to group %s\n", name, g->name); |
4743 aim_ssi_addbuddy(od->sess, b->name, g->name, gaim_get_buddy_alias_only(b), NULL, NULL, 0); | |
4230 | 4744 } |
4745 } | |
4746 #endif | |
8150 | 4747 |
4759 | 4748 if (od->icq) |
4749 aim_icq_getalias(od->sess, name); | |
4230 | 4750 } |
4751 | |
5575 | 4752 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
7283 | 4753 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4754 #ifdef NOSSI |
4755 char buf[MSG_LEN]; | |
4756 int n=0; | |
4757 while (buddies) { | |
4758 if (n > MSG_LEN - 18) { | |
7285 | 4759 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 4760 n = 0; |
3092 | 4761 } |
8150 | 4762 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (const char *)buddies->data); |
4230 | 4763 buddies = buddies->next; |
4764 } | |
7285 | 4765 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 4766 #else |
4767 if (od->sess->ssi.received_data) { | |
4768 while (buddies) { | |
8092 | 4769 oscar_add_buddy(gc, buddies->data, NULL); |
4230 | 4770 buddies = buddies->next; |
4771 } | |
4772 } | |
4773 #endif | |
4774 } | |
4775 | |
6059 | 4776 static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { |
7283 | 4777 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4778 #ifdef NOSSI |
8143 | 4779 aim_buddylist_removebuddy(od->sess, od->conn, name); |
4230 | 4780 #else |
4781 if (od->sess->ssi.received_data) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4782 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4783 "ssi: deleting buddy %s from group %s\n", name, group); |
4889 | 4784 aim_ssi_delbuddy(od->sess, name, group); |
4230 | 4785 } |
4786 #endif | |
4787 } | |
4788 | |
5575 | 4789 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
7283 | 4790 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4791 #ifdef NOSSI |
4792 GList *cur; | |
4793 for (cur=buddies; cur; cur=cur->next) | |
8143 | 4794 aim_buddylist_removebuddy(od->sess, od->conn, cur->data); |
4230 | 4795 #else |
4796 if (od->sess->ssi.received_data) { | |
3092 | 4797 while (buddies) { |
8150 | 4798 oscar_remove_buddy(gc, buddies->data, group); |
3092 | 4799 buddies = buddies->next; |
4800 } | |
4230 | 4801 } |
4802 #endif | |
4803 } | |
4804 | |
4805 #ifndef NOSSI | |
5575 | 4806 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
7283 | 4807 OscarData *od = (OscarData *)gc->proto_data; |
4303 | 4808 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
|
4809 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4810 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 4811 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 4812 } |
4813 } | |
4814 | |
5575 | 4815 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
7283 | 4816 OscarData *od = (OscarData *)gc->proto_data; |
4269 | 4817 if (od->sess->ssi.received_data) { |
4818 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
4819 if (gname) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4820 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4821 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4889 | 4822 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 4823 } |
4824 } | |
4825 } | |
4826 | |
5575 | 4827 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { |
7283 | 4828 OscarData *od = (OscarData *)g->proto_data; |
4230 | 4829 |
4830 if (od->sess->ssi.received_data) { | |
4831 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | |
4832 oscar_remove_buddies(g, members, old_group); | |
4833 oscar_add_buddies(g, members); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4834 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4835 "ssi: moved all buddies from group %s to %s\n", old_group, new_group); |
4230 | 4836 } else { |
4889 | 4837 aim_ssi_rename_group(od->sess, old_group, new_group); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4838 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4839 "ssi: renamed group %s to %s\n", old_group, new_group); |
2995 | 4840 } |
4841 } | |
4842 } | |
4843 | |
5968 | 4844 static gboolean gaim_ssi_rerequestdata(gpointer data) { |
4845 aim_session_t *sess = data; | |
6350 | 4846 aim_ssi_reqdata(sess); |
5968 | 4847 return FALSE; |
4848 } | |
4849 | |
4642 | 4850 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4851 GaimConnection *gc = sess->aux_data; |
7283 | 4852 OscarData *od = gc->proto_data; |
4642 | 4853 va_list ap; |
4854 fu16_t reason; | |
4855 | |
4856 va_start(ap, fr); | |
4857 reason = (fu16_t)va_arg(ap, unsigned int); | |
4858 va_end(ap); | |
4859 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4860 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); |
4642 | 4861 |
4862 if (reason == 0x0005) { | |
5892 | 4863 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), |
5828 | 4864 _("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.")); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
4865 od->getblisttimer = gaim_timeout_add(300000, gaim_ssi_rerequestdata, od->sess); |
4642 | 4866 } |
4867 | |
4868 /* Activate SSI */ | |
4869 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4870 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
5968 | 4871 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: activating server-stored buddy list\n"); |
4642 | 4872 aim_ssi_enable(od->sess); |
4873 | |
4874 return 1; | |
4875 } | |
4876 | |
2991 | 4877 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4878 GaimConnection *gc = sess->aux_data; |
7283 | 4879 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4880 int numtypes, i; |
4881 fu16_t *maxitems; | |
2991 | 4882 va_list ap; |
4883 | |
4884 va_start(ap, fr); | |
4230 | 4885 numtypes = va_arg(ap, int); |
4886 maxitems = va_arg(ap, fu16_t *); | |
2991 | 4887 va_end(ap); |
4888 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4889 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ssi rights:"); |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4890 |
4230 | 4891 for (i=0; i<numtypes; i++) |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4892 gaim_debug(GAIM_DEBUG_MISC, NULL, " max type 0x%04x=%hd,", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4893 i, maxitems[i]); |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4894 |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4895 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
4230 | 4896 |
4897 if (numtypes >= 0) | |
4898 od->rights.maxbuddies = maxitems[0]; | |
4899 if (numtypes >= 1) | |
4900 od->rights.maxgroups = maxitems[1]; | |
4901 if (numtypes >= 2) | |
4902 od->rights.maxpermits = maxitems[2]; | |
4903 if (numtypes >= 3) | |
4904 od->rights.maxdenies = maxitems[3]; | |
2991 | 4905 |
4906 return 1; | |
4907 } | |
4908 | |
4909 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4910 GaimConnection *gc = sess->aux_data; |
4911 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 4912 OscarData *od = (OscarData *)gc->proto_data; |
8150 | 4913 GaimGroup *g; |
4914 GaimBuddy *b; | |
2995 | 4915 struct aim_ssi_item *curitem; |
2991 | 4916 int tmp; |
4230 | 4917 va_list ap; |
8219 | 4918 fu16_t fmtver, numitems; |
4919 struct aim_ssi_item *items; | |
4920 fu32_t timestamp; | |
4230 | 4921 |
4922 va_start(ap, fr); | |
4923 fmtver = (fu16_t)va_arg(ap, int); | |
4924 numitems = (fu16_t)va_arg(ap, int); | |
8219 | 4925 items = va_arg(ap, struct aim_ssi_item *); |
4230 | 4926 timestamp = va_arg(ap, fu32_t); |
8219 | 4927 va_end(ap); |
2991 | 4928 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4929 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4930 "ssi: syncing local list and server list\n"); |
2991 | 4931 |
8219 | 4932 if ((timestamp == 0) || (numitems == 0)) { |
4933 gaim_notify_error(gc, NULL, "Got AIM SSI with a 0 timestamp or 0 numitems, not syncing, tell KingAnt! And tell him if your buddy list actually works or not. Thanks! Oh, IM him at markdoliner on AIM/ICQ.", NULL); | |
4934 return 1; | |
4935 } | |
4936 | |
2991 | 4937 /* Clean the buddy list */ |
4889 | 4938 aim_ssi_cleanlist(sess); |
2991 | 4939 |
8150 | 4940 { /* If not in server list then prune from local list */ |
4941 GaimBlistNode *gnode, *cnode, *bnode; | |
4942 GaimBuddyList *blist; | |
4943 GSList *cur; | |
4944 | |
4945 /* Buddies */ | |
4946 cur = NULL; | |
4947 if ((blist = gaim_get_blist()) != NULL) { | |
4948 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
4949 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
4950 continue; | |
4951 g = (GaimGroup *)gnode; | |
4952 for (cnode = gnode->child; cnode; cnode = cnode->next) { | |
4953 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4954 continue; | |
4955 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
4956 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
4957 continue; | |
4958 b = (GaimBuddy *)bnode; | |
4959 if (b->account == gc->account) { | |
4960 if (aim_ssi_itemlist_exists(sess->ssi.local, b->name)) { | |
4961 /* If the buddy is an ICQ user then load his nickname */ | |
4962 const char *servernick = gaim_blist_node_get_string((GaimBlistNode*)b, "servernick"); | |
8214 | 4963 char *alias; |
8150 | 4964 if (servernick) |
4965 serv_got_alias(gc, b->name, servernick); | |
4966 | |
4967 /* Store local alias on server */ | |
8214 | 4968 alias = aim_ssi_getalias(sess->ssi.local, g->name, b->name); |
8150 | 4969 if (!alias && b->alias && strlen(b->alias)) |
4970 aim_ssi_aliasbuddy(sess, g->name, b->name, b->alias); | |
4971 free(alias); | |
4972 } else { | |
4973 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
4974 "ssi: removing buddy %s from local list\n", b->name); | |
4975 /* We can't actually remove now because it will screw up our looping */ | |
4976 cur = g_slist_prepend(cur, b); | |
4977 } | |
4978 } | |
4979 } | |
4980 } | |
4981 } | |
4982 } | |
8175 | 4983 |
8150 | 4984 while (cur != NULL) { |
4985 b = cur->data; | |
4986 cur = g_slist_remove(cur, b); | |
4987 gaim_blist_remove_buddy(b); | |
4988 } | |
4989 | |
4990 /* Permit list */ | |
4991 if (gc->account->permit) { | |
4992 for (cur=gc->account->permit; cur; cur=cur->next) | |
4993 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { | |
4994 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
4995 "ssi: removing permit %s from local list\n", (const char *)cur->data); | |
4996 gaim_privacy_permit_remove(account, cur->data, TRUE); | |
4997 cur = gc->account->permit; | |
4998 } | |
4999 } | |
5000 | |
5001 /* Deny list */ | |
5002 if (gc->account->deny) { | |
5003 for (cur=gc->account->deny; cur; cur=cur->next) | |
5004 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { | |
5005 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5006 "ssi: removing deny %s from local list\n", (const char *)cur->data); | |
5007 gaim_privacy_deny_remove(account, cur->data, TRUE); | |
5008 cur = gc->account->deny; | |
5009 } | |
5010 } | |
5011 /* Presence settings (idle time visibility) */ | |
5012 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) | |
5013 if (!(tmp & 0x400)) | |
5014 aim_ssi_setpresence(sess, tmp | 0x400); | |
5015 } /* end pruning buddies from local list */ | |
5016 | |
2991 | 5017 /* Add from server list to local list */ |
4230 | 5018 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
7328 | 5019 if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL))) |
2991 | 5020 switch (curitem->type) { |
4230 | 5021 case 0x0000: { /* Buddy */ |
4251 | 5022 if (curitem->name) { |
4292 | 5023 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
7166 | 5024 char *gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; |
4282 | 5025 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
7166 | 5026 char *alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; |
8150 | 5027 b = gaim_find_buddy(gc->account, curitem->name); |
4458 | 5028 /* Should gname be freed here? -- elb */ |
4754 | 5029 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 5030 free(alias); |
8150 | 5031 if (b) { |
4292 | 5032 /* Get server stored alias */ |
4705 | 5033 if (alias_utf8) { |
8150 | 5034 g_free(b->alias); |
5035 b->alias = g_strdup(alias_utf8); | |
4705 | 5036 } |
4282 | 5037 } else { |
8150 | 5038 b = gaim_buddy_new(gc->account, curitem->name, alias_utf8); |
5146 | 5039 |
4754 | 5040 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 5041 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 5042 gaim_blist_add_group(g, NULL); |
5043 } | |
5146 | 5044 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5045 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
8150 | 5046 "ssi: adding b %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
5047 gaim_blist_add_buddy(b, NULL, g, NULL); | |
4251 | 5048 } |
7162 | 5049 g_free(gname_utf8); |
5050 g_free(alias_utf8); | |
2991 | 5051 } |
4230 | 5052 } break; |
5053 | |
5054 case 0x0001: { /* Group */ | |
4282 | 5055 /* Shouldn't add empty groups */ |
4230 | 5056 } break; |
5057 | |
5058 case 0x0002: { /* Permit buddy */ | |
2991 | 5059 if (curitem->name) { |
4230 | 5060 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 5061 GSList *list; |
5575 | 5062 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 5063 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5064 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5065 "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
|
5066 gaim_privacy_permit_add(account, curitem->name, TRUE); |
2991 | 5067 } |
5068 } | |
4230 | 5069 } break; |
5070 | |
5071 case 0x0003: { /* Deny buddy */ | |
2991 | 5072 if (curitem->name) { |
5073 GSList *list; | |
5575 | 5074 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 5075 if (!list) { |
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: adding deny buddy %s to local list\n", curitem->name); |
6400
588e88bcdac5
[gaim-migrate @ 6905]
Christian Hammond <chipx86@chipx86.com>
parents:
6378
diff
changeset
|
5078 gaim_privacy_deny_add(account, curitem->name, TRUE); |
2991 | 5079 } |
5080 } | |
4230 | 5081 } break; |
5082 | |
5083 case 0x0004: { /* Permit/deny setting */ | |
2991 | 5084 if (curitem->data) { |
5085 fu8_t permdeny; | |
5575 | 5086 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
|
5087 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5575 | 5088 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
5089 account->perm_deny = permdeny; | |
5090 if (od->icq && account->perm_deny == 0x03) { | |
4342 | 5091 serv_set_away(gc, "Invisible", ""); |
5092 } | |
2991 | 5093 } |
5094 } | |
4230 | 5095 } break; |
5096 | |
5097 case 0x0005: { /* Presence setting */ | |
3109 | 5098 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 5099 } break; |
2991 | 5100 } /* End of switch on curitem->type */ |
5101 } /* End of for loop */ | |
4230 | 5102 |
4901 | 5103 /* Set our ICQ status */ |
8257 | 5104 if (!gc->away) { |
4901 | 5105 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); |
5106 } | |
5107 | |
4342 | 5108 /* Activate SSI */ |
5109 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
5110 /* 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
|
5111 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5112 "ssi: activating server-stored buddy list\n"); |
4642 | 5113 aim_ssi_enable(sess); |
4342 | 5114 |
2991 | 5115 return 1; |
2086 | 5116 } |
4230 | 5117 |
5118 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5119 GaimConnection *gc = sess->aux_data; |
4230 | 5120 va_list ap; |
5121 struct aim_ssi_tmp *retval; | |
5122 | |
5123 va_start(ap, fr); | |
5124 retval = va_arg(ap, struct aim_ssi_tmp *); | |
5125 va_end(ap); | |
5126 | |
5127 while (retval) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5128 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5129 "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 | 5130 |
5131 if (retval->ack != 0xffff) | |
5132 switch (retval->ack) { | |
5133 case 0x0000: { /* added successfully */ | |
5134 } break; | |
5135 | |
4829 | 5136 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
5137 gchar *buf; | |
5138 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
|
5139 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4829 | 5140 g_free(buf); |
5141 } | |
5142 | |
7023 | 5143 case 0x000e: { /* buddy requires authorization */ |
4828 | 5144 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 5145 gaim_auth_sendrequest(gc, retval->name); |
4230 | 5146 } break; |
5147 | |
5148 default: { /* La la la */ | |
5197 | 5149 gchar *buf; |
5402 | 5150 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
5151 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
|
5152 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5197 | 5153 g_free(buf); |
4230 | 5154 } break; |
5155 } | |
5156 | |
5157 retval = retval->next; | |
5158 } | |
5159 | |
5160 return 1; | |
5161 } | |
5162 | |
8227 | 5163 static int gaim_ssi_parseadd(aim_session_t *sess, aim_frame_t *fr, ...) { |
5164 GaimConnection *gc = sess->aux_data; | |
5165 char *gname, *gname_utf8, *alias, *alias_utf8; | |
5166 GaimBuddy *b; | |
5167 GaimGroup *g; | |
5168 va_list ap; | |
5169 fu16_t type; | |
5170 const char *name; | |
5171 | |
5172 va_start(ap, fr); | |
5173 type = (fu16_t)va_arg(ap, int); | |
5174 name = va_arg(ap, char *); | |
5175 va_end(ap); | |
5176 | |
5177 if ((type != 0x0000) || (name == NULL)) | |
5178 return 1; | |
5179 | |
5180 gname = aim_ssi_itemlist_findparentname(sess->ssi.local, name); | |
5181 gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; | |
5182 alias = aim_ssi_getalias(sess->ssi.local, gname, name); | |
5183 alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; | |
5184 b = gaim_find_buddy(gc->account, name); | |
5185 free(alias); | |
5186 | |
5187 if (b) { | |
5188 /* Get server stored alias */ | |
5189 if (alias_utf8) { | |
5190 g_free(b->alias); | |
5191 b->alias = g_strdup(alias_utf8); | |
5192 } | |
5193 } else { | |
5194 b = gaim_buddy_new(gc->account, name, alias_utf8); | |
5195 | |
5196 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { | |
5197 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); | |
5198 gaim_blist_add_group(g, NULL); | |
5199 } | |
5200 | |
5201 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5202 "ssi: adding b %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); | |
5203 gaim_blist_add_buddy(b, NULL, g, NULL); | |
5204 } | |
5205 g_free(gname_utf8); | |
5206 g_free(alias_utf8); | |
5207 | |
5208 return 1; | |
5209 } | |
5210 | |
4230 | 5211 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5212 GaimConnection *gc = sess->aux_data; |
4230 | 5213 va_list ap; |
5214 char *sn, *msg; | |
4236 | 5215 gchar *dialog_msg, *nombre; |
4230 | 5216 struct name_data *data; |
6695 | 5217 GaimBuddy *buddy; |
4230 | 5218 |
5219 va_start(ap, fr); | |
5220 sn = va_arg(ap, char *); | |
5221 msg = va_arg(ap, char *); | |
5222 va_end(ap); | |
5223 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5224 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5225 "ssi: %s has given you permission to add him to your buddy list\n", sn); |
4230 | 5226 |
4687 | 5227 buddy = gaim_find_buddy(gc->account, sn); |
5228 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5229 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5230 else |
5231 nombre = g_strdup(sn); | |
5232 | |
5233 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 | 5234 data = g_new(struct name_data, 1); |
5235 data->gc = gc; | |
5236 data->name = g_strdup(sn); | |
5237 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5238 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5239 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5240 0, data, |
7023 | 5241 G_CALLBACK(gaim_icq_buddyadd), |
5836 | 5242 G_CALLBACK(oscar_free_name_data)); |
4236 | 5243 |
4230 | 5244 g_free(dialog_msg); |
4236 | 5245 g_free(nombre); |
4230 | 5246 |
5247 return 1; | |
5248 } | |
5249 | |
5250 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5251 GaimConnection *gc = sess->aux_data; |
4230 | 5252 va_list ap; |
5253 char *sn, *msg; | |
4236 | 5254 gchar *dialog_msg, *nombre; |
4230 | 5255 struct name_data *data; |
6695 | 5256 GaimBuddy *buddy; |
4230 | 5257 |
5258 va_start(ap, fr); | |
5259 sn = va_arg(ap, char *); | |
5260 msg = va_arg(ap, char *); | |
5261 va_end(ap); | |
5262 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5263 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5264 "ssi: received authorization request from %s\n", sn); |
4230 | 5265 |
4687 | 5266 buddy = gaim_find_buddy(gc->account, sn); |
5267 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5268 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5269 else |
5270 nombre = g_strdup(sn); | |
5271 | |
4337 | 5272 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 | 5273 data = g_new(struct name_data, 1); |
5274 data->gc = gc; | |
5275 data->name = g_strdup(sn); | |
5276 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5277 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5278 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5279 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5280 _("Authorize"), G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5281 _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4236 | 5282 |
4230 | 5283 g_free(dialog_msg); |
4236 | 5284 g_free(nombre); |
4230 | 5285 |
5286 return 1; | |
5287 } | |
5288 | |
5289 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5290 GaimConnection *gc = sess->aux_data; |
4230 | 5291 va_list ap; |
5292 char *sn, *msg; | |
4236 | 5293 gchar *dialog_msg, *nombre; |
4230 | 5294 fu8_t reply; |
6695 | 5295 GaimBuddy *buddy; |
4230 | 5296 |
5297 va_start(ap, fr); | |
5298 sn = va_arg(ap, char *); | |
5299 reply = (fu8_t)va_arg(ap, int); | |
5300 msg = va_arg(ap, char *); | |
5301 va_end(ap); | |
5302 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5303 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5304 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4236 | 5305 |
4687 | 5306 buddy = gaim_find_buddy(gc->account, sn); |
5307 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5308 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5309 else |
5310 nombre = g_strdup(sn); | |
5311 | |
4230 | 5312 if (reply) { |
5313 /* Granted */ | |
7023 | 5314 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
|
5315 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); |
4230 | 5316 } else { |
5317 /* Denied */ | |
7023 | 5318 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
|
5319 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); |
4230 | 5320 } |
5321 g_free(dialog_msg); | |
4236 | 5322 g_free(nombre); |
4230 | 5323 |
5324 return 1; | |
5325 } | |
5326 | |
5327 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5328 GaimConnection *gc = sess->aux_data; |
4230 | 5329 va_list ap; |
5330 char *sn; | |
6695 | 5331 GaimBuddy *buddy; |
4230 | 5332 |
5333 va_start(ap, fr); | |
5334 sn = va_arg(ap, char *); | |
5335 va_end(ap); | |
5336 | |
4687 | 5337 buddy = gaim_find_buddy(gc->account, sn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5338 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5339 "ssi: %s added you to their buddy list\n", sn); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
7011
diff
changeset
|
5340 gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 5341 |
5342 return 1; | |
5343 } | |
4269 | 5344 #endif |
2086 | 5345 |
5575 | 5346 static GList *oscar_chat_info(GaimConnection *gc) { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5347 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5348 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5349 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5350 pce = g_new0(struct proto_chat_entry, 1); |
7841 | 5351 pce->label = _("_Group:"); |
5234 | 5352 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5353 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5354 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5355 pce = g_new0(struct proto_chat_entry, 1); |
7841 | 5356 pce->label = _("_Exchange:"); |
5234 | 5357 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5358 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5359 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5360 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5361 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5362 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5363 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5364 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5365 |
5575 | 5366 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { |
7283 | 5367 OscarData *od = (OscarData *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5368 aim_conn_t *cur; |
5234 | 5369 char *name, *exchange; |
5370 | |
5371 name = g_hash_table_lookup(data, "room"); | |
5372 exchange = g_hash_table_lookup(data, "exchange"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5373 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5374 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5375 "Attempting to join chat room %s.\n", name); |
4617 | 5376 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
|
5377 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5378 "chatnav exists, creating room\n"); |
5234 | 5379 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); |
2086 | 5380 } else { |
5381 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5382 struct create_room *cr = g_new0(struct create_room, 1); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5383 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5384 "chatnav does not exist, opening chatnav\n"); |
5234 | 5385 cr->exchange = atoi(exchange); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5386 cr->name = g_strdup(name); |
4617 | 5387 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5388 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 5389 } |
5390 } | |
5391 | |
5575 | 5392 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { |
7283 | 5393 OscarData *od = (OscarData *)g->proto_data; |
2086 | 5394 struct chat_connection *ccon = find_oscar_chat(g, id); |
5395 | |
5396 if (!ccon) | |
5397 return; | |
5398 | |
8225 | 5399 aim_im_sendch2_chatinvite(od->sess, name, message ? message : "", |
2086 | 5400 ccon->exchange, ccon->name, 0x0); |
5401 } | |
5402 | |
5575 | 5403 static void oscar_chat_leave(GaimConnection *g, int id) { |
7283 | 5404 OscarData *od = g ? (OscarData *)g->proto_data : NULL; |
2086 | 5405 GSList *bcs = g->buddy_chats; |
5679 | 5406 GaimConversation *b = NULL; |
2086 | 5407 struct chat_connection *c = NULL; |
5408 int count = 0; | |
5409 | |
5410 while (bcs) { | |
5411 count++; | |
5679 | 5412 b = (GaimConversation *)bcs->data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5413 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))) |
2086 | 5414 break; |
5415 bcs = bcs->next; | |
5416 b = NULL; | |
5417 } | |
5418 | |
5419 if (!b) | |
5420 return; | |
5421 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5422 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5423 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); |
2086 | 5424 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5425 c = find_oscar_chat(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 5426 if (c != NULL) { |
4617 | 5427 if (od) |
5428 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 5429 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5430 gaim_input_remove(c->inpa); |
4617 | 5431 if (g && od->sess) |
5432 aim_conn_kill(od->sess, &c->conn); | |
2086 | 5433 g_free(c->name); |
5434 g_free(c->show); | |
5435 g_free(c); | |
5436 } | |
5437 /* 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
|
5438 serv_got_chat_left(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 5439 } |
5440 | |
8219 | 5441 static int oscar_send_chat(GaimConnection *gc, int id, const char *message) { |
5442 OscarData *od = (OscarData *)gc->proto_data; | |
5443 GError *err = NULL; | |
5444 GaimConversation *conv = NULL; | |
2086 | 5445 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5446 char *buf, *buf2; |
8219 | 5447 char *charset = NULL; |
5448 int encoding; | |
5449 int len; | |
5450 | |
5451 if (!(conv = gaim_find_chat(gc, id))) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5452 return -EINVAL; |
2086 | 5453 |
8219 | 5454 if (!(c = find_oscar_chat_by_conv(gc, conv))) |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5455 return -EINVAL; |
2086 | 5456 |
8219 | 5457 buf = gaim_strdup_withhtml(message); |
5458 len = strlen(buf); | |
5459 | |
5460 encoding = oscar_encoding_check(buf); | |
8233 | 5461 if (encoding & AIM_IMFLAGS_UNICODE) { |
8219 | 5462 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode Chat\n"); |
5463 charset = "unicode-2-0"; | |
5464 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err); | |
5465 if (err) { | |
5466 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5467 "Error converting a unicode message: %s\n", | |
5468 err->message); | |
5469 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5470 "This really shouldn't happen!\n"); | |
5471 /* We really shouldn't try to send the | |
5472 * IM now, but I'm not sure what to do */ | |
5473 g_error_free(err); | |
5474 } | |
5475 } else if (encoding & AIM_IMFLAGS_ISO_8859_1) { | |
5476 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5477 "Sending ISO-8859-1 Chat\n"); | |
5478 charset = "iso-8859-1"; | |
5479 buf2 = g_convert(buf, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); | |
5480 if (err) { | |
5481 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5482 "conversion error: %s\n", err->message); | |
5483 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5484 "Someone tell Ethan his 8859-1 detection is wrong\n"); | |
5485 g_error_free(err); | |
5486 encoding = AIM_IMFLAGS_UNICODE; | |
5487 buf2 = g_convert(buf, len, "UCS-2BE", "UTF8", NULL, &len, &err); | |
5488 if (err) { | |
5489 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5490 "Error in unicode fallback: %s\n", err->message); | |
5491 g_error_free(err); | |
5492 } | |
2086 | 5493 } |
8219 | 5494 } else { |
5495 charset = "us-ascii"; | |
5496 buf2 = g_strdup(buf); | |
5497 } | |
5498 | |
5499 if (len > c->maxlen) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5500 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5501 |
8219 | 5502 g_free(buf); |
5503 buf = gaim_markup_strip_html(buf2); | |
5504 g_free(buf2); | |
5505 if (strlen(buf) > c->maxvis) { | |
5506 g_free(buf); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5507 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5508 } |
8219 | 5509 |
8233 | 5510 aim_chat_send_im(od->sess, c->conn, 0, buf, len, charset, "en"); |
2086 | 5511 g_free(buf); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5512 return 0; |
2086 | 5513 } |
5514 | |
6695 | 5515 static const char *oscar_list_icon(GaimAccount *a, GaimBuddy *b) { |
4766 | 5516 if (!b || (b && b->name && b->name[0] == '+')) { |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5517 if (a != NULL && isdigit(*gaim_account_get_username(a))) |
4687 | 5518 return "icq"; |
5519 else | |
5520 return "aim"; | |
5521 } | |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5522 |
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5523 if (b != NULL && isdigit(b->name[0])) |
4687 | 5524 return "icq"; |
5525 return "aim"; | |
5526 } | |
5527 | |
6695 | 5528 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 5529 { |
7334 | 5530 GaimAccount *account = NULL; |
5531 GaimConnection *gc = NULL; | |
5532 OscarData *od = NULL; | |
4687 | 5533 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
5534 int i = 0; | |
7334 | 5535 aim_userinfo_t *userinfo = NULL; |
5536 | |
5537 if (b != NULL) | |
5538 account = b->account; | |
5539 if (account != NULL) | |
5540 gc = account->gc; | |
5541 if (gc != NULL) | |
5542 od = gc->proto_data; | |
7945 | 5543 if (od != NULL) |
5544 userinfo = aim_locate_finduserinfo(od->sess, b->name); | |
4687 | 5545 |
5131 | 5546 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5547 char *gname; | |
7334 | 5548 if ((b->name) && (od) && (od->sess->ssi.received_data) && |
5131 | 5549 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
5550 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
5551 emblems[i++] = "notauthorized"; | |
5552 } else { | |
5553 emblems[i++] = "offline"; | |
5554 } | |
5555 } | |
4916 | 5556 |
4766 | 5557 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 5558 int uc = b->uc >> 16; |
4766 | 5559 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 5560 emblems[i++] = "invisible"; |
4766 | 5561 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 5562 emblems[i++] = "freeforchat"; |
4766 | 5563 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 5564 emblems[i++] = "dnd"; |
4766 | 5565 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 5566 emblems[i++] = "na"; |
4766 | 5567 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 5568 emblems[i++] = "occupied"; |
4766 | 5569 else if (uc & AIM_ICQ_STATE_AWAY) |
5570 emblems[i++] = "away"; | |
5571 } else { | |
5572 if (b->uc & UC_UNAVAILABLE) | |
5573 emblems[i++] = "away"; | |
5574 } | |
4687 | 5575 if (b->uc & UC_WIRELESS) |
5576 emblems[i++] = "wireless"; | |
5577 if (b->uc & UC_AOL) | |
5578 emblems[i++] = "aol"; | |
5579 if (b->uc & UC_ADMIN) | |
5580 emblems[i++] = "admin"; | |
5581 if (b->uc & UC_AB && i < 4) | |
5582 emblems[i++] = "activebuddy"; | |
4766 | 5583 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
5584 emblems[i++] = "unconfirmed"; */ | |
7334 | 5585 |
7945 | 5586 if ((i < 4) && (userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_HIPTOP)) |
5587 emblems[i++] = "hiptop"; | |
5588 | |
5589 if ((i < 4) && (userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_SECUREIM)) | |
7334 | 5590 emblems[i++] = "secure"; |
5591 | |
4687 | 5592 *se = emblems[0]; |
5593 *sw = emblems[1]; | |
5594 *nw = emblems[2]; | |
5595 *ne = emblems[3]; | |
5596 } | |
5597 | |
6695 | 5598 static char *oscar_tooltip_text(GaimBuddy *b) { |
5575 | 5599 GaimConnection *gc = b->account->gc; |
7283 | 5600 OscarData *od = gc->proto_data; |
7692 | 5601 GaimGroup *g = gaim_find_buddys_group(b); |
7261 | 5602 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
7045 | 5603 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); |
7011 | 5604 gchar *tmp = NULL, *ret = g_strdup(""); |
5131 | 5605 |
5606 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
5607 if (isdigit(b->name[0])) { | |
7011 | 5608 char *status; |
5131 | 5609 status = gaim_icq_status((b->uc & 0xffff0000) >> 16); |
7011 | 5610 tmp = ret; |
5611 ret = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); | |
5131 | 5612 g_free(tmp); |
5613 g_free(status); | |
5614 } | |
5615 | |
7011 | 5616 if ((bi != NULL) && (bi->ipaddr)) { |
7283 | 5617 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", |
7011 | 5618 (bi->ipaddr & 0xff000000) >> 24, |
5619 (bi->ipaddr & 0x00ff0000) >> 16, | |
5620 (bi->ipaddr & 0x0000ff00) >> 8, | |
5621 (bi->ipaddr & 0x000000ff)); | |
5622 tmp = ret; | |
5623 ret = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL); | |
7162 | 5624 g_free(tmp); |
5625 g_free(tstr); | |
7011 | 5626 } |
5627 | |
5628 if ((userinfo != NULL) && (userinfo->capabilities)) { | |
5629 char *caps = caps_string(userinfo->capabilities); | |
5630 tmp = ret; | |
5631 ret = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); | |
7162 | 5632 g_free(tmp); |
7011 | 5633 } |
5634 | |
7692 | 5635 if (g && g->name) { |
5636 char *comment = NULL; | |
5637 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, b->name); | |
5638 if (comment != NULL) { | |
5639 tmp = ret; | |
5640 ret = g_strconcat(tmp, _("<b>Buddy Comment:</b> "), comment, "\n", NULL); | |
5641 free(tmp); | |
5642 free(comment); | |
5643 } | |
5644 } | |
5645 | |
7011 | 5646 if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) { |
5647 gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5648 tmp = ret; | |
5649 ret = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL); | |
7162 | 5650 g_free(tmp); |
7011 | 5651 g_free(escaped); |
5652 } | |
5653 | |
5654 if ((userinfo != NULL) && (userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
8225 | 5655 gchar *charset = oscar_encoding_extract(userinfo->away_encoding); |
5656 gchar *away_utf8 = away_utf8 = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len); | |
5657 g_free(charset); | |
7011 | 5658 if (away_utf8 != NULL) { |
7091 | 5659 gchar *tmp1, *tmp2; |
7162 | 5660 const char *tmp3; |
7091 | 5661 tmp1 = gaim_strreplace(away_utf8, "<BR>", "\n"); |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7093
diff
changeset
|
5662 tmp2 = gaim_markup_strip_html(tmp1); |
7091 | 5663 g_free(tmp1); |
7235 | 5664 tmp1 = g_markup_escape_text(tmp2, strlen(tmp2)); |
7091 | 5665 g_free(tmp2); |
7235 | 5666 tmp3 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); |
5667 g_free(tmp1); | |
7011 | 5668 tmp = ret; |
7162 | 5669 ret = g_strconcat(tmp, _("<b>Away Message:</b> "), tmp3, "\n", NULL); |
5670 g_free(tmp); | |
7011 | 5671 g_free(away_utf8); |
5836 | 5672 } |
5131 | 5673 } |
5674 } else { | |
5675 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
5676 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { | |
7011 | 5677 tmp = ret; |
5678 ret = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); | |
5131 | 5679 g_free(tmp); |
5680 } else { | |
7011 | 5681 tmp = ret; |
5682 ret = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); | |
5131 | 5683 g_free(tmp); |
5684 } | |
5685 } | |
5686 | |
5687 /* remove the trailing newline character */ | |
8266 | 5688 if (ret && (strlen(ret) > 0)) |
7011 | 5689 ret[strlen(ret)-1] = '\0'; |
5690 return ret; | |
5131 | 5691 } |
5692 | |
6695 | 5693 static char *oscar_status_text(GaimBuddy *b) { |
5575 | 5694 GaimConnection *gc = b->account->gc; |
7283 | 5695 OscarData *od = gc->proto_data; |
5167 | 5696 gchar *ret = NULL; |
5697 | |
5698 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | |
5699 if (isdigit(b->name[0])) | |
5700 ret = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
7038 | 5701 else |
5702 ret = g_strdup(_("Away")); | |
5836 | 5703 } else if (GAIM_BUDDY_IS_ONLINE(b)) { |
7261 | 5704 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
6292 | 5705 if (bi->availmsg) |
5706 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5836 | 5707 } else { |
5167 | 5708 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); |
5709 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) | |
5710 ret = g_strdup(_("Not Authorized")); | |
5711 else | |
5712 ret = g_strdup(_("Offline")); | |
5713 } | |
5714 | |
5715 return ret; | |
5716 } | |
5717 | |
5842 | 5718 |
5844 | 5719 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5842 | 5720 GaimConnection *gc = sess->aux_data; |
7283 | 5721 OscarData *od = gc->proto_data; |
5892 | 5722 va_list ap; |
5842 | 5723 fu16_t type; |
5892 | 5724 fu8_t flags = 0, length = 0; |
5725 char *md5 = NULL; | |
5726 | |
7334 | 5727 |
5842 | 5728 va_start(ap, fr); |
5729 type = va_arg(ap, int); | |
5892 | 5730 |
5731 switch(type) { | |
5732 case 0x0000: | |
5733 case 0x0001: { | |
5734 flags = va_arg(ap, int); | |
5735 length = va_arg(ap, int); | |
5736 md5 = va_arg(ap, char *); | |
5737 | |
5738 if (flags == 0x41) { | |
5739 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
5740 od->iconconnecting = TRUE; | |
5741 od->set_icon = TRUE; | |
5742 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
5743 } else { | |
6039 | 5744 struct stat st; |
5745 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
5746 if (iconfile == NULL) { | |
5747 /* Set an empty icon, or something */ | |
5748 } else if (!stat(iconfile, &st)) { | |
5749 char *buf = g_malloc(st.st_size); | |
5750 FILE *file = fopen(iconfile, "rb"); | |
5751 if (file) { | |
5752 fread(buf, 1, st.st_size, file); | |
5753 fclose(file); | |
5754 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5755 "Uploading icon to icon server\n"); | |
6879 | 5756 aim_bart_upload(od->sess, buf, st.st_size); |
5892 | 5757 } else |
5758 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6039 | 5759 "Can't open buddy icon file!\n"); |
5760 g_free(buf); | |
5761 } else { | |
5762 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5763 "Can't stat buddy icon file!\n"); | |
5892 | 5764 } |
5765 } | |
5893 | 5766 } else if (flags == 0x81) |
5767 aim_ssi_seticon(od->sess, md5, length); | |
5892 | 5768 } break; |
5769 | |
5770 case 0x0002: { /* We just set an "available" message? */ | |
5771 } break; | |
5772 } | |
5773 | |
5842 | 5774 va_end(ap); |
5844 | 5775 |
5776 return 0; | |
5842 | 5777 } |
5892 | 5778 |
3952 | 5779 /* |
4617 | 5780 * We have just established a socket with the other dude, so set up some handlers. |
3952 | 5781 */ |
4617 | 5782 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5783 GaimConnection *gc = sess->aux_data; |
7283 | 5784 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 5785 GaimConversation *cnv; |
2086 | 5786 struct direct_im *dim; |
5787 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5788 char *sn; |
4617 | 5789 va_list ap; |
5790 aim_conn_t *newconn, *listenerconn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5791 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5792 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5793 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5794 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 5795 va_end(ap); |
5796 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5797 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5798 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5799 |
4617 | 5800 sn = g_strdup(aim_odc_getsn(newconn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5801 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5802 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5803 "DirectIM: initiate success to %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5804 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5805 |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5806 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
|
5807 gaim_input_remove(dim->watcher); |
2086 | 5808 dim->conn = newconn; |
4617 | 5809 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
3008 | 5810 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5811 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5812 g_free(sn); |
6982 | 5813 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
2086 | 5814 |
4617 | 5815 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); |
5816 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
6982 | 5817 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_odc_update_ui, 0); |
4617 | 5818 |
2993 | 5819 return 1; |
5820 } | |
5821 | |
6982 | 5822 /* |
5823 * This is called when each chunk of an image is received. It can be used to | |
5824 * update a progress bar, or to eat lots of dry cat food. Wet cat food is | |
5825 * nasty, you sicko. | |
5826 */ | |
5827 static int gaim_odc_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
2993 | 5828 va_list ap; |
5829 char *sn; | |
5830 double percent; | |
5575 | 5831 GaimConnection *gc = sess->aux_data; |
7283 | 5832 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 5833 GaimConversation *c; |
2993 | 5834 struct direct_im *dim; |
5835 | |
5836 va_start(ap, fr); | |
5837 sn = va_arg(ap, char *); | |
5838 percent = va_arg(ap, double); | |
5839 va_end(ap); | |
6873 | 5840 |
2994 | 5841 if (!(dim = find_direct_im(od, sn))) |
5842 return 1; | |
3059 | 5843 if (dim->watcher) { |
5844 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
5845 dim->watcher = 0; | |
5846 } | |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5847 |
6982 | 5848 c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
6873 | 5849 if (c != NULL) |
5850 gaim_conversation_update_progress(c, percent); | |
2993 | 5851 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
5852 oscar_callback, dim->conn); | |
2086 | 5853 |
5854 return 1; | |
5855 } | |
5856 | |
6982 | 5857 /* |
5858 * This is called after a direct IM has been received in its entirety. This | |
5859 * function is passed a long chunk of data which contains the IM with any | |
5860 * data chunks (images) appended to it. | |
5861 * | |
5862 * This function rips out all the data chunks and creates an imgstore for | |
5863 * each one. In order to do this, it first goes through the IM and takes | |
5864 * out all the IMG tags. When doing so, it rewrites the original IMG tag | |
5865 * with one compatable with the imgstore Gaim core code. For each one, we | |
5866 * then read in chunks of data from the end of the message and actually | |
5867 * create the img store using the given data. | |
5868 * | |
5869 * For somewhat easy reference, here's a sample message | |
5870 * (without the whitespace and asterisks): | |
5871 * | |
5872 * <HTML><BODY BGCOLOR="#ffffff"> | |
5873 * <FONT LANG="0"> | |
5874 * This is a really stupid picture:<BR> | |
5875 * <IMG SRC="Sample.jpg" ID="1" WIDTH="283" HEIGHT="212" DATASIZE="9894"><BR> | |
5876 * Yeah it is<BR> | |
5877 * Here is another one:<BR> | |
5878 * <IMG SRC="Soap Bubbles.bmp" ID="2" WIDTH="256" HEIGHT="256" DATASIZE="65978"> | |
5879 * </FONT> | |
5880 * </BODY></HTML> | |
5881 * <BINARY> | |
5882 * <DATA ID="1" SIZE="9894">datadatadatadata</DATA> | |
5883 * <DATA ID="2" SIZE="65978">datadatadatadata</DATA> | |
5884 * </BINARY> | |
5885 */ | |
4617 | 5886 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5887 GaimConnection *gc = sess->aux_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5888 GaimConvImFlags imflags = 0; |
8233 | 5889 gchar *utf8; |
6982 | 5890 GString *newmsg = g_string_new(""); |
5891 GSList *images = NULL; | |
2086 | 5892 va_list ap; |
6982 | 5893 const char *sn, *msg, *msgend, *binary; |
5894 size_t len; | |
5895 int encoding, isawaymsg; | |
2086 | 5896 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5897 va_start(ap, fr); |
6982 | 5898 sn = va_arg(ap, const char *); |
5899 msg = va_arg(ap, const char *); | |
5900 len = va_arg(ap, size_t); | |
3952 | 5901 encoding = va_arg(ap, int); |
4870 | 5902 isawaymsg = va_arg(ap, int); |
2086 | 5903 va_end(ap); |
6982 | 5904 msgend = msg + len; |
2086 | 5905 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5906 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5907 "Got DirectIM message from %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5908 |
4870 | 5909 if (isawaymsg) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5910 imflags |= GAIM_CONV_IM_AUTO_RESP; |
4870 | 5911 |
6982 | 5912 /* message has a binary trailer */ |
5913 if ((binary = gaim_strcasestr(msg, "<binary>"))) { | |
5914 GData *attribs; | |
5915 const char *tmp, *start, *end, *last = NULL; | |
5916 | |
5917 tmp = msg; | |
5918 | |
5919 /* for each valid image tag... */ | |
5920 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
5921 const char *id, *src, *datasize; | |
5922 const char *tag = NULL, *data = NULL; | |
5923 size_t size; | |
5924 int imgid = 0; | |
5925 | |
5926 /* update the location of the last img tag */ | |
5927 last = end; | |
5928 | |
5929 /* grab attributes */ | |
5930 id = g_datalist_get_data(&attribs, "id"); | |
5931 src = g_datalist_get_data(&attribs, "src"); | |
5932 datasize = g_datalist_get_data(&attribs, "datasize"); | |
5933 | |
5934 /* if we have id & datasize, build the data tag */ | |
5935 if (id && datasize) | |
5936 tag = g_strdup_printf("<data id=\"%s\" size=\"%s\">", id, datasize); | |
5937 | |
5938 /* if we have a tag, find the start of the data */ | |
5939 if (tag && (data = gaim_strcasestr(binary, tag))) | |
5940 data += strlen(tag); | |
5941 | |
5942 /* check the data is here and store it */ | |
5943 if (data + (size = atoi(datasize)) <= msgend) | |
5944 imgid = gaim_imgstore_add(data, size, src); | |
5945 | |
8233 | 5946 /* |
5947 * XXX - The code below contains some calls to oscar_encoding_to_utf8 | |
5948 * The hardcoded "us-ascii" value REALLY needs to be removed. | |
5949 */ | |
6982 | 5950 /* if we have a stored image... */ |
5951 if (imgid) { | |
5952 /* append the message up to the tag */ | |
8233 | 5953 utf8 = oscar_encoding_to_utf8("us-ascii", tmp, start - tmp); |
5954 if (utf8 != NULL) { | |
5955 newmsg = g_string_append(newmsg, utf8); | |
5956 g_free(utf8); | |
5957 } | |
6982 | 5958 |
5959 /* write the new image tag */ | |
5960 g_string_append_printf(newmsg, "<IMG ID=\"%d\">", imgid); | |
5961 | |
5962 /* and record the image number */ | |
5963 images = g_slist_append(images, GINT_TO_POINTER(imgid)); | |
5964 } else { | |
5965 /* otherwise, copy up to the end of the tag */ | |
8233 | 5966 utf8 = oscar_encoding_to_utf8("us-ascii", tmp, (end + 1) - tmp); |
5967 if (utf8 != NULL) { | |
5968 newmsg = g_string_append(newmsg, utf8); | |
5969 g_free(utf8); | |
5970 } | |
6982 | 5971 } |
5972 | |
5973 /* clear the attribute list */ | |
5974 g_datalist_clear(&attribs); | |
5975 | |
5976 /* continue from the end of the tag */ | |
5977 tmp = end + 1; | |
5978 } | |
5979 | |
5980 /* append any remaining message data (without the > :-) */ | |
5981 if (last++ && (last < binary)) | |
5982 newmsg = g_string_append_len(newmsg, last, binary - last); | |
5983 | |
5984 /* set the flag if we caught any images */ | |
5985 if (images) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5986 imflags |= GAIM_CONV_IM_IMAGES; |
6982 | 5987 } else { |
5988 g_string_append_len(newmsg, msg, len); | |
5989 } | |
5990 | |
4617 | 5991 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
6982 | 5992 serv_got_im(gc, sn, newmsg->str, imflags, time(NULL)); |
5993 | |
5994 /* free up the message */ | |
5995 g_string_free(newmsg, TRUE); | |
5996 | |
5997 /* unref any images we allocated */ | |
5998 if (images) { | |
5999 GSList *tmp; | |
6000 int id; | |
6001 | |
6002 for (tmp = images; tmp != NULL; tmp = tmp->next) { | |
6003 id = GPOINTER_TO_INT(tmp->data); | |
6004 gaim_imgstore_unref(id); | |
6005 } | |
6006 | |
6007 g_slist_free(images); | |
6008 } | |
2086 | 6009 |
6010 return 1; | |
6011 } | |
6012 | |
4617 | 6013 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 6014 va_list ap; |
6015 char *sn; | |
2993 | 6016 int typing; |
5575 | 6017 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6018 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6019 va_start(ap, fr); |
2086 | 6020 sn = va_arg(ap, char *); |
2993 | 6021 typing = va_arg(ap, int); |
2086 | 6022 va_end(ap); |
6023 | |
4870 | 6024 if (typing == 0x0002) { |
2993 | 6025 /* 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
|
6026 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6027 "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
|
6028 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
4870 | 6029 } else if (typing == 0x0001) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
6030 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
4870 | 6031 else |
4342 | 6032 serv_got_typing_stopped(gc, sn); |
2086 | 6033 return 1; |
6034 } | |
6035 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
6036 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimConvImFlags imflags) { |
6982 | 6037 char *buf; |
6038 size_t len; | |
6039 int ret; | |
6040 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
6041 if (imflags & GAIM_CONV_IM_IMAGES) { |
6982 | 6042 GString *msg = g_string_new(""); |
6043 GString *data = g_string_new("<BINARY>"); | |
6044 GData *attribs; | |
6045 const char *tmp, *start, *end, *last = NULL; | |
6046 int oscar_id = 0; | |
6047 | |
6048 tmp = message; | |
6049 | |
6050 /* for each valid IMG tag... */ | |
6051 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
6052 GaimStoredImage *image = NULL; | |
6053 const char *id; | |
6054 | |
6055 last = end; | |
6056 id = g_datalist_get_data(&attribs, "id"); | |
6057 | |
6058 /* ... if it refers to a valid gaim image ... */ | |
6059 if (id && (image = gaim_imgstore_get(atoi(id)))) { | |
6060 /* ... append the message from start to the tag ... */ | |
6061 msg = g_string_append_len(msg, tmp, start - tmp); | |
6062 oscar_id++; | |
6063 | |
6064 /* ... insert a new img tag with the oscar id ... */ | |
6065 if (image->filename) | |
6066 g_string_append_printf(msg, | |
6067 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
7386 | 6068 image->filename, oscar_id, (int)image->size); |
6982 | 6069 else |
6070 g_string_append_printf(msg, | |
6071 "<IMG ID=\"%d\" DATASIZE=\"%d\">", | |
7386 | 6072 oscar_id, (int)image->size); |
6982 | 6073 |
6074 /* ... and append the data to the binary section ... */ | |
6075 g_string_append_printf(data, "<DATA ID=\"%d\" SIZE=\"%d\">", | |
7386 | 6076 oscar_id, (int)image->size); |
6982 | 6077 data = g_string_append_len(data, image->data, image->size); |
6078 data = g_string_append(data, "</DATA>"); | |
6079 } else { | |
6080 /* ... otherwise, allow the possibly invalid img tag through. */ | |
6081 /* should we do something else? */ | |
6082 msg = g_string_append_len(msg, tmp, (end + 1) - tmp); | |
6083 } | |
6084 | |
6085 g_datalist_clear(&attribs); | |
6086 | |
6087 /* continue from the end of the tag */ | |
6088 tmp = end + 1; | |
6089 } | |
6090 | |
6091 /* append any remaining message data (without the > :-) */ | |
6092 if (last++ && *last) | |
6093 msg = g_string_append(msg, last); | |
6094 | |
6095 /* if we inserted any images in the binary section, append it */ | |
6096 if (oscar_id) { | |
6097 msg = g_string_append_len(msg, data->str, data->len); | |
6098 msg = g_string_append(msg, "</BINARY>"); | |
6099 } | |
6100 | |
6101 len = msg->len; | |
6102 buf = msg->str; | |
6103 g_string_free(msg, FALSE); | |
6104 g_string_free(data, TRUE); | |
6105 } else { | |
6106 len = strlen(message); | |
6107 buf = g_memdup(message, len+1); | |
6108 } | |
6109 | |
6110 /* 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
|
6111 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
6982 | 6112 ret = aim_odc_send_im(sess, conn, buf, len, 0, 1); |
6113 else | |
6114 ret = aim_odc_send_im(sess, conn, buf, len, 0, 0); | |
6115 | |
6116 g_free(buf); | |
6117 | |
6118 return ret; | |
6119 } | |
6120 | |
2086 | 6121 struct ask_do_dir_im { |
6122 char *who; | |
5575 | 6123 GaimConnection *gc; |
2086 | 6124 }; |
6125 | |
3730 | 6126 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5136 | 6127 g_free(data->who); |
2086 | 6128 g_free(data); |
6129 } | |
6130 | |
3730 | 6131 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5575 | 6132 GaimConnection *gc = data->gc; |
7283 | 6133 OscarData *od; |
2086 | 6134 struct direct_im *dim; |
8240 | 6135 int listenfd; |
2086 | 6136 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
6137 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5136 | 6138 g_free(data->who); |
4244 | 6139 g_free(data); |
6140 return; | |
6141 } | |
6142 | |
7283 | 6143 od = (OscarData *)gc->proto_data; |
4244 | 6144 |
2086 | 6145 dim = find_direct_im(od, data->who); |
6146 if (dim) { | |
3008 | 6147 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
6148 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
6149 gaim_input_remove(dim->watcher); | |
6150 g_free(dim); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6151 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6152 "Gave up on old direct IM, trying again\n"); |
3008 | 6153 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6154 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); |
5136 | 6155 g_free(data->who); |
4244 | 6156 g_free(data); |
3008 | 6157 return; |
6158 } | |
2086 | 6159 } |
6160 dim = g_new0(struct direct_im, 1); | |
6161 dim->gc = gc; | |
6162 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
6163 | |
8246 | 6164 listenfd = gaim_network_listen_range(5190, 5199); |
8240 | 6165 dim->conn = aim_odc_initiate(od->sess, data->who, listenfd, gaim_network_get_port_from_fd(listenfd)); |
2086 | 6166 if (dim->conn != NULL) { |
6167 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
6168 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 6169 oscar_callback, dim->conn); |
4617 | 6170 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
6171 gaim_odc_initiate, 0); | |
2086 | 6172 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6173 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL); |
2086 | 6174 g_free(dim); |
6175 } | |
4244 | 6176 |
5136 | 6177 g_free(data->who); |
4244 | 6178 g_free(data); |
2086 | 6179 } |
6180 | |
5575 | 6181 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
5420 | 6182 gchar *buf; |
2086 | 6183 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
5136 | 6184 data->who = g_strdup(who); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
6185 data->gc = gc; |
5420 | 6186 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
|
6187 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6188 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6189 _("Because this reveals your IP address, it " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6190 "may be considered a privacy risk. Do you " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6191 "wish to continue?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6192 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6193 _("Connect"), G_CALLBACK(oscar_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6194 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
5420 | 6195 g_free(buf); |
2086 | 6196 } |
6197 | |
5575 | 6198 static void oscar_set_permit_deny(GaimConnection *gc) { |
6199 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 6200 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 6201 #ifdef NOSSI |
8143 | 6202 GSList *list; |
4230 | 6203 char buf[MAXMSGLEN]; |
6204 int at; | |
6205 | |
5575 | 6206 switch(account->perm_deny) { |
8175 | 6207 case GAIM_PRIVACY_ALLOW_ALL: |
5575 | 6208 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
4230 | 6209 break; |
8175 | 6210 case GAIM_PRIVACY_DENY_ALL: |
5575 | 6211 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
4230 | 6212 break; |
8175 | 6213 case GAIM_PRIVACY_ALLOW_USERS: |
5575 | 6214 list = account->permit; |
4230 | 6215 at = 0; |
6216 while (list) { | |
6217 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6218 list = list->next; | |
6219 } | |
6220 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
6221 break; | |
8175 | 6222 case GAIM_PRIVACY_DENY_USERS: |
5575 | 6223 list = account->deny; |
4230 | 6224 at = 0; |
6225 while (list) { | |
6226 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6227 list = list->next; | |
6228 } | |
6229 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
6230 break; | |
6231 default: | |
6232 break; | |
2086 | 6233 } |
4230 | 6234 #else |
8175 | 6235 if (od->sess->ssi.received_data) { |
6236 switch (account->perm_deny) { | |
6237 case GAIM_PRIVACY_ALLOW_ALL: | |
6238 aim_ssi_setpermdeny(od->sess, 0x01, 0xffffffff); | |
6239 break; | |
6240 case GAIM_PRIVACY_ALLOW_BUDDYLIST: | |
6241 aim_ssi_setpermdeny(od->sess, 0x05, 0xffffffff); | |
6242 break; | |
6243 case GAIM_PRIVACY_ALLOW_USERS: | |
6244 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); | |
6245 break; | |
6246 case GAIM_PRIVACY_DENY_ALL: | |
6247 aim_ssi_setpermdeny(od->sess, 0x02, 0xffffffff); | |
6248 break; | |
6249 case GAIM_PRIVACY_DENY_USERS: | |
6250 aim_ssi_setpermdeny(od->sess, 0x04, 0xffffffff); | |
6251 break; | |
6252 default: | |
6253 aim_ssi_setpermdeny(od->sess, 0x01, 0xffffffff); | |
6254 break; | |
6255 } | |
6256 } | |
4230 | 6257 #endif |
2086 | 6258 } |
6259 | |
5575 | 6260 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
4269 | 6261 #ifdef NOSSI |
8143 | 6262 if (gc->account->perm_deny == 3) |
4269 | 6263 oscar_set_permit_deny(gc); |
6264 #else | |
7283 | 6265 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6266 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); |
4230 | 6267 if (od->sess->ssi.received_data) |
4889 | 6268 aim_ssi_addpermit(od->sess, who); |
4230 | 6269 #endif |
2086 | 6270 } |
6271 | |
5575 | 6272 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
4269 | 6273 #ifdef NOSSI |
8143 | 6274 if (gc->account->perm_deny == 4) |
4269 | 6275 oscar_set_permit_deny(gc); |
6276 #else | |
7283 | 6277 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6278 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); |
4230 | 6279 if (od->sess->ssi.received_data) |
4889 | 6280 aim_ssi_adddeny(od->sess, who); |
4230 | 6281 #endif |
2086 | 6282 } |
6283 | |
5575 | 6284 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
4269 | 6285 #ifdef NOSSI |
8143 | 6286 if (gc->account->perm_deny == 3) |
4269 | 6287 oscar_set_permit_deny(gc); |
6288 #else | |
7283 | 6289 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6290 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); |
4230 | 6291 if (od->sess->ssi.received_data) |
4889 | 6292 aim_ssi_delpermit(od->sess, who); |
4230 | 6293 #endif |
2086 | 6294 } |
6295 | |
5575 | 6296 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
4269 | 6297 #ifdef NOSSI |
8143 | 6298 if (gc->account->perm_deny == 4) |
4269 | 6299 oscar_set_permit_deny(gc); |
6300 #else | |
7283 | 6301 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6302 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); |
4230 | 6303 if (od->sess->ssi.received_data) |
4889 | 6304 aim_ssi_deldeny(od->sess, who); |
4230 | 6305 #endif |
2086 | 6306 } |
6307 | |
5575 | 6308 static GList *oscar_away_states(GaimConnection *gc) |
2086 | 6309 { |
7283 | 6310 OscarData *od = gc->proto_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6311 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6312 |
8257 | 6313 if (od->icq) { |
6314 m = g_list_append(m, _("Online")); | |
6315 m = g_list_append(m, _("Away")); | |
6316 m = g_list_append(m, _("Do Not Disturb")); | |
6317 m = g_list_append(m, _("Not Available")); | |
6318 m = g_list_append(m, _("Occupied")); | |
6319 m = g_list_append(m, _("Free For Chat")); | |
6320 m = g_list_append(m, _("Invisible")); | |
6321 } else { | |
6322 m = g_list_append(m, GAIM_AWAY_CUSTOM); | |
6323 m = g_list_append(m, _("Visible")); | |
6324 m = g_list_append(m, _("Invisible")); | |
6325 } | |
4333 | 6326 |
6327 return m; | |
6328 } | |
6329 | |
7172 | 6330 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { |
7283 | 6331 OscarData *od = data->gc->proto_data; |
7172 | 6332 GaimBuddy *b; |
6333 GaimGroup *g; | |
6334 | |
6335 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { | |
6336 oscar_free_name_data(data); | |
6337 return; | |
6338 } | |
6339 | |
6340 if (!(g = gaim_find_buddys_group(b))) { | |
6341 oscar_free_name_data(data); | |
6342 return; | |
6343 } | |
6344 | |
6345 aim_ssi_editcomment(od->sess, g->name, data->name, text); | |
6346 oscar_free_name_data(data); | |
6347 } | |
6348 | |
6349 static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { | |
7283 | 6350 OscarData *od = gc->proto_data; |
7172 | 6351 struct name_data *data = g_new(struct name_data, 1); |
6352 GaimBuddy *b; | |
6353 GaimGroup *g; | |
6354 char *comment; | |
6355 gchar *comment_utf8; | |
6356 | |
6357 if (!(b = gaim_find_buddy(gaim_connection_get_account(gc), name))) | |
6358 return; | |
6359 if (!(g = gaim_find_buddys_group(b))) | |
6360 return; | |
6361 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, name); | |
6362 comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; | |
6363 | |
6364 data->gc = gc; | |
6365 data->name = g_strdup(name); | |
6366 data->nick = NULL; | |
6367 | |
6368 gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, | |
6369 comment_utf8, TRUE, FALSE, | |
6370 _("OK"), G_CALLBACK(oscar_ssi_editcomment), | |
6371 _("Cancel"), G_CALLBACK(oscar_free_name_data), | |
6372 data); | |
6373 | |
6374 free(comment); | |
6375 g_free(comment_utf8); | |
6376 } | |
6377 | |
5575 | 6378 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
7283 | 6379 OscarData *od = gc->proto_data; |
4333 | 6380 GList *m = NULL; |
6381 struct proto_buddy_menu *pbm; | |
6382 | |
7172 | 6383 pbm = g_new0(struct proto_buddy_menu, 1); |
6384 pbm->label = _("Edit Buddy Comment"); | |
6385 pbm->callback = oscar_buddycb_edit_comment; | |
6386 pbm->gc = gc; | |
6387 m = g_list_append(m, pbm); | |
6388 | |
4333 | 6389 if (od->icq) { |
4624 | 6390 #if 0 |
4333 | 6391 pbm = g_new0(struct proto_buddy_menu, 1); |
6392 pbm->label = _("Get Status Msg"); | |
4969 | 6393 pbm->callback = oscar_get_icqstatusmsg; |
4333 | 6394 pbm->gc = gc; |
6395 m = g_list_append(m, pbm); | |
4624 | 6396 #endif |
4333 | 6397 } else { |
6695 | 6398 GaimBuddy *b = gaim_find_buddy(gc->account, who); |
7011 | 6399 aim_userinfo_t *userinfo; |
5975 | 6400 |
6401 if (b) | |
7045 | 6402 userinfo = aim_locate_finduserinfo(od->sess, b->name); |
7011 | 6403 |
6404 if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { | |
6405 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { | |
5917 | 6406 pbm = g_new0(struct proto_buddy_menu, 1); |
6407 pbm->label = _("Direct IM"); | |
6408 pbm->callback = oscar_ask_direct_im; | |
6409 pbm->gc = gc; | |
6410 m = g_list_append(m, pbm); | |
6411 } | |
7650 | 6412 |
6413 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { | |
6414 pbm = g_new0(struct proto_buddy_menu, 1); | |
6415 pbm->label = _("Send File"); | |
6416 pbm->callback = oscar_ask_sendfile; | |
6417 pbm->gc = gc; | |
6418 m = g_list_append(m, pbm); | |
6419 } | |
4826 | 6420 #if 0 |
7011 | 6421 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
5917 | 6422 pbm = g_new0(struct proto_buddy_menu, 1); |
6423 pbm->label = _("Get File"); | |
6424 pbm->callback = oscar_ask_getfile; | |
6425 pbm->gc = gc; | |
6426 m = g_list_append(m, pbm); | |
6427 } | |
4826 | 6428 #endif |
4333 | 6429 } |
5131 | 6430 } |
5197 | 6431 |
5131 | 6432 if (od->sess->ssi.received_data) { |
6433 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); | |
6434 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { | |
6435 pbm = g_new0(struct proto_buddy_menu, 1); | |
6873 | 6436 pbm->label = _("Re-request Authorization"); |
5131 | 6437 pbm->callback = gaim_auth_sendrequest; |
6438 pbm->gc = gc; | |
6439 m = g_list_append(m, pbm); | |
4333 | 6440 } |
4916 | 6441 } |
6442 | |
4333 | 6443 return m; |
6444 } | |
6445 | |
5575 | 6446 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
7283 | 6447 OscarData *od = gc->proto_data; |
5575 | 6448 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
4333 | 6449 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
6450 od->setnick = TRUE; | |
6451 od->newsn = g_strdup(nick); | |
6452 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6453 } else { | |
6454 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
6455 } | |
6456 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6457 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
8152 | 6458 _("Screen name formatting can change only capitalization and whitespace.")); |
4333 | 6459 } |
6460 } | |
6461 | |
5575 | 6462 static void oscar_show_format_screenname(GaimConnection *gc) |
4333 | 6463 { |
8152 | 6464 gaim_request_input(gc, NULL, _("New screen name formatting:"), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6465 gaim_connection_get_display_name(gc), FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6466 _("OK"), G_CALLBACK(oscar_format_screenname), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6467 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6468 gc); |
4333 | 6469 } |
6470 | |
5575 | 6471 static void oscar_confirm_account(GaimConnection *gc) |
4333 | 6472 { |
7283 | 6473 OscarData *od = gc->proto_data; |
4333 | 6474 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6475 | |
6476 if (conn) { | |
6477 aim_admin_reqconfirm(od->sess, conn); | |
6478 } else { | |
6479 od->conf = TRUE; | |
6480 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6481 } | |
6482 } | |
6483 | |
5575 | 6484 static void oscar_show_email(GaimConnection *gc) |
4333 | 6485 { |
7283 | 6486 OscarData *od = gc->proto_data; |
4333 | 6487 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6488 | |
6489 if (conn) { | |
6490 aim_admin_getinfo(od->sess, conn, 0x11); | |
6491 } else { | |
6492 od->reqemail = TRUE; | |
6493 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6494 } | |
6495 } | |
6496 | |
5575 | 6497 static void oscar_change_email(GaimConnection *gc, const char *email) |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6498 { |
7283 | 6499 OscarData *od = gc->proto_data; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6500 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
|
6501 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6502 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6503 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6504 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6505 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6506 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6507 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6508 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6509 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6510 |
5575 | 6511 static void oscar_show_change_email(GaimConnection *gc) |
4333 | 6512 { |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6513 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, |
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6514 FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6515 _("OK"), G_CALLBACK(oscar_change_email), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6516 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6517 gc); |
4333 | 6518 } |
6519 | |
5575 | 6520 static void oscar_show_awaitingauth(GaimConnection *gc) |
4333 | 6521 { |
7283 | 6522 OscarData *od = gc->proto_data; |
4333 | 6523 gchar *nombre, *text, *tmp; |
6695 | 6524 GaimBlistNode *gnode, *cnode, *bnode; |
4333 | 6525 int num=0; |
6526 | |
6873 | 6527 text = g_strdup(""); |
4333 | 6528 |
4785 | 6529 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
6695 | 6530 GaimGroup *group = (GaimGroup *)gnode; |
4785 | 6531 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
6532 continue; | |
6695 | 6533 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
6534 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 6535 continue; |
6695 | 6536 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
6537 GaimBuddy *buddy = (GaimBuddy *)bnode; | |
6538 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
6539 continue; | |
6540 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { | |
6541 if (gaim_get_buddy_alias_only(buddy)) | |
6542 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
6543 else | |
6544 nombre = g_strdup_printf(" %s", buddy->name); | |
6873 | 6545 tmp = g_strdup_printf("%s%s<br>", text, nombre); |
6695 | 6546 g_free(text); |
6547 text = tmp; | |
6548 g_free(nombre); | |
6549 num++; | |
6550 } | |
4333 | 6551 } |
2979 | 6552 } |
4333 | 6553 } |
6554 | |
6555 if (!num) { | |
6556 g_free(text); | |
6873 | 6557 text = g_strdup(_("<i>you are not waiting for authorization</i>")); |
6558 } | |
6559 | |
6560 gaim_notify_formatted(gc, NULL, _("You are awaiting authorization from " | |
6561 "the following buddies"), _("You can re-request " | |
6562 "authorization from these buddies by " | |
6563 "right-clicking on them and selecting " | |
6564 "\"Re-request Authorization.\""), text, NULL, NULL); | |
4333 | 6565 g_free(text); |
2979 | 6566 } |
6567 | |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6568 static void search_by_email_cb(GaimConnection *gc, const char *email) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6569 { |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6570 serv_dir_search(gc, "", "", "", "", "", "", "", email); |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6571 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6572 |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6573 static void oscar_show_find_email(GaimConnection *gc) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6574 { |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6575 gaim_request_input(gc, _("Find Buddy by E-mail"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6576 _("Search for a buddy by e-mail address"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6577 _("Type the e-mail address of the buddy you are " |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6578 "searching for."), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6579 NULL, FALSE, FALSE, |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6580 _("Search"), G_CALLBACK(search_by_email_cb), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6581 _("Cancel"), NULL, gc); |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6582 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6583 |
7366 | 6584 #if 0 |
5917 | 6585 static void oscar_setavailmsg(GaimConnection *gc, char *text) { |
7283 | 6586 OscarData *od = (OscarData *)gc->proto_data; |
5917 | 6587 |
7334 | 6588 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
5917 | 6589 aim_srv_setavailmsg(od->sess, text); |
6590 } | |
6591 | |
6592 static void oscar_show_setavailmsg(GaimConnection *gc) | |
6593 { | |
7313 | 6594 gaim_request_input(gc, NULL, _("Available Message:"), NULL, |
6595 _("I'm doing work and hoping for a distraction--IM me!"), | |
6596 TRUE, FALSE, | |
5917 | 6597 _("OK"), G_CALLBACK(oscar_setavailmsg), |
6598 _("Cancel"), NULL, | |
6599 gc); | |
6600 } | |
7366 | 6601 #endif |
5917 | 6602 |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6603 static void oscar_show_set_info(GaimConnection *gc) |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6604 { |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6605 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6606 } |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6607 |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6608 static void oscar_change_pass(GaimConnection *gc) |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6609 { |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6610 gaim_account_request_change_password(gaim_connection_get_account(gc)); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6611 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6612 |
5575 | 6613 static void oscar_show_chpassurl(GaimConnection *gc) |
4333 | 6614 { |
7283 | 6615 OscarData *od = gc->proto_data; |
5575 | 6616 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
|
6617 gaim_notify_uri(gc, substituted); |
5517 | 6618 g_free(substituted); |
4333 | 6619 } |
6620 | |
7026 | 6621 static void oscar_show_imforwardingurl(GaimConnection *gc) |
6622 { | |
6623 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); | |
6624 } | |
6625 | |
5842 | 6626 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) |
6627 { | |
7283 | 6628 OscarData *od = gc->proto_data; |
5844 | 6629 aim_session_t *sess = od->sess; |
5842 | 6630 FILE *file; |
6631 struct stat st; | |
5844 | 6632 |
6039 | 6633 if (iconfile == NULL) { |
6634 /* Set an empty icon, or something */ | |
6635 } else if (!stat(iconfile, &st)) { | |
5842 | 6636 char *buf = g_malloc(st.st_size); |
6637 file = fopen(iconfile, "rb"); | |
6638 if (file) { | |
6052 | 6639 md5_state_t *state; |
6039 | 6640 char md5[16]; |
5842 | 6641 int len = fread(buf, 1, st.st_size, file); |
6039 | 6642 fclose(file); |
6052 | 6643 state = g_malloc(sizeof(md5_state_t)); |
5842 | 6644 md5_init(state); |
6645 md5_append(state, buf, len); | |
6646 md5_finish(state, md5); | |
6647 g_free(state); | |
6648 aim_ssi_seticon(sess, md5, 16); | |
6649 } else | |
6650 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6651 "Can't open buddy icon file!\n"); | |
6652 g_free(buf); | |
6653 } else | |
6654 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6655 "Can't stat buddy icon file!\n"); | |
6656 } | |
6657 | |
6658 | |
5575 | 6659 static GList *oscar_actions(GaimConnection *gc) |
2086 | 6660 { |
7283 | 6661 OscarData *od = gc->proto_data; |
4333 | 6662 struct proto_actions_menu *pam; |
6663 GList *m = NULL; | |
6664 | |
6665 pam = g_new0(struct proto_actions_menu, 1); | |
7853 | 6666 pam->label = _("Set User Info..."); |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6667 pam->callback = oscar_show_set_info; |
4333 | 6668 pam->gc = gc; |
6669 m = g_list_append(m, pam); | |
6670 | |
7366 | 6671 #if 0 |
5917 | 6672 pam = g_new0(struct proto_actions_menu, 1); |
7853 | 6673 pam->label = _("Set Available Message..."); |
5917 | 6674 pam->callback = oscar_show_setavailmsg; |
6675 pam->gc = gc; | |
6676 m = g_list_append(m, pam); | |
7366 | 6677 #endif |
5917 | 6678 |
5238 | 6679 pam = g_new0(struct proto_actions_menu, 1); |
7853 | 6680 pam->label = _("Change Password..."); |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6681 pam->callback = oscar_change_pass; |
5238 | 6682 pam->gc = gc; |
6683 m = g_list_append(m, pam); | |
4617 | 6684 |
6685 if (od->sess->authinfo->chpassurl) { | |
6686 pam = g_new0(struct proto_actions_menu, 1); | |
6687 pam->label = _("Change Password (URL)"); | |
6688 pam->callback = oscar_show_chpassurl; | |
6689 pam->gc = gc; | |
6690 m = g_list_append(m, pam); | |
6691 } | |
6692 | |
7026 | 6693 if (od->sess->authinfo->chpassurl) { |
6694 pam = g_new0(struct proto_actions_menu, 1); | |
6695 pam->label = _("Configure IM Forwarding (URL)"); | |
6696 pam->callback = oscar_show_imforwardingurl; | |
6697 pam->gc = gc; | |
6698 m = g_list_append(m, pam); | |
6699 } | |
6700 | |
5238 | 6701 if (!od->icq) { |
4617 | 6702 /* AIM actions */ |
6703 m = g_list_append(m, NULL); | |
4333 | 6704 |
5917 | 6705 pam = g_new0(struct proto_actions_menu, 1); |
8152 | 6706 pam->label = _("Format Screen Name..."); |
5844 | 6707 pam->callback = oscar_show_format_screenname; |
4333 | 6708 pam->gc = gc; |
6709 m = g_list_append(m, pam); | |
6710 | |
6711 pam = g_new0(struct proto_actions_menu, 1); | |
6712 pam->label = _("Confirm Account"); | |
6713 pam->callback = oscar_confirm_account; | |
6714 pam->gc = gc; | |
6715 m = g_list_append(m, pam); | |
6716 | |
6717 pam = g_new0(struct proto_actions_menu, 1); | |
7880 | 6718 pam->label = _("Display Currently Registered Address"); |
4333 | 6719 pam->callback = oscar_show_email; |
6720 pam->gc = gc; | |
6721 m = g_list_append(m, pam); | |
6722 | |
6723 pam = g_new0(struct proto_actions_menu, 1); | |
7880 | 6724 pam->label = _("Change Currently Registered Address..."); |
4333 | 6725 pam->callback = oscar_show_change_email; |
6726 pam->gc = gc; | |
6727 m = g_list_append(m, pam); | |
2086 | 6728 } |
4333 | 6729 |
6730 m = g_list_append(m, NULL); | |
6731 | |
6732 pam = g_new0(struct proto_actions_menu, 1); | |
6733 pam->label = _("Show Buddies Awaiting Authorization"); | |
6734 pam->callback = oscar_show_awaitingauth; | |
6735 pam->gc = gc; | |
6736 m = g_list_append(m, pam); | |
6737 | |
2086 | 6738 m = g_list_append(m, NULL); |
4333 | 6739 |
6740 pam = g_new0(struct proto_actions_menu, 1); | |
7853 | 6741 pam->label = _("Search for Buddy by Email..."); |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6742 pam->callback = oscar_show_find_email; |
4333 | 6743 pam->gc = gc; |
6744 m = g_list_append(m, pam); | |
6745 | |
4336 | 6746 /* pam = g_new0(struct proto_actions_menu, 1); |
4333 | 6747 pam->label = _("Search for Buddy by Information"); |
6748 pam->callback = show_find_info; | |
6749 pam->gc = gc; | |
4336 | 6750 m = g_list_append(m, pam); */ |
2086 | 6751 |
6752 return m; | |
6753 } | |
6754 | |
5575 | 6755 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2086 | 6756 { |
7283 | 6757 OscarData *od = gc->proto_data; |
4617 | 6758 |
6759 if (od->icq) { | |
6760 aim_icq_changepasswd(od->sess, new); | |
2086 | 6761 } else { |
4617 | 6762 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6763 if (conn) { | |
6764 aim_admin_changepasswd(od->sess, conn, new, old); | |
6765 } else { | |
6766 od->chpass = TRUE; | |
6767 od->oldp = g_strdup(old); | |
6768 od->newp = g_strdup(new); | |
6769 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6770 } | |
2086 | 6771 } |
6772 } | |
6773 | |
6059 | 6774 static void oscar_convo_closed(GaimConnection *gc, const char *who) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6775 { |
7283 | 6776 OscarData *od = gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6777 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6778 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6779 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6780 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6781 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6782 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6783 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6784 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6785 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6786 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6787 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6788 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6789 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6790 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
|
6791 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6792 NULL, |
8170 | 6793 NULL, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6794 oscar_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6795 oscar_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6796 oscar_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6797 oscar_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6798 oscar_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6799 oscar_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6800 oscar_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6801 oscar_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6802 oscar_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6803 oscar_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6804 oscar_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6805 oscar_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6806 oscar_send_typing, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6807 oscar_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6808 oscar_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6809 oscar_get_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6810 oscar_set_dir, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6811 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6812 oscar_dir_search, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6813 oscar_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6814 oscar_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6815 oscar_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6816 oscar_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6817 oscar_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6818 oscar_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6819 oscar_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6820 oscar_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6821 oscar_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6822 oscar_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6823 oscar_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6824 oscar_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6825 oscar_join_chat, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6826 oscar_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6827 oscar_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6828 NULL, |
8219 | 6829 oscar_send_chat, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6830 oscar_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6831 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6832 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6833 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6834 #ifndef NOSSI |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6835 oscar_alias_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6836 oscar_move_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6837 oscar_rename_group, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6838 #else |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6839 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6840 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6841 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6842 #endif |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6843 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6844 oscar_convo_closed, |
5842 | 6845 NULL, |
7650 | 6846 oscar_set_icon |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6847 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6848 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6849 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6850 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6851 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6852 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6853 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6854 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6855 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6856 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6857 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6858 "prpl-oscar", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6859 "AIM/ICQ", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6860 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6861 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6862 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6863 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6864 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6865 NULL, /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
6866 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6867 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6868 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6869 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6870 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6871 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6872 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6873 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6874 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6875 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6876 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6877 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6878 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6879 GaimAccountOption *option; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6880 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6881 option = gaim_account_option_string_new(_("Auth host"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6882 "login.oscar.aol.com"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6883 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6884 option); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6885 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6886 option = gaim_account_option_int_new(_("Auth port"), "port", 5190); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6887 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6888 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6889 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6890 my_protocol = plugin; |
2086 | 6891 } |
6892 | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6893 GAIM_INIT_PLUGIN(oscar, init_plugin, info); |