Mercurial > pidgin
annotate src/protocols/oscar/oscar.c @ 8951:3e69753b555b
[gaim-migrate @ 9723]
we need to keep this changing when we remove or add things in the middle of that struct
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 16 May 2004 15:46:46 +0000 |
parents | 80b4c956d7ae |
children | 4ff4c34b7500 |
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" |
8476 | 31 #include "away.h" |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
32 #include "buddyicon.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
33 #include "conversation.h" |
7083
3100a6e03644
[gaim-migrate @ 7648]
Christian Hammond <chipx86@chipx86.com>
parents:
7082
diff
changeset
|
34 #include "core.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
35 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
36 #include "ft.h" |
6982 | 37 #include "imgstore.h" |
2086 | 38 #include "multi.h" |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8227
diff
changeset
|
39 #include "network.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
40 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
41 #include "privacy.h" |
2086 | 42 #include "prpl.h" |
4889 | 43 #include "proxy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
44 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
45 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
46 |
2086 | 47 #include "aim.h" |
5842 | 48 #include "md5.h" |
2086 | 49 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
50 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
51 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
52 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
53 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
54 #define UC_AB 0x20 |
3079 | 55 #define UC_WIRELESS 0x40 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
56 |
2086 | 57 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
58 | |
7283 | 59 #define OSCAR_CONNECT_STEPS 6 |
60 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
61 static GaimPlugin *my_protocol = NULL; |
4249 | 62 |
7376 | 63 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; |
64 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; | |
3458 | 65 |
4665 | 66 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
67 static fu8_t features_icq[] = {0x01, 0x06}; | |
8341 | 68 static fu8_t ck[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
2086 | 69 |
7283 | 70 typedef struct _OscarData OscarData; |
71 struct _OscarData { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
72 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
73 aim_conn_t *conn; |
2086 | 74 |
75 guint cnpa; | |
76 guint paspa; | |
3694 | 77 guint emlpa; |
4804 | 78 guint icopa; |
2086 | 79 |
4823 | 80 gboolean iconconnecting; |
5842 | 81 gboolean set_icon; |
4823 | 82 |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
83 GSList *create_rooms; |
2086 | 84 |
85 gboolean conf; | |
86 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
87 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
88 char *email; |
2979 | 89 gboolean setnick; |
90 char *newsn; | |
2086 | 91 gboolean chpass; |
92 char *oldp; | |
93 char *newp; | |
5842 | 94 |
2086 | 95 GSList *oscar_chats; |
96 GSList *direct_ims; | |
3630 | 97 GSList *file_transfers; |
4738 | 98 GHashTable *buddyinfo; |
4804 | 99 GSList *requesticon; |
2086 | 100 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
101 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
102 gboolean icq; |
4804 | 103 guint icontimer; |
5968 | 104 guint getblisttimer; |
8341 | 105 guint getinfotimer; |
2993 | 106 |
107 struct { | |
4230 | 108 guint maxwatchers; /* max users who can watch you */ |
2993 | 109 guint maxbuddies; /* max users you can watch */ |
4230 | 110 guint maxgroups; /* max groups in server list */ |
2993 | 111 guint maxpermits; /* max users on permit list */ |
112 guint maxdenies; /* max users on deny list */ | |
113 guint maxsiglen; /* max size (bytes) of profile */ | |
114 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
115 } rights; | |
2086 | 116 }; |
117 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
118 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
119 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
120 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
121 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
122 |
2086 | 123 struct chat_connection { |
124 char *name; | |
125 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
126 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
127 fu16_t instance; |
2086 | 128 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
|
129 aim_conn_t *conn; |
2086 | 130 int inpa; |
131 int id; | |
5575 | 132 GaimConnection *gc; /* i hate this. */ |
8733 | 133 GaimConversation *conv; /* bah. */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
134 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
135 int maxvis; |
2086 | 136 }; |
137 | |
138 struct direct_im { | |
5575 | 139 GaimConnection *gc; |
2086 | 140 char name[80]; |
141 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
142 aim_conn_t *conn; |
3008 | 143 gboolean connected; |
2086 | 144 }; |
145 | |
146 struct ask_direct { | |
5575 | 147 GaimConnection *gc; |
2086 | 148 char *sn; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
149 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
150 fu8_t cookie[8]; |
2086 | 151 }; |
152 | |
7011 | 153 /* |
154 * Various PRPL-specific buddy info that we want to keep track of | |
155 * Some other info is maintained by locate.c, and I'd like to move | |
156 * the rest of this to libfaim, mostly im.c | |
157 */ | |
4738 | 158 struct buddyinfo { |
159 gboolean typingnot; | |
6292 | 160 gchar *availmsg; |
6857 | 161 fu32_t ipaddr; |
5836 | 162 |
163 unsigned long ico_me_len; | |
164 unsigned long ico_me_csum; | |
165 time_t ico_me_time; | |
166 gboolean ico_informed; | |
4738 | 167 |
168 unsigned long ico_len; | |
169 unsigned long ico_csum; | |
170 time_t ico_time; | |
171 gboolean ico_need; | |
7406 | 172 gboolean ico_sent; |
2086 | 173 }; |
174 | |
4230 | 175 struct name_data { |
5575 | 176 GaimConnection *gc; |
4230 | 177 gchar *name; |
3453 | 178 gchar *nick; |
3141 | 179 }; |
180 | |
5129 | 181 static char *msgerrreason[] = { |
182 N_("Invalid error"), | |
183 N_("Invalid SNAC"), | |
184 N_("Rate to host"), | |
185 N_("Rate to client"), | |
186 N_("Not logged in"), | |
187 N_("Service unavailable"), | |
188 N_("Service not defined"), | |
189 N_("Obsolete SNAC"), | |
190 N_("Not supported by host"), | |
191 N_("Not supported by client"), | |
192 N_("Refused by client"), | |
193 N_("Reply too big"), | |
194 N_("Responses lost"), | |
195 N_("Request denied"), | |
196 N_("Busted SNAC payload"), | |
197 N_("Insufficient rights"), | |
198 N_("In local permit/deny"), | |
199 N_("Too evil (sender)"), | |
200 N_("Too evil (receiver)"), | |
201 N_("User temporarily unavailable"), | |
202 N_("No match"), | |
203 N_("List overflow"), | |
204 N_("Request ambiguous"), | |
205 N_("Queue full"), | |
206 N_("Not while on AOL") | |
207 }; | |
208 static int msgerrreasonlen = 25; | |
209 | |
210 /* All the libfaim->gaim callback functions */ | |
211 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); | |
212 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); | |
213 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); | |
214 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); | |
215 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); | |
216 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); | |
217 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); | |
218 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); | |
219 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); | |
220 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); | |
7011 | 221 static int gaim_parse_userinfo (aim_session_t *, aim_frame_t *, ...); |
8341 | 222 static int gaim_reqinfo_timeout (aim_session_t *, aim_frame_t *, ...); |
5129 | 223 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); |
224 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
|
225 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
|
226 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
|
227 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
|
228 static int gaim_conv_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); |
5129 | 229 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); |
230 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); | |
231 static int gaim_icon_parseicon (aim_session_t *, aim_frame_t *, ...); | |
5844 | 232 static int oscar_icon_req (aim_session_t *, aim_frame_t *, ...); |
5129 | 233 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
234 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); | |
235 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); | |
236 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); | |
237 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); | |
238 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); | |
239 static int gaim_connerr (aim_session_t *, aim_frame_t *, ...); | |
240 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); | |
241 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); | |
242 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); | |
243 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); | |
244 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); | |
245 static int conninitdone_icon (aim_session_t *, aim_frame_t *, ...); | |
246 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); | |
247 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); | |
248 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); | |
249 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); | |
250 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | |
251 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | |
252 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | |
253 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); | |
254 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); | |
255 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); | |
256 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); | |
257 static int gaim_icqalias (aim_session_t *, aim_frame_t *, ...); | |
258 static int gaim_icqinfo (aim_session_t *, aim_frame_t *, ...); | |
259 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); | |
260 #ifndef NOSSI | |
261 static int gaim_ssi_parseerr (aim_session_t *, aim_frame_t *, ...); | |
262 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); | |
263 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
264 static int gaim_ssi_parseack (aim_session_t *, aim_frame_t *, ...); | |
8227 | 265 static int gaim_ssi_parseadd (aim_session_t *, aim_frame_t *, ...); |
5129 | 266 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); |
267 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
268 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
269 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
270 #endif | |
271 | |
272 /* for DirectIM/image transfer */ | |
273 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
274 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
275 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
6982 | 276 static int gaim_odc_update_ui (aim_session_t *, aim_frame_t *, ...); |
5129 | 277 |
278 /* for file transfer */ | |
279 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
280 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
281 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
282 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
283 | |
284 /* for icons */ | |
285 static gboolean gaim_icon_timerfunc(gpointer data); | |
286 | |
8076 | 287 /* remove these at some point? */ |
7282 | 288 /* Because I don't like forward declarations? I think that was why... */ |
5954 | 289 static void oscar_set_info(GaimConnection *gc, const char *text); |
8076 | 290 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message); |
5306 | 291 |
5836 | 292 static void oscar_free_name_data(struct name_data *data) { |
4230 | 293 g_free(data->name); |
294 g_free(data->nick); | |
295 g_free(data); | |
296 } | |
297 | |
5836 | 298 static void oscar_free_buddyinfo(void *data) { |
299 struct buddyinfo *bi = data; | |
6292 | 300 g_free(bi->availmsg); |
5836 | 301 g_free(bi); |
302 } | |
303 | |
5129 | 304 static fu32_t oscar_encoding_check(const char *utf8) |
305 { | |
306 int i = 0; | |
307 fu32_t encodingflag = 0; | |
308 | |
309 /* Determine how we can send this message. Per the warnings elsewhere | |
310 * in this file, these little checks determine the simplest encoding | |
311 * we can use for a given message send using it. */ | |
312 while (utf8[i]) { | |
313 if ((unsigned char)utf8[i] > 0x7f) { | |
314 /* not ASCII! */ | |
315 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
316 break; | |
317 } | |
318 i++; | |
319 } | |
320 while (utf8[i]) { | |
321 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
322 * followed by 0xc0-0xc3 in the second */ | |
323 if ((unsigned char)utf8[i] < 0x80) { | |
324 i++; | |
325 continue; | |
326 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
327 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
328 i += 2; | |
329 continue; | |
330 } | |
331 encodingflag = AIM_IMFLAGS_UNICODE; | |
332 break; | |
333 } | |
334 | |
335 return encodingflag; | |
336 } | |
337 | |
8225 | 338 /* |
339 * Take a string of the form charset="bleh" where bleh is | |
340 * one of us-ascii, utf-8, iso-8859-1, or unicode-2-0, and | |
341 * return a newly allocated string containing bleh. | |
342 */ | |
343 static gchar *oscar_encoding_extract(const char *encoding) | |
5129 | 344 { |
8225 | 345 gchar *ret = NULL; |
346 char *begin, *end; | |
347 | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
348 /* Make sure encoding begins with charset= */ |
8225 | 349 if (strncmp(encoding, "text/aolrtf; charset=", 21)) |
350 return NULL; | |
351 | |
352 begin = strchr(encoding, '"'); | |
353 end = strrchr(encoding, '"'); | |
354 | |
355 if ((begin == NULL) || (end == NULL) || (begin >= end)) | |
356 return NULL; | |
357 | |
358 ret = g_strndup(begin+1, (end-1) - begin); | |
359 | |
360 return ret; | |
361 } | |
362 | |
363 /* | |
364 * Return the flag specifying the given encoding. | |
365 */ | |
366 static fu32_t oscar_encoding_parse(const char *encoding) | |
367 { | |
368 if ((encoding == NULL) || encoding[0] == '\0') { | |
8660 | 369 gaim_debug_warning("oscar", "Empty encoding, assuming ASCII\n"); |
5129 | 370 return 0; |
371 } | |
8225 | 372 |
373 if (!strcmp(encoding, "us-ascii") || !strcmp(encoding, "utf-8")) { | |
374 /* UTF-8 is our native encoding, ASCII is a proper subset */ | |
5129 | 375 return 0; |
8225 | 376 } else if (!strcmp(encoding, "iso-8859-1")) { |
5129 | 377 return AIM_IMFLAGS_ISO_8859_1; |
8225 | 378 } else if (!strcmp(encoding, "unicode-2-0")) { |
5129 | 379 return AIM_IMFLAGS_UNICODE; |
380 } else { | |
8660 | 381 gaim_debug_warning("oscar", |
8250 | 382 "Unrecognized character encoding '%s', attempting to convert to utf8 anyway\n", encoding); |
383 return 99; | |
5129 | 384 } |
385 } | |
386 | |
8233 | 387 gchar *oscar_encoding_to_utf8(const char *encoding, const char *text, int textlen) |
5129 | 388 { |
389 gchar *utf8 = NULL; | |
390 int flags = oscar_encoding_parse(encoding); | |
391 | |
392 switch (flags) { | |
393 case 0: | |
8250 | 394 utf8 = g_convert(text, textlen, "UTF-8", "UTF-8", NULL, NULL, NULL); |
5129 | 395 break; |
396 case AIM_IMFLAGS_ISO_8859_1: | |
397 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
398 break; | |
399 case AIM_IMFLAGS_UNICODE: | |
400 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
401 break; | |
8250 | 402 case 99: |
403 utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL); | |
404 if (utf8 == NULL) { | |
405 utf8 = g_convert(text, textlen, "UTF-8", "UTF-8", NULL, NULL, NULL); | |
406 } | |
407 break; | |
5129 | 408 } |
409 | |
410 return utf8; | |
411 } | |
412 | |
8701 | 413 static char *oscar_caps_to_string(guint caps) |
414 { | |
415 static char buf[512], *tmp; | |
416 int count = 0, i = 0; | |
417 guint bit = 1; | |
418 | |
419 if (!caps) { | |
420 return NULL; | |
421 } else while (bit <= AIM_CAPS_LAST) { | |
422 if (bit & caps) { | |
423 switch (bit) { | |
424 case AIM_CAPS_BUDDYICON: | |
425 tmp = _("Buddy Icon"); | |
426 break; | |
427 case AIM_CAPS_TALK: | |
428 tmp = _("Voice"); | |
429 break; | |
430 case AIM_CAPS_DIRECTIM: | |
431 tmp = _("AIM Direct IM"); | |
432 break; | |
433 case AIM_CAPS_CHAT: | |
434 tmp = _("Chat"); | |
435 break; | |
436 case AIM_CAPS_GETFILE: | |
437 tmp = _("Get File"); | |
438 break; | |
439 case AIM_CAPS_SENDFILE: | |
440 tmp = _("Send File"); | |
441 break; | |
442 case AIM_CAPS_GAMES: | |
443 case AIM_CAPS_GAMES2: | |
444 tmp = _("Games"); | |
445 break; | |
446 case AIM_CAPS_ADDINS: | |
447 tmp = _("Add-Ins"); | |
448 break; | |
449 case AIM_CAPS_SENDBUDDYLIST: | |
450 tmp = _("Send Buddy List"); | |
451 break; | |
452 case AIM_CAPS_ICQ_DIRECT: | |
453 tmp = _("ICQ Direct Connect"); | |
454 break; | |
455 case AIM_CAPS_APINFO: | |
456 tmp = _("AP User"); | |
457 break; | |
458 case AIM_CAPS_ICQRTF: | |
459 tmp = _("ICQ RTF"); | |
460 break; | |
461 case AIM_CAPS_EMPTY: | |
462 tmp = _("Nihilist"); | |
463 break; | |
464 case AIM_CAPS_ICQSERVERRELAY: | |
465 tmp = _("ICQ Server Relay"); | |
466 break; | |
467 case AIM_CAPS_ICQUTF8OLD: | |
468 tmp = _("Old ICQ UTF8"); | |
469 break; | |
470 case AIM_CAPS_TRILLIANCRYPT: | |
471 tmp = _("Trillian Encryption"); | |
472 break; | |
473 case AIM_CAPS_ICQUTF8: | |
474 tmp = _("ICQ UTF8"); | |
475 break; | |
476 case AIM_CAPS_HIPTOP: | |
477 tmp = _("Hiptop"); | |
478 break; | |
479 case AIM_CAPS_SECUREIM: | |
480 tmp = _("Security Enabled"); | |
481 break; | |
482 case AIM_CAPS_VIDEO: | |
483 tmp = _("Video Chat"); | |
484 break; | |
485 /* Not actually sure about this one... WinAIM doesn't show anything */ | |
486 case AIM_CAPS_ICHATAV: | |
487 tmp = _("iChat AV"); | |
488 break; | |
489 case AIM_CAPS_LIVEVIDEO: | |
490 tmp = _("Live Video"); | |
491 break; | |
492 case AIM_CAPS_CAMERA: | |
493 tmp = _("Camera"); | |
494 break; | |
495 default: | |
496 tmp = NULL; | |
497 break; | |
498 } | |
499 if (tmp) | |
500 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
501 tmp); | |
502 count++; | |
503 } | |
504 bit <<= 1; | |
505 } | |
506 return buf; | |
507 } | |
508 | |
509 static char *oscar_icqstatus(int state) { | |
510 /* Make a cute little string that shows the status of the dude or dudet */ | |
511 if (state & AIM_ICQ_STATE_CHAT) | |
512 return g_strdup_printf(_("Free For Chat")); | |
513 else if (state & AIM_ICQ_STATE_DND) | |
514 return g_strdup_printf(_("Do Not Disturb")); | |
515 else if (state & AIM_ICQ_STATE_OUT) | |
516 return g_strdup_printf(_("Not Available")); | |
517 else if (state & AIM_ICQ_STATE_BUSY) | |
518 return g_strdup_printf(_("Occupied")); | |
519 else if (state & AIM_ICQ_STATE_AWAY) | |
520 return g_strdup_printf(_("Away")); | |
521 else if (state & AIM_ICQ_STATE_WEBAWARE) | |
522 return g_strdup_printf(_("Web Aware")); | |
523 else if (state & AIM_ICQ_STATE_INVISIBLE) | |
524 return g_strdup_printf(_("Invisible")); | |
525 else | |
526 return g_strdup_printf(_("Online")); | |
527 } | |
528 | |
529 static void oscar_string_append(GString *str, char *newline, char *name, char *value) | |
8700 | 530 { |
531 gchar *utf8; | |
532 | |
533 if (value && value[0] && (utf8 = gaim_utf8_try_convert(value))) { | |
8701 | 534 g_string_append_printf(str, "%s<b>%s:</b> %s", newline, name, utf8); |
8700 | 535 g_free(utf8); |
536 } | |
537 } | |
538 | |
8701 | 539 static void oscar_string_append_info(GaimConnection *gc, GString *str, char *newline, GaimBuddy *b, aim_userinfo_t *userinfo) |
540 { | |
541 OscarData *od = gc->proto_data; | |
542 GaimAccount *account = gaim_connection_get_account(gc); | |
543 GaimGroup *g = NULL; | |
544 struct buddyinfo *bi = NULL; | |
545 char *tmp; | |
546 | |
547 if ((str == NULL) || (str == NULL) || (newline == NULL) || ((b == NULL) && (userinfo == NULL))) | |
548 return; | |
549 | |
550 if (userinfo == NULL) | |
551 userinfo = aim_locate_finduserinfo(od->sess, b->name); | |
552 | |
553 if (b == NULL) | |
554 b = gaim_find_buddy(gc->account, userinfo->sn); | |
555 | |
556 if (b != NULL) | |
557 g = gaim_find_buddys_group(b); | |
558 | |
559 if (userinfo != NULL) | |
560 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); | |
561 | |
8733 | 562 if (b != NULL) { |
563 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
564 if (isdigit(b->name[0])) { | |
565 tmp = oscar_icqstatus((b->uc & 0xffff0000) >> 16); | |
566 oscar_string_append(str, newline, _("Status"), tmp); | |
567 g_free(tmp); | |
568 } | |
569 } else { | |
570 char *tmp = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
571 if (aim_ssi_waitingforauth(od->sess->ssi.local, tmp, b->name)) | |
572 oscar_string_append(str, newline, _("Status"), _("Not Authorized")); | |
573 else | |
574 oscar_string_append(str, newline, _("Status"), _("Offline")); | |
8701 | 575 } |
8733 | 576 } |
8701 | 577 |
578 if ((bi != NULL) && (bi->ipaddr != 0)) { | |
579 char *tmp = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", | |
580 (bi->ipaddr & 0xff000000) >> 24, | |
581 (bi->ipaddr & 0x00ff0000) >> 16, | |
582 (bi->ipaddr & 0x0000ff00) >> 8, | |
583 (bi->ipaddr & 0x000000ff)); | |
584 oscar_string_append(str, newline, _("IP Address"), tmp); | |
585 g_free(tmp); | |
586 } | |
587 | |
588 if ((userinfo != NULL) && (userinfo->capabilities != 0)) { | |
589 tmp = oscar_caps_to_string(userinfo->capabilities); | |
590 oscar_string_append(str, newline, _("Capabilities"), tmp); | |
591 } | |
592 | |
593 if ((b != NULL) && (b->name != NULL) && (g != NULL) && (g->name != NULL)) { | |
594 tmp = aim_ssi_getcomment(od->sess->ssi.local, g->name, b->name); | |
595 if (tmp != NULL) { | |
596 oscar_string_append(str, newline, _("Buddy Comment"), tmp); | |
597 g_free(tmp); | |
598 } | |
599 } | |
600 | |
601 if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) { | |
602 tmp = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
603 oscar_string_append(str, newline, _("Available"), tmp); | |
604 g_free(tmp); | |
605 } | |
606 } | |
607 | |
7283 | 608 static struct direct_im *find_direct_im(OscarData *od, const char *who) { |
2086 | 609 GSList *d = od->direct_ims; |
610 struct direct_im *m = NULL; | |
611 | |
612 while (d) { | |
613 m = (struct direct_im *)d->data; | |
4355 | 614 if (!aim_sncmp(who, m->name)) |
4269 | 615 return m; |
2086 | 616 d = d->next; |
617 } | |
618 | |
4269 | 619 return NULL; |
2086 | 620 } |
621 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
622 static char *extract_name(const char *name) { |
4121 | 623 char *tmp, *x; |
2086 | 624 int i, j; |
4120 | 625 |
626 if (!name) | |
4121 | 627 return NULL; |
628 | |
4120 | 629 x = strchr(name, '-'); |
4121 | 630 |
2086 | 631 if (!x) return NULL; |
632 x = strchr(++x, '-'); | |
633 if (!x) return NULL; | |
634 tmp = g_strdup(++x); | |
635 | |
636 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
637 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
638 if (x[i] != '%') { |
2086 | 639 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
640 continue; |
2086 | 641 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
642 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
643 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
644 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 645 } |
646 | |
647 tmp[j] = 0; | |
648 return tmp; | |
649 } | |
650 | |
5575 | 651 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
7283 | 652 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 653 struct chat_connection *c = NULL; |
654 | |
655 while (g) { | |
656 c = (struct chat_connection *)g->data; | |
657 if (c->id == id) | |
658 break; | |
659 g = g->next; | |
660 c = NULL; | |
661 } | |
662 | |
663 return c; | |
664 } | |
665 | |
5575 | 666 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
|
667 aim_conn_t *conn) { |
7283 | 668 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 669 struct chat_connection *c = NULL; |
670 | |
671 while (g) { | |
672 c = (struct chat_connection *)g->data; | |
673 if (c->conn == conn) | |
674 break; | |
675 g = g->next; | |
676 c = NULL; | |
677 } | |
678 | |
679 return c; | |
680 } | |
681 | |
8219 | 682 static struct chat_connection *find_oscar_chat_by_conv(GaimConnection *gc, |
683 GaimConversation *conv) { | |
684 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; | |
685 struct chat_connection *c = NULL; | |
686 | |
687 while (g) { | |
688 c = (struct chat_connection *)g->data; | |
8733 | 689 if (c->conv == conv) |
8219 | 690 break; |
691 g = g->next; | |
692 c = NULL; | |
693 } | |
694 | |
695 return c; | |
696 } | |
697 | |
4617 | 698 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
5575 | 699 GaimConnection *gc = sess->aux_data; |
7283 | 700 OscarData *od = (OscarData *)gc->proto_data; |
8733 | 701 GaimConversation *conv; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
702 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
703 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
704 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
705 |
4617 | 706 sn = g_strdup(aim_odc_getsn(conn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
707 |
8660 | 708 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
709 "%s disconnected Direct IM.\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
710 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
711 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
712 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
713 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
714 |
3008 | 715 if (dim->connected) |
716 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
717 else | |
718 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
|
719 |
8733 | 720 conv = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
721 if (conv) | |
722 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
723 | |
724 gaim_conversation_update_progress(conv, 0); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
725 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
726 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
|
727 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
728 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
729 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
730 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
731 |
4617 | 732 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
733 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
734 aim_session_t *sess = aim_conn_getsess(conn); |
5575 | 735 GaimConnection *gc = sess ? sess->aux_data : NULL; |
7283 | 736 OscarData *od; |
2086 | 737 |
738 if (!gc) { | |
8660 | 739 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
740 "oscar callback for closed connection (1).\n"); |
2086 | 741 return; |
742 } | |
743 | |
7283 | 744 od = (OscarData *)gc->proto_data; |
2086 | 745 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
746 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 747 /* oh boy. this is probably bad. i guess the only thing we |
748 * can really do is return? */ | |
8660 | 749 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
750 "oscar callback for closed connection (2).\n"); |
8660 | 751 gaim_debug_misc("oscar", "gc = %p\n", gc); |
2086 | 752 return; |
753 } | |
754 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
755 if (condition & GAIM_INPUT_READ) { |
4617 | 756 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
8660 | 757 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
758 "got information on rendezvous listener\n"); |
4617 | 759 if (aim_handlerendconnect(od->sess, conn) < 0) { |
8660 | 760 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
761 "connection error (rendezvous listener)\n"); |
4617 | 762 aim_conn_kill(od->sess, &conn); |
8446 | 763 /* AAA - Don't we need to gaim_xfer_cancel here? --marv */ |
2086 | 764 } |
765 } else { | |
4617 | 766 if (aim_get_command(od->sess, conn) >= 0) { |
767 aim_rxdispatch(od->sess); | |
6029 | 768 if (od->killme) { |
8660 | 769 gaim_debug_error("oscar", "Waiting to be destroyed\n"); |
6029 | 770 return; |
771 } | |
2086 | 772 } else { |
773 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 774 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
8660 | 775 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
776 "major connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
777 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 778 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
779 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
5420 | 780 char *buf; |
8660 | 781 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
782 "disconnected from chat room %s\n", c->name); |
2086 | 783 c->conn = NULL; |
784 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
785 gaim_input_remove(c->inpa); |
2086 | 786 c->inpa = 0; |
787 c->fd = -1; | |
4617 | 788 aim_conn_kill(od->sess, &conn); |
5420 | 789 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
|
790 gaim_notify_error(gc, NULL, buf, NULL); |
5420 | 791 g_free(buf); |
2086 | 792 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 793 if (od->cnpa > 0) |
794 gaim_input_remove(od->cnpa); | |
795 od->cnpa = 0; | |
8660 | 796 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
797 "removing chatnav input watcher\n"); |
4617 | 798 while (od->create_rooms) { |
799 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
800 g_free(cr->name); |
4617 | 801 od->create_rooms = |
802 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
803 g_free(cr); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
804 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
805 _("Chat is currently unavailable"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
806 NULL); |
2086 | 807 } |
4617 | 808 aim_conn_kill(od->sess, &conn); |
2086 | 809 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 810 if (od->paspa > 0) |
811 gaim_input_remove(od->paspa); | |
812 od->paspa = 0; | |
8660 | 813 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
814 "removing authconn input watcher\n"); |
4617 | 815 aim_conn_kill(od->sess, &conn); |
3694 | 816 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 817 if (od->emlpa > 0) |
818 gaim_input_remove(od->emlpa); | |
819 od->emlpa = 0; | |
8660 | 820 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
821 "removing email input watcher\n"); |
4617 | 822 aim_conn_kill(od->sess, &conn); |
4804 | 823 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
824 if (od->icopa > 0) | |
825 gaim_input_remove(od->icopa); | |
826 od->icopa = 0; | |
8660 | 827 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
828 "removing icon input watcher\n"); |
4804 | 829 aim_conn_kill(od->sess, &conn); |
2086 | 830 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
831 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 832 gaim_odc_disconnect(od->sess, conn); |
833 aim_conn_kill(od->sess, &conn); | |
2086 | 834 } else { |
8660 | 835 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
836 "holy crap! generic connection error! %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
837 conn->type); |
4617 | 838 aim_conn_kill(od->sess, &conn); |
2086 | 839 } |
840 } | |
841 } | |
842 } | |
843 } | |
844 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
845 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
5575 | 846 GaimConnection *gc = sess->aux_data; |
7285 | 847 gchar *s = g_strdup_vprintf(format, va); |
848 gchar *buf; | |
849 | |
850 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s); | |
8660 | 851 gaim_debug_info("oscar", buf); |
7285 | 852 if (buf[strlen(buf)-1] != '\n') |
8660 | 853 gaim_debug_info(NULL, "\n"); |
7285 | 854 g_free(buf); |
2086 | 855 g_free(s); |
856 } | |
857 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
858 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 859 { |
5575 | 860 GaimConnection *gc = data; |
7283 | 861 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
862 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
863 aim_conn_t *conn; |
2086 | 864 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
865 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 866 close(source); |
867 return; | |
868 } | |
869 | |
4617 | 870 od = gc->proto_data; |
871 sess = od->sess; | |
2086 | 872 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 873 conn->fd = source; |
2086 | 874 |
875 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
876 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 877 return; |
878 } | |
879 | |
880 aim_conn_completeconnect(sess, conn); | |
4617 | 881 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
7282 | 882 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); |
883 | |
8660 | 884 gaim_debug_info("oscar", |
7282 | 885 "Screen name sent, waiting for response\n"); |
7283 | 886 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); |
8341 | 887 ck[1] = 0x65; |
2086 | 888 } |
889 | |
5575 | 890 static void oscar_login(GaimAccount *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
891 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
892 aim_conn_t *conn; |
5575 | 893 GaimConnection *gc = gaim_account_get_connection(account); |
7283 | 894 OscarData *od = gc->proto_data = g_new0(OscarData, 1); |
2086 | 895 |
8660 | 896 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
897 |
8437 | 898 if (!aim_snvalid(gaim_account_get_username(account))) { |
899 gchar *buf; | |
8590 | 900 buf = g_strdup_printf(_("Unable to login: Could not sign on as %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."), gaim_account_get_username(account)); |
8437 | 901 gaim_connection_error(gc, buf); |
902 g_free(buf); | |
903 } | |
904 | |
5575 | 905 if (isdigit(*(gaim_account_get_username(account)))) { |
4617 | 906 od->icq = TRUE; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
907 } else { |
6622 | 908 gc->flags |= GAIM_CONNECTION_HTML; |
909 gc->flags |= GAIM_CONNECTION_AUTO_RESP; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
910 } |
5836 | 911 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
2086 | 912 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
913 sess = g_new0(aim_session_t, 1); |
7285 | 914 aim_session_init(sess, TRUE, 0); |
2086 | 915 aim_setdebuggingcb(sess, oscar_debug); |
7282 | 916 /* |
917 * We need an immediate queue because we don't use a while-loop | |
918 * to see if things need to be sent. | |
919 */ | |
2086 | 920 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); |
4617 | 921 od->sess = sess; |
2086 | 922 sess->aux_data = gc; |
923 | |
924 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
925 if (conn == NULL) { | |
8660 | 926 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
927 "internal connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
928 gaim_connection_error(gc, _("Unable to login to AIM")); |
2086 | 929 return; |
930 } | |
931 | |
4649 | 932 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 933 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
934 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
935 | |
936 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
937 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
5575 | 938 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
939 oscar_login_connect, gc) < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
940 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 941 return; |
942 } | |
7282 | 943 |
7283 | 944 gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); |
8341 | 945 ck[0] = 0x5a; |
5575 | 946 } |
947 | |
948 static void oscar_close(GaimConnection *gc) { | |
7283 | 949 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 950 |
951 while (od->oscar_chats) { | |
952 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 953 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
954 gaim_input_remove(n->inpa); |
2086 | 955 g_free(n->name); |
956 g_free(n->show); | |
4617 | 957 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 958 g_free(n); |
959 } | |
4617 | 960 while (od->direct_ims) { |
961 struct direct_im *n = od->direct_ims->data; | |
2086 | 962 if (n->watcher > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
963 gaim_input_remove(n->watcher); |
4617 | 964 od->direct_ims = g_slist_remove(od->direct_ims, n); |
2086 | 965 g_free(n); |
966 } | |
4617 | 967 /* BBB */ |
968 while (od->file_transfers) { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
969 GaimXfer *xfer; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
970 xfer = (GaimXfer *)od->file_transfers->data; |
7805 | 971 gaim_xfer_cancel_local(xfer); |
3630 | 972 } |
4804 | 973 while (od->requesticon) { |
974 char *sn = od->requesticon->data; | |
975 od->requesticon = g_slist_remove(od->requesticon, sn); | |
976 free(sn); | |
977 } | |
4738 | 978 g_hash_table_destroy(od->buddyinfo); |
4617 | 979 while (od->create_rooms) { |
980 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
981 g_free(cr->name); |
4617 | 982 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
983 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
984 } |
4617 | 985 if (od->email) |
986 g_free(od->email); | |
987 if (od->newp) | |
988 g_free(od->newp); | |
989 if (od->oldp) | |
990 g_free(od->oldp); | |
2086 | 991 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
992 gaim_input_remove(gc->inpa); |
4617 | 993 if (od->cnpa > 0) |
994 gaim_input_remove(od->cnpa); | |
995 if (od->paspa > 0) | |
996 gaim_input_remove(od->paspa); | |
997 if (od->emlpa > 0) | |
998 gaim_input_remove(od->emlpa); | |
4804 | 999 if (od->icopa > 0) |
1000 gaim_input_remove(od->icopa); | |
6907 | 1001 if (od->icontimer > 0) |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
1002 gaim_timeout_remove(od->icontimer); |
8341 | 1003 if (od->getblisttimer > 0) |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
1004 gaim_timeout_remove(od->getblisttimer); |
8341 | 1005 if (od->getinfotimer > 0) |
1006 gaim_timeout_remove(od->getinfotimer); | |
4617 | 1007 aim_session_kill(od->sess); |
1008 g_free(od->sess); | |
1009 od->sess = NULL; | |
2086 | 1010 g_free(gc->proto_data); |
1011 gc->proto_data = NULL; | |
8660 | 1012 gaim_debug_info("oscar", "Signed off.\n"); |
2086 | 1013 } |
1014 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1015 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1016 GaimConnection *gc = data; |
7283 | 1017 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1018 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1019 aim_conn_t *bosconn; |
2086 | 1020 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1021 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1022 close(source); |
1023 return; | |
1024 } | |
1025 | |
4617 | 1026 od = gc->proto_data; |
1027 sess = od->sess; | |
1028 bosconn = od->conn; | |
4366 | 1029 bosconn->fd = source; |
2086 | 1030 |
1031 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1032 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 1033 return; |
1034 } | |
1035 | |
1036 aim_conn_completeconnect(sess, bosconn); | |
4617 | 1037 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
7283 | 1038 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1039 gaim_connection_update_progress(gc, |
7283 | 1040 _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); |
8341 | 1041 ck[4] = 0x61; |
2086 | 1042 } |
1043 | |
4617 | 1044 /* BBB */ |
4656 | 1045 /* |
1046 * This little area in oscar.c is the nexus of file transfer code, | |
1047 * so I wrote a little explanation of what happens. I am such a | |
1048 * ninja. | |
1049 * | |
1050 * The series of events for a file send is: | |
1051 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
1052 * -User chooses a file and oscar_xfer_init is called. It establishes a |
4656 | 1053 * listening socket, then asks the remote user to connect to us (and |
1054 * gives them the file name, port, IP, etc.) | |
1055 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
1056 * in oscar_sendfile_estblsh) | |
1057 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
1058 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
1059 * connection. | |
1060 * -We get drunk because file transfer kicks ass. | |
1061 * | |
1062 * The series of events for a file receive is: | |
1063 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
1064 * -Gaim user selects file to name and location to save file to and | |
1065 * oscar_xfer_init is called | |
1066 * -It connects to the remote user using the IP they gave us earlier | |
1067 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
1068 * them an AIM_CB_OFT_ACK. | |
1069 * -They begin to send us lots of raw data. | |
1070 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
1071 * the connection. |
4656 | 1072 */ |
1073 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
1074 | |
8446 | 1075 /* |
1076 * Miscellaneous xfer functions | |
1077 */ | |
1078 static GaimXfer *oscar_find_xfer_by_cookie(GSList *fts, const fu8_t *ck) | |
4656 | 1079 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1080 GaimXfer *xfer; |
5146 | 1081 struct aim_oft_info *oft_info; |
4656 | 1082 |
1083 while (fts) { | |
1084 xfer = fts->data; | |
5146 | 1085 oft_info = xfer->data; |
1086 | |
8446 | 1087 if (oft_info && !memcmp(ck, oft_info->cookie, 8)) |
4656 | 1088 return xfer; |
1089 | |
1090 fts = g_slist_next(fts); | |
1091 } | |
1092 | |
1093 return NULL; | |
1094 } | |
1095 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1096 static GaimXfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
4656 | 1097 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1098 GaimXfer *xfer; |
5146 | 1099 struct aim_oft_info *oft_info; |
4656 | 1100 |
1101 while (fts) { | |
1102 xfer = fts->data; | |
5146 | 1103 oft_info = xfer->data; |
1104 | |
1105 if (oft_info && (conn == oft_info->conn)) | |
4656 | 1106 return xfer; |
1107 | |
1108 fts = g_slist_next(fts); | |
1109 } | |
1110 | |
1111 return NULL; | |
1112 } | |
1113 | |
8446 | 1114 static void oscar_xfer_end(GaimXfer *xfer) |
1115 { | |
1116 struct aim_oft_info *oft_info = xfer->data; | |
1117 GaimConnection *gc = oft_info->sess->aux_data; | |
1118 OscarData *od = gc->proto_data; | |
1119 | |
8660 | 1120 gaim_debug_info("oscar", "AAA - in oscar_xfer_end\n"); |
8446 | 1121 |
1122 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
1123 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | |
1124 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); | |
1125 } | |
1126 | |
1127 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
1128 aim_oft_destroyinfo(oft_info); | |
1129 xfer->data = NULL; | |
1130 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
1131 } | |
1132 | |
1133 /* | |
1134 * xfer functions used when receiving files | |
1135 */ | |
1136 | |
1137 static void oscar_xfer_init_recv(GaimXfer *xfer) | |
1138 { | |
1139 struct aim_oft_info *oft_info = xfer->data; | |
1140 GaimConnection *gc = oft_info->sess->aux_data; | |
1141 OscarData *od = gc->proto_data; | |
1142 | |
8660 | 1143 gaim_debug_info("oscar", "AAA - in oscar_xfer_recv_init\n"); |
8446 | 1144 |
1145 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); | |
1146 if (oft_info->conn) { | |
1147 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
1148 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); | |
1149 oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc), | |
1150 xfer->remote_ip, xfer->remote_port, oscar_sendfile_connected, xfer); | |
1151 if (xfer->fd == -1) { | |
1152 gaim_xfer_error(GAIM_XFER_RECEIVE, xfer->who, | |
1153 _("Unable to establish file descriptor.")); | |
1154 gaim_xfer_cancel_local(xfer); | |
1155 } | |
1156 } else { | |
1157 gaim_xfer_error(GAIM_XFER_RECEIVE, xfer->who, | |
1158 _("Unable to create new connection.")); | |
1159 gaim_xfer_cancel_local(xfer); | |
1160 /* Try a different port? Ask them to connect to us? /join #gaim and whine? */ | |
1161 } | |
1162 | |
1163 } | |
1164 | |
1165 static void oscar_xfer_cancel_recv(GaimXfer *xfer) | |
1166 { | |
1167 struct aim_oft_info *oft_info = xfer->data; | |
1168 GaimConnection *gc = oft_info->sess->aux_data; | |
1169 OscarData *od = gc->proto_data; | |
1170 | |
8660 | 1171 gaim_debug_info("oscar", "AAA - in oscar_xfer_cancel_recv\n"); |
8446 | 1172 |
1173 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
1174 | |
1175 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
1176 aim_oft_destroyinfo(oft_info); | |
1177 xfer->data = NULL; | |
1178 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
1179 } | |
1180 | |
1181 static void oscar_xfer_ack_recv(GaimXfer *xfer, const char *buffer, size_t size) | |
1182 { | |
1183 struct aim_oft_info *oft_info = xfer->data; | |
1184 | |
1185 /* Update our rolling checksum. Like Walmart, yo. */ | |
1186 oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); | |
1187 } | |
1188 | |
1189 /* | |
1190 * xfer functions used when sending files | |
1191 */ | |
1192 | |
1193 static void oscar_xfer_init_send(GaimXfer *xfer) | |
1194 { | |
1195 struct aim_oft_info *oft_info = xfer->data; | |
1196 GaimConnection *gc = oft_info->sess->aux_data; | |
1197 OscarData *od = gc->proto_data; | |
1198 int listenfd; | |
1199 | |
8660 | 1200 gaim_debug_info("oscar", "AAA - in oscar_xfer_send_init\n"); |
8446 | 1201 |
1202 xfer->filename = g_path_get_basename(xfer->local_filename); | |
1203 strncpy(oft_info->fh.name, xfer->filename, 64); | |
1204 oft_info->fh.name[63] = '\0'; | |
1205 oft_info->fh.totsize = gaim_xfer_get_size(xfer); | |
1206 oft_info->fh.size = gaim_xfer_get_size(xfer); | |
1207 oft_info->fh.checksum = aim_oft_checksum_file(xfer->local_filename); | |
1208 | |
1209 /* Create a listening socket and an associated libfaim conn */ | |
1210 if ((listenfd = gaim_network_listen_range(5190, 5199)) < 0) { | |
1211 gaim_xfer_cancel_local(xfer); | |
1212 return; | |
1213 } | |
1214 xfer->local_port = gaim_network_get_port_from_fd(listenfd); | |
1215 oft_info->port = xfer->local_port; | |
1216 if (aim_sendfile_listen(od->sess, oft_info, listenfd) != 0) { | |
1217 gaim_xfer_cancel_local(xfer); | |
1218 return; | |
1219 } | |
8660 | 1220 gaim_debug_misc("oscar", |
8446 | 1221 "port is %hu, ip is %s\n", |
1222 xfer->local_port, oft_info->clientip); | |
1223 if (oft_info->conn) { | |
1224 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
1225 aim_im_sendch2_sendfile_ask(od->sess, oft_info); | |
1226 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
1227 } else { | |
1228 gaim_xfer_error(GAIM_XFER_SEND, xfer->who, | |
1229 _("Unable to establish listener socket.")); | |
1230 gaim_xfer_cancel_local(xfer); | |
1231 } | |
1232 } | |
1233 | |
1234 static void oscar_xfer_cancel_send(GaimXfer *xfer) | |
1235 { | |
1236 struct aim_oft_info *oft_info = xfer->data; | |
1237 GaimConnection *gc = oft_info->sess->aux_data; | |
1238 OscarData *od = gc->proto_data; | |
1239 | |
8660 | 1240 gaim_debug_info("oscar", "AAA - in oscar_xfer_cancel_send\n"); |
8446 | 1241 |
1242 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
1243 | |
1244 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
1245 aim_oft_destroyinfo(oft_info); | |
1246 xfer->data = NULL; | |
1247 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
1248 } | |
1249 | |
1250 static void oscar_xfer_ack_send(GaimXfer *xfer, const char *buffer, size_t size) | |
1251 { | |
1252 struct aim_oft_info *oft_info = xfer->data; | |
1253 | |
1254 /* I'm not sure I like how we do this. --marv | |
1255 * I do. AIM file transfers aren't really meant to be thought | |
1256 * of as a transferring just a single file. The rendezvous | |
1257 * establishes a connection between two computers, and then | |
1258 * those computers can use the same connection for transferring | |
1259 * multiple files. So we don't want the Gaim core up and closing | |
1260 * the socket all willy-nilly. We want to do that in the oscar | |
1261 * prpl, whenever one side or the other says they're finished | |
1262 * using the connection. There might be a better way to intercept | |
1263 * the socket from the core, however... --KingAnt | |
1264 */ | |
1265 | |
1266 /* | |
1267 * If we're done sending, intercept the socket from the core ft code | |
1268 * and wait for the other guy to send the "done" OFT packet. | |
1269 */ | |
1270 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
1271 gaim_input_remove(xfer->watcher); | |
1272 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
1273 xfer->fd = 0; | |
1274 gaim_xfer_set_completed(xfer, TRUE); | |
1275 } | |
1276 } | |
1277 | |
5575 | 1278 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
7283 | 1279 OscarData *od = (OscarData *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1280 GaimXfer *xfer; |
5146 | 1281 struct aim_oft_info *oft_info; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8227
diff
changeset
|
1282 const char *ip; |
3752 | 1283 |
4617 | 1284 /* You want to send a file to someone else, you're so generous */ |
1285 | |
1286 /* Build the file transfer handle */ | |
5575 | 1287 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
4617 | 1288 |
5146 | 1289 /* Create the oscar-specific data */ |
8838 | 1290 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1); |
8240 | 1291 oft_info = aim_oft_createinfo(od->sess, NULL, destsn, ip, 0, 0, 0, NULL); |
5146 | 1292 xfer->data = oft_info; |
1293 | |
4617 | 1294 /* Setup our I/O op functions */ |
8446 | 1295 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init_send); |
4617 | 1296 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1297 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
8446 | 1298 gaim_xfer_set_request_denied_fnc(xfer, oscar_xfer_cancel_send); |
1299 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack_send); | |
4617 | 1300 |
1301 /* Keep track of this transfer for later */ | |
1302 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1303 | |
1304 /* Now perform the request */ | |
1305 gaim_xfer_request(xfer); | |
3630 | 1306 } |
1307 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1308 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
6029 | 1309 GaimConnection *gc = sess->aux_data; |
7283 | 1310 OscarData *od = gc->proto_data; |
6029 | 1311 GaimAccount *account = gc->account; |
1312 aim_conn_t *bosconn; | |
1313 char *host; int port; | |
1314 int i, rc; | |
2086 | 1315 va_list ap; |
2704 | 1316 struct aim_authresp_info *info; |
6029 | 1317 |
5575 | 1318 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1319 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1320 va_start(ap, fr); |
2704 | 1321 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 1322 va_end(ap); |
1323 | |
8660 | 1324 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1325 "inside auth_resp (Screen name: %s)\n", info->sn); |
2704 | 1326 |
4293 | 1327 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
4056 | 1328 char buf[256]; |
2704 | 1329 switch (info->errorcode) { |
2086 | 1330 case 0x05: |
1331 /* Incorrect nick/password */ | |
6498 | 1332 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1333 gaim_connection_error(gc, _("Incorrect nickname or password.")); |
2086 | 1334 break; |
1335 case 0x11: | |
1336 /* Suspended account */ | |
6498 | 1337 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1338 gaim_connection_error(gc, _("Your account is currently suspended.")); |
2086 | 1339 break; |
3498 | 1340 case 0x14: |
1341 /* service temporarily unavailable */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1342 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); |
3498 | 1343 break; |
2086 | 1344 case 0x18: |
1345 /* connecting too frequently */ | |
6498 | 1346 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1347 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 | 1348 break; |
1349 case 0x1c: | |
1350 /* client too old */ | |
6498 | 1351 gc->wants_to_die = TRUE; |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
1352 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
|
1353 gaim_connection_error(gc, buf); |
2086 | 1354 break; |
1355 default: | |
6623 | 1356 gaim_connection_error(gc, _("Authentication failed")); |
2086 | 1357 break; |
1358 } | |
8660 | 1359 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1360 "Login Error Code 0x%04hx\n", info->errorcode); |
8660 | 1361 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1362 "Error URL: %s\n", info->errorurl); |
2086 | 1363 od->killme = TRUE; |
1364 return 1; | |
1365 } | |
1366 | |
1367 | |
8660 | 1368 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1369 "Reg status: %hu\n", info->regstatus); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1370 |
2704 | 1371 if (info->email) { |
8660 | 1372 gaim_debug_misc("oscar", "Email: %s\n", info->email); |
2086 | 1373 } else { |
8660 | 1374 gaim_debug_misc("oscar", "Email is NULL\n"); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1375 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1376 |
8660 | 1377 gaim_debug_misc("oscar", "BOSIP: %s\n", info->bosip); |
1378 gaim_debug_info("oscar", | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1379 "Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1380 aim_conn_kill(sess, &fr->conn); |
2086 | 1381 |
1382 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
1383 if (bosconn == NULL) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1384 gaim_connection_error(gc, _("Internal Error")); |
2086 | 1385 od->killme = TRUE; |
1386 return 0; | |
1387 } | |
1388 | |
4649 | 1389 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1390 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 1391 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
1392 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
1393 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 1394 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 1395 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
1396 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
1397 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
1398 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
1399 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
1400 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 1401 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 1402 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
1403 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
1404 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
1405 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
1406 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 1407 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
7011 | 1408 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_userinfo, 0); |
8341 | 1409 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_REQUESTINFOTIMEOUT, gaim_reqinfo_timeout, 0); |
2086 | 1410 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); |
1411 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
|
1412 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 1413 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
1414 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
1415 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
1416 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1417 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
5844 | 1418 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
|
1419 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
|
1420 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
|
1421 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4759 | 1422 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
4624 | 1423 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
4230 | 1424 #ifndef NOSSI |
4642 | 1425 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
2991 | 1426 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
1427 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
1428 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
4230 | 1429 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
8227 | 1430 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADD, gaim_ssi_parseadd, 0); |
4230 | 1431 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); |
1432 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | |
1433 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | |
1434 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | |
1435 #endif | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1436 |
7283 | 1437 od->conn = bosconn; |
2704 | 1438 for (i = 0; i < (int)strlen(info->bosip); i++) { |
1439 if (info->bosip[i] == ':') { | |
1440 port = atoi(&(info->bosip[i+1])); | |
2086 | 1441 break; |
1442 } | |
1443 } | |
2704 | 1444 host = g_strndup(info->bosip, i); |
2086 | 1445 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1446 rc = gaim_proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
2086 | 1447 g_free(host); |
4366 | 1448 if (rc < 0) { |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1449 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 1450 od->killme = TRUE; |
1451 return 0; | |
1452 } | |
4293 | 1453 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1454 gaim_input_remove(gc->inpa); |
2704 | 1455 |
7283 | 1456 gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); |
8341 | 1457 ck[3] = 0x64; |
7282 | 1458 |
2086 | 1459 return 1; |
1460 } | |
1461 | |
7285 | 1462 /* XXX - Should use gaim_url_fetch for the below stuff */ |
2086 | 1463 struct pieceofcrap { |
5575 | 1464 GaimConnection *gc; |
2086 | 1465 unsigned long offset; |
1466 unsigned long len; | |
1467 char *modname; | |
1468 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1469 aim_conn_t *conn; |
2086 | 1470 unsigned int inpa; |
1471 }; | |
1472 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1473 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 1474 { |
1475 struct pieceofcrap *pos = data; | |
7283 | 1476 OscarData *od = pos->gc->proto_data; |
2086 | 1477 char in = '\0'; |
1478 int x = 0; | |
1479 unsigned char m[17]; | |
1480 | |
1481 while (read(pos->fd, &in, 1) == 1) { | |
1482 if (in == '\n') | |
1483 x++; | |
1484 else if (in != '\r') | |
1485 x = 0; | |
1486 if (x == 2) | |
1487 break; | |
1488 in = '\0'; | |
1489 } | |
1490 if (in != '\n') { | |
4056 | 1491 char buf[256]; |
1492 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
|
1493 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1494 gaim_notify_warning(pos->gc, NULL, |
7422 | 1495 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1496 buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1497 gaim_input_remove(pos->inpa); |
2086 | 1498 close(pos->fd); |
1499 g_free(pos); | |
1500 return; | |
1501 } | |
1502 read(pos->fd, m, 16); | |
1503 m[16] = '\0'; | |
8660 | 1504 gaim_debug_misc("oscar", "Sending hash: "); |
2086 | 1505 for (x = 0; x < 16; x++) |
8660 | 1506 gaim_debug_misc(NULL, "%02hhx ", (unsigned char)m[x]); |
1507 | |
1508 gaim_debug_misc(NULL, "\n"); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1509 gaim_input_remove(pos->inpa); |
2086 | 1510 close(pos->fd); |
1511 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
1512 g_free(pos); | |
1513 } | |
1514 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1515 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1516 struct pieceofcrap *pos = data; |
5420 | 1517 gchar *buf; |
2086 | 1518 |
4366 | 1519 pos->fd = source; |
1520 | |
2086 | 1521 if (source < 0) { |
5420 | 1522 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
|
1523 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1524 gaim_notify_warning(pos->gc, NULL, |
7422 | 1525 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1526 buf); |
5420 | 1527 g_free(buf); |
2086 | 1528 if (pos->modname) |
1529 g_free(pos->modname); | |
1530 g_free(pos); | |
1531 return; | |
1532 } | |
1533 | |
5420 | 1534 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", |
2086 | 1535 pos->offset, pos->len, pos->modname ? pos->modname : ""); |
1536 write(pos->fd, buf, strlen(buf)); | |
5420 | 1537 g_free(buf); |
2086 | 1538 if (pos->modname) |
1539 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1540 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 1541 return; |
1542 } | |
1543 | |
1544 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
1545 #define AIM_MAX_FILE_SIZE 98304 | |
1546 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1547 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1548 va_list ap; |
1549 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1550 fu32_t offset, len; |
2086 | 1551 char *modname; |
1552 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1553 va_start(ap, fr); |
4200 | 1554 offset = va_arg(ap, fu32_t); |
1555 len = va_arg(ap, fu32_t); | |
2086 | 1556 modname = va_arg(ap, char *); |
1557 va_end(ap); | |
1558 | |
8660 | 1559 gaim_debug_misc("oscar", |
5556 | 1560 "offset: %u, len: %u, file: %s\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1561 offset, len, (modname ? modname : "aim.exe")); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1562 |
2086 | 1563 if (len == 0) { |
8660 | 1564 gaim_debug_misc("oscar", "len is 0, hashing NULL\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1565 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 1566 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1567 return 1; | |
1568 } | |
1569 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
1570 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
1571 char *buf; | |
1572 int i = 8; | |
1573 if (modname) | |
1574 i += strlen(modname); | |
1575 buf = g_malloc(i); | |
1576 i = 0; | |
1577 if (modname) { | |
1578 memcpy(buf, modname, strlen(modname)); | |
1579 i += strlen(modname); | |
1580 } | |
1581 buf[i++] = offset & 0xff; | |
1582 buf[i++] = (offset >> 8) & 0xff; | |
1583 buf[i++] = (offset >> 16) & 0xff; | |
1584 buf[i++] = (offset >> 24) & 0xff; | |
1585 buf[i++] = len & 0xff; | |
1586 buf[i++] = (len >> 8) & 0xff; | |
1587 buf[i++] = (len >> 16) & 0xff; | |
1588 buf[i++] = (len >> 24) & 0xff; | |
8660 | 1589 gaim_debug_misc("oscar", "len + offset is invalid, " |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1590 "hashing request\n"); |
2086 | 1591 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1592 g_free(buf); | |
1593 return 1; | |
1594 } | |
1595 */ | |
1596 | |
1597 pos = g_new0(struct pieceofcrap, 1); | |
1598 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1599 pos->conn = fr->conn; |
2086 | 1600 |
1601 pos->offset = offset; | |
1602 pos->len = len; | |
1603 pos->modname = modname ? g_strdup(modname) : NULL; | |
1604 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1605 if (gaim_proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
4056 | 1606 char buf[256]; |
2086 | 1607 if (pos->modname) |
1608 g_free(pos->modname); | |
1609 g_free(pos); | |
4056 | 1610 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
|
1611 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1612 gaim_notify_warning(pos->gc, NULL, |
7422 | 1613 _("Gaim was unable to get a valid login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1614 buf); |
2086 | 1615 } |
1616 | |
1617 return 1; | |
1618 } | |
1619 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1620 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1621 GaimConnection *gc = sess->aux_data; |
7283 | 1622 OscarData *od = gc->proto_data; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1623 GaimAccount *account = gaim_connection_get_account(gc); |
5575 | 1624 GaimAccount *ac = gaim_connection_get_account(gc); |
7282 | 1625 #if 0 |
1626 struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; | |
1627 #endif | |
7011 | 1628 va_list ap; |
1629 char *key; | |
2086 | 1630 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1631 va_start(ap, fr); |
2086 | 1632 key = va_arg(ap, char *); |
1633 va_end(ap); | |
1634 | |
4617 | 1635 if (od->icq) { |
3458 | 1636 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1637 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1638 gaim_account_get_password(account), &info, key); |
3458 | 1639 } else { |
1640 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1641 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1642 gaim_account_get_password(account), &info, key); |
3458 | 1643 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1644 |
7283 | 1645 gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); |
8341 | 1646 ck[2] = 0x6c; |
7282 | 1647 |
2086 | 1648 return 1; |
1649 } | |
1650 | |
2675 | 1651 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1652 GaimConnection *gc = sess->aux_data; |
2647 | 1653 struct chat_connection *chatcon; |
1654 static int id = 1; | |
1655 | |
6905 | 1656 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
|
1657 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
|
1658 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
|
1659 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
|
1660 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0); |
2675 | 1661 |
2672 | 1662 aim_clientready(sess, fr->conn); |
2675 | 1663 |
2647 | 1664 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
1665 chatcon->id = id; | |
8733 | 1666 chatcon->conv = serv_got_joined_chat(gc, id++, chatcon->show); |
2647 | 1667 |
1668 return 1; | |
1669 } | |
1670 | |
2675 | 1671 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
1672 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1673 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 1674 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 1675 |
1676 aim_clientready(sess, fr->conn); | |
1677 | |
1678 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1679 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1680 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1681 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1682 |
3694 | 1683 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
1684 | |
1685 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1686 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
1687 | |
7282 | 1688 aim_email_sendcookies(sess); |
1689 aim_email_activate(sess); | |
3694 | 1690 aim_clientready(sess, fr->conn); |
1691 | |
1692 return 1; | |
1693 } | |
1694 | |
4804 | 1695 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1696 GaimConnection *gc = sess->aux_data; |
7283 | 1697 OscarData *od = gc->proto_data; |
4804 | 1698 |
1699 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1700 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | |
1701 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | |
1702 | |
1703 aim_clientready(sess, fr->conn); | |
1704 | |
4823 | 1705 od->iconconnecting = FALSE; |
1706 | |
4804 | 1707 if (od->icontimer) |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
1708 gaim_timeout_remove(od->icontimer); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
1709 od->icontimer = gaim_timeout_add(100, gaim_icon_timerfunc, gc); |
4804 | 1710 |
1711 return 1; | |
1712 } | |
1713 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1714 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1715 GaimConnection *gc = data; |
7283 | 1716 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1717 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1718 aim_conn_t *tstconn; |
2086 | 1719 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1720 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1721 close(source); |
1722 return; | |
1723 } | |
1724 | |
4617 | 1725 od = gc->proto_data; |
1726 sess = od->sess; | |
2086 | 1727 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
4366 | 1728 tstconn->fd = source; |
2086 | 1729 |
1730 if (source < 0) { | |
1731 aim_conn_kill(sess, &tstconn); | |
8660 | 1732 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1733 "unable to connect to chatnav server\n"); |
2086 | 1734 return; |
1735 } | |
1736 | |
1737 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1738 od->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
8660 | 1739 gaim_debug_info("oscar", "chatnav: connected\n"); |
2086 | 1740 } |
1741 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1742 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1743 { |
5575 | 1744 GaimConnection *gc = data; |
7283 | 1745 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1746 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1747 aim_conn_t *tstconn; |
2086 | 1748 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1749 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1750 close(source); |
1751 return; | |
1752 } | |
1753 | |
4617 | 1754 od = gc->proto_data; |
1755 sess = od->sess; | |
2086 | 1756 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 1757 tstconn->fd = source; |
2086 | 1758 |
1759 if (source < 0) { | |
1760 aim_conn_kill(sess, &tstconn); | |
8660 | 1761 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1762 "unable to connect to authorizer\n"); |
2086 | 1763 return; |
1764 } | |
1765 | |
1766 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1767 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
8660 | 1768 gaim_debug_info("oscar", "admin: connected\n"); |
2086 | 1769 } |
1770 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1771 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1772 { |
1773 struct chat_connection *ccon = data; | |
5575 | 1774 GaimConnection *gc = ccon->gc; |
7283 | 1775 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1776 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1777 aim_conn_t *tstconn; |
2086 | 1778 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1779 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1780 close(source); |
1781 g_free(ccon->show); | |
1782 g_free(ccon->name); | |
1783 g_free(ccon); | |
1784 return; | |
1785 } | |
1786 | |
4617 | 1787 od = gc->proto_data; |
1788 sess = od->sess; | |
2086 | 1789 tstconn = ccon->conn; |
4366 | 1790 tstconn->fd = source; |
2086 | 1791 |
1792 if (source < 0) { | |
1793 aim_conn_kill(sess, &tstconn); | |
1794 g_free(ccon->show); | |
1795 g_free(ccon->name); | |
1796 g_free(ccon); | |
1797 return; | |
1798 } | |
1799 | |
1800 aim_conn_completeconnect(sess, ccon->conn); | |
4617 | 1801 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
1802 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | |
2086 | 1803 } |
1804 | |
3694 | 1805 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1806 GaimConnection *gc = data; |
7283 | 1807 OscarData *od; |
3694 | 1808 aim_session_t *sess; |
1809 aim_conn_t *tstconn; | |
1810 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1811 if (!g_list_find(gaim_connections_get_all(), gc)) { |
3694 | 1812 close(source); |
1813 return; | |
1814 } | |
1815 | |
4617 | 1816 od = gc->proto_data; |
1817 sess = od->sess; | |
3694 | 1818 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
4366 | 1819 tstconn->fd = source; |
3694 | 1820 |
1821 if (source < 0) { | |
1822 aim_conn_kill(sess, &tstconn); | |
8660 | 1823 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1824 "unable to connect to email server\n"); |
3694 | 1825 return; |
1826 } | |
1827 | |
1828 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1829 od->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
8660 | 1830 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1831 "email: connected\n"); |
3694 | 1832 } |
1833 | |
4804 | 1834 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1835 GaimConnection *gc = data; |
7283 | 1836 OscarData *od; |
4804 | 1837 aim_session_t *sess; |
1838 aim_conn_t *tstconn; | |
1839 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1840 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4804 | 1841 close(source); |
1842 return; | |
1843 } | |
1844 | |
1845 od = gc->proto_data; | |
1846 sess = od->sess; | |
1847 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); | |
1848 tstconn->fd = source; | |
1849 | |
1850 if (source < 0) { | |
1851 aim_conn_kill(sess, &tstconn); | |
8660 | 1852 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1853 "unable to connect to icon server\n"); |
4804 | 1854 return; |
1855 } | |
1856 | |
1857 aim_conn_completeconnect(sess, tstconn); | |
1858 od->icopa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); | |
8660 | 1859 gaim_debug_info("oscar", "icon: connected\n"); |
4804 | 1860 } |
1861 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1862 /* 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
|
1863 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1864 GaimConnection *gc = sess->aux_data; |
1865 GaimAccount *account = gaim_connection_get_account(gc); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1866 aim_conn_t *tstconn; |
4452 | 1867 int i; |
2086 | 1868 char *host; |
1869 int port; | |
4821 | 1870 va_list ap; |
1871 struct aim_redirect_data *redir; | |
2086 | 1872 |
5575 | 1873 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1874 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1875 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1876 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1877 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1878 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1879 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1880 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1881 port = atoi(&(redir->ip[i+1])); |
2086 | 1882 break; |
1883 } | |
1884 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1885 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1886 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1887 switch(redir->group) { |
2086 | 1888 case 0x7: /* Authorizer */ |
8660 | 1889 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1890 "Reconnecting with authorizor...\n"); |
2086 | 1891 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
1892 if (tstconn == NULL) { | |
8660 | 1893 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1894 "unable to reconnect with authorizer\n"); |
2086 | 1895 g_free(host); |
1896 return 1; | |
1897 } | |
4649 | 1898 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1899 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1900 |
1901 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1902 if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
2086 | 1903 aim_conn_kill(sess, &tstconn); |
8660 | 1904 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1905 "unable to reconnect with authorizer\n"); |
2086 | 1906 g_free(host); |
1907 return 1; | |
1908 } | |
4293 | 1909 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1910 break; |
1911 | |
2086 | 1912 case 0xd: /* ChatNav */ |
1913 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1914 if (tstconn == NULL) { | |
8660 | 1915 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1916 "unable to connect to chatnav server\n"); |
2086 | 1917 g_free(host); |
1918 return 1; | |
1919 } | |
4649 | 1920 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1921 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1922 |
1923 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1924 if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
2086 | 1925 aim_conn_kill(sess, &tstconn); |
8660 | 1926 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1927 "unable to connect to chatnav server\n"); |
2086 | 1928 g_free(host); |
1929 return 1; | |
1930 } | |
4293 | 1931 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1932 break; |
1933 | |
1934 case 0xe: { /* Chat */ | |
2086 | 1935 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1936 |
2086 | 1937 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1938 if (tstconn == NULL) { | |
8660 | 1939 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1940 "unable to connect to chat server\n"); |
2086 | 1941 g_free(host); |
1942 return 1; | |
1943 } | |
1944 | |
4649 | 1945 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1946 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1947 | |
2086 | 1948 ccon = g_new0(struct chat_connection, 1); |
1949 ccon->conn = tstconn; | |
1950 ccon->gc = gc; | |
1951 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1952 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1953 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1954 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1955 ccon->show = extract_name(redir->chat.room); |
4634 | 1956 |
2086 | 1957 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1958 if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
2086 | 1959 aim_conn_kill(sess, &tstconn); |
8660 | 1960 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1961 "unable to connect to chat server\n"); |
2086 | 1962 g_free(host); |
1963 g_free(ccon->show); | |
1964 g_free(ccon->name); | |
1965 g_free(ccon); | |
1966 return 1; | |
1967 } | |
4293 | 1968 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
8660 | 1969 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1970 "Connected to chat room %s exchange %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1971 ccon->name, ccon->exchange); |
4194 | 1972 } break; |
3694 | 1973 |
4804 | 1974 case 0x0010: { /* icon */ |
1975 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { | |
8660 | 1976 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1977 "unable to connect to icon server\n"); |
4804 | 1978 g_free(host); |
1979 return 1; | |
1980 } | |
1981 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); | |
1982 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); | |
1983 | |
1984 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1985 if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { |
4804 | 1986 aim_conn_kill(sess, &tstconn); |
8660 | 1987 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1988 "unable to connect to icon server\n"); |
4804 | 1989 g_free(host); |
1990 return 1; | |
1991 } | |
1992 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); | |
1993 } break; | |
1994 | |
3694 | 1995 case 0x0018: { /* email */ |
1996 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
8660 | 1997 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1998 "unable to connect to email server\n"); |
3694 | 1999 g_free(host); |
2000 return 1; | |
2001 } | |
4649 | 2002 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
3694 | 2003 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
2004 | |
2005 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2006 if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
3694 | 2007 aim_conn_kill(sess, &tstconn); |
8660 | 2008 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2009 "unable to connect to email server\n"); |
3694 | 2010 g_free(host); |
2011 return 1; | |
2012 } | |
4293 | 2013 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
3694 | 2014 } break; |
2015 | |
2086 | 2016 default: /* huh? */ |
8660 | 2017 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2018 "got redirect for unknown service 0x%04hx\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2019 redir->group); |
2086 | 2020 break; |
2021 } | |
2022 | |
2023 g_free(host); | |
2024 return 1; | |
2025 } | |
2026 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2027 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2028 GaimConnection *gc = sess->aux_data; |
7283 | 2029 OscarData *od = gc->proto_data; |
4738 | 2030 struct buddyinfo *bi; |
2993 | 2031 time_t time_idle = 0, signon = 0; |
2032 int type = 0; | |
2033 int caps = 0; | |
2086 | 2034 va_list ap; |
4738 | 2035 aim_userinfo_t *info; |
4194 | 2036 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2037 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2038 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2039 va_end(ap); |
2040 | |
2993 | 2041 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
2042 caps = info->capabilities; | |
3267 | 2043 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
2044 type |= UC_AB; | |
2045 | |
4766 | 2046 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
2047 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
2048 type |= UC_UNCONFIRMED; | |
2049 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
2050 type |= UC_ADMIN; | |
2051 if (info->flags & AIM_FLAG_AOL) | |
2052 type |= UC_AOL; | |
2053 if (info->flags & AIM_FLAG_FREE) | |
2054 type |= UC_NORMAL; | |
2055 if (info->flags & AIM_FLAG_AWAY) | |
2056 type |= UC_UNAVAILABLE; | |
2057 if (info->flags & AIM_FLAG_WIRELESS) | |
2058 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2059 } |
2993 | 2060 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 2061 type = (info->icqinfo.status << 16); |
3013 | 2062 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
2063 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 2064 type |= UC_UNAVAILABLE; |
3013 | 2065 } |
2993 | 2066 } |
2067 | |
7141 | 2068 if (caps & AIM_CAPS_ICQ_DIRECT) |
2069 caps ^= AIM_CAPS_ICQ_DIRECT; | |
2993 | 2070 |
2071 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 2072 time(&time_idle); |
2073 time_idle -= info->idletime*60; | |
2993 | 2074 } |
2075 | |
5836 | 2076 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
2077 signon = info->onlinesince; | |
2078 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
2993 | 2079 signon = time(NULL) - info->sessionlen; |
2086 | 2080 |
5575 | 2081 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
2082 gaim_connection_set_display_name(gc, info->sn); | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2083 |
7261 | 2084 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
4738 | 2085 if (!bi) { |
2086 bi = g_new0(struct buddyinfo, 1); | |
7261 | 2087 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, info->sn)), bi); |
4738 | 2088 } |
4739 | 2089 bi->typingnot = FALSE; |
2090 bi->ico_informed = FALSE; | |
6857 | 2091 bi->ipaddr = info->icqinfo.ipaddr; |
2092 | |
2093 /* Available message stuff */ | |
6292 | 2094 free(bi->availmsg); |
7011 | 2095 if (info->avail != NULL) |
8225 | 2096 bi->availmsg = oscar_encoding_to_utf8(info->avail_encoding, info->avail, info->avail_len); |
5837 | 2097 else |
6292 | 2098 bi->availmsg = NULL; |
4732 | 2099 |
4804 | 2100 /* Server stored icon stuff */ |
4853 | 2101 if (info->iconcsumlen) { |
7125 | 2102 const char *filename = NULL, *saved_b16 = NULL; |
2103 char *b16 = NULL; | |
7093 | 2104 GaimBuddy *b = NULL; |
4853 | 2105 |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
2106 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); |
4853 | 2107 b = gaim_find_buddy(gc->account, info->sn); |
7093 | 2108 /* |
2109 * If for some reason the checksum is valid, but cached file is not.. | |
2110 * we want to know. | |
2111 */ | |
7693 | 2112 filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon"); |
7093 | 2113 if (filename != NULL) { |
2114 if (g_file_test(filename, G_FILE_TEST_EXISTS)) | |
7693 | 2115 saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b, |
2116 "icon_checksum"); | |
7093 | 2117 } else |
2118 saved_b16 = NULL; | |
7054
7c04a0775918
[gaim-migrate @ 7617]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7045
diff
changeset
|
2119 |
4853 | 2120 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { |
2121 GSList *cur = od->requesticon; | |
2122 while (cur && aim_sncmp((char *)cur->data, info->sn)) | |
2123 cur = cur->next; | |
2124 if (!cur) { | |
7475 | 2125 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn))); |
4853 | 2126 if (od->icontimer) |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
2127 gaim_timeout_remove(od->icontimer); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
2128 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); |
4853 | 2129 } |
2130 } | |
6053 | 2131 g_free(b16); |
4853 | 2132 } |
2133 | |
5628 | 2134 serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); |
2086 | 2135 |
2136 return 1; | |
2137 } | |
2138 | |
8341 | 2139 static void gaim_check_comment(OscarData *od, const char *str) { |
2140 if ((str == NULL) || strcmp(str, ck)) | |
2141 aim_locate_setcaps(od->sess, caps_aim); | |
2142 else | |
2143 aim_locate_setcaps(od->sess, caps_aim | AIM_CAPS_SECUREIM); | |
2144 } | |
2145 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2146 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2147 GaimConnection *gc = sess->aux_data; |
7283 | 2148 OscarData *od = gc->proto_data; |
2086 | 2149 va_list ap; |
4739 | 2150 aim_userinfo_t *info; |
2086 | 2151 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2152 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2153 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2154 va_end(ap); |
2155 | |
4732 | 2156 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
2086 | 2157 |
7261 | 2158 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
5837 | 2159 |
2086 | 2160 return 1; |
2161 } | |
2162 | |
3730 | 2163 static void cancel_direct_im(struct ask_direct *d) { |
8660 | 2164 gaim_debug_info("oscar", "Freeing DirectIM prompts.\n"); |
2086 | 2165 |
2166 g_free(d->sn); | |
2167 g_free(d); | |
2168 } | |
2169 | |
4617 | 2170 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 2171 struct direct_im *dim = data; |
5575 | 2172 GaimConnection *gc = dim->gc; |
7283 | 2173 OscarData *od = gc->proto_data; |
8733 | 2174 GaimConversation *conv; |
2086 | 2175 char buf[256]; |
3008 | 2176 struct sockaddr name; |
2177 socklen_t name_len = 1; | |
2178 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2179 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 2180 g_free(dim); |
2181 return; | |
2182 } | |
2183 | |
2184 if (source < 0) { | |
2185 g_free(dim); | |
2186 return; | |
2187 } | |
2188 | |
4366 | 2189 dim->conn->fd = source; |
2086 | 2190 aim_conn_completeconnect(od->sess, dim->conn); |
8733 | 2191 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); |
3008 | 2192 |
2193 /* This is the best way to see if we're connected or not */ | |
2194 if (getpeername(source, &name, &name_len) == 0) { | |
2195 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
2196 dim->connected = TRUE; | |
8733 | 2197 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
3008 | 2198 } |
2086 | 2199 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 2200 |
4617 | 2201 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
2086 | 2202 } |
2203 | |
4617 | 2204 /* BBB */ |
3952 | 2205 /* |
4617 | 2206 * This is called after a remote AIM user has connected to us. We |
2207 * want to do some voodoo with the socket file descriptors, add a | |
2208 * callback or two, and then send the AIM_CB_OFT_PROMPT. | |
3952 | 2209 */ |
4656 | 2210 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2211 GaimConnection *gc = sess->aux_data; |
7283 | 2212 OscarData *od = (OscarData *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2213 GaimXfer *xfer; |
5146 | 2214 struct aim_oft_info *oft_info; |
3630 | 2215 va_list ap; |
2216 aim_conn_t *conn, *listenerconn; | |
4656 | 2217 |
8660 | 2218 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2219 "AAA - in oscar_sendfile_estblsh\n"); |
3630 | 2220 va_start(ap, fr); |
2221 conn = va_arg(ap, aim_conn_t *); | |
2222 listenerconn = va_arg(ap, aim_conn_t *); | |
2223 va_end(ap); | |
2224 | |
4617 | 2225 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
2226 return 1; | |
2227 | |
5146 | 2228 if (!(oft_info = xfer->data)) |
4617 | 2229 return 1; |
2230 | |
3630 | 2231 /* Stop watching listener conn; watch transfer conn instead */ |
4617 | 2232 gaim_input_remove(xfer->watcher); |
3630 | 2233 aim_conn_kill(sess, &listenerconn); |
2234 | |
5146 | 2235 oft_info->conn = conn; |
2236 xfer->fd = oft_info->conn->fd; | |
2237 | |
2238 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); | |
2239 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); | |
2240 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 2241 |
2242 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 2243 aim_oft_sendheader(sess, AIM_CB_OFT_PROMPT, oft_info); |
3630 | 2244 |
2245 return 0; | |
2246 } | |
2247 | |
3952 | 2248 /* |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2249 * This is the gaim callback passed to gaim_proxy_connect when connecting to another AIM |
4617 | 2250 * user in order to transfer a file. |
3952 | 2251 */ |
4617 | 2252 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
|
2253 GaimXfer *xfer; |
5146 | 2254 struct aim_oft_info *oft_info; |
4656 | 2255 |
8660 | 2256 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2257 "AAA - in oscar_sendfile_connected\n"); |
4617 | 2258 if (!(xfer = data)) |
2259 return; | |
5146 | 2260 if (!(oft_info = xfer->data)) |
3630 | 2261 return; |
8446 | 2262 if (source < 0) { |
2263 gaim_xfer_cancel_remote(xfer); | |
4617 | 2264 return; |
8446 | 2265 } |
4617 | 2266 |
2267 xfer->fd = source; | |
5146 | 2268 oft_info->conn->fd = source; |
2269 | |
2270 aim_conn_completeconnect(oft_info->sess, oft_info->conn); | |
2271 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 2272 |
2273 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 2274 aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); |
4617 | 2275 |
2276 return; | |
3630 | 2277 } |
2278 | |
3952 | 2279 /* |
4617 | 2280 * This is called when a buddy sends us some file info. This happens when they |
2281 * are sending a file to you, and you have just established a connection to them. | |
4650 | 2282 * You should send them the exact same info except use the real cookie. We also |
4617 | 2283 * get like totally ready to like, receive the file, kay? |
3952 | 2284 */ |
4617 | 2285 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2286 GaimConnection *gc = sess->aux_data; |
7283 | 2287 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2288 GaimXfer *xfer; |
5146 | 2289 struct aim_oft_info *oft_info; |
4617 | 2290 va_list ap; |
2291 aim_conn_t *conn; | |
2292 fu8_t *cookie; | |
2293 struct aim_fileheader_t *fh; | |
4656 | 2294 |
8660 | 2295 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2296 "AAA - in oscar_sendfile_prompt\n"); |
4617 | 2297 va_start(ap, fr); |
2298 conn = va_arg(ap, aim_conn_t *); | |
2299 cookie = va_arg(ap, fu8_t *); | |
2300 fh = va_arg(ap, struct aim_fileheader_t *); | |
2301 va_end(ap); | |
2302 | |
2303 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2304 return 1; | |
2305 | |
5146 | 2306 if (!(oft_info = xfer->data)) |
4617 | 2307 return 1; |
2308 | |
2309 /* We want to stop listening with a normal thingy */ | |
2310 gaim_input_remove(xfer->watcher); | |
2311 xfer->watcher = 0; | |
2312 | |
5146 | 2313 /* They sent us some information about the file they're sending */ |
2314 memcpy(&oft_info->fh, fh, sizeof(*fh)); | |
2315 | |
2316 /* Fill in the cookie */ | |
2317 memcpy(&oft_info->fh.bcookie, oft_info->cookie, 8); | |
2318 | |
4617 | 2319 /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ |
5146 | 2320 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); |
4617 | 2321 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2322 | |
2323 return 0; | |
3630 | 2324 } |
2325 | |
3952 | 2326 /* |
4657 | 2327 * We are sending a file to someone else. They have just acknowledged our |
4617 | 2328 * prompt, so we want to start sending data like there's no tomorrow. |
3952 | 2329 */ |
4617 | 2330 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2331 GaimConnection *gc = sess->aux_data; |
7283 | 2332 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2333 GaimXfer *xfer; |
4617 | 2334 va_list ap; |
2335 aim_conn_t *conn; | |
2336 fu8_t *cookie; | |
2337 struct aim_fileheader_t *fh; | |
4656 | 2338 |
8660 | 2339 gaim_debug_info("oscar", "AAA - in oscar_sendfile_ack\n"); |
4617 | 2340 va_start(ap, fr); |
2341 conn = va_arg(ap, aim_conn_t *); | |
2342 cookie = va_arg(ap, fu8_t *); | |
2343 fh = va_arg(ap, struct aim_fileheader_t *); | |
2344 va_end(ap); | |
2345 | |
2346 if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
2347 return 1; | |
2348 | |
4656 | 2349 /* We want to stop listening with a normal thingy */ |
2350 gaim_input_remove(xfer->watcher); | |
2351 xfer->watcher = 0; | |
2352 | |
4617 | 2353 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2354 | |
2355 return 0; | |
3630 | 2356 } |
4617 | 2357 |
2358 /* | |
2359 * We just sent a file to someone. They said they got it and everything, | |
2360 * so we can close our direct connection and what not. | |
2361 */ | |
2362 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 2363 GaimConnection *gc = sess->aux_data; |
7283 | 2364 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2365 GaimXfer *xfer; |
4617 | 2366 va_list ap; |
2367 aim_conn_t *conn; | |
2368 fu8_t *cookie; | |
2369 struct aim_fileheader_t *fh; | |
4656 | 2370 |
8660 | 2371 gaim_debug_info("oscar", "AAA - in oscar_sendfile_done\n"); |
4617 | 2372 va_start(ap, fr); |
2373 conn = va_arg(ap, aim_conn_t *); | |
2374 cookie = va_arg(ap, fu8_t *); | |
2375 fh = va_arg(ap, struct aim_fileheader_t *); | |
2376 va_end(ap); | |
2377 | |
2378 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2379 return 1; | |
2380 | |
4656 | 2381 xfer->fd = conn->fd; |
4617 | 2382 gaim_xfer_end(xfer); |
2383 | |
2384 return 0; | |
2385 } | |
3630 | 2386 |
4244 | 2387 static void accept_direct_im(struct ask_direct *d) { |
5575 | 2388 GaimConnection *gc = d->gc; |
7283 | 2389 OscarData *od; |
2086 | 2390 struct direct_im *dim; |
8240 | 2391 char *host; int port = 5190; |
4366 | 2392 int i, rc; |
2086 | 2393 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2394 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2395 cancel_direct_im(d); |
2396 return; | |
2397 } | |
2398 | |
7283 | 2399 od = (OscarData *)gc->proto_data; |
8660 | 2400 gaim_debug_info("oscar", "Accepted DirectIM.\n"); |
2086 | 2401 |
2402 dim = find_direct_im(od, d->sn); | |
2403 if (dim) { | |
3730 | 2404 cancel_direct_im(d); /* 40 */ |
4244 | 2405 return; |
2086 | 2406 } |
2407 dim = g_new0(struct direct_im, 1); | |
2408 dim->gc = d->gc; | |
2409 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
2410 | |
4617 | 2411 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
|
2412 if (!dim->conn) { |
2086 | 2413 g_free(dim); |
3730 | 2414 cancel_direct_im(d); |
4244 | 2415 return; |
2086 | 2416 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2417 |
2086 | 2418 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
4617 | 2419 gaim_odc_incoming, 0); |
2086 | 2420 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, |
4617 | 2421 gaim_odc_typing, 0); |
3033 | 2422 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
6982 | 2423 gaim_odc_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2424 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2425 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2426 port = atoi(&(d->ip[i+1])); |
2086 | 2427 break; |
2428 } | |
2429 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2430 host = g_strndup(d->ip, i); |
2086 | 2431 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2432 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
2086 | 2433 g_free(host); |
4366 | 2434 if (rc < 0) { |
2086 | 2435 aim_conn_kill(od->sess, &dim->conn); |
2436 g_free(dim); | |
3730 | 2437 cancel_direct_im(d); |
4244 | 2438 return; |
2086 | 2439 } |
2440 | |
3730 | 2441 cancel_direct_im(d); |
2086 | 2442 |
4244 | 2443 return; |
2086 | 2444 } |
2445 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2446 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
5575 | 2447 GaimConnection *gc = sess->aux_data; |
7283 | 2448 OscarData *od = gc->proto_data; |
8708 | 2449 GaimAccount *account = gaim_connection_get_account(gc); |
7475 | 2450 gchar *tmp; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
2451 GaimConvImFlags flags = 0; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
2452 gsize convlen; |
3659 | 2453 GError *err = NULL; |
4738 | 2454 struct buddyinfo *bi; |
5575 | 2455 const char *iconfile; |
4738 | 2456 |
8708 | 2457 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); |
4738 | 2458 if (!bi) { |
2459 bi = g_new0(struct buddyinfo, 1); | |
8708 | 2460 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, userinfo->sn)), bi); |
4738 | 2461 } |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2462 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2463 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
2464 flags |= GAIM_CONV_IM_AUTO_RESP; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2465 |
4738 | 2466 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
2467 bi->typingnot = TRUE; | |
2468 else | |
2469 bi->typingnot = FALSE; | |
2470 | |
4380 | 2471 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { |
8660 | 2472 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2473 "%s has an icon\n", userinfo->sn); |
4738 | 2474 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
2475 bi->ico_need = TRUE; | |
2476 bi->ico_len = args->iconlen; | |
2477 bi->ico_csum = args->iconsum; | |
2478 bi->ico_time = args->iconstamp; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2479 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2480 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2481 |
8708 | 2482 if ((iconfile = gaim_account_get_buddy_icon(account)) && |
7406 | 2483 (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
|
2484 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2485 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2486 |
5575 | 2487 if (!stat(iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2488 char *buf = g_malloc(st.st_size); |
5575 | 2489 file = fopen(iconfile, "rb"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2490 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
2491 int len = fread(buf, 1, st.st_size, file); |
8660 | 2492 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2493 "Sending buddy icon to %s (%d bytes, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2494 "%lu reported)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2495 userinfo->sn, len, st.st_size); |
4617 | 2496 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, |
2497 st.st_mtime, aimutil_iconsum(buf, st.st_size)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2498 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2499 } else |
8660 | 2500 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2501 "Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2502 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2503 } else |
8660 | 2504 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2505 "Can't stat buddy icon file!\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2506 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2507 |
8660 | 2508 gaim_debug_misc("oscar", |
8623 | 2509 "Received message from %s with charset %hu %hu\n", |
2510 userinfo->sn, args->charset, args->charsubset); | |
2511 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2512 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 2513 /* This message is marked as UNICODE, so we have to |
2514 * convert it to utf-8 before handing it to the gaim core. | |
2515 * This conversion should *never* fail, if it does it | |
2516 * means that either the incoming ICBM is corrupted or | |
4662 | 2517 * there is something we don't understand about it. |
2518 * For the record, AIM Unicode is big-endian UCS-2 */ | |
2519 | |
8660 | 2520 gaim_debug_info("oscar", "Received UNICODE IM\n"); |
4121 | 2521 |
2522 if (!args->msg || !args->msglen) | |
2523 return 1; | |
4641 | 2524 |
3659 | 2525 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2526 if (err) { | |
8660 | 2527 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2528 "Unicode IM conversion: %s\n", err->message); |
7475 | 2529 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 2530 g_error_free(err); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2531 } |
3722 | 2532 } else { |
3850 | 2533 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 2534 * unflagged messages, which are ASCII. That's OK because |
2535 * ASCII is a strict subset of ISO-8859-1; this should | |
2536 * help with compatibility with old, broken versions of | |
2537 * gaim (everything before 0.60) and other broken clients | |
2538 * that will happily send ISO-8859-1 without marking it as | |
2539 * such */ | |
4662 | 2540 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
8660 | 2541 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2542 "Received ISO-8859-1 IM\n"); |
4121 | 2543 |
2544 if (!args->msg || !args->msglen) | |
2545 return 1; | |
2546 | |
3659 | 2547 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2548 if (err) { | |
8660 | 2549 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2550 "ISO-8859-1 IM conversion: %s\n", err->message); |
7475 | 2551 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 2552 g_error_free(err); |
3659 | 2553 } |
3642 | 2554 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2555 |
8666 | 2556 /* |
8708 | 2557 * If the message is being sent to an ICQ user then escape any HTML, |
2558 * because HTML should not be sent over ICQ as a means to format a message. | |
8666 | 2559 * SIM is the only client we know of that sends HTML, everything else |
2560 * (ie. official clients) use RTF. Please let us know if this is | |
2561 * incorrect. | |
2562 */ | |
8708 | 2563 if (isdigit(gaim_account_get_username(account)[0])) { |
8666 | 2564 gchar *tmp2 = gaim_escape_html(tmp); |
8493 | 2565 g_free(tmp); |
2566 tmp = tmp2; | |
2567 } | |
2568 | |
6982 | 2569 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2570 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2571 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2572 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2573 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2574 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2575 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
5575 | 2576 GaimConnection *gc = sess->aux_data; |
7283 | 2577 OscarData *od = gc->proto_data; |
5575 | 2578 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
|
2579 |
4121 | 2580 if (!args) |
2581 return 0; | |
4194 | 2582 |
8660 | 2583 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2584 "rendezvous with %s, status is %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2585 userinfo->sn, args->status); |
2869 | 2586 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2587 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 2588 char *name; |
5234 | 2589 GHashTable *components; |
2590 | |
4121 | 2591 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
2592 return 1; | |
5234 | 2593 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
2594 g_free); | |
4121 | 2595 name = extract_name(args->info.chat.roominfo.name); |
5234 | 2596 g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name)); |
2597 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
|
2598 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2599 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2600 userinfo->sn, |
6059 | 2601 args->msg, |
5234 | 2602 components); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2603 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2604 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2605 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
4617 | 2606 /* BBB */ |
2607 if (args->status == AIM_RENDEZVOUS_PROPOSE) { | |
2608 /* Someone wants to send a file (or files) to us */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2609 GaimXfer *xfer; |
5146 | 2610 struct aim_oft_info *oft_info; |
2611 | |
2612 if (!args->cookie || !args->port || !args->verifiedip || | |
2613 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
4656 | 2614 !args->info.sendfile.totfiles || !args->reqclass) { |
8660 | 2615 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2616 "%s tried to send you a file with incomplete " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2617 "information.\n", userinfo->sn); |
5146 | 2618 if (args->proxyip) |
8660 | 2619 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2620 "IP for a proxy server was given. Gaim " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2621 "does not support this yet.\n"); |
4617 | 2622 return 1; |
4656 | 2623 } |
4617 | 2624 |
2625 if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { | |
2626 /* last char of the ft req is a star, they are sending us a | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
2627 * directory -- remove the star and trailing slash so we don't save |
4617 | 2628 * directories that look like 'dirname\*' -- arl */ |
2629 char *tmp = strrchr(args->info.sendfile.filename, '\\'); | |
2630 if (tmp && (tmp[1] == '*')) { | |
2631 tmp[0] = '\0'; | |
2632 } | |
8660 | 2633 gaim_debug_warning("oscar", |
8446 | 2634 "We're receiving a whole directory! What fun! " |
2635 "Especially since we don't support that!\n"); | |
4617 | 2636 } |
2637 | |
2638 /* Build the file transfer handle */ | |
2639 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); | |
5163 | 2640 xfer->remote_ip = g_strdup(args->verifiedip); |
5146 | 2641 xfer->remote_port = args->port; |
4617 | 2642 gaim_xfer_set_filename(xfer, args->info.sendfile.filename); |
2643 gaim_xfer_set_size(xfer, args->info.sendfile.totsize); | |
5146 | 2644 |
2645 /* Create the oscar-specific data */ | |
5163 | 2646 oft_info = aim_oft_createinfo(od->sess, args->cookie, userinfo->sn, args->clientip, xfer->remote_port, 0, 0, NULL); |
4898 | 2647 if (args->proxyip) |
5146 | 2648 oft_info->proxyip = g_strdup(args->proxyip); |
4898 | 2649 if (args->verifiedip) |
5146 | 2650 oft_info->verifiedip = g_strdup(args->verifiedip); |
2651 xfer->data = oft_info; | |
4617 | 2652 |
2653 /* Setup our I/O op functions */ | |
8446 | 2654 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init_recv); |
4617 | 2655 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
8446 | 2656 gaim_xfer_set_request_denied_fnc(xfer, oscar_xfer_cancel_recv); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2657 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
8446 | 2658 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack_recv); |
4617 | 2659 |
2660 /* | |
2661 * XXX - Should do something with args->msg, args->encoding, and args->language | |
2662 * probably make it apply to all ch2 messages. | |
3752 | 2663 */ |
4617 | 2664 |
2665 /* Keep track of this transfer for later */ | |
2666 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
2667 | |
2668 /* Now perform the request */ | |
2669 gaim_xfer_request(xfer); | |
2670 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { | |
2671 /* The other user wants to cancel a file transfer */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2672 GaimXfer *xfer; |
8660 | 2673 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2674 "AAA - File transfer canceled by remote user\n"); |
4617 | 2675 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
|
2676 gaim_xfer_cancel_remote(xfer); |
4617 | 2677 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
2678 /* | |
2679 * This gets sent by the receiver of a file | |
2680 * as they connect directly to us. If we don't | |
2681 * get this, then maybe a third party connected | |
2682 * to us, and we shouldn't send them anything. | |
2683 */ | |
2684 } else { | |
8660 | 2685 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2686 "unknown rendezvous status!\n"); |
3630 | 2687 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2688 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
8092 | 2689 } else if (args->reqclass & AIM_CAPS_TALK) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2690 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2691 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2692 userinfo->sn, args->info.icon.icon, |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2693 args->info.icon.length); |
6871 | 2694 } else if (args->reqclass & AIM_CAPS_DIRECTIM) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2695 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2696 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2697 |
4212 | 2698 if (!args->verifiedip) { |
8660 | 2699 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2700 "directim kill blocked (%s)\n", userinfo->sn); |
4650 | 2701 return 1; |
4212 | 2702 } |
2703 | |
8660 | 2704 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2705 "%s received direct im request from %s (%s)\n", |
5575 | 2706 username, userinfo->sn, args->verifiedip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2707 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2708 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2709 d->sn = g_strdup(userinfo->sn); |
8552 | 2710 snprintf(d->ip, sizeof(d->ip), "%s:%d", args->verifiedip, args->port); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2711 memcpy(d->cookie, args->cookie, 8); |
5575 | 2712 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
|
2713 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2714 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2715 _("This requires a direct connection between " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2716 "the two computers and is necessary for IM " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2717 "Images. Because your IP address will be " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2718 "revealed, this may be considered a privacy " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2719 "risk."), 0, d, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2720 _("Connect"), G_CALLBACK(accept_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2721 _("Cancel"), G_CALLBACK(cancel_direct_im)); |
8708 | 2722 } else if (args->reqclass & AIM_CAPS_ICQSERVERRELAY) { |
2723 gaim_debug_error("oscar", "Got an ICQ Server Relay message of type %d\n", args->info.rtfmsg.msgtype); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2724 } else { |
8660 | 2725 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2726 "Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2727 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2728 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2729 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2730 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2731 |
3453 | 2732 /* |
4230 | 2733 * Authorization Functions |
2734 * Most of these are callbacks from dialogs. They're used by both | |
2735 * methods of authorization (SSI and old-school channel 4 ICBM) | |
3453 | 2736 */ |
4269 | 2737 /* When you ask other people for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2738 static void gaim_auth_request(struct name_data *data, char *msg) { |
5575 | 2739 GaimConnection *gc = data->gc; |
4244 | 2740 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2741 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2742 OscarData *od = gc->proto_data; |
6695 | 2743 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); |
2744 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4244 | 2745 if (buddy && group) { |
8660 | 2746 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2747 "ssi: adding buddy %s to group %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2748 buddy->name, group->name); |
4889 | 2749 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
4269 | 2750 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
4889 | 2751 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
4244 | 2752 } |
4230 | 2753 } |
4337 | 2754 } |
2755 | |
2756 static void gaim_auth_request_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2757 gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), |
8697 | 2758 NULL, _("Please authorize me!"), TRUE, FALSE, NULL, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2759 _("OK"), G_CALLBACK(gaim_auth_request), |
5836 | 2760 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2761 data); |
4230 | 2762 } |
2763 | |
2764 static void gaim_auth_dontrequest(struct name_data *data) { | |
5575 | 2765 GaimConnection *gc = data->gc; |
4244 | 2766 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2767 if (g_list_find(gaim_connections_get_all(), gc)) { |
8151 | 2768 /* Remove from local list */ |
2769 GaimBuddy *b = gaim_find_buddy(gaim_connection_get_account(gc), data->name); | |
2770 gaim_blist_remove_buddy(b); | |
4244 | 2771 } |
2772 | |
5836 | 2773 oscar_free_name_data(data); |
4230 | 2774 } |
2775 | |
5575 | 2776 static void gaim_auth_sendrequest(GaimConnection *gc, const char *name) { |
4269 | 2777 struct name_data *data = g_new(struct name_data, 1); |
6695 | 2778 GaimBuddy *buddy; |
4269 | 2779 gchar *dialog_msg, *nombre; |
2780 | |
4687 | 2781 buddy = gaim_find_buddy(gc->account, name); |
2782 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
2783 nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); | |
4269 | 2784 else |
4830 | 2785 nombre = NULL; |
2786 | |
2787 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 | 2788 data->gc = gc; |
2789 data->name = g_strdup(name); | |
2790 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2791 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2792 gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2793 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2794 _("Request Authorization"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2795 G_CALLBACK(gaim_auth_request_msgprompt), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2796 _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); |
4269 | 2797 |
2798 g_free(dialog_msg); | |
2799 g_free(nombre); | |
2800 } | |
2801 | |
4230 | 2802 /* When other people ask you for authorization */ |
2803 static void gaim_auth_grant(struct name_data *data) { | |
5575 | 2804 GaimConnection *gc = data->gc; |
4244 | 2805 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2806 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2807 OscarData *od = gc->proto_data; |
4236 | 2808 #ifdef NOSSI |
6695 | 2809 GaimBuddy *buddy; |
4244 | 2810 gchar message; |
2811 message = 0; | |
4687 | 2812 buddy = gaim_find_buddy(gc->account, data->name); |
4617 | 2813 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
|
2814 gaim_account_notify_added(gc->account, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 2815 #else |
4889 | 2816 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
4230 | 2817 #endif |
4244 | 2818 } |
2819 | |
5836 | 2820 oscar_free_name_data(data); |
3141 | 2821 } |
2822 | |
4230 | 2823 /* When other people ask you for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2824 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
5575 | 2825 GaimConnection *gc = data->gc; |
4244 | 2826 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2827 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2828 OscarData *od = gc->proto_data; |
4230 | 2829 #ifdef NOSSI |
4617 | 2830 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
4230 | 2831 #else |
4889 | 2832 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
4230 | 2833 #endif |
4244 | 2834 } |
4337 | 2835 } |
2836 | |
2837 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2838 gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
8697 | 2839 NULL, _("No reason given."), TRUE, FALSE, NULL, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2840 _("OK"), G_CALLBACK(gaim_auth_dontgrant), |
5836 | 2841 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2842 data); |
3141 | 2843 } |
2844 | |
7023 | 2845 /* When someone sends you buddies */ |
2846 static void gaim_icq_buddyadd(struct name_data *data) { | |
5575 | 2847 GaimConnection *gc = data->gc; |
4244 | 2848 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2849 if (g_list_find(gaim_connections_get_all(), gc)) { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7054
diff
changeset
|
2850 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick); |
4244 | 2851 } |
2852 | |
5836 | 2853 oscar_free_name_data(data); |
3453 | 2854 } |
2855 | |
4075 | 2856 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 | 2857 GaimConnection *gc = sess->aux_data; |
4076 | 2858 gchar **msg1, **msg2; |
2859 GError *err = NULL; | |
6051 | 2860 int i, numtoks; |
4076 | 2861 |
4121 | 2862 if (!args->type || !args->msg || !args->uin) |
2863 return 1; | |
4194 | 2864 |
8660 | 2865 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2866 "Received a channel 4 message of type 0x%02hhx.\n", args->type); |
4076 | 2867 |
2868 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 2869 msg1 = g_strsplit(args->msg, "\376", 0); |
6051 | 2870 for (numtoks=0; msg1[numtoks]; numtoks++); |
2871 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); | |
4076 | 2872 for (i=0; msg1[i]; i++) { |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7475
diff
changeset
|
2873 gaim_str_strip_cr(msg1[i]); |
4076 | 2874 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); |
4800 | 2875 if (err) { |
8660 | 2876 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2877 "Error converting a string from ISO-8859-1 to " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2878 "UTF-8 in oscar ICBM channel 4 parsing\n"); |
4800 | 2879 g_error_free(err); |
2880 } | |
4076 | 2881 } |
2882 msg2[i] = NULL; | |
2883 | |
3952 | 2884 switch (args->type) { |
4173 | 2885 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 2886 if (i >= 1) { |
5556 | 2887 gchar *uin = g_strdup_printf("%u", args->uin); |
8493 | 2888 gchar *tmp; |
2889 | |
2890 /* If the message came from an ICQ user then escape any HTML */ | |
8501 | 2891 tmp = gaim_escape_html(msg2[0]); |
8493 | 2892 |
4076 | 2893 if (t) { /* This is an offline message */ |
2894 /* I think this timestamp is in UTC, or something */ | |
8514 | 2895 serv_got_im(gc, uin, tmp, 0, t); |
4076 | 2896 } else { /* This is a message from MacICQ/Miranda */ |
8514 | 2897 serv_got_im(gc, uin, tmp, 0, time(NULL)); |
4076 | 2898 } |
2899 g_free(uin); | |
8493 | 2900 g_free(tmp); |
4075 | 2901 } |
3316 | 2902 } break; |
2903 | |
4173 | 2904 case 0x04: { /* Someone sent you a URL */ |
4076 | 2905 if (i >= 2) { |
7385 | 2906 if (msg2[1] != NULL) { |
2907 gchar *uin = g_strdup_printf("%u", args->uin); | |
2908 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", | |
2909 msg2[1], | |
2910 (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]); | |
2911 serv_got_im(gc, uin, message, 0, time(NULL)); | |
2912 g_free(uin); | |
2913 g_free(message); | |
2914 } | |
3453 | 2915 } |
2916 } break; | |
2917 | |
4173 | 2918 case 0x06: { /* Someone requested authorization */ |
4076 | 2919 if (i >= 6) { |
4230 | 2920 struct name_data *data = g_new(struct name_data, 1); |
5556 | 2921 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.")); |
8660 | 2922 gaim_debug_info("oscar", |
5556 | 2923 "Received an authorization request from UIN %u\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2924 args->uin); |
4076 | 2925 data->gc = gc; |
5556 | 2926 data->name = g_strdup_printf("%u", args->uin); |
4230 | 2927 data->nick = NULL; |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2928 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2929 gaim_request_action(gc, NULL, _("Authorization Request"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2930 dialog_msg, 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2931 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2932 G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2933 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2934 G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4076 | 2935 g_free(dialog_msg); |
2936 } | |
3141 | 2937 } break; |
2938 | |
4173 | 2939 case 0x07: { /* Someone has denied you authorization */ |
4076 | 2940 if (i >= 1) { |
7023 | 2941 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
|
2942 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2943 dialog_msg); |
4076 | 2944 g_free(dialog_msg); |
2945 } | |
3141 | 2946 } break; |
2947 | |
4173 | 2948 case 0x08: { /* Someone has granted you authorization */ |
7023 | 2949 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
|
2950 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2951 dialog_msg); |
3141 | 2952 g_free(dialog_msg); |
2953 } break; | |
2954 | |
4333 | 2955 case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
2956 if (i >= 5) { | |
2957 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
|
2958 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); |
4333 | 2959 g_free(dialog_msg); |
2960 } | |
2961 } break; | |
2962 | |
4173 | 2963 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 2964 if (i >= 6) { |
4194 | 2965 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
|
2966 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); |
4076 | 2967 g_free(dialog_msg); |
2968 } | |
4075 | 2969 } break; |
2970 | |
4173 | 2971 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 2972 if (i >= 6) { |
4308 | 2973 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
|
2974 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg); |
4076 | 2975 g_free(dialog_msg); |
2976 } | |
4075 | 2977 } break; |
2978 | |
4173 | 2979 case 0x12: { |
3141 | 2980 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
7023 | 2981 /* Someone added you to their buddy list? */ |
3141 | 2982 } break; |
2983 | |
7023 | 2984 case 0x13: { /* Someone has sent you some ICQ buddies */ |
7631 | 2985 guint i, num; |
3453 | 2986 gchar **text; |
4173 | 2987 text = g_strsplit(args->msg, "\376", 0); |
3453 | 2988 if (text) { |
2989 num = 0; | |
2990 for (i=0; i<strlen(text[0]); i++) | |
2991 num = num*10 + text[0][i]-48; | |
2992 for (i=0; i<num; i++) { | |
4230 | 2993 struct name_data *data = g_new(struct name_data, 1); |
7023 | 2994 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 | 2995 data->gc = gc; |
4790 | 2996 data->name = g_strdup(text[i*2+1]); |
2997 data->nick = g_strdup(text[i*2+2]); | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2998 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2999 gaim_request_action(gc, NULL, message, |
7023 | 3000 _("Do you want to add this buddy " |
3001 "to your buddy list?"), | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3002 0, data, 2, |
7023 | 3003 _("Add"), G_CALLBACK(gaim_icq_buddyadd), |
5836 | 3004 _("Decline"), G_CALLBACK(oscar_free_name_data)); |
3453 | 3005 g_free(message); |
3006 } | |
3007 g_strfreev(text); | |
3008 } | |
3009 } break; | |
3010 | |
7023 | 3011 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */ |
3453 | 3012 /* This is boring and silly. */ |
3013 } break; | |
3014 | |
3141 | 3015 default: { |
8660 | 3016 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3017 "Received a channel 4 message of unknown type " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3018 "(type 0x%02hhx).\n", args->type); |
3141 | 3019 } break; |
3020 } | |
3021 | |
4076 | 3022 g_strfreev(msg1); |
3023 g_strfreev(msg2); | |
3024 | |
3141 | 3025 return 1; |
3026 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3027 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3028 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 3029 fu16_t channel; |
3030 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3031 aim_userinfo_t *userinfo; |
2086 | 3032 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3033 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3034 va_start(ap, fr); |
4200 | 3035 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3036 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3037 |
3141 | 3038 switch (channel) { |
3039 case 1: { /* standard message */ | |
3040 struct aim_incomingim_ch1_args *args; | |
3041 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
3042 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
3043 } break; | |
3044 | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
3045 case 2: { /* rendezvous */ |
3141 | 3046 struct aim_incomingim_ch2_args *args; |
3047 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
3048 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
3049 } break; | |
3050 | |
3051 case 4: { /* ICQ */ | |
3052 struct aim_incomingim_ch4_args *args; | |
3053 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 3054 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 3055 } break; |
3056 | |
3057 default: { | |
8660 | 3058 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3059 "ICBM received on unsupported channel (channel " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3060 "0x%04hx).", channel); |
3141 | 3061 } break; |
2086 | 3062 } |
3063 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3064 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3065 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3066 return ret; |
2086 | 3067 } |
3068 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3069 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
8733 | 3070 GaimConnection *gc = sess->aux_data; |
3071 GaimAccount *account = gaim_connection_get_account(gc); | |
3072 GaimConversation *conv; | |
5420 | 3073 char *buf; |
2086 | 3074 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3075 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3076 aim_userinfo_t *userinfo; |
2086 | 3077 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3078 va_start(ap, fr); |
4200 | 3079 chan = (fu16_t)va_arg(ap, unsigned int); |
3080 userinfo = va_arg(ap, aim_userinfo_t *); | |
3081 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
3082 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 3083 va_end(ap); |
3084 | |
3085 switch(reason) { | |
5420 | 3086 case 0: /* Invalid (0) */ |
3087 buf = g_strdup_printf( | |
3088 ngettext( | |
4276 | 3089 "You missed %hu message from %s because it was invalid.", |
3090 "You missed %hu messages from %s because they were invalid.", | |
3091 nummissed), | |
4282 | 3092 nummissed, |
3093 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3094 break; |
5420 | 3095 case 1: /* Message too large */ |
3096 buf = g_strdup_printf( | |
3097 ngettext( | |
4276 | 3098 "You missed %hu message from %s because it was too large.", |
3099 "You missed %hu messages from %s because they were too large.", | |
3100 nummissed), | |
4282 | 3101 nummissed, |
3102 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3103 break; |
5420 | 3104 case 2: /* Rate exceeded */ |
3105 buf = g_strdup_printf( | |
3106 ngettext( | |
4276 | 3107 "You missed %hu message from %s because the rate limit has been exceeded.", |
3108 "You missed %hu messages from %s because the rate limit has been exceeded.", | |
3109 nummissed), | |
4282 | 3110 nummissed, |
3111 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3112 break; |
5420 | 3113 case 3: /* Evil Sender */ |
3114 buf = g_strdup_printf( | |
3115 ngettext( | |
4276 | 3116 "You missed %hu message from %s because he/she was too evil.", |
3117 "You missed %hu messages from %s because he/she was too evil.", | |
3118 nummissed), | |
4282 | 3119 nummissed, |
3120 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3121 break; |
5420 | 3122 case 4: /* Evil Receiver */ |
3123 buf = g_strdup_printf( | |
3124 ngettext( | |
4276 | 3125 "You missed %hu message from %s because you are too evil.", |
3126 "You missed %hu messages from %s because you are too evil.", | |
3127 nummissed), | |
4282 | 3128 nummissed, |
3129 userinfo->sn); | |
2086 | 3130 break; |
3131 default: | |
5420 | 3132 buf = g_strdup_printf( |
3133 ngettext( | |
4276 | 3134 "You missed %hu message from %s for an unknown reason.", |
3135 "You missed %hu messages from %s for an unknown reason.", | |
3136 nummissed), | |
4282 | 3137 nummissed, |
3138 userinfo->sn); | |
2086 | 3139 break; |
3140 } | |
8733 | 3141 |
3142 conv = gaim_find_conversation_with_account(userinfo->sn, account); | |
3143 if (conv != NULL) | |
3144 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_ERROR, time(NULL)); | |
3145 else | |
3146 gaim_notify_error(sess->aux_data, NULL, buf, NULL); | |
5420 | 3147 g_free(buf); |
2086 | 3148 |
3149 return 1; | |
3150 } | |
3151 | |
4194 | 3152 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
5575 | 3153 GaimConnection *gc = sess->aux_data; |
7283 | 3154 OscarData *od = gc->proto_data; |
4617 | 3155 |
3156 /* BBB */ | |
3630 | 3157 switch (reason) { |
4151 | 3158 case 3: { /* Decline sendfile. */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
3159 GaimXfer *xfer; |
8660 | 3160 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3161 "AAA - Other user declined file transfer\n"); |
4617 | 3162 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
|
3163 gaim_xfer_cancel_remote(xfer); |
4151 | 3164 } break; |
3165 | |
3166 default: { | |
8660 | 3167 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3168 "Received an unknown rendezvous client auto-response " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3169 "from %s. Type 0x%04hx\n", who, reason); |
4151 | 3170 } |
3630 | 3171 |
3172 } | |
3173 | |
3174 return 0; | |
3175 } | |
3176 | |
4194 | 3177 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
5575 | 3178 GaimConnection *gc = sess->aux_data; |
4151 | 3179 |
3180 switch(reason) { | |
3181 case 0x0003: { /* Reply from an ICQ status message request */ | |
8701 | 3182 char *status_msg = oscar_icqstatus(state); |
4151 | 3183 char *dialog_msg, **splitmsg; |
3184 | |
3185 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
3186 splitmsg = g_strsplit(msg, "\r\n", 0); | |
3187 | |
7011 | 3188 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); |
7032 | 3189 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, dialog_msg, NULL, NULL); |
4151 | 3190 |
3191 g_free(status_msg); | |
3192 g_free(dialog_msg); | |
3193 g_strfreev(splitmsg); | |
3194 } break; | |
3195 | |
3196 default: { | |
8660 | 3197 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3198 "Received an unknown client auto-response from %s. " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3199 "Type 0x%04hx\n", who, reason); |
4151 | 3200 } break; |
3201 } /* end of switch */ | |
3202 | |
3203 return 0; | |
3204 } | |
3205 | |
3212 | 3206 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
3207 va_list ap; | |
3208 fu16_t chan, reason; | |
3209 char *who; | |
3210 | |
3211 va_start(ap, fr); | |
4200 | 3212 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 3213 who = va_arg(ap, char *); |
4200 | 3214 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 3215 |
3952 | 3216 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 3217 char *cookie = va_arg(ap, char *); |
4151 | 3218 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 3219 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 3220 fu32_t state = 0; |
4151 | 3221 char *msg = NULL; |
3222 if (reason == 0x0003) { | |
4200 | 3223 state = va_arg(ap, fu32_t); |
4151 | 3224 msg = va_arg(ap, char *); |
3225 } | |
3226 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
3227 } | |
3952 | 3228 |
3212 | 3229 va_end(ap); |
3230 | |
3231 return 1; | |
3232 } | |
3233 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3234 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3235 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3236 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
3237 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3238 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3239 va_start(ap, fr); |
4199 | 3240 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3241 va_end(ap); |
3242 | |
8660 | 3243 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3244 "snac threw error (reason 0x%04hx: %s)\n", reason, |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3245 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2086 | 3246 |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
3247 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
5411 | 3248 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3249 gaim_notify_error(sess->aux_data, NULL, m, NULL); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
3250 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
3251 |
2086 | 3252 return 1; |
3253 } | |
3254 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3255 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4617 | 3256 #if 0 |
5575 | 3257 GaimConnection *gc = sess->aux_data; |
7283 | 3258 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
3259 GaimXfer *xfer; |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3260 #endif |
4617 | 3261 va_list ap; |
3262 fu16_t reason; | |
3263 char *data, *buf; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3264 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3265 va_start(ap, fr); |
4617 | 3266 reason = (fu16_t)va_arg(ap, unsigned int); |
3752 | 3267 data = va_arg(ap, char *); |
2086 | 3268 va_end(ap); |
3269 | |
8660 | 3270 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3271 "Message error with data %s and reason %hu\n", data, reason); |
4617 | 3272 |
3273 /* BBB */ | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3274 #if 0 |
4617 | 3275 /* If this was a file transfer request, data is a cookie */ |
3276 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
|
3277 gaim_xfer_cancel_remote(xfer); |
3630 | 3278 return 1; |
3279 } | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3280 #endif |
3630 | 3281 |
4617 | 3282 /* Data is assumed to be the destination sn */ |
3283 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
|
3284 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3285 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
4617 | 3286 g_free(buf); |
2086 | 3287 |
3288 return 1; | |
3289 } | |
3290 | |
3595 | 3291 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3292 GaimConnection *gc = sess->aux_data; |
3595 | 3293 va_list ap; |
3294 fu16_t type1, type2; | |
3295 char *sn; | |
3296 | |
3297 va_start(ap, fr); | |
4199 | 3298 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3299 sn = va_arg(ap, char *); |
4199 | 3300 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3301 va_end(ap); |
3302 | |
3303 switch (type2) { | |
3304 case 0x0000: { /* Text has been cleared */ | |
3305 serv_got_typing_stopped(gc, sn); | |
3306 } break; | |
3307 | |
3308 case 0x0001: { /* Paused typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3309 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
3595 | 3310 } break; |
3311 | |
3312 case 0x0002: { /* Typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3313 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
3595 | 3314 } break; |
3315 | |
3316 default: { | |
8660 | 3317 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 | 3318 } break; |
3319 } | |
3320 | |
3321 return 1; | |
3322 } | |
3323 | |
7141 | 3324 /* |
3325 * We get this error when there was an error in the locate family. This | |
7259 | 3326 * happens when you request info of someone who is offline. |
7141 | 3327 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3328 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
7259 | 3329 gchar *buf; |
2086 | 3330 va_list ap; |
5420 | 3331 fu16_t reason; |
2086 | 3332 char *destn; |
3333 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3334 va_start(ap, fr); |
4199 | 3335 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3336 destn = va_arg(ap, char *); |
3337 va_end(ap); | |
3338 | |
7781 | 3339 if (destn == NULL) |
7793 | 3340 return 1; |
3341 | |
3342 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); | |
7781 | 3343 |
3344 gaim_notify_error(sess->aux_data, NULL, buf, | |
3345 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); | |
3346 g_free(buf); | |
2086 | 3347 |
3348 return 1; | |
3349 } | |
3350 | |
7011 | 3351 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3352 GaimConnection *gc = sess->aux_data; |
8700 | 3353 GaimAccount *account = gaim_connection_get_account(gc); |
3354 GString *str; | |
3355 gchar *tmp = NULL, *info_utf8 = NULL, *away_utf8 = NULL; | |
4791 | 3356 va_list ap; |
7011 | 3357 aim_userinfo_t *userinfo; |
2086 | 3358 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3359 va_start(ap, fr); |
7011 | 3360 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3361 va_end(ap); |
3362 | |
8700 | 3363 str = g_string_new(""); |
3364 g_string_append_printf(str, "<b>%s:</b> %s", _("Screen Name"), userinfo->sn); | |
3365 g_string_append_printf(str, "\n<br><b>%s</b>: %d%%", _("Warning Level"), (int)((userinfo->warnlevel/10.0) + 0.5)); | |
7011 | 3366 |
3367 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
8701 | 3368 oscar_string_append(str, "\n<br>", _("Online Since"), |
8700 | 3369 asctime(localtime((time_t *)&userinfo->onlinesince))); |
7011 | 3370 |
3371 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
8701 | 3372 oscar_string_append(str, "\n<br>", _("Member Since"), |
8700 | 3373 asctime(localtime((time_t *)&userinfo->membersince))); |
7011 | 3374 |
3375 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) { | |
8700 | 3376 tmp = gaim_str_seconds_to_string(userinfo->idletime*60); |
8701 | 3377 oscar_string_append(str, "\n<br>", _("Idle"), tmp); |
8700 | 3378 g_free(tmp); |
3379 } | |
3380 | |
8701 | 3381 oscar_string_append_info(gc, str, "\n<br>", NULL, userinfo); |
7011 | 3382 |
3383 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
8700 | 3384 tmp = oscar_encoding_extract(userinfo->away_encoding); |
3385 away_utf8 = oscar_encoding_to_utf8(tmp, userinfo->away, userinfo->away_len); | |
3386 g_free(tmp); | |
7011 | 3387 if (away_utf8 != NULL) { |
8700 | 3388 g_string_append_printf(str, "\n<hr>%s", away_utf8); |
7011 | 3389 g_free(away_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3390 } |
7011 | 3391 } |
3392 | |
3393 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { | |
8700 | 3394 tmp = oscar_encoding_extract(userinfo->info_encoding); |
3395 info_utf8 = oscar_encoding_to_utf8(tmp, userinfo->info, userinfo->info_len); | |
3396 g_free(tmp); | |
7011 | 3397 if (info_utf8 != NULL) { |
8700 | 3398 g_string_append_printf(str, "\n<hr>%s", info_utf8); |
7011 | 3399 g_free(info_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3400 } |
7011 | 3401 } |
3402 | |
8701 | 3403 tmp = gaim_str_sub_away_formatters(str->str, gaim_account_get_username(account)); |
8700 | 3404 g_string_free(str, TRUE); |
3405 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, tmp, NULL, NULL); | |
3406 g_free(tmp); | |
4151 | 3407 |
2086 | 3408 return 1; |
3409 } | |
3410 | |
8341 | 3411 static gboolean gaim_reqinfo_timeout_cb(void *data) |
3412 { | |
3413 aim_session_t *sess = data; | |
3414 GaimConnection *gc = sess->aux_data; | |
3415 OscarData *od = (OscarData *)gc->proto_data; | |
3416 | |
3417 aim_locate_dorequest(data); | |
3418 od->getinfotimer = 0; | |
3419 | |
3420 return FALSE; | |
3421 } | |
3422 | |
3423 static int gaim_reqinfo_timeout(aim_session_t *sess, aim_frame_t *fr, ...) | |
3424 { | |
3425 GaimConnection *gc = sess->aux_data; | |
3426 OscarData *od = (OscarData *)gc->proto_data; | |
3427 | |
3428 /* | |
3429 * Wait a little while then call aim_locate_dorequest(sess). This keeps | |
3430 * us from hitting the rate limit due to request away messages and info | |
3431 * too quickly. | |
3432 */ | |
3433 if (od->getinfotimer == 0) | |
3434 od->getinfotimer = gaim_timeout_add(1200, gaim_reqinfo_timeout_cb, sess); | |
3435 | |
3436 return 1; | |
3437 } | |
3438 | |
3439 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) | |
3440 { | |
2086 | 3441 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3442 fu16_t id; |
2086 | 3443 va_list ap; |
3444 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3445 va_start(ap, fr); |
4199 | 3446 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3447 msg = va_arg(ap, char *); |
3448 va_end(ap); | |
3449 | |
8660 | 3450 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3451 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
3452 if (id < 4) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3453 gaim_notify_warning(sess->aux_data, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3454 _("Your AIM connection may be lost."), NULL); |
2086 | 3455 |
3456 return 1; | |
3457 } | |
3458 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3459 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3460 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3461 fu16_t type; |
5575 | 3462 GaimConnection *gc = sess->aux_data; |
7283 | 3463 OscarData *od = (OscarData *)gc->proto_data; |
2086 | 3464 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3465 va_start(ap, fr); |
4199 | 3466 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3467 |
3468 switch(type) { | |
3469 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3470 fu8_t maxrooms; |
2086 | 3471 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3472 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3473 |
4199 | 3474 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 3475 exchangecount = va_arg(ap, int); |
3476 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
3477 | |
8660 | 3478 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3479 "chat info: Chat Rights:\n"); |
8660 | 3480 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3481 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
8660 | 3482 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3483 "chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3484 for (i = 0; i < exchangecount; i++) |
8660 | 3485 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3486 "chat info: \t\t%hu %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3487 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
4617 | 3488 while (od->create_rooms) { |
3489 struct create_room *cr = od->create_rooms->data; | |
8660 | 3490 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3491 "creating room %s\n", cr->name); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3492 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3493 g_free(cr->name); |
4617 | 3494 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3495 g_free(cr); |
2086 | 3496 } |
3497 } | |
3498 break; | |
3499 case 0x0008: { | |
3500 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3501 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3502 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3503 fu32_t createtime; |
2086 | 3504 |
3505 fqcn = va_arg(ap, char *); | |
4200 | 3506 instance = (fu16_t)va_arg(ap, unsigned int); |
3507 exchange = (fu16_t)va_arg(ap, unsigned int); | |
3508 flags = (fu16_t)va_arg(ap, unsigned int); | |
3509 createtime = va_arg(ap, fu32_t); | |
3510 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3511 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
3512 createperms = (fu8_t)va_arg(ap, unsigned int); | |
3513 unknown = (fu16_t)va_arg(ap, unsigned int); | |
3514 name = va_arg(ap, char *); | |
3515 ck = va_arg(ap, char *); | |
4194 | 3516 |
8660 | 3517 gaim_debug_misc("oscar", |
5556 | 3518 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", |
2086 | 3519 fqcn, |
3520 exchange, instance, flags, | |
3521 createtime, | |
3522 maxmsglen, maxoccupancy, createperms, unknown, | |
3523 name, ck); | |
4617 | 3524 aim_chat_join(od->sess, od->conn, exchange, ck, instance); |
2086 | 3525 } |
3526 break; | |
3527 default: | |
8660 | 3528 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3529 "chatnav info: unknown type (%04hx)\n", type); |
2086 | 3530 break; |
3531 } | |
4194 | 3532 |
3533 va_end(ap); | |
3534 | |
2086 | 3535 return 1; |
3536 } | |
3537 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3538 static int gaim_conv_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3539 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3540 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3541 aim_userinfo_t *info; |
5575 | 3542 GaimConnection *g = sess->aux_data; |
2086 | 3543 |
3544 struct chat_connection *c = NULL; | |
3545 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3546 va_start(ap, fr); |
2086 | 3547 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3548 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3549 va_end(ap); |
3550 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3551 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3552 if (!c) |
3553 return 1; | |
3554 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3555 for (i = 0; i < count; i++) |
8733 | 3556 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL); |
2086 | 3557 |
3558 return 1; | |
3559 } | |
3560 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3561 static int gaim_conv_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3562 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3563 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3564 aim_userinfo_t *info; |
5575 | 3565 GaimConnection *g = sess->aux_data; |
2086 | 3566 |
3567 struct chat_connection *c = NULL; | |
3568 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3569 va_start(ap, fr); |
2086 | 3570 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3571 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3572 va_end(ap); |
3573 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3574 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3575 if (!c) |
3576 return 1; | |
3577 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3578 for (i = 0; i < count; i++) |
8733 | 3579 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL); |
2086 | 3580 |
3581 return 1; | |
3582 } | |
3583 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3584 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
|
3585 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3586 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3587 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3588 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3589 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3590 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3591 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3592 fu32_t creationtime; |
5575 | 3593 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3594 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
|
3595 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3596 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3597 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3598 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3599 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3600 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3601 roomdesc = va_arg(ap, char *); |
4200 | 3602 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
3603 creationtime = va_arg(ap, fu32_t); | |
3604 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3605 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
3606 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
3607 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3608 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3609 |
8660 | 3610 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3611 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3612 maxmsglen, maxvisiblemsglen); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3613 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3614 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3615 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3616 |
2086 | 3617 return 1; |
3618 } | |
3619 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3620 static int gaim_conv_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3621 GaimConnection *gc = sess->aux_data; |
8225 | 3622 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
3623 gchar *utf8; | |
2086 | 3624 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3625 aim_userinfo_t *info; |
8225 | 3626 int len; |
2086 | 3627 char *msg; |
8219 | 3628 char *charset; |
2086 | 3629 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3630 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3631 info = va_arg(ap, aim_userinfo_t *); |
8219 | 3632 len = va_arg(ap, int); |
4194 | 3633 msg = va_arg(ap, char *); |
8219 | 3634 charset = va_arg(ap, char *); |
4194 | 3635 va_end(ap); |
2086 | 3636 |
8225 | 3637 utf8 = oscar_encoding_to_utf8(charset, msg, len); |
8667 | 3638 if (utf8 == NULL) |
3639 /* The conversion failed! */ | |
8668 | 3640 utf8 = g_strdup(_("[Unable to display a message from this user because it contained invalid characters.]")); |
8225 | 3641 serv_got_chat_in(gc, ccon->id, info->sn, 0, utf8, time((time_t)NULL)); |
3642 g_free(utf8); | |
2086 | 3643 |
3644 return 1; | |
3645 } | |
3646 | |
3694 | 3647 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
3648 va_list ap; | |
5575 | 3649 GaimConnection *gc = sess->aux_data; |
3694 | 3650 struct aim_emailinfo *emailinfo; |
3725 | 3651 int havenewmail; |
7297 | 3652 char *alertitle, *alerturl; |
3694 | 3653 |
3654 va_start(ap, fr); | |
3655 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 3656 havenewmail = va_arg(ap, int); |
7301 | 3657 alertitle = va_arg(ap, char *); |
3658 alerturl = va_arg(ap, char *); | |
3694 | 3659 va_end(ap); |
3660 | |
5628 | 3661 if (emailinfo && gaim_account_get_check_mail(gc->account)) { |
5575 | 3662 gchar *to = g_strdup_printf("%s@%s", gaim_account_get_username(gaim_connection_get_account(gc)), emailinfo->domain); |
5542 | 3663 if (emailinfo->unread && havenewmail) |
3664 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); | |
5537 | 3665 g_free(to); |
3694 | 3666 } |
7297 | 3667 |
7301 | 3668 if (alertitle) |
8660 | 3669 gaim_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); |
3694 | 3670 |
3671 return 1; | |
3672 } | |
3673 | |
4804 | 3674 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3675 GaimConnection *gc = sess->aux_data; |
7283 | 3676 OscarData *od = gc->proto_data; |
4804 | 3677 char *sn; |
3678 | |
3679 sn = od->requesticon->data; | |
8660 | 3680 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3681 "removing %s from hash table\n", sn); |
4804 | 3682 od->requesticon = g_slist_remove(od->requesticon, sn); |
3683 free(sn); | |
3684 | |
3685 if (od->icontimer) | |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
3686 gaim_timeout_remove(od->icontimer); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
3687 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); |
4804 | 3688 |
3689 return 1; | |
3690 } | |
3691 | |
3692 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 3693 GaimConnection *gc = sess->aux_data; |
7283 | 3694 OscarData *od = gc->proto_data; |
4804 | 3695 GSList *cur; |
3696 va_list ap; | |
3697 char *sn; | |
4853 | 3698 fu8_t *iconcsum, *icon; |
3699 fu16_t iconcsumlen, iconlen; | |
4804 | 3700 |
3701 va_start(ap, fr); | |
3702 sn = va_arg(ap, char *); | |
4853 | 3703 iconcsum = va_arg(ap, fu8_t *); |
3704 iconcsumlen = va_arg(ap, int); | |
4804 | 3705 icon = va_arg(ap, fu8_t *); |
3706 iconlen = va_arg(ap, int); | |
3707 va_end(ap); | |
3708 | |
4853 | 3709 if (iconlen > 0) { |
3710 char *b16; | |
6695 | 3711 GaimBuddy *b = gaim_find_buddy(gc->account, sn); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3712 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3713 sn, icon, iconlen); |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
3714 b16 = gaim_base16_encode(iconcsum, iconcsumlen); |
5129 | 3715 if (b16) { |
7693 | 3716 gaim_blist_node_set_string((GaimBlistNode*)b, "icon_checksum", b16); |
5129 | 3717 gaim_blist_save(); |
7162 | 3718 g_free(b16); |
5129 | 3719 } |
4853 | 3720 } |
4804 | 3721 |
3722 cur = od->requesticon; | |
3723 while (cur) { | |
3724 char *cursn = cur->data; | |
3725 if (!aim_sncmp(cursn, sn)) { | |
3726 od->requesticon = g_slist_remove(od->requesticon, cursn); | |
3727 free(cursn); | |
3728 cur = od->requesticon; | |
3729 } else | |
3730 cur = cur->next; | |
3731 } | |
3732 | |
3733 if (od->icontimer) | |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
3734 gaim_timeout_remove(od->icontimer); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
3735 od->icontimer = gaim_timeout_add(250, gaim_icon_timerfunc, gc); |
4804 | 3736 |
3737 return 1; | |
3738 } | |
3739 | |
3740 static gboolean gaim_icon_timerfunc(gpointer data) { | |
5575 | 3741 GaimConnection *gc = data; |
7283 | 3742 OscarData *od = gc->proto_data; |
7011 | 3743 aim_userinfo_t *userinfo; |
4804 | 3744 aim_conn_t *conn; |
3745 | |
3746 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | |
5892 | 3747 if (!conn) { |
3748 if (!od->iconconnecting) { | |
3749 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
3750 od->iconconnecting = TRUE; | |
3751 } | |
4804 | 3752 return FALSE; |
3753 } | |
3754 | |
5842 | 3755 if (od->set_icon) { |
6039 | 3756 struct stat st; |
3757 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
3758 if (iconfile == NULL) { | |
8363 | 3759 aim_ssi_delicon(od->sess); |
6039 | 3760 } else if (!stat(iconfile, &st)) { |
3761 char *buf = g_malloc(st.st_size); | |
3762 FILE *file = fopen(iconfile, "rb"); | |
3763 if (file) { | |
3764 fread(buf, 1, st.st_size, file); | |
3765 fclose(file); | |
8660 | 3766 gaim_debug_info("oscar", |
6039 | 3767 "Uploading icon to icon server\n"); |
6879 | 3768 aim_bart_upload(od->sess, buf, st.st_size); |
5842 | 3769 } else |
8660 | 3770 gaim_debug_error("oscar", |
6039 | 3771 "Can't open buddy icon file!\n"); |
3772 g_free(buf); | |
3773 } else { | |
8660 | 3774 gaim_debug_error("oscar", |
6039 | 3775 "Can't stat buddy icon file!\n"); |
5842 | 3776 } |
3777 od->set_icon = FALSE; | |
3778 } | |
3779 | |
3780 if (!od->requesticon) { | |
8660 | 3781 gaim_debug_misc("oscar", |
5842 | 3782 "no more icons to request\n"); |
3783 return FALSE; | |
3784 } | |
3785 | |
7045 | 3786 userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data); |
7011 | 3787 if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) { |
3788 aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen); | |
4804 | 3789 return FALSE; |
3790 } else { | |
3791 char *sn = od->requesticon->data; | |
3792 od->requesticon = g_slist_remove(od->requesticon, sn); | |
3793 free(sn); | |
3794 } | |
3795 | |
3796 return TRUE; | |
3797 } | |
3798 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3799 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3800 * 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
|
3801 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3802 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3803 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3804 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3805 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3806 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3807 va_start(ap, fr); |
4199 | 3808 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3809 sn = va_arg(ap, char *); |
3810 va_end(ap); | |
3811 | |
8660 | 3812 gaim_debug_info("oscar", "Sent message to %s.\n", sn); |
2086 | 3813 |
3814 return 1; | |
3815 } | |
3816 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3817 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
|
3818 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3819 "invalid", |
4194 | 3820 "change", |
3821 "warning", | |
3822 "limit", | |
3823 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3824 }; |
2086 | 3825 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3826 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3827 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3828 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3829 va_start(ap, fr); |
4200 | 3830 code = (fu16_t)va_arg(ap, unsigned int); |
3831 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
3832 windowsize = va_arg(ap, fu32_t); | |
3833 clear = va_arg(ap, fu32_t); | |
3834 alert = va_arg(ap, fu32_t); | |
3835 limit = va_arg(ap, fu32_t); | |
3836 disconnect = va_arg(ap, fu32_t); | |
3837 currentavg = va_arg(ap, fu32_t); | |
3838 maxavg = va_arg(ap, fu32_t); | |
2086 | 3839 va_end(ap); |
3840 | |
8660 | 3841 gaim_debug_misc("oscar", |
5556 | 3842 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " |
3843 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", | |
2086 | 3844 (code < 5) ? codes[code] : codes[0], |
3845 rateclass, | |
3846 currentavg, maxavg, | |
3847 alert, clear, | |
3848 limit, disconnect, | |
3849 windowsize); | |
3850 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3851 /* XXX fix these values */ |
2086 | 3852 if (code == AIM_RATE_CODE_CHANGE) { |
3853 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3854 aim_conn_setlatency(fr->conn, 0); |
2086 | 3855 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3856 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
3857 } else if (code == AIM_RATE_CODE_LIMIT) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3858 gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."), |
6040 | 3859 _("The last action you attempted could not be " |
3860 "performed because you are over the rate limit. " | |
3861 "Please wait 10 seconds and try again.")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3862 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 3863 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3864 aim_conn_setlatency(fr->conn, 0); |
2086 | 3865 } |
3866 | |
3867 return 1; | |
3868 } | |
3869 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3870 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3871 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3872 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3873 aim_userinfo_t *userinfo; |
5575 | 3874 GaimConnection *gc = sess->aux_data; |
2086 | 3875 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3876 va_start(ap, fr); |
4199 | 3877 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3878 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3879 va_end(ap); |
3880 | |
7111 | 3881 serv_got_eviled(gc, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); |
2086 | 3882 |
3883 return 1; | |
3884 } | |
3885 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3886 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
|
3887 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3888 aim_userinfo_t *info; |
5575 | 3889 GaimConnection *gc = sess->aux_data; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3890 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3891 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3892 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3893 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3894 |
5628 | 3895 gc->evil = (info->warnlevel/10.0) + 0.5; |
4841 | 3896 |
7872 | 3897 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
4841 | 3898 gc->login_time_official = info->onlinesince; |
7872 | 3899 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
3900 gc->login_time_official = time(NULL) - info->sessionlen; | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3901 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3902 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3903 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3904 |
4649 | 3905 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3906 GaimConnection *gc = sess->aux_data; |
7283 | 3907 OscarData *od = gc->proto_data; |
4649 | 3908 va_list ap; |
3909 fu16_t code; | |
3910 char *msg; | |
3911 | |
3912 va_start(ap, fr); | |
3913 code = (fu16_t)va_arg(ap, int); | |
3914 msg = va_arg(ap, char *); | |
3915 va_end(ap); | |
3916 | |
8660 | 3917 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3918 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); |
4649 | 3919 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { |
4651 | 3920 if (code == 0x0001) { |
6113 | 3921 gc->wants_to_die = TRUE; |
5579 | 3922 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); |
4651 | 3923 } else { |
5579 | 3924 gaim_connection_error(gc, _("You have been signed off for an unknown reason.")); |
4651 | 3925 } |
4666 | 3926 od->killme = TRUE; |
4649 | 3927 } |
3928 | |
3929 return 1; | |
3930 } | |
3931 | |
2675 | 3932 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
7283 | 3933 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3934 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3935 aim_reqpersonalinfo(sess, fr->conn); |
4230 | 3936 |
3937 #ifndef NOSSI | |
8660 | 3938 gaim_debug_info("oscar", "ssi: requesting rights and list\n"); |
4889 | 3939 aim_ssi_reqrights(sess); |
6350 | 3940 aim_ssi_reqdata(sess); |
4230 | 3941 #endif |
3942 | |
7011 | 3943 aim_locate_reqrights(sess); |
7285 | 3944 aim_buddylist_reqrights(sess, fr->conn); |
4617 | 3945 aim_im_reqparams(sess); |
7334 | 3946 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */ |
4230 | 3947 |
3948 #ifdef NOSSI | |
8660 | 3949 gaim_debug_info("oscar", "bos: requesting rights\n"); |
7334 | 3950 aim_bos_reqrights(sess, fr->conn); |
4230 | 3951 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
3952 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
3953 #endif | |
2086 | 3954 |
7283 | 3955 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); |
3956 | |
2086 | 3957 return 1; |
3958 } | |
3959 | |
2675 | 3960 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3961 GaimConnection *gc = sess->aux_data; |
7283 | 3962 OscarData *od = gc->proto_data; |
2647 | 3963 |
6905 | 3964 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); |
3965 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); | |
3966 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); | |
3967 | |
2672 | 3968 aim_clientready(sess, fr->conn); |
8660 | 3969 gaim_debug_info("oscar", "connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3970 |
2647 | 3971 if (od->chpass) { |
8660 | 3972 gaim_debug_info("oscar", "changing password\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3973 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 3974 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3975 od->oldp = NULL; |
2647 | 3976 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3977 od->newp = NULL; |
2647 | 3978 od->chpass = FALSE; |
3979 } | |
2979 | 3980 if (od->setnick) { |
8660 | 3981 gaim_debug_info("oscar", "formatting screen name\n"); |
2979 | 3982 aim_admin_setnick(sess, fr->conn, od->newsn); |
3983 g_free(od->newsn); | |
3984 od->newsn = NULL; | |
3985 od->setnick = FALSE; | |
3986 } | |
2647 | 3987 if (od->conf) { |
8660 | 3988 gaim_debug_info("oscar", "confirming account\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3989 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 3990 od->conf = FALSE; |
3991 } | |
3992 if (od->reqemail) { | |
8660 | 3993 gaim_debug_info("oscar", "requesting email\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3994 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 3995 od->reqemail = FALSE; |
3996 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3997 if (od->setemail) { |
8660 | 3998 gaim_debug_info("oscar", "setting email\n"); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3999 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4000 g_free(od->email); |
5497 | 4001 od->email = NULL; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4002 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4003 } |
2647 | 4004 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4005 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4006 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4007 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4008 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
|
4009 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4010 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4011 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4012 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4013 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4014 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4015 |
4194 | 4016 /* XXX - evidently this crashes on solaris. i have no clue why |
8660 | 4017 gaim_debug_misc("oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " |
5556 | 4018 "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
|
4019 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4020 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4021 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
4022 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4023 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4024 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 4025 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4026 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4027 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4028 |
4617 | 4029 aim_im_setparams(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4030 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4031 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4032 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4033 |
2993 | 4034 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
4035 { | |
5575 | 4036 GaimConnection *gc = sess->aux_data; |
7283 | 4037 OscarData *od = (OscarData *)gc->proto_data; |
5306 | 4038 va_list ap; |
4039 fu16_t maxsiglen; | |
2993 | 4040 |
4041 va_start(ap, fr); | |
4199 | 4042 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 4043 va_end(ap); |
4044 | |
8660 | 4045 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4046 "locate rights: max sig len = %d\n", maxsiglen); |
2993 | 4047 |
4617 | 4048 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; |
4049 | |
4050 if (od->icq) | |
7334 | 4051 aim_locate_setcaps(od->sess, caps_icq); |
5301 | 4052 else |
7334 | 4053 aim_locate_setcaps(od->sess, caps_aim); |
4054 oscar_set_info(gc, gc->account->user_info); | |
2993 | 4055 |
4056 return 1; | |
4057 } | |
4058 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4059 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
|
4060 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4061 fu16_t maxbuddies, maxwatchers; |
5575 | 4062 GaimConnection *gc = sess->aux_data; |
7283 | 4063 OscarData *od = (OscarData *)gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4064 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4065 va_start(ap, fr); |
4199 | 4066 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
4067 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 4068 va_end(ap); |
4069 | |
8660 | 4070 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4071 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 4072 |
4617 | 4073 od->rights.maxbuddies = (guint)maxbuddies; |
4074 od->rights.maxwatchers = (guint)maxwatchers; | |
2993 | 4075 |
2086 | 4076 return 1; |
4077 } | |
4078 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4079 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4080 GaimConnection *gc = sess->aux_data; |
7283 | 4081 OscarData *od = (OscarData *)gc->proto_data; |
7334 | 4082 va_list ap; |
4083 fu16_t maxpermits, maxdenies; | |
2086 | 4084 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4085 va_start(ap, fr); |
4199 | 4086 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
4087 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 4088 va_end(ap); |
4089 | |
8660 | 4090 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4091 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 4092 |
4617 | 4093 od->rights.maxpermits = (guint)maxpermits; |
4094 od->rights.maxdenies = (guint)maxdenies; | |
2993 | 4095 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
4096 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2993 | 4097 serv_finish_login(gc); |
4098 | |
8660 | 4099 gaim_debug_info("oscar", "buddy list loaded\n"); |
2993 | 4100 |
2672 | 4101 aim_clientready(sess, fr->conn); |
5948 | 4102 aim_srv_setavailmsg(sess, NULL); |
7474 | 4103 aim_srv_setidle(sess, 0); |
4617 | 4104 |
4664 | 4105 if (od->icq) { |
4106 aim_icq_reqofflinemsgs(sess); | |
4107 aim_icq_hideip(sess); | |
4108 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4109 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4110 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 4111 if (sess->authinfo->email) |
4112 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 4113 |
4114 return 1; | |
4115 } | |
4116 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4117 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
|
4118 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4119 struct aim_icq_offlinemsg *msg; |
4075 | 4120 struct aim_incomingim_ch4_args args; |
4121 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4122 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4123 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4124 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4125 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4126 |
8660 | 4127 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4128 "Received offline message. Converting to channel 4 ICBM...\n"); |
4075 | 4129 args.uin = msg->sender; |
4130 args.type = msg->type; | |
4173 | 4131 args.flags = msg->flags; |
4076 | 4132 args.msglen = msg->msglen; |
4075 | 4133 args.msg = msg->msg; |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4134 t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); |
4075 | 4135 incomingim_chan4(sess, fr->conn, NULL, &args, t); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4136 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4137 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4138 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4139 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4140 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
|
4141 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4142 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4143 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4144 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4145 |
7388 | 4146 #if 0 |
4147 /* | |
7465 | 4148 * Update, 2003-11-09: |
4149 * Joseph S. Myers, a gcc dude, fixed this for gcc 3.4! Rock on! | |
4150 * | |
7388 | 4151 * It may not be my place to do this, but... |
4152 * I feel pretty strongly that the "last 2 digits" warning is ridiculously | |
4153 * stupid, and should not exist for % switches (%x in our case) that request | |
4154 * a year in the preferred representation for the current locale. For that | |
4155 * reason I've chosen to not use this workaround (n., see kluge). | |
4156 * | |
4157 * I have a date. I want to show it to the user in the "preferred" way. | |
4158 * Whether that displays a 2 digit year is perfectly fine--after all, it's | |
4159 * what the locale wanted. | |
4160 * | |
4161 * If I have a necessity for a full representation of the year in the current | |
4162 * locale, then I'll use a switch that returns a full representation of the | |
4163 * year. | |
4164 * | |
4165 * If you think the preferred locale should show 4 digits instead of 2 digits | |
4166 * (because you're anal, or whatever), then change the f***ing locale. | |
4167 * | |
4168 * I guess the bottom line is--I'm trying to show a date to the user how they | |
4169 * prefer to see it, why the hell does gcc want me to change that? | |
7389 | 4170 * |
4171 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3190 | |
4172 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8714 | |
7388 | 4173 */ |
4174 | |
4175 /* | |
4176 * This function was recommended by the STRFTIME(3) man page to remove the | |
7386 | 4177 * "last 2 digits" warning. |
4178 */ | |
4179 static size_t my_strftime(char *s, size_t max, const char *fmt, | |
4180 const struct tm *tm) | |
4181 { | |
4182 return strftime(s, max, fmt, tm); | |
4183 } | |
7388 | 4184 #endif |
7386 | 4185 |
4624 | 4186 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
|
4187 { |
5575 | 4188 GaimConnection *gc = sess->aux_data; |
8670 | 4189 OscarData *od = (OscarData *)gc->proto_data; |
4190 GaimBuddy *buddy; | |
8853 | 4191 struct buddyinfo *bi = NULL; |
4624 | 4192 gchar who[16]; |
8670 | 4193 GString *str; |
4194 gchar *primary, *utf8; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4195 va_list ap; |
4151 | 4196 struct aim_icq_info *info; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4197 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4198 va_start(ap, fr); |
4151 | 4199 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4200 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4201 |
4664 | 4202 if (!info->uin) |
4203 return 0; | |
4204 | |
8670 | 4205 str = g_string_sized_new(100); |
5556 | 4206 g_snprintf(who, sizeof(who), "%u", info->uin); |
8670 | 4207 buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); |
4208 if (buddy != NULL) | |
4209 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(buddy->account, buddy->name)); | |
4210 | |
4211 g_string_append_printf(str, "<b>%s:</b> %s", _("UIN"), who); | |
8701 | 4212 oscar_string_append(str, "\n<br>", _("Nick"), info->nick); |
8670 | 4213 if ((bi != NULL) && (bi->ipaddr != 0)) { |
4214 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", | |
4215 (bi->ipaddr & 0xff000000) >> 24, | |
4216 (bi->ipaddr & 0x00ff0000) >> 16, | |
4217 (bi->ipaddr & 0x0000ff00) >> 8, | |
4218 (bi->ipaddr & 0x000000ff)); | |
8701 | 4219 oscar_string_append(str, "\n<br>", _("IP Address"), tstr); |
8670 | 4220 g_free(tstr); |
4221 } | |
8701 | 4222 oscar_string_append(str, "\n<br>", _("First Name"), info->first); |
4223 oscar_string_append(str, "\n<br>", _("Last Name"), info->last); | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4224 if (info->email && info->email[0] && (utf8 = gaim_utf8_try_convert(info->email))) { |
8670 | 4225 g_string_append_printf(str, "\n<br><b>%s:</b> <a href=\"mailto:%s\">%s</a>", _("Email Address"), utf8, utf8); |
4226 g_free(utf8); | |
4625 | 4227 } |
4228 if (info->numaddresses && info->email2) { | |
4229 int i; | |
4230 for (i = 0; i < info->numaddresses; i++) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4231 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_utf8_try_convert(info->email2[i]))) { |
8670 | 4232 g_string_append_printf(str, "\n<br><b>%s:</b> <a href=\"mailto%s\">%s</a>", _("Email Address"), utf8, utf8); |
4233 g_free(utf8); | |
4643 | 4234 } |
4625 | 4235 } |
4624 | 4236 } |
8701 | 4237 oscar_string_append(str, "\n<br>", _("Mobile Phone"), info->mobile); |
8902 | 4238 oscar_string_append(str, "\n<br>", _("Gender"), info->gender == 0 ? _("Not specified") : |
4239 info->gender == 1 ? _("Female") : _("Male")); | |
4624 | 4240 if (info->birthyear || info->birthmonth || info->birthday) { |
4627 | 4241 char date[30]; |
4242 struct tm tm; | |
4243 tm.tm_mday = (int)info->birthday; | |
4244 tm.tm_mon = (int)info->birthmonth-1; | |
4245 tm.tm_year = (int)info->birthyear-1900; | |
7388 | 4246 strftime(date, sizeof(date), "%x", &tm); |
8701 | 4247 oscar_string_append(str, "\n<br>", _("Birthday"), date); |
4151 | 4248 } |
4624 | 4249 if (info->age) { |
4250 char age[5]; | |
4251 snprintf(age, sizeof(age), "%hhd", info->age); | |
8701 | 4252 oscar_string_append(str, "\n<br>", _("Age"), age); |
4819 | 4253 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4254 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_utf8_try_convert(info->personalwebpage))) { |
8670 | 4255 g_string_append_printf(str, "\n<br><b>%s:</b> <a href=\"%s\">%s</a>", _("Personal Web Page"), utf8, utf8); |
4256 g_free(utf8); | |
4819 | 4257 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4258 if (info->info && info->info[0] && (utf8 = gaim_utf8_try_convert(info->info))) { |
8670 | 4259 g_string_append_printf(str, "<hr><b>%s:</b><br>%s", _("Additional Information"), utf8); |
4260 g_free(utf8); | |
4261 } | |
4262 g_string_append_printf(str, "<hr>\n"); | |
4641 | 4263 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
8670 | 4264 g_string_append_printf(str, "<b>%s:</b>", _("Home Address")); |
8701 | 4265 oscar_string_append(str, "\n<br>", _("Address"), info->homeaddr); |
4266 oscar_string_append(str, "\n<br>", _("City"), info->homecity); | |
4267 oscar_string_append(str, "\n<br>", _("State"), info->homestate); | |
4268 oscar_string_append(str, "\n<br>", _("Zip Code"), info->homezip); | |
8670 | 4269 g_string_append_printf(str, "\n<hr>\n"); |
4151 | 4270 } |
4641 | 4271 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
8670 | 4272 g_string_append_printf(str, "<b>%s:</b>", _("Work Address")); |
8701 | 4273 oscar_string_append(str, "\n<br>", _("Address"), info->workaddr); |
4274 oscar_string_append(str, "\n<br>", _("City"), info->workcity); | |
4275 oscar_string_append(str, "\n<br>", _("State"), info->workstate); | |
4276 oscar_string_append(str, "\n<br>", _("Zip Code"), info->workzip); | |
8670 | 4277 g_string_append_printf(str, "\n<hr>\n"); |
4624 | 4278 } |
4641 | 4279 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
8670 | 4280 g_string_append_printf(str, "<b>%s:</b>", _("Work Information")); |
8701 | 4281 oscar_string_append(str, "\n<br>", _("Company"), info->workcompany); |
4282 oscar_string_append(str, "\n<br>", _("Division"), info->workdivision); | |
4283 oscar_string_append(str, "\n<br>", _("Position"), info->workposition); | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4284 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_utf8_try_convert(info->workwebpage))) { |
8670 | 4285 g_string_append_printf(str, "\n<br><b>%s:</b> <a href=\"%s\">%s</a>", _("Web Page"), utf8, utf8); |
4286 g_free(utf8); | |
4624 | 4287 } |
8670 | 4288 g_string_append_printf(str, "\n<hr>\n"); |
4289 } | |
4290 | |
6873 | 4291 primary = g_strdup_printf(_("ICQ Info for %s"), gaim_get_buddy_alias(buddy)); |
8670 | 4292 gaim_notify_formatted(gc, NULL, primary, NULL, str->str, NULL, NULL); |
6873 | 4293 g_free(primary); |
8670 | 4294 g_string_free(str, TRUE); |
4151 | 4295 |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4296 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4297 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4298 |
4759 | 4299 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
4300 { | |
5575 | 4301 GaimConnection *gc = sess->aux_data; |
4820 | 4302 gchar who[16], *utf8; |
6695 | 4303 GaimBuddy *b; |
4759 | 4304 va_list ap; |
4305 struct aim_icq_info *info; | |
4306 | |
4307 va_start(ap, fr); | |
4308 info = va_arg(ap, struct aim_icq_info *); | |
4309 va_end(ap); | |
4310 | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4311 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { |
5556 | 4312 g_snprintf(who, sizeof(who), "%u", info->uin); |
4820 | 4313 serv_got_alias(gc, who, utf8); |
4759 | 4314 if ((b = gaim_find_buddy(gc->account, who))) { |
7693 | 4315 gaim_blist_node_set_string((GaimBlistNode*)b, "servernick", utf8); |
4759 | 4316 gaim_blist_save(); |
4317 } | |
4820 | 4318 g_free(utf8); |
4759 | 4319 } |
4320 | |
4321 return 1; | |
4322 } | |
4323 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4324 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
|
4325 { |
7032 | 4326 GaimConnection *gc = sess->aux_data; |
4327 gchar *text; | |
4328 va_list ap; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4329 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4330 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4331 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4332 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4333 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4334 url = va_arg(ap, char *); |
4199 | 4335 wid = (fu16_t) va_arg(ap, int); |
4336 hei = (fu16_t) va_arg(ap, int); | |
4337 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4338 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4339 |
7032 | 4340 text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url); |
4341 gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); | |
4342 g_free(text); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4343 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4344 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4345 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4346 |
7032 | 4347 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) |
4348 { | |
6873 | 4349 GaimConnection *gc = sess->aux_data; |
4350 gchar *secondary; | |
4351 GString *text; | |
4352 int i, num; | |
2086 | 4353 va_list ap; |
6873 | 4354 char *email, *SNs; |
2086 | 4355 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4356 va_start(ap, fr); |
6873 | 4357 email = va_arg(ap, char *); |
2086 | 4358 num = va_arg(ap, int); |
4359 SNs = va_arg(ap, char *); | |
4360 va_end(ap); | |
4361 | |
8152 | 4362 secondary = g_strdup_printf(_("The following screen names are associated with %s"), email); |
6873 | 4363 text = g_string_new(""); |
2086 | 4364 for (i = 0; i < num; i++) |
6873 | 4365 g_string_append_printf(text, "%s<br>", &SNs[i * (MAXSNLEN + 1)]); |
4366 gaim_notify_formatted(gc, NULL, _("Search Results"), secondary, text->str, NULL, NULL); | |
4367 | |
4368 g_free(secondary); | |
4369 g_string_free(text, TRUE); | |
2086 | 4370 |
4371 return 1; | |
4372 } | |
4373 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4374 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4375 va_list ap; |
6873 | 4376 char *email; |
5420 | 4377 char *buf; |
2086 | 4378 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4379 va_start(ap, fr); |
6873 | 4380 email = va_arg(ap, char *); |
2086 | 4381 va_end(ap); |
4382 | |
6873 | 4383 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
|
4384 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 4385 g_free(buf); |
2086 | 4386 |
4387 return 1; | |
4388 } | |
4389 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4390 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
6873 | 4391 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4392 fu16_t status; |
2086 | 4393 va_list ap; |
4394 char msg[256]; | |
4395 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4396 va_start(ap, fr); |
4199 | 4397 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 4398 va_end(ap); |
4399 | |
8660 | 4400 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4401 "account confirmation returned status 0x%04x (%s)\n", status, |
3912 | 4402 status ? "unknown" : "email sent"); |
4403 if (!status) { | |
5302 | 4404 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
5575 | 4405 gaim_account_get_username(gaim_connection_get_account(gc))); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4406 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
2086 | 4407 } |
4408 | |
4409 return 1; | |
4410 } | |
4411 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4412 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4413 GaimConnection *gc = sess->aux_data; |
2086 | 4414 va_list ap; |
3912 | 4415 fu16_t perms, err; |
4416 char *url, *sn, *email; | |
4417 int change; | |
2086 | 4418 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4419 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4420 change = va_arg(ap, int); |
4199 | 4421 perms = (fu16_t) va_arg(ap, unsigned int); |
4422 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 4423 url = va_arg(ap, char *); |
4424 sn = va_arg(ap, char *); | |
4425 email = va_arg(ap, char *); | |
2086 | 4426 va_end(ap); |
4427 | |
8660 | 4428 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4429 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
3912 | 4430 change ? "change" : "request", perms, err, url, sn, email); |
4431 | |
4432 if (err && url) { | |
4433 char *dialog_msg; | |
4434 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
4435 switch (err) { | |
4436 case 0x0001: { | |
4437 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
4438 } break; | |
4439 case 0x0006: { | |
4440 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
4441 } break; | |
4442 case 0x000b: { | |
4443 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
4444 } break; | |
4445 case 0x001d: { | |
4446 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); | |
4447 } break; | |
4448 case 0x0021: { | |
4449 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); | |
4450 } break; | |
4451 case 0x0023: { | |
4452 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
4453 } break; | |
4454 default: { | |
4455 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
4456 } break; | |
4457 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4458 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); |
3912 | 4459 g_free(dialog_top); |
4460 g_free(dialog_msg); | |
4461 return 1; | |
4462 } | |
4463 | |
4464 if (sn) { | |
4585 | 4465 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
|
4466 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4467 g_free(dialog_msg); |
4468 } | |
4469 | |
4470 if (email) { | |
5575 | 4471 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), |
4472 gaim_account_get_username(gaim_connection_get_account(gc)), email); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4473 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4474 g_free(dialog_msg); |
2086 | 4475 } |
4476 | |
4477 return 1; | |
4478 } | |
4479 | |
5575 | 4480 static void oscar_keepalive(GaimConnection *gc) { |
7283 | 4481 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4482 aim_flap_nop(od->sess, od->conn); |
2086 | 4483 } |
4484 | |
6059 | 4485 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { |
7283 | 4486 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4487 struct direct_im *dim = find_direct_im(od, name); |
3595 | 4488 if (dim) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4489 if (typing == GAIM_TYPING) |
4870 | 4490 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4491 else if (typing == GAIM_TYPED) |
4870 | 4492 aim_odc_send_typing(od->sess, dim->conn, 0x0001); |
4493 else | |
4494 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
3595 | 4495 else { |
5300 | 4496 /* Don't send if this turkey is in our deny list */ |
4497 GSList *list; | |
4498 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); | |
4499 if (!list) { | |
7261 | 4500 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
5300 | 4501 if (bi && bi->typingnot) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4502 if (typing == GAIM_TYPING) |
5300 | 4503 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4504 else if (typing == GAIM_TYPED) |
5300 | 4505 aim_im_sendmtn(od->sess, 0x0001, name, 0x0001); |
4506 else | |
4507 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); | |
4508 } | |
3595 | 4509 } |
4510 } | |
2993 | 4511 return 0; |
4512 } | |
5575 | 4513 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
|
4514 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
|
4515 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4516 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { |
7283 | 4517 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4518 struct direct_im *dim = find_direct_im(od, name); |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4519 int ret = 0; |
3659 | 4520 GError *err = NULL; |
5575 | 4521 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); |
8800 | 4522 char *tmpmsg = NULL, *tmpmsg2 = NULL; |
3458 | 4523 |
4838 | 4524 if (dim && dim->connected) { |
4525 /* If we're directly connected, send a direct IM */ | |
6982 | 4526 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
|
4527 } else if (imflags & GAIM_CONV_IM_IMAGES) { |
3044 | 4528 /* Trying to send an IM image outside of a direct connection. */ |
4529 oscar_ask_direct_im(gc, name); | |
4838 | 4530 ret = -ENOTCONN; |
2086 | 4531 } else { |
4738 | 4532 struct buddyinfo *bi; |
3008 | 4533 struct aim_sendimext_args args; |
4534 struct stat st; | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4535 gsize len; |
4269 | 4536 |
7261 | 4537 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
4738 | 4538 if (!bi) { |
4539 bi = g_new0(struct buddyinfo, 1); | |
7261 | 4540 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi); |
4738 | 4541 } |
4542 | |
3008 | 4543 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
4665 | 4544 if (od->icq) { |
4545 args.features = features_icq; | |
4546 args.featureslen = sizeof(features_icq); | |
3008 | 4547 args.flags |= AIM_IMFLAGS_OFFLINE; |
4665 | 4548 } else { |
4549 args.features = features_aim; | |
4550 args.featureslen = sizeof(features_aim); | |
4972 | 4551 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4552 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
4972 | 4553 args.flags |= AIM_IMFLAGS_AWAY; |
4665 | 4554 } |
4269 | 4555 |
4738 | 4556 if (bi->ico_need) { |
8660 | 4557 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4558 "Sending buddy icon request with message\n"); |
3008 | 4559 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4738 | 4560 bi->ico_need = FALSE; |
3008 | 4561 } |
4269 | 4562 |
5575 | 4563 if (iconfile && !stat(iconfile, &st)) { |
8361 | 4564 FILE *file = fopen(iconfile, "rb"); |
3008 | 4565 if (file) { |
4566 char *buf = g_malloc(st.st_size); | |
4567 fread(buf, 1, st.st_size, file); | |
6039 | 4568 fclose(file); |
4269 | 4569 |
3008 | 4570 args.iconlen = st.st_size; |
4617 | 4571 args.iconsum = aimutil_iconsum(buf, st.st_size); |
3008 | 4572 args.iconstamp = st.st_mtime; |
4573 | |
7406 | 4574 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { |
4738 | 4575 bi->ico_informed = FALSE; |
7406 | 4576 bi->ico_sent = FALSE; |
4577 } | |
4738 | 4578 |
4579 if (!bi->ico_informed) { | |
8660 | 4580 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4581 "Claiming to have a buddy icon\n"); |
4738 | 4582 args.flags |= AIM_IMFLAGS_HASICON; |
4583 bi->ico_me_len = args.iconlen; | |
4584 bi->ico_me_csum = args.iconsum; | |
4585 bi->ico_me_time = args.iconstamp; | |
4586 bi->ico_informed = TRUE; | |
4587 } | |
4588 | |
3008 | 4589 g_free(buf); |
2086 | 4590 } |
4591 } | |
4269 | 4592 |
3008 | 4593 args.destsn = name; |
4269 | 4594 |
6310 | 4595 /* For ICQ send newlines as CR/LF, for AIM send newlines as <BR> */ |
8800 | 4596 /* Also strip HTML for ICQ */ |
4597 if (isdigit(name[0])) { | |
4598 tmpmsg2 = gaim_markup_strip_html(message); | |
4599 tmpmsg = gaim_str_add_cr(tmpmsg2); | |
4600 g_free(tmpmsg2); | |
4601 } else | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4602 tmpmsg = gaim_strdup_withhtml(message); |
6310 | 4603 len = strlen(tmpmsg); |
4604 | |
4605 args.flags |= oscar_encoding_check(tmpmsg); | |
3642 | 4606 if (args.flags & AIM_IMFLAGS_UNICODE) { |
8660 | 4607 gaim_debug_info("oscar", "Sending Unicode IM\n"); |
4662 | 4608 args.charset = 0x0002; |
4665 | 4609 args.charsubset = 0x0000; |
6310 | 4610 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
3659 | 4611 if (err) { |
8660 | 4612 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4613 "Error converting a unicode message: %s\n", err->message); |
8660 | 4614 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4615 "This really shouldn't happen!\n"); |
3659 | 4616 /* We really shouldn't try to send the |
4617 * IM now, but I'm not sure what to do */ | |
4800 | 4618 g_error_free(err); |
3659 | 4619 } |
3850 | 4620 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
8660 | 4621 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4622 "Sending ISO-8859-1 IM\n"); |
4662 | 4623 args.charset = 0x0003; |
4665 | 4624 args.charsubset = 0x0000; |
6310 | 4625 args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
3659 | 4626 if (err) { |
8660 | 4627 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4628 "conversion error: %s\n", err->message); |
8660 | 4629 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4630 "Someone tell Ethan his 8859-1 detection is wrong\n"); |
3642 | 4631 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
6310 | 4632 len = strlen(tmpmsg); |
4800 | 4633 g_error_free(err); |
6310 | 4634 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
3659 | 4635 if (err) { |
8660 | 4636 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4637 "Error in unicode fallback: %s\n", err->message); |
4800 | 4638 g_error_free(err); |
3659 | 4639 } |
3642 | 4640 } |
4641 } else { | |
4662 | 4642 args.charset = 0x0000; |
4643 args.charsubset = 0x0000; | |
6310 | 4644 args.msg = tmpmsg; |
3642 | 4645 } |
4646 args.msglen = len; | |
4269 | 4647 |
4617 | 4648 ret = aim_im_sendch1_ext(od->sess, &args); |
2086 | 4649 } |
4838 | 4650 |
6310 | 4651 g_free(tmpmsg); |
4652 | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4653 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4654 return 1; |
6310 | 4655 |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4656 return ret; |
2086 | 4657 } |
4658 | |
7011 | 4659 static void oscar_get_info(GaimConnection *gc, const char *name) { |
7283 | 4660 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 4661 |
7173 | 4662 if (od->icq && isdigit(name[0])) |
4624 | 4663 aim_icq_getallinfo(od->sess, name); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4664 else |
7235 | 4665 aim_locate_getinfoshort(od->sess, name, 0x00000003); |
7011 | 4666 } |
4667 | |
8950 | 4668 #if 0 |
7011 | 4669 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, |
3466 | 4670 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4617 | 4671 /* XXX - some of these things are wrong, but i'm lazy */ |
7283 | 4672 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 4673 aim_locate_setdirinfo(od->sess, first, middle, last, |
2086 | 4674 maiden, NULL, NULL, city, state, NULL, 0, web); |
4675 } | |
8950 | 4676 #endif |
2086 | 4677 |
5575 | 4678 static void oscar_set_idle(GaimConnection *gc, int time) { |
7283 | 4679 OscarData *od = (OscarData *)gc->proto_data; |
7474 | 4680 aim_srv_setidle(od->sess, time); |
2086 | 4681 } |
4682 | |
5954 | 4683 static void oscar_set_info(GaimConnection *gc, const char *text) { |
7283 | 4684 OscarData *od = (OscarData *)gc->proto_data; |
5129 | 4685 fu32_t flags = 0; |
6019 | 4686 char *text_html = NULL; |
5129 | 4687 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4688 gsize msglen = 0; |
2993 | 4689 |
4617 | 4690 if (od->rights.maxsiglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4691 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4692 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4693 "profile before the login procedure completed. " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4694 "Your profile remains unset; try setting it " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4695 "again when you are fully connected.")); |
4617 | 4696 |
7334 | 4697 if (!text) { |
4698 aim_locate_setprofile(od->sess, NULL, "", 0, NULL, NULL, 0); | |
4699 return; | |
4700 } | |
6019 | 4701 |
7334 | 4702 text_html = gaim_strdup_withhtml(text); |
4703 flags = oscar_encoding_check(text_html); | |
4704 if (flags & AIM_IMFLAGS_UNICODE) { | |
4705 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
4706 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4707 g_free(msg); | |
4708 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
4709 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
4710 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4711 g_free(msg); | |
4712 } else { | |
4713 msglen = strlen(text_html); | |
4714 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4715 } | |
4716 | |
4717 if (msglen > od->rights.maxsiglen) { | |
4718 gchar *errstr; | |
4719 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " | |
4720 "has been exceeded. Gaim has truncated it for you.", | |
4721 "The maximum profile length of %d bytes " | |
4722 "has been exceeded. Gaim has truncated it for you.", | |
4723 od->rights.maxsiglen), od->rights.maxsiglen); | |
4724 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); | |
4725 g_free(errstr); | |
4726 } | |
4727 | |
4728 g_free(text_html); | |
2993 | 4729 |
4730 return; | |
2086 | 4731 } |
4732 | |
8257 | 4733 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *state, const char *text) |
2993 | 4734 { |
5129 | 4735 fu32_t flags = 0; |
6019 | 4736 gchar *text_html = NULL; |
5129 | 4737 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4738 gsize msglen = 0; |
2993 | 4739 |
8257 | 4740 if (!strcmp(state, _("Visible"))) { |
4741 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); | |
4742 return; | |
4743 } else if (!strcmp(state, _("Invisible"))) { | |
4744 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); | |
4745 return; | |
4746 } /* else... */ | |
4747 | |
8476 | 4748 if (!strcmp(state, _("Back"))) { |
4749 /* If this is our only online account then globally set Gaim not-away */ | |
4750 GList *gcs = gaim_connections_get_all(); | |
4751 if (gcs->next == NULL) | |
4752 do_im_back(NULL, NULL); | |
4753 } | |
4754 | |
8257 | 4755 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4756 | |
2993 | 4757 if (od->rights.maxawaymsglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4758 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4759 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4760 "away message before the login procedure " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4761 "completed. You remain in a \"present\" " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4762 "state; try setting it again when you are " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4763 "fully connected.")); |
5129 | 4764 |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4765 if (gc->away) { |
2993 | 4766 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4767 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4768 } |
2993 | 4769 |
5129 | 4770 if (!text) { |
7334 | 4771 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4772 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4773 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4774 |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4775 text_html = gaim_strdup_withhtml(text); |
6019 | 4776 flags = oscar_encoding_check(text_html); |
5129 | 4777 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 4778 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
7011 | 4779 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, |
7334 | 4780 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 4781 g_free(msg); |
4782 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
4783 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 4784 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
7011 | 4785 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, |
7334 | 4786 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 4787 g_free(msg); |
6019 | 4788 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4789 } else { |
6019 | 4790 msglen = strlen(text_html); |
7011 | 4791 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, |
7334 | 4792 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
6019 | 4793 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4794 } |
4795 | |
4796 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 4797 gchar *errstr; |
4798 | |
6308 | 4799 errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " |
4800 "has been exceeded. Gaim has truncated it for you.", | |
4801 "The maximum away message length of %d bytes " | |
4802 "has been exceeded. Gaim has truncated it for you.", | |
4803 od->rights.maxawaymsglen), od->rights.maxawaymsglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4804 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); |
2993 | 4805 g_free(errstr); |
4806 } | |
6019 | 4807 |
4808 g_free(text_html); | |
8257 | 4809 |
2993 | 4810 return; |
4811 } | |
4812 | |
7283 | 4813 static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message) |
2993 | 4814 { |
5575 | 4815 GaimAccount *account = gaim_connection_get_account(gc); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4816 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4817 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4818 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4819 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4820 |
8265 | 4821 if (strcmp(state, _("Invisible"))) |
5575 | 4822 account->perm_deny = 4; |
8265 | 4823 else |
5575 | 4824 account->perm_deny = 3; |
8265 | 4825 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
4826 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); | |
4342 | 4827 |
4828 if (!strcmp(state, _("Online"))) | |
4901 | 4829 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 4830 else if (!strcmp(state, _("Away"))) { |
4901 | 4831 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4832 gc->away = g_strdup(""); |
4342 | 4833 } else if (!strcmp(state, _("Do Not Disturb"))) { |
4901 | 4834 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
|
4835 gc->away = g_strdup(""); |
4342 | 4836 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 4837 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
|
4838 gc->away = g_strdup(""); |
4342 | 4839 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 4840 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
|
4841 gc->away = g_strdup(""); |
4342 | 4842 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 4843 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4844 gc->away = g_strdup(""); |
4342 | 4845 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 4846 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4847 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4848 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 4849 if (message) { |
4901 | 4850 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
|
4851 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4852 } else { |
4901 | 4853 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4854 } |
2086 | 4855 } |
2993 | 4856 |
4857 return; | |
4858 } | |
4859 | |
6059 | 4860 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) |
2993 | 4861 { |
7283 | 4862 OscarData *od = (OscarData *)gc->proto_data; |
2993 | 4863 |
4864 if (od->icq) | |
4865 oscar_set_away_icq(gc, od, state, message); | |
4866 else | |
8257 | 4867 oscar_set_away_aim(gc, od, state, message); |
2993 | 4868 |
4869 return; | |
2086 | 4870 } |
4871 | |
6059 | 4872 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { |
7283 | 4873 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4874 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); |
2086 | 4875 } |
4876 | |
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4877 static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { |
7283 | 4878 OscarData *od = (OscarData *)gc->proto_data; |
8150 | 4879 GaimBuddy *b; |
4880 | |
4881 if (g == NULL) { | |
4882 /* If we were called from oscar_add_buddies... */ | |
4883 b = gaim_find_buddy(gaim_connection_get_account(gc), name); | |
4884 g = gaim_find_buddys_group(b); | |
4885 } else | |
4886 b = gaim_find_buddy_in_group(gaim_connection_get_account(gc), name, g); | |
8092 | 4887 |
4888 if (!aim_snvalid(name)) { | |
4889 gchar *buf; | |
8150 | 4890 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 | 4891 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4892 g_free(buf); | |
8150 | 4893 |
4894 /* Remove from local list */ | |
4895 gaim_blist_remove_buddy(b); | |
4896 | |
8092 | 4897 return; |
4898 } | |
4899 | |
4230 | 4900 #ifdef NOSSI |
8143 | 4901 aim_buddylist_addbuddy(od->sess, od->conn, name); |
4230 | 4902 #else |
4903 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | |
8150 | 4904 if (b && g) { |
8660 | 4905 gaim_debug_info("oscar", |
8150 | 4906 "ssi: adding buddy %s to group %s\n", name, g->name); |
4907 aim_ssi_addbuddy(od->sess, b->name, g->name, gaim_get_buddy_alias_only(b), NULL, NULL, 0); | |
4230 | 4908 } |
4909 } | |
4910 #endif | |
8150 | 4911 |
4759 | 4912 if (od->icq) |
4913 aim_icq_getalias(od->sess, name); | |
4230 | 4914 } |
4915 | |
5575 | 4916 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
7283 | 4917 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4918 #ifdef NOSSI |
4919 char buf[MSG_LEN]; | |
4920 int n=0; | |
4921 while (buddies) { | |
4922 if (n > MSG_LEN - 18) { | |
7285 | 4923 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 4924 n = 0; |
3092 | 4925 } |
8150 | 4926 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (const char *)buddies->data); |
4230 | 4927 buddies = buddies->next; |
4928 } | |
7285 | 4929 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 4930 #else |
4931 if (od->sess->ssi.received_data) { | |
4932 while (buddies) { | |
8092 | 4933 oscar_add_buddy(gc, buddies->data, NULL); |
4230 | 4934 buddies = buddies->next; |
4935 } | |
4936 } | |
4937 #endif | |
4938 } | |
4939 | |
6059 | 4940 static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { |
7283 | 4941 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4942 #ifdef NOSSI |
8143 | 4943 aim_buddylist_removebuddy(od->sess, od->conn, name); |
4230 | 4944 #else |
4945 if (od->sess->ssi.received_data) { | |
8660 | 4946 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4947 "ssi: deleting buddy %s from group %s\n", name, group); |
4889 | 4948 aim_ssi_delbuddy(od->sess, name, group); |
4230 | 4949 } |
4950 #endif | |
4951 } | |
4952 | |
5575 | 4953 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
7283 | 4954 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4955 #ifdef NOSSI |
4956 GList *cur; | |
4957 for (cur=buddies; cur; cur=cur->next) | |
8143 | 4958 aim_buddylist_removebuddy(od->sess, od->conn, cur->data); |
4230 | 4959 #else |
4960 if (od->sess->ssi.received_data) { | |
3092 | 4961 while (buddies) { |
8150 | 4962 oscar_remove_buddy(gc, buddies->data, group); |
3092 | 4963 buddies = buddies->next; |
4964 } | |
4230 | 4965 } |
4966 #endif | |
4967 } | |
4968 | |
4969 #ifndef NOSSI | |
5575 | 4970 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
7283 | 4971 OscarData *od = (OscarData *)gc->proto_data; |
4303 | 4972 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { |
8660 | 4973 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4974 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 4975 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 4976 } |
4977 } | |
4978 | |
5575 | 4979 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
7283 | 4980 OscarData *od = (OscarData *)gc->proto_data; |
4269 | 4981 if (od->sess->ssi.received_data) { |
4982 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
4983 if (gname) { | |
8660 | 4984 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4985 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4889 | 4986 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 4987 } |
4988 } | |
4989 } | |
4990 | |
8341 | 4991 static void oscar_rename_group(GaimConnection *gc, const char *old_group, const char *new_group, GList *members) { |
4992 OscarData *od = (OscarData *)gc->proto_data; | |
4230 | 4993 |
4994 if (od->sess->ssi.received_data) { | |
4995 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | |
8341 | 4996 oscar_remove_buddies(gc, members, old_group); |
4997 oscar_add_buddies(gc, members); | |
8660 | 4998 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4999 "ssi: moved all buddies from group %s to %s\n", old_group, new_group); |
4230 | 5000 } else { |
4889 | 5001 aim_ssi_rename_group(od->sess, old_group, new_group); |
8660 | 5002 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5003 "ssi: renamed group %s to %s\n", old_group, new_group); |
2995 | 5004 } |
5005 } | |
5006 } | |
5007 | |
5968 | 5008 static gboolean gaim_ssi_rerequestdata(gpointer data) { |
5009 aim_session_t *sess = data; | |
6350 | 5010 aim_ssi_reqdata(sess); |
5968 | 5011 return FALSE; |
5012 } | |
5013 | |
4642 | 5014 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5015 GaimConnection *gc = sess->aux_data; |
7283 | 5016 OscarData *od = gc->proto_data; |
4642 | 5017 va_list ap; |
5018 fu16_t reason; | |
5019 | |
5020 va_start(ap, fr); | |
5021 reason = (fu16_t)va_arg(ap, unsigned int); | |
5022 va_end(ap); | |
5023 | |
8660 | 5024 gaim_debug_error("oscar", "ssi: SNAC error %hu\n", reason); |
4642 | 5025 |
5026 if (reason == 0x0005) { | |
5892 | 5027 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), |
5828 | 5028 _("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
|
5029 od->getblisttimer = gaim_timeout_add(300000, gaim_ssi_rerequestdata, od->sess); |
4642 | 5030 } |
5031 | |
5032 /* Activate SSI */ | |
5033 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
5034 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
8660 | 5035 gaim_debug_info("oscar", "ssi: activating server-stored buddy list\n"); |
4642 | 5036 aim_ssi_enable(od->sess); |
5037 | |
5038 return 1; | |
5039 } | |
5040 | |
2991 | 5041 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5042 GaimConnection *gc = sess->aux_data; |
7283 | 5043 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 5044 int numtypes, i; |
5045 fu16_t *maxitems; | |
2991 | 5046 va_list ap; |
5047 | |
5048 va_start(ap, fr); | |
4230 | 5049 numtypes = va_arg(ap, int); |
5050 maxitems = va_arg(ap, fu16_t *); | |
2991 | 5051 va_end(ap); |
5052 | |
8660 | 5053 gaim_debug_misc("oscar", "ssi rights:"); |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
5054 |
4230 | 5055 for (i=0; i<numtypes; i++) |
8660 | 5056 gaim_debug_misc(NULL, " max type 0x%04x=%hd,", |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
5057 i, maxitems[i]); |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
5058 |
8660 | 5059 gaim_debug_misc(NULL, "\n"); |
4230 | 5060 |
5061 if (numtypes >= 0) | |
5062 od->rights.maxbuddies = maxitems[0]; | |
5063 if (numtypes >= 1) | |
5064 od->rights.maxgroups = maxitems[1]; | |
5065 if (numtypes >= 2) | |
5066 od->rights.maxpermits = maxitems[2]; | |
5067 if (numtypes >= 3) | |
5068 od->rights.maxdenies = maxitems[3]; | |
2991 | 5069 |
5070 return 1; | |
5071 } | |
5072 | |
5073 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5074 GaimConnection *gc = sess->aux_data; |
5075 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 5076 OscarData *od = (OscarData *)gc->proto_data; |
8150 | 5077 GaimGroup *g; |
5078 GaimBuddy *b; | |
2995 | 5079 struct aim_ssi_item *curitem; |
2991 | 5080 int tmp; |
4230 | 5081 va_list ap; |
8219 | 5082 fu16_t fmtver, numitems; |
5083 struct aim_ssi_item *items; | |
5084 fu32_t timestamp; | |
4230 | 5085 |
5086 va_start(ap, fr); | |
5087 fmtver = (fu16_t)va_arg(ap, int); | |
5088 numitems = (fu16_t)va_arg(ap, int); | |
8219 | 5089 items = va_arg(ap, struct aim_ssi_item *); |
4230 | 5090 timestamp = va_arg(ap, fu32_t); |
8219 | 5091 va_end(ap); |
2991 | 5092 |
8660 | 5093 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5094 "ssi: syncing local list and server list\n"); |
2991 | 5095 |
8219 | 5096 if ((timestamp == 0) || (numitems == 0)) { |
8660 | 5097 gaim_debug_info("oscar", "Got AIM SSI with a 0 timestamp or 0 numitems--not syncing. This probably means your buddy list is empty.", NULL); |
8219 | 5098 return 1; |
5099 } | |
5100 | |
2991 | 5101 /* Clean the buddy list */ |
4889 | 5102 aim_ssi_cleanlist(sess); |
2991 | 5103 |
8150 | 5104 { /* If not in server list then prune from local list */ |
5105 GaimBlistNode *gnode, *cnode, *bnode; | |
5106 GaimBuddyList *blist; | |
5107 GSList *cur; | |
5108 | |
5109 /* Buddies */ | |
5110 cur = NULL; | |
5111 if ((blist = gaim_get_blist()) != NULL) { | |
5112 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
5113 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
5114 continue; | |
5115 g = (GaimGroup *)gnode; | |
5116 for (cnode = gnode->child; cnode; cnode = cnode->next) { | |
5117 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
5118 continue; | |
5119 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
5120 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
5121 continue; | |
5122 b = (GaimBuddy *)bnode; | |
5123 if (b->account == gc->account) { | |
5124 if (aim_ssi_itemlist_exists(sess->ssi.local, b->name)) { | |
5125 /* If the buddy is an ICQ user then load his nickname */ | |
5126 const char *servernick = gaim_blist_node_get_string((GaimBlistNode*)b, "servernick"); | |
8214 | 5127 char *alias; |
8150 | 5128 if (servernick) |
5129 serv_got_alias(gc, b->name, servernick); | |
5130 | |
5131 /* Store local alias on server */ | |
8214 | 5132 alias = aim_ssi_getalias(sess->ssi.local, g->name, b->name); |
8150 | 5133 if (!alias && b->alias && strlen(b->alias)) |
5134 aim_ssi_aliasbuddy(sess, g->name, b->name, b->alias); | |
5135 free(alias); | |
5136 } else { | |
8660 | 5137 gaim_debug_info("oscar", |
8150 | 5138 "ssi: removing buddy %s from local list\n", b->name); |
5139 /* We can't actually remove now because it will screw up our looping */ | |
5140 cur = g_slist_prepend(cur, b); | |
5141 } | |
5142 } | |
5143 } | |
5144 } | |
5145 } | |
5146 } | |
8175 | 5147 |
8150 | 5148 while (cur != NULL) { |
5149 b = cur->data; | |
5150 cur = g_slist_remove(cur, b); | |
5151 gaim_blist_remove_buddy(b); | |
5152 } | |
5153 | |
5154 /* Permit list */ | |
5155 if (gc->account->permit) { | |
5156 for (cur=gc->account->permit; cur; cur=cur->next) | |
5157 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { | |
8660 | 5158 gaim_debug_info("oscar", |
8150 | 5159 "ssi: removing permit %s from local list\n", (const char *)cur->data); |
5160 gaim_privacy_permit_remove(account, cur->data, TRUE); | |
5161 cur = gc->account->permit; | |
5162 } | |
5163 } | |
5164 | |
5165 /* Deny list */ | |
5166 if (gc->account->deny) { | |
5167 for (cur=gc->account->deny; cur; cur=cur->next) | |
5168 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { | |
8660 | 5169 gaim_debug_info("oscar", |
8150 | 5170 "ssi: removing deny %s from local list\n", (const char *)cur->data); |
5171 gaim_privacy_deny_remove(account, cur->data, TRUE); | |
5172 cur = gc->account->deny; | |
5173 } | |
5174 } | |
5175 /* Presence settings (idle time visibility) */ | |
5176 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) | |
5177 if (!(tmp & 0x400)) | |
5178 aim_ssi_setpresence(sess, tmp | 0x400); | |
5179 } /* end pruning buddies from local list */ | |
5180 | |
2991 | 5181 /* Add from server list to local list */ |
4230 | 5182 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
7328 | 5183 if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL))) |
2991 | 5184 switch (curitem->type) { |
4230 | 5185 case 0x0000: { /* Buddy */ |
4251 | 5186 if (curitem->name) { |
4292 | 5187 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
7166 | 5188 char *gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; |
4282 | 5189 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
7166 | 5190 char *alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; |
8150 | 5191 b = gaim_find_buddy(gc->account, curitem->name); |
4458 | 5192 /* Should gname be freed here? -- elb */ |
4754 | 5193 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 5194 free(alias); |
8150 | 5195 if (b) { |
4292 | 5196 /* Get server stored alias */ |
4705 | 5197 if (alias_utf8) { |
8150 | 5198 g_free(b->alias); |
5199 b->alias = g_strdup(alias_utf8); | |
4705 | 5200 } |
4282 | 5201 } else { |
8150 | 5202 b = gaim_buddy_new(gc->account, curitem->name, alias_utf8); |
5146 | 5203 |
4754 | 5204 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 5205 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 5206 gaim_blist_add_group(g, NULL); |
5207 } | |
5146 | 5208 |
8660 | 5209 gaim_debug_info("oscar", |
8150 | 5210 "ssi: adding b %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
5211 gaim_blist_add_buddy(b, NULL, g, NULL); | |
4251 | 5212 } |
8341 | 5213 if (!aim_sncmp(curitem->name, account->username)) { |
5214 char *comment = aim_ssi_getcomment(sess->ssi.local, gname, curitem->name); | |
5215 gaim_check_comment(od, comment); | |
5216 free(comment); | |
5217 } | |
7162 | 5218 g_free(gname_utf8); |
5219 g_free(alias_utf8); | |
2991 | 5220 } |
4230 | 5221 } break; |
5222 | |
5223 case 0x0001: { /* Group */ | |
4282 | 5224 /* Shouldn't add empty groups */ |
4230 | 5225 } break; |
5226 | |
5227 case 0x0002: { /* Permit buddy */ | |
2991 | 5228 if (curitem->name) { |
4230 | 5229 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 5230 GSList *list; |
5575 | 5231 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 5232 if (!list) { |
8660 | 5233 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5234 "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
|
5235 gaim_privacy_permit_add(account, curitem->name, TRUE); |
2991 | 5236 } |
5237 } | |
4230 | 5238 } break; |
5239 | |
5240 case 0x0003: { /* Deny buddy */ | |
2991 | 5241 if (curitem->name) { |
5242 GSList *list; | |
5575 | 5243 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 5244 if (!list) { |
8660 | 5245 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5246 "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
|
5247 gaim_privacy_deny_add(account, curitem->name, TRUE); |
2991 | 5248 } |
5249 } | |
4230 | 5250 } break; |
5251 | |
5252 case 0x0004: { /* Permit/deny setting */ | |
2991 | 5253 if (curitem->data) { |
5254 fu8_t permdeny; | |
5575 | 5255 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != account->perm_deny)) { |
8660 | 5256 gaim_debug_info("oscar", |
5575 | 5257 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
5258 account->perm_deny = permdeny; | |
5259 if (od->icq && account->perm_deny == 0x03) { | |
4342 | 5260 serv_set_away(gc, "Invisible", ""); |
5261 } | |
2991 | 5262 } |
5263 } | |
4230 | 5264 } break; |
5265 | |
5266 case 0x0005: { /* Presence setting */ | |
3109 | 5267 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 5268 } break; |
2991 | 5269 } /* End of switch on curitem->type */ |
5270 } /* End of for loop */ | |
4230 | 5271 |
4901 | 5272 /* Set our ICQ status */ |
8257 | 5273 if (!gc->away) { |
4901 | 5274 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); |
5275 } | |
5276 | |
4342 | 5277 /* Activate SSI */ |
5278 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
5279 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
8660 | 5280 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5281 "ssi: activating server-stored buddy list\n"); |
4642 | 5282 aim_ssi_enable(sess); |
4342 | 5283 |
2991 | 5284 return 1; |
2086 | 5285 } |
4230 | 5286 |
5287 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5288 GaimConnection *gc = sess->aux_data; |
4230 | 5289 va_list ap; |
5290 struct aim_ssi_tmp *retval; | |
5291 | |
5292 va_start(ap, fr); | |
5293 retval = va_arg(ap, struct aim_ssi_tmp *); | |
5294 va_end(ap); | |
5295 | |
5296 while (retval) { | |
8660 | 5297 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5298 "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 | 5299 |
5300 if (retval->ack != 0xffff) | |
5301 switch (retval->ack) { | |
5302 case 0x0000: { /* added successfully */ | |
5303 } break; | |
5304 | |
4829 | 5305 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
5306 gchar *buf; | |
5307 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
|
5308 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4829 | 5309 g_free(buf); |
5310 } | |
5311 | |
7023 | 5312 case 0x000e: { /* buddy requires authorization */ |
4828 | 5313 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 5314 gaim_auth_sendrequest(gc, retval->name); |
4230 | 5315 } break; |
5316 | |
5317 default: { /* La la la */ | |
5197 | 5318 gchar *buf; |
8660 | 5319 gaim_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
5402 | 5320 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
|
5321 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5197 | 5322 g_free(buf); |
4230 | 5323 } break; |
5324 } | |
5325 | |
5326 retval = retval->next; | |
5327 } | |
5328 | |
5329 return 1; | |
5330 } | |
5331 | |
8227 | 5332 static int gaim_ssi_parseadd(aim_session_t *sess, aim_frame_t *fr, ...) { |
5333 GaimConnection *gc = sess->aux_data; | |
5334 char *gname, *gname_utf8, *alias, *alias_utf8; | |
5335 GaimBuddy *b; | |
5336 GaimGroup *g; | |
5337 va_list ap; | |
5338 fu16_t type; | |
5339 const char *name; | |
5340 | |
5341 va_start(ap, fr); | |
5342 type = (fu16_t)va_arg(ap, int); | |
5343 name = va_arg(ap, char *); | |
5344 va_end(ap); | |
5345 | |
5346 if ((type != 0x0000) || (name == NULL)) | |
5347 return 1; | |
5348 | |
5349 gname = aim_ssi_itemlist_findparentname(sess->ssi.local, name); | |
5350 gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; | |
5351 alias = aim_ssi_getalias(sess->ssi.local, gname, name); | |
5352 alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; | |
5353 b = gaim_find_buddy(gc->account, name); | |
5354 free(alias); | |
5355 | |
5356 if (b) { | |
5357 /* Get server stored alias */ | |
5358 if (alias_utf8) { | |
5359 g_free(b->alias); | |
5360 b->alias = g_strdup(alias_utf8); | |
5361 } | |
5362 } else { | |
5363 b = gaim_buddy_new(gc->account, name, alias_utf8); | |
5364 | |
5365 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { | |
5366 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); | |
5367 gaim_blist_add_group(g, NULL); | |
5368 } | |
5369 | |
8660 | 5370 gaim_debug_info("oscar", |
8227 | 5371 "ssi: adding b %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); |
5372 gaim_blist_add_buddy(b, NULL, g, NULL); | |
5373 } | |
5374 g_free(gname_utf8); | |
5375 g_free(alias_utf8); | |
5376 | |
5377 return 1; | |
5378 } | |
5379 | |
4230 | 5380 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5381 GaimConnection *gc = sess->aux_data; |
4230 | 5382 va_list ap; |
5383 char *sn, *msg; | |
4236 | 5384 gchar *dialog_msg, *nombre; |
4230 | 5385 struct name_data *data; |
6695 | 5386 GaimBuddy *buddy; |
4230 | 5387 |
5388 va_start(ap, fr); | |
5389 sn = va_arg(ap, char *); | |
5390 msg = va_arg(ap, char *); | |
5391 va_end(ap); | |
5392 | |
8660 | 5393 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5394 "ssi: %s has given you permission to add him to your buddy list\n", sn); |
4230 | 5395 |
4687 | 5396 buddy = gaim_find_buddy(gc->account, sn); |
5397 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5398 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5399 else |
5400 nombre = g_strdup(sn); | |
5401 | |
5402 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 | 5403 data = g_new(struct name_data, 1); |
5404 data->gc = gc; | |
5405 data->name = g_strdup(sn); | |
5406 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5407 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5408 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5409 0, data, |
7023 | 5410 G_CALLBACK(gaim_icq_buddyadd), |
5836 | 5411 G_CALLBACK(oscar_free_name_data)); |
4236 | 5412 |
4230 | 5413 g_free(dialog_msg); |
4236 | 5414 g_free(nombre); |
4230 | 5415 |
5416 return 1; | |
5417 } | |
5418 | |
5419 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5420 GaimConnection *gc = sess->aux_data; |
4230 | 5421 va_list ap; |
5422 char *sn, *msg; | |
4236 | 5423 gchar *dialog_msg, *nombre; |
4230 | 5424 struct name_data *data; |
6695 | 5425 GaimBuddy *buddy; |
4230 | 5426 |
5427 va_start(ap, fr); | |
5428 sn = va_arg(ap, char *); | |
5429 msg = va_arg(ap, char *); | |
5430 va_end(ap); | |
5431 | |
8660 | 5432 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5433 "ssi: received authorization request from %s\n", sn); |
4230 | 5434 |
4687 | 5435 buddy = gaim_find_buddy(gc->account, sn); |
5436 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5437 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5438 else |
5439 nombre = g_strdup(sn); | |
5440 | |
4337 | 5441 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 | 5442 data = g_new(struct name_data, 1); |
5443 data->gc = gc; | |
5444 data->name = g_strdup(sn); | |
5445 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5446 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5447 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5448 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5449 _("Authorize"), G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5450 _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4236 | 5451 |
4230 | 5452 g_free(dialog_msg); |
4236 | 5453 g_free(nombre); |
4230 | 5454 |
5455 return 1; | |
5456 } | |
5457 | |
5458 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5459 GaimConnection *gc = sess->aux_data; |
4230 | 5460 va_list ap; |
5461 char *sn, *msg; | |
4236 | 5462 gchar *dialog_msg, *nombre; |
4230 | 5463 fu8_t reply; |
6695 | 5464 GaimBuddy *buddy; |
4230 | 5465 |
5466 va_start(ap, fr); | |
5467 sn = va_arg(ap, char *); | |
5468 reply = (fu8_t)va_arg(ap, int); | |
5469 msg = va_arg(ap, char *); | |
5470 va_end(ap); | |
5471 | |
8660 | 5472 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5473 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4236 | 5474 |
4687 | 5475 buddy = gaim_find_buddy(gc->account, sn); |
5476 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5477 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5478 else |
5479 nombre = g_strdup(sn); | |
5480 | |
4230 | 5481 if (reply) { |
5482 /* Granted */ | |
7023 | 5483 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
|
5484 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); |
4230 | 5485 } else { |
5486 /* Denied */ | |
7023 | 5487 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
|
5488 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); |
4230 | 5489 } |
5490 g_free(dialog_msg); | |
4236 | 5491 g_free(nombre); |
4230 | 5492 |
5493 return 1; | |
5494 } | |
5495 | |
5496 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5497 GaimConnection *gc = sess->aux_data; |
4230 | 5498 va_list ap; |
5499 char *sn; | |
6695 | 5500 GaimBuddy *buddy; |
4230 | 5501 |
5502 va_start(ap, fr); | |
5503 sn = va_arg(ap, char *); | |
5504 va_end(ap); | |
5505 | |
4687 | 5506 buddy = gaim_find_buddy(gc->account, sn); |
8660 | 5507 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5508 "ssi: %s added you to their buddy list\n", sn); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
7011
diff
changeset
|
5509 gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 5510 |
5511 return 1; | |
5512 } | |
4269 | 5513 #endif |
2086 | 5514 |
5575 | 5515 static GList *oscar_chat_info(GaimConnection *gc) { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5516 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5517 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5518 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5519 pce = g_new0(struct proto_chat_entry, 1); |
7841 | 5520 pce->label = _("_Group:"); |
5234 | 5521 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5522 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5523 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5524 pce = g_new0(struct proto_chat_entry, 1); |
7841 | 5525 pce->label = _("_Exchange:"); |
5234 | 5526 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5527 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5528 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5529 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5530 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5531 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5532 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5533 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5534 |
8308 | 5535 static void oscar_join_chat(GaimConnection *gc, GHashTable *data) { |
5536 OscarData *od = (OscarData *)gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5537 aim_conn_t *cur; |
5234 | 5538 char *name, *exchange; |
5539 | |
5540 name = g_hash_table_lookup(data, "room"); | |
5541 exchange = g_hash_table_lookup(data, "exchange"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5542 |
8660 | 5543 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5544 "Attempting to join chat room %s.\n", name); |
8308 | 5545 |
5546 if ((name == NULL) || (*name == '\0')) { | |
5547 gaim_notify_error(gc, NULL, _("Invalid chat name specified."), NULL); | |
5548 return; | |
5549 } | |
5550 | |
4617 | 5551 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { |
8660 | 5552 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5553 "chatnav exists, creating room\n"); |
5234 | 5554 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); |
2086 | 5555 } else { |
5556 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5557 struct create_room *cr = g_new0(struct create_room, 1); |
8660 | 5558 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5559 "chatnav does not exist, opening chatnav\n"); |
5234 | 5560 cr->exchange = atoi(exchange); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5561 cr->name = g_strdup(name); |
4617 | 5562 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5563 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 5564 } |
5565 } | |
5566 | |
8308 | 5567 static void oscar_chat_invite(GaimConnection *gc, int id, const char *message, const char *name) { |
5568 OscarData *od = (OscarData *)gc->proto_data; | |
5569 struct chat_connection *ccon = find_oscar_chat(gc, id); | |
2086 | 5570 |
5571 if (!ccon) | |
5572 return; | |
5573 | |
8225 | 5574 aim_im_sendch2_chatinvite(od->sess, name, message ? message : "", |
2086 | 5575 ccon->exchange, ccon->name, 0x0); |
5576 } | |
5577 | |
8308 | 5578 static void oscar_chat_leave(GaimConnection *gc, int id) { |
5579 OscarData *od = gc ? (OscarData *)gc->proto_data : NULL; | |
5580 GSList *bcs = gc->buddy_chats; | |
5679 | 5581 GaimConversation *b = NULL; |
2086 | 5582 struct chat_connection *c = NULL; |
5583 int count = 0; | |
5584 | |
5585 while (bcs) { | |
5586 count++; | |
5679 | 5587 b = (GaimConversation *)bcs->data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5588 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))) |
2086 | 5589 break; |
5590 bcs = bcs->next; | |
5591 b = NULL; | |
5592 } | |
5593 | |
5594 if (!b) | |
5595 return; | |
5596 | |
8660 | 5597 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5598 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); |
2086 | 5599 |
8308 | 5600 c = find_oscar_chat(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 5601 if (c != NULL) { |
4617 | 5602 if (od) |
5603 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 5604 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5605 gaim_input_remove(c->inpa); |
8308 | 5606 if (gc && od->sess) |
4617 | 5607 aim_conn_kill(od->sess, &c->conn); |
2086 | 5608 g_free(c->name); |
5609 g_free(c->show); | |
5610 g_free(c); | |
5611 } | |
5612 /* we do this because with Oscar it doesn't tell us we left */ | |
8308 | 5613 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 5614 } |
5615 | |
8219 | 5616 static int oscar_send_chat(GaimConnection *gc, int id, const char *message) { |
5617 OscarData *od = (OscarData *)gc->proto_data; | |
5618 GError *err = NULL; | |
5619 GaimConversation *conv = NULL; | |
2086 | 5620 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5621 char *buf, *buf2; |
8219 | 5622 char *charset = NULL; |
5623 int encoding; | |
8907 | 5624 gsize len; |
8219 | 5625 |
5626 if (!(conv = gaim_find_chat(gc, id))) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5627 return -EINVAL; |
2086 | 5628 |
8219 | 5629 if (!(c = find_oscar_chat_by_conv(gc, conv))) |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5630 return -EINVAL; |
2086 | 5631 |
8219 | 5632 buf = gaim_strdup_withhtml(message); |
5633 len = strlen(buf); | |
5634 | |
5635 encoding = oscar_encoding_check(buf); | |
8233 | 5636 if (encoding & AIM_IMFLAGS_UNICODE) { |
8660 | 5637 gaim_debug_info("oscar", "Sending Unicode chat\n"); |
8219 | 5638 charset = "unicode-2-0"; |
5639 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err); | |
5640 if (err) { | |
8660 | 5641 gaim_debug_error("oscar", |
8359 | 5642 "Error converting to unicode-2-0: %s\n", err->message); |
5643 g_error_free(err); | |
5644 } | |
8219 | 5645 } else if (encoding & AIM_IMFLAGS_ISO_8859_1) { |
8660 | 5646 gaim_debug_info("oscar", "Sending ISO-8859-1 chat\n"); |
8219 | 5647 charset = "iso-8859-1"; |
5648 buf2 = g_convert(buf, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); | |
5649 if (err) { | |
8660 | 5650 gaim_debug_error("oscar", |
8359 | 5651 "Error converting to iso-8859-1: %s\n", err->message); |
8219 | 5652 g_error_free(err); |
8359 | 5653 err = NULL; |
5654 | |
8660 | 5655 gaim_debug_info("oscar", "Falling back to Unicode\n"); |
8359 | 5656 charset = "unicode-2-0"; |
5657 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err); | |
8219 | 5658 if (err) { |
8660 | 5659 gaim_debug_error("oscar", |
8359 | 5660 "Error converting to unicode-2-0: %s\n", |
5661 err->message); | |
8219 | 5662 g_error_free(err); |
5663 } | |
2086 | 5664 } |
8219 | 5665 } else { |
5666 charset = "us-ascii"; | |
5667 buf2 = g_strdup(buf); | |
5668 } | |
8359 | 5669 g_free(buf); |
5670 | |
5671 if ((len > c->maxlen) || (len > c->maxvis)) { | |
5672 g_free(buf2); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5673 return -E2BIG; |
8359 | 5674 } |
5675 | |
5676 aim_chat_send_im(od->sess, c->conn, 0, buf2, len, charset, "en"); | |
8219 | 5677 g_free(buf2); |
8359 | 5678 |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5679 return 0; |
2086 | 5680 } |
5681 | |
6695 | 5682 static const char *oscar_list_icon(GaimAccount *a, GaimBuddy *b) { |
4766 | 5683 if (!b || (b && b->name && b->name[0] == '+')) { |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5684 if (a != NULL && isdigit(*gaim_account_get_username(a))) |
4687 | 5685 return "icq"; |
5686 else | |
5687 return "aim"; | |
5688 } | |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5689 |
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5690 if (b != NULL && isdigit(b->name[0])) |
4687 | 5691 return "icq"; |
5692 return "aim"; | |
5693 } | |
5694 | |
6695 | 5695 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 5696 { |
7334 | 5697 GaimAccount *account = NULL; |
5698 GaimConnection *gc = NULL; | |
5699 OscarData *od = NULL; | |
4687 | 5700 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
5701 int i = 0; | |
7334 | 5702 aim_userinfo_t *userinfo = NULL; |
5703 | |
5704 if (b != NULL) | |
5705 account = b->account; | |
5706 if (account != NULL) | |
5707 gc = account->gc; | |
5708 if (gc != NULL) | |
5709 od = gc->proto_data; | |
7945 | 5710 if (od != NULL) |
5711 userinfo = aim_locate_finduserinfo(od->sess, b->name); | |
4687 | 5712 |
5131 | 5713 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5714 char *gname; | |
7334 | 5715 if ((b->name) && (od) && (od->sess->ssi.received_data) && |
5131 | 5716 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
5717 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
5718 emblems[i++] = "notauthorized"; | |
5719 } else { | |
5720 emblems[i++] = "offline"; | |
5721 } | |
5722 } | |
4916 | 5723 |
4766 | 5724 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 5725 int uc = b->uc >> 16; |
4766 | 5726 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 5727 emblems[i++] = "invisible"; |
4766 | 5728 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 5729 emblems[i++] = "freeforchat"; |
4766 | 5730 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 5731 emblems[i++] = "dnd"; |
4766 | 5732 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 5733 emblems[i++] = "na"; |
4766 | 5734 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 5735 emblems[i++] = "occupied"; |
4766 | 5736 else if (uc & AIM_ICQ_STATE_AWAY) |
5737 emblems[i++] = "away"; | |
5738 } else { | |
5739 if (b->uc & UC_UNAVAILABLE) | |
5740 emblems[i++] = "away"; | |
5741 } | |
4687 | 5742 if (b->uc & UC_WIRELESS) |
5743 emblems[i++] = "wireless"; | |
5744 if (b->uc & UC_AOL) | |
5745 emblems[i++] = "aol"; | |
5746 if (b->uc & UC_ADMIN) | |
5747 emblems[i++] = "admin"; | |
5748 if (b->uc & UC_AB && i < 4) | |
5749 emblems[i++] = "activebuddy"; | |
4766 | 5750 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
5751 emblems[i++] = "unconfirmed"; */ | |
7334 | 5752 |
7945 | 5753 if ((i < 4) && (userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_HIPTOP)) |
5754 emblems[i++] = "hiptop"; | |
5755 | |
5756 if ((i < 4) && (userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_SECUREIM)) | |
7334 | 5757 emblems[i++] = "secure"; |
5758 | |
4687 | 5759 *se = emblems[0]; |
5760 *sw = emblems[1]; | |
5761 *nw = emblems[2]; | |
5762 *ne = emblems[3]; | |
5763 } | |
5764 | |
6695 | 5765 static char *oscar_tooltip_text(GaimBuddy *b) { |
5575 | 5766 GaimConnection *gc = b->account->gc; |
7283 | 5767 OscarData *od = gc->proto_data; |
7045 | 5768 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); |
8701 | 5769 GString *str = g_string_new(""); |
5131 | 5770 |
5771 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
8701 | 5772 oscar_string_append_info(gc, str, "\n", b, userinfo); |
7011 | 5773 |
5774 if ((userinfo != NULL) && (userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
8225 | 5775 gchar *charset = oscar_encoding_extract(userinfo->away_encoding); |
8392 | 5776 gchar *away_utf8 = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len); |
8225 | 5777 g_free(charset); |
7011 | 5778 if (away_utf8 != NULL) { |
7091 | 5779 gchar *tmp1, *tmp2; |
8341 | 5780 tmp1 = gaim_strcasereplace(away_utf8, "<BR>", "\n"); |
5781 g_free(away_utf8); | |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7093
diff
changeset
|
5782 tmp2 = gaim_markup_strip_html(tmp1); |
7091 | 5783 g_free(tmp1); |
8571 | 5784 tmp1 = gaim_escape_html(tmp2); |
7091 | 5785 g_free(tmp2); |
8700 | 5786 tmp2 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); |
8461 | 5787 g_free(tmp1); |
8701 | 5788 g_string_append_printf(str, "\n<b>%s:</b> %s", _("Away Message"), tmp2); |
8700 | 5789 g_free(tmp2); |
5836 | 5790 } |
5131 | 5791 } |
8701 | 5792 } |
5793 | |
5794 return g_string_free(str, FALSE); | |
5131 | 5795 } |
5796 | |
6695 | 5797 static char *oscar_status_text(GaimBuddy *b) { |
5575 | 5798 GaimConnection *gc = b->account->gc; |
7283 | 5799 OscarData *od = gc->proto_data; |
5167 | 5800 gchar *ret = NULL; |
5801 | |
5802 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | |
5803 if (isdigit(b->name[0])) | |
8701 | 5804 ret = oscar_icqstatus((b->uc & 0xffff0000) >> 16); |
7038 | 5805 else |
5806 ret = g_strdup(_("Away")); | |
5836 | 5807 } else if (GAIM_BUDDY_IS_ONLINE(b)) { |
7261 | 5808 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
6292 | 5809 if (bi->availmsg) |
5810 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5836 | 5811 } else { |
5167 | 5812 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); |
5813 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) | |
5814 ret = g_strdup(_("Not Authorized")); | |
5815 else | |
5816 ret = g_strdup(_("Offline")); | |
5817 } | |
5818 | |
5819 return ret; | |
5820 } | |
5821 | |
5842 | 5822 |
5844 | 5823 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5842 | 5824 GaimConnection *gc = sess->aux_data; |
7283 | 5825 OscarData *od = gc->proto_data; |
5892 | 5826 va_list ap; |
5842 | 5827 fu16_t type; |
5892 | 5828 fu8_t flags = 0, length = 0; |
5829 char *md5 = NULL; | |
5830 | |
7334 | 5831 |
5842 | 5832 va_start(ap, fr); |
5833 type = va_arg(ap, int); | |
5892 | 5834 |
5835 switch(type) { | |
5836 case 0x0000: | |
5837 case 0x0001: { | |
5838 flags = va_arg(ap, int); | |
5839 length = va_arg(ap, int); | |
5840 md5 = va_arg(ap, char *); | |
5841 | |
5842 if (flags == 0x41) { | |
5843 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
5844 od->iconconnecting = TRUE; | |
5845 od->set_icon = TRUE; | |
5846 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
5847 } else { | |
6039 | 5848 struct stat st; |
5849 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
5850 if (iconfile == NULL) { | |
8363 | 5851 aim_ssi_delicon(od->sess); |
6039 | 5852 } else if (!stat(iconfile, &st)) { |
5853 char *buf = g_malloc(st.st_size); | |
5854 FILE *file = fopen(iconfile, "rb"); | |
5855 if (file) { | |
5856 fread(buf, 1, st.st_size, file); | |
5857 fclose(file); | |
8660 | 5858 gaim_debug_info("oscar", |
6039 | 5859 "Uploading icon to icon server\n"); |
6879 | 5860 aim_bart_upload(od->sess, buf, st.st_size); |
5892 | 5861 } else |
8660 | 5862 gaim_debug_error("oscar", |
6039 | 5863 "Can't open buddy icon file!\n"); |
5864 g_free(buf); | |
5865 } else { | |
8660 | 5866 gaim_debug_error("oscar", |
6039 | 5867 "Can't stat buddy icon file!\n"); |
5892 | 5868 } |
5869 } | |
8363 | 5870 } else if (flags == 0x81) { |
5871 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
5872 if (iconfile == NULL) | |
5873 aim_ssi_delicon(od->sess); | |
5874 else | |
5875 aim_ssi_seticon(od->sess, md5, length); | |
5876 } | |
5892 | 5877 } break; |
5878 | |
5879 case 0x0002: { /* We just set an "available" message? */ | |
5880 } break; | |
5881 } | |
5882 | |
5842 | 5883 va_end(ap); |
5844 | 5884 |
5885 return 0; | |
5842 | 5886 } |
5892 | 5887 |
3952 | 5888 /* |
4617 | 5889 * We have just established a socket with the other dude, so set up some handlers. |
3952 | 5890 */ |
4617 | 5891 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5892 GaimConnection *gc = sess->aux_data; |
7283 | 5893 OscarData *od = (OscarData *)gc->proto_data; |
8733 | 5894 GaimConversation *conv; |
2086 | 5895 struct direct_im *dim; |
5896 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5897 char *sn; |
4617 | 5898 va_list ap; |
5899 aim_conn_t *newconn, *listenerconn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5900 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5901 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5902 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5903 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 5904 va_end(ap); |
5905 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5906 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5907 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5908 |
4617 | 5909 sn = g_strdup(aim_odc_getsn(newconn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5910 |
8660 | 5911 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5912 "DirectIM: initiate success to %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5913 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5914 |
8733 | 5915 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5916 gaim_input_remove(dim->watcher); |
2086 | 5917 dim->conn = newconn; |
4617 | 5918 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
3008 | 5919 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5920 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5921 g_free(sn); |
8733 | 5922 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
2086 | 5923 |
4617 | 5924 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); |
5925 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
6982 | 5926 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_odc_update_ui, 0); |
4617 | 5927 |
2993 | 5928 return 1; |
5929 } | |
5930 | |
6982 | 5931 /* |
5932 * This is called when each chunk of an image is received. It can be used to | |
5933 * update a progress bar, or to eat lots of dry cat food. Wet cat food is | |
5934 * nasty, you sicko. | |
5935 */ | |
5936 static int gaim_odc_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
2993 | 5937 va_list ap; |
5938 char *sn; | |
5939 double percent; | |
5575 | 5940 GaimConnection *gc = sess->aux_data; |
7283 | 5941 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 5942 GaimConversation *c; |
2993 | 5943 struct direct_im *dim; |
5944 | |
5945 va_start(ap, fr); | |
5946 sn = va_arg(ap, char *); | |
5947 percent = va_arg(ap, double); | |
5948 va_end(ap); | |
6873 | 5949 |
2994 | 5950 if (!(dim = find_direct_im(od, sn))) |
5951 return 1; | |
3059 | 5952 if (dim->watcher) { |
5953 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
5954 dim->watcher = 0; | |
5955 } | |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5956 |
6982 | 5957 c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
6873 | 5958 if (c != NULL) |
5959 gaim_conversation_update_progress(c, percent); | |
2993 | 5960 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
5961 oscar_callback, dim->conn); | |
2086 | 5962 |
5963 return 1; | |
5964 } | |
5965 | |
6982 | 5966 /* |
5967 * This is called after a direct IM has been received in its entirety. This | |
5968 * function is passed a long chunk of data which contains the IM with any | |
5969 * data chunks (images) appended to it. | |
5970 * | |
5971 * This function rips out all the data chunks and creates an imgstore for | |
5972 * each one. In order to do this, it first goes through the IM and takes | |
5973 * out all the IMG tags. When doing so, it rewrites the original IMG tag | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
5974 * with one compatible with the imgstore Gaim core code. For each one, we |
6982 | 5975 * then read in chunks of data from the end of the message and actually |
5976 * create the img store using the given data. | |
5977 * | |
5978 * For somewhat easy reference, here's a sample message | |
5979 * (without the whitespace and asterisks): | |
5980 * | |
5981 * <HTML><BODY BGCOLOR="#ffffff"> | |
5982 * <FONT LANG="0"> | |
5983 * This is a really stupid picture:<BR> | |
5984 * <IMG SRC="Sample.jpg" ID="1" WIDTH="283" HEIGHT="212" DATASIZE="9894"><BR> | |
5985 * Yeah it is<BR> | |
5986 * Here is another one:<BR> | |
5987 * <IMG SRC="Soap Bubbles.bmp" ID="2" WIDTH="256" HEIGHT="256" DATASIZE="65978"> | |
5988 * </FONT> | |
5989 * </BODY></HTML> | |
5990 * <BINARY> | |
5991 * <DATA ID="1" SIZE="9894">datadatadatadata</DATA> | |
5992 * <DATA ID="2" SIZE="65978">datadatadatadata</DATA> | |
5993 * </BINARY> | |
5994 */ | |
4617 | 5995 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5996 GaimConnection *gc = sess->aux_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5997 GaimConvImFlags imflags = 0; |
8233 | 5998 gchar *utf8; |
6982 | 5999 GString *newmsg = g_string_new(""); |
6000 GSList *images = NULL; | |
2086 | 6001 va_list ap; |
6982 | 6002 const char *sn, *msg, *msgend, *binary; |
6003 size_t len; | |
6004 int encoding, isawaymsg; | |
2086 | 6005 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6006 va_start(ap, fr); |
6982 | 6007 sn = va_arg(ap, const char *); |
6008 msg = va_arg(ap, const char *); | |
6009 len = va_arg(ap, size_t); | |
3952 | 6010 encoding = va_arg(ap, int); |
4870 | 6011 isawaymsg = va_arg(ap, int); |
2086 | 6012 va_end(ap); |
6982 | 6013 msgend = msg + len; |
2086 | 6014 |
8660 | 6015 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6016 "Got DirectIM message from %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6017 |
4870 | 6018 if (isawaymsg) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
6019 imflags |= GAIM_CONV_IM_AUTO_RESP; |
4870 | 6020 |
6982 | 6021 /* message has a binary trailer */ |
6022 if ((binary = gaim_strcasestr(msg, "<binary>"))) { | |
6023 GData *attribs; | |
6024 const char *tmp, *start, *end, *last = NULL; | |
6025 | |
6026 tmp = msg; | |
6027 | |
6028 /* for each valid image tag... */ | |
6029 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
6030 const char *id, *src, *datasize; | |
6031 const char *tag = NULL, *data = NULL; | |
6032 size_t size; | |
6033 int imgid = 0; | |
6034 | |
6035 /* update the location of the last img tag */ | |
6036 last = end; | |
6037 | |
6038 /* grab attributes */ | |
6039 id = g_datalist_get_data(&attribs, "id"); | |
6040 src = g_datalist_get_data(&attribs, "src"); | |
6041 datasize = g_datalist_get_data(&attribs, "datasize"); | |
6042 | |
6043 /* if we have id & datasize, build the data tag */ | |
6044 if (id && datasize) | |
6045 tag = g_strdup_printf("<data id=\"%s\" size=\"%s\">", id, datasize); | |
6046 | |
6047 /* if we have a tag, find the start of the data */ | |
6048 if (tag && (data = gaim_strcasestr(binary, tag))) | |
6049 data += strlen(tag); | |
6050 | |
6051 /* check the data is here and store it */ | |
6052 if (data + (size = atoi(datasize)) <= msgend) | |
6053 imgid = gaim_imgstore_add(data, size, src); | |
6054 | |
8233 | 6055 /* |
6056 * XXX - The code below contains some calls to oscar_encoding_to_utf8 | |
6057 * The hardcoded "us-ascii" value REALLY needs to be removed. | |
6058 */ | |
6982 | 6059 /* if we have a stored image... */ |
6060 if (imgid) { | |
6061 /* append the message up to the tag */ | |
8233 | 6062 utf8 = oscar_encoding_to_utf8("us-ascii", tmp, start - tmp); |
6063 if (utf8 != NULL) { | |
6064 newmsg = g_string_append(newmsg, utf8); | |
6065 g_free(utf8); | |
6066 } | |
6982 | 6067 |
6068 /* write the new image tag */ | |
6069 g_string_append_printf(newmsg, "<IMG ID=\"%d\">", imgid); | |
6070 | |
6071 /* and record the image number */ | |
6072 images = g_slist_append(images, GINT_TO_POINTER(imgid)); | |
6073 } else { | |
6074 /* otherwise, copy up to the end of the tag */ | |
8233 | 6075 utf8 = oscar_encoding_to_utf8("us-ascii", tmp, (end + 1) - tmp); |
6076 if (utf8 != NULL) { | |
6077 newmsg = g_string_append(newmsg, utf8); | |
6078 g_free(utf8); | |
6079 } | |
6982 | 6080 } |
6081 | |
6082 /* clear the attribute list */ | |
6083 g_datalist_clear(&attribs); | |
6084 | |
6085 /* continue from the end of the tag */ | |
6086 tmp = end + 1; | |
6087 } | |
6088 | |
6089 /* append any remaining message data (without the > :-) */ | |
6090 if (last++ && (last < binary)) | |
6091 newmsg = g_string_append_len(newmsg, last, binary - last); | |
6092 | |
6093 /* set the flag if we caught any images */ | |
6094 if (images) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
6095 imflags |= GAIM_CONV_IM_IMAGES; |
6982 | 6096 } else { |
6097 g_string_append_len(newmsg, msg, len); | |
6098 } | |
6099 | |
4617 | 6100 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
6982 | 6101 serv_got_im(gc, sn, newmsg->str, imflags, time(NULL)); |
6102 | |
6103 /* free up the message */ | |
6104 g_string_free(newmsg, TRUE); | |
6105 | |
6106 /* unref any images we allocated */ | |
6107 if (images) { | |
6108 GSList *tmp; | |
6109 int id; | |
6110 | |
6111 for (tmp = images; tmp != NULL; tmp = tmp->next) { | |
6112 id = GPOINTER_TO_INT(tmp->data); | |
6113 gaim_imgstore_unref(id); | |
6114 } | |
6115 | |
6116 g_slist_free(images); | |
6117 } | |
2086 | 6118 |
6119 return 1; | |
6120 } | |
6121 | |
4617 | 6122 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 6123 va_list ap; |
6124 char *sn; | |
2993 | 6125 int typing; |
5575 | 6126 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6127 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6128 va_start(ap, fr); |
2086 | 6129 sn = va_arg(ap, char *); |
2993 | 6130 typing = va_arg(ap, int); |
2086 | 6131 va_end(ap); |
6132 | |
4870 | 6133 if (typing == 0x0002) { |
2993 | 6134 /* I had to leave this. It's just too funny. It reminds me of my sister. */ |
8660 | 6135 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6136 "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
|
6137 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
4870 | 6138 } else if (typing == 0x0001) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
6139 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
4870 | 6140 else |
4342 | 6141 serv_got_typing_stopped(gc, sn); |
2086 | 6142 return 1; |
6143 } | |
6144 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
6145 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimConvImFlags imflags) { |
6982 | 6146 char *buf; |
6147 size_t len; | |
6148 int ret; | |
6149 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
6150 if (imflags & GAIM_CONV_IM_IMAGES) { |
6982 | 6151 GString *msg = g_string_new(""); |
6152 GString *data = g_string_new("<BINARY>"); | |
6153 GData *attribs; | |
6154 const char *tmp, *start, *end, *last = NULL; | |
6155 int oscar_id = 0; | |
6156 | |
6157 tmp = message; | |
6158 | |
6159 /* for each valid IMG tag... */ | |
6160 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
6161 GaimStoredImage *image = NULL; | |
6162 const char *id; | |
6163 | |
6164 last = end; | |
6165 id = g_datalist_get_data(&attribs, "id"); | |
6166 | |
6167 /* ... if it refers to a valid gaim image ... */ | |
6168 if (id && (image = gaim_imgstore_get(atoi(id)))) { | |
6169 /* ... append the message from start to the tag ... */ | |
6170 msg = g_string_append_len(msg, tmp, start - tmp); | |
6171 oscar_id++; | |
6172 | |
6173 /* ... insert a new img tag with the oscar id ... */ | |
6174 if (image->filename) | |
6175 g_string_append_printf(msg, | |
6176 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
7386 | 6177 image->filename, oscar_id, (int)image->size); |
6982 | 6178 else |
6179 g_string_append_printf(msg, | |
6180 "<IMG ID=\"%d\" DATASIZE=\"%d\">", | |
7386 | 6181 oscar_id, (int)image->size); |
6982 | 6182 |
6183 /* ... and append the data to the binary section ... */ | |
6184 g_string_append_printf(data, "<DATA ID=\"%d\" SIZE=\"%d\">", | |
7386 | 6185 oscar_id, (int)image->size); |
6982 | 6186 data = g_string_append_len(data, image->data, image->size); |
6187 data = g_string_append(data, "</DATA>"); | |
6188 } else { | |
6189 /* ... otherwise, allow the possibly invalid img tag through. */ | |
6190 /* should we do something else? */ | |
6191 msg = g_string_append_len(msg, tmp, (end + 1) - tmp); | |
6192 } | |
6193 | |
6194 g_datalist_clear(&attribs); | |
6195 | |
6196 /* continue from the end of the tag */ | |
6197 tmp = end + 1; | |
6198 } | |
6199 | |
6200 /* append any remaining message data (without the > :-) */ | |
6201 if (last++ && *last) | |
6202 msg = g_string_append(msg, last); | |
6203 | |
6204 /* if we inserted any images in the binary section, append it */ | |
6205 if (oscar_id) { | |
6206 msg = g_string_append_len(msg, data->str, data->len); | |
6207 msg = g_string_append(msg, "</BINARY>"); | |
6208 } | |
6209 | |
6210 len = msg->len; | |
6211 buf = msg->str; | |
6212 g_string_free(msg, FALSE); | |
6213 g_string_free(data, TRUE); | |
6214 } else { | |
6215 len = strlen(message); | |
6216 buf = g_memdup(message, len+1); | |
6217 } | |
6218 | |
6219 /* 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
|
6220 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
6982 | 6221 ret = aim_odc_send_im(sess, conn, buf, len, 0, 1); |
6222 else | |
6223 ret = aim_odc_send_im(sess, conn, buf, len, 0, 0); | |
6224 | |
6225 g_free(buf); | |
6226 | |
6227 return ret; | |
6228 } | |
6229 | |
2086 | 6230 struct ask_do_dir_im { |
6231 char *who; | |
5575 | 6232 GaimConnection *gc; |
2086 | 6233 }; |
6234 | |
3730 | 6235 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5136 | 6236 g_free(data->who); |
2086 | 6237 g_free(data); |
6238 } | |
6239 | |
3730 | 6240 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5575 | 6241 GaimConnection *gc = data->gc; |
7283 | 6242 OscarData *od; |
2086 | 6243 struct direct_im *dim; |
8240 | 6244 int listenfd; |
2086 | 6245 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
6246 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5136 | 6247 g_free(data->who); |
4244 | 6248 g_free(data); |
6249 return; | |
6250 } | |
6251 | |
7283 | 6252 od = (OscarData *)gc->proto_data; |
4244 | 6253 |
2086 | 6254 dim = find_direct_im(od, data->who); |
6255 if (dim) { | |
3008 | 6256 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
6257 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
6258 gaim_input_remove(dim->watcher); | |
6259 g_free(dim); | |
8660 | 6260 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6261 "Gave up on old direct IM, trying again\n"); |
3008 | 6262 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6263 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); |
5136 | 6264 g_free(data->who); |
4244 | 6265 g_free(data); |
3008 | 6266 return; |
6267 } | |
2086 | 6268 } |
6269 dim = g_new0(struct direct_im, 1); | |
6270 dim->gc = gc; | |
6271 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
6272 | |
8246 | 6273 listenfd = gaim_network_listen_range(5190, 5199); |
8240 | 6274 dim->conn = aim_odc_initiate(od->sess, data->who, listenfd, gaim_network_get_port_from_fd(listenfd)); |
2086 | 6275 if (dim->conn != NULL) { |
6276 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
6277 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 6278 oscar_callback, dim->conn); |
4617 | 6279 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
6280 gaim_odc_initiate, 0); | |
2086 | 6281 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6282 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL); |
2086 | 6283 g_free(dim); |
6284 } | |
4244 | 6285 |
5136 | 6286 g_free(data->who); |
4244 | 6287 g_free(data); |
2086 | 6288 } |
6289 | |
5575 | 6290 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
5420 | 6291 gchar *buf; |
2086 | 6292 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
5136 | 6293 data->who = g_strdup(who); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
6294 data->gc = gc; |
5420 | 6295 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
|
6296 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6297 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6298 _("Because this reveals your IP address, it " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6299 "may be considered a privacy risk. Do you " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6300 "wish to continue?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6301 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6302 _("Connect"), G_CALLBACK(oscar_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6303 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
5420 | 6304 g_free(buf); |
2086 | 6305 } |
6306 | |
5575 | 6307 static void oscar_set_permit_deny(GaimConnection *gc) { |
6308 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 6309 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 6310 #ifdef NOSSI |
8143 | 6311 GSList *list; |
4230 | 6312 char buf[MAXMSGLEN]; |
6313 int at; | |
6314 | |
5575 | 6315 switch(account->perm_deny) { |
8175 | 6316 case GAIM_PRIVACY_ALLOW_ALL: |
5575 | 6317 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
4230 | 6318 break; |
8175 | 6319 case GAIM_PRIVACY_DENY_ALL: |
5575 | 6320 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
4230 | 6321 break; |
8175 | 6322 case GAIM_PRIVACY_ALLOW_USERS: |
5575 | 6323 list = account->permit; |
4230 | 6324 at = 0; |
6325 while (list) { | |
6326 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6327 list = list->next; | |
6328 } | |
6329 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
6330 break; | |
8175 | 6331 case GAIM_PRIVACY_DENY_USERS: |
5575 | 6332 list = account->deny; |
4230 | 6333 at = 0; |
6334 while (list) { | |
6335 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6336 list = list->next; | |
6337 } | |
6338 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
6339 break; | |
6340 default: | |
6341 break; | |
2086 | 6342 } |
4230 | 6343 #else |
8175 | 6344 if (od->sess->ssi.received_data) { |
6345 switch (account->perm_deny) { | |
6346 case GAIM_PRIVACY_ALLOW_ALL: | |
6347 aim_ssi_setpermdeny(od->sess, 0x01, 0xffffffff); | |
6348 break; | |
6349 case GAIM_PRIVACY_ALLOW_BUDDYLIST: | |
6350 aim_ssi_setpermdeny(od->sess, 0x05, 0xffffffff); | |
6351 break; | |
6352 case GAIM_PRIVACY_ALLOW_USERS: | |
6353 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); | |
6354 break; | |
6355 case GAIM_PRIVACY_DENY_ALL: | |
6356 aim_ssi_setpermdeny(od->sess, 0x02, 0xffffffff); | |
6357 break; | |
6358 case GAIM_PRIVACY_DENY_USERS: | |
6359 aim_ssi_setpermdeny(od->sess, 0x04, 0xffffffff); | |
6360 break; | |
6361 default: | |
6362 aim_ssi_setpermdeny(od->sess, 0x01, 0xffffffff); | |
6363 break; | |
6364 } | |
6365 } | |
4230 | 6366 #endif |
2086 | 6367 } |
6368 | |
5575 | 6369 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
4269 | 6370 #ifdef NOSSI |
8143 | 6371 if (gc->account->perm_deny == 3) |
4269 | 6372 oscar_set_permit_deny(gc); |
6373 #else | |
7283 | 6374 OscarData *od = (OscarData *)gc->proto_data; |
8660 | 6375 gaim_debug_info("oscar", "ssi: About to add a permit\n"); |
4230 | 6376 if (od->sess->ssi.received_data) |
4889 | 6377 aim_ssi_addpermit(od->sess, who); |
4230 | 6378 #endif |
2086 | 6379 } |
6380 | |
5575 | 6381 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
4269 | 6382 #ifdef NOSSI |
8143 | 6383 if (gc->account->perm_deny == 4) |
4269 | 6384 oscar_set_permit_deny(gc); |
6385 #else | |
7283 | 6386 OscarData *od = (OscarData *)gc->proto_data; |
8660 | 6387 gaim_debug_info("oscar", "ssi: About to add a deny\n"); |
4230 | 6388 if (od->sess->ssi.received_data) |
4889 | 6389 aim_ssi_adddeny(od->sess, who); |
4230 | 6390 #endif |
2086 | 6391 } |
6392 | |
5575 | 6393 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
4269 | 6394 #ifdef NOSSI |
8143 | 6395 if (gc->account->perm_deny == 3) |
4269 | 6396 oscar_set_permit_deny(gc); |
6397 #else | |
7283 | 6398 OscarData *od = (OscarData *)gc->proto_data; |
8660 | 6399 gaim_debug_info("oscar", "ssi: About to delete a permit\n"); |
4230 | 6400 if (od->sess->ssi.received_data) |
4889 | 6401 aim_ssi_delpermit(od->sess, who); |
4230 | 6402 #endif |
2086 | 6403 } |
6404 | |
5575 | 6405 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
4269 | 6406 #ifdef NOSSI |
8143 | 6407 if (gc->account->perm_deny == 4) |
4269 | 6408 oscar_set_permit_deny(gc); |
6409 #else | |
7283 | 6410 OscarData *od = (OscarData *)gc->proto_data; |
8660 | 6411 gaim_debug_info("oscar", "ssi: About to delete a deny\n"); |
4230 | 6412 if (od->sess->ssi.received_data) |
4889 | 6413 aim_ssi_deldeny(od->sess, who); |
4230 | 6414 #endif |
2086 | 6415 } |
6416 | |
5575 | 6417 static GList *oscar_away_states(GaimConnection *gc) |
2086 | 6418 { |
7283 | 6419 OscarData *od = gc->proto_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6420 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6421 |
8257 | 6422 if (od->icq) { |
6423 m = g_list_append(m, _("Online")); | |
6424 m = g_list_append(m, _("Away")); | |
6425 m = g_list_append(m, _("Do Not Disturb")); | |
6426 m = g_list_append(m, _("Not Available")); | |
6427 m = g_list_append(m, _("Occupied")); | |
6428 m = g_list_append(m, _("Free For Chat")); | |
6429 m = g_list_append(m, _("Invisible")); | |
6430 } else { | |
6431 m = g_list_append(m, GAIM_AWAY_CUSTOM); | |
8476 | 6432 m = g_list_append(m, _("Back")); |
8257 | 6433 m = g_list_append(m, _("Visible")); |
6434 m = g_list_append(m, _("Invisible")); | |
6435 } | |
4333 | 6436 |
6437 return m; | |
6438 } | |
6439 | |
7172 | 6440 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { |
8341 | 6441 GaimConnection *gc = data->gc; |
6442 OscarData *od = gc->proto_data; | |
7172 | 6443 GaimBuddy *b; |
6444 GaimGroup *g; | |
6445 | |
6446 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { | |
6447 oscar_free_name_data(data); | |
6448 return; | |
6449 } | |
6450 | |
6451 if (!(g = gaim_find_buddys_group(b))) { | |
6452 oscar_free_name_data(data); | |
6453 return; | |
6454 } | |
6455 | |
6456 aim_ssi_editcomment(od->sess, g->name, data->name, text); | |
8341 | 6457 |
6458 if (!aim_sncmp(data->name, gc->account->username)) | |
6459 gaim_check_comment(od, text); | |
6460 | |
7172 | 6461 oscar_free_name_data(data); |
6462 } | |
6463 | |
6464 static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { | |
7283 | 6465 OscarData *od = gc->proto_data; |
7172 | 6466 struct name_data *data = g_new(struct name_data, 1); |
6467 GaimBuddy *b; | |
6468 GaimGroup *g; | |
6469 char *comment; | |
6470 gchar *comment_utf8; | |
6471 | |
6472 if (!(b = gaim_find_buddy(gaim_connection_get_account(gc), name))) | |
6473 return; | |
6474 if (!(g = gaim_find_buddys_group(b))) | |
6475 return; | |
6476 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, name); | |
6477 comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; | |
6478 | |
6479 data->gc = gc; | |
6480 data->name = g_strdup(name); | |
6481 data->nick = NULL; | |
6482 | |
6483 gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, | |
8697 | 6484 comment_utf8, TRUE, FALSE, NULL, |
7172 | 6485 _("OK"), G_CALLBACK(oscar_ssi_editcomment), |
6486 _("Cancel"), G_CALLBACK(oscar_free_name_data), | |
6487 data); | |
6488 | |
6489 free(comment); | |
6490 g_free(comment_utf8); | |
6491 } | |
6492 | |
5575 | 6493 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
7283 | 6494 OscarData *od = gc->proto_data; |
4333 | 6495 GList *m = NULL; |
6496 struct proto_buddy_menu *pbm; | |
6497 | |
7172 | 6498 pbm = g_new0(struct proto_buddy_menu, 1); |
6499 pbm->label = _("Edit Buddy Comment"); | |
6500 pbm->callback = oscar_buddycb_edit_comment; | |
6501 pbm->gc = gc; | |
6502 m = g_list_append(m, pbm); | |
6503 | |
4333 | 6504 if (od->icq) { |
4624 | 6505 #if 0 |
4333 | 6506 pbm = g_new0(struct proto_buddy_menu, 1); |
6507 pbm->label = _("Get Status Msg"); | |
4969 | 6508 pbm->callback = oscar_get_icqstatusmsg; |
4333 | 6509 pbm->gc = gc; |
6510 m = g_list_append(m, pbm); | |
4624 | 6511 #endif |
4333 | 6512 } else { |
6695 | 6513 GaimBuddy *b = gaim_find_buddy(gc->account, who); |
7011 | 6514 aim_userinfo_t *userinfo; |
5975 | 6515 |
6516 if (b) | |
7045 | 6517 userinfo = aim_locate_finduserinfo(od->sess, b->name); |
7011 | 6518 |
6519 if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { | |
6520 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { | |
5917 | 6521 pbm = g_new0(struct proto_buddy_menu, 1); |
6522 pbm->label = _("Direct IM"); | |
6523 pbm->callback = oscar_ask_direct_im; | |
6524 pbm->gc = gc; | |
6525 m = g_list_append(m, pbm); | |
6526 } | |
7650 | 6527 |
6528 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { | |
6529 pbm = g_new0(struct proto_buddy_menu, 1); | |
6530 pbm->label = _("Send File"); | |
6531 pbm->callback = oscar_ask_sendfile; | |
6532 pbm->gc = gc; | |
6533 m = g_list_append(m, pbm); | |
6534 } | |
4826 | 6535 #if 0 |
7011 | 6536 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
5917 | 6537 pbm = g_new0(struct proto_buddy_menu, 1); |
6538 pbm->label = _("Get File"); | |
6539 pbm->callback = oscar_ask_getfile; | |
6540 pbm->gc = gc; | |
6541 m = g_list_append(m, pbm); | |
6542 } | |
4826 | 6543 #endif |
4333 | 6544 } |
5131 | 6545 } |
5197 | 6546 |
5131 | 6547 if (od->sess->ssi.received_data) { |
6548 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); | |
6549 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { | |
6550 pbm = g_new0(struct proto_buddy_menu, 1); | |
6873 | 6551 pbm->label = _("Re-request Authorization"); |
5131 | 6552 pbm->callback = gaim_auth_sendrequest; |
6553 pbm->gc = gc; | |
6554 m = g_list_append(m, pbm); | |
4333 | 6555 } |
4916 | 6556 } |
6557 | |
4333 | 6558 return m; |
6559 } | |
6560 | |
5575 | 6561 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
7283 | 6562 OscarData *od = gc->proto_data; |
5575 | 6563 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
4333 | 6564 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
6565 od->setnick = TRUE; | |
6566 od->newsn = g_strdup(nick); | |
6567 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6568 } else { | |
6569 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
6570 } | |
6571 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6572 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
8152 | 6573 _("Screen name formatting can change only capitalization and whitespace.")); |
4333 | 6574 } |
6575 } | |
6576 | |
5575 | 6577 static void oscar_show_format_screenname(GaimConnection *gc) |
4333 | 6578 { |
8152 | 6579 gaim_request_input(gc, NULL, _("New screen name formatting:"), NULL, |
8697 | 6580 gaim_connection_get_display_name(gc), FALSE, FALSE, NULL, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6581 _("OK"), G_CALLBACK(oscar_format_screenname), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6582 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6583 gc); |
4333 | 6584 } |
6585 | |
5575 | 6586 static void oscar_confirm_account(GaimConnection *gc) |
4333 | 6587 { |
7283 | 6588 OscarData *od = gc->proto_data; |
4333 | 6589 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6590 | |
6591 if (conn) { | |
6592 aim_admin_reqconfirm(od->sess, conn); | |
6593 } else { | |
6594 od->conf = TRUE; | |
6595 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6596 } | |
6597 } | |
6598 | |
5575 | 6599 static void oscar_show_email(GaimConnection *gc) |
4333 | 6600 { |
7283 | 6601 OscarData *od = gc->proto_data; |
4333 | 6602 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6603 | |
6604 if (conn) { | |
6605 aim_admin_getinfo(od->sess, conn, 0x11); | |
6606 } else { | |
6607 od->reqemail = TRUE; | |
6608 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6609 } | |
6610 } | |
6611 | |
5575 | 6612 static void oscar_change_email(GaimConnection *gc, const char *email) |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6613 { |
7283 | 6614 OscarData *od = gc->proto_data; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6615 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
|
6616 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6617 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6618 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6619 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6620 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6621 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6622 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6623 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6624 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6625 |
5575 | 6626 static void oscar_show_change_email(GaimConnection *gc) |
4333 | 6627 { |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6628 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, |
8697 | 6629 FALSE, FALSE, NULL, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6630 _("OK"), G_CALLBACK(oscar_change_email), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6631 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6632 gc); |
4333 | 6633 } |
6634 | |
5575 | 6635 static void oscar_show_awaitingauth(GaimConnection *gc) |
4333 | 6636 { |
7283 | 6637 OscarData *od = gc->proto_data; |
4333 | 6638 gchar *nombre, *text, *tmp; |
6695 | 6639 GaimBlistNode *gnode, *cnode, *bnode; |
4333 | 6640 int num=0; |
6641 | |
6873 | 6642 text = g_strdup(""); |
4333 | 6643 |
4785 | 6644 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
6695 | 6645 GaimGroup *group = (GaimGroup *)gnode; |
4785 | 6646 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
6647 continue; | |
6695 | 6648 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
6649 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 6650 continue; |
6695 | 6651 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
6652 GaimBuddy *buddy = (GaimBuddy *)bnode; | |
6653 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
6654 continue; | |
6655 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { | |
6656 if (gaim_get_buddy_alias_only(buddy)) | |
6657 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
6658 else | |
6659 nombre = g_strdup_printf(" %s", buddy->name); | |
6873 | 6660 tmp = g_strdup_printf("%s%s<br>", text, nombre); |
6695 | 6661 g_free(text); |
6662 text = tmp; | |
6663 g_free(nombre); | |
6664 num++; | |
6665 } | |
4333 | 6666 } |
2979 | 6667 } |
4333 | 6668 } |
6669 | |
6670 if (!num) { | |
6671 g_free(text); | |
6873 | 6672 text = g_strdup(_("<i>you are not waiting for authorization</i>")); |
6673 } | |
6674 | |
6675 gaim_notify_formatted(gc, NULL, _("You are awaiting authorization from " | |
6676 "the following buddies"), _("You can re-request " | |
6677 "authorization from these buddies by " | |
6678 "right-clicking on them and selecting " | |
6679 "\"Re-request Authorization.\""), text, NULL, NULL); | |
4333 | 6680 g_free(text); |
2979 | 6681 } |
6682 | |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6683 static void search_by_email_cb(GaimConnection *gc, const char *email) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6684 { |
8950 | 6685 OscarData *od = (OscarData *)gc->proto_data; |
6686 | |
6687 aim_search_address(od->sess, od->conn, email); | |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6688 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6689 |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6690 static void oscar_show_find_email(GaimConnection *gc) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6691 { |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6692 gaim_request_input(gc, _("Find Buddy by E-mail"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6693 _("Search for a buddy by e-mail address"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6694 _("Type the e-mail address of the buddy you are " |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6695 "searching for."), |
8697 | 6696 NULL, FALSE, FALSE, NULL, |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6697 _("Search"), G_CALLBACK(search_by_email_cb), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6698 _("Cancel"), NULL, gc); |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6699 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6700 |
7366 | 6701 #if 0 |
5917 | 6702 static void oscar_setavailmsg(GaimConnection *gc, char *text) { |
7283 | 6703 OscarData *od = (OscarData *)gc->proto_data; |
5917 | 6704 |
7334 | 6705 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
5917 | 6706 aim_srv_setavailmsg(od->sess, text); |
6707 } | |
6708 | |
6709 static void oscar_show_setavailmsg(GaimConnection *gc) | |
6710 { | |
7313 | 6711 gaim_request_input(gc, NULL, _("Available Message:"), NULL, |
6712 _("I'm doing work and hoping for a distraction--IM me!"), | |
8697 | 6713 TRUE, FALSE, NULL, |
5917 | 6714 _("OK"), G_CALLBACK(oscar_setavailmsg), |
6715 _("Cancel"), NULL, | |
6716 gc); | |
6717 } | |
7366 | 6718 #endif |
5917 | 6719 |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6720 static void oscar_show_set_info(GaimConnection *gc) |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6721 { |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6722 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6723 } |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6724 |
8576 | 6725 static void oscar_show_set_info_icqurl(GaimConnection *gc) |
6726 { | |
6727 gaim_notify_uri(gc, "http://web.icq.com/whitepages/login/1,,,00.html"); | |
6728 } | |
6729 | |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6730 static void oscar_change_pass(GaimConnection *gc) |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6731 { |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6732 gaim_account_request_change_password(gaim_connection_get_account(gc)); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6733 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6734 |
5575 | 6735 static void oscar_show_chpassurl(GaimConnection *gc) |
4333 | 6736 { |
7283 | 6737 OscarData *od = gc->proto_data; |
5575 | 6738 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
|
6739 gaim_notify_uri(gc, substituted); |
5517 | 6740 g_free(substituted); |
4333 | 6741 } |
6742 | |
7026 | 6743 static void oscar_show_imforwardingurl(GaimConnection *gc) |
6744 { | |
6745 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); | |
6746 } | |
6747 | |
5842 | 6748 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) |
6749 { | |
7283 | 6750 OscarData *od = gc->proto_data; |
5844 | 6751 aim_session_t *sess = od->sess; |
5842 | 6752 FILE *file; |
6753 struct stat st; | |
5844 | 6754 |
6039 | 6755 if (iconfile == NULL) { |
8363 | 6756 aim_ssi_delicon(od->sess); |
6039 | 6757 } else if (!stat(iconfile, &st)) { |
5842 | 6758 char *buf = g_malloc(st.st_size); |
6759 file = fopen(iconfile, "rb"); | |
6760 if (file) { | |
6052 | 6761 md5_state_t *state; |
6039 | 6762 char md5[16]; |
5842 | 6763 int len = fread(buf, 1, st.st_size, file); |
6039 | 6764 fclose(file); |
6052 | 6765 state = g_malloc(sizeof(md5_state_t)); |
5842 | 6766 md5_init(state); |
6767 md5_append(state, buf, len); | |
6768 md5_finish(state, md5); | |
6769 g_free(state); | |
6770 aim_ssi_seticon(sess, md5, 16); | |
6771 } else | |
8660 | 6772 gaim_debug_error("oscar", |
5842 | 6773 "Can't open buddy icon file!\n"); |
6774 g_free(buf); | |
6775 } else | |
8660 | 6776 gaim_debug_error("oscar", |
5842 | 6777 "Can't stat buddy icon file!\n"); |
6778 } | |
6779 | |
6780 | |
5575 | 6781 static GList *oscar_actions(GaimConnection *gc) |
2086 | 6782 { |
7283 | 6783 OscarData *od = gc->proto_data; |
4333 | 6784 struct proto_actions_menu *pam; |
6785 GList *m = NULL; | |
6786 | |
6787 pam = g_new0(struct proto_actions_menu, 1); | |
7853 | 6788 pam->label = _("Set User Info..."); |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6789 pam->callback = oscar_show_set_info; |
4333 | 6790 pam->gc = gc; |
6791 m = g_list_append(m, pam); | |
6792 | |
8576 | 6793 if (od->icq) { |
6794 pam = g_new0(struct proto_actions_menu, 1); | |
6795 pam->label = _("Set User Info (URL)..."); | |
6796 pam->callback = oscar_show_set_info_icqurl; | |
6797 pam->gc = gc; | |
6798 m = g_list_append(m, pam); | |
6799 } | |
6800 | |
7366 | 6801 #if 0 |
5917 | 6802 pam = g_new0(struct proto_actions_menu, 1); |
7853 | 6803 pam->label = _("Set Available Message..."); |
5917 | 6804 pam->callback = oscar_show_setavailmsg; |
6805 pam->gc = gc; | |
6806 m = g_list_append(m, pam); | |
7366 | 6807 #endif |
5917 | 6808 |
5238 | 6809 pam = g_new0(struct proto_actions_menu, 1); |
7853 | 6810 pam->label = _("Change Password..."); |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6811 pam->callback = oscar_change_pass; |
5238 | 6812 pam->gc = gc; |
6813 m = g_list_append(m, pam); | |
4617 | 6814 |
6815 if (od->sess->authinfo->chpassurl) { | |
6816 pam = g_new0(struct proto_actions_menu, 1); | |
6817 pam->label = _("Change Password (URL)"); | |
6818 pam->callback = oscar_show_chpassurl; | |
6819 pam->gc = gc; | |
6820 m = g_list_append(m, pam); | |
6821 } | |
6822 | |
7026 | 6823 if (od->sess->authinfo->chpassurl) { |
6824 pam = g_new0(struct proto_actions_menu, 1); | |
6825 pam->label = _("Configure IM Forwarding (URL)"); | |
6826 pam->callback = oscar_show_imforwardingurl; | |
6827 pam->gc = gc; | |
6828 m = g_list_append(m, pam); | |
6829 } | |
6830 | |
5238 | 6831 if (!od->icq) { |
4617 | 6832 /* AIM actions */ |
6833 m = g_list_append(m, NULL); | |
4333 | 6834 |
5917 | 6835 pam = g_new0(struct proto_actions_menu, 1); |
8152 | 6836 pam->label = _("Format Screen Name..."); |
5844 | 6837 pam->callback = oscar_show_format_screenname; |
4333 | 6838 pam->gc = gc; |
6839 m = g_list_append(m, pam); | |
6840 | |
6841 pam = g_new0(struct proto_actions_menu, 1); | |
6842 pam->label = _("Confirm Account"); | |
6843 pam->callback = oscar_confirm_account; | |
6844 pam->gc = gc; | |
6845 m = g_list_append(m, pam); | |
6846 | |
6847 pam = g_new0(struct proto_actions_menu, 1); | |
7880 | 6848 pam->label = _("Display Currently Registered Address"); |
4333 | 6849 pam->callback = oscar_show_email; |
6850 pam->gc = gc; | |
6851 m = g_list_append(m, pam); | |
6852 | |
6853 pam = g_new0(struct proto_actions_menu, 1); | |
7880 | 6854 pam->label = _("Change Currently Registered Address..."); |
4333 | 6855 pam->callback = oscar_show_change_email; |
6856 pam->gc = gc; | |
6857 m = g_list_append(m, pam); | |
2086 | 6858 } |
4333 | 6859 |
6860 m = g_list_append(m, NULL); | |
6861 | |
6862 pam = g_new0(struct proto_actions_menu, 1); | |
6863 pam->label = _("Show Buddies Awaiting Authorization"); | |
6864 pam->callback = oscar_show_awaitingauth; | |
6865 pam->gc = gc; | |
6866 m = g_list_append(m, pam); | |
6867 | |
2086 | 6868 m = g_list_append(m, NULL); |
4333 | 6869 |
6870 pam = g_new0(struct proto_actions_menu, 1); | |
7853 | 6871 pam->label = _("Search for Buddy by Email..."); |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6872 pam->callback = oscar_show_find_email; |
4333 | 6873 pam->gc = gc; |
6874 m = g_list_append(m, pam); | |
6875 | |
8591 | 6876 #if 0 |
6877 pam = g_new0(struct proto_actions_menu, 1); | |
4333 | 6878 pam->label = _("Search for Buddy by Information"); |
6879 pam->callback = show_find_info; | |
6880 pam->gc = gc; | |
8591 | 6881 m = g_list_append(m, pam); |
6882 #endif | |
2086 | 6883 |
6884 return m; | |
6885 } | |
6886 | |
5575 | 6887 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2086 | 6888 { |
7283 | 6889 OscarData *od = gc->proto_data; |
4617 | 6890 |
6891 if (od->icq) { | |
6892 aim_icq_changepasswd(od->sess, new); | |
2086 | 6893 } else { |
4617 | 6894 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6895 if (conn) { | |
6896 aim_admin_changepasswd(od->sess, conn, new, old); | |
6897 } else { | |
6898 od->chpass = TRUE; | |
6899 od->oldp = g_strdup(old); | |
6900 od->newp = g_strdup(new); | |
6901 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6902 } | |
2086 | 6903 } |
6904 } | |
6905 | |
6059 | 6906 static void oscar_convo_closed(GaimConnection *gc, const char *who) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6907 { |
7283 | 6908 OscarData *od = gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6909 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6910 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6911 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6912 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6913 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6914 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6915 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6916 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6917 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6918 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6919 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6920 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6921 { |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
6922 GAIM_PRPL_API_VERSION, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6923 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
|
6924 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6925 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6926 oscar_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6927 oscar_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6928 oscar_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6929 oscar_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6930 oscar_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6931 oscar_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6932 oscar_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6933 oscar_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6934 oscar_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6935 oscar_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6936 oscar_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6937 oscar_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6938 oscar_send_typing, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6939 oscar_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6940 oscar_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6941 oscar_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6942 oscar_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6943 oscar_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6944 oscar_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6945 oscar_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6946 oscar_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6947 oscar_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6948 oscar_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6949 oscar_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6950 oscar_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6951 oscar_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6952 oscar_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6953 oscar_join_chat, |
8562 | 6954 NULL, /* reject chat invite */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6955 oscar_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6956 oscar_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6957 NULL, |
8219 | 6958 oscar_send_chat, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6959 oscar_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6960 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6961 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6962 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6963 #ifndef NOSSI |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6964 oscar_alias_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6965 oscar_move_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6966 oscar_rename_group, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6967 #else |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6968 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6969 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6970 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6971 #endif |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6972 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6973 oscar_convo_closed, |
5842 | 6974 NULL, |
8586 | 6975 oscar_set_icon, |
8589 | 6976 NULL, |
6977 NULL, | |
6978 NULL, | |
6979 NULL, | |
6980 NULL, | |
6981 NULL, | |
6982 NULL, | |
6983 NULL | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6984 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6985 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6986 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6987 { |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
6988 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6989 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6990 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6991 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6992 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6993 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6994 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6995 "prpl-oscar", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6996 "AIM/ICQ", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6997 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6998 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6999 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7000 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7001 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7002 NULL, /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
7003 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7004 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7005 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7006 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7007 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7008 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7009 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7010 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7011 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7012 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7013 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
7014 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7015 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7016 GaimAccountOption *option; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7017 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
7018 option = gaim_account_option_string_new(_("Auth host"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7019 "login.oscar.aol.com"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7020 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7021 option); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7022 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
7023 option = gaim_account_option_int_new(_("Auth port"), "port", 5190); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7024 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7025 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7026 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7027 my_protocol = plugin; |
2086 | 7028 } |
7029 | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
7030 GAIM_INIT_PLUGIN(oscar, init_plugin, info); |