[07ab1cb] | 1 | /* |
---|
| 2 | Â * gaim |
---|
| 3 | Â * |
---|
| 4 | Â * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> |
---|
| 5 | Â * Some code copyright (C) 1999-2001, Eric Warmenhoven |
---|
| 6 | Â * Some code copyright (C) 2001-2003, Sean Egan |
---|
| 7 | Â * Some code copyright (C) 2001-2003, Mark Doliner <thekingant@users.sourceforge.net> |
---|
| 8 | Â * |
---|
| 9 | Â * Most libfaim code copyright (C) 1998-2001 Adam Fritzler <afritz@auk.cx> |
---|
| 10 | Â * Some libfaim code copyright (C) 2001-2003 Mark Doliner <thekingant@users.sourceforge.net> |
---|
| 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 | Â */ |
---|
| 27 | #include "internal.h" |
---|
| 28 | |
---|
| 29 | #include "account.h" |
---|
| 30 | #include "accountopt.h" |
---|
| 31 | #include "buddyicon.h" |
---|
| 32 | #include "conversation.h" |
---|
| 33 | #include "debug.h" |
---|
| 34 | #include "ft.h" |
---|
| 35 | #include "imgstore.h" |
---|
| 36 | #include "multi.h" |
---|
| 37 | #include "notify.h" |
---|
| 38 | #include "privacy.h" |
---|
| 39 | #include "prpl.h" |
---|
| 40 | #include "proxy.h" |
---|
| 41 | #include "request.h" |
---|
| 42 | #include "util.h" |
---|
| 43 | #include "html.h" |
---|
| 44 | |
---|
| 45 | #include "aim.h" |
---|
| 46 | #include "md5.h" |
---|
| 47 | |
---|
| 48 | /* XXX CORE/UI */ |
---|
| 49 | #include "gtkinternal.h" |
---|
| 50 | #include "gaim.h" |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | #define UC_AOLÂ Â Â Â Â 0x02 |
---|
| 54 | #define UC_ADMINÂ Â Â Â 0x04 |
---|
| 55 | #define UC_UNCONFIRMEDÂ 0x08 |
---|
| 56 | #define UC_NORMALÂ Â Â Â 0x10 |
---|
| 57 | #define UC_ABÂ Â Â Â Â Â 0x20 |
---|
| 58 | #define UC_WIRELESSÂ Â Â 0x40 |
---|
| 59 | #define UC_HIPTOPÂ Â Â Â 0x80 |
---|
| 60 | |
---|
| 61 | #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
---|
| 62 | |
---|
| 63 | static GaimPlugin *my_protocol = NULL; |
---|
| 64 | |
---|
| 65 | static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE; |
---|
| 66 | static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE; |
---|
| 67 | |
---|
| 68 | static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
---|
| 69 | static fu8_t features_icq[] = {0x01, 0x06}; |
---|
| 70 | |
---|
| 71 | struct oscar_data { |
---|
| 72 |     aim_session_t *sess; |
---|
| 73 |     aim_conn_t *conn; |
---|
| 74 | |
---|
| 75 | Â Â Â Â guint cnpa; |
---|
| 76 | Â Â Â Â guint paspa; |
---|
| 77 | Â Â Â Â guint emlpa; |
---|
| 78 | Â Â Â Â guint icopa; |
---|
| 79 | |
---|
| 80 | Â Â Â Â gboolean iconconnecting; |
---|
| 81 | Â Â Â Â gboolean set_icon; |
---|
| 82 | |
---|
| 83 | Â Â Â Â GSList *create_rooms; |
---|
| 84 | |
---|
| 85 | Â Â Â Â gboolean conf; |
---|
| 86 | Â Â Â Â gboolean reqemail; |
---|
| 87 | Â Â Â Â gboolean setemail; |
---|
| 88 |     char *email; |
---|
| 89 | Â Â Â Â gboolean setnick; |
---|
| 90 |     char *newsn; |
---|
| 91 | Â Â Â Â gboolean chpass; |
---|
| 92 |     char *oldp; |
---|
| 93 |     char *newp; |
---|
| 94 | Â Â Â Â |
---|
| 95 | Â Â Â Â GSList *oscar_chats; |
---|
| 96 | Â Â Â Â GSList *direct_ims; |
---|
| 97 | Â Â Â Â GSList *file_transfers; |
---|
| 98 | Â Â Â Â GHashTable *buddyinfo; |
---|
| 99 | Â Â Â Â GSList *requesticon; |
---|
| 100 | |
---|
| 101 | Â Â Â Â gboolean killme; |
---|
| 102 | Â Â Â Â gboolean icq; |
---|
| 103 | Â Â Â Â GSList *evilhack; |
---|
| 104 | Â Â Â Â guint icontimer; |
---|
| 105 | Â Â Â Â guint getblisttimer; |
---|
| 106 | |
---|
| 107 |     struct { |
---|
| 108 | Â Â Â Â Â Â Â Â guint maxwatchers;Â /* max users who can watch you */ |
---|
| 109 | Â Â Â Â Â Â Â Â guint maxbuddies;Â /* max users you can watch */ |
---|
| 110 | Â Â Â Â Â Â Â Â guint maxgroups;Â /* max groups in server list */ |
---|
| 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; |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | struct create_room { |
---|
| 119 |     char *name; |
---|
| 120 |     int exchange; |
---|
| 121 | }; |
---|
| 122 | |
---|
| 123 | struct chat_connection { |
---|
| 124 |     char *name; |
---|
| 125 |     char *show; /* AOL did something funny to us */ |
---|
| 126 |     fu16_t exchange; |
---|
| 127 |     fu16_t instance; |
---|
| 128 |     int fd; /* this is redundant since we have the conn below */ |
---|
| 129 |     aim_conn_t *conn; |
---|
| 130 |     int inpa; |
---|
| 131 |     int id; |
---|
| 132 | Â Â Â Â GaimConnection *gc;Â /* i hate this. */ |
---|
| 133 | Â Â Â Â GaimConversation *cnv;Â /* bah. */ |
---|
| 134 |     int maxlen; |
---|
| 135 |     int maxvis; |
---|
| 136 | }; |
---|
| 137 | |
---|
| 138 | struct direct_im { |
---|
| 139 | Â Â Â Â GaimConnection *gc; |
---|
| 140 |     char name[80]; |
---|
| 141 |     int watcher; |
---|
| 142 |     aim_conn_t *conn; |
---|
| 143 | Â Â Â Â gboolean connected; |
---|
| 144 | }; |
---|
| 145 | |
---|
| 146 | struct ask_direct { |
---|
| 147 | Â Â Â Â GaimConnection *gc; |
---|
| 148 |     char *sn; |
---|
| 149 |     char ip[64]; |
---|
| 150 |     fu8_t cookie[8]; |
---|
| 151 | }; |
---|
| 152 | |
---|
| 153 | /* Various PRPL-specific buddy info that we want to keep track of */ |
---|
| 154 | struct buddyinfo { |
---|
| 155 |     time_t signon; |
---|
| 156 |     int caps; |
---|
| 157 | Â Â Â Â gboolean typingnot; |
---|
| 158 | Â Â Â Â gchar *availmsg; |
---|
| 159 |     fu32_t ipaddr; |
---|
| 160 | |
---|
| 161 |     unsigned long ico_me_len; |
---|
| 162 |     unsigned long ico_me_csum; |
---|
| 163 |     time_t ico_me_time; |
---|
| 164 | Â Â Â Â gboolean ico_informed; |
---|
| 165 | |
---|
| 166 |     unsigned long ico_len; |
---|
| 167 |     unsigned long ico_csum; |
---|
| 168 |     time_t ico_time; |
---|
| 169 | Â Â Â Â gboolean ico_need; |
---|
| 170 | |
---|
| 171 |     fu16_t iconcsumlen; |
---|
| 172 |     fu8_t *iconcsum; |
---|
| 173 | }; |
---|
| 174 | |
---|
| 175 | struct name_data { |
---|
| 176 | Â Â Â Â GaimConnection *gc; |
---|
| 177 | Â Â Â Â gchar *name; |
---|
| 178 | Â Â Â Â gchar *nick; |
---|
| 179 | }; |
---|
| 180 | |
---|
| 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 *, ...); |
---|
| 221 | static int gaim_parse_user_info (aim_session_t *, aim_frame_t *, ...); |
---|
| 222 | static int gaim_parse_motd    (aim_session_t *, aim_frame_t *, ...); |
---|
| 223 | static int gaim_chatnav_info   (aim_session_t *, aim_frame_t *, ...); |
---|
| 224 | static int gaim_chat_join    (aim_session_t *, aim_frame_t *, ...); |
---|
| 225 | static int gaim_chat_leave    (aim_session_t *, aim_frame_t *, ...); |
---|
| 226 | static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...); |
---|
| 227 | static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); |
---|
| 228 | static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); |
---|
| 229 | static int gaim_icon_error    (aim_session_t *, aim_frame_t *, ...); |
---|
| 230 | static int gaim_icon_parseicon  (aim_session_t *, aim_frame_t *, ...); |
---|
| 231 | static int oscar_icon_req    (aim_session_t *, aim_frame_t *, ...); |
---|
| 232 | static int gaim_parse_msgack   (aim_session_t *, aim_frame_t *, ...); |
---|
| 233 | static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); |
---|
| 234 | static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); |
---|
| 235 | static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); |
---|
| 236 | static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); |
---|
| 237 | static int gaim_bosrights    (aim_session_t *, aim_frame_t *, ...); |
---|
| 238 | static int gaim_connerr     (aim_session_t *, aim_frame_t *, ...); |
---|
| 239 | static int conninitdone_admin  (aim_session_t *, aim_frame_t *, ...); |
---|
| 240 | static int conninitdone_bos   (aim_session_t *, aim_frame_t *, ...); |
---|
| 241 | static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); |
---|
| 242 | static int conninitdone_chat   (aim_session_t *, aim_frame_t *, ...); |
---|
| 243 | static int conninitdone_email  (aim_session_t *, aim_frame_t *, ...); |
---|
| 244 | static int conninitdone_icon   (aim_session_t *, aim_frame_t *, ...); |
---|
| 245 | static int gaim_parse_msgerr   (aim_session_t *, aim_frame_t *, ...); |
---|
| 246 | static int gaim_parse_mtn    (aim_session_t *, aim_frame_t *, ...); |
---|
| 247 | static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); |
---|
| 248 | static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); |
---|
| 249 | static int gaim_parse_locerr   (aim_session_t *, aim_frame_t *, ...); |
---|
| 250 | static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); |
---|
| 251 | static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); |
---|
| 252 | static int gaim_memrequest    (aim_session_t *, aim_frame_t *, ...); |
---|
| 253 | static int gaim_selfinfo     (aim_session_t *, aim_frame_t *, ...); |
---|
| 254 | static int gaim_offlinemsg    (aim_session_t *, aim_frame_t *, ...); |
---|
| 255 | static int gaim_offlinemsgdone  (aim_session_t *, aim_frame_t *, ...); |
---|
| 256 | static int gaim_icqalias     (aim_session_t *, aim_frame_t *, ...); |
---|
| 257 | static int gaim_icqinfo     (aim_session_t *, aim_frame_t *, ...); |
---|
| 258 | static int gaim_popup      (aim_session_t *, aim_frame_t *, ...); |
---|
| 259 | #ifndef NOSSI |
---|
| 260 | static int gaim_ssi_parseerr   (aim_session_t *, aim_frame_t *, ...); |
---|
| 261 | static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); |
---|
| 262 | static int gaim_ssi_parselist  (aim_session_t *, aim_frame_t *, ...); |
---|
| 263 | static int gaim_ssi_parseack   (aim_session_t *, aim_frame_t *, ...); |
---|
| 264 | static int gaim_ssi_authgiven  (aim_session_t *, aim_frame_t *, ...); |
---|
| 265 | static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); |
---|
| 266 | static int gaim_ssi_authreply  (aim_session_t *, aim_frame_t *, ...); |
---|
| 267 | static int gaim_ssi_gotadded   (aim_session_t *, aim_frame_t *, ...); |
---|
| 268 | #endif |
---|
| 269 | |
---|
| 270 | /* for DirectIM/image transfer */ |
---|
| 271 | static int gaim_odc_initiate   (aim_session_t *, aim_frame_t *, ...); |
---|
| 272 | static int gaim_odc_incoming   (aim_session_t *, aim_frame_t *, ...); |
---|
| 273 | static int gaim_odc_typing    (aim_session_t *, aim_frame_t *, ...); |
---|
| 274 | static int gaim_odc_update_ui  (aim_session_t *, aim_frame_t *, ...); |
---|
| 275 | |
---|
| 276 | /* for file transfer */ |
---|
| 277 | static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); |
---|
| 278 | static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); |
---|
| 279 | static int oscar_sendfile_ack  (aim_session_t *, aim_frame_t *, ...); |
---|
| 280 | static int oscar_sendfile_done  (aim_session_t *, aim_frame_t *, ...); |
---|
| 281 | |
---|
| 282 | /* for icons */ |
---|
| 283 | static gboolean gaim_icon_timerfunc(gpointer data); |
---|
| 284 | |
---|
| 285 | /* prpl actions - remove this at some point */ |
---|
| 286 | static void oscar_set_info(GaimConnection *gc, const char *text); |
---|
| 287 | |
---|
| 288 | static void oscar_free_name_data(struct name_data *data) { |
---|
| 289 | Â Â Â Â g_free(data->name); |
---|
| 290 | Â Â Â Â g_free(data->nick); |
---|
| 291 | Â Â Â Â g_free(data); |
---|
| 292 | } |
---|
| 293 | |
---|
| 294 | static void oscar_free_buddyinfo(void *data) { |
---|
| 295 |     struct buddyinfo *bi = data; |
---|
| 296 | Â Â Â Â g_free(bi->availmsg); |
---|
| 297 | Â Â Â Â g_free(bi->iconcsum); |
---|
| 298 | Â Â Â Â g_free(bi); |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | static fu32_t oscar_encoding_check(const char *utf8) |
---|
| 302 | { |
---|
| 303 |     int i = 0; |
---|
| 304 |     fu32_t encodingflag = 0; |
---|
| 305 | |
---|
| 306 |     /* Determine how we can send this message. Per the warnings elsewhere |
---|
| 307 | Â Â Â Â Â * in this file, these little checks determine the simplest encoding |
---|
| 308 | Â Â Â Â Â * we can use for a given message send using it. */ |
---|
| 309 |     while (utf8[i]) { |
---|
| 310 |         if ((unsigned char)utf8[i] > 0x7f) { |
---|
| 311 | Â Â Â Â Â Â Â Â Â Â Â Â /* not ASCII! */ |
---|
| 312 | Â Â Â Â Â Â Â Â Â Â Â Â encodingflag =Â AIM_IMFLAGS_ISO_8859_1; |
---|
| 313 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 314 | Â Â Â Â Â Â Â Â } |
---|
| 315 | Â Â Â Â Â Â Â Â i++; |
---|
| 316 | Â Â Â Â } |
---|
| 317 |     while (utf8[i]) { |
---|
| 318 | Â Â Â Â Â Â Â Â /* ISO-8859-1 is 0x00-0xbf in the first byte |
---|
| 319 | Â Â Â Â Â Â Â Â Â * followed by 0xc0-0xc3 in the second */ |
---|
| 320 |         if ((unsigned char)utf8[i] < 0x80) { |
---|
| 321 | Â Â Â Â Â Â Â Â Â Â Â Â i++; |
---|
| 322 | Â Â Â Â Â Â Â Â Â Â Â Â continue; |
---|
| 323 |         } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && |
---|
| 324 |               ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { |
---|
| 325 | Â Â Â Â Â Â Â Â Â Â Â Â i +=Â 2; |
---|
| 326 | Â Â Â Â Â Â Â Â Â Â Â Â continue; |
---|
| 327 | Â Â Â Â Â Â Â Â } |
---|
| 328 | Â Â Â Â Â Â Â Â encodingflag =Â AIM_IMFLAGS_UNICODE; |
---|
| 329 | Â Â Â Â Â Â Â Â break; |
---|
| 330 | Â Â Â Â } |
---|
| 331 | |
---|
| 332 |     return encodingflag; |
---|
| 333 | } |
---|
| 334 | |
---|
| 335 | static fu32_t oscar_encoding_parse(const char *enc) |
---|
| 336 | { |
---|
| 337 |     char *charset; |
---|
| 338 | |
---|
| 339 | Â Â Â Â /* If anything goes wrong, fall back on ASCII and print a message */ |
---|
| 340 |     if (enc == NULL) { |
---|
| 341 |         gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 342 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Encoding was null, that's odd\n"); |
---|
| 343 |         return 0; |
---|
| 344 | Â Â Â Â } |
---|
| 345 |     charset = strstr(enc, "charset="); |
---|
| 346 |     if (charset == NULL) { |
---|
| 347 |         gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 348 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "No charset specified for info, assuming ASCII\n"); |
---|
| 349 |         return 0; |
---|
| 350 | Â Â Â Â } |
---|
| 351 | Â Â Â Â charset +=Â 8; |
---|
| 352 |     if (!strcmp(charset, "\"us-ascii\"") || !strcmp(charset, "\"utf-8\"")) { |
---|
| 353 | Â Â Â Â Â Â Â Â /* UTF-8 is our native charset, ASCII is a proper subset */ |
---|
| 354 |         return 0; |
---|
| 355 |     } else if (!strcmp(charset, "\"iso-8859-1\"")) { |
---|
| 356 |         return AIM_IMFLAGS_ISO_8859_1; |
---|
| 357 |     } else if (!strcmp(charset, "\"unicode-2-0\"")) { |
---|
| 358 |         return AIM_IMFLAGS_UNICODE; |
---|
| 359 |     } else { |
---|
| 360 |         gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 361 |                   "Unrecognized character set '%s', using ASCII\n", charset); |
---|
| 362 |         return 0; |
---|
| 363 | Â Â Â Â } |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | gchar *oscar_encoding_to_utf8(const char *encoding, char *text, int textlen) |
---|
| 367 | { |
---|
| 368 | Â Â Â Â gchar *utf8 =Â NULL; |
---|
| 369 |     int flags = oscar_encoding_parse(encoding); |
---|
| 370 | |
---|
| 371 |     switch (flags) { |
---|
| 372 |     case 0: |
---|
| 373 |         utf8 = g_strndup(text, textlen); |
---|
| 374 | Â Â Â Â Â Â Â Â break; |
---|
| 375 |     case AIM_IMFLAGS_ISO_8859_1: |
---|
| 376 |         utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); |
---|
| 377 | Â Â Â Â Â Â Â Â break; |
---|
| 378 |     case AIM_IMFLAGS_UNICODE: |
---|
| 379 |         utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); |
---|
| 380 | Â Â Â Â Â Â Â Â break; |
---|
| 381 | Â Â Â Â } |
---|
| 382 | |
---|
| 383 |     return utf8; |
---|
| 384 | } |
---|
| 385 | |
---|
| 386 | static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { |
---|
| 387 | Â Â Â Â GSList *d =Â od->direct_ims; |
---|
| 388 |     struct direct_im *m = NULL; |
---|
| 389 | |
---|
| 390 |     while (d) { |
---|
| 391 |         m = (struct direct_im *)d->data; |
---|
| 392 |         if (!aim_sncmp(who, m->name)) |
---|
| 393 |             return m; |
---|
| 394 | Â Â Â Â Â Â Â Â d =Â d->next; |
---|
| 395 | Â Â Â Â } |
---|
| 396 | |
---|
| 397 |     return NULL; |
---|
| 398 | } |
---|
| 399 | |
---|
| 400 | static char *extract_name(const char *name) { |
---|
| 401 |     char *tmp, *x; |
---|
| 402 |     int i, j; |
---|
| 403 | |
---|
| 404 |     if (!name) |
---|
| 405 |         return NULL; |
---|
| 406 | Â Â Â Â |
---|
| 407 |     x = strchr(name, '-'); |
---|
| 408 | |
---|
| 409 |     if (!x) return NULL; |
---|
| 410 |     x = strchr(++x, '-'); |
---|
| 411 |     if (!x) return NULL; |
---|
| 412 | Â Â Â Â tmp =Â g_strdup(++x); |
---|
| 413 | |
---|
| 414 |     for (i = 0, j = 0; x[i]; i++) { |
---|
| 415 |         char hex[3]; |
---|
| 416 |         if (x[i] != '%') { |
---|
| 417 | Â Â Â Â Â Â Â Â Â Â Â Â tmp[j++]Â =Â x[i]; |
---|
| 418 | Â Â Â Â Â Â Â Â Â Â Â Â continue; |
---|
| 419 | Â Â Â Â Â Â Â Â } |
---|
| 420 |         strncpy(hex, x + ++i, 2); hex[2] = 0; |
---|
| 421 | Â Â Â Â Â Â Â Â i++; |
---|
| 422 |         tmp[j++] = strtol(hex, NULL, 16); |
---|
| 423 | Â Â Â Â } |
---|
| 424 | |
---|
| 425 | Â Â Â Â tmp[j]Â =Â 0; |
---|
| 426 |     return tmp; |
---|
| 427 | } |
---|
| 428 | |
---|
| 429 | static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
---|
| 430 |     GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
---|
| 431 |     struct chat_connection *c = NULL; |
---|
| 432 | |
---|
| 433 |     while (g) { |
---|
| 434 |         c = (struct chat_connection *)g->data; |
---|
| 435 |         if (c->id == id) |
---|
| 436 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 437 | Â Â Â Â Â Â Â Â g =Â g->next; |
---|
| 438 | Â Â Â Â Â Â Â Â c =Â NULL; |
---|
| 439 | Â Â Â Â } |
---|
| 440 | |
---|
| 441 |     return c; |
---|
| 442 | } |
---|
| 443 | |
---|
| 444 | static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, |
---|
| 445 |                             aim_conn_t *conn) { |
---|
| 446 |     GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
---|
| 447 |     struct chat_connection *c = NULL; |
---|
| 448 | |
---|
| 449 |     while (g) { |
---|
| 450 |         c = (struct chat_connection *)g->data; |
---|
| 451 |         if (c->conn == conn) |
---|
| 452 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 453 | Â Â Â Â Â Â Â Â g =Â g->next; |
---|
| 454 | Â Â Â Â Â Â Â Â c =Â NULL; |
---|
| 455 | Â Â Â Â } |
---|
| 456 | |
---|
| 457 |     return c; |
---|
| 458 | } |
---|
| 459 | |
---|
| 460 | static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
---|
| 461 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 462 |     struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
---|
| 463 | Â Â Â Â GaimConversation *cnv; |
---|
| 464 |     struct direct_im *dim; |
---|
| 465 |     char *sn; |
---|
| 466 |     char buf[256]; |
---|
| 467 | |
---|
| 468 | Â Â Â Â sn =Â g_strdup(aim_odc_getsn(conn)); |
---|
| 469 | |
---|
| 470 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 471 |               "%s disconnected Direct IM.\n", sn); |
---|
| 472 | |
---|
| 473 |     dim = find_direct_im(od, sn); |
---|
| 474 |     od->direct_ims = g_slist_remove(od->direct_ims, dim); |
---|
| 475 | Â Â Â Â gaim_input_remove(dim->watcher); |
---|
| 476 | |
---|
| 477 |     if (dim->connected) |
---|
| 478 |         g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); |
---|
| 479 |     else |
---|
| 480 |         g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); |
---|
| 481 | |
---|
| 482 |     cnv = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
---|
| 483 |     if (cnv) |
---|
| 484 |         gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
---|
| 485 | |
---|
| 486 |     gaim_conversation_update_progress(cnv, 0); |
---|
| 487 | |
---|
| 488 | Â Â Â Â g_free(dim);Â /* I guess? I don't see it anywhere else... -- mid */ |
---|
| 489 | Â Â Â Â g_free(sn); |
---|
| 490 | |
---|
| 491 | Â Â Â Â return; |
---|
| 492 | } |
---|
| 493 | |
---|
| 494 | static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
---|
| 495 |     aim_conn_t *conn = (aim_conn_t *)data; |
---|
| 496 |     aim_session_t *sess = aim_conn_getsess(conn); |
---|
| 497 |     GaimConnection *gc = sess ? sess->aux_data : NULL; |
---|
| 498 |     struct oscar_data *od; |
---|
| 499 | |
---|
| 500 |     if (!gc) { |
---|
| 501 | Â Â Â Â Â Â Â Â /* gc is null. we return, else we seg SIGSEG on next line. */ |
---|
| 502 |         gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 503 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "oscar callback for closed connection (1).\n"); |
---|
| 504 | Â Â Â Â Â Â Â Â return; |
---|
| 505 | Â Â Â Â } |
---|
| 506 | Â Â Â |
---|
| 507 |     od = (struct oscar_data *)gc->proto_data; |
---|
| 508 | |
---|
| 509 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 510 | Â Â Â Â Â Â Â Â /* oh boy. this is probably bad. i guess the only thing we |
---|
| 511 | Â Â Â Â Â Â Â Â Â * can really do is return? */ |
---|
| 512 |         gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 513 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "oscar callback for closed connection (2).\n"); |
---|
| 514 |         gaim_debug(GAIM_DEBUG_MISC, "oscar", "gc = %p\n", gc); |
---|
| 515 | Â Â Â Â Â Â Â Â return; |
---|
| 516 | Â Â Â Â } |
---|
| 517 | |
---|
| 518 |     if (condition & GAIM_INPUT_READ) { |
---|
| 519 |         if (conn->type == AIM_CONN_TYPE_LISTENER) { |
---|
| 520 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 521 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "got information on rendezvous listener\n"); |
---|
| 522 |             if (aim_handlerendconnect(od->sess, conn) < 0) { |
---|
| 523 |                 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 524 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "connection error (rendezvous listener)\n"); |
---|
| 525 |                 aim_conn_kill(od->sess, &conn); |
---|
| 526 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 527 |         } else { |
---|
| 528 |             if (aim_get_command(od->sess, conn) >= 0) { |
---|
| 529 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â aim_rxdispatch(od->sess); |
---|
| 530 |                 if (od->killme) { |
---|
| 531 |                     gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Waiting to be destroyed\n"); |
---|
| 532 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return; |
---|
| 533 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 534 |             } else { |
---|
| 535 |                 if ((conn->type == AIM_CONN_TYPE_BOS) || |
---|
| 536 |                       !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
---|
| 537 |                     gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 538 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "major connection error\n"); |
---|
| 539 |                     gaim_connection_error(gc, _("Disconnected.")); |
---|
| 540 |                 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
---|
| 541 |                     struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); |
---|
| 542 |                     char *buf; |
---|
| 543 |                     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 544 |                               "disconnected from chat room %s\n", c->name); |
---|
| 545 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â c->conn =Â NULL; |
---|
| 546 |                     if (c->inpa > 0) |
---|
| 547 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gaim_input_remove(c->inpa); |
---|
| 548 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â c->inpa =Â 0; |
---|
| 549 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â c->fd =Â -1; |
---|
| 550 |                     aim_conn_kill(od->sess, &conn); |
---|
| 551 |                     buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name); |
---|
| 552 |                     gaim_notify_error(gc, NULL, buf, NULL); |
---|
| 553 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(buf); |
---|
| 554 |                 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
---|
| 555 |                     if (od->cnpa > 0) |
---|
| 556 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gaim_input_remove(od->cnpa); |
---|
| 557 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â od->cnpa =Â 0; |
---|
| 558 |                     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 559 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "removing chatnav input watcher\n"); |
---|
| 560 |                     while (od->create_rooms) { |
---|
| 561 |                         struct create_room *cr = od->create_rooms->data; |
---|
| 562 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(cr->name); |
---|
| 563 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â od->create_rooms = |
---|
| 564 |                             g_slist_remove(od->create_rooms, cr); |
---|
| 565 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(cr); |
---|
| 566 |                         gaim_notify_error(gc, NULL, |
---|
| 567 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Chat is currently unavailable"), |
---|
| 568 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â NULL); |
---|
| 569 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 570 |                     aim_conn_kill(od->sess, &conn); |
---|
| 571 |                 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
---|
| 572 |                     if (od->paspa > 0) |
---|
| 573 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gaim_input_remove(od->paspa); |
---|
| 574 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â od->paspa =Â 0; |
---|
| 575 |                     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 576 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "removing authconn input watcher\n"); |
---|
| 577 |                     aim_conn_kill(od->sess, &conn); |
---|
| 578 |                 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
---|
| 579 |                     if (od->emlpa > 0) |
---|
| 580 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gaim_input_remove(od->emlpa); |
---|
| 581 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â od->emlpa =Â 0; |
---|
| 582 |                     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 583 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "removing email input watcher\n"); |
---|
| 584 |                     aim_conn_kill(od->sess, &conn); |
---|
| 585 |                 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
---|
| 586 |                     if (od->icopa > 0) |
---|
| 587 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gaim_input_remove(od->icopa); |
---|
| 588 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â od->icopa =Â 0; |
---|
| 589 |                     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 590 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "removing icon input watcher\n"); |
---|
| 591 |                     aim_conn_kill(od->sess, &conn); |
---|
| 592 |                 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
---|
| 593 |                     if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
---|
| 594 |                         gaim_odc_disconnect(od->sess, conn); |
---|
| 595 |                     aim_conn_kill(od->sess, &conn); |
---|
| 596 |                 } else { |
---|
| 597 |                     gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 598 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "holy crap! generic connection error! %hu\n", |
---|
| 599 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â conn->type); |
---|
| 600 |                     aim_conn_kill(od->sess, &conn); |
---|
| 601 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 602 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 603 | Â Â Â Â Â Â Â Â } |
---|
| 604 | Â Â Â Â } |
---|
| 605 | } |
---|
| 606 | |
---|
| 607 | static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
---|
| 608 |     char *s = g_strdup_vprintf(format, va); |
---|
| 609 |     char buf[256]; |
---|
| 610 |     char *t; |
---|
| 611 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 612 | |
---|
| 613 |     g_snprintf(buf, sizeof(buf), "%s %d: ", gaim_account_get_username(gaim_connection_get_account(gc)), level); |
---|
| 614 |     t = g_strconcat(buf, s, NULL); |
---|
| 615 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", t); |
---|
| 616 |     if (t[strlen(t)-1] != '\n') |
---|
| 617 |         gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
---|
| 618 | Â Â Â Â g_free(t); |
---|
| 619 | Â Â Â Â g_free(s); |
---|
| 620 | } |
---|
| 621 | |
---|
| 622 | static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
---|
| 623 | { |
---|
| 624 | Â Â Â Â GaimConnection *gc =Â data; |
---|
| 625 |     struct oscar_data *od; |
---|
| 626 |     aim_session_t *sess; |
---|
| 627 |     aim_conn_t *conn; |
---|
| 628 | |
---|
| 629 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 630 | Â Â Â Â Â Â Â Â close(source); |
---|
| 631 | Â Â Â Â Â Â Â Â return; |
---|
| 632 | Â Â Â Â } |
---|
| 633 | |
---|
| 634 | Â Â Â Â od =Â gc->proto_data; |
---|
| 635 | Â Â Â Â sess =Â od->sess; |
---|
| 636 |     conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
---|
| 637 | Â Â Â Â |
---|
| 638 | Â Â Â Â conn->fd =Â source; |
---|
| 639 | |
---|
| 640 |     if (source < 0) { |
---|
| 641 |         gaim_connection_error(gc, _("Couldn't connect to host")); |
---|
| 642 | Â Â Â Â Â Â Â Â return; |
---|
| 643 | Â Â Â Â } |
---|
| 644 | |
---|
| 645 |     aim_conn_completeconnect(sess, conn); |
---|
| 646 |     gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
---|
| 647 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 648 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Password sent, waiting for response\n"); |
---|
| 649 | } |
---|
| 650 | |
---|
| 651 | static void oscar_login(GaimAccount *account) { |
---|
| 652 |     aim_session_t *sess; |
---|
| 653 |     aim_conn_t *conn; |
---|
| 654 |     char buf[256]; |
---|
| 655 | Â Â Â Â GaimConnection *gc =Â gaim_account_get_connection(account); |
---|
| 656 |     struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1); |
---|
| 657 | |
---|
| 658 |     gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); |
---|
| 659 | |
---|
| 660 |     if (isdigit(*(gaim_account_get_username(account)))) { |
---|
| 661 | Â Â Â Â Â Â Â Â od->icq =Â TRUE; |
---|
| 662 |     } else { |
---|
| 663 | Â Â Â Â Â Â Â Â gc->flags |=Â GAIM_CONNECTION_HTML; |
---|
| 664 | Â Â Â Â Â Â Â Â gc->flags |=Â GAIM_CONNECTION_AUTO_RESP; |
---|
| 665 | Â Â Â Â } |
---|
| 666 |     od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
---|
| 667 | |
---|
| 668 |     sess = g_new0(aim_session_t, 1); |
---|
| 669 | |
---|
| 670 |     aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); |
---|
| 671 |     aim_setdebuggingcb(sess, oscar_debug); |
---|
| 672 | |
---|
| 673 | Â Â Â Â /* we need an immediate queue because we don't use a while-loop to |
---|
| 674 | Â Â Â Â Â * see if things need to be sent. */ |
---|
| 675 |     aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); |
---|
| 676 | Â Â Â Â od->sess =Â sess; |
---|
| 677 | Â Â Â Â sess->aux_data =Â gc; |
---|
| 678 | |
---|
| 679 |     conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
---|
| 680 |     if (conn == NULL) { |
---|
| 681 |         gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 682 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "internal connection error\n"); |
---|
| 683 |         gaim_connection_error(gc, _("Unable to login to AIM")); |
---|
| 684 | Â Â Â Â Â Â Â Â return; |
---|
| 685 | Â Â Â Â } |
---|
| 686 | |
---|
| 687 |     g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account)); |
---|
| 688 |     gaim_connection_update_progress(gc, buf, 2, 5); |
---|
| 689 | |
---|
| 690 |     aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
---|
| 691 |     aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
---|
| 692 |     aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); |
---|
| 693 | |
---|
| 694 | Â Â Â Â conn->status |=Â AIM_CONN_STATUS_INPROGRESS; |
---|
| 695 |     if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
---|
| 696 |              gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
---|
| 697 |              oscar_login_connect, gc) < 0) { |
---|
| 698 |         gaim_connection_error(gc, _("Couldn't connect to host")); |
---|
| 699 | Â Â Â Â Â Â Â Â return; |
---|
| 700 | Â Â Â Â } |
---|
| 701 |     aim_request_login(sess, conn, gaim_account_get_username(account)); |
---|
| 702 | } |
---|
| 703 | |
---|
| 704 | static void oscar_close(GaimConnection *gc) { |
---|
| 705 |     struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
---|
| 706 | |
---|
| 707 |     while (od->oscar_chats) { |
---|
| 708 |         struct chat_connection *n = od->oscar_chats->data; |
---|
| 709 |         if (n->inpa > 0) |
---|
| 710 | Â Â Â Â Â Â Â Â Â Â Â Â gaim_input_remove(n->inpa); |
---|
| 711 | Â Â Â Â Â Â Â Â g_free(n->name); |
---|
| 712 | Â Â Â Â Â Â Â Â g_free(n->show); |
---|
| 713 |         od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
---|
| 714 | Â Â Â Â Â Â Â Â g_free(n); |
---|
| 715 | Â Â Â Â } |
---|
| 716 |     while (od->direct_ims) { |
---|
| 717 |         struct direct_im *n = od->direct_ims->data; |
---|
| 718 |         if (n->watcher > 0) |
---|
| 719 | Â Â Â Â Â Â Â Â Â Â Â Â gaim_input_remove(n->watcher); |
---|
| 720 |         od->direct_ims = g_slist_remove(od->direct_ims, n); |
---|
| 721 | Â Â Â Â Â Â Â Â g_free(n); |
---|
| 722 | Â Â Â Â } |
---|
| 723 | /* BBB */ |
---|
| 724 |     while (od->file_transfers) { |
---|
| 725 | Â Â Â Â Â Â Â Â GaimXfer *xfer; |
---|
| 726 | Â Â Â Â Â Â Â Â xfer =Â (GaimXfer *)od->file_transfers->data; |
---|
| 727 | Â Â Â Â Â Â Â Â gaim_xfer_destroy(xfer); |
---|
| 728 | Â Â Â Â } |
---|
| 729 |     while (od->requesticon) { |
---|
| 730 |         char *sn = od->requesticon->data; |
---|
| 731 |         od->requesticon = g_slist_remove(od->requesticon, sn); |
---|
| 732 | Â Â Â Â Â Â Â Â free(sn); |
---|
| 733 | Â Â Â Â } |
---|
| 734 | Â Â Â Â g_hash_table_destroy(od->buddyinfo); |
---|
| 735 |     while (od->evilhack) { |
---|
| 736 | Â Â Â Â Â Â Â Â g_free(od->evilhack->data); |
---|
| 737 |         od->evilhack = g_slist_remove(od->evilhack, od->evilhack->data); |
---|
| 738 | Â Â Â Â } |
---|
| 739 |     while (od->create_rooms) { |
---|
| 740 |         struct create_room *cr = od->create_rooms->data; |
---|
| 741 | Â Â Â Â Â Â Â Â g_free(cr->name); |
---|
| 742 |         od->create_rooms = g_slist_remove(od->create_rooms, cr); |
---|
| 743 | Â Â Â Â Â Â Â Â g_free(cr); |
---|
| 744 | Â Â Â Â } |
---|
| 745 |     if (od->email) |
---|
| 746 | Â Â Â Â Â Â Â Â g_free(od->email); |
---|
| 747 |     if (od->newp) |
---|
| 748 | Â Â Â Â Â Â Â Â g_free(od->newp); |
---|
| 749 |     if (od->oldp) |
---|
| 750 | Â Â Â Â Â Â Â Â g_free(od->oldp); |
---|
| 751 |     if (gc->inpa > 0) |
---|
| 752 | Â Â Â Â Â Â Â Â gaim_input_remove(gc->inpa); |
---|
| 753 |     if (od->cnpa > 0) |
---|
| 754 | Â Â Â Â Â Â Â Â gaim_input_remove(od->cnpa); |
---|
| 755 |     if (od->paspa > 0) |
---|
| 756 | Â Â Â Â Â Â Â Â gaim_input_remove(od->paspa); |
---|
| 757 |     if (od->emlpa > 0) |
---|
| 758 | Â Â Â Â Â Â Â Â gaim_input_remove(od->emlpa); |
---|
| 759 |     if (od->icopa > 0) |
---|
| 760 | Â Â Â Â Â Â Â Â gaim_input_remove(od->icopa); |
---|
| 761 |     if (od->icontimer > 0) |
---|
| 762 | Â Â Â Â Â Â Â Â g_source_remove(od->icontimer); |
---|
| 763 |     if (od->getblisttimer) |
---|
| 764 | Â Â Â Â Â Â Â Â g_source_remove(od->getblisttimer); |
---|
| 765 | Â Â Â Â aim_session_kill(od->sess); |
---|
| 766 | Â Â Â Â g_free(od->sess); |
---|
| 767 | Â Â Â Â od->sess =Â NULL; |
---|
| 768 | Â Â Â Â g_free(gc->proto_data); |
---|
| 769 | Â Â Â Â gc->proto_data =Â NULL; |
---|
| 770 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
---|
| 771 | } |
---|
| 772 | |
---|
| 773 | static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
---|
| 774 | Â Â Â Â GaimConnection *gc =Â data; |
---|
| 775 |     struct oscar_data *od; |
---|
| 776 |     aim_session_t *sess; |
---|
| 777 |     aim_conn_t *bosconn; |
---|
| 778 | |
---|
| 779 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 780 | Â Â Â Â Â Â Â Â close(source); |
---|
| 781 | Â Â Â Â Â Â Â Â return; |
---|
| 782 | Â Â Â Â } |
---|
| 783 | |
---|
| 784 | Â Â Â Â od =Â gc->proto_data; |
---|
| 785 | Â Â Â Â sess =Â od->sess; |
---|
| 786 | Â Â Â Â bosconn =Â od->conn;Â Â Â |
---|
| 787 | Â Â Â Â bosconn->fd =Â source; |
---|
| 788 | |
---|
| 789 |     if (source < 0) { |
---|
| 790 |         gaim_connection_error(gc, _("Could Not Connect")); |
---|
| 791 | Â Â Â Â Â Â Â Â return; |
---|
| 792 | Â Â Â Â } |
---|
| 793 | |
---|
| 794 |     aim_conn_completeconnect(sess, bosconn); |
---|
| 795 |     gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
---|
| 796 | Â Â Â Â gaim_connection_update_progress(gc, |
---|
| 797 |             _("Connection established, cookie sent"), 4, 5); |
---|
| 798 | } |
---|
| 799 | |
---|
| 800 | /* BBB */ |
---|
| 801 | /* |
---|
| 802 | Â * This little area in oscar.c is the nexus of file transfer code, |
---|
| 803 |  * so I wrote a little explanation of what happens. I am such a |
---|
| 804 | Â * ninja. |
---|
| 805 | Â * |
---|
| 806 | Â * The series of events for a file send is: |
---|
| 807 | Â *Â -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) |
---|
| 808 |  * -User chooses a file and oscar_xfer_init is called. It establishs a |
---|
| 809 | Â *Â Â listening socket, then asks the remote user to connect to us (and |
---|
| 810 | Â *Â Â gives them the file name, port, IP, etc.) |
---|
| 811 | Â *Â -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens |
---|
| 812 | Â *Â Â in oscar_sendfile_estblsh) |
---|
| 813 | Â *Â -They send us an AIM_CB_OFT_ACK and then we start sending data |
---|
| 814 | Â *Â -When we finish, they send us an AIM_CB_OFT_DONE and they close the |
---|
| 815 | Â *Â Â connection. |
---|
| 816 | Â *Â -We get drunk because file transfer kicks ass. |
---|
| 817 | Â * |
---|
| 818 | Â * The series of events for a file receive is: |
---|
| 819 | Â *Â -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) |
---|
| 820 | Â *Â -Gaim user selects file to name and location to save file to and |
---|
| 821 | Â *Â Â oscar_xfer_init is called |
---|
| 822 | Â *Â -It connects to the remote user using the IP they gave us earlier |
---|
| 823 |  * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send |
---|
| 824 | Â *Â Â them an AIM_CB_OFT_ACK. |
---|
| 825 | Â *Â -They begin to send us lots of raw data. |
---|
| 826 | Â *Â -When they finish sending data we send an AIM_CB_OFT_DONE and then close |
---|
| 827 | Â *Â Â the connectionn. |
---|
| 828 | Â */ |
---|
| 829 | static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); |
---|
| 830 | |
---|
| 831 | /* XXX - This function is pretty ugly */ |
---|
| 832 | static void oscar_xfer_init(GaimXfer *xfer) |
---|
| 833 | { |
---|
| 834 |     struct aim_oft_info *oft_info = xfer->data; |
---|
| 835 | Â Â Â Â GaimConnection *gc =Â oft_info->sess->aux_data; |
---|
| 836 |     struct oscar_data *od = gc->proto_data; |
---|
| 837 | |
---|
| 838 |     if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { |
---|
| 839 |         int i; |
---|
| 840 | |
---|
| 841 | Â Â Â Â Â Â Â Â xfer->filename =Â g_path_get_basename(xfer->local_filename); |
---|
| 842 |         strncpy(oft_info->fh.name, xfer->filename, 64); |
---|
| 843 | Â Â Â Â Â Â Â Â oft_info->fh.totsize =Â gaim_xfer_get_size(xfer); |
---|
| 844 | Â Â Â Â Â Â Â Â oft_info->fh.size =Â gaim_xfer_get_size(xfer); |
---|
| 845 | Â Â Â Â Â Â Â Â oft_info->fh.checksum =Â aim_oft_checksum_file(xfer->local_filename); |
---|
| 846 | |
---|
| 847 | Â Â Â Â Â Â Â Â /* |
---|
| 848 |          * First try the port specified earlier (5190). If that fails, |
---|
| 849 | Â Â Â Â Â Â Â Â Â * increment by 1 and try again. |
---|
| 850 | Â Â Â Â Â Â Â Â Â */ |
---|
| 851 |         aim_sendfile_listen(od->sess, oft_info); |
---|
| 852 |         for (i=0; (i<5 && !oft_info->conn); i++) { |
---|
| 853 | Â Â Â Â Â Â Â Â Â Â Â Â xfer->local_port =Â oft_info->port =Â oft_info->port +Â 1; |
---|
| 854 |             aim_sendfile_listen(od->sess, oft_info); |
---|
| 855 | Â Â Â Â Â Â Â Â } |
---|
| 856 |         gaim_debug(GAIM_DEBUG_MISC, "oscar", |
---|
| 857 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "port is %d, ip is %s\n", |
---|
| 858 |                   xfer->local_port, oft_info->clientip); |
---|
| 859 |         if (oft_info->conn) { |
---|
| 860 |             xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
---|
| 861 |             aim_im_sendch2_sendfile_ask(od->sess, oft_info); |
---|
| 862 |             aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); |
---|
| 863 |         } else { |
---|
| 864 |             gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
---|
| 865 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Unable to establish listener socket.")); |
---|
| 866 | Â Â Â Â Â Â Â Â Â Â Â Â /* XXX - The below line causes a crash because the transfer is canceled before the "Ok" callback on the file selection thing exists, I think */ |
---|
| 867 | Â Â Â Â Â Â Â Â Â Â Â Â /* gaim_xfer_cancel_remote(xfer); */ |
---|
| 868 | Â Â Â Â Â Â Â Â } |
---|
| 869 |     } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
---|
| 870 |         oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
---|
| 871 |         if (oft_info->conn) { |
---|
| 872 | Â Â Â Â Â Â Â Â Â Â Â Â oft_info->conn->subtype =Â AIM_CONN_SUBTYPE_OFT_SENDFILE; |
---|
| 873 |             aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); |
---|
| 874 |             oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc), xfer->remote_ip, xfer->remote_port, |
---|
| 875 |                                    oscar_sendfile_connected, xfer); |
---|
| 876 |             if (xfer->fd == -1) { |
---|
| 877 |                 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
---|
| 878 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Unable to establish file descriptor.")); |
---|
| 879 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â /* gaim_xfer_cancel_remote(xfer); */ |
---|
| 880 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 881 |         } else { |
---|
| 882 |             gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
---|
| 883 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Unable to create new connection.")); |
---|
| 884 | Â Â Â Â Â Â Â Â Â Â Â Â /* gaim_xfer_cancel_remote(xfer); */ |
---|
| 885 | Â Â Â Â Â Â Â Â Â Â Â Â /* Try a different port? Ask them to connect to us? */ |
---|
| 886 | Â Â Â Â Â Â Â Â } |
---|
| 887 | |
---|
| 888 | Â Â Â Â } |
---|
| 889 | } |
---|
| 890 | |
---|
| 891 | static void oscar_xfer_start(GaimXfer *xfer) |
---|
| 892 | { |
---|
| 893 | |
---|
| 894 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_start\n"); |
---|
| 895 |     /* I'm pretty sure we don't need to do jack here. Nor Jill. */ |
---|
| 896 | } |
---|
| 897 | |
---|
| 898 | static void oscar_xfer_end(GaimXfer *xfer) |
---|
| 899 | { |
---|
| 900 |     struct aim_oft_info *oft_info = xfer->data; |
---|
| 901 | Â Â Â Â GaimConnection *gc =Â oft_info->sess->aux_data; |
---|
| 902 |     struct oscar_data *od = gc->proto_data; |
---|
| 903 | |
---|
| 904 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
---|
| 905 | |
---|
| 906 |     if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
---|
| 907 | Â Â Â Â Â Â Â Â oft_info->fh.nrecvd =Â gaim_xfer_get_bytes_sent(xfer); |
---|
| 908 |         aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); |
---|
| 909 | Â Â Â Â } |
---|
| 910 | |
---|
| 911 |     aim_conn_kill(oft_info->sess, &oft_info->conn); |
---|
| 912 | Â Â Â Â aim_oft_destroyinfo(oft_info); |
---|
| 913 | Â Â Â Â xfer->data =Â NULL; |
---|
| 914 |     od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
---|
| 915 | } |
---|
| 916 | |
---|
| 917 | static void oscar_xfer_cancel_send(GaimXfer *xfer) |
---|
| 918 | { |
---|
| 919 |     struct aim_oft_info *oft_info = xfer->data; |
---|
| 920 | Â Â Â Â GaimConnection *gc =Â oft_info->sess->aux_data; |
---|
| 921 |     struct oscar_data *od = gc->proto_data; |
---|
| 922 | |
---|
| 923 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 924 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "AAA - in oscar_xfer_cancel_send\n"); |
---|
| 925 | |
---|
| 926 |     aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); |
---|
| 927 | |
---|
| 928 |     aim_conn_kill(oft_info->sess, &oft_info->conn); |
---|
| 929 | Â Â Â Â aim_oft_destroyinfo(oft_info); |
---|
| 930 | Â Â Â Â xfer->data =Â NULL; |
---|
| 931 |     od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
---|
| 932 | } |
---|
| 933 | |
---|
| 934 | static void oscar_xfer_cancel_recv(GaimXfer *xfer) |
---|
| 935 | { |
---|
| 936 |     struct aim_oft_info *oft_info = xfer->data; |
---|
| 937 | Â Â Â Â GaimConnection *gc =Â oft_info->sess->aux_data; |
---|
| 938 |     struct oscar_data *od = gc->proto_data; |
---|
| 939 | |
---|
| 940 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 941 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "AAA - in oscar_xfer_cancel_recv\n"); |
---|
| 942 | |
---|
| 943 |     aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); |
---|
| 944 | |
---|
| 945 |     aim_conn_kill(oft_info->sess, &oft_info->conn); |
---|
| 946 | Â Â Â Â aim_oft_destroyinfo(oft_info); |
---|
| 947 | Â Â Â Â xfer->data =Â NULL; |
---|
| 948 |     od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
---|
| 949 | } |
---|
| 950 | |
---|
| 951 | static void oscar_xfer_ack(GaimXfer *xfer, const char *buffer, size_t size) |
---|
| 952 | { |
---|
| 953 |     struct aim_oft_info *oft_info = xfer->data; |
---|
| 954 | |
---|
| 955 |     if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { |
---|
| 956 | Â Â Â Â Â Â Â Â /* |
---|
| 957 | Â Â Â Â Â Â Â Â Â * If we're done sending, intercept the socket from the core ft code |
---|
| 958 | Â Â Â Â Â Â Â Â Â * and wait for the other guy to send the "done" OFT packet. |
---|
| 959 | Â Â Â Â Â Â Â Â Â */ |
---|
| 960 |         if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { |
---|
| 961 | Â Â Â Â Â Â Â Â Â Â Â Â gaim_input_remove(xfer->watcher); |
---|
| 962 |             xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
---|
| 963 | Â Â Â Â Â Â Â Â Â Â Â Â xfer->fd =Â 0; |
---|
| 964 |             gaim_xfer_set_completed(xfer, TRUE); |
---|
| 965 | Â Â Â Â Â Â Â Â } |
---|
| 966 |     } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
---|
| 967 |         /* Update our rolling checksum. Like Walmart, yo. */ |
---|
| 968 |         oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); |
---|
| 969 | Â Â Â Â } |
---|
| 970 | } |
---|
| 971 | |
---|
| 972 | static GaimXfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) |
---|
| 973 | { |
---|
| 974 | Â Â Â Â GaimXfer *xfer; |
---|
| 975 |     struct aim_oft_info *oft_info; |
---|
| 976 | |
---|
| 977 |     while (fts) { |
---|
| 978 | Â Â Â Â Â Â Â Â xfer =Â fts->data; |
---|
| 979 | Â Â Â Â Â Â Â Â oft_info =Â xfer->data; |
---|
| 980 | |
---|
| 981 |         if (oft_info && !strcmp(ck, oft_info->cookie)) |
---|
| 982 |             return xfer; |
---|
| 983 | |
---|
| 984 | Â Â Â Â Â Â Â Â fts =Â g_slist_next(fts); |
---|
| 985 | Â Â Â Â } |
---|
| 986 | |
---|
| 987 |     return NULL; |
---|
| 988 | } |
---|
| 989 | |
---|
| 990 | static GaimXfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
---|
| 991 | { |
---|
| 992 | Â Â Â Â GaimXfer *xfer; |
---|
| 993 |     struct aim_oft_info *oft_info; |
---|
| 994 | |
---|
| 995 |     while (fts) { |
---|
| 996 | Â Â Â Â Â Â Â Â xfer =Â fts->data; |
---|
| 997 | Â Â Â Â Â Â Â Â oft_info =Â xfer->data; |
---|
| 998 | |
---|
| 999 |         if (oft_info && (conn == oft_info->conn)) |
---|
| 1000 |             return xfer; |
---|
| 1001 | |
---|
| 1002 | Â Â Â Â Â Â Â Â fts =Â g_slist_next(fts); |
---|
| 1003 | Â Â Â Â } |
---|
| 1004 | |
---|
| 1005 |     return NULL; |
---|
| 1006 | } |
---|
| 1007 | |
---|
| 1008 | static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
---|
| 1009 |     struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
---|
| 1010 | Â Â Â Â GaimXfer *xfer; |
---|
| 1011 |     struct aim_oft_info *oft_info; |
---|
| 1012 | |
---|
| 1013 | Â Â Â Â /* You want to send a file to someone else, you're so generous */ |
---|
| 1014 | |
---|
| 1015 | Â Â Â Â /* Build the file transfer handle */ |
---|
| 1016 |     xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
---|
| 1017 | Â Â Â Â xfer->local_port =Â 5190; |
---|
| 1018 | |
---|
| 1019 | Â Â Â Â /* Create the oscar-specific data */ |
---|
| 1020 |     oft_info = aim_oft_createinfo(od->sess, NULL, destsn, xfer->local_ip, xfer->local_port, 0, 0, NULL); |
---|
| 1021 | Â Â Â Â xfer->data =Â oft_info; |
---|
| 1022 | |
---|
| 1023 | Â Â Â Â Â /* Setup our I/O op functions */ |
---|
| 1024 |     gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); |
---|
| 1025 |     gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); |
---|
| 1026 |     gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
---|
| 1027 |     gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
---|
| 1028 |     gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
---|
| 1029 |     gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
---|
| 1030 | |
---|
| 1031 | Â Â Â Â /* Keep track of this transfer for later */ |
---|
| 1032 |     od->file_transfers = g_slist_append(od->file_transfers, xfer); |
---|
| 1033 | |
---|
| 1034 | Â Â Â Â /* Now perform the request */ |
---|
| 1035 | Â Â Â Â gaim_xfer_request(xfer); |
---|
| 1036 | } |
---|
| 1037 | |
---|
| 1038 | static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1039 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 1040 |     struct oscar_data *od = gc->proto_data; |
---|
| 1041 | Â Â Â Â GaimAccount *account =Â gc->account; |
---|
| 1042 |     aim_conn_t *bosconn; |
---|
| 1043 |     char *host; int port; |
---|
| 1044 |     int i, rc; |
---|
| 1045 |     va_list ap; |
---|
| 1046 |     struct aim_authresp_info *info; |
---|
| 1047 | |
---|
| 1048 |     port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
---|
| 1049 | |
---|
| 1050 |     va_start(ap, fr); |
---|
| 1051 |     info = va_arg(ap, struct aim_authresp_info *); |
---|
| 1052 | Â Â Â Â va_end(ap); |
---|
| 1053 | |
---|
| 1054 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 1055 |               "inside auth_resp (Screen name: %s)\n", info->sn); |
---|
| 1056 | |
---|
| 1057 |     if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
---|
| 1058 |         char buf[256]; |
---|
| 1059 |         switch (info->errorcode) { |
---|
| 1060 |         case 0x05: |
---|
| 1061 | Â Â Â Â Â Â Â Â Â Â Â Â /* Incorrect nick/password */ |
---|
| 1062 | Â Â Â Â Â Â Â Â Â Â Â Â gc->wants_to_die =Â TRUE; |
---|
| 1063 |             gaim_connection_error(gc, _("Incorrect nickname or password.")); |
---|
| 1064 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1065 |         case 0x11: |
---|
| 1066 | Â Â Â Â Â Â Â Â Â Â Â Â /* Suspended account */ |
---|
| 1067 | Â Â Â Â Â Â Â Â Â Â Â Â gc->wants_to_die =Â TRUE; |
---|
| 1068 |             gaim_connection_error(gc, _("Your account is currently suspended.")); |
---|
| 1069 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1070 |         case 0x14: |
---|
| 1071 | Â Â Â Â Â Â Â Â Â Â Â Â /* service temporarily unavailable */ |
---|
| 1072 |             gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); |
---|
| 1073 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1074 |         case 0x18: |
---|
| 1075 | Â Â Â Â Â Â Â Â Â Â Â Â /* connecting too frequently */ |
---|
| 1076 | Â Â Â Â Â Â Â Â Â Â Â Â gc->wants_to_die =Â TRUE; |
---|
| 1077 |             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.")); |
---|
| 1078 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1079 |         case 0x1c: |
---|
| 1080 | Â Â Â Â Â Â Â Â Â Â Â Â /* client too old */ |
---|
| 1081 | Â Â Â Â Â Â Â Â Â Â Â Â gc->wants_to_die =Â TRUE; |
---|
| 1082 |             g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), GAIM_WEBSITE); |
---|
| 1083 |             gaim_connection_error(gc, buf); |
---|
| 1084 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1085 | Â Â Â Â Â Â Â Â default: |
---|
| 1086 |             gaim_connection_error(gc, _("Authentication failed")); |
---|
| 1087 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1088 | Â Â Â Â Â Â Â Â } |
---|
| 1089 |         gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1090 |                   "Login Error Code 0x%04hx\n", info->errorcode); |
---|
| 1091 |         gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1092 |                   "Error URL: %s\n", info->errorurl); |
---|
| 1093 | Â Â Â Â Â Â Â Â od->killme =Â TRUE; |
---|
| 1094 |         return 1; |
---|
| 1095 | Â Â Â Â } |
---|
| 1096 | |
---|
| 1097 | |
---|
| 1098 |     gaim_debug(GAIM_DEBUG_MISC, "oscar", |
---|
| 1099 |               "Reg status: %hu\n", info->regstatus); |
---|
| 1100 | |
---|
| 1101 |     if (info->email) { |
---|
| 1102 |         gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email: %s\n", info->email); |
---|
| 1103 |     } else { |
---|
| 1104 |         gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email is NULL\n"); |
---|
| 1105 | Â Â Â Â } |
---|
| 1106 | Â Â Â Â |
---|
| 1107 |     gaim_debug(GAIM_DEBUG_MISC, "oscar", "BOSIP: %s\n", info->bosip); |
---|
| 1108 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 1109 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Closing auth connection...\n"); |
---|
| 1110 |     aim_conn_kill(sess, &fr->conn); |
---|
| 1111 | |
---|
| 1112 |     bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); |
---|
| 1113 |     if (bosconn == NULL) { |
---|
| 1114 |         gaim_connection_error(gc, _("Internal Error")); |
---|
| 1115 | Â Â Â Â Â Â Â Â od->killme =Â TRUE; |
---|
| 1116 |         return 0; |
---|
| 1117 | Â Â Â Â } |
---|
| 1118 | |
---|
| 1119 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
---|
| 1120 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
---|
| 1121 |     aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
---|
| 1122 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); |
---|
| 1123 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); |
---|
| 1124 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
---|
| 1125 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
---|
| 1126 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); |
---|
| 1127 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); |
---|
| 1128 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); |
---|
| 1129 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); |
---|
| 1130 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); |
---|
| 1131 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
---|
| 1132 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
---|
| 1133 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); |
---|
| 1134 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); |
---|
| 1135 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); |
---|
| 1136 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); |
---|
| 1137 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
---|
| 1138 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0); |
---|
| 1139 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); |
---|
| 1140 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0); |
---|
| 1141 |     aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
---|
| 1142 |     aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
---|
| 1143 |     aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); |
---|
| 1144 |     aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); |
---|
| 1145 |     aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); |
---|
| 1146 |     aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
---|
| 1147 |     aim_conn_addhandler(sess, bosconn, 0x0001, 0x0021, oscar_icon_req,0); |
---|
| 1148 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); |
---|
| 1149 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); |
---|
| 1150 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
---|
| 1151 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
---|
| 1152 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
---|
| 1153 | #ifndef NOSSI |
---|
| 1154 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
---|
| 1155 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
---|
| 1156 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); |
---|
| 1157 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); |
---|
| 1158 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
---|
| 1159 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); |
---|
| 1160 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); |
---|
| 1161 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); |
---|
| 1162 |     aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); |
---|
| 1163 | #endif |
---|
| 1164 | |
---|
| 1165 |     ((struct oscar_data *)gc->proto_data)->conn = bosconn; |
---|
| 1166 |     for (i = 0; i < (int)strlen(info->bosip); i++) { |
---|
| 1167 |         if (info->bosip[i] == ':') { |
---|
| 1168 | Â Â Â Â Â Â Â Â Â Â Â Â port =Â atoi(&(info->bosip[i+1])); |
---|
| 1169 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1170 | Â Â Â Â Â Â Â Â } |
---|
| 1171 | Â Â Â Â } |
---|
| 1172 |     host = g_strndup(info->bosip, i); |
---|
| 1173 | Â Â Â Â bosconn->status |=Â AIM_CONN_STATUS_INPROGRESS; |
---|
| 1174 |     rc = gaim_proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
---|
| 1175 | Â Â Â Â g_free(host); |
---|
| 1176 |     if (rc < 0) { |
---|
| 1177 |         gaim_connection_error(gc, _("Could Not Connect")); |
---|
| 1178 | Â Â Â Â Â Â Â Â od->killme =Â TRUE; |
---|
| 1179 |         return 0; |
---|
| 1180 | Â Â Â Â } |
---|
| 1181 |     aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
---|
| 1182 | Â Â Â Â gaim_input_remove(gc->inpa); |
---|
| 1183 | |
---|
| 1184 |     return 1; |
---|
| 1185 | } |
---|
| 1186 | |
---|
| 1187 | struct pieceofcrap { |
---|
| 1188 | Â Â Â Â GaimConnection *gc; |
---|
| 1189 |     unsigned long offset; |
---|
| 1190 |     unsigned long len; |
---|
| 1191 |     char *modname; |
---|
| 1192 |     int fd; |
---|
| 1193 |     aim_conn_t *conn; |
---|
| 1194 |     unsigned int inpa; |
---|
| 1195 | }; |
---|
| 1196 | |
---|
| 1197 | static void damn_you(gpointer data, gint source, GaimInputCondition c) |
---|
| 1198 | { |
---|
| 1199 |     struct pieceofcrap *pos = data; |
---|
| 1200 |     struct oscar_data *od = pos->gc->proto_data; |
---|
| 1201 |     char in = '\0'; |
---|
| 1202 |     int x = 0; |
---|
| 1203 |     unsigned char m[17]; |
---|
| 1204 | |
---|
| 1205 |     while (read(pos->fd, &in, 1) == 1) { |
---|
| 1206 |         if (in == '\n') |
---|
| 1207 | Â Â Â Â Â Â Â Â Â Â Â Â x++; |
---|
| 1208 |         else if (in != '\r') |
---|
| 1209 | Â Â Â Â Â Â Â Â Â Â Â Â x =Â 0; |
---|
| 1210 |         if (x == 2) |
---|
| 1211 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1212 | Â Â Â Â Â Â Â Â in =Â '\0'; |
---|
| 1213 | Â Â Â Â } |
---|
| 1214 |     if (in != '\n') { |
---|
| 1215 |         char buf[256]; |
---|
| 1216 |         g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " |
---|
| 1217 |             "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
---|
| 1218 |         gaim_notify_warning(pos->gc, NULL, |
---|
| 1219 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Gaim was Unable to get a valid AIM login hash."), |
---|
| 1220 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â buf); |
---|
| 1221 | Â Â Â Â Â Â Â Â gaim_input_remove(pos->inpa); |
---|
| 1222 | Â Â Â Â Â Â Â Â close(pos->fd); |
---|
| 1223 | Â Â Â Â Â Â Â Â g_free(pos); |
---|
| 1224 | Â Â Â Â Â Â Â Â return; |
---|
| 1225 | Â Â Â Â } |
---|
| 1226 |     read(pos->fd, m, 16); |
---|
| 1227 | Â Â Â Â m[16]Â =Â '\0'; |
---|
| 1228 |     gaim_debug(GAIM_DEBUG_MISC, "oscar", "Sending hash: "); |
---|
| 1229 |     for (x = 0; x < 16; x++) |
---|
| 1230 |         gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx ", (unsigned char)m[x]); |
---|
| 1231 | |
---|
| 1232 |     gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
---|
| 1233 | Â Â Â Â gaim_input_remove(pos->inpa); |
---|
| 1234 | Â Â Â Â close(pos->fd); |
---|
| 1235 |     aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); |
---|
| 1236 | Â Â Â Â g_free(pos); |
---|
| 1237 | } |
---|
| 1238 | |
---|
| 1239 | static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
---|
| 1240 |     struct pieceofcrap *pos = data; |
---|
| 1241 | Â Â Â Â gchar *buf; |
---|
| 1242 | |
---|
| 1243 | Â Â Â Â pos->fd =Â source; |
---|
| 1244 | |
---|
| 1245 |     if (source < 0) { |
---|
| 1246 |         buf = g_strdup_printf(_("You may be disconnected shortly. You may want to use TOC until " |
---|
| 1247 |             "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
---|
| 1248 |         gaim_notify_warning(pos->gc, NULL, |
---|
| 1249 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Gaim was Unable to get a valid AIM login hash."), |
---|
| 1250 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â buf); |
---|
| 1251 | Â Â Â Â Â Â Â Â g_free(buf); |
---|
| 1252 |         if (pos->modname) |
---|
| 1253 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(pos->modname); |
---|
| 1254 | Â Â Â Â Â Â Â Â g_free(pos); |
---|
| 1255 | Â Â Â Â Â Â Â Â return; |
---|
| 1256 | Â Â Â Â } |
---|
| 1257 | |
---|
| 1258 | Â Â Â Â buf =Â g_strdup_printf("GET "Â AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", |
---|
| 1259 |             pos->offset, pos->len, pos->modname ? pos->modname : ""); |
---|
| 1260 |     write(pos->fd, buf, strlen(buf)); |
---|
| 1261 | Â Â Â Â g_free(buf); |
---|
| 1262 |     if (pos->modname) |
---|
| 1263 | Â Â Â Â Â Â Â Â g_free(pos->modname); |
---|
| 1264 |     pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
---|
| 1265 | Â Â Â Â return; |
---|
| 1266 | } |
---|
| 1267 | |
---|
| 1268 | /* size of icbmui.ocm, the largest module in AIM 3.5 */ |
---|
| 1269 | #define AIM_MAX_FILE_SIZE 98304 |
---|
| 1270 | |
---|
| 1271 | int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1272 |     va_list ap; |
---|
| 1273 |     struct pieceofcrap *pos; |
---|
| 1274 |     fu32_t offset, len; |
---|
| 1275 |     char *modname; |
---|
| 1276 | |
---|
| 1277 |     va_start(ap, fr); |
---|
| 1278 |     offset = va_arg(ap, fu32_t); |
---|
| 1279 |     len = va_arg(ap, fu32_t); |
---|
| 1280 |     modname = va_arg(ap, char *); |
---|
| 1281 | Â Â Â Â va_end(ap); |
---|
| 1282 | |
---|
| 1283 |     gaim_debug(GAIM_DEBUG_MISC, "oscar", |
---|
| 1284 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "offset: %u, len: %u, file: %s\n", |
---|
| 1285 |               offset, len, (modname ? modname : "aim.exe")); |
---|
| 1286 | |
---|
| 1287 |     if (len == 0) { |
---|
| 1288 |         gaim_debug(GAIM_DEBUG_MISC, "oscar", "len is 0, hashing NULL\n"); |
---|
| 1289 |         aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
---|
| 1290 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
---|
| 1291 |         return 1; |
---|
| 1292 | Â Â Â Â } |
---|
| 1293 | Â Â Â Â /* uncomment this when you're convinced it's right. remember, it's been wrong before. |
---|
| 1294 | Â Â Â Â if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { |
---|
| 1295 | Â Â Â Â Â Â Â Â char *buf; |
---|
| 1296 | Â Â Â Â Â Â Â Â int i = 8; |
---|
| 1297 | Â Â Â Â Â Â Â Â if (modname) |
---|
| 1298 | Â Â Â Â Â Â Â Â Â Â Â Â i += strlen(modname); |
---|
| 1299 | Â Â Â Â Â Â Â Â buf = g_malloc(i); |
---|
| 1300 | Â Â Â Â Â Â Â Â i = 0; |
---|
| 1301 | Â Â Â Â Â Â Â Â if (modname) { |
---|
| 1302 | Â Â Â Â Â Â Â Â Â Â Â Â memcpy(buf, modname, strlen(modname)); |
---|
| 1303 | Â Â Â Â Â Â Â Â Â Â Â Â i += strlen(modname); |
---|
| 1304 | Â Â Â Â Â Â Â Â } |
---|
| 1305 | Â Â Â Â Â Â Â Â buf[i++] = offset & 0xff; |
---|
| 1306 | Â Â Â Â Â Â Â Â buf[i++] = (offset >> 8) & 0xff; |
---|
| 1307 | Â Â Â Â Â Â Â Â buf[i++] = (offset >> 16) & 0xff; |
---|
| 1308 | Â Â Â Â Â Â Â Â buf[i++] = (offset >> 24) & 0xff; |
---|
| 1309 | Â Â Â Â Â Â Â Â buf[i++] = len & 0xff; |
---|
| 1310 | Â Â Â Â Â Â Â Â buf[i++] = (len >> 8) & 0xff; |
---|
| 1311 | Â Â Â Â Â Â Â Â buf[i++] = (len >> 16) & 0xff; |
---|
| 1312 | Â Â Â Â Â Â Â Â buf[i++] = (len >> 24) & 0xff; |
---|
| 1313 | Â Â Â Â Â Â Â Â gaim_debug(GAIM_DEBUG_MISC, "oscar", "len + offset is invalid, " |
---|
| 1314 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "hashing request\n"); |
---|
| 1315 | Â Â Â Â Â Â Â Â aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
---|
| 1316 | Â Â Â Â Â Â Â Â g_free(buf); |
---|
| 1317 | Â Â Â Â Â Â Â Â return 1; |
---|
| 1318 | Â Â Â Â } |
---|
| 1319 | Â Â Â Â */ |
---|
| 1320 | |
---|
| 1321 |     pos = g_new0(struct pieceofcrap, 1); |
---|
| 1322 | Â Â Â Â pos->gc =Â sess->aux_data; |
---|
| 1323 | Â Â Â Â pos->conn =Â fr->conn; |
---|
| 1324 | |
---|
| 1325 | Â Â Â Â pos->offset =Â offset; |
---|
| 1326 | Â Â Â Â pos->len =Â len; |
---|
| 1327 |     pos->modname = modname ? g_strdup(modname) : NULL; |
---|
| 1328 | |
---|
| 1329 |     if (gaim_proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
---|
| 1330 |         char buf[256]; |
---|
| 1331 |         if (pos->modname) |
---|
| 1332 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(pos->modname); |
---|
| 1333 | Â Â Â Â Â Â Â Â g_free(pos); |
---|
| 1334 |         g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " |
---|
| 1335 |             "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
---|
| 1336 |         gaim_notify_warning(pos->gc, NULL, |
---|
| 1337 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Gaim was Unable to get a valid login hash."), |
---|
| 1338 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â buf); |
---|
| 1339 | Â Â Â Â } |
---|
| 1340 | |
---|
| 1341 |     return 1; |
---|
| 1342 | } |
---|
| 1343 | |
---|
| 1344 | static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1345 |     char *key; |
---|
| 1346 |     va_list ap; |
---|
| 1347 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 1348 | Â Â Â Â GaimAccount *account =Â gaim_connection_get_account(gc); |
---|
| 1349 | Â Â Â Â GaimAccount *ac =Â gaim_connection_get_account(gc); |
---|
| 1350 |     struct oscar_data *od = gc->proto_data; |
---|
| 1351 | |
---|
| 1352 |     va_start(ap, fr); |
---|
| 1353 |     key = va_arg(ap, char *); |
---|
| 1354 | Â Â Â Â va_end(ap); |
---|
| 1355 | |
---|
| 1356 |     if (od->icq) { |
---|
| 1357 |         struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
---|
| 1358 |         aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
---|
| 1359 |                       gaim_account_get_password(account), &info, key); |
---|
| 1360 |     } else { |
---|
| 1361 | #if 0 |
---|
| 1362 | Â Â Â Â Â Â Â Â struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; |
---|
| 1363 | #endif |
---|
| 1364 |         struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; |
---|
| 1365 |         aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
---|
| 1366 |                       gaim_account_get_password(account), &info, key); |
---|
| 1367 | Â Â Â Â } |
---|
| 1368 | |
---|
| 1369 |     return 1; |
---|
| 1370 | } |
---|
| 1371 | |
---|
| 1372 | static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1373 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 1374 |     struct chat_connection *chatcon; |
---|
| 1375 |     static int id = 1; |
---|
| 1376 | |
---|
| 1377 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, 0x0001, gaim_parse_genericerr, 0); |
---|
| 1378 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
---|
| 1379 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0); |
---|
| 1380 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); |
---|
| 1381 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0); |
---|
| 1382 | |
---|
| 1383 |     aim_clientready(sess, fr->conn); |
---|
| 1384 | |
---|
| 1385 |     chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
---|
| 1386 | Â Â Â Â chatcon->id =Â id; |
---|
| 1387 |     chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); |
---|
| 1388 | |
---|
| 1389 |     return 1; |
---|
| 1390 | } |
---|
| 1391 | |
---|
| 1392 | static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1393 | |
---|
| 1394 |     aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
---|
| 1395 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
---|
| 1396 | |
---|
| 1397 |     aim_clientready(sess, fr->conn); |
---|
| 1398 | |
---|
| 1399 |     aim_chatnav_reqrights(sess, fr->conn); |
---|
| 1400 | |
---|
| 1401 |     return 1; |
---|
| 1402 | } |
---|
| 1403 | |
---|
| 1404 | static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1405 | |
---|
| 1406 |     aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); |
---|
| 1407 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); |
---|
| 1408 | |
---|
| 1409 |     aim_email_sendcookies(sess, fr->conn); |
---|
| 1410 |     aim_email_activate(sess, fr->conn); |
---|
| 1411 |     aim_clientready(sess, fr->conn); |
---|
| 1412 | |
---|
| 1413 |     return 1; |
---|
| 1414 | } |
---|
| 1415 | |
---|
| 1416 | static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1417 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 1418 |     struct oscar_data *od = gc->proto_data; |
---|
| 1419 | |
---|
| 1420 |     aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); |
---|
| 1421 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); |
---|
| 1422 |     aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); |
---|
| 1423 | |
---|
| 1424 |     aim_clientready(sess, fr->conn); |
---|
| 1425 | |
---|
| 1426 | Â Â Â Â od->iconconnecting =Â FALSE; |
---|
| 1427 | |
---|
| 1428 |     if (od->icontimer) |
---|
| 1429 | Â Â Â Â Â Â Â Â g_source_remove(od->icontimer); |
---|
| 1430 |     od->icontimer = g_timeout_add(100, gaim_icon_timerfunc, gc); |
---|
| 1431 | |
---|
| 1432 |     return 1; |
---|
| 1433 | } |
---|
| 1434 | |
---|
| 1435 | static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
---|
| 1436 | Â Â Â Â GaimConnection *gc =Â data; |
---|
| 1437 |     struct oscar_data *od; |
---|
| 1438 |     aim_session_t *sess; |
---|
| 1439 |     aim_conn_t *tstconn; |
---|
| 1440 | |
---|
| 1441 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 1442 | Â Â Â Â Â Â Â Â close(source); |
---|
| 1443 | Â Â Â Â Â Â Â Â return; |
---|
| 1444 | Â Â Â Â } |
---|
| 1445 | |
---|
| 1446 | Â Â Â Â od =Â gc->proto_data; |
---|
| 1447 | Â Â Â Â sess =Â od->sess; |
---|
| 1448 |     tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
---|
| 1449 | Â Â Â Â tstconn->fd =Â source; |
---|
| 1450 | |
---|
| 1451 |     if (source < 0) { |
---|
| 1452 |         aim_conn_kill(sess, &tstconn); |
---|
| 1453 |         gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1454 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to chatnav server\n"); |
---|
| 1455 | Â Â Â Â Â Â Â Â return; |
---|
| 1456 | Â Â Â Â } |
---|
| 1457 | |
---|
| 1458 |     aim_conn_completeconnect(sess, tstconn); |
---|
| 1459 |     od->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
---|
| 1460 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
---|
| 1461 | } |
---|
| 1462 | |
---|
| 1463 | static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
---|
| 1464 | { |
---|
| 1465 | Â Â Â Â GaimConnection *gc =Â data; |
---|
| 1466 |     struct oscar_data *od; |
---|
| 1467 |     aim_session_t *sess; |
---|
| 1468 |     aim_conn_t *tstconn; |
---|
| 1469 | |
---|
| 1470 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 1471 | Â Â Â Â Â Â Â Â close(source); |
---|
| 1472 | Â Â Â Â Â Â Â Â return; |
---|
| 1473 | Â Â Â Â } |
---|
| 1474 | |
---|
| 1475 | Â Â Â Â od =Â gc->proto_data; |
---|
| 1476 | Â Â Â Â sess =Â od->sess; |
---|
| 1477 |     tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
---|
| 1478 | Â Â Â Â tstconn->fd =Â source; |
---|
| 1479 | |
---|
| 1480 |     if (source < 0) { |
---|
| 1481 |         aim_conn_kill(sess, &tstconn); |
---|
| 1482 |         gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1483 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to authorizer\n"); |
---|
| 1484 | Â Â Â Â Â Â Â Â return; |
---|
| 1485 | Â Â Â Â } |
---|
| 1486 | |
---|
| 1487 |     aim_conn_completeconnect(sess, tstconn); |
---|
| 1488 |     od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
---|
| 1489 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "admin: connected\n"); |
---|
| 1490 | } |
---|
| 1491 | |
---|
| 1492 | static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
---|
| 1493 | { |
---|
| 1494 |     struct chat_connection *ccon = data; |
---|
| 1495 | Â Â Â Â GaimConnection *gc =Â ccon->gc; |
---|
| 1496 |     struct oscar_data *od; |
---|
| 1497 |     aim_session_t *sess; |
---|
| 1498 |     aim_conn_t *tstconn; |
---|
| 1499 | |
---|
| 1500 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 1501 | Â Â Â Â Â Â Â Â close(source); |
---|
| 1502 | Â Â Â Â Â Â Â Â g_free(ccon->show); |
---|
| 1503 | Â Â Â Â Â Â Â Â g_free(ccon->name); |
---|
| 1504 | Â Â Â Â Â Â Â Â g_free(ccon); |
---|
| 1505 | Â Â Â Â Â Â Â Â return; |
---|
| 1506 | Â Â Â Â } |
---|
| 1507 | |
---|
| 1508 | Â Â Â Â od =Â gc->proto_data; |
---|
| 1509 | Â Â Â Â sess =Â od->sess; |
---|
| 1510 | Â Â Â Â tstconn =Â ccon->conn; |
---|
| 1511 | Â Â Â Â tstconn->fd =Â source; |
---|
| 1512 | |
---|
| 1513 |     if (source < 0) { |
---|
| 1514 |         aim_conn_kill(sess, &tstconn); |
---|
| 1515 | Â Â Â Â Â Â Â Â g_free(ccon->show); |
---|
| 1516 | Â Â Â Â Â Â Â Â g_free(ccon->name); |
---|
| 1517 | Â Â Â Â Â Â Â Â g_free(ccon); |
---|
| 1518 | Â Â Â Â Â Â Â Â return; |
---|
| 1519 | Â Â Â Â } |
---|
| 1520 | |
---|
| 1521 |     aim_conn_completeconnect(sess, ccon->conn); |
---|
| 1522 |     ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
---|
| 1523 |     od->oscar_chats = g_slist_append(od->oscar_chats, ccon); |
---|
| 1524 | } |
---|
| 1525 | |
---|
| 1526 | static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
---|
| 1527 | Â Â Â Â GaimConnection *gc =Â data; |
---|
| 1528 |     struct oscar_data *od; |
---|
| 1529 |     aim_session_t *sess; |
---|
| 1530 |     aim_conn_t *tstconn; |
---|
| 1531 | |
---|
| 1532 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 1533 | Â Â Â Â Â Â Â Â close(source); |
---|
| 1534 | Â Â Â Â Â Â Â Â return; |
---|
| 1535 | Â Â Â Â } |
---|
| 1536 | |
---|
| 1537 | Â Â Â Â od =Â gc->proto_data; |
---|
| 1538 | Â Â Â Â sess =Â od->sess; |
---|
| 1539 |     tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
---|
| 1540 | Â Â Â Â tstconn->fd =Â source; |
---|
| 1541 | |
---|
| 1542 |     if (source < 0) { |
---|
| 1543 |         aim_conn_kill(sess, &tstconn); |
---|
| 1544 |         gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1545 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to email server\n"); |
---|
| 1546 | Â Â Â Â Â Â Â Â return; |
---|
| 1547 | Â Â Â Â } |
---|
| 1548 | |
---|
| 1549 |     aim_conn_completeconnect(sess, tstconn); |
---|
| 1550 |     od->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
---|
| 1551 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 1552 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "email: connected\n"); |
---|
| 1553 | } |
---|
| 1554 | |
---|
| 1555 | static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
---|
| 1556 | Â Â Â Â GaimConnection *gc =Â data; |
---|
| 1557 |     struct oscar_data *od; |
---|
| 1558 |     aim_session_t *sess; |
---|
| 1559 |     aim_conn_t *tstconn; |
---|
| 1560 | |
---|
| 1561 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 1562 | Â Â Â Â Â Â Â Â close(source); |
---|
| 1563 | Â Â Â Â Â Â Â Â return; |
---|
| 1564 | Â Â Â Â } |
---|
| 1565 | |
---|
| 1566 | Â Â Â Â od =Â gc->proto_data; |
---|
| 1567 | Â Â Â Â sess =Â od->sess; |
---|
| 1568 |     tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); |
---|
| 1569 | Â Â Â Â tstconn->fd =Â source; |
---|
| 1570 | |
---|
| 1571 |     if (source < 0) { |
---|
| 1572 |         aim_conn_kill(sess, &tstconn); |
---|
| 1573 |         gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1574 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to icon server\n"); |
---|
| 1575 | Â Â Â Â Â Â Â Â return; |
---|
| 1576 | Â Â Â Â } |
---|
| 1577 | |
---|
| 1578 |     aim_conn_completeconnect(sess, tstconn); |
---|
| 1579 |     od->icopa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
---|
| 1580 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); |
---|
| 1581 | } |
---|
| 1582 | |
---|
| 1583 | /* Hrmph. I don't know how to make this look better. --mid */ |
---|
| 1584 | static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1585 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 1586 | Â Â Â Â GaimAccount *account =Â gaim_connection_get_account(gc); |
---|
| 1587 |     aim_conn_t *tstconn; |
---|
| 1588 |     int i; |
---|
| 1589 |     char *host; |
---|
| 1590 |     int port; |
---|
| 1591 |     va_list ap; |
---|
| 1592 |     struct aim_redirect_data *redir; |
---|
| 1593 | |
---|
| 1594 |     port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
---|
| 1595 | |
---|
| 1596 |     va_start(ap, fr); |
---|
| 1597 |     redir = va_arg(ap, struct aim_redirect_data *); |
---|
| 1598 | Â Â Â Â va_end(ap); |
---|
| 1599 | |
---|
| 1600 |     for (i = 0; i < (int)strlen(redir->ip); i++) { |
---|
| 1601 |         if (redir->ip[i] == ':') { |
---|
| 1602 | Â Â Â Â Â Â Â Â Â Â Â Â port =Â atoi(&(redir->ip[i+1])); |
---|
| 1603 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 1604 | Â Â Â Â Â Â Â Â } |
---|
| 1605 | Â Â Â Â } |
---|
| 1606 |     host = g_strndup(redir->ip, i); |
---|
| 1607 | |
---|
| 1608 | Â Â Â Â switch(redir->group)Â { |
---|
| 1609 |     case 0x7: /* Authorizer */ |
---|
| 1610 |         gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 1611 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Reconnecting with authorizor...\n"); |
---|
| 1612 |         tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
---|
| 1613 |         if (tstconn == NULL) { |
---|
| 1614 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1615 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to reconnect with authorizer\n"); |
---|
| 1616 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1617 |             return 1; |
---|
| 1618 | Â Â Â Â Â Â Â Â } |
---|
| 1619 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
---|
| 1620 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
---|
| 1621 | |
---|
| 1622 | Â Â Â Â Â Â Â Â tstconn->status |=Â AIM_CONN_STATUS_INPROGRESS; |
---|
| 1623 |         if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
---|
| 1624 |             aim_conn_kill(sess, &tstconn); |
---|
| 1625 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1626 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to reconnect with authorizer\n"); |
---|
| 1627 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1628 |             return 1; |
---|
| 1629 | Â Â Â Â Â Â Â Â } |
---|
| 1630 |         aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
---|
| 1631 | Â Â Â Â break; |
---|
| 1632 | |
---|
| 1633 |     case 0xd: /* ChatNav */ |
---|
| 1634 |         tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); |
---|
| 1635 |         if (tstconn == NULL) { |
---|
| 1636 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1637 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to chatnav server\n"); |
---|
| 1638 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1639 |             return 1; |
---|
| 1640 | Â Â Â Â Â Â Â Â } |
---|
| 1641 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
---|
| 1642 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
---|
| 1643 | |
---|
| 1644 | Â Â Â Â Â Â Â Â tstconn->status |=Â AIM_CONN_STATUS_INPROGRESS; |
---|
| 1645 |         if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
---|
| 1646 |             aim_conn_kill(sess, &tstconn); |
---|
| 1647 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1648 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to chatnav server\n"); |
---|
| 1649 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1650 |             return 1; |
---|
| 1651 | Â Â Â Â Â Â Â Â } |
---|
| 1652 |         aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
---|
| 1653 | Â Â Â Â break; |
---|
| 1654 | |
---|
| 1655 |     case 0xe: { /* Chat */ |
---|
| 1656 |         struct chat_connection *ccon; |
---|
| 1657 | |
---|
| 1658 |         tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
---|
| 1659 |         if (tstconn == NULL) { |
---|
| 1660 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1661 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to chat server\n"); |
---|
| 1662 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1663 |             return 1; |
---|
| 1664 | Â Â Â Â Â Â Â Â } |
---|
| 1665 | |
---|
| 1666 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
---|
| 1667 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
---|
| 1668 | |
---|
| 1669 |         ccon = g_new0(struct chat_connection, 1); |
---|
| 1670 | Â Â Â Â Â Â Â Â ccon->conn =Â tstconn; |
---|
| 1671 | Â Â Â Â Â Â Â Â ccon->gc =Â gc; |
---|
| 1672 | Â Â Â Â Â Â Â Â ccon->fd =Â -1; |
---|
| 1673 | Â Â Â Â Â Â Â Â ccon->name =Â g_strdup(redir->chat.room); |
---|
| 1674 | Â Â Â Â Â Â Â Â ccon->exchange =Â redir->chat.exchange; |
---|
| 1675 | Â Â Â Â Â Â Â Â ccon->instance =Â redir->chat.instance; |
---|
| 1676 | Â Â Â Â Â Â Â Â ccon->show =Â extract_name(redir->chat.room); |
---|
| 1677 | |
---|
| 1678 | Â Â Â Â Â Â Â Â ccon->conn->status |=Â AIM_CONN_STATUS_INPROGRESS; |
---|
| 1679 |         if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
---|
| 1680 |             aim_conn_kill(sess, &tstconn); |
---|
| 1681 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1682 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to chat server\n"); |
---|
| 1683 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1684 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(ccon->show); |
---|
| 1685 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(ccon->name); |
---|
| 1686 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(ccon); |
---|
| 1687 |             return 1; |
---|
| 1688 | Â Â Â Â Â Â Â Â } |
---|
| 1689 |         aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
---|
| 1690 |         gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 1691 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Connected to chat room %s exchange %hu\n", |
---|
| 1692 |                   ccon->name, ccon->exchange); |
---|
| 1693 | Â Â Â Â }Â break; |
---|
| 1694 | |
---|
| 1695 |     case 0x0010: { /* icon */ |
---|
| 1696 |         if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { |
---|
| 1697 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1698 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to icon server\n"); |
---|
| 1699 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1700 |             return 1; |
---|
| 1701 | Â Â Â Â Â Â Â Â } |
---|
| 1702 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
---|
| 1703 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); |
---|
| 1704 | |
---|
| 1705 | Â Â Â Â Â Â Â Â tstconn->status |=Â AIM_CONN_STATUS_INPROGRESS; |
---|
| 1706 |         if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { |
---|
| 1707 |             aim_conn_kill(sess, &tstconn); |
---|
| 1708 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1709 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to icon server\n"); |
---|
| 1710 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1711 |             return 1; |
---|
| 1712 | Â Â Â Â Â Â Â Â } |
---|
| 1713 |         aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
---|
| 1714 | Â Â Â Â }Â break; |
---|
| 1715 | |
---|
| 1716 |     case 0x0018: { /* email */ |
---|
| 1717 |         if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { |
---|
| 1718 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1719 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to email server\n"); |
---|
| 1720 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1721 |             return 1; |
---|
| 1722 | Â Â Â Â Â Â Â Â } |
---|
| 1723 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
---|
| 1724 |         aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
---|
| 1725 | |
---|
| 1726 | Â Â Â Â Â Â Â Â tstconn->status |=Â AIM_CONN_STATUS_INPROGRESS; |
---|
| 1727 |         if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
---|
| 1728 |             aim_conn_kill(sess, &tstconn); |
---|
| 1729 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 1730 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unable to connect to email server\n"); |
---|
| 1731 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(host); |
---|
| 1732 |             return 1; |
---|
| 1733 | Â Â Â Â Â Â Â Â } |
---|
| 1734 |         aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
---|
| 1735 | Â Â Â Â }Â break; |
---|
| 1736 | |
---|
| 1737 | Â Â Â Â default:Â /* huh? */ |
---|
| 1738 |         gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 1739 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "got redirect for unknown service 0x%04hx\n", |
---|
| 1740 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â redir->group); |
---|
| 1741 | Â Â Â Â Â Â Â Â break; |
---|
| 1742 | Â Â Â Â } |
---|
| 1743 | |
---|
| 1744 | Â Â Â Â g_free(host); |
---|
| 1745 |     return 1; |
---|
| 1746 | } |
---|
| 1747 | |
---|
| 1748 | static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1749 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 1750 |     struct oscar_data *od = gc->proto_data; |
---|
| 1751 |     struct buddyinfo *bi; |
---|
| 1752 |     time_t time_idle = 0, signon = 0; |
---|
| 1753 |     int type = 0; |
---|
| 1754 |     int caps = 0; |
---|
| 1755 |     va_list ap; |
---|
| 1756 |     aim_userinfo_t *info; |
---|
| 1757 | |
---|
| 1758 |     va_start(ap, fr); |
---|
| 1759 |     info = va_arg(ap, aim_userinfo_t *); |
---|
| 1760 | Â Â Â Â va_end(ap); |
---|
| 1761 | |
---|
| 1762 |     if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
---|
| 1763 | Â Â Â Â Â Â Â Â caps =Â info->capabilities; |
---|
| 1764 |     if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
---|
| 1765 | Â Â Â Â Â Â Â Â type |=Â UC_AB; |
---|
| 1766 |     if (caps & AIM_CAPS_HIPTOP) |
---|
| 1767 | Â Â Â Â Â Â Â Â type |=Â UC_HIPTOP; |
---|
| 1768 | |
---|
| 1769 |     if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
---|
| 1770 |         if (info->flags & AIM_FLAG_UNCONFIRMED) |
---|
| 1771 | Â Â Â Â Â Â Â Â Â Â Â Â type |=Â UC_UNCONFIRMED; |
---|
| 1772 |         if (info->flags & AIM_FLAG_ADMINISTRATOR) |
---|
| 1773 | Â Â Â Â Â Â Â Â Â Â Â Â type |=Â UC_ADMIN; |
---|
| 1774 |         if (info->flags & AIM_FLAG_AOL) |
---|
| 1775 | Â Â Â Â Â Â Â Â Â Â Â Â type |=Â UC_AOL; |
---|
| 1776 |         if (info->flags & AIM_FLAG_FREE) |
---|
| 1777 | Â Â Â Â Â Â Â Â Â Â Â Â type |=Â UC_NORMAL; |
---|
| 1778 |         if (info->flags & AIM_FLAG_AWAY) |
---|
| 1779 | Â Â Â Â Â Â Â Â Â Â Â Â type |=Â UC_UNAVAILABLE; |
---|
| 1780 |         if (info->flags & AIM_FLAG_WIRELESS) |
---|
| 1781 | Â Â Â Â Â Â Â Â Â Â Â Â type |=Â UC_WIRELESS; |
---|
| 1782 | Â Â Â Â } |
---|
| 1783 |     if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
---|
| 1784 | Â Â Â Â Â Â Â Â type =Â (info->icqinfo.status <<Â 16); |
---|
| 1785 |         if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
---|
| 1786 | Â Â Â Â Â Â Â Â Â Â Â (info->icqinfo.status !=Â AIM_ICQ_STATE_NORMAL))Â { |
---|
| 1787 | Â Â Â Â Â Â Â Â Â Â Â Â type |=Â UC_UNAVAILABLE; |
---|
| 1788 | Â Â Â Â Â Â Â Â } |
---|
| 1789 | Â Â Â Â } |
---|
| 1790 | |
---|
| 1791 |     if (caps & AIM_CAPS_ICQ) |
---|
| 1792 | Â Â Â Â Â Â Â Â caps ^=Â AIM_CAPS_ICQ; |
---|
| 1793 | |
---|
| 1794 |     if (info->present & AIM_USERINFO_PRESENT_IDLE) { |
---|
| 1795 | Â Â Â Â Â Â Â Â time(&time_idle); |
---|
| 1796 | Â Â Â Â Â Â Â Â time_idle -=Â info->idletime*60; |
---|
| 1797 | Â Â Â Â } |
---|
| 1798 | |
---|
| 1799 |     if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
---|
| 1800 | Â Â Â Â Â Â Â Â signon =Â info->onlinesince; |
---|
| 1801 |     else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
---|
| 1802 | Â Â Â Â Â Â Â Â signon =Â time(NULL)Â -Â info->sessionlen; |
---|
| 1803 | |
---|
| 1804 |     if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
---|
| 1805 |         gaim_connection_set_display_name(gc, info->sn); |
---|
| 1806 | |
---|
| 1807 |     bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn)); |
---|
| 1808 |     if (!bi) { |
---|
| 1809 |         bi = g_new0(struct buddyinfo, 1); |
---|
| 1810 |         g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi); |
---|
| 1811 | Â Â Â Â } |
---|
| 1812 |     bi->signon = info->onlinesince ? info->onlinesince : (info->sessionlen + time(NULL)); |
---|
| 1813 |     if (caps) |
---|
| 1814 | Â Â Â Â Â Â Â Â bi->caps =Â caps; |
---|
| 1815 | Â Â Â Â bi->typingnot =Â FALSE; |
---|
| 1816 | Â Â Â Â bi->ico_informed =Â FALSE; |
---|
| 1817 | Â Â Â Â bi->ipaddr =Â info->icqinfo.ipaddr; |
---|
| 1818 | |
---|
| 1819 | Â Â Â Â /* Available message stuff */ |
---|
| 1820 | Â Â Â Â free(bi->availmsg); |
---|
| 1821 |     if (info->availmsg) |
---|
| 1822 |         if (info->availmsg_encoding) { |
---|
| 1823 |             gchar *enc = g_strdup_printf("charset=\"%s\"", info->availmsg_encoding); |
---|
| 1824 |             bi->availmsg = oscar_encoding_to_utf8(enc, info->availmsg, info->availmsg_len); |
---|
| 1825 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(enc); |
---|
| 1826 |         } else { |
---|
| 1827 |             /* No explicit encoding means utf8. Yay. */ |
---|
| 1828 | Â Â Â Â Â Â Â Â Â Â Â Â bi->availmsg =Â g_strdup(info->availmsg); |
---|
| 1829 | Â Â Â Â Â Â Â Â } |
---|
| 1830 | Â Â Â Â else |
---|
| 1831 | Â Â Â Â Â Â Â Â bi->availmsg =Â NULL; |
---|
| 1832 | |
---|
| 1833 | Â Â Â Â /* Server stored icon stuff */ |
---|
| 1834 |     if (info->iconcsumlen) { |
---|
| 1835 |         char *b16, *saved_b16; |
---|
| 1836 | Â Â Â Â Â Â Â Â GaimBuddy *b; |
---|
| 1837 | |
---|
| 1838 | Â Â Â Â Â Â Â Â free(bi->iconcsum); |
---|
| 1839 | Â Â Â Â Â Â Â Â bi->iconcsum =Â malloc(info->iconcsumlen); |
---|
| 1840 |         memcpy(bi->iconcsum, info->iconcsum, info->iconcsumlen); |
---|
| 1841 | Â Â Â Â Â Â Â Â bi->iconcsumlen =Â info->iconcsumlen; |
---|
| 1842 |         b16 = tobase16(bi->iconcsum, bi->iconcsumlen); |
---|
| 1843 |         b = gaim_find_buddy(gc->account, info->sn); |
---|
| 1844 |         saved_b16 = gaim_buddy_get_setting(b, "icon_checksum"); |
---|
| 1845 |         if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { |
---|
| 1846 | Â Â Â Â Â Â Â Â Â Â Â Â GSList *cur =Â od->requesticon; |
---|
| 1847 |             while (cur && aim_sncmp((char *)cur->data, info->sn)) |
---|
| 1848 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â cur =Â cur->next; |
---|
| 1849 |             if (!cur) { |
---|
| 1850 |                 od->requesticon = g_slist_append(od->requesticon, strdup(normalize(info->sn))); |
---|
| 1851 |                 if (od->icontimer) |
---|
| 1852 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_source_remove(od->icontimer); |
---|
| 1853 |                 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); |
---|
| 1854 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 1855 | Â Â Â Â Â Â Â Â } |
---|
| 1856 | Â Â Â Â Â Â Â Â g_free(saved_b16); |
---|
| 1857 | Â Â Â Â Â Â Â Â g_free(b16); |
---|
| 1858 | Â Â Â Â } |
---|
| 1859 | |
---|
| 1860 |     serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); |
---|
| 1861 | |
---|
| 1862 |     return 1; |
---|
| 1863 | } |
---|
| 1864 | |
---|
| 1865 | static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1866 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 1867 |     struct oscar_data *od = gc->proto_data; |
---|
| 1868 |     va_list ap; |
---|
| 1869 |     aim_userinfo_t *info; |
---|
| 1870 | |
---|
| 1871 |     va_start(ap, fr); |
---|
| 1872 |     info = va_arg(ap, aim_userinfo_t *); |
---|
| 1873 | Â Â Â Â va_end(ap); |
---|
| 1874 | |
---|
| 1875 |     serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
---|
| 1876 | |
---|
| 1877 |     g_hash_table_remove(od->buddyinfo, normalize(info->sn)); |
---|
| 1878 | |
---|
| 1879 |     return 1; |
---|
| 1880 | } |
---|
| 1881 | |
---|
| 1882 | static void cancel_direct_im(struct ask_direct *d) { |
---|
| 1883 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "Freeing DirectIM prompts.\n"); |
---|
| 1884 | |
---|
| 1885 | Â Â Â Â g_free(d->sn); |
---|
| 1886 | Â Â Â Â g_free(d); |
---|
| 1887 | } |
---|
| 1888 | |
---|
| 1889 | static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
---|
| 1890 |     struct direct_im *dim = data; |
---|
| 1891 | Â Â Â Â GaimConnection *gc =Â dim->gc; |
---|
| 1892 |     struct oscar_data *od = gc->proto_data; |
---|
| 1893 | Â Â Â Â GaimConversation *cnv; |
---|
| 1894 |     char buf[256]; |
---|
| 1895 |     struct sockaddr name; |
---|
| 1896 |     socklen_t name_len = 1; |
---|
| 1897 | Â Â Â Â |
---|
| 1898 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 1899 | Â Â Â Â Â Â Â Â g_free(dim); |
---|
| 1900 | Â Â Â Â Â Â Â Â return; |
---|
| 1901 | Â Â Â Â } |
---|
| 1902 | |
---|
| 1903 |     if (source < 0) { |
---|
| 1904 | Â Â Â Â Â Â Â Â g_free(dim); |
---|
| 1905 | Â Â Â Â Â Â Â Â return; |
---|
| 1906 | Â Â Â Â } |
---|
| 1907 | |
---|
| 1908 | Â Â Â Â dim->conn->fd =Â source; |
---|
| 1909 |     aim_conn_completeconnect(od->sess, dim->conn); |
---|
| 1910 |     cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); |
---|
| 1911 | |
---|
| 1912 | Â Â Â Â /* This is the best way to see if we're connected or not */ |
---|
| 1913 |     if (getpeername(source, &name, &name_len) == 0) { |
---|
| 1914 |         g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); |
---|
| 1915 | Â Â Â Â Â Â Â Â dim->connected =Â TRUE; |
---|
| 1916 |         gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
---|
| 1917 | Â Â Â Â } |
---|
| 1918 |     od->direct_ims = g_slist_append(od->direct_ims, dim); |
---|
| 1919 | Â Â Â Â |
---|
| 1920 |     dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
---|
| 1921 | } |
---|
| 1922 | |
---|
| 1923 | /* BBB */ |
---|
| 1924 | /* |
---|
| 1925 |  * This is called after a remote AIM user has connected to us. We |
---|
| 1926 | Â * want to do some voodoo with the socket file descriptors, add a |
---|
| 1927 | Â * callback or two, and then send the AIM_CB_OFT_PROMPT. |
---|
| 1928 | Â */ |
---|
| 1929 | static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 1930 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 1931 |     struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
---|
| 1932 | Â Â Â Â GaimXfer *xfer; |
---|
| 1933 |     struct aim_oft_info *oft_info; |
---|
| 1934 |     va_list ap; |
---|
| 1935 |     aim_conn_t *conn, *listenerconn; |
---|
| 1936 | |
---|
| 1937 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 1938 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "AAA - in oscar_sendfile_estblsh\n"); |
---|
| 1939 |     va_start(ap, fr); |
---|
| 1940 |     conn = va_arg(ap, aim_conn_t *); |
---|
| 1941 |     listenerconn = va_arg(ap, aim_conn_t *); |
---|
| 1942 | Â Â Â Â va_end(ap); |
---|
| 1943 | |
---|
| 1944 |     if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
---|
| 1945 |         return 1; |
---|
| 1946 | |
---|
| 1947 |     if (!(oft_info = xfer->data)) |
---|
| 1948 |         return 1; |
---|
| 1949 | |
---|
| 1950 | Â Â Â Â /* Stop watching listener conn; watch transfer conn instead */ |
---|
| 1951 | Â Â Â Â gaim_input_remove(xfer->watcher); |
---|
| 1952 |     aim_conn_kill(sess, &listenerconn); |
---|
| 1953 | |
---|
| 1954 | Â Â Â Â oft_info->conn =Â conn; |
---|
| 1955 | Â Â Â Â xfer->fd =Â oft_info->conn->fd; |
---|
| 1956 | |
---|
| 1957 |     aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); |
---|
| 1958 |     aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); |
---|
| 1959 |     xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
---|
| 1960 | |
---|
| 1961 | Â Â Â Â /* Inform the other user that we are connected and ready to transfer */ |
---|
| 1962 |     aim_oft_sendheader(sess, AIM_CB_OFT_PROMPT, oft_info); |
---|
| 1963 | |
---|
| 1964 |     return 0; |
---|
| 1965 | } |
---|
| 1966 | |
---|
| 1967 | /* |
---|
| 1968 | Â * This is the gaim callback passed to gaim_proxy_connect when connecting to another AIM |
---|
| 1969 | Â * user in order to transfer a file. |
---|
| 1970 | Â */ |
---|
| 1971 | static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition) { |
---|
| 1972 | Â Â Â Â GaimXfer *xfer; |
---|
| 1973 |     struct aim_oft_info *oft_info; |
---|
| 1974 | |
---|
| 1975 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 1976 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "AAA - in oscar_sendfile_connected\n"); |
---|
| 1977 |     if (!(xfer = data)) |
---|
| 1978 | Â Â Â Â Â Â Â Â return; |
---|
| 1979 |     if (!(oft_info = xfer->data)) |
---|
| 1980 | Â Â Â Â Â Â Â Â return; |
---|
| 1981 |     if (source < 0) |
---|
| 1982 | Â Â Â Â Â Â Â Â return; |
---|
| 1983 | |
---|
| 1984 | Â Â Â Â xfer->fd =Â source; |
---|
| 1985 | Â Â Â Â oft_info->conn->fd =Â source; |
---|
| 1986 | |
---|
| 1987 |     aim_conn_completeconnect(oft_info->sess, oft_info->conn); |
---|
| 1988 |     xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
---|
| 1989 | |
---|
| 1990 | Â Â Â Â /* Inform the other user that we are connected and ready to transfer */ |
---|
| 1991 |     aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); |
---|
| 1992 | |
---|
| 1993 | Â Â Â Â return; |
---|
| 1994 | } |
---|
| 1995 | |
---|
| 1996 | /* |
---|
| 1997 |  * This is called when a buddy sends us some file info. This happens when they |
---|
| 1998 | Â * are sending a file to you, and you have just established a connection to them. |
---|
| 1999 |  * You should send them the exact same info except use the real cookie. We also |
---|
| 2000 | Â * get like totally ready to like, receive the file, kay? |
---|
| 2001 | Â */ |
---|
| 2002 | static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 2003 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 2004 |     struct oscar_data *od = gc->proto_data; |
---|
| 2005 | Â Â Â Â GaimXfer *xfer; |
---|
| 2006 |     struct aim_oft_info *oft_info; |
---|
| 2007 |     va_list ap; |
---|
| 2008 |     aim_conn_t *conn; |
---|
| 2009 |     fu8_t *cookie; |
---|
| 2010 |     struct aim_fileheader_t *fh; |
---|
| 2011 | |
---|
| 2012 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2013 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "AAA - in oscar_sendfile_prompt\n"); |
---|
| 2014 |     va_start(ap, fr); |
---|
| 2015 |     conn = va_arg(ap, aim_conn_t *); |
---|
| 2016 |     cookie = va_arg(ap, fu8_t *); |
---|
| 2017 |     fh = va_arg(ap, struct aim_fileheader_t *); |
---|
| 2018 | Â Â Â Â va_end(ap); |
---|
| 2019 | |
---|
| 2020 |     if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) |
---|
| 2021 |         return 1; |
---|
| 2022 | |
---|
| 2023 |     if (!(oft_info = xfer->data)) |
---|
| 2024 |         return 1; |
---|
| 2025 | |
---|
| 2026 | Â Â Â Â /* We want to stop listening with a normal thingy */ |
---|
| 2027 | Â Â Â Â gaim_input_remove(xfer->watcher); |
---|
| 2028 | Â Â Â Â xfer->watcher =Â 0; |
---|
| 2029 | |
---|
| 2030 | Â Â Â Â /* They sent us some information about the file they're sending */ |
---|
| 2031 |     memcpy(&oft_info->fh, fh, sizeof(*fh)); |
---|
| 2032 | |
---|
| 2033 | Â Â Â Â /* Fill in the cookie */ |
---|
| 2034 |     memcpy(&oft_info->fh.bcookie, oft_info->cookie, 8); |
---|
| 2035 | |
---|
| 2036 | Â Â Â Â /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ |
---|
| 2037 |     aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); |
---|
| 2038 |     gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
---|
| 2039 | |
---|
| 2040 |     return 0; |
---|
| 2041 | } |
---|
| 2042 | |
---|
| 2043 | /* |
---|
| 2044 |  * We are sending a file to someone else. They have just acknowledged our |
---|
| 2045 | Â * prompt, so we want to start sending data like there's no tomorrow. |
---|
| 2046 | Â */ |
---|
| 2047 | static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 2048 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 2049 |     struct oscar_data *od = gc->proto_data; |
---|
| 2050 | Â Â Â Â GaimXfer *xfer; |
---|
| 2051 |     va_list ap; |
---|
| 2052 |     aim_conn_t *conn; |
---|
| 2053 |     fu8_t *cookie; |
---|
| 2054 |     struct aim_fileheader_t *fh; |
---|
| 2055 | |
---|
| 2056 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_ack\n"); |
---|
| 2057 |     va_start(ap, fr); |
---|
| 2058 |     conn = va_arg(ap, aim_conn_t *); |
---|
| 2059 |     cookie = va_arg(ap, fu8_t *); |
---|
| 2060 |     fh = va_arg(ap, struct aim_fileheader_t *); |
---|
| 2061 | Â Â Â Â va_end(ap); |
---|
| 2062 | |
---|
| 2063 |     if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) |
---|
| 2064 |         return 1; |
---|
| 2065 | |
---|
| 2066 | Â Â Â Â /* We want to stop listening with a normal thingy */ |
---|
| 2067 | Â Â Â Â gaim_input_remove(xfer->watcher); |
---|
| 2068 | Â Â Â Â xfer->watcher =Â 0; |
---|
| 2069 | |
---|
| 2070 |     gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
---|
| 2071 | |
---|
| 2072 |     return 0; |
---|
| 2073 | } |
---|
| 2074 | |
---|
| 2075 | /* |
---|
| 2076 |  * We just sent a file to someone. They said they got it and everything, |
---|
| 2077 | Â * so we can close our direct connection and what not. |
---|
| 2078 | Â */ |
---|
| 2079 | static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 2080 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 2081 |     struct oscar_data *od = gc->proto_data; |
---|
| 2082 | Â Â Â Â GaimXfer *xfer; |
---|
| 2083 |     va_list ap; |
---|
| 2084 |     aim_conn_t *conn; |
---|
| 2085 |     fu8_t *cookie; |
---|
| 2086 |     struct aim_fileheader_t *fh; |
---|
| 2087 | |
---|
| 2088 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_done\n"); |
---|
| 2089 |     va_start(ap, fr); |
---|
| 2090 |     conn = va_arg(ap, aim_conn_t *); |
---|
| 2091 |     cookie = va_arg(ap, fu8_t *); |
---|
| 2092 |     fh = va_arg(ap, struct aim_fileheader_t *); |
---|
| 2093 | Â Â Â Â va_end(ap); |
---|
| 2094 | |
---|
| 2095 |     if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) |
---|
| 2096 |         return 1; |
---|
| 2097 | |
---|
| 2098 | Â Â Â Â xfer->fd =Â conn->fd; |
---|
| 2099 | Â Â Â Â gaim_xfer_end(xfer); |
---|
| 2100 | |
---|
| 2101 |     return 0; |
---|
| 2102 | } |
---|
| 2103 | |
---|
| 2104 | static void accept_direct_im(struct ask_direct *d) { |
---|
| 2105 | Â Â Â Â GaimConnection *gc =Â d->gc; |
---|
| 2106 |     struct oscar_data *od; |
---|
| 2107 |     struct direct_im *dim; |
---|
| 2108 |     char *host; int port = 4443; |
---|
| 2109 |     int i, rc; |
---|
| 2110 | |
---|
| 2111 |     if (!g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 2112 | Â Â Â Â Â Â Â Â cancel_direct_im(d); |
---|
| 2113 | Â Â Â Â Â Â Â Â return; |
---|
| 2114 | Â Â Â Â } |
---|
| 2115 | |
---|
| 2116 |     od = (struct oscar_data *)gc->proto_data; |
---|
| 2117 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); |
---|
| 2118 | |
---|
| 2119 |     dim = find_direct_im(od, d->sn); |
---|
| 2120 |     if (dim) { |
---|
| 2121 | Â Â Â Â Â Â Â Â cancel_direct_im(d);Â /* 40 */ |
---|
| 2122 | Â Â Â Â Â Â Â Â return; |
---|
| 2123 | Â Â Â Â } |
---|
| 2124 |     dim = g_new0(struct direct_im, 1); |
---|
| 2125 | Â Â Â Â dim->gc =Â d->gc; |
---|
| 2126 |     g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); |
---|
| 2127 | |
---|
| 2128 |     dim->conn = aim_odc_connect(od->sess, d->sn, NULL, d->cookie); |
---|
| 2129 |     if (!dim->conn) { |
---|
| 2130 | Â Â Â Â Â Â Â Â g_free(dim); |
---|
| 2131 | Â Â Â Â Â Â Â Â cancel_direct_im(d); |
---|
| 2132 | Â Â Â Â Â Â Â Â return; |
---|
| 2133 | Â Â Â Â } |
---|
| 2134 | |
---|
| 2135 |     aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
---|
| 2136 |                 gaim_odc_incoming, 0); |
---|
| 2137 |     aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, |
---|
| 2138 |                 gaim_odc_typing, 0); |
---|
| 2139 |     aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
---|
| 2140 |                 gaim_odc_update_ui, 0); |
---|
| 2141 |     for (i = 0; i < (int)strlen(d->ip); i++) { |
---|
| 2142 |         if (d->ip[i] == ':') { |
---|
| 2143 | Â Â Â Â Â Â Â Â Â Â Â Â port =Â atoi(&(d->ip[i+1])); |
---|
| 2144 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 2145 | Â Â Â Â Â Â Â Â } |
---|
| 2146 | Â Â Â Â } |
---|
| 2147 |     host = g_strndup(d->ip, i); |
---|
| 2148 | Â Â Â Â dim->conn->status |=Â AIM_CONN_STATUS_INPROGRESS; |
---|
| 2149 |     rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
---|
| 2150 | Â Â Â Â g_free(host); |
---|
| 2151 |     if (rc < 0) { |
---|
| 2152 |         aim_conn_kill(od->sess, &dim->conn); |
---|
| 2153 | Â Â Â Â Â Â Â Â g_free(dim); |
---|
| 2154 | Â Â Â Â Â Â Â Â cancel_direct_im(d); |
---|
| 2155 | Â Â Â Â Â Â Â Â return; |
---|
| 2156 | Â Â Â Â } |
---|
| 2157 | |
---|
| 2158 | Â Â Â Â cancel_direct_im(d); |
---|
| 2159 | |
---|
| 2160 | Â Â Â Â return; |
---|
| 2161 | } |
---|
| 2162 | |
---|
| 2163 | static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
---|
| 2164 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 2165 |     struct oscar_data *od = gc->proto_data; |
---|
| 2166 |     char *tmp; |
---|
| 2167 | Â Â Â Â GaimImFlags flags =Â 0; |
---|
| 2168 | Â Â Â Â gsize convlen; |
---|
| 2169 | Â Â Â Â GError *err =Â NULL; |
---|
| 2170 |     struct buddyinfo *bi; |
---|
| 2171 |     const char *iconfile; |
---|
| 2172 | |
---|
| 2173 |     bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn)); |
---|
| 2174 |     if (!bi) { |
---|
| 2175 |         bi = g_new0(struct buddyinfo, 1); |
---|
| 2176 |         g_hash_table_insert(od->buddyinfo, g_strdup(normalize(userinfo->sn)), bi); |
---|
| 2177 | Â Â Â Â } |
---|
| 2178 | |
---|
| 2179 |     if (args->icbmflags & AIM_IMFLAGS_AWAY) |
---|
| 2180 | Â Â Â Â Â Â Â Â flags |=Â GAIM_IM_AUTO_RESP; |
---|
| 2181 | |
---|
| 2182 |     if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
---|
| 2183 | Â Â Â Â Â Â Â Â bi->typingnot =Â TRUE; |
---|
| 2184 | Â Â Â Â else |
---|
| 2185 | Â Â Â Â Â Â Â Â bi->typingnot =Â FALSE; |
---|
| 2186 | |
---|
| 2187 |     if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { |
---|
| 2188 |         gaim_debug(GAIM_DEBUG_MISC, "oscar", |
---|
| 2189 |                   "%s has an icon\n", userinfo->sn); |
---|
| 2190 |         if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
---|
| 2191 | Â Â Â Â Â Â Â Â Â Â Â Â bi->ico_need =Â TRUE; |
---|
| 2192 | Â Â Â Â Â Â Â Â Â Â Â Â bi->ico_len =Â args->iconlen; |
---|
| 2193 | Â Â Â Â Â Â Â Â Â Â Â Â bi->ico_csum =Â args->iconsum; |
---|
| 2194 | Â Â Â Â Â Â Â Â Â Â Â Â bi->ico_time =Â args->iconstamp; |
---|
| 2195 | Â Â Â Â Â Â Â Â } |
---|
| 2196 | Â Â Â Â } |
---|
| 2197 | |
---|
| 2198 |     if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && |
---|
| 2199 | Â Â Â Â Â Â (args->icbmflags &Â AIM_IMFLAGS_BUDDYREQ))Â { |
---|
| 2200 | Â Â Â Â Â Â Â Â FILEÂ *file; |
---|
| 2201 |         struct stat st; |
---|
| 2202 | |
---|
| 2203 |         if (!stat(iconfile, &st)) { |
---|
| 2204 |             char *buf = g_malloc(st.st_size); |
---|
| 2205 |             file = fopen(iconfile, "rb"); |
---|
| 2206 |             if (file) { |
---|
| 2207 |                 int len = fread(buf, 1, st.st_size, file); |
---|
| 2208 |                 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2209 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Sending buddy icon to %s (%d bytes, " |
---|
| 2210 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "%lu reported)\n", |
---|
| 2211 |                           userinfo->sn, len, st.st_size); |
---|
| 2212 |                 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, |
---|
| 2213 |                     st.st_mtime, aimutil_iconsum(buf, st.st_size)); |
---|
| 2214 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â fclose(file); |
---|
| 2215 | Â Â Â Â Â Â Â Â Â Â Â Â }Â else |
---|
| 2216 |                 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 2217 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Can't open buddy icon file!\n"); |
---|
| 2218 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(buf); |
---|
| 2219 | Â Â Â Â Â Â Â Â }Â else |
---|
| 2220 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 2221 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Can't stat buddy icon file!\n"); |
---|
| 2222 | Â Â Â Â } |
---|
| 2223 | |
---|
| 2224 |     gaim_debug(GAIM_DEBUG_MISC, "oscar", |
---|
| 2225 |               "Character set is %hu %hu\n", args->charset, args->charsubset); |
---|
| 2226 |     if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
---|
| 2227 | Â Â Â Â Â Â Â Â /* This message is marked as UNICODE, so we have to |
---|
| 2228 | Â Â Â Â Â Â Â Â Â * convert it to utf-8 before handing it to the gaim core. |
---|
| 2229 | Â Â Â Â Â Â Â Â Â * This conversion should *never* fail, if it does it |
---|
| 2230 | Â Â Â Â Â Â Â Â Â * means that either the incoming ICBM is corrupted or |
---|
| 2231 | Â Â Â Â Â Â Â Â Â * there is something we don't understand about it. |
---|
| 2232 | Â Â Â Â Â Â Â Â Â * For the record, AIM Unicode is big-endian UCS-2 */ |
---|
| 2233 | |
---|
| 2234 |         gaim_debug(GAIM_DEBUG_INFO, "oscar", "Received UNICODE IM\n"); |
---|
| 2235 | |
---|
| 2236 |         if (!args->msg || !args->msglen) |
---|
| 2237 |             return 1; |
---|
| 2238 | |
---|
| 2239 |         tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
---|
| 2240 |         if (err) { |
---|
| 2241 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2242 |                       "Unicode IM conversion: %s\n", err->message); |
---|
| 2243 | Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â strdup(_("(There was an error receiving this message)")); |
---|
| 2244 | Â Â Â Â Â Â Â Â Â Â Â Â g_error_free(err); |
---|
| 2245 | Â Â Â Â Â Â Â Â } |
---|
| 2246 |     } else { |
---|
| 2247 | Â Â Â Â Â Â Â Â /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
---|
| 2248 |          * unflagged messages, which are ASCII. That's OK because |
---|
| 2249 | Â Â Â Â Â Â Â Â Â * ASCII is a strict subset of ISO-8859-1; this should |
---|
| 2250 | Â Â Â Â Â Â Â Â Â * help with compatibility with old, broken versions of |
---|
| 2251 | Â Â Â Â Â Â Â Â Â * gaim (everything before 0.60) and other broken clients |
---|
| 2252 | Â Â Â Â Â Â Â Â Â * that will happily send ISO-8859-1 without marking it as |
---|
| 2253 | Â Â Â Â Â Â Â Â Â * such */ |
---|
| 2254 |         if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
---|
| 2255 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2256 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Received ISO-8859-1 IM\n"); |
---|
| 2257 | |
---|
| 2258 |         if (!args->msg || !args->msglen) |
---|
| 2259 |             return 1; |
---|
| 2260 | |
---|
| 2261 |         tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
---|
| 2262 |         if (err) { |
---|
| 2263 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2264 |                       "ISO-8859-1 IM conversion: %s\n", err->message); |
---|
| 2265 | Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â strdup(_("(There was an error receiving this message)")); |
---|
| 2266 | Â Â Â Â Â Â Â Â Â Â Â Â g_error_free(err); |
---|
| 2267 | Â Â Â Â Â Â Â Â } |
---|
| 2268 | Â Â Â Â } |
---|
| 2269 | |
---|
| 2270 | Â Â Â Â /* strip_linefeed(tmp); */ |
---|
| 2271 |     serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
---|
| 2272 | Â Â Â Â g_free(tmp); |
---|
| 2273 | |
---|
| 2274 |     return 1; |
---|
| 2275 | } |
---|
| 2276 | |
---|
| 2277 | static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
---|
| 2278 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 2279 |     struct oscar_data *od = gc->proto_data; |
---|
| 2280 |     const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); |
---|
| 2281 | |
---|
| 2282 |     if (!args) |
---|
| 2283 |         return 0; |
---|
| 2284 | |
---|
| 2285 |     gaim_debug(GAIM_DEBUG_MISC, "oscar", |
---|
| 2286 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â "rendezvous with %s, status is %hu\n", |
---|
| 2287 |               userinfo->sn, args->status); |
---|
| 2288 | |
---|
| 2289 |     if (args->reqclass & AIM_CAPS_CHAT) { |
---|
| 2290 |         char *name; |
---|
| 2291 | Â Â Â Â Â Â Â Â GHashTable *components; |
---|
| 2292 | |
---|
| 2293 |         if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
---|
| 2294 |             return 1; |
---|
| 2295 |         components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
---|
| 2296 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free); |
---|
| 2297 | Â Â Â Â Â Â Â Â name =Â extract_name(args->info.chat.roominfo.name); |
---|
| 2298 |         g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name)); |
---|
| 2299 |         g_hash_table_replace(components, g_strdup("exchange"), g_strdup_printf("%d", args->info.chat.roominfo.exchange)); |
---|
| 2300 | Â Â Â Â Â Â Â Â serv_got_chat_invite(gc, |
---|
| 2301 |                    name ? name : args->info.chat.roominfo.name, |
---|
| 2302 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â userinfo->sn, |
---|
| 2303 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â args->msg, |
---|
| 2304 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â components); |
---|
| 2305 |         if (name) |
---|
| 2306 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(name); |
---|
| 2307 |     } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
---|
| 2308 | /* BBB */ |
---|
| 2309 |         if (args->status == AIM_RENDEZVOUS_PROPOSE) { |
---|
| 2310 | Â Â Â Â Â Â Â Â Â Â Â Â /* Someone wants to send a file (or files) to us */ |
---|
| 2311 | Â Â Â Â Â Â Â Â Â Â Â Â GaimXfer *xfer; |
---|
| 2312 |             struct aim_oft_info *oft_info; |
---|
| 2313 | |
---|
| 2314 |             if (!args->cookie || !args->port || !args->verifiedip || |
---|
| 2315 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â !args->info.sendfile.filename ||Â !args->info.sendfile.totsize ||Â |
---|
| 2316 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â !args->info.sendfile.totfiles ||Â !args->reqclass)Â { |
---|
| 2317 |                 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 2318 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "%s tried to send you a file with incomplete " |
---|
| 2319 |                           "information.\n", userinfo->sn); |
---|
| 2320 |                 if (args->proxyip) |
---|
| 2321 |                     gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 2322 |                               "IP for a proxy server was given. Gaim " |
---|
| 2323 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "does not support this yet.\n"); |
---|
| 2324 |                 return 1; |
---|
| 2325 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2326 | |
---|
| 2327 |             if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { |
---|
| 2328 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â /* last char of the ft req is a star, they are sending us a |
---|
| 2329 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â * directory -- remove the star and trailing slash so we dont save |
---|
| 2330 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â * directories that look like 'dirname\*'Â -- arl */ |
---|
| 2331 |                 char *tmp = strrchr(args->info.sendfile.filename, '\\'); |
---|
| 2332 |                 if (tmp && (tmp[1] == '*')) { |
---|
| 2333 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp[0]Â =Â '\0'; |
---|
| 2334 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2335 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2336 | |
---|
| 2337 | Â Â Â Â Â Â Â Â Â Â Â Â /* Build the file transfer handle */ |
---|
| 2338 |             xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); |
---|
| 2339 | Â Â Â Â Â Â Â Â Â Â Â Â xfer->remote_ip =Â g_strdup(args->verifiedip); |
---|
| 2340 | Â Â Â Â Â Â Â Â Â Â Â Â xfer->remote_port =Â args->port; |
---|
| 2341 |             gaim_xfer_set_filename(xfer, args->info.sendfile.filename); |
---|
| 2342 |             gaim_xfer_set_size(xfer, args->info.sendfile.totsize); |
---|
| 2343 | |
---|
| 2344 | Â Â Â Â Â Â Â Â Â Â Â Â /* Create the oscar-specific data */ |
---|
| 2345 |             oft_info = aim_oft_createinfo(od->sess, args->cookie, userinfo->sn, args->clientip, xfer->remote_port, 0, 0, NULL); |
---|
| 2346 |             if (args->proxyip) |
---|
| 2347 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â oft_info->proxyip =Â g_strdup(args->proxyip); |
---|
| 2348 |             if (args->verifiedip) |
---|
| 2349 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â oft_info->verifiedip =Â g_strdup(args->verifiedip); |
---|
| 2350 | Â Â Â Â Â Â Â Â Â Â Â Â xfer->data =Â oft_info; |
---|
| 2351 | |
---|
| 2352 | Â Â Â Â Â Â Â Â Â Â Â Â Â /* Setup our I/O op functions */ |
---|
| 2353 |             gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); |
---|
| 2354 |             gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); |
---|
| 2355 |             gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
---|
| 2356 |             gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
---|
| 2357 |             gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
---|
| 2358 |             gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
---|
| 2359 | |
---|
| 2360 | Â Â Â Â Â Â Â Â Â Â Â Â /* |
---|
| 2361 | Â Â Â Â Â Â Â Â Â Â Â Â Â * XXX - Should do something with args->msg, args->encoding, and args->language |
---|
| 2362 | Â Â Â Â Â Â Â Â Â Â Â Â Â *Â Â Â Â probably make it apply to all ch2 messages. |
---|
| 2363 | Â Â Â Â Â Â Â Â Â Â Â Â Â */ |
---|
| 2364 | |
---|
| 2365 | Â Â Â Â Â Â Â Â Â Â Â Â /* Keep track of this transfer for later */ |
---|
| 2366 |             od->file_transfers = g_slist_append(od->file_transfers, xfer); |
---|
| 2367 | |
---|
| 2368 | Â Â Â Â Â Â Â Â Â Â Â Â /* Now perform the request */ |
---|
| 2369 | Â Â Â Â Â Â Â Â Â Â Â Â gaim_xfer_request(xfer); |
---|
| 2370 |         } else if (args->status == AIM_RENDEZVOUS_CANCEL) { |
---|
| 2371 | Â Â Â Â Â Â Â Â Â Â Â Â /* The other user wants to cancel a file transfer */ |
---|
| 2372 | Â Â Â Â Â Â Â Â Â Â Â Â GaimXfer *xfer; |
---|
| 2373 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2374 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "AAA - File transfer canceled by remote user\n"); |
---|
| 2375 |             if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, args->cookie))) |
---|
| 2376 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gaim_xfer_cancel_remote(xfer); |
---|
| 2377 |         } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
---|
| 2378 | Â Â Â Â Â Â Â Â Â Â Â Â /* |
---|
| 2379 | Â Â Â Â Â Â Â Â Â Â Â Â Â * This gets sent by the receiver of a file |
---|
| 2380 |              * as they connect directly to us. If we don't |
---|
| 2381 | Â Â Â Â Â Â Â Â Â Â Â Â Â * get this, then maybe a third party connected |
---|
| 2382 | Â Â Â Â Â Â Â Â Â Â Â Â Â * to us, and we shouldn't send them anything. |
---|
| 2383 | Â Â Â Â Â Â Â Â Â Â Â Â Â */ |
---|
| 2384 |         } else { |
---|
| 2385 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 2386 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "unknown rendezvous status!\n"); |
---|
| 2387 | Â Â Â Â Â Â Â Â } |
---|
| 2388 |     } else if (args->reqclass & AIM_CAPS_GETFILE) { |
---|
| 2389 |     } else if (args->reqclass & AIM_CAPS_VOICE) { |
---|
| 2390 |     } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
---|
| 2391 | Â Â Â Â Â Â Â Â gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
---|
| 2392 |                                      userinfo->sn, args->info.icon.icon, |
---|
| 2393 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â args->info.icon.length); |
---|
| 2394 |     } else if (args->reqclass & AIM_CAPS_DIRECTIM) { |
---|
| 2395 |         struct ask_direct *d = g_new0(struct ask_direct, 1); |
---|
| 2396 |         char buf[256]; |
---|
| 2397 | |
---|
| 2398 |         if (!args->verifiedip) { |
---|
| 2399 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2400 |                       "directim kill blocked (%s)\n", userinfo->sn); |
---|
| 2401 |             return 1; |
---|
| 2402 | Â Â Â Â Â Â Â Â } |
---|
| 2403 | |
---|
| 2404 |         gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2405 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "%s received direct im request from %s (%s)\n", |
---|
| 2406 |                   username, userinfo->sn, args->verifiedip); |
---|
| 2407 | |
---|
| 2408 | Â Â Â Â Â Â Â Â d->gc =Â gc; |
---|
| 2409 | Â Â Â Â Â Â Â Â d->sn =Â g_strdup(userinfo->sn); |
---|
| 2410 |         strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
---|
| 2411 |         memcpy(d->cookie, args->cookie, 8); |
---|
| 2412 |         g_snprintf(buf, sizeof buf, _("%s has just asked to directly connect to %s"), userinfo->sn, username); |
---|
| 2413 | |
---|
| 2414 |         gaim_request_action(gc, NULL, buf, |
---|
| 2415 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("This requires a direct connection between " |
---|
| 2416 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "the two computers and is necessary for IM " |
---|
| 2417 |                              "Images. Because your IP address will be " |
---|
| 2418 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "revealed, this may be considered a privacy " |
---|
| 2419 |                              "risk."), 0, d, 2, |
---|
| 2420 |                             _("Connect"), G_CALLBACK(accept_direct_im), |
---|
| 2421 |                             _("Cancel"), G_CALLBACK(cancel_direct_im)); |
---|
| 2422 |     } else { |
---|
| 2423 |         gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 2424 |                   "Unknown reqclass %hu\n", args->reqclass); |
---|
| 2425 | Â Â Â Â } |
---|
| 2426 | |
---|
| 2427 |     return 1; |
---|
| 2428 | } |
---|
| 2429 | |
---|
| 2430 | /* |
---|
| 2431 | Â * Authorization Functions |
---|
| 2432 |  * Most of these are callbacks from dialogs. They're used by both |
---|
| 2433 | Â * methods of authorization (SSI and old-school channel 4 ICBM) |
---|
| 2434 | Â */ |
---|
| 2435 | /* When you ask other people for authorization */ |
---|
| 2436 | static void gaim_auth_request(struct name_data *data, char *msg) { |
---|
| 2437 | Â Â Â Â GaimConnection *gc =Â data->gc; |
---|
| 2438 | |
---|
| 2439 |     if (g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 2440 |         struct oscar_data *od = gc->proto_data; |
---|
| 2441 |         GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); |
---|
| 2442 | Â Â Â Â Â Â Â Â GaimGroup *group =Â gaim_find_buddys_group(buddy); |
---|
| 2443 |         if (buddy && group) { |
---|
| 2444 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2445 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "ssi: adding buddy %s to group %s\n", |
---|
| 2446 |                       buddy->name, group->name); |
---|
| 2447 |             aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
---|
| 2448 |             if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
---|
| 2449 |                 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
---|
| 2450 | Â Â Â Â Â Â Â Â } |
---|
| 2451 | Â Â Â Â } |
---|
| 2452 | } |
---|
| 2453 | |
---|
| 2454 | static void gaim_auth_request_msgprompt(struct name_data *data) { |
---|
| 2455 |     gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), |
---|
| 2456 |                       NULL, _("Please authorize me!"), TRUE, FALSE, |
---|
| 2457 |                       _("OK"), G_CALLBACK(gaim_auth_request), |
---|
| 2458 |                       _("Cancel"), G_CALLBACK(oscar_free_name_data), |
---|
| 2459 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data); |
---|
| 2460 | } |
---|
| 2461 | |
---|
| 2462 | static void gaim_auth_dontrequest(struct name_data *data) { |
---|
| 2463 | Â Â Â Â GaimConnection *gc =Â data->gc; |
---|
| 2464 | |
---|
| 2465 |     if (g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 2466 | Â Â Â Â Â Â Â Â /* struct oscar_data *od = gc->proto_data; */ |
---|
| 2467 | Â Â Â Â Â Â Â Â /* XXX - Take the buddy out of our buddy list */ |
---|
| 2468 | Â Â Â Â } |
---|
| 2469 | |
---|
| 2470 | Â Â Â Â oscar_free_name_data(data); |
---|
| 2471 | } |
---|
| 2472 | |
---|
| 2473 | static void gaim_auth_sendrequest(GaimConnection *gc, const char *name) { |
---|
| 2474 |     struct name_data *data = g_new(struct name_data, 1); |
---|
| 2475 | Â Â Â Â GaimBuddy *buddy; |
---|
| 2476 |     gchar *dialog_msg, *nombre; |
---|
| 2477 | |
---|
| 2478 |     buddy = gaim_find_buddy(gc->account, name); |
---|
| 2479 |     if (buddy && (gaim_get_buddy_alias_only(buddy))) |
---|
| 2480 |         nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); |
---|
| 2481 | Â Â Â Â else |
---|
| 2482 | Â Â Â Â Â Â Â Â nombre =Â NULL; |
---|
| 2483 | |
---|
| 2484 |     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)); |
---|
| 2485 | Â Â Â Â data->gc =Â gc; |
---|
| 2486 | Â Â Â Â data->name =Â g_strdup(name); |
---|
| 2487 | Â Â Â Â data->nick =Â NULL; |
---|
| 2488 | |
---|
| 2489 |     gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, |
---|
| 2490 |                         0, data, 2, |
---|
| 2491 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Request Authorization"), |
---|
| 2492 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â G_CALLBACK(gaim_auth_request_msgprompt), |
---|
| 2493 |                         _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); |
---|
| 2494 | |
---|
| 2495 | Â Â Â Â g_free(dialog_msg); |
---|
| 2496 | Â Â Â Â g_free(nombre); |
---|
| 2497 | } |
---|
| 2498 | |
---|
| 2499 | /* When other people ask you for authorization */ |
---|
| 2500 | static void gaim_auth_grant(struct name_data *data) { |
---|
| 2501 | Â Â Â Â GaimConnection *gc =Â data->gc; |
---|
| 2502 | |
---|
| 2503 |     if (g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 2504 |         struct oscar_data *od = gc->proto_data; |
---|
| 2505 | #ifdef NOSSI |
---|
| 2506 | Â Â Â Â Â Â Â Â GaimBuddy *buddy; |
---|
| 2507 | Â Â Â Â Â Â Â Â gchar message; |
---|
| 2508 | Â Â Â Â Â Â Â Â message =Â 0; |
---|
| 2509 |         buddy = gaim_find_buddy(gc->account, data->name); |
---|
| 2510 |         aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message); |
---|
| 2511 |         show_got_added(gc, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
---|
| 2512 | #else |
---|
| 2513 |         aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
---|
| 2514 | #endif |
---|
| 2515 | Â Â Â Â } |
---|
| 2516 | |
---|
| 2517 | Â Â Â Â oscar_free_name_data(data); |
---|
| 2518 | } |
---|
| 2519 | |
---|
| 2520 | /* When other people ask you for authorization */ |
---|
| 2521 | static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
---|
| 2522 | Â Â Â Â GaimConnection *gc =Â data->gc; |
---|
| 2523 | |
---|
| 2524 |     if (g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 2525 |         struct oscar_data *od = gc->proto_data; |
---|
| 2526 | #ifdef NOSSI |
---|
| 2527 |         aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
---|
| 2528 | #else |
---|
| 2529 |         aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
---|
| 2530 | #endif |
---|
| 2531 | Â Â Â Â } |
---|
| 2532 | } |
---|
| 2533 | |
---|
| 2534 | static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { |
---|
| 2535 |     gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
---|
| 2536 |                       NULL, _("No reason given."), TRUE, FALSE, |
---|
| 2537 |                       _("OK"), G_CALLBACK(gaim_auth_dontgrant), |
---|
| 2538 |                       _("Cancel"), G_CALLBACK(oscar_free_name_data), |
---|
| 2539 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data); |
---|
| 2540 | } |
---|
| 2541 | |
---|
| 2542 | /* When someone sends you contacts */ |
---|
| 2543 | static void gaim_icq_contactadd(struct name_data *data) { |
---|
| 2544 | Â Â Â Â GaimConnection *gc =Â data->gc; |
---|
| 2545 | |
---|
| 2546 |     if (g_list_find(gaim_connections_get_all(), gc)) { |
---|
| 2547 |         show_add_buddy(gc, data->name, NULL, data->nick); |
---|
| 2548 | Â Â Â Â } |
---|
| 2549 | |
---|
| 2550 | Â Â Â Â oscar_free_name_data(data); |
---|
| 2551 | } |
---|
| 2552 | |
---|
| 2553 | 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) { |
---|
| 2554 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 2555 |     gchar **msg1, **msg2; |
---|
| 2556 | Â Â Â Â GError *err =Â NULL; |
---|
| 2557 |     int i, numtoks; |
---|
| 2558 | |
---|
| 2559 |     if (!args->type || !args->msg || !args->uin) |
---|
| 2560 |         return 1; |
---|
| 2561 | |
---|
| 2562 |     gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2563 |               "Received a channel 4 message of type 0x%02hhx.\n", args->type); |
---|
| 2564 | |
---|
| 2565 | Â Â Â Â /* Split up the message at the delimeter character, then convert each string to UTF-8 */ |
---|
| 2566 |     msg1 = g_strsplit(args->msg, "\376", 0); |
---|
| 2567 |     for (numtoks=0; msg1[numtoks]; numtoks++); |
---|
| 2568 | Â Â Â Â msg2 =Â (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); |
---|
| 2569 |     for (i=0; msg1[i]; i++) { |
---|
| 2570 | Â Â Â Â Â Â Â Â strip_linefeed(msg1[i]); |
---|
| 2571 |         msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); |
---|
| 2572 |         if (err) { |
---|
| 2573 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 2574 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Error converting a string from ISO-8859-1 to " |
---|
| 2575 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "UTF-8 in oscar ICBM channel 4 parsing\n"); |
---|
| 2576 | Â Â Â Â Â Â Â Â Â Â Â Â g_error_free(err); |
---|
| 2577 | Â Â Â Â Â Â Â Â } |
---|
| 2578 | Â Â Â Â } |
---|
| 2579 | Â Â Â Â msg2[i]Â =Â NULL; |
---|
| 2580 | |
---|
| 2581 |     switch (args->type) { |
---|
| 2582 |         case 0x01: { /* MacICQ message or basic offline message */ |
---|
| 2583 |             if (i >= 1) { |
---|
| 2584 |                 gchar *uin = g_strdup_printf("%u", args->uin); |
---|
| 2585 |                 if (t) { /* This is an offline message */ |
---|
| 2586 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â /* I think this timestamp is in UTC, or something */ |
---|
| 2587 |                     serv_got_im(gc, uin, msg2[0], 0, t); |
---|
| 2588 |                 } else { /* This is a message from MacICQ/Miranda */ |
---|
| 2589 |                     serv_got_im(gc, uin, msg2[0], 0, time(NULL)); |
---|
| 2590 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2591 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(uin); |
---|
| 2592 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2593 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2594 | |
---|
| 2595 |         case 0x04: { /* Someone sent you a URL */ |
---|
| 2596 |             if (i >= 2) { |
---|
| 2597 |                 gchar *uin = g_strdup_printf("%u", args->uin); |
---|
| 2598 |                 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", msg2[1], msg2[0]); |
---|
| 2599 |                 serv_got_im(gc, uin, message, 0, time(NULL)); |
---|
| 2600 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(uin); |
---|
| 2601 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(message); |
---|
| 2602 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2603 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2604 | |
---|
| 2605 |         case 0x06: { /* Someone requested authorization */ |
---|
| 2606 |             if (i >= 6) { |
---|
| 2607 |                 struct name_data *data = g_new(struct name_data, 1); |
---|
| 2608 |                 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.")); |
---|
| 2609 |                 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2610 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Received an authorization request from UIN %u\n", |
---|
| 2611 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â args->uin); |
---|
| 2612 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data->gc =Â gc; |
---|
| 2613 |                 data->name = g_strdup_printf("%u", args->uin); |
---|
| 2614 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data->nick =Â NULL; |
---|
| 2615 | |
---|
| 2616 |                 gaim_request_action(gc, NULL, _("Authorization Request"), |
---|
| 2617 |                                     dialog_msg, 0, data, 2, |
---|
| 2618 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Authorize"), |
---|
| 2619 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â G_CALLBACK(gaim_auth_grant), |
---|
| 2620 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Deny"), |
---|
| 2621 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
---|
| 2622 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(dialog_msg); |
---|
| 2623 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2624 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2625 | |
---|
| 2626 |         case 0x07: { /* Someone has denied you authorization */ |
---|
| 2627 |             if (i >= 1) { |
---|
| 2628 |                 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); |
---|
| 2629 |                 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), |
---|
| 2630 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â dialog_msg); |
---|
| 2631 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(dialog_msg); |
---|
| 2632 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2633 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2634 | |
---|
| 2635 |         case 0x08: { /* Someone has granted you authorization */ |
---|
| 2636 |             gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your contact list."), args->uin); |
---|
| 2637 |             gaim_notify_info(gc, NULL, "ICQ authorization accepted.", |
---|
| 2638 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â dialog_msg); |
---|
| 2639 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(dialog_msg); |
---|
| 2640 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2641 | |
---|
| 2642 |         case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
---|
| 2643 |             if (i >= 5) { |
---|
| 2644 |                 gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); |
---|
| 2645 |                 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); |
---|
| 2646 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(dialog_msg); |
---|
| 2647 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2648 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2649 | |
---|
| 2650 |         case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
---|
| 2651 |             if (i >= 6) { |
---|
| 2652 |                 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); |
---|
| 2653 |                 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); |
---|
| 2654 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(dialog_msg); |
---|
| 2655 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2656 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2657 | |
---|
| 2658 |         case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
---|
| 2659 |             if (i >= 6) { |
---|
| 2660 |                 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]); |
---|
| 2661 |                 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg); |
---|
| 2662 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(dialog_msg); |
---|
| 2663 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2664 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2665 | |
---|
| 2666 |         case 0x12: { |
---|
| 2667 |             /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
---|
| 2668 | Â Â Â Â Â Â Â Â Â Â Â Â /* Someone added you to their contact list? */ |
---|
| 2669 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2670 | |
---|
| 2671 |         case 0x13: { /* Someone has sent you some ICQ contacts */ |
---|
| 2672 |             int i, num; |
---|
| 2673 | Â Â Â Â Â Â Â Â Â Â Â Â gchar **text; |
---|
| 2674 |             text = g_strsplit(args->msg, "\376", 0); |
---|
| 2675 |             if (text) { |
---|
| 2676 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â num =Â 0; |
---|
| 2677 |                 for (i=0; i<strlen(text[0]); i++) |
---|
| 2678 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â num =Â num*10Â +Â text[0][i]-48; |
---|
| 2679 |                 for (i=0; i<num; i++) { |
---|
| 2680 |                     struct name_data *data = g_new(struct name_data, 1); |
---|
| 2681 |                     gchar *message = g_strdup_printf(_("ICQ user %u has sent you a contact: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); |
---|
| 2682 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data->gc =Â gc; |
---|
| 2683 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data->name =Â g_strdup(text[i*2+1]); |
---|
| 2684 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data->nick =Â g_strdup(text[i*2+2]); |
---|
| 2685 | |
---|
| 2686 |                     gaim_request_action(gc, NULL, message, |
---|
| 2687 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Do you want to add this contact " |
---|
| 2688 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "to your Buddy List?"), |
---|
| 2689 |                                         0, data, 2, |
---|
| 2690 |                                         _("Add"), G_CALLBACK(gaim_icq_contactadd), |
---|
| 2691 |                                         _("Decline"), G_CALLBACK(oscar_free_name_data)); |
---|
| 2692 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(message); |
---|
| 2693 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2694 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_strfreev(text); |
---|
| 2695 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2696 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2697 | |
---|
| 2698 |         case 0x1a: { /* Someone has sent you a greeting card or requested contacts? */ |
---|
| 2699 | Â Â Â Â Â Â Â Â Â Â Â Â /* This is boring and silly. */ |
---|
| 2700 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2701 | |
---|
| 2702 | Â Â Â Â Â Â Â Â default:Â { |
---|
| 2703 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2704 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Received a channel 4 message of unknown type " |
---|
| 2705 |                       "(type 0x%02hhx).\n", args->type); |
---|
| 2706 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2707 | Â Â Â Â } |
---|
| 2708 | |
---|
| 2709 | Â Â Â Â g_strfreev(msg1); |
---|
| 2710 | Â Â Â Â g_strfreev(msg2); |
---|
| 2711 | |
---|
| 2712 |     return 1; |
---|
| 2713 | } |
---|
| 2714 | |
---|
| 2715 | static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 2716 |     fu16_t channel; |
---|
| 2717 |     int ret = 0; |
---|
| 2718 |     aim_userinfo_t *userinfo; |
---|
| 2719 |     va_list ap; |
---|
| 2720 | |
---|
| 2721 |     va_start(ap, fr); |
---|
| 2722 |     channel = (fu16_t)va_arg(ap, unsigned int); |
---|
| 2723 |     userinfo = va_arg(ap, aim_userinfo_t *); |
---|
| 2724 | |
---|
| 2725 |     switch (channel) { |
---|
| 2726 |         case 1: { /* standard message */ |
---|
| 2727 |             struct aim_incomingim_ch1_args *args; |
---|
| 2728 |             args = va_arg(ap, struct aim_incomingim_ch1_args *); |
---|
| 2729 |             ret = incomingim_chan1(sess, fr->conn, userinfo, args); |
---|
| 2730 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2731 | |
---|
| 2732 |         case 2: { /* rendevous */ |
---|
| 2733 |             struct aim_incomingim_ch2_args *args; |
---|
| 2734 |             args = va_arg(ap, struct aim_incomingim_ch2_args *); |
---|
| 2735 |             ret = incomingim_chan2(sess, fr->conn, userinfo, args); |
---|
| 2736 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2737 | |
---|
| 2738 |         case 4: { /* ICQ */ |
---|
| 2739 |             struct aim_incomingim_ch4_args *args; |
---|
| 2740 |             args = va_arg(ap, struct aim_incomingim_ch4_args *); |
---|
| 2741 |             ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
---|
| 2742 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2743 | |
---|
| 2744 | Â Â Â Â Â Â Â Â default:Â { |
---|
| 2745 |             gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 2746 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "ICBM received on unsupported channel (channel " |
---|
| 2747 |                       "0x%04hx).", channel); |
---|
| 2748 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2749 | Â Â Â Â } |
---|
| 2750 | |
---|
| 2751 | Â Â Â Â va_end(ap); |
---|
| 2752 | |
---|
| 2753 |     return ret; |
---|
| 2754 | } |
---|
| 2755 | |
---|
| 2756 | static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 2757 |     char *buf; |
---|
| 2758 |     va_list ap; |
---|
| 2759 |     fu16_t chan, nummissed, reason; |
---|
| 2760 |     aim_userinfo_t *userinfo; |
---|
| 2761 | |
---|
| 2762 |     va_start(ap, fr); |
---|
| 2763 |     chan = (fu16_t)va_arg(ap, unsigned int); |
---|
| 2764 |     userinfo = va_arg(ap, aim_userinfo_t *); |
---|
| 2765 |     nummissed = (fu16_t)va_arg(ap, unsigned int); |
---|
| 2766 |     reason = (fu16_t)va_arg(ap, unsigned int); |
---|
| 2767 | Â Â Â Â va_end(ap); |
---|
| 2768 | |
---|
| 2769 | Â Â Â Â switch(reason)Â { |
---|
| 2770 |         case 0: /* Invalid (0) */ |
---|
| 2771 | Â Â Â Â Â Â Â Â Â Â Â Â buf =Â g_strdup_printf( |
---|
| 2772 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ngettext( |
---|
| 2773 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu message from %s because it was invalid.", |
---|
| 2774 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu messages from %s because they were invalid.", |
---|
| 2775 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed), |
---|
| 2776 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed, |
---|
| 2777 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â userinfo->sn); |
---|
| 2778 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 2779 |         case 1: /* Message too large */ |
---|
| 2780 | Â Â Â Â Â Â Â Â Â Â Â Â buf =Â g_strdup_printf( |
---|
| 2781 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ngettext( |
---|
| 2782 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu message from %s because it was too large.", |
---|
| 2783 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu messages from %s because they were too large.", |
---|
| 2784 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed), |
---|
| 2785 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed, |
---|
| 2786 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â userinfo->sn); |
---|
| 2787 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 2788 |         case 2: /* Rate exceeded */ |
---|
| 2789 | Â Â Â Â Â Â Â Â Â Â Â Â buf =Â g_strdup_printf( |
---|
| 2790 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ngettext( |
---|
| 2791 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu message from %s because the rate limit has been exceeded.", |
---|
| 2792 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu messages from %s because the rate limit has been exceeded.", |
---|
| 2793 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed), |
---|
| 2794 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed, |
---|
| 2795 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â userinfo->sn); |
---|
| 2796 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 2797 |         case 3: /* Evil Sender */ |
---|
| 2798 | Â Â Â Â Â Â Â Â Â Â Â Â buf =Â g_strdup_printf( |
---|
| 2799 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ngettext( |
---|
| 2800 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu message from %s because he/she was too evil.", |
---|
| 2801 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu messages from %s because he/she was too evil.", |
---|
| 2802 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed), |
---|
| 2803 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed, |
---|
| 2804 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â userinfo->sn); |
---|
| 2805 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 2806 |         case 4: /* Evil Receiver */ |
---|
| 2807 | Â Â Â Â Â Â Â Â Â Â Â Â buf =Â g_strdup_printf( |
---|
| 2808 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ngettext( |
---|
| 2809 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu message from %s because you are too evil.", |
---|
| 2810 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu messages from %s because you are too evil.", |
---|
| 2811 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed), |
---|
| 2812 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed, |
---|
| 2813 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â userinfo->sn); |
---|
| 2814 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 2815 | Â Â Â Â Â Â Â Â default: |
---|
| 2816 | Â Â Â Â Â Â Â Â Â Â Â Â buf =Â g_strdup_printf( |
---|
| 2817 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ngettext( |
---|
| 2818 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu message from %s for an unknown reason.", |
---|
| 2819 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "You missed %hu messages from %s for an unknown reason.", |
---|
| 2820 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed), |
---|
| 2821 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nummissed, |
---|
| 2822 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â userinfo->sn); |
---|
| 2823 | Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 2824 | Â Â Â Â } |
---|
| 2825 |     gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
---|
| 2826 | Â Â Â Â g_free(buf); |
---|
| 2827 | |
---|
| 2828 |     return 1; |
---|
| 2829 | } |
---|
| 2830 | |
---|
| 2831 | static char *gaim_icq_status(int state) { |
---|
| 2832 | Â Â Â Â /* Make a cute little string that shows the status of the dude or dudet */ |
---|
| 2833 |     if (state & AIM_ICQ_STATE_CHAT) |
---|
| 2834 |         return g_strdup_printf(_("Free For Chat")); |
---|
| 2835 |     else if (state & AIM_ICQ_STATE_DND) |
---|
| 2836 |         return g_strdup_printf(_("Do Not Disturb")); |
---|
| 2837 |     else if (state & AIM_ICQ_STATE_OUT) |
---|
| 2838 |         return g_strdup_printf(_("Not Available")); |
---|
| 2839 |     else if (state & AIM_ICQ_STATE_BUSY) |
---|
| 2840 |         return g_strdup_printf(_("Occupied")); |
---|
| 2841 |     else if (state & AIM_ICQ_STATE_AWAY) |
---|
| 2842 |         return g_strdup_printf(_("Away")); |
---|
| 2843 |     else if (state & AIM_ICQ_STATE_WEBAWARE) |
---|
| 2844 |         return g_strdup_printf(_("Web Aware")); |
---|
| 2845 |     else if (state & AIM_ICQ_STATE_INVISIBLE) |
---|
| 2846 |         return g_strdup_printf(_("Invisible")); |
---|
| 2847 | Â Â Â Â else |
---|
| 2848 |         return g_strdup_printf(_("Online")); |
---|
| 2849 | } |
---|
| 2850 | |
---|
| 2851 | static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
---|
| 2852 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 2853 |     struct oscar_data *od = gc->proto_data; |
---|
| 2854 | |
---|
| 2855 | /* BBB */ |
---|
| 2856 |     switch (reason) { |
---|
| 2857 |         case 3: { /* Decline sendfile. */ |
---|
| 2858 | Â Â Â Â Â Â Â Â Â Â Â Â GaimXfer *xfer; |
---|
| 2859 |             gaim_debug(GAIM_DEBUG_INFO, "oscar", |
---|
| 2860 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "AAA - Other user declined file transfer\n"); |
---|
| 2861 |             if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) |
---|
| 2862 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gaim_xfer_cancel_remote(xfer); |
---|
| 2863 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2864 | |
---|
| 2865 | Â Â Â Â Â Â Â Â default:Â { |
---|
| 2866 |             gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 2867 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Received an unknown rendezvous client auto-response " |
---|
| 2868 |                       "from %s. Type 0x%04hx\n", who, reason); |
---|
| 2869 | Â Â Â Â Â Â Â Â } |
---|
| 2870 | |
---|
| 2871 | Â Â Â Â } |
---|
| 2872 | |
---|
| 2873 |     return 0; |
---|
| 2874 | } |
---|
| 2875 | |
---|
| 2876 | static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
---|
| 2877 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 2878 | |
---|
| 2879 | Â Â Â Â switch(reason)Â { |
---|
| 2880 |         case 0x0003: { /* Reply from an ICQ status message request */ |
---|
| 2881 |             char *status_msg = gaim_icq_status(state); |
---|
| 2882 |             char *dialog_msg, **splitmsg; |
---|
| 2883 |             struct oscar_data *od = gc->proto_data; |
---|
| 2884 | Â Â Â Â Â Â Â Â Â Â Â Â GSList *l =Â od->evilhack; |
---|
| 2885 | Â Â Â Â Â Â Â Â Â Â Â Â gboolean evilhack =Â FALSE; |
---|
| 2886 | |
---|
| 2887 | Â Â Â Â Â Â Â Â Â Â Â Â /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ |
---|
| 2888 |             splitmsg = g_strsplit(msg, "\r\n", 0); |
---|
| 2889 | |
---|
| 2890 | Â Â Â Â Â Â Â Â Â Â Â Â /* If who is in od->evilhack, then we're just getting the away message, otherwise this |
---|
| 2891 | Â Â Â Â Â Â Â Â Â Â Â Â Â * will just get appended to the info box (which is already showing). */ |
---|
| 2892 |             while (l) { |
---|
| 2893 |                 char *x = l->data; |
---|
| 2894 |                 if (!strcmp(x, normalize(who))) { |
---|
| 2895 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â evilhack =Â TRUE; |
---|
| 2896 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â g_free(x); |
---|
| 2897 |                     od->evilhack = g_slist_remove(od->evilhack, x); |
---|
| 2898 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 2899 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2900 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â l =Â l->next; |
---|
| 2901 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 2902 | |
---|
| 2903 |             if (evilhack) |
---|
| 2904 |                 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); |
---|
| 2905 | Â Â Â Â Â Â Â Â Â Â Â Â else |
---|
| 2906 |                 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<HR>%s"), status_msg, g_strjoinv("<BR>", splitmsg)); |
---|
| 2907 |             g_show_info_text(gc, who, 2, dialog_msg, NULL); |
---|
| 2908 | |
---|
| 2909 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(status_msg); |
---|
| 2910 | Â Â Â Â Â Â Â Â Â Â Â Â g_free(dialog_msg); |
---|
| 2911 | Â Â Â Â Â Â Â Â Â Â Â Â g_strfreev(splitmsg); |
---|
| 2912 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2913 | |
---|
| 2914 | Â Â Â Â Â Â Â Â default:Â { |
---|
| 2915 |             gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
---|
| 2916 |                       "Received an unknown client auto-response from %s. " |
---|
| 2917 |                       "Type 0x%04hx\n", who, reason); |
---|
| 2918 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 2919 | Â Â Â Â }Â /* end of switch */ |
---|
| 2920 | |
---|
| 2921 |     return 0; |
---|
| 2922 | } |
---|
| 2923 | |
---|
| 2924 | static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 2925 |     va_list ap; |
---|
| 2926 |     fu16_t chan, reason; |
---|
| 2927 |     char *who; |
---|
| 2928 | |
---|
| 2929 |     va_start(ap, fr); |
---|
| 2930 |     chan = (fu16_t)va_arg(ap, unsigned int); |
---|
| 2931 |     who = va_arg(ap, char *); |
---|
| 2932 |     reason = (fu16_t)va_arg(ap, unsigned int); |
---|
| 2933 | |
---|
| 2934 |     if (chan == 0x0002) { /* File transfer declined */ |
---|
| 2935 |         char *cookie = va_arg(ap, char *); |
---|
| 2936 |         return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
---|
| 2937 |     } else if (chan == 0x0004) { /* ICQ message */ |
---|
| 2938 |         fu32_t state = 0; |
---|
| 2939 |         char *msg = NULL; |
---|
| 2940 |         if (reason == 0x0003) { |
---|
| 2941 |             state = va_arg(ap, fu32_t); |
---|
| 2942 |             msg = va_arg(ap, char *); |
---|
| 2943 | Â Â Â Â Â Â Â Â } |
---|
| 2944 |         return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); |
---|
| 2945 | Â Â Â Â } |
---|
| 2946 | |
---|
| 2947 | Â Â Â Â va_end(ap); |
---|
| 2948 | |
---|
| 2949 |     return 1; |
---|
| 2950 | } |
---|
| 2951 | |
---|
| 2952 | static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 2953 |     va_list ap; |
---|
| 2954 |     fu16_t reason; |
---|
| 2955 |     char *m; |
---|
| 2956 | |
---|
| 2957 |     va_start(ap, fr); |
---|
| 2958 |     reason = (fu16_t) va_arg(ap, unsigned int); |
---|
| 2959 | Â Â Â Â va_end(ap); |
---|
| 2960 | |
---|
| 2961 |     gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 2962 |               "snac threw error (reason 0x%04hx: %s)\n", reason, |
---|
| 2963 |               (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
---|
| 2964 | |
---|
| 2965 | Â Â Â Â m =Â g_strdup_printf(_("SNAC threw error: %s\n"), |
---|
| 2966 |             reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); |
---|
| 2967 |     gaim_notify_error(sess->aux_data, NULL, m, NULL); |
---|
| 2968 | Â Â Â Â g_free(m); |
---|
| 2969 | |
---|
| 2970 |     return 1; |
---|
| 2971 | } |
---|
| 2972 | |
---|
| 2973 | static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 2974 | #if 0 |
---|
| 2975 | Â Â Â Â GaimConnection *gc = sess->aux_data; |
---|
| 2976 | Â Â Â Â struct oscar_data *od = gc->proto_data; |
---|
| 2977 | Â Â Â Â GaimXfer *xfer; |
---|
| 2978 | #endif |
---|
| 2979 |     va_list ap; |
---|
| 2980 |     fu16_t reason; |
---|
| 2981 |     char *data, *buf; |
---|
| 2982 | |
---|
| 2983 |     va_start(ap, fr); |
---|
| 2984 |     reason = (fu16_t)va_arg(ap, unsigned int); |
---|
| 2985 |     data = va_arg(ap, char *); |
---|
| 2986 | Â Â Â Â va_end(ap); |
---|
| 2987 | |
---|
| 2988 |     gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
---|
| 2989 |               "Message error with data %s and reason %hu\n", data, reason); |
---|
| 2990 | |
---|
| 2991 | /* BBB */ |
---|
| 2992 | #if 0 |
---|
| 2993 | Â Â Â Â /* If this was a file transfer request, data is a cookie */ |
---|
| 2994 | Â Â Â Â if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) { |
---|
| 2995 | Â Â Â Â Â Â Â Â gaim_xfer_cancel_remote(xfer); |
---|
| 2996 | Â Â Â Â Â Â Â Â return 1; |
---|
| 2997 | Â Â Â Â } |
---|
| 2998 | #endif |
---|
| 2999 | |
---|
| 3000 | Â Â Â Â /* Data is assumed to be the destination sn */ |
---|
| 3001 |     buf = g_strdup_printf(_("Your message to %s did not get sent:"), data); |
---|
| 3002 |     gaim_notify_error(sess->aux_data, NULL, buf, |
---|
| 3003 |                      (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
---|
| 3004 | Â Â Â Â g_free(buf); |
---|
| 3005 | |
---|
| 3006 |     return 1; |
---|
| 3007 | } |
---|
| 3008 | |
---|
| 3009 | static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 3010 | Â Â Â Â GaimConnection *gc =Â sess->aux_data; |
---|
| 3011 |     va_list ap; |
---|
| 3012 |     fu16_t type1, type2; |
---|
| 3013 |     char *sn; |
---|
| 3014 | |
---|
| 3015 |     va_start(ap, fr); |
---|
| 3016 |     type1 = (fu16_t) va_arg(ap, unsigned int); |
---|
| 3017 |     sn = va_arg(ap, char *); |
---|
| 3018 |     type2 = (fu16_t) va_arg(ap, unsigned int); |
---|
| 3019 | Â Â Â Â va_end(ap); |
---|
| 3020 | |
---|
| 3021 |     switch (type2) { |
---|
| 3022 |         case 0x0000: { /* Text has been cleared */ |
---|
| 3023 |             serv_got_typing_stopped(gc, sn); |
---|
| 3024 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 3025 | |
---|
| 3026 |         case 0x0001: { /* Paused typing */ |
---|
| 3027 |             serv_got_typing(gc, sn, 0, GAIM_TYPED); |
---|
| 3028 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 3029 | |
---|
| 3030 |         case 0x0002: { /* Typing */ |
---|
| 3031 |             serv_got_typing(gc, sn, 0, GAIM_TYPING); |
---|
| 3032 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 3033 | |
---|
| 3034 | Â Â Â Â Â Â Â Â default:Â { |
---|
| 3035 |             gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2); |
---|
| 3036 | Â Â Â Â Â Â Â Â }Â break; |
---|
| 3037 | Â Â Â Â } |
---|
| 3038 | |
---|
| 3039 |     return 1; |
---|
| 3040 | } |
---|
| 3041 | |
---|
| 3042 | static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
---|
| 3043 |     char *buf; |
---|
| 3044 |     va_list ap; |
---|
| 3045 |     fu16_t reason; |
---|
| 3046 |     char *destn; |
---|
| 3047 | |
---|
| 3048 |     va_start(ap, fr); |
---|
| 3049 |     reason = (fu16_t) va_arg(ap, unsigned int); |
---|
| 3050 |     destn = va_arg(ap, char *); |
---|
| 3051 | Â Â Â Â va_end(ap); |
---|
| 3052 | |
---|
| 3053 |     buf = g_strdup_printf(_("User information for %s unavailable:"), destn); |
---|
| 3054 |     gaim_notify_error(sess->aux_data, NULL, buf, |
---|
| 3055 |                      (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
---|
| 3056 | Â Â Â Â g_free(buf); |
---|
| 3057 | |
---|
| 3058 |     return 1; |
---|
| 3059 | } |
---|
| 3060 | |
---|
| 3061 | #if 0 |
---|
| 3062 | static char *images(int flags) { |
---|
| 3063 | Â Â Â Â static char buf[1024]; |
---|
| 3064 | Â Â Â Â g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
---|
| 3065 | Â Â Â Â Â Â Â Â Â Â Â Â (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
---|
| 3066 | Â Â Â Â Â Â Â Â Â Â Â Â (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
---|
| 3067 | Â Â Â Â Â Â Â Â Â Â Â Â (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", |
---|
| 3068 | Â Â Â Â Â Â Â Â Â Â Â Â (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
---|
| 3069 | Â Â Â Â Â Â Â Â Â Â Â Â (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
---|
| 3070 | Â Â Â Â Â Â Â Â Â Â Â Â (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
---|
| 3071 | Â Â Â Â Â Â Â Â Â Â Â Â (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); |
---|
| 3072 | Â Â Â Â return buf; |
---|
| 3073 | } |
---|
| 3074 | #endif |
---|
| 3075 | |
---|
| 3076 | static char *caps_string(guint caps) |
---|
| 3077 | { |
---|
| 3078 |     static char buf[512], *tmp; |
---|
| 3079 |     int count = 0, i = 0; |
---|
| 3080 | Â Â Â Â guint bit =Â 1; |
---|
| 3081 | |
---|
| 3082 |     if (!caps) { |
---|
| 3083 |         return NULL; |
---|
| 3084 |     } else while (bit <= AIM_CAPS_LAST) { |
---|
| 3085 |         if (bit & caps) { |
---|
| 3086 |             switch (bit) { |
---|
| 3087 |             case AIM_CAPS_BUDDYICON: |
---|
| 3088 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Buddy Icon"); |
---|
| 3089 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3090 |             case AIM_CAPS_VOICE: |
---|
| 3091 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Voice"); |
---|
| 3092 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3093 |             case AIM_CAPS_DIRECTIM: |
---|
| 3094 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Direct IM"); |
---|
| 3095 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3096 |             case AIM_CAPS_CHAT: |
---|
| 3097 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Chat"); |
---|
| 3098 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3099 |             case AIM_CAPS_GETFILE: |
---|
| 3100 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Get File"); |
---|
| 3101 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3102 |             case AIM_CAPS_SENDFILE: |
---|
| 3103 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Send File"); |
---|
| 3104 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3105 |             case AIM_CAPS_GAMES: |
---|
| 3106 |             case AIM_CAPS_GAMES2: |
---|
| 3107 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Games"); |
---|
| 3108 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3109 |             case AIM_CAPS_SAVESTOCKS: |
---|
| 3110 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Add-Ins"); |
---|
| 3111 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3112 |             case AIM_CAPS_SENDBUDDYLIST: |
---|
| 3113 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Send Buddy List"); |
---|
| 3114 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3115 |             case AIM_CAPS_ICQ: |
---|
| 3116 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("EveryBuddy Bug"); |
---|
| 3117 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3118 |             case AIM_CAPS_APINFO: |
---|
| 3119 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("AP User"); |
---|
| 3120 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3121 |             case AIM_CAPS_ICQRTF: |
---|
| 3122 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("ICQ RTF"); |
---|
| 3123 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3124 |             case AIM_CAPS_EMPTY: |
---|
| 3125 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Nihilist"); |
---|
| 3126 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3127 |             case AIM_CAPS_ICQSERVERRELAY: |
---|
| 3128 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("ICQ Server Relay"); |
---|
| 3129 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3130 |             case AIM_CAPS_ICQUTF8OLD: |
---|
| 3131 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Old ICQ UTF8"); |
---|
| 3132 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3133 |             case AIM_CAPS_TRILLIANCRYPT: |
---|
| 3134 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Trillian Encryption"); |
---|
| 3135 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3136 |             case AIM_CAPS_ICQUTF8: |
---|
| 3137 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("ICQ UTF8"); |
---|
| 3138 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3139 |             case AIM_CAPS_HIPTOP: |
---|
| 3140 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Hiptop"); |
---|
| 3141 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3142 |             case AIM_CAPS_SECUREIM: |
---|
| 3143 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â _("Secure IM"); |
---|
| 3144 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3145 | Â Â Â Â Â Â Â Â Â Â Â Â default: |
---|
| 3146 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp =Â NULL; |
---|
| 3147 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â break; |
---|
| 3148 | Â Â Â Â Â Â Â Â Â Â Â Â } |
---|
| 3149 |             if (tmp) |
---|
| 3150 |                 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), |
---|
| 3151 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â tmp); |
---|
| 3152 | Â Â Â Â Â Â Â Â Â Â Â Â count++; |
---|
| 3153 | Â Â Â Â Â Â Â Â } |
---|
| 3154 | Â Â Â Â Â Â Â Â bit <<=Â 1; |
---|
| 3155 | Â Â Â Â } |
---|
| 3156 |     return buf; |
---|