comparison libpurple/protocols/oscar/oscar.c @ 15823:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 52a044731fbe
children abb1e1e0c96f
comparison
equal deleted inserted replaced
15822:84b0f9b23ede 15823:32c366eeeb99
1 /* 1 /*
2 * gaim 2 * purple
3 * 3 *
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> 4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
5 * Some code copyright (C) 1999-2001, Eric Warmenhoven 5 * Some code copyright (C) 1999-2001, Eric Warmenhoven
6 * Some code copyright (C) 2001-2003, Sean Egan 6 * Some code copyright (C) 2001-2003, Sean Egan
7 * Some code copyright (C) 2001-2005, Mark Doliner <thekingant@users.sourceforge.net> 7 * Some code copyright (C) 2001-2005, Mark Doliner <thekingant@users.sourceforge.net>
58 #define OSCAR_STATUS_ID_OCCUPIED "occupied" 58 #define OSCAR_STATUS_ID_OCCUPIED "occupied"
59 #define OSCAR_STATUS_ID_FREE4CHAT "free4chat" 59 #define OSCAR_STATUS_ID_FREE4CHAT "free4chat"
60 #define OSCAR_STATUS_ID_CUSTOM "custom" 60 #define OSCAR_STATUS_ID_CUSTOM "custom"
61 #define OSCAR_STATUS_ID_MOBILE "mobile" 61 #define OSCAR_STATUS_ID_MOBILE "mobile"
62 62
63 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" 63 #define AIMHASHDATA "http://purple.sourceforge.net/aim_data.php3"
64 64
65 #define OSCAR_CONNECT_STEPS 6 65 #define OSCAR_CONNECT_STEPS 6
66 66
67 static OscarCapability gaim_caps = OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | OSCAR_CAPABILITY_ICHAT; 67 static OscarCapability purple_caps = OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | OSCAR_CAPABILITY_ICHAT;
68 68
69 static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02}; 69 static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02};
70 static guint8 features_icq[] = {0x01, 0x06}; 70 static guint8 features_icq[] = {0x01, 0x06};
71 static guint8 features_icq_offline[] = {0x01}; 71 static guint8 features_icq_offline[] = {0x01};
72 static guint8 ck[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 72 static guint8 ck[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
104 gboolean ico_need; 104 gboolean ico_need;
105 gboolean ico_sent; 105 gboolean ico_sent;
106 }; 106 };
107 107
108 struct name_data { 108 struct name_data {
109 GaimConnection *gc; 109 PurpleConnection *gc;
110 gchar *name; 110 gchar *name;
111 gchar *nick; 111 gchar *nick;
112 }; 112 };
113 113
114 static char *msgerrreason[] = { 114 static char *msgerrreason[] = {
138 N_("Queue full"), 138 N_("Queue full"),
139 N_("Not while on AOL") 139 N_("Not while on AOL")
140 }; 140 };
141 static int msgerrreasonlen = 25; 141 static int msgerrreasonlen = 25;
142 142
143 /* All the libfaim->gaim callback functions */ 143 /* All the libfaim->purple callback functions */
144 static int gaim_parse_auth_resp (OscarData *, FlapConnection *, FlapFrame *, ...); 144 static int purple_parse_auth_resp (OscarData *, FlapConnection *, FlapFrame *, ...);
145 static int gaim_parse_login (OscarData *, FlapConnection *, FlapFrame *, ...); 145 static int purple_parse_login (OscarData *, FlapConnection *, FlapFrame *, ...);
146 static int gaim_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...); 146 static int purple_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...);
147 static int gaim_handle_redirect (OscarData *, FlapConnection *, FlapFrame *, ...); 147 static int purple_handle_redirect (OscarData *, FlapConnection *, FlapFrame *, ...);
148 static int gaim_info_change (OscarData *, FlapConnection *, FlapFrame *, ...); 148 static int purple_info_change (OscarData *, FlapConnection *, FlapFrame *, ...);
149 static int gaim_account_confirm (OscarData *, FlapConnection *, FlapFrame *, ...); 149 static int purple_account_confirm (OscarData *, FlapConnection *, FlapFrame *, ...);
150 static int gaim_parse_oncoming (OscarData *, FlapConnection *, FlapFrame *, ...); 150 static int purple_parse_oncoming (OscarData *, FlapConnection *, FlapFrame *, ...);
151 static int gaim_parse_offgoing (OscarData *, FlapConnection *, FlapFrame *, ...); 151 static int purple_parse_offgoing (OscarData *, FlapConnection *, FlapFrame *, ...);
152 static int gaim_parse_incoming_im(OscarData *, FlapConnection *, FlapFrame *, ...); 152 static int purple_parse_incoming_im(OscarData *, FlapConnection *, FlapFrame *, ...);
153 static int gaim_parse_misses (OscarData *, FlapConnection *, FlapFrame *, ...); 153 static int purple_parse_misses (OscarData *, FlapConnection *, FlapFrame *, ...);
154 static int gaim_parse_clientauto (OscarData *, FlapConnection *, FlapFrame *, ...); 154 static int purple_parse_clientauto (OscarData *, FlapConnection *, FlapFrame *, ...);
155 static int gaim_parse_userinfo (OscarData *, FlapConnection *, FlapFrame *, ...); 155 static int purple_parse_userinfo (OscarData *, FlapConnection *, FlapFrame *, ...);
156 static int gaim_got_infoblock (OscarData *, FlapConnection *, FlapFrame *, ...); 156 static int purple_got_infoblock (OscarData *, FlapConnection *, FlapFrame *, ...);
157 static int gaim_parse_motd (OscarData *, FlapConnection *, FlapFrame *, ...); 157 static int purple_parse_motd (OscarData *, FlapConnection *, FlapFrame *, ...);
158 static int gaim_chatnav_info (OscarData *, FlapConnection *, FlapFrame *, ...); 158 static int purple_chatnav_info (OscarData *, FlapConnection *, FlapFrame *, ...);
159 static int gaim_conv_chat_join (OscarData *, FlapConnection *, FlapFrame *, ...); 159 static int purple_conv_chat_join (OscarData *, FlapConnection *, FlapFrame *, ...);
160 static int gaim_conv_chat_leave (OscarData *, FlapConnection *, FlapFrame *, ...); 160 static int purple_conv_chat_leave (OscarData *, FlapConnection *, FlapFrame *, ...);
161 static int gaim_conv_chat_info_update (OscarData *, FlapConnection *, FlapFrame *, ...); 161 static int purple_conv_chat_info_update (OscarData *, FlapConnection *, FlapFrame *, ...);
162 static int gaim_conv_chat_incoming_msg(OscarData *, FlapConnection *, FlapFrame *, ...); 162 static int purple_conv_chat_incoming_msg(OscarData *, FlapConnection *, FlapFrame *, ...);
163 static int gaim_email_parseupdate(OscarData *, FlapConnection *, FlapFrame *, ...); 163 static int purple_email_parseupdate(OscarData *, FlapConnection *, FlapFrame *, ...);
164 static int gaim_icon_error (OscarData *, FlapConnection *, FlapFrame *, ...); 164 static int purple_icon_error (OscarData *, FlapConnection *, FlapFrame *, ...);
165 static int gaim_icon_parseicon (OscarData *, FlapConnection *, FlapFrame *, ...); 165 static int purple_icon_parseicon (OscarData *, FlapConnection *, FlapFrame *, ...);
166 static int oscar_icon_req (OscarData *, FlapConnection *, FlapFrame *, ...); 166 static int oscar_icon_req (OscarData *, FlapConnection *, FlapFrame *, ...);
167 static int gaim_parse_msgack (OscarData *, FlapConnection *, FlapFrame *, ...); 167 static int purple_parse_msgack (OscarData *, FlapConnection *, FlapFrame *, ...);
168 static int gaim_parse_ratechange (OscarData *, FlapConnection *, FlapFrame *, ...); 168 static int purple_parse_ratechange (OscarData *, FlapConnection *, FlapFrame *, ...);
169 static int gaim_parse_evilnotify (OscarData *, FlapConnection *, FlapFrame *, ...); 169 static int purple_parse_evilnotify (OscarData *, FlapConnection *, FlapFrame *, ...);
170 static int gaim_parse_searcherror(OscarData *, FlapConnection *, FlapFrame *, ...); 170 static int purple_parse_searcherror(OscarData *, FlapConnection *, FlapFrame *, ...);
171 static int gaim_parse_searchreply(OscarData *, FlapConnection *, FlapFrame *, ...); 171 static int purple_parse_searchreply(OscarData *, FlapConnection *, FlapFrame *, ...);
172 static int gaim_bosrights (OscarData *, FlapConnection *, FlapFrame *, ...); 172 static int purple_bosrights (OscarData *, FlapConnection *, FlapFrame *, ...);
173 static int gaim_connerr (OscarData *, FlapConnection *, FlapFrame *, ...); 173 static int purple_connerr (OscarData *, FlapConnection *, FlapFrame *, ...);
174 static int gaim_parse_msgerr (OscarData *, FlapConnection *, FlapFrame *, ...); 174 static int purple_parse_msgerr (OscarData *, FlapConnection *, FlapFrame *, ...);
175 static int gaim_parse_mtn (OscarData *, FlapConnection *, FlapFrame *, ...); 175 static int purple_parse_mtn (OscarData *, FlapConnection *, FlapFrame *, ...);
176 static int gaim_parse_locaterights(OscarData *, FlapConnection *, FlapFrame *, ...); 176 static int purple_parse_locaterights(OscarData *, FlapConnection *, FlapFrame *, ...);
177 static int gaim_parse_buddyrights(OscarData *, FlapConnection *, FlapFrame *, ...); 177 static int purple_parse_buddyrights(OscarData *, FlapConnection *, FlapFrame *, ...);
178 static int gaim_parse_locerr (OscarData *, FlapConnection *, FlapFrame *, ...); 178 static int purple_parse_locerr (OscarData *, FlapConnection *, FlapFrame *, ...);
179 static int gaim_icbm_param_info (OscarData *, FlapConnection *, FlapFrame *, ...); 179 static int purple_icbm_param_info (OscarData *, FlapConnection *, FlapFrame *, ...);
180 static int gaim_parse_genericerr (OscarData *, FlapConnection *, FlapFrame *, ...); 180 static int purple_parse_genericerr (OscarData *, FlapConnection *, FlapFrame *, ...);
181 static int gaim_memrequest (OscarData *, FlapConnection *, FlapFrame *, ...); 181 static int purple_memrequest (OscarData *, FlapConnection *, FlapFrame *, ...);
182 static int gaim_selfinfo (OscarData *, FlapConnection *, FlapFrame *, ...); 182 static int purple_selfinfo (OscarData *, FlapConnection *, FlapFrame *, ...);
183 static int gaim_offlinemsg (OscarData *, FlapConnection *, FlapFrame *, ...); 183 static int purple_offlinemsg (OscarData *, FlapConnection *, FlapFrame *, ...);
184 static int gaim_offlinemsgdone (OscarData *, FlapConnection *, FlapFrame *, ...); 184 static int purple_offlinemsgdone (OscarData *, FlapConnection *, FlapFrame *, ...);
185 static int gaim_icqalias (OscarData *, FlapConnection *, FlapFrame *, ...); 185 static int purple_icqalias (OscarData *, FlapConnection *, FlapFrame *, ...);
186 static int gaim_icqinfo (OscarData *, FlapConnection *, FlapFrame *, ...); 186 static int purple_icqinfo (OscarData *, FlapConnection *, FlapFrame *, ...);
187 static int gaim_popup (OscarData *, FlapConnection *, FlapFrame *, ...); 187 static int purple_popup (OscarData *, FlapConnection *, FlapFrame *, ...);
188 static int gaim_ssi_parseerr (OscarData *, FlapConnection *, FlapFrame *, ...); 188 static int purple_ssi_parseerr (OscarData *, FlapConnection *, FlapFrame *, ...);
189 static int gaim_ssi_parserights (OscarData *, FlapConnection *, FlapFrame *, ...); 189 static int purple_ssi_parserights (OscarData *, FlapConnection *, FlapFrame *, ...);
190 static int gaim_ssi_parselist (OscarData *, FlapConnection *, FlapFrame *, ...); 190 static int purple_ssi_parselist (OscarData *, FlapConnection *, FlapFrame *, ...);
191 static int gaim_ssi_parseack (OscarData *, FlapConnection *, FlapFrame *, ...); 191 static int purple_ssi_parseack (OscarData *, FlapConnection *, FlapFrame *, ...);
192 static int gaim_ssi_parseadd (OscarData *, FlapConnection *, FlapFrame *, ...); 192 static int purple_ssi_parseadd (OscarData *, FlapConnection *, FlapFrame *, ...);
193 static int gaim_ssi_authgiven (OscarData *, FlapConnection *, FlapFrame *, ...); 193 static int purple_ssi_authgiven (OscarData *, FlapConnection *, FlapFrame *, ...);
194 static int gaim_ssi_authrequest (OscarData *, FlapConnection *, FlapFrame *, ...); 194 static int purple_ssi_authrequest (OscarData *, FlapConnection *, FlapFrame *, ...);
195 static int gaim_ssi_authreply (OscarData *, FlapConnection *, FlapFrame *, ...); 195 static int purple_ssi_authreply (OscarData *, FlapConnection *, FlapFrame *, ...);
196 static int gaim_ssi_gotadded (OscarData *, FlapConnection *, FlapFrame *, ...); 196 static int purple_ssi_gotadded (OscarData *, FlapConnection *, FlapFrame *, ...);
197 197
198 static gboolean gaim_icon_timerfunc(gpointer data); 198 static gboolean purple_icon_timerfunc(gpointer data);
199 199
200 static void recent_buddies_cb(const char *name, GaimPrefType type, gconstpointer value, gpointer data); 200 static void recent_buddies_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data);
201 void oscar_set_info(GaimConnection *gc, const char *info); 201 void oscar_set_info(PurpleConnection *gc, const char *info);
202 static void oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, GaimStatus *status); 202 static void oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, PurpleStatus *status);
203 static void oscar_set_extendedstatus(GaimConnection *gc); 203 static void oscar_set_extendedstatus(PurpleConnection *gc);
204 static void oscar_format_screenname(GaimConnection *gc, const char *nick); 204 static void oscar_format_screenname(PurpleConnection *gc, const char *nick);
205 static gboolean gaim_ssi_rerequestdata(gpointer data); 205 static gboolean purple_ssi_rerequestdata(gpointer data);
206 206
207 static void oscar_free_name_data(struct name_data *data) { 207 static void oscar_free_name_data(struct name_data *data) {
208 g_free(data->name); 208 g_free(data->name);
209 g_free(data->nick); 209 g_free(data->nick);
210 g_free(data); 210 g_free(data);
300 oscar_encoding_to_utf8(const char *encoding, const char *text, int textlen) 300 oscar_encoding_to_utf8(const char *encoding, const char *text, int textlen)
301 { 301 {
302 gchar *utf8 = NULL; 302 gchar *utf8 = NULL;
303 303
304 if ((encoding == NULL) || encoding[0] == '\0') { 304 if ((encoding == NULL) || encoding[0] == '\0') {
305 gaim_debug_info("oscar", "Empty encoding, assuming UTF-8\n"); 305 purple_debug_info("oscar", "Empty encoding, assuming UTF-8\n");
306 } else if (!strcasecmp(encoding, "iso-8859-1")) { 306 } else if (!strcasecmp(encoding, "iso-8859-1")) {
307 utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL); 307 utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL);
308 } else if (!strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") || 308 } else if (!strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") ||
309 !strcasecmp(encoding, "us-ascii")) 309 !strcasecmp(encoding, "us-ascii"))
310 { 310 {
311 utf8 = g_convert(text, textlen, "UTF-8", "Windows-1252", NULL, NULL, NULL); 311 utf8 = g_convert(text, textlen, "UTF-8", "Windows-1252", NULL, NULL, NULL);
312 } else if (!strcasecmp(encoding, "unicode-2-0")) { 312 } else if (!strcasecmp(encoding, "unicode-2-0")) {
313 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); 313 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL);
314 } else if (strcasecmp(encoding, "utf-8")) { 314 } else if (strcasecmp(encoding, "utf-8")) {
315 gaim_debug_warning("oscar", "Unrecognized character encoding \"%s\", " 315 purple_debug_warning("oscar", "Unrecognized character encoding \"%s\", "
316 "attempting to convert to UTF-8 anyway\n", encoding); 316 "attempting to convert to UTF-8 anyway\n", encoding);
317 utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL); 317 utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL);
318 } 318 }
319 319
320 /* 320 /*
333 333
334 return utf8; 334 return utf8;
335 } 335 }
336 336
337 static gchar * 337 static gchar *
338 oscar_utf8_try_convert(GaimAccount *account, const gchar *msg) 338 oscar_utf8_try_convert(PurpleAccount *account, const gchar *msg)
339 { 339 {
340 const char *charset = NULL; 340 const char *charset = NULL;
341 char *ret = NULL; 341 char *ret = NULL;
342 342
343 if(aim_sn_is_icq(gaim_account_get_username(account))) 343 if(aim_sn_is_icq(purple_account_get_username(account)))
344 charset = gaim_account_get_string(account, "encoding", NULL); 344 charset = purple_account_get_string(account, "encoding", NULL);
345 345
346 if(charset && *charset) 346 if(charset && *charset)
347 ret = g_convert(msg, -1, "UTF-8", charset, NULL, NULL, NULL); 347 ret = g_convert(msg, -1, "UTF-8", charset, NULL, NULL, NULL);
348 348
349 if(!ret) 349 if(!ret)
350 ret = gaim_utf8_try_convert(msg); 350 ret = purple_utf8_try_convert(msg);
351 351
352 return ret; 352 return ret;
353 } 353 }
354 354
355 static gchar * 355 static gchar *
356 gaim_plugin_oscar_convert_to_utf8(const gchar *data, gsize datalen, const char *charsetstr, gboolean fallback) 356 purple_plugin_oscar_convert_to_utf8(const gchar *data, gsize datalen, const char *charsetstr, gboolean fallback)
357 { 357 {
358 gchar *ret = NULL; 358 gchar *ret = NULL;
359 GError *err = NULL; 359 GError *err = NULL;
360 360
361 if ((charsetstr == NULL) || (*charsetstr == '\0')) 361 if ((charsetstr == NULL) || (*charsetstr == '\0'))
365 if (fallback) 365 if (fallback)
366 ret = g_convert_with_fallback(data, datalen, "UTF-8", charsetstr, "?", NULL, NULL, &err); 366 ret = g_convert_with_fallback(data, datalen, "UTF-8", charsetstr, "?", NULL, NULL, &err);
367 else 367 else
368 ret = g_convert(data, datalen, "UTF-8", charsetstr, NULL, NULL, &err); 368 ret = g_convert(data, datalen, "UTF-8", charsetstr, NULL, NULL, &err);
369 if (err != NULL) { 369 if (err != NULL) {
370 gaim_debug_warning("oscar", "Conversion from %s failed: %s.\n", 370 purple_debug_warning("oscar", "Conversion from %s failed: %s.\n",
371 charsetstr, err->message); 371 charsetstr, err->message);
372 g_error_free(err); 372 g_error_free(err);
373 } 373 }
374 } else { 374 } else {
375 if (g_utf8_validate(data, datalen, NULL)) 375 if (g_utf8_validate(data, datalen, NULL))
376 ret = g_strndup(data, datalen); 376 ret = g_strndup(data, datalen);
377 else 377 else
378 gaim_debug_warning("oscar", "String is not valid UTF-8.\n"); 378 purple_debug_warning("oscar", "String is not valid UTF-8.\n");
379 } 379 }
380 380
381 return ret; 381 return ret;
382 } 382 }
383 383
385 * This attemps to decode an incoming IM into a UTF8 string. 385 * This attemps to decode an incoming IM into a UTF8 string.
386 * 386 *
387 * We try decoding using two different character sets. The charset 387 * We try decoding using two different character sets. The charset
388 * specified in the IM determines the order in which we attempt to 388 * specified in the IM determines the order in which we attempt to
389 * decode. We do this because there are lots of broken ICQ clients 389 * decode. We do this because there are lots of broken ICQ clients
390 * that don't correctly send non-ASCII messages. And if Gaim isn't 390 * that don't correctly send non-ASCII messages. And if Purple isn't
391 * able to deal with that crap, then people complain like banshees. 391 * able to deal with that crap, then people complain like banshees.
392 * charsetstr1 is always set to what the correct encoding should be. 392 * charsetstr1 is always set to what the correct encoding should be.
393 */ 393 */
394 gchar * 394 gchar *
395 gaim_plugin_oscar_decode_im_part(GaimAccount *account, const char *sourcesn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen) 395 purple_plugin_oscar_decode_im_part(PurpleAccount *account, const char *sourcesn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen)
396 { 396 {
397 gchar *ret = NULL; 397 gchar *ret = NULL;
398 const gchar *charsetstr1, *charsetstr2; 398 const gchar *charsetstr1, *charsetstr2;
399 399
400 gaim_debug_info("oscar", "Parsing IM part, charset=0x%04hx, charsubset=0x%04hx, datalen=%hd\n", charset, charsubset, datalen); 400 purple_debug_info("oscar", "Parsing IM part, charset=0x%04hx, charsubset=0x%04hx, datalen=%hd\n", charset, charsubset, datalen);
401 401
402 if ((datalen == 0) || (data == NULL)) 402 if ((datalen == 0) || (data == NULL))
403 return NULL; 403 return NULL;
404 404
405 if (charset == AIM_CHARSET_UNICODE) { 405 if (charset == AIM_CHARSET_UNICODE) {
406 charsetstr1 = "UCS-2BE"; 406 charsetstr1 = "UCS-2BE";
407 charsetstr2 = "UTF-8"; 407 charsetstr2 = "UTF-8";
408 } else if (charset == AIM_CHARSET_CUSTOM) { 408 } else if (charset == AIM_CHARSET_CUSTOM) {
409 if ((sourcesn != NULL) && isdigit(sourcesn[0])) 409 if ((sourcesn != NULL) && isdigit(sourcesn[0]))
410 charsetstr1 = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); 410 charsetstr1 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
411 else 411 else
412 charsetstr1 = "ISO-8859-1"; 412 charsetstr1 = "ISO-8859-1";
413 charsetstr2 = "UTF-8"; 413 charsetstr2 = "UTF-8";
414 } else if (charset == AIM_CHARSET_ASCII) { 414 } else if (charset == AIM_CHARSET_ASCII) {
415 /* Should just be "ASCII" */ 415 /* Should just be "ASCII" */
416 charsetstr1 = "ASCII"; 416 charsetstr1 = "ASCII";
417 charsetstr2 = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); 417 charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
418 } else if (charset == 0x000d) { 418 } else if (charset == 0x000d) {
419 /* Mobile AIM client on a Nokia 3100 and an LG VX6000 */ 419 /* Mobile AIM client on a Nokia 3100 and an LG VX6000 */
420 charsetstr1 = "ISO-8859-1"; 420 charsetstr1 = "ISO-8859-1";
421 charsetstr2 = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); 421 charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
422 } else { 422 } else {
423 /* Unknown, hope for valid UTF-8... */ 423 /* Unknown, hope for valid UTF-8... */
424 charsetstr1 = "UTF-8"; 424 charsetstr1 = "UTF-8";
425 charsetstr2 = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); 425 charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
426 } 426 }
427 427
428 ret = gaim_plugin_oscar_convert_to_utf8(data, datalen, charsetstr1, FALSE); 428 ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr1, FALSE);
429 if (ret == NULL) 429 if (ret == NULL)
430 ret = gaim_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, TRUE); 430 ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, TRUE);
431 if (ret == NULL) { 431 if (ret == NULL) {
432 char *str, *salvage, *tmp; 432 char *str, *salvage, *tmp;
433 433
434 str = g_malloc(datalen + 1); 434 str = g_malloc(datalen + 1);
435 strncpy(str, data, datalen); 435 strncpy(str, data, datalen);
436 str[datalen] = '\0'; 436 str[datalen] = '\0';
437 salvage = gaim_utf8_salvage(str); 437 salvage = purple_utf8_salvage(str);
438 tmp = g_strdup_printf(_("(There was an error receiving this message. Either you and %s have different encodings selected, or %s has a buggy client.)"), 438 tmp = g_strdup_printf(_("(There was an error receiving this message. Either you and %s have different encodings selected, or %s has a buggy client.)"),
439 sourcesn, sourcesn); 439 sourcesn, sourcesn);
440 ret = g_strdup_printf("%s %s", salvage, tmp); 440 ret = g_strdup_printf("%s %s", salvage, tmp);
441 g_free(tmp); 441 g_free(tmp);
442 g_free(str); 442 g_free(str);
448 448
449 /** 449 /**
450 * Figure out what encoding to use when sending a given outgoing message. 450 * Figure out what encoding to use when sending a given outgoing message.
451 */ 451 */
452 static void 452 static void
453 gaim_plugin_oscar_convert_to_best_encoding(GaimConnection *gc, 453 purple_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc,
454 const char *destsn, const gchar *from, 454 const char *destsn, const gchar *from,
455 gchar **msg, int *msglen_int, 455 gchar **msg, int *msglen_int,
456 guint16 *charset, guint16 *charsubset) 456 guint16 *charset, guint16 *charsubset)
457 { 457 {
458 OscarData *od = gc->proto_data; 458 OscarData *od = gc->proto_data;
459 GaimAccount *account = gaim_connection_get_account(gc); 459 PurpleAccount *account = purple_connection_get_account(gc);
460 GError *err = NULL; 460 GError *err = NULL;
461 aim_userinfo_t *userinfo = NULL; 461 aim_userinfo_t *userinfo = NULL;
462 const gchar *charsetstr; 462 const gchar *charsetstr;
463 gsize msglen; 463 gsize msglen;
464 464
480 if ((destsn != NULL) && aim_sn_is_icq(destsn)) 480 if ((destsn != NULL) && aim_sn_is_icq(destsn))
481 userinfo = aim_locate_finduserinfo(od, destsn); 481 userinfo = aim_locate_finduserinfo(od, destsn);
482 482
483 if ((userinfo != NULL) && (userinfo->capabilities & OSCAR_CAPABILITY_UNICODE)) 483 if ((userinfo != NULL) && (userinfo->capabilities & OSCAR_CAPABILITY_UNICODE))
484 { 484 {
485 GaimBuddy *b; 485 PurpleBuddy *b;
486 b = gaim_find_buddy(account, destsn); 486 b = purple_find_buddy(account, destsn);
487 if ((b != NULL) && (GAIM_BUDDY_IS_ONLINE(b))) 487 if ((b != NULL) && (PURPLE_BUDDY_IS_ONLINE(b)))
488 { 488 {
489 *msg = g_convert(from, strlen(from), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); 489 *msg = g_convert(from, strlen(from), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
490 if (*msg != NULL) 490 if (*msg != NULL)
491 { 491 {
492 *charset = AIM_CHARSET_UNICODE; 492 *charset = AIM_CHARSET_UNICODE;
501 * If this is AIM then attempt to send as ISO-8859-1. If this is 501 * If this is AIM then attempt to send as ISO-8859-1. If this is
502 * ICQ then attempt to send as the user specified character encoding. 502 * ICQ then attempt to send as the user specified character encoding.
503 */ 503 */
504 charsetstr = "ISO-8859-1"; 504 charsetstr = "ISO-8859-1";
505 if ((destsn != NULL) && aim_sn_is_icq(destsn)) 505 if ((destsn != NULL) && aim_sn_is_icq(destsn))
506 charsetstr = gaim_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); 506 charsetstr = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
507 507
508 /* 508 /*
509 * XXX - We need a way to only attempt to convert if we KNOW "from" 509 * XXX - We need a way to only attempt to convert if we KNOW "from"
510 * can be converted to "charsetstr" 510 * can be converted to "charsetstr"
511 */ 511 */
526 *charsubset = 0x0000; 526 *charsubset = 0x0000;
527 *msglen_int = msglen; 527 *msglen_int = msglen;
528 return; 528 return;
529 } 529 }
530 530
531 gaim_debug_error("oscar", "Error converting a Unicode message: %s\n", err->message); 531 purple_debug_error("oscar", "Error converting a Unicode message: %s\n", err->message);
532 g_error_free(err); 532 g_error_free(err);
533 533
534 gaim_debug_error("oscar", "This should NEVER happen! Sending UTF-8 text flagged as ASCII.\n"); 534 purple_debug_error("oscar", "This should NEVER happen! Sending UTF-8 text flagged as ASCII.\n");
535 *msg = g_strdup(from); 535 *msg = g_strdup(from);
536 *msglen_int = strlen(*msg); 536 *msglen_int = strlen(*msg);
537 *charset = AIM_CHARSET_ASCII; 537 *charset = AIM_CHARSET_ASCII;
538 *charsubset = 0x0000; 538 *charsubset = 0x0000;
539 return; 539 return;
548 * 548 *
549 * @return A newly allocated string where the special variables are 549 * @return A newly allocated string where the special variables are
550 * expanded. This should be g_free'd by the caller. 550 * expanded. This should be g_free'd by the caller.
551 */ 551 */
552 static gchar * 552 static gchar *
553 gaim_str_sub_away_formatters(const char *str, const char *name) 553 purple_str_sub_away_formatters(const char *str, const char *name)
554 { 554 {
555 char *c; 555 char *c;
556 GString *cpy; 556 GString *cpy;
557 time_t t; 557 time_t t;
558 struct tm *tme; 558 struct tm *tme;
577 g_string_append(cpy, name); 577 g_string_append(cpy, name);
578 c++; 578 c++;
579 break; 579 break;
580 case 'd': 580 case 'd':
581 /* append date */ 581 /* append date */
582 g_string_append(cpy, gaim_date_format_short(tme)); 582 g_string_append(cpy, purple_date_format_short(tme));
583 c++; 583 c++;
584 break; 584 break;
585 case 't': 585 case 't':
586 /* append time */ 586 /* append time */
587 g_string_append(cpy, gaim_time_format(tme)); 587 g_string_append(cpy, purple_time_format(tme));
588 c++; 588 c++;
589 break; 589 break;
590 default: 590 default:
591 g_string_append_c(cpy, *c); 591 g_string_append_c(cpy, *c);
592 } 592 }
719 else 719 else
720 return g_strdup_printf(_("Online")); 720 return g_strdup_printf(_("Online"));
721 } 721 }
722 722
723 static void 723 static void
724 oscar_user_info_add_pair(GaimNotifyUserInfo *user_info, const char *name, const char *value) 724 oscar_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *name, const char *value)
725 { 725 {
726 if (value && value[0]) { 726 if (value && value[0]) {
727 gaim_notify_user_info_add_pair(user_info, name, value); 727 purple_notify_user_info_add_pair(user_info, name, value);
728 } 728 }
729 } 729 }
730 730
731 static void 731 static void
732 oscar_user_info_convert_and_add_pair(GaimAccount *account, GaimNotifyUserInfo *user_info, 732 oscar_user_info_convert_and_add_pair(PurpleAccount *account, PurpleNotifyUserInfo *user_info,
733 const char *name, const char *value) 733 const char *name, const char *value)
734 { 734 {
735 gchar *utf8; 735 gchar *utf8;
736 736
737 if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) { 737 if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) {
738 gaim_notify_user_info_add_pair(user_info, name, utf8); 738 purple_notify_user_info_add_pair(user_info, name, utf8);
739 g_free(utf8); 739 g_free(utf8);
740 } 740 }
741 } 741 }
742 742
743 static void 743 static void
744 oscar_string_convert_and_append(GaimAccount *account, GString *str, const char *newline, 744 oscar_string_convert_and_append(PurpleAccount *account, GString *str, const char *newline,
745 const char *name, const char *value) 745 const char *name, const char *value)
746 { 746 {
747 gchar *utf8; 747 gchar *utf8;
748 748
749 if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) { 749 if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) {
751 g_free(utf8); 751 g_free(utf8);
752 } 752 }
753 } 753 }
754 754
755 static void 755 static void
756 oscar_user_info_convert_and_add(GaimAccount *account, GaimNotifyUserInfo *user_info, 756 oscar_user_info_convert_and_add(PurpleAccount *account, PurpleNotifyUserInfo *user_info,
757 const char *name, const char *value) 757 const char *name, const char *value)
758 { 758 {
759 gchar *utf8; 759 gchar *utf8;
760 760
761 if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) { 761 if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) {
762 gaim_notify_user_info_add_pair(user_info, name, value); 762 purple_notify_user_info_add_pair(user_info, name, value);
763 g_free(utf8); 763 g_free(utf8);
764 } 764 }
765 } 765 }
766 766
767 static void oscar_string_append_info(GaimConnection *gc, GaimNotifyUserInfo *user_info, GaimBuddy *b, aim_userinfo_t *userinfo) 767 static void oscar_string_append_info(PurpleConnection *gc, PurpleNotifyUserInfo *user_info, PurpleBuddy *b, aim_userinfo_t *userinfo)
768 { 768 {
769 OscarData *od; 769 OscarData *od;
770 GaimAccount *account; 770 PurpleAccount *account;
771 GaimPresence *presence = NULL; 771 PurplePresence *presence = NULL;
772 GaimStatus *status = NULL; 772 PurpleStatus *status = NULL;
773 GaimGroup *g = NULL; 773 PurpleGroup *g = NULL;
774 struct buddyinfo *bi = NULL; 774 struct buddyinfo *bi = NULL;
775 char *tmp; 775 char *tmp;
776 776
777 od = gc->proto_data; 777 od = gc->proto_data;
778 account = gaim_connection_get_account(gc); 778 account = purple_connection_get_account(gc);
779 779
780 if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL))) 780 if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL)))
781 return; 781 return;
782 782
783 if (userinfo == NULL) 783 if (userinfo == NULL)
784 userinfo = aim_locate_finduserinfo(od, b->name); 784 userinfo = aim_locate_finduserinfo(od, b->name);
785 785
786 if (b == NULL) 786 if (b == NULL)
787 b = gaim_find_buddy(account, userinfo->sn); 787 b = purple_find_buddy(account, userinfo->sn);
788 788
789 if (b != NULL) { 789 if (b != NULL) {
790 g = gaim_buddy_get_group(b); 790 g = purple_buddy_get_group(b);
791 presence = gaim_buddy_get_presence(b); 791 presence = purple_buddy_get_presence(b);
792 status = gaim_presence_get_active_status(presence); 792 status = purple_presence_get_active_status(presence);
793 } 793 }
794 794
795 if (userinfo != NULL) 795 if (userinfo != NULL)
796 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); 796 bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->sn));
797 797
798 if (b != NULL) { 798 if (b != NULL) {
799 if (gaim_presence_is_online(presence)) { 799 if (purple_presence_is_online(presence)) {
800 if (aim_sn_is_icq(b->name)) { 800 if (aim_sn_is_icq(b->name)) {
801 GaimStatus *status = gaim_presence_get_active_status(presence); 801 PurpleStatus *status = purple_presence_get_active_status(presence);
802 oscar_user_info_add_pair(user_info, _("Status"), gaim_status_get_name(status)); 802 oscar_user_info_add_pair(user_info, _("Status"), purple_status_get_name(status));
803 } 803 }
804 } else { 804 } else {
805 tmp = aim_ssi_itemlist_findparentname(od->ssi.local, b->name); 805 tmp = aim_ssi_itemlist_findparentname(od->ssi.local, b->name);
806 if (aim_ssi_waitingforauth(od->ssi.local, tmp, b->name)) 806 if (aim_ssi_waitingforauth(od->ssi.local, tmp, b->name))
807 oscar_user_info_add_pair(user_info, _("Status"), _("Not Authorized")); 807 oscar_user_info_add_pair(user_info, _("Status"), _("Not Authorized"));
871 tmp[j] = 0; 871 tmp[j] = 0;
872 return tmp; 872 return tmp;
873 } 873 }
874 874
875 static struct chat_connection * 875 static struct chat_connection *
876 find_oscar_chat(GaimConnection *gc, int id) 876 find_oscar_chat(PurpleConnection *gc, int id)
877 { 877 {
878 OscarData *od = (OscarData *)gc->proto_data; 878 OscarData *od = (OscarData *)gc->proto_data;
879 GSList *cur; 879 GSList *cur;
880 struct chat_connection *cc; 880 struct chat_connection *cc;
881 881
888 888
889 return NULL; 889 return NULL;
890 } 890 }
891 891
892 static struct chat_connection * 892 static struct chat_connection *
893 find_oscar_chat_by_conn(GaimConnection *gc, FlapConnection *conn) 893 find_oscar_chat_by_conn(PurpleConnection *gc, FlapConnection *conn)
894 { 894 {
895 OscarData *od = (OscarData *)gc->proto_data; 895 OscarData *od = (OscarData *)gc->proto_data;
896 GSList *cur; 896 GSList *cur;
897 struct chat_connection *cc; 897 struct chat_connection *cc;
898 898
905 905
906 return NULL; 906 return NULL;
907 } 907 }
908 908
909 static struct chat_connection * 909 static struct chat_connection *
910 find_oscar_chat_by_conv(GaimConnection *gc, GaimConversation *conv) 910 find_oscar_chat_by_conv(PurpleConnection *gc, PurpleConversation *conv)
911 { 911 {
912 OscarData *od = (OscarData *)gc->proto_data; 912 OscarData *od = (OscarData *)gc->proto_data;
913 GSList *cur; 913 GSList *cur;
914 struct chat_connection *cc; 914 struct chat_connection *cc;
915 915
930 g_free(cc->show); 930 g_free(cc->show);
931 g_free(cc); 931 g_free(cc);
932 } 932 }
933 933
934 static void 934 static void
935 oscar_chat_kill(GaimConnection *gc, struct chat_connection *cc) 935 oscar_chat_kill(PurpleConnection *gc, struct chat_connection *cc)
936 { 936 {
937 OscarData *od = (OscarData *)gc->proto_data; 937 OscarData *od = (OscarData *)gc->proto_data;
938 938
939 /* Notify the conversation window that we've left the chat */ 939 /* Notify the conversation window that we've left the chat */
940 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(cc->conv))); 940 serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(cc->conv)));
941 941
942 /* Destroy the chat_connection */ 942 /* Destroy the chat_connection */
943 od->oscar_chats = g_slist_remove(od->oscar_chats, cc); 943 od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
944 flap_connection_schedule_destroy(cc->conn, OSCAR_DISCONNECT_DONE, NULL); 944 flap_connection_schedule_destroy(cc->conn, OSCAR_DISCONNECT_DONE, NULL);
945 oscar_chat_destroy(cc); 945 oscar_chat_destroy(cc);
946 } 946 }
947 947
948 /** 948 /**
949 * This is the callback function anytime gaim_proxy_connect() 949 * This is the callback function anytime purple_proxy_connect()
950 * establishes a new TCP connection with an oscar host. Depending 950 * establishes a new TCP connection with an oscar host. Depending
951 * on the type of host, we do a few different things here. 951 * on the type of host, we do a few different things here.
952 */ 952 */
953 static void 953 static void
954 connection_established_cb(gpointer data, gint source, const gchar *error_message) 954 connection_established_cb(gpointer data, gint source, const gchar *error_message)
955 { 955 {
956 GaimConnection *gc; 956 PurpleConnection *gc;
957 OscarData *od; 957 OscarData *od;
958 GaimAccount *account; 958 PurpleAccount *account;
959 FlapConnection *conn; 959 FlapConnection *conn;
960 960
961 conn = data; 961 conn = data;
962 od = conn->od; 962 od = conn->od;
963 gc = od->gc; 963 gc = od->gc;
964 account = gaim_connection_get_account(gc); 964 account = purple_connection_get_account(gc);
965 965
966 conn->connect_data = NULL; 966 conn->connect_data = NULL;
967 conn->fd = source; 967 conn->fd = source;
968 968
969 if (source < 0) 969 if (source < 0)
970 { 970 {
971 gaim_debug_error("oscar", "unable to connect FLAP server " 971 purple_debug_error("oscar", "unable to connect FLAP server "
972 "of type 0x%04hx\n", conn->type); 972 "of type 0x%04hx\n", conn->type);
973 if (conn->type == SNAC_FAMILY_AUTH) 973 if (conn->type == SNAC_FAMILY_AUTH)
974 { 974 {
975 gchar *msg; 975 gchar *msg;
976 msg = g_strdup_printf(_("Could not connect to authentication server:\n%s"), 976 msg = g_strdup_printf(_("Could not connect to authentication server:\n%s"),
977 error_message); 977 error_message);
978 gaim_connection_error(gc, msg); 978 purple_connection_error(gc, msg);
979 g_free(msg); 979 g_free(msg);
980 } 980 }
981 else if (conn->type == SNAC_FAMILY_LOCATE) 981 else if (conn->type == SNAC_FAMILY_LOCATE)
982 { 982 {
983 gchar *msg; 983 gchar *msg;
984 msg = g_strdup_printf(_("Could not connect to BOS server:\n%s"), 984 msg = g_strdup_printf(_("Could not connect to BOS server:\n%s"),
985 error_message); 985 error_message);
986 gaim_connection_error(gc, msg); 986 purple_connection_error(gc, msg);
987 g_free(msg); 987 g_free(msg);
988 } 988 }
989 else 989 else
990 { 990 {
991 /* Maybe we should call this for BOS connections, too? */ 991 /* Maybe we should call this for BOS connections, too? */
993 OSCAR_DISCONNECT_COULD_NOT_CONNECT, error_message); 993 OSCAR_DISCONNECT_COULD_NOT_CONNECT, error_message);
994 } 994 }
995 return; 995 return;
996 } 996 }
997 997
998 gaim_debug_info("oscar", "connected to FLAP server of type 0x%04hx\n", 998 purple_debug_info("oscar", "connected to FLAP server of type 0x%04hx\n",
999 conn->type); 999 conn->type);
1000 conn->watcher_incoming = gaim_input_add(conn->fd, 1000 conn->watcher_incoming = purple_input_add(conn->fd,
1001 GAIM_INPUT_READ, flap_connection_recv_cb, conn); 1001 PURPLE_INPUT_READ, flap_connection_recv_cb, conn);
1002 if (conn->cookie == NULL) 1002 if (conn->cookie == NULL)
1003 { 1003 {
1004 if (!aim_sn_is_icq(gaim_account_get_username(account))) 1004 if (!aim_sn_is_icq(purple_account_get_username(account)))
1005 /* 1005 /*
1006 * We don't send this when authenticating an ICQ account 1006 * We don't send this when authenticating an ICQ account
1007 * because for some reason ICQ is still using the 1007 * because for some reason ICQ is still using the
1008 * assy/insecure authentication procedure. 1008 * assy/insecure authentication procedure.
1009 */ 1009 */
1017 conn->cookie = NULL; 1017 conn->cookie = NULL;
1018 } 1018 }
1019 1019
1020 if (conn->type == SNAC_FAMILY_AUTH) 1020 if (conn->type == SNAC_FAMILY_AUTH)
1021 { 1021 {
1022 aim_request_login(od, conn, gaim_account_get_username(account)); 1022 aim_request_login(od, conn, purple_account_get_username(account));
1023 gaim_debug_info("oscar", "Screen name sent, waiting for response\n"); 1023 purple_debug_info("oscar", "Screen name sent, waiting for response\n");
1024 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); 1024 purple_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS);
1025 ck[1] = 0x65; 1025 ck[1] = 0x65;
1026 } 1026 }
1027 else if (conn->type == SNAC_FAMILY_LOCATE) 1027 else if (conn->type == SNAC_FAMILY_LOCATE)
1028 { 1028 {
1029 gaim_connection_update_progress(gc, _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); 1029 purple_connection_update_progress(gc, _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS);
1030 ck[4] = 0x61; 1030 ck[4] = 0x61;
1031 } 1031 }
1032 else if (conn->type == SNAC_FAMILY_CHAT) 1032 else if (conn->type == SNAC_FAMILY_CHAT)
1033 { 1033 {
1034 od->oscar_chats = g_slist_prepend(od->oscar_chats, conn->new_conn_data); 1034 od->oscar_chats = g_slist_prepend(od->oscar_chats, conn->new_conn_data);
1037 } 1037 }
1038 1038
1039 static void 1039 static void
1040 flap_connection_established_bos(OscarData *od, FlapConnection *conn) 1040 flap_connection_established_bos(OscarData *od, FlapConnection *conn)
1041 { 1041 {
1042 GaimConnection *gc = od->gc; 1042 PurpleConnection *gc = od->gc;
1043 1043
1044 aim_srv_reqpersonalinfo(od, conn); 1044 aim_srv_reqpersonalinfo(od, conn);
1045 1045
1046 gaim_debug_info("oscar", "ssi: requesting rights and list\n"); 1046 purple_debug_info("oscar", "ssi: requesting rights and list\n");
1047 aim_ssi_reqrights(od); 1047 aim_ssi_reqrights(od);
1048 aim_ssi_reqdata(od); 1048 aim_ssi_reqdata(od);
1049 if (od->getblisttimer > 0) 1049 if (od->getblisttimer > 0)
1050 gaim_timeout_remove(od->getblisttimer); 1050 purple_timeout_remove(od->getblisttimer);
1051 od->getblisttimer = gaim_timeout_add(30000, gaim_ssi_rerequestdata, od); 1051 od->getblisttimer = purple_timeout_add(30000, purple_ssi_rerequestdata, od);
1052 1052
1053 aim_locate_reqrights(od); 1053 aim_locate_reqrights(od);
1054 aim_buddylist_reqrights(od, conn); 1054 aim_buddylist_reqrights(od, conn);
1055 aim_im_reqparams(od); 1055 aim_im_reqparams(od);
1056 aim_bos_reqrights(od, conn); /* TODO: Don't call this with ssi */ 1056 aim_bos_reqrights(od, conn); /* TODO: Don't call this with ssi */
1057 1057
1058 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); 1058 purple_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS);
1059 } 1059 }
1060 1060
1061 static void 1061 static void
1062 flap_connection_established_admin(OscarData *od, FlapConnection *conn) 1062 flap_connection_established_admin(OscarData *od, FlapConnection *conn)
1063 { 1063 {
1064 aim_clientready(od, conn); 1064 aim_clientready(od, conn);
1065 gaim_debug_info("oscar", "connected to admin\n"); 1065 purple_debug_info("oscar", "connected to admin\n");
1066 1066
1067 if (od->chpass) { 1067 if (od->chpass) {
1068 gaim_debug_info("oscar", "changing password\n"); 1068 purple_debug_info("oscar", "changing password\n");
1069 aim_admin_changepasswd(od, conn, od->newp, od->oldp); 1069 aim_admin_changepasswd(od, conn, od->newp, od->oldp);
1070 g_free(od->oldp); 1070 g_free(od->oldp);
1071 od->oldp = NULL; 1071 od->oldp = NULL;
1072 g_free(od->newp); 1072 g_free(od->newp);
1073 od->newp = NULL; 1073 od->newp = NULL;
1074 od->chpass = FALSE; 1074 od->chpass = FALSE;
1075 } 1075 }
1076 if (od->setnick) { 1076 if (od->setnick) {
1077 gaim_debug_info("oscar", "formatting screen name\n"); 1077 purple_debug_info("oscar", "formatting screen name\n");
1078 aim_admin_setnick(od, conn, od->newsn); 1078 aim_admin_setnick(od, conn, od->newsn);
1079 g_free(od->newsn); 1079 g_free(od->newsn);
1080 od->newsn = NULL; 1080 od->newsn = NULL;
1081 od->setnick = FALSE; 1081 od->setnick = FALSE;
1082 } 1082 }
1083 if (od->conf) { 1083 if (od->conf) {
1084 gaim_debug_info("oscar", "confirming account\n"); 1084 purple_debug_info("oscar", "confirming account\n");
1085 aim_admin_reqconfirm(od, conn); 1085 aim_admin_reqconfirm(od, conn);
1086 od->conf = FALSE; 1086 od->conf = FALSE;
1087 } 1087 }
1088 if (od->reqemail) { 1088 if (od->reqemail) {
1089 gaim_debug_info("oscar", "requesting e-mail address\n"); 1089 purple_debug_info("oscar", "requesting e-mail address\n");
1090 aim_admin_getinfo(od, conn, 0x0011); 1090 aim_admin_getinfo(od, conn, 0x0011);
1091 od->reqemail = FALSE; 1091 od->reqemail = FALSE;
1092 } 1092 }
1093 if (od->setemail) { 1093 if (od->setemail) {
1094 gaim_debug_info("oscar", "setting e-mail address\n"); 1094 purple_debug_info("oscar", "setting e-mail address\n");
1095 aim_admin_setemail(od, conn, od->email); 1095 aim_admin_setemail(od, conn, od->email);
1096 g_free(od->email); 1096 g_free(od->email);
1097 od->email = NULL; 1097 od->email = NULL;
1098 od->setemail = FALSE; 1098 od->setemail = FALSE;
1099 } 1099 }
1100 } 1100 }
1101 1101
1102 static void 1102 static void
1103 flap_connection_established_chat(OscarData *od, FlapConnection *conn) 1103 flap_connection_established_chat(OscarData *od, FlapConnection *conn)
1104 { 1104 {
1105 GaimConnection *gc = od->gc; 1105 PurpleConnection *gc = od->gc;
1106 struct chat_connection *chatcon; 1106 struct chat_connection *chatcon;
1107 static int id = 1; 1107 static int id = 1;
1108 1108
1109 aim_clientready(od, conn); 1109 aim_clientready(od, conn);
1110 1110
1129 } 1129 }
1130 1130
1131 static void 1131 static void
1132 flap_connection_established_bart(OscarData *od, FlapConnection *conn) 1132 flap_connection_established_bart(OscarData *od, FlapConnection *conn)
1133 { 1133 {
1134 GaimConnection *gc = od->gc; 1134 PurpleConnection *gc = od->gc;
1135 1135
1136 aim_clientready(od, conn); 1136 aim_clientready(od, conn);
1137 1137
1138 od->iconconnecting = FALSE; 1138 od->iconconnecting = FALSE;
1139 1139
1140 if (od->icontimer == 0) 1140 if (od->icontimer == 0)
1141 od->icontimer = gaim_timeout_add(100, gaim_icon_timerfunc, gc); 1141 od->icontimer = purple_timeout_add(100, purple_icon_timerfunc, gc);
1142 } 1142 }
1143 1143
1144 static int 1144 static int
1145 flap_connection_established(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 1145 flap_connection_established(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
1146 { 1146 {
1147 gaim_debug_info("oscar", "FLAP connection of type 0x%04hx is " 1147 purple_debug_info("oscar", "FLAP connection of type 0x%04hx is "
1148 "now fully connected\n", conn->type); 1148 "now fully connected\n", conn->type);
1149 if (conn->type == SNAC_FAMILY_LOCATE) 1149 if (conn->type == SNAC_FAMILY_LOCATE)
1150 flap_connection_established_bos(od, conn); 1150 flap_connection_established_bos(od, conn);
1151 else if (conn->type == SNAC_FAMILY_ADMIN) 1151 else if (conn->type == SNAC_FAMILY_ADMIN)
1152 flap_connection_established_admin(od, conn); 1152 flap_connection_established_admin(od, conn);
1161 1161
1162 return 1; 1162 return 1;
1163 } 1163 }
1164 1164
1165 void 1165 void
1166 oscar_login(GaimAccount *account) 1166 oscar_login(PurpleAccount *account)
1167 { 1167 {
1168 GaimConnection *gc; 1168 PurpleConnection *gc;
1169 OscarData *od; 1169 OscarData *od;
1170 FlapConnection *newconn; 1170 FlapConnection *newconn;
1171 1171
1172 gc = gaim_account_get_connection(account); 1172 gc = purple_account_get_connection(account);
1173 od = gc->proto_data = oscar_data_new(); 1173 od = gc->proto_data = oscar_data_new();
1174 od->gc = gc; 1174 od->gc = gc;
1175 1175
1176 oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 1176 oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, purple_connerr, 0);
1177 oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, flap_connection_established, 0); 1177 oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, flap_connection_established, 0);
1178 1178
1179 oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0003, gaim_info_change, 0); 1179 oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0003, purple_info_change, 0);
1180 oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0005, gaim_info_change, 0); 1180 oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0005, purple_info_change, 0);
1181 oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0007, gaim_account_confirm, 0); 1181 oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0007, purple_account_confirm, 0);
1182 oscar_data_addhandler(od, SNAC_FAMILY_ALERT, 0x0001, gaim_parse_genericerr, 0); 1182 oscar_data_addhandler(od, SNAC_FAMILY_ALERT, 0x0001, purple_parse_genericerr, 0);
1183 oscar_data_addhandler(od, SNAC_FAMILY_ALERT, SNAC_SUBTYPE_ALERT_MAILSTATUS, gaim_email_parseupdate, 0); 1183 oscar_data_addhandler(od, SNAC_FAMILY_ALERT, SNAC_SUBTYPE_ALERT_MAILSTATUS, purple_email_parseupdate, 0);
1184 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, gaim_parse_auth_resp, 0); 1184 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, purple_parse_auth_resp, 0);
1185 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0007, gaim_parse_login, 0); 1185 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0007, purple_parse_login, 0);
1186 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, gaim_parse_auth_securid_request, 0); 1186 oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, purple_parse_auth_securid_request, 0);
1187 oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_ERROR, gaim_icon_error, 0); 1187 oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_ERROR, purple_icon_error, 0);
1188 oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, gaim_icon_parseicon, 0); 1188 oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, purple_icon_parseicon, 0);
1189 oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0001, gaim_parse_genericerr, 0); 1189 oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0001, purple_parse_genericerr, 0);
1190 oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0003, gaim_bosrights, 0); 1190 oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0003, purple_bosrights, 0);
1191 oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, 0x0001, gaim_parse_genericerr, 0); 1191 oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, 0x0001, purple_parse_genericerr, 0);
1192 oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_RIGHTSINFO, gaim_parse_buddyrights, 0); 1192 oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_RIGHTSINFO, purple_parse_buddyrights, 0);
1193 oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_ONCOMING, gaim_parse_oncoming, 0); 1193 oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_ONCOMING, purple_parse_oncoming, 0);
1194 oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_OFFGOING, gaim_parse_offgoing, 0); 1194 oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_OFFGOING, purple_parse_offgoing, 0);
1195 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, 0x0001, gaim_parse_genericerr, 0); 1195 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, 0x0001, purple_parse_genericerr, 0);
1196 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERJOIN, gaim_conv_chat_join, 0); 1196 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERJOIN, purple_conv_chat_join, 0);
1197 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERLEAVE, gaim_conv_chat_leave, 0); 1197 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERLEAVE, purple_conv_chat_leave, 0);
1198 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_ROOMINFOUPDATE, gaim_conv_chat_info_update, 0); 1198 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_ROOMINFOUPDATE, purple_conv_chat_info_update, 0);
1199 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0); 1199 oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_INCOMINGMSG, purple_conv_chat_incoming_msg, 0);
1200 oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, 0x0001, gaim_parse_genericerr, 0); 1200 oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, 0x0001, purple_parse_genericerr, 0);
1201 oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, SNAC_SUBTYPE_CHATNAV_INFO, gaim_chatnav_info, 0); 1201 oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, SNAC_SUBTYPE_CHATNAV_INFO, purple_chatnav_info, 0);
1202 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ERROR, gaim_ssi_parseerr, 0); 1202 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ERROR, purple_ssi_parseerr, 0);
1203 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO, gaim_ssi_parserights, 0); 1203 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO, purple_ssi_parserights, 0);
1204 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_LIST, gaim_ssi_parselist, 0); 1204 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_LIST, purple_ssi_parselist, 0);
1205 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SRVACK, gaim_ssi_parseack, 0); 1205 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SRVACK, purple_ssi_parseack, 0);
1206 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADD, gaim_ssi_parseadd, 0); 1206 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADD, purple_ssi_parseadd, 0);
1207 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTH, gaim_ssi_authgiven, 0); 1207 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTH, purple_ssi_authgiven, 0);
1208 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ, gaim_ssi_authrequest, 0); 1208 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ, purple_ssi_authrequest, 0);
1209 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP, gaim_ssi_authreply, 0); 1209 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP, purple_ssi_authreply, 0);
1210 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADDED, gaim_ssi_gotadded, 0); 1210 oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADDED, purple_ssi_gotadded, 0);
1211 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, 0x0005, gaim_icbm_param_info, 0); 1211 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, 0x0005, purple_icbm_param_info, 0);
1212 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_INCOMING, gaim_parse_incoming_im, 0); 1212 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_INCOMING, purple_parse_incoming_im, 0);
1213 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MISSEDCALL, gaim_parse_misses, 0); 1213 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MISSEDCALL, purple_parse_misses, 0);
1214 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_CLIENTAUTORESP, gaim_parse_clientauto, 0); 1214 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_CLIENTAUTORESP, purple_parse_clientauto, 0);
1215 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ERROR, gaim_parse_msgerr, 0); 1215 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ERROR, purple_parse_msgerr, 0);
1216 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MTN, gaim_parse_mtn, 0); 1216 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MTN, purple_parse_mtn, 0);
1217 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ACK, gaim_parse_msgack, 0); 1217 oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ACK, purple_parse_msgack, 0);
1218 oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); 1218 oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG, purple_offlinemsg, 0);
1219 oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); 1219 oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE, purple_offlinemsgdone, 0);
1220 oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS, gaim_icqalias, 0); 1220 oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS, purple_icqalias, 0);
1221 oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO, gaim_icqinfo, 0); 1221 oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO, purple_icqinfo, 0);
1222 oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_RIGHTSINFO, gaim_parse_locaterights, 0); 1222 oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_RIGHTSINFO, purple_parse_locaterights, 0);
1223 oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_USERINFO, gaim_parse_userinfo, 0); 1223 oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_USERINFO, purple_parse_userinfo, 0);
1224 oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_ERROR, gaim_parse_locerr, 0); 1224 oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_ERROR, purple_parse_locerr, 0);
1225 oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_GOTINFOBLOCK, gaim_got_infoblock, 0); 1225 oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_GOTINFOBLOCK, purple_got_infoblock, 0);
1226 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0001, gaim_parse_genericerr, 0); 1226 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0001, purple_parse_genericerr, 0);
1227 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x000f, gaim_selfinfo, 0); 1227 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x000f, purple_selfinfo, 0);
1228 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x001f, gaim_memrequest, 0); 1228 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x001f, purple_memrequest, 0);
1229 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0021, oscar_icon_req,0); 1229 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0021, oscar_icon_req,0);
1230 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_RATECHANGE, gaim_parse_ratechange, 0); 1230 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_RATECHANGE, purple_parse_ratechange, 0);
1231 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_REDIRECT, gaim_handle_redirect, 0); 1231 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_REDIRECT, purple_handle_redirect, 0);
1232 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_MOTD, gaim_parse_motd, 0); 1232 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_MOTD, purple_parse_motd, 0);
1233 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_EVIL, gaim_parse_evilnotify, 0); 1233 oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_EVIL, purple_parse_evilnotify, 0);
1234 oscar_data_addhandler(od, SNAC_FAMILY_POPUP, 0x0002, gaim_popup, 0); 1234 oscar_data_addhandler(od, SNAC_FAMILY_POPUP, 0x0002, purple_popup, 0);
1235 oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, SNAC_SUBTYPE_USERLOOKUP_ERROR, gaim_parse_searcherror, 0); 1235 oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, SNAC_SUBTYPE_USERLOOKUP_ERROR, purple_parse_searcherror, 0);
1236 oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, gaim_parse_searchreply, 0); 1236 oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, purple_parse_searchreply, 0);
1237 1237
1238 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc); 1238 purple_debug_misc("oscar", "oscar_login: gc = %p\n", gc);
1239 1239
1240 if (!aim_snvalid(gaim_account_get_username(account))) { 1240 if (!aim_snvalid(purple_account_get_username(account))) {
1241 gchar *buf; 1241 gchar *buf;
1242 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), gaim_account_get_username(account)); 1242 buf = g_strdup_printf(_("Unable to login: Could not sign on as %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account));
1243 gc->wants_to_die = TRUE; 1243 gc->wants_to_die = TRUE;
1244 gaim_connection_error(gc, buf); 1244 purple_connection_error(gc, buf);
1245 g_free(buf); 1245 g_free(buf);
1246 } 1246 }
1247 1247
1248 if (aim_sn_is_icq((gaim_account_get_username(account)))) { 1248 if (aim_sn_is_icq((purple_account_get_username(account)))) {
1249 od->icq = TRUE; 1249 od->icq = TRUE;
1250 } else { 1250 } else {
1251 gc->flags |= GAIM_CONNECTION_HTML; 1251 gc->flags |= PURPLE_CONNECTION_HTML;
1252 gc->flags |= GAIM_CONNECTION_AUTO_RESP; 1252 gc->flags |= PURPLE_CONNECTION_AUTO_RESP;
1253 } 1253 }
1254 1254
1255 /* Connect to core Gaim signals */ 1255 /* Connect to core Purple signals */
1256 gaim_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_cb, gc); 1256 purple_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_cb, gc);
1257 1257
1258 newconn = flap_connection_new(od, SNAC_FAMILY_AUTH); 1258 newconn = flap_connection_new(od, SNAC_FAMILY_AUTH);
1259 newconn->connect_data = gaim_proxy_connect(NULL, account, 1259 newconn->connect_data = purple_proxy_connect(NULL, account,
1260 gaim_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER), 1260 purple_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER),
1261 gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), 1261 purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT),
1262 connection_established_cb, newconn); 1262 connection_established_cb, newconn);
1263 if (newconn->connect_data == NULL) 1263 if (newconn->connect_data == NULL)
1264 { 1264 {
1265 gaim_connection_error(gc, _("Couldn't connect to host")); 1265 purple_connection_error(gc, _("Couldn't connect to host"));
1266 return; 1266 return;
1267 } 1267 }
1268 1268
1269 gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); 1269 purple_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS);
1270 ck[0] = 0x5a; 1270 ck[0] = 0x5a;
1271 } 1271 }
1272 1272
1273 void 1273 void
1274 oscar_close(GaimConnection *gc) 1274 oscar_close(PurpleConnection *gc)
1275 { 1275 {
1276 OscarData *od; 1276 OscarData *od;
1277 1277
1278 od = (OscarData *)gc->proto_data; 1278 od = (OscarData *)gc->proto_data;
1279 1279
1291 g_free(cr); 1291 g_free(cr);
1292 } 1292 }
1293 oscar_data_destroy(od); 1293 oscar_data_destroy(od);
1294 gc->proto_data = NULL; 1294 gc->proto_data = NULL;
1295 1295
1296 gaim_prefs_disconnect_by_handle(gc); 1296 purple_prefs_disconnect_by_handle(gc);
1297 1297
1298 gaim_debug_info("oscar", "Signed off.\n"); 1298 purple_debug_info("oscar", "Signed off.\n");
1299 } 1299 }
1300 1300
1301 static int 1301 static int
1302 gaim_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 1302 purple_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
1303 { 1303 {
1304 GaimConnection *gc = od->gc; 1304 PurpleConnection *gc = od->gc;
1305 GaimAccount *account = gc->account; 1305 PurpleAccount *account = gc->account;
1306 char *host; int port; 1306 char *host; int port;
1307 int i; 1307 int i;
1308 FlapConnection *newconn; 1308 FlapConnection *newconn;
1309 va_list ap; 1309 va_list ap;
1310 struct aim_authresp_info *info; 1310 struct aim_authresp_info *info;
1311 1311
1312 port = gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); 1312 port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT);
1313 1313
1314 va_start(ap, fr); 1314 va_start(ap, fr);
1315 info = va_arg(ap, struct aim_authresp_info *); 1315 info = va_arg(ap, struct aim_authresp_info *);
1316 va_end(ap); 1316 va_end(ap);
1317 1317
1318 gaim_debug_info("oscar", 1318 purple_debug_info("oscar",
1319 "inside auth_resp (Screen name: %s)\n", info->sn); 1319 "inside auth_resp (Screen name: %s)\n", info->sn);
1320 1320
1321 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { 1321 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) {
1322 char buf[256]; 1322 char buf[256];
1323 switch (info->errorcode) { 1323 switch (info->errorcode) {
1324 case 0x01: 1324 case 0x01:
1325 /* Unregistered screen name */ 1325 /* Unregistered screen name */
1326 gc->wants_to_die = TRUE; 1326 gc->wants_to_die = TRUE;
1327 gaim_connection_error(gc, _("Invalid screen name.")); 1327 purple_connection_error(gc, _("Invalid screen name."));
1328 break; 1328 break;
1329 case 0x05: 1329 case 0x05:
1330 /* Incorrect password */ 1330 /* Incorrect password */
1331 gc->wants_to_die = TRUE; 1331 gc->wants_to_die = TRUE;
1332 if (!gaim_account_get_remember_password(account)) 1332 if (!purple_account_get_remember_password(account))
1333 gaim_account_set_password(account, NULL); 1333 purple_account_set_password(account, NULL);
1334 gaim_connection_error(gc, _("Incorrect password.")); 1334 purple_connection_error(gc, _("Incorrect password."));
1335 break; 1335 break;
1336 case 0x11: 1336 case 0x11:
1337 /* Suspended account */ 1337 /* Suspended account */
1338 gc->wants_to_die = TRUE; 1338 gc->wants_to_die = TRUE;
1339 gaim_connection_error(gc, _("Your account is currently suspended.")); 1339 purple_connection_error(gc, _("Your account is currently suspended."));
1340 break; 1340 break;
1341 case 0x14: 1341 case 0x14:
1342 /* service temporarily unavailable */ 1342 /* service temporarily unavailable */
1343 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); 1343 purple_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable."));
1344 break; 1344 break;
1345 case 0x18: 1345 case 0x18:
1346 /* connecting too frequently */ 1346 /* connecting too frequently */
1347 gc->wants_to_die = TRUE; 1347 gc->wants_to_die = TRUE;
1348 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.")); 1348 purple_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."));
1349 break; 1349 break;
1350 case 0x1c: 1350 case 0x1c:
1351 /* client too old */ 1351 /* client too old */
1352 gc->wants_to_die = TRUE; 1352 gc->wants_to_die = TRUE;
1353 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), GAIM_WEBSITE); 1353 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), PURPLE_WEBSITE);
1354 gaim_connection_error(gc, buf); 1354 purple_connection_error(gc, buf);
1355 break; 1355 break;
1356 default: 1356 default:
1357 gaim_connection_error(gc, _("Authentication failed")); 1357 purple_connection_error(gc, _("Authentication failed"));
1358 break; 1358 break;
1359 } 1359 }
1360 gaim_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); 1360 purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode);
1361 gaim_debug_info("oscar", "Error URL: %s\n", info->errorurl); 1361 purple_debug_info("oscar", "Error URL: %s\n", info->errorurl);
1362 od->killme = TRUE; 1362 od->killme = TRUE;
1363 return 1; 1363 return 1;
1364 } 1364 }
1365 1365
1366 gaim_debug_misc("oscar", "Reg status: %hu\n", info->regstatus); 1366 purple_debug_misc("oscar", "Reg status: %hu\n", info->regstatus);
1367 gaim_debug_misc("oscar", "E-mail: %s\n", 1367 purple_debug_misc("oscar", "E-mail: %s\n",
1368 (info->email != NULL) ? info->email : "null"); 1368 (info->email != NULL) ? info->email : "null");
1369 gaim_debug_misc("oscar", "BOSIP: %s\n", info->bosip); 1369 purple_debug_misc("oscar", "BOSIP: %s\n", info->bosip);
1370 gaim_debug_info("oscar", "Closing auth connection...\n"); 1370 purple_debug_info("oscar", "Closing auth connection...\n");
1371 flap_connection_schedule_destroy(conn, OSCAR_DISCONNECT_DONE, NULL); 1371 flap_connection_schedule_destroy(conn, OSCAR_DISCONNECT_DONE, NULL);
1372 1372
1373 for (i = 0; i < strlen(info->bosip); i++) { 1373 for (i = 0; i < strlen(info->bosip); i++) {
1374 if (info->bosip[i] == ':') { 1374 if (info->bosip[i] == ':') {
1375 port = atoi(&(info->bosip[i+1])); 1375 port = atoi(&(info->bosip[i+1]));
1378 } 1378 }
1379 host = g_strndup(info->bosip, i); 1379 host = g_strndup(info->bosip, i);
1380 newconn = flap_connection_new(od, SNAC_FAMILY_LOCATE); 1380 newconn = flap_connection_new(od, SNAC_FAMILY_LOCATE);
1381 newconn->cookielen = info->cookielen; 1381 newconn->cookielen = info->cookielen;
1382 newconn->cookie = g_memdup(info->cookie, info->cookielen); 1382 newconn->cookie = g_memdup(info->cookie, info->cookielen);
1383 newconn->connect_data = gaim_proxy_connect(NULL, account, host, port, 1383 newconn->connect_data = purple_proxy_connect(NULL, account, host, port,
1384 connection_established_cb, newconn); 1384 connection_established_cb, newconn);
1385 g_free(host); 1385 g_free(host);
1386 if (newconn->connect_data == NULL) 1386 if (newconn->connect_data == NULL)
1387 { 1387 {
1388 gaim_connection_error(gc, _("Could Not Connect")); 1388 purple_connection_error(gc, _("Could Not Connect"));
1389 od->killme = TRUE; 1389 od->killme = TRUE;
1390 return 0; 1390 return 0;
1391 } 1391 }
1392 1392
1393 gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); 1393 purple_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS);
1394 ck[3] = 0x64; 1394 ck[3] = 0x64;
1395 1395
1396 return 1; 1396 return 1;
1397 } 1397 }
1398 1398
1399 static void 1399 static void
1400 gaim_parse_auth_securid_request_yes_cb(gpointer user_data, const char *msg) 1400 purple_parse_auth_securid_request_yes_cb(gpointer user_data, const char *msg)
1401 { 1401 {
1402 GaimConnection *gc = user_data; 1402 PurpleConnection *gc = user_data;
1403 OscarData *od = gc->proto_data; 1403 OscarData *od = gc->proto_data;
1404 1404
1405 aim_auth_securid_send(od, msg); 1405 aim_auth_securid_send(od, msg);
1406 } 1406 }
1407 1407
1408 static void 1408 static void
1409 gaim_parse_auth_securid_request_no_cb(gpointer user_data, const char *value) 1409 purple_parse_auth_securid_request_no_cb(gpointer user_data, const char *value)
1410 { 1410 {
1411 GaimConnection *gc = user_data; 1411 PurpleConnection *gc = user_data;
1412 OscarData *od = gc->proto_data; 1412 OscarData *od = gc->proto_data;
1413 1413
1414 /* Disconnect */ 1414 /* Disconnect */
1415 gc->wants_to_die = TRUE; 1415 gc->wants_to_die = TRUE;
1416 gaim_connection_error(gc, _("The SecurID key entered is invalid.")); 1416 purple_connection_error(gc, _("The SecurID key entered is invalid."));
1417 od->killme = TRUE; 1417 od->killme = TRUE;
1418 } 1418 }
1419 1419
1420 static int 1420 static int
1421 gaim_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 1421 purple_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
1422 { 1422 {
1423 GaimConnection *gc = od->gc; 1423 PurpleConnection *gc = od->gc;
1424 GaimAccount *account = gaim_connection_get_account(gc); 1424 PurpleAccount *account = purple_connection_get_account(gc);
1425 gchar *primary; 1425 gchar *primary;
1426 1426
1427 gaim_debug_info("oscar", "Got SecurID request\n"); 1427 purple_debug_info("oscar", "Got SecurID request\n");
1428 1428
1429 primary = g_strdup_printf("Enter the SecurID key for %s.", gaim_account_get_username(account)); 1429 primary = g_strdup_printf("Enter the SecurID key for %s.", purple_account_get_username(account));
1430 gaim_request_input(gc, NULL, _("Enter SecurID"), primary, 1430 purple_request_input(gc, NULL, _("Enter SecurID"), primary,
1431 _("Enter the 6 digit number from the digital display."), 1431 _("Enter the 6 digit number from the digital display."),
1432 FALSE, FALSE, NULL, 1432 FALSE, FALSE, NULL,
1433 _("_OK"), G_CALLBACK(gaim_parse_auth_securid_request_yes_cb), 1433 _("_OK"), G_CALLBACK(purple_parse_auth_securid_request_yes_cb),
1434 _("_Cancel"), G_CALLBACK(gaim_parse_auth_securid_request_no_cb), 1434 _("_Cancel"), G_CALLBACK(purple_parse_auth_securid_request_no_cb),
1435 gc); 1435 gc);
1436 g_free(primary); 1436 g_free(primary);
1437 1437
1438 return 1; 1438 return 1;
1439 } 1439 }
1440 1440
1441 /* XXX - Should use gaim_util_fetch_url for the below stuff */ 1441 /* XXX - Should use purple_util_fetch_url for the below stuff */
1442 struct pieceofcrap { 1442 struct pieceofcrap {
1443 GaimConnection *gc; 1443 PurpleConnection *gc;
1444 unsigned long offset; 1444 unsigned long offset;
1445 unsigned long len; 1445 unsigned long len;
1446 char *modname; 1446 char *modname;
1447 int fd; 1447 int fd;
1448 FlapConnection *conn; 1448 FlapConnection *conn;
1449 unsigned int inpa; 1449 unsigned int inpa;
1450 }; 1450 };
1451 1451
1452 static void damn_you(gpointer data, gint source, GaimInputCondition c) 1452 static void damn_you(gpointer data, gint source, PurpleInputCondition c)
1453 { 1453 {
1454 struct pieceofcrap *pos = data; 1454 struct pieceofcrap *pos = data;
1455 OscarData *od = pos->gc->proto_data; 1455 OscarData *od = pos->gc->proto_data;
1456 char in = '\0'; 1456 char in = '\0';
1457 int x = 0; 1457 int x = 0;
1467 in = '\0'; 1467 in = '\0';
1468 } 1468 }
1469 if (in != '\n') { 1469 if (in != '\n') {
1470 char buf[256]; 1470 char buf[256];
1471 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " 1471 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until "
1472 "this is fixed. Check %s for updates."), GAIM_WEBSITE); 1472 "this is fixed. Check %s for updates."), PURPLE_WEBSITE);
1473 gaim_notify_warning(pos->gc, NULL, 1473 purple_notify_warning(pos->gc, NULL,
1474 _("Unable to get a valid AIM login hash."), 1474 _("Unable to get a valid AIM login hash."),
1475 buf); 1475 buf);
1476 gaim_input_remove(pos->inpa); 1476 purple_input_remove(pos->inpa);
1477 close(pos->fd); 1477 close(pos->fd);
1478 g_free(pos); 1478 g_free(pos);
1479 return; 1479 return;
1480 } 1480 }
1481 if (read(pos->fd, m, 16) != 16) 1481 if (read(pos->fd, m, 16) != 16)
1482 { 1482 {
1483 gaim_debug_warning("oscar", "Could not read full AIM login hash " 1483 purple_debug_warning("oscar", "Could not read full AIM login hash "
1484 "from " AIMHASHDATA "--that's bad.\n"); 1484 "from " AIMHASHDATA "--that's bad.\n");
1485 } 1485 }
1486 m[16] = '\0'; 1486 m[16] = '\0';
1487 gaim_debug_misc("oscar", "Sending hash: "); 1487 purple_debug_misc("oscar", "Sending hash: ");
1488 for (x = 0; x < 16; x++) 1488 for (x = 0; x < 16; x++)
1489 gaim_debug_misc(NULL, "%02hhx ", (unsigned char)m[x]); 1489 purple_debug_misc(NULL, "%02hhx ", (unsigned char)m[x]);
1490 1490
1491 gaim_debug_misc(NULL, "\n"); 1491 purple_debug_misc(NULL, "\n");
1492 gaim_input_remove(pos->inpa); 1492 purple_input_remove(pos->inpa);
1493 close(pos->fd); 1493 close(pos->fd);
1494 aim_sendmemblock(od, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); 1494 aim_sendmemblock(od, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
1495 g_free(pos); 1495 g_free(pos);
1496 } 1496 }
1497 1497
1499 straight_to_hell(gpointer data, gint source, const gchar *error_message) 1499 straight_to_hell(gpointer data, gint source, const gchar *error_message)
1500 { 1500 {
1501 struct pieceofcrap *pos = data; 1501 struct pieceofcrap *pos = data;
1502 gchar *buf; 1502 gchar *buf;
1503 1503
1504 if (!GAIM_CONNECTION_IS_VALID(pos->gc)) 1504 if (!PURPLE_CONNECTION_IS_VALID(pos->gc))
1505 { 1505 {
1506 g_free(pos->modname); 1506 g_free(pos->modname);
1507 g_free(pos); 1507 g_free(pos);
1508 return; 1508 return;
1509 } 1509 }
1510 1510
1511 pos->fd = source; 1511 pos->fd = source;
1512 1512
1513 if (source < 0) { 1513 if (source < 0) {
1514 buf = g_strdup_printf(_("You may be disconnected shortly. You may want to use TOC until " 1514 buf = g_strdup_printf(_("You may be disconnected shortly. You may want to use TOC until "
1515 "this is fixed. Check %s for updates."), GAIM_WEBSITE); 1515 "this is fixed. Check %s for updates."), PURPLE_WEBSITE);
1516 gaim_notify_warning(pos->gc, NULL, 1516 purple_notify_warning(pos->gc, NULL,
1517 _("Unable to get a valid AIM login hash."), 1517 _("Unable to get a valid AIM login hash."),
1518 buf); 1518 buf);
1519 g_free(buf); 1519 g_free(buf);
1520 g_free(pos->modname); 1520 g_free(pos->modname);
1521 g_free(pos); 1521 g_free(pos);
1525 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", 1525 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n",
1526 pos->offset, pos->len, pos->modname ? pos->modname : ""); 1526 pos->offset, pos->len, pos->modname ? pos->modname : "");
1527 write(pos->fd, buf, strlen(buf)); 1527 write(pos->fd, buf, strlen(buf));
1528 g_free(buf); 1528 g_free(buf);
1529 g_free(pos->modname); 1529 g_free(pos->modname);
1530 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); 1530 pos->inpa = purple_input_add(pos->fd, PURPLE_INPUT_READ, damn_you, pos);
1531 return; 1531 return;
1532 } 1532 }
1533 1533
1534 /* size of icbmui.ocm, the largest module in AIM 3.5 */ 1534 /* size of icbmui.ocm, the largest module in AIM 3.5 */
1535 #define AIM_MAX_FILE_SIZE 98304 1535 #define AIM_MAX_FILE_SIZE 98304
1536 1536
1537 int gaim_memrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 1537 int purple_memrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
1538 va_list ap; 1538 va_list ap;
1539 struct pieceofcrap *pos; 1539 struct pieceofcrap *pos;
1540 guint32 offset, len; 1540 guint32 offset, len;
1541 char *modname; 1541 char *modname;
1542 1542
1544 offset = va_arg(ap, guint32); 1544 offset = va_arg(ap, guint32);
1545 len = va_arg(ap, guint32); 1545 len = va_arg(ap, guint32);
1546 modname = va_arg(ap, char *); 1546 modname = va_arg(ap, char *);
1547 va_end(ap); 1547 va_end(ap);
1548 1548
1549 gaim_debug_misc("oscar", "offset: %u, len: %u, file: %s\n", 1549 purple_debug_misc("oscar", "offset: %u, len: %u, file: %s\n",
1550 offset, len, (modname ? modname : "aim.exe")); 1550 offset, len, (modname ? modname : "aim.exe"));
1551 1551
1552 if (len == 0) { 1552 if (len == 0) {
1553 gaim_debug_misc("oscar", "len is 0, hashing NULL\n"); 1553 purple_debug_misc("oscar", "len is 0, hashing NULL\n");
1554 aim_sendmemblock(od, conn, offset, len, NULL, 1554 aim_sendmemblock(od, conn, offset, len, NULL,
1555 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); 1555 AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
1556 return 1; 1556 return 1;
1557 } 1557 }
1558 /* uncomment this when you're convinced it's right. remember, it's been wrong before. */ 1558 /* uncomment this when you're convinced it's right. remember, it's been wrong before. */
1574 buf[i++] = (offset >> 24) & 0xff; 1574 buf[i++] = (offset >> 24) & 0xff;
1575 buf[i++] = len & 0xff; 1575 buf[i++] = len & 0xff;
1576 buf[i++] = (len >> 8) & 0xff; 1576 buf[i++] = (len >> 8) & 0xff;
1577 buf[i++] = (len >> 16) & 0xff; 1577 buf[i++] = (len >> 16) & 0xff;
1578 buf[i++] = (len >> 24) & 0xff; 1578 buf[i++] = (len >> 24) & 0xff;
1579 gaim_debug_misc("oscar", "len + offset is invalid, " 1579 purple_debug_misc("oscar", "len + offset is invalid, "
1580 "hashing request\n"); 1580 "hashing request\n");
1581 aim_sendmemblock(od, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); 1581 aim_sendmemblock(od, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
1582 g_free(buf); 1582 g_free(buf);
1583 return 1; 1583 return 1;
1584 } 1584 }
1591 pos->offset = offset; 1591 pos->offset = offset;
1592 pos->len = len; 1592 pos->len = len;
1593 pos->modname = g_strdup(modname); 1593 pos->modname = g_strdup(modname);
1594 1594
1595 /* TODO: Keep track of this return value. */ 1595 /* TODO: Keep track of this return value. */
1596 if (gaim_proxy_connect(NULL, pos->gc->account, "gaim.sourceforge.net", 80, 1596 if (purple_proxy_connect(NULL, pos->gc->account, "purple.sourceforge.net", 80,
1597 straight_to_hell, pos) == NULL) 1597 straight_to_hell, pos) == NULL)
1598 { 1598 {
1599 char buf[256]; 1599 char buf[256];
1600 if (pos->modname) 1600 if (pos->modname)
1601 g_free(pos->modname); 1601 g_free(pos->modname);
1602 g_free(pos); 1602 g_free(pos);
1603 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. " 1603 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. "
1604 "Check %s for updates."), GAIM_WEBSITE); 1604 "Check %s for updates."), PURPLE_WEBSITE);
1605 gaim_notify_warning(pos->gc, NULL, 1605 purple_notify_warning(pos->gc, NULL,
1606 _("Unable to get a valid login hash."), 1606 _("Unable to get a valid login hash."),
1607 buf); 1607 buf);
1608 } 1608 }
1609 1609
1610 return 1; 1610 return 1;
1611 } 1611 }
1612 1612
1613 static int 1613 static int
1614 gaim_parse_login(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 1614 purple_parse_login(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
1615 { 1615 {
1616 GaimConnection *gc; 1616 PurpleConnection *gc;
1617 GaimAccount *account; 1617 PurpleAccount *account;
1618 ClientInfo info = CLIENTINFO_GAIM; 1618 ClientInfo info = CLIENTINFO_PURPLE;
1619 va_list ap; 1619 va_list ap;
1620 char *key; 1620 char *key;
1621 1621
1622 gc = od->gc; 1622 gc = od->gc;
1623 account = gaim_connection_get_account(gc); 1623 account = purple_connection_get_account(gc);
1624 1624
1625 va_start(ap, fr); 1625 va_start(ap, fr);
1626 key = va_arg(ap, char *); 1626 key = va_arg(ap, char *);
1627 va_end(ap); 1627 va_end(ap);
1628 1628
1629 aim_send_login(od, conn, gaim_account_get_username(account), 1629 aim_send_login(od, conn, purple_account_get_username(account),
1630 gaim_connection_get_password(gc), &info, key); 1630 purple_connection_get_password(gc), &info, key);
1631 1631
1632 gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); 1632 purple_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS);
1633 ck[2] = 0x6c; 1633 ck[2] = 0x6c;
1634 1634
1635 return 1; 1635 return 1;
1636 } 1636 }
1637 1637
1638 static int 1638 static int
1639 gaim_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 1639 purple_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
1640 { 1640 {
1641 GaimConnection *gc = od->gc; 1641 PurpleConnection *gc = od->gc;
1642 GaimAccount *account = gaim_connection_get_account(gc); 1642 PurpleAccount *account = purple_connection_get_account(gc);
1643 char *host, *separator; 1643 char *host, *separator;
1644 int port; 1644 int port;
1645 FlapConnection *newconn; 1645 FlapConnection *newconn;
1646 va_list ap; 1646 va_list ap;
1647 struct aim_redirect_data *redir; 1647 struct aim_redirect_data *redir;
1648 1648
1649 va_start(ap, fr); 1649 va_start(ap, fr);
1650 redir = va_arg(ap, struct aim_redirect_data *); 1650 redir = va_arg(ap, struct aim_redirect_data *);
1651 va_end(ap); 1651 va_end(ap);
1652 1652
1653 port = gaim_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); 1653 port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT);
1654 separator = strchr(redir->ip, ':'); 1654 separator = strchr(redir->ip, ':');
1655 if (separator != NULL) 1655 if (separator != NULL)
1656 { 1656 {
1657 host = g_strndup(redir->ip, separator - redir->ip); 1657 host = g_strndup(redir->ip, separator - redir->ip);
1658 port = atoi(separator + 1); 1658 port = atoi(separator + 1);
1659 } 1659 }
1660 else 1660 else
1661 host = g_strdup(redir->ip); 1661 host = g_strdup(redir->ip);
1662 1662
1663 gaim_debug_info("oscar", "Connecting to FLAP server %s:%d of type 0x%04hx\n", 1663 purple_debug_info("oscar", "Connecting to FLAP server %s:%d of type 0x%04hx\n",
1664 host, port, redir->group); 1664 host, port, redir->group);
1665 newconn = flap_connection_new(od, redir->group); 1665 newconn = flap_connection_new(od, redir->group);
1666 newconn->cookielen = redir->cookielen; 1666 newconn->cookielen = redir->cookielen;
1667 newconn->cookie = g_memdup(redir->cookie, redir->cookielen); 1667 newconn->cookie = g_memdup(redir->cookie, redir->cookielen);
1668 if (newconn->type == SNAC_FAMILY_CHAT) 1668 if (newconn->type == SNAC_FAMILY_CHAT)
1674 cc->name = g_strdup(redir->chat.room); 1674 cc->name = g_strdup(redir->chat.room);
1675 cc->exchange = redir->chat.exchange; 1675 cc->exchange = redir->chat.exchange;
1676 cc->instance = redir->chat.instance; 1676 cc->instance = redir->chat.instance;
1677 cc->show = extract_name(redir->chat.room); 1677 cc->show = extract_name(redir->chat.room);
1678 newconn->new_conn_data = cc; 1678 newconn->new_conn_data = cc;
1679 gaim_debug_info("oscar", "Connecting to chat room %s exchange %hu\n", cc->name, cc->exchange); 1679 purple_debug_info("oscar", "Connecting to chat room %s exchange %hu\n", cc->name, cc->exchange);
1680 } 1680 }
1681 1681
1682 newconn->connect_data = gaim_proxy_connect(NULL, account, host, port, 1682 newconn->connect_data = purple_proxy_connect(NULL, account, host, port,
1683 connection_established_cb, newconn); 1683 connection_established_cb, newconn);
1684 if (newconn->connect_data == NULL) 1684 if (newconn->connect_data == NULL)
1685 { 1685 {
1686 flap_connection_schedule_destroy(newconn, 1686 flap_connection_schedule_destroy(newconn,
1687 OSCAR_DISCONNECT_COULD_NOT_CONNECT, 1687 OSCAR_DISCONNECT_COULD_NOT_CONNECT,
1688 _("Unable to initialize connection")); 1688 _("Unable to initialize connection"));
1689 gaim_debug_error("oscar", "Unable to connect to FLAP server " 1689 purple_debug_error("oscar", "Unable to connect to FLAP server "
1690 "of type 0x%04hx\n", redir->group); 1690 "of type 0x%04hx\n", redir->group);
1691 } 1691 }
1692 g_free(host); 1692 g_free(host);
1693 1693
1694 return 1; 1694 return 1;
1695 } 1695 }
1696 1696
1697 static int gaim_parse_oncoming(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 1697 static int purple_parse_oncoming(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
1698 { 1698 {
1699 GaimConnection *gc; 1699 PurpleConnection *gc;
1700 GaimAccount *account; 1700 PurpleAccount *account;
1701 GaimPresence *presence; 1701 PurplePresence *presence;
1702 struct buddyinfo *bi; 1702 struct buddyinfo *bi;
1703 time_t time_idle = 0, signon = 0; 1703 time_t time_idle = 0, signon = 0;
1704 int type = 0; 1704 int type = 0;
1705 gboolean buddy_is_away = FALSE; 1705 gboolean buddy_is_away = FALSE;
1706 const char *status_id; 1706 const char *status_id;
1708 char *message = NULL; 1708 char *message = NULL;
1709 va_list ap; 1709 va_list ap;
1710 aim_userinfo_t *info; 1710 aim_userinfo_t *info;
1711 1711
1712 gc = od->gc; 1712 gc = od->gc;
1713 account = gaim_connection_get_account(gc); 1713 account = purple_connection_get_account(gc);
1714 presence = gaim_account_get_presence(account); 1714 presence = purple_account_get_presence(account);
1715 1715
1716 va_start(ap, fr); 1716 va_start(ap, fr);
1717 info = va_arg(ap, aim_userinfo_t *); 1717 info = va_arg(ap, aim_userinfo_t *);
1718 va_end(ap); 1718 va_end(ap);
1719 1719
1769 info->status, info->status_len); 1769 info->status, info->status_len);
1770 } 1770 }
1771 1771
1772 if (info->flags & AIM_FLAG_WIRELESS || info->capabilities & OSCAR_CAPABILITY_HIPTOP) 1772 if (info->flags & AIM_FLAG_WIRELESS || info->capabilities & OSCAR_CAPABILITY_HIPTOP)
1773 { 1773 {
1774 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_MOBILE, NULL); 1774 purple_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_MOBILE, NULL);
1775 } else { 1775 } else {
1776 gaim_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE); 1776 purple_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
1777 } 1777 }
1778 1778
1779 if (have_status_message) 1779 if (have_status_message)
1780 { 1780 {
1781 gaim_prpl_got_user_status(account, info->sn, status_id, 1781 purple_prpl_got_user_status(account, info->sn, status_id,
1782 "message", message, NULL); 1782 "message", message, NULL);
1783 g_free(message); 1783 g_free(message);
1784 } 1784 }
1785 else 1785 else
1786 { 1786 {
1787 GaimBuddy *b = gaim_find_buddy(account, info->sn); 1787 PurpleBuddy *b = purple_find_buddy(account, info->sn);
1788 GaimStatus *status; 1788 PurpleStatus *status;
1789 const char *active_status_id; 1789 const char *active_status_id;
1790 1790
1791 status = gaim_presence_get_active_status(gaim_buddy_get_presence(b)); 1791 status = purple_presence_get_active_status(purple_buddy_get_presence(b));
1792 active_status_id = gaim_status_get_id(status); 1792 active_status_id = purple_status_get_id(status);
1793 1793
1794 if (!active_status_id || strcmp(active_status_id, status_id)) 1794 if (!active_status_id || strcmp(active_status_id, status_id))
1795 gaim_prpl_got_user_status(account, info->sn, status_id, NULL); 1795 purple_prpl_got_user_status(account, info->sn, status_id, NULL);
1796 } 1796 }
1797 1797
1798 /* Login time stuff */ 1798 /* Login time stuff */
1799 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) 1799 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE)
1800 signon = info->onlinesince; 1800 signon = info->onlinesince;
1801 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) 1801 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
1802 signon = time(NULL) - info->sessionlen; 1802 signon = time(NULL) - info->sessionlen;
1803 if (!aim_sncmp(gaim_account_get_username(account), info->sn)) { 1803 if (!aim_sncmp(purple_account_get_username(account), info->sn)) {
1804 gaim_connection_set_display_name(gc, info->sn); 1804 purple_connection_set_display_name(gc, info->sn);
1805 od->timeoffset = signon - gaim_presence_get_login_time(presence); 1805 od->timeoffset = signon - purple_presence_get_login_time(presence);
1806 } 1806 }
1807 gaim_prpl_got_user_login_time(account, info->sn, signon - od->timeoffset); 1807 purple_prpl_got_user_login_time(account, info->sn, signon - od->timeoffset);
1808 1808
1809 /* Idle time stuff */ 1809 /* Idle time stuff */
1810 /* info->idletime is the number of minutes that this user has been idle */ 1810 /* info->idletime is the number of minutes that this user has been idle */
1811 if (info->present & AIM_USERINFO_PRESENT_IDLE) 1811 if (info->present & AIM_USERINFO_PRESENT_IDLE)
1812 time_idle = time(NULL) - info->idletime * 60; 1812 time_idle = time(NULL) - info->idletime * 60;
1813 1813
1814 if (time_idle > 0) 1814 if (time_idle > 0)
1815 gaim_prpl_got_user_idle(account, info->sn, TRUE, time_idle); 1815 purple_prpl_got_user_idle(account, info->sn, TRUE, time_idle);
1816 else 1816 else
1817 gaim_prpl_got_user_idle(account, info->sn, FALSE, 0); 1817 purple_prpl_got_user_idle(account, info->sn, FALSE, 0);
1818 1818
1819 /* Server stored icon stuff */ 1819 /* Server stored icon stuff */
1820 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, info->sn)); 1820 bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, info->sn));
1821 if (!bi) { 1821 if (!bi) {
1822 bi = g_new0(struct buddyinfo, 1); 1822 bi = g_new0(struct buddyinfo, 1);
1823 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, info->sn)), bi); 1823 g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, info->sn)), bi);
1824 } 1824 }
1825 bi->typingnot = FALSE; 1825 bi->typingnot = FALSE;
1826 bi->ico_informed = FALSE; 1826 bi->ico_informed = FALSE;
1827 bi->ipaddr = info->icqinfo.ipaddr; 1827 bi->ipaddr = info->icqinfo.ipaddr;
1828 1828
1829 if (info->iconcsumlen) { 1829 if (info->iconcsumlen) {
1830 const char *filename, *saved_b16 = NULL; 1830 const char *filename, *saved_b16 = NULL;
1831 char *b16 = NULL, *filepath = NULL; 1831 char *b16 = NULL, *filepath = NULL;
1832 GaimBuddy *b = NULL; 1832 PurpleBuddy *b = NULL;
1833 1833
1834 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); 1834 b16 = purple_base16_encode(info->iconcsum, info->iconcsumlen);
1835 b = gaim_find_buddy(account, info->sn); 1835 b = purple_find_buddy(account, info->sn);
1836 /* 1836 /*
1837 * If for some reason the checksum is valid, but cached file is not.. 1837 * If for some reason the checksum is valid, but cached file is not..
1838 * we want to know. 1838 * we want to know.
1839 */ 1839 */
1840 if (b != NULL) 1840 if (b != NULL)
1841 filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon"); 1841 filename = purple_blist_node_get_string((PurpleBlistNode*)b, "buddy_icon");
1842 else 1842 else
1843 filename = NULL; 1843 filename = NULL;
1844 if (filename != NULL) { 1844 if (filename != NULL) {
1845 if (g_file_test(filename, G_FILE_TEST_EXISTS)) 1845 if (g_file_test(filename, G_FILE_TEST_EXISTS))
1846 saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b, 1846 saved_b16 = purple_blist_node_get_string((PurpleBlistNode*)b,
1847 "icon_checksum"); 1847 "icon_checksum");
1848 else { 1848 else {
1849 filepath = g_build_filename(gaim_buddy_icons_get_cache_dir(), 1849 filepath = g_build_filename(purple_buddy_icons_get_cache_dir(),
1850 filename, NULL); 1850 filename, NULL);
1851 if (g_file_test(filepath, G_FILE_TEST_EXISTS)) 1851 if (g_file_test(filepath, G_FILE_TEST_EXISTS))
1852 saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b, 1852 saved_b16 = purple_blist_node_get_string((PurpleBlistNode*)b,
1853 "icon_checksum"); 1853 "icon_checksum");
1854 g_free(filepath); 1854 g_free(filepath);
1855 } 1855 }
1856 } else 1856 } else
1857 saved_b16 = NULL; 1857 saved_b16 = NULL;
1859 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { 1859 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) {
1860 GSList *cur = od->requesticon; 1860 GSList *cur = od->requesticon;
1861 while (cur && aim_sncmp((char *)cur->data, info->sn)) 1861 while (cur && aim_sncmp((char *)cur->data, info->sn))
1862 cur = cur->next; 1862 cur = cur->next;
1863 if (!cur) { 1863 if (!cur) {
1864 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(account, info->sn))); 1864 od->requesticon = g_slist_append(od->requesticon, g_strdup(purple_normalize(account, info->sn)));
1865 if (od->icontimer == 0) 1865 if (od->icontimer == 0)
1866 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); 1866 od->icontimer = purple_timeout_add(500, purple_icon_timerfunc, gc);
1867 } 1867 }
1868 } 1868 }
1869 g_free(b16); 1869 g_free(b16);
1870 } 1870 }
1871 1871
1872 return 1; 1872 return 1;
1873 } 1873 }
1874 1874
1875 static void gaim_check_comment(OscarData *od, const char *str) { 1875 static void purple_check_comment(OscarData *od, const char *str) {
1876 if ((str == NULL) || strcmp(str, (const char *)ck)) 1876 if ((str == NULL) || strcmp(str, (const char *)ck))
1877 aim_locate_setcaps(od, gaim_caps); 1877 aim_locate_setcaps(od, purple_caps);
1878 else 1878 else
1879 aim_locate_setcaps(od, gaim_caps | OSCAR_CAPABILITY_SECUREIM); 1879 aim_locate_setcaps(od, purple_caps | OSCAR_CAPABILITY_SECUREIM);
1880 } 1880 }
1881 1881
1882 static int gaim_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 1882 static int purple_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
1883 GaimConnection *gc = od->gc; 1883 PurpleConnection *gc = od->gc;
1884 GaimAccount *account = gaim_connection_get_account(gc); 1884 PurpleAccount *account = purple_connection_get_account(gc);
1885 va_list ap; 1885 va_list ap;
1886 aim_userinfo_t *info; 1886 aim_userinfo_t *info;
1887 1887
1888 va_start(ap, fr); 1888 va_start(ap, fr);
1889 info = va_arg(ap, aim_userinfo_t *); 1889 info = va_arg(ap, aim_userinfo_t *);
1890 va_end(ap); 1890 va_end(ap);
1891 1891
1892 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL); 1892 purple_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL);
1893 gaim_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE); 1893 purple_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
1894 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); 1894 g_hash_table_remove(od->buddyinfo, purple_normalize(gc->account, info->sn));
1895 1895
1896 return 1; 1896 return 1;
1897 } 1897 }
1898 1898
1899 static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { 1899 static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
1900 GaimConnection *gc = od->gc; 1900 PurpleConnection *gc = od->gc;
1901 GaimAccount *account = gaim_connection_get_account(gc); 1901 PurpleAccount *account = purple_connection_get_account(gc);
1902 GaimMessageFlags flags = 0; 1902 PurpleMessageFlags flags = 0;
1903 struct buddyinfo *bi; 1903 struct buddyinfo *bi;
1904 char *iconfile; 1904 char *iconfile;
1905 GString *message; 1905 GString *message;
1906 gchar *tmp; 1906 gchar *tmp;
1907 aim_mpmsg_section_t *curpart; 1907 aim_mpmsg_section_t *curpart;
1908 const char *start, *end; 1908 const char *start, *end;
1909 GData *attribs; 1909 GData *attribs;
1910 1910
1911 gaim_debug_misc("oscar", "Received IM from %s with %d parts\n", 1911 purple_debug_misc("oscar", "Received IM from %s with %d parts\n",
1912 userinfo->sn, args->mpmsg.numparts); 1912 userinfo->sn, args->mpmsg.numparts);
1913 1913
1914 if (args->mpmsg.numparts == 0) 1914 if (args->mpmsg.numparts == 0)
1915 return 1; 1915 return 1;
1916 1916
1917 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); 1917 bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->sn));
1918 if (!bi) { 1918 if (!bi) {
1919 bi = g_new0(struct buddyinfo, 1); 1919 bi = g_new0(struct buddyinfo, 1);
1920 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, userinfo->sn)), bi); 1920 g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, userinfo->sn)), bi);
1921 } 1921 }
1922 1922
1923 if (args->icbmflags & AIM_IMFLAGS_AWAY) 1923 if (args->icbmflags & AIM_IMFLAGS_AWAY)
1924 flags |= GAIM_MESSAGE_AUTO_RESP; 1924 flags |= PURPLE_MESSAGE_AUTO_RESP;
1925 1925
1926 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) 1926 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT)
1927 bi->typingnot = TRUE; 1927 bi->typingnot = TRUE;
1928 else 1928 else
1929 bi->typingnot = FALSE; 1929 bi->typingnot = FALSE;
1930 1930
1931 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { 1931 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) {
1932 gaim_debug_misc("oscar", "%s has an icon\n", userinfo->sn); 1932 purple_debug_misc("oscar", "%s has an icon\n", userinfo->sn);
1933 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { 1933 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) {
1934 bi->ico_need = TRUE; 1934 bi->ico_need = TRUE;
1935 bi->ico_len = args->iconlen; 1935 bi->ico_len = args->iconlen;
1936 bi->ico_csum = args->iconsum; 1936 bi->ico_csum = args->iconsum;
1937 bi->ico_time = args->iconstamp; 1937 bi->ico_time = args->iconstamp;
1938 } 1938 }
1939 } 1939 }
1940 1940
1941 iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(account)); 1941 iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(account));
1942 if ((iconfile != NULL) && 1942 if ((iconfile != NULL) &&
1943 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { 1943 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) {
1944 FILE *file; 1944 FILE *file;
1945 struct stat st; 1945 struct stat st;
1946 1946
1949 file = g_fopen(iconfile, "rb"); 1949 file = g_fopen(iconfile, "rb");
1950 if (file) { 1950 if (file) {
1951 /* XXX - Use g_file_get_contents() */ 1951 /* XXX - Use g_file_get_contents() */
1952 /* g_file_get_contents(iconfile, &data, &len, NULL); */ 1952 /* g_file_get_contents(iconfile, &data, &len, NULL); */
1953 int len = fread(buf, 1, st.st_size, file); 1953 int len = fread(buf, 1, st.st_size, file);
1954 gaim_debug_info("oscar", 1954 purple_debug_info("oscar",
1955 "Sending buddy icon to %s (%d bytes, " 1955 "Sending buddy icon to %s (%d bytes, "
1956 "%lu reported)\n", 1956 "%lu reported)\n",
1957 userinfo->sn, len, st.st_size); 1957 userinfo->sn, len, st.st_size);
1958 aim_im_sendch2_icon(od, userinfo->sn, buf, st.st_size, 1958 aim_im_sendch2_icon(od, userinfo->sn, buf, st.st_size,
1959 st.st_mtime, aimutil_iconsum(buf, st.st_size)); 1959 st.st_mtime, aimutil_iconsum(buf, st.st_size));
1960 fclose(file); 1960 fclose(file);
1961 } else 1961 } else
1962 gaim_debug_error("oscar", "Can't open buddy icon file!\n"); 1962 purple_debug_error("oscar", "Can't open buddy icon file!\n");
1963 g_free(buf); 1963 g_free(buf);
1964 } else 1964 } else
1965 gaim_debug_error("oscar", "Can't stat buddy icon file!\n"); 1965 purple_debug_error("oscar", "Can't stat buddy icon file!\n");
1966 } 1966 }
1967 g_free(iconfile); 1967 g_free(iconfile);
1968 1968
1969 message = g_string_new(""); 1969 message = g_string_new("");
1970 curpart = args->mpmsg.parts; 1970 curpart = args->mpmsg.parts;
1971 while (curpart != NULL) { 1971 while (curpart != NULL) {
1972 tmp = gaim_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset, 1972 tmp = purple_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset,
1973 curpart->charsubset, curpart->data, curpart->datalen); 1973 curpart->charsubset, curpart->data, curpart->datalen);
1974 if (tmp != NULL) { 1974 if (tmp != NULL) {
1975 g_string_append(message, tmp); 1975 g_string_append(message, tmp);
1976 g_free(tmp); 1976 g_free(tmp);
1977 } 1977 }
1987 * replaced with <br> 1987 * replaced with <br>
1988 * 1988 *
1989 * Note: There *may* be some clients which send messages as HTML formatted - 1989 * Note: There *may* be some clients which send messages as HTML formatted -
1990 * they need to be special-cased somehow. 1990 * they need to be special-cased somehow.
1991 */ 1991 */
1992 if (aim_sn_is_icq(gaim_account_get_username(account)) && aim_sn_is_icq(userinfo->sn)) { 1992 if (aim_sn_is_icq(purple_account_get_username(account)) && aim_sn_is_icq(userinfo->sn)) {
1993 /* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */ 1993 /* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */
1994 gchar *tmp2 = g_markup_escape_text(tmp, -1); 1994 gchar *tmp2 = g_markup_escape_text(tmp, -1);
1995 g_free(tmp); 1995 g_free(tmp);
1996 tmp = tmp2; 1996 tmp = tmp2;
1997 tmp2 = gaim_strreplace(tmp, "\r\n", "<br>"); 1997 tmp2 = purple_strreplace(tmp, "\r\n", "<br>");
1998 g_free(tmp); 1998 g_free(tmp);
1999 tmp = tmp2; 1999 tmp = tmp2;
2000 } 2000 }
2001 2001
2002 /* 2002 /*
2003 * Convert iChat color tags to normal font tags. 2003 * Convert iChat color tags to normal font tags.
2004 */ 2004 */
2005 if (gaim_markup_find_tag("body", tmp, &start, &end, &attribs)) 2005 if (purple_markup_find_tag("body", tmp, &start, &end, &attribs))
2006 { 2006 {
2007 const char *ichattextcolor, *ichatballooncolor; 2007 const char *ichattextcolor, *ichatballooncolor;
2008 2008
2009 ichattextcolor = g_datalist_get_data(&attribs, "ichattextcolor"); 2009 ichattextcolor = g_datalist_get_data(&attribs, "ichattextcolor");
2010 if (ichattextcolor != NULL) 2010 if (ichattextcolor != NULL)
2034 } 2034 }
2035 2035
2036 static int 2036 static int
2037 incomingim_chan2(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, IcbmArgsCh2 *args) 2037 incomingim_chan2(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, IcbmArgsCh2 *args)
2038 { 2038 {
2039 GaimConnection *gc; 2039 PurpleConnection *gc;
2040 GaimAccount *account; 2040 PurpleAccount *account;
2041 char *message = NULL; 2041 char *message = NULL;
2042 2042
2043 g_return_val_if_fail(od != NULL, 0); 2043 g_return_val_if_fail(od != NULL, 0);
2044 g_return_val_if_fail(od->gc != NULL, 0); 2044 g_return_val_if_fail(od->gc != NULL, 0);
2045 2045
2046 gc = od->gc; 2046 gc = od->gc;
2047 account = gaim_connection_get_account(gc); 2047 account = purple_connection_get_account(gc);
2048 od = gc->proto_data; 2048 od = gc->proto_data;
2049 2049
2050 if (args == NULL) 2050 if (args == NULL)
2051 return 0; 2051 return 0;
2052 2052
2053 gaim_debug_misc("oscar", "Incoming rendezvous message of type %u, " 2053 purple_debug_misc("oscar", "Incoming rendezvous message of type %u, "
2054 "user %s, status %hu\n", args->type, userinfo->sn, args->status); 2054 "user %s, status %hu\n", args->type, userinfo->sn, args->status);
2055 2055
2056 if (args->msg != NULL) 2056 if (args->msg != NULL)
2057 { 2057 {
2058 if (args->encoding != NULL) 2058 if (args->encoding != NULL)
2142 /* 2142 /*
2143 * If they are connecting directly to us then 2143 * If they are connecting directly to us then
2144 * continue the peer negotiation by 2144 * continue the peer negotiation by
2145 * accepting connections on our listener port. 2145 * accepting connections on our listener port.
2146 */ 2146 */
2147 conn->watcher_incoming = gaim_input_add(conn->listenerfd, 2147 conn->watcher_incoming = purple_input_add(conn->listenerfd,
2148 GAIM_INPUT_READ, peer_connection_listen_cb, conn); 2148 PURPLE_INPUT_READ, peer_connection_listen_cb, conn);
2149 } 2149 }
2150 } 2150 }
2151 } 2151 }
2152 } 2152 }
2153 2153
2159 { 2159 {
2160 } 2160 }
2161 2161
2162 else if (args->type & OSCAR_CAPABILITY_BUDDYICON) 2162 else if (args->type & OSCAR_CAPABILITY_BUDDYICON)
2163 { 2163 {
2164 gaim_buddy_icons_set_for_user(account, userinfo->sn, 2164 purple_buddy_icons_set_for_user(account, userinfo->sn,
2165 args->info.icon.icon, 2165 args->info.icon.icon,
2166 args->info.icon.length); 2166 args->info.icon.length);
2167 } 2167 }
2168 2168
2169 else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY) 2169 else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY)
2170 { 2170 {
2171 gaim_debug_error("oscar", "Got an ICQ Server Relay message of " 2171 purple_debug_error("oscar", "Got an ICQ Server Relay message of "
2172 "type %d\n", args->info.rtfmsg.msgtype); 2172 "type %d\n", args->info.rtfmsg.msgtype);
2173 } 2173 }
2174 2174
2175 else 2175 else
2176 { 2176 {
2177 gaim_debug_error("oscar", "Unknown request class %hu\n", 2177 purple_debug_error("oscar", "Unknown request class %hu\n",
2178 args->type); 2178 args->type);
2179 } 2179 }
2180 2180
2181 g_free(message); 2181 g_free(message);
2182 2182
2188 * Most of these are callbacks from dialogs. They're used by both 2188 * Most of these are callbacks from dialogs. They're used by both
2189 * methods of authorization (SSI and old-school channel 4 ICBM) 2189 * methods of authorization (SSI and old-school channel 4 ICBM)
2190 */ 2190 */
2191 /* When you ask other people for authorization */ 2191 /* When you ask other people for authorization */
2192 static void 2192 static void
2193 gaim_auth_request(struct name_data *data, char *msg) 2193 purple_auth_request(struct name_data *data, char *msg)
2194 { 2194 {
2195 GaimConnection *gc; 2195 PurpleConnection *gc;
2196 OscarData *od; 2196 OscarData *od;
2197 GaimBuddy *buddy; 2197 PurpleBuddy *buddy;
2198 GaimGroup *group; 2198 PurpleGroup *group;
2199 2199
2200 gc = data->gc; 2200 gc = data->gc;
2201 od = gc->proto_data; 2201 od = gc->proto_data;
2202 buddy = gaim_find_buddy(gaim_connection_get_account(gc), data->name); 2202 buddy = purple_find_buddy(purple_connection_get_account(gc), data->name);
2203 if (buddy != NULL) 2203 if (buddy != NULL)
2204 group = gaim_buddy_get_group(buddy); 2204 group = purple_buddy_get_group(buddy);
2205 else 2205 else
2206 group = NULL; 2206 group = NULL;
2207 2207
2208 if (group != NULL) 2208 if (group != NULL)
2209 { 2209 {
2210 gaim_debug_info("oscar", "ssi: adding buddy %s to group %s\n", 2210 purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n",
2211 buddy->name, group->name); 2211 buddy->name, group->name);
2212 aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); 2212 aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list."));
2213 if (!aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) 2213 if (!aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))
2214 aim_ssi_addbuddy(od, buddy->name, group->name, gaim_buddy_get_alias_only(buddy), NULL, NULL, 1); 2214 aim_ssi_addbuddy(od, buddy->name, group->name, purple_buddy_get_alias_only(buddy), NULL, NULL, 1);
2215 } 2215 }
2216 } 2216 }
2217 2217
2218 static void 2218 static void
2219 gaim_auth_dontrequest(struct name_data *data) 2219 purple_auth_dontrequest(struct name_data *data)
2220 { 2220 {
2221 GaimConnection *gc = data->gc; 2221 PurpleConnection *gc = data->gc;
2222 GaimBuddy *b = gaim_find_buddy(gaim_connection_get_account(gc), data->name); 2222 PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), data->name);
2223 2223
2224 /* Remove from local list */ 2224 /* Remove from local list */
2225 gaim_blist_remove_buddy(b); 2225 purple_blist_remove_buddy(b);
2226 2226
2227 oscar_free_name_data(data); 2227 oscar_free_name_data(data);
2228 } 2228 }
2229 2229
2230 2230
2231 static void 2231 static void
2232 gaim_auth_sendrequest(GaimConnection *gc, const char *name) 2232 purple_auth_sendrequest(PurpleConnection *gc, const char *name)
2233 { 2233 {
2234 struct name_data *data; 2234 struct name_data *data;
2235 2235
2236 data = g_new0(struct name_data, 1); 2236 data = g_new0(struct name_data, 1);
2237 data->gc = gc; 2237 data->gc = gc;
2238 data->name = g_strdup(name); 2238 data->name = g_strdup(name);
2239 2239
2240 gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), 2240 purple_request_input(data->gc, NULL, _("Authorization Request Message:"),
2241 NULL, _("Please authorize me!"), TRUE, FALSE, NULL, 2241 NULL, _("Please authorize me!"), TRUE, FALSE, NULL,
2242 _("_OK"), G_CALLBACK(gaim_auth_request), 2242 _("_OK"), G_CALLBACK(purple_auth_request),
2243 _("_Cancel"), G_CALLBACK(gaim_auth_dontrequest), 2243 _("_Cancel"), G_CALLBACK(purple_auth_dontrequest),
2244 data); 2244 data);
2245 } 2245 }
2246 2246
2247 2247
2248 static void 2248 static void
2249 gaim_auth_sendrequest_menu(GaimBlistNode *node, gpointer ignored) 2249 purple_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored)
2250 { 2250 {
2251 GaimBuddy *buddy; 2251 PurpleBuddy *buddy;
2252 GaimConnection *gc; 2252 PurpleConnection *gc;
2253 2253
2254 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); 2254 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
2255 2255
2256 buddy = (GaimBuddy *) node; 2256 buddy = (PurpleBuddy *) node;
2257 gc = gaim_account_get_connection(buddy->account); 2257 gc = purple_account_get_connection(buddy->account);
2258 gaim_auth_sendrequest(gc, buddy->name); 2258 purple_auth_sendrequest(gc, buddy->name);
2259 } 2259 }
2260 2260
2261 /* When other people ask you for authorization */ 2261 /* When other people ask you for authorization */
2262 static void 2262 static void
2263 gaim_auth_grant(struct name_data *data) 2263 purple_auth_grant(struct name_data *data)
2264 { 2264 {
2265 GaimConnection *gc = data->gc; 2265 PurpleConnection *gc = data->gc;
2266 OscarData *od = gc->proto_data; 2266 OscarData *od = gc->proto_data;
2267 2267
2268 aim_ssi_sendauthreply(od, data->name, 0x01, NULL); 2268 aim_ssi_sendauthreply(od, data->name, 0x01, NULL);
2269 2269
2270 oscar_free_name_data(data); 2270 oscar_free_name_data(data);
2271 } 2271 }
2272 2272
2273 /* When other people ask you for authorization */ 2273 /* When other people ask you for authorization */
2274 static void 2274 static void
2275 gaim_auth_dontgrant(struct name_data *data, char *msg) 2275 purple_auth_dontgrant(struct name_data *data, char *msg)
2276 { 2276 {
2277 GaimConnection *gc = data->gc; 2277 PurpleConnection *gc = data->gc;
2278 OscarData *od = gc->proto_data; 2278 OscarData *od = gc->proto_data;
2279 2279
2280 aim_ssi_sendauthreply(od, data->name, 0x00, msg ? msg : _("No reason given.")); 2280 aim_ssi_sendauthreply(od, data->name, 0x00, msg ? msg : _("No reason given."));
2281 } 2281 }
2282 2282
2283 static void 2283 static void
2284 gaim_auth_dontgrant_msgprompt(struct name_data *data) 2284 purple_auth_dontgrant_msgprompt(struct name_data *data)
2285 { 2285 {
2286 gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), 2286 purple_request_input(data->gc, NULL, _("Authorization Denied Message:"),
2287 NULL, _("No reason given."), TRUE, FALSE, NULL, 2287 NULL, _("No reason given."), TRUE, FALSE, NULL,
2288 _("_OK"), G_CALLBACK(gaim_auth_dontgrant), 2288 _("_OK"), G_CALLBACK(purple_auth_dontgrant),
2289 _("_Cancel"), G_CALLBACK(oscar_free_name_data), 2289 _("_Cancel"), G_CALLBACK(oscar_free_name_data),
2290 data); 2290 data);
2291 } 2291 }
2292 2292
2293 /* When someone sends you buddies */ 2293 /* When someone sends you buddies */
2294 static void 2294 static void
2295 gaim_icq_buddyadd(struct name_data *data) 2295 purple_icq_buddyadd(struct name_data *data)
2296 { 2296 {
2297 GaimConnection *gc = data->gc; 2297 PurpleConnection *gc = data->gc;
2298 2298
2299 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick); 2299 purple_blist_request_add_buddy(purple_connection_get_account(gc), data->name, NULL, data->nick);
2300 2300
2301 oscar_free_name_data(data); 2301 oscar_free_name_data(data);
2302 } 2302 }
2303 2303
2304 static int 2304 static int
2305 incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) 2305 incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t)
2306 { 2306 {
2307 GaimConnection *gc = od->gc; 2307 PurpleConnection *gc = od->gc;
2308 GaimAccount *account = gaim_connection_get_account(gc); 2308 PurpleAccount *account = purple_connection_get_account(gc);
2309 gchar **msg1, **msg2; 2309 gchar **msg1, **msg2;
2310 int i, numtoks; 2310 int i, numtoks;
2311 2311
2312 if (!args->type || !args->msg || !args->uin) 2312 if (!args->type || !args->msg || !args->uin)
2313 return 1; 2313 return 1;
2314 2314
2315 gaim_debug_info("oscar", 2315 purple_debug_info("oscar",
2316 "Received a channel 4 message of type 0x%02hx.\n", 2316 "Received a channel 4 message of type 0x%02hx.\n",
2317 args->type); 2317 args->type);
2318 2318
2319 /* 2319 /*
2320 * Split up the message at the delimeter character, then convert each 2320 * Split up the message at the delimeter character, then convert each
2329 for (numtoks=0; msg1[numtoks]; numtoks++); 2329 for (numtoks=0; msg1[numtoks]; numtoks++);
2330 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); 2330 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *));
2331 for (i=0; msg1[i]; i++) { 2331 for (i=0; msg1[i]; i++) {
2332 gchar *uin = g_strdup_printf("%u", args->uin); 2332 gchar *uin = g_strdup_printf("%u", args->uin);
2333 2333
2334 gaim_str_strip_char(msg1[i], '\r'); 2334 purple_str_strip_char(msg1[i], '\r');
2335 /* TODO: Should use an encoding other than ASCII? */ 2335 /* TODO: Should use an encoding other than ASCII? */
2336 msg2[i] = gaim_plugin_oscar_decode_im_part(account, uin, AIM_CHARSET_ASCII, 0x0000, msg1[i], strlen(msg1[i])); 2336 msg2[i] = purple_plugin_oscar_decode_im_part(account, uin, AIM_CHARSET_ASCII, 0x0000, msg1[i], strlen(msg1[i]));
2337 g_free(uin); 2337 g_free(uin);
2338 } 2338 }
2339 msg2[i] = NULL; 2339 msg2[i] = NULL;
2340 2340
2341 switch (args->type) { 2341 switch (args->type) {
2389 struct name_data *data = g_new(struct name_data, 1); 2389 struct name_data *data = g_new(struct name_data, 1);
2390 gchar *sn = g_strdup_printf("%u", args->uin); 2390 gchar *sn = g_strdup_printf("%u", args->uin);
2391 gchar *reason = NULL; 2391 gchar *reason = NULL;
2392 2392
2393 if (msg2[5] != NULL) 2393 if (msg2[5] != NULL)
2394 reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg2[5], strlen(msg2[5])); 2394 reason = purple_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg2[5], strlen(msg2[5]));
2395 2395
2396 gaim_debug_info("oscar", 2396 purple_debug_info("oscar",
2397 "Received an authorization request from UIN %u\n", 2397 "Received an authorization request from UIN %u\n",
2398 args->uin); 2398 args->uin);
2399 data->gc = gc; 2399 data->gc = gc;
2400 data->name = sn; 2400 data->name = sn;
2401 data->nick = NULL; 2401 data->nick = NULL;
2402 2402
2403 gaim_account_request_authorization(account, sn, NULL, NULL, 2403 purple_account_request_authorization(account, sn, NULL, NULL,
2404 reason, gaim_find_buddy(account, sn) != NULL, 2404 reason, purple_find_buddy(account, sn) != NULL,
2405 G_CALLBACK(gaim_auth_grant), 2405 G_CALLBACK(purple_auth_grant),
2406 G_CALLBACK(gaim_auth_dontgrant_msgprompt), data); 2406 G_CALLBACK(purple_auth_dontgrant_msgprompt), data);
2407 g_free(reason); 2407 g_free(reason);
2408 } 2408 }
2409 } break; 2409 } break;
2410 2410
2411 case 0x07: { /* Someone has denied you authorization */ 2411 case 0x07: { /* Someone has denied you authorization */
2412 if (i >= 1) { 2412 if (i >= 1) {
2413 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); 2413 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given."));
2414 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), 2414 purple_notify_info(gc, NULL, _("ICQ authorization denied."),
2415 dialog_msg); 2415 dialog_msg);
2416 g_free(dialog_msg); 2416 g_free(dialog_msg);
2417 } 2417 }
2418 } break; 2418 } break;
2419 2419
2420 case 0x08: { /* Someone has granted you authorization */ 2420 case 0x08: { /* Someone has granted you authorization */
2421 gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin); 2421 gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin);
2422 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", 2422 purple_notify_info(gc, NULL, "ICQ authorization accepted.",
2423 dialog_msg); 2423 dialog_msg);
2424 g_free(dialog_msg); 2424 g_free(dialog_msg);
2425 } break; 2425 } break;
2426 2426
2427 case 0x09: { /* Message from the Godly ICQ server itself, I think */ 2427 case 0x09: { /* Message from the Godly ICQ server itself, I think */
2428 if (i >= 5) { 2428 if (i >= 5) {
2429 gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); 2429 gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]);
2430 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); 2430 purple_notify_info(gc, NULL, "ICQ Server Message", dialog_msg);
2431 g_free(dialog_msg); 2431 g_free(dialog_msg);
2432 } 2432 }
2433 } break; 2433 } break;
2434 2434
2435 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ 2435 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */
2436 if (i >= 6) { 2436 if (i >= 6) {
2437 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); 2437 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]);
2438 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); 2438 purple_notify_info(gc, NULL, "ICQ Page", dialog_msg);
2439 g_free(dialog_msg); 2439 g_free(dialog_msg);
2440 } 2440 }
2441 } break; 2441 } break;
2442 2442
2443 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ 2443 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */
2444 if (i >= 6) { 2444 if (i >= 6) {
2445 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ e-mail from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]); 2445 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ e-mail from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]);
2446 gaim_notify_info(gc, NULL, "ICQ E-Mail", dialog_msg); 2446 purple_notify_info(gc, NULL, "ICQ E-Mail", dialog_msg);
2447 g_free(dialog_msg); 2447 g_free(dialog_msg);
2448 } 2448 }
2449 } break; 2449 } break;
2450 2450
2451 case 0x12: { 2451 case 0x12: {
2466 gchar *message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); 2466 gchar *message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]);
2467 data->gc = gc; 2467 data->gc = gc;
2468 data->name = g_strdup(text[i*2+1]); 2468 data->name = g_strdup(text[i*2+1]);
2469 data->nick = g_strdup(text[i*2+2]); 2469 data->nick = g_strdup(text[i*2+2]);
2470 2470
2471 gaim_request_action(gc, NULL, message, 2471 purple_request_action(gc, NULL, message,
2472 _("Do you want to add this buddy " 2472 _("Do you want to add this buddy "
2473 "to your buddy list?"), 2473 "to your buddy list?"),
2474 GAIM_DEFAULT_ACTION_NONE, data, 2, 2474 PURPLE_DEFAULT_ACTION_NONE, data, 2,
2475 _("_Add"), G_CALLBACK(gaim_icq_buddyadd), 2475 _("_Add"), G_CALLBACK(purple_icq_buddyadd),
2476 _("_Decline"), G_CALLBACK(oscar_free_name_data)); 2476 _("_Decline"), G_CALLBACK(oscar_free_name_data));
2477 g_free(message); 2477 g_free(message);
2478 } 2478 }
2479 g_strfreev(text); 2479 g_strfreev(text);
2480 } 2480 }
2483 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */ 2483 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */
2484 /* This is boring and silly. */ 2484 /* This is boring and silly. */
2485 } break; 2485 } break;
2486 2486
2487 default: { 2487 default: {
2488 gaim_debug_info("oscar", 2488 purple_debug_info("oscar",
2489 "Received a channel 4 message of unknown type " 2489 "Received a channel 4 message of unknown type "
2490 "(type 0x%02hhx).\n", args->type); 2490 "(type 0x%02hhx).\n", args->type);
2491 } break; 2491 } break;
2492 } 2492 }
2493 2493
2495 g_strfreev(msg2); 2495 g_strfreev(msg2);
2496 2496
2497 return 1; 2497 return 1;
2498 } 2498 }
2499 2499
2500 static int gaim_parse_incoming_im(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2500 static int purple_parse_incoming_im(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2501 guint16 channel; 2501 guint16 channel;
2502 int ret = 0; 2502 int ret = 0;
2503 aim_userinfo_t *userinfo; 2503 aim_userinfo_t *userinfo;
2504 va_list ap; 2504 va_list ap;
2505 2505
2525 args = va_arg(ap, struct aim_incomingim_ch4_args *); 2525 args = va_arg(ap, struct aim_incomingim_ch4_args *);
2526 ret = incomingim_chan4(od, conn, userinfo, args, 0); 2526 ret = incomingim_chan4(od, conn, userinfo, args, 0);
2527 } break; 2527 } break;
2528 2528
2529 default: { 2529 default: {
2530 gaim_debug_warning("oscar", 2530 purple_debug_warning("oscar",
2531 "ICBM received on unsupported channel (channel " 2531 "ICBM received on unsupported channel (channel "
2532 "0x%04hx).", channel); 2532 "0x%04hx).", channel);
2533 } break; 2533 } break;
2534 } 2534 }
2535 2535
2536 va_end(ap); 2536 va_end(ap);
2537 2537
2538 return ret; 2538 return ret;
2539 } 2539 }
2540 2540
2541 static int gaim_parse_misses(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2541 static int purple_parse_misses(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2542 GaimConnection *gc = od->gc; 2542 PurpleConnection *gc = od->gc;
2543 GaimAccount *account = gaim_connection_get_account(gc); 2543 PurpleAccount *account = purple_connection_get_account(gc);
2544 char *buf; 2544 char *buf;
2545 va_list ap; 2545 va_list ap;
2546 guint16 chan, nummissed, reason; 2546 guint16 chan, nummissed, reason;
2547 aim_userinfo_t *userinfo; 2547 aim_userinfo_t *userinfo;
2548 2548
2608 nummissed, 2608 nummissed,
2609 userinfo->sn); 2609 userinfo->sn);
2610 break; 2610 break;
2611 } 2611 }
2612 2612
2613 if (!gaim_conv_present_error(userinfo->sn, account, buf)) 2613 if (!purple_conv_present_error(userinfo->sn, account, buf))
2614 gaim_notify_error(od->gc, NULL, buf, NULL); 2614 purple_notify_error(od->gc, NULL, buf, NULL);
2615 g_free(buf); 2615 g_free(buf);
2616 2616
2617 return 1; 2617 return 1;
2618 } 2618 }
2619 2619
2620 static int 2620 static int
2621 gaim_parse_clientauto_ch2(OscarData *od, const char *who, guint16 reason, const guchar *cookie) 2621 purple_parse_clientauto_ch2(OscarData *od, const char *who, guint16 reason, const guchar *cookie)
2622 { 2622 {
2623 if (reason == 0x0003) 2623 if (reason == 0x0003)
2624 { 2624 {
2625 /* Rendezvous was refused. */ 2625 /* Rendezvous was refused. */
2626 PeerConnection *conn; 2626 PeerConnection *conn;
2627 2627
2628 conn = peer_connection_find_by_cookie(od, who, cookie); 2628 conn = peer_connection_find_by_cookie(od, who, cookie);
2629 2629
2630 if (conn == NULL) 2630 if (conn == NULL)
2631 { 2631 {
2632 gaim_debug_info("oscar", "Received a rendezvous cancel message " 2632 purple_debug_info("oscar", "Received a rendezvous cancel message "
2633 "for a nonexistant connection from %s.\n", who); 2633 "for a nonexistant connection from %s.\n", who);
2634 } 2634 }
2635 else 2635 else
2636 { 2636 {
2637 peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_REFUSED, NULL); 2637 peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_REFUSED, NULL);
2638 } 2638 }
2639 } 2639 }
2640 else 2640 else
2641 { 2641 {
2642 gaim_debug_warning("oscar", "Received an unknown rendezvous " 2642 purple_debug_warning("oscar", "Received an unknown rendezvous "
2643 "message from %s. Type 0x%04hx\n", who, reason); 2643 "message from %s. Type 0x%04hx\n", who, reason);
2644 } 2644 }
2645 2645
2646 return 0; 2646 return 0;
2647 } 2647 }
2648 2648
2649 static int gaim_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, guint32 state, char *msg) { 2649 static int purple_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, guint32 state, char *msg) {
2650 GaimConnection *gc = od->gc; 2650 PurpleConnection *gc = od->gc;
2651 2651
2652 switch(reason) { 2652 switch(reason) {
2653 case 0x0003: { /* Reply from an ICQ status message request */ 2653 case 0x0003: { /* Reply from an ICQ status message request */
2654 char *statusmsg, **splitmsg; 2654 char *statusmsg, **splitmsg;
2655 GaimNotifyUserInfo *user_info; 2655 PurpleNotifyUserInfo *user_info;
2656 2656
2657 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ 2657 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */
2658 statusmsg = oscar_icqstatus(state); 2658 statusmsg = oscar_icqstatus(state);
2659 splitmsg = g_strsplit(msg, "\r\n", 0); 2659 splitmsg = g_strsplit(msg, "\r\n", 0);
2660 2660
2661 user_info = gaim_notify_user_info_new(); 2661 user_info = purple_notify_user_info_new();
2662 2662
2663 gaim_notify_user_info_add_pair(user_info, _("UIN"), who); 2663 purple_notify_user_info_add_pair(user_info, _("UIN"), who);
2664 gaim_notify_user_info_add_pair(user_info, _("Status"), statusmsg); 2664 purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg);
2665 gaim_notify_user_info_add_section_break(user_info); 2665 purple_notify_user_info_add_section_break(user_info);
2666 gaim_notify_user_info_add_pair(user_info, NULL, g_strjoinv("<BR>", splitmsg)); 2666 purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("<BR>", splitmsg));
2667 2667
2668 g_free(statusmsg); 2668 g_free(statusmsg);
2669 g_strfreev(splitmsg); 2669 g_strfreev(splitmsg);
2670 2670
2671 gaim_notify_userinfo(gc, who, user_info, NULL, NULL); 2671 purple_notify_userinfo(gc, who, user_info, NULL, NULL);
2672 gaim_notify_user_info_destroy(user_info); 2672 purple_notify_user_info_destroy(user_info);
2673 2673
2674 } break; 2674 } break;
2675 2675
2676 default: { 2676 default: {
2677 gaim_debug_warning("oscar", 2677 purple_debug_warning("oscar",
2678 "Received an unknown client auto-response from %s. " 2678 "Received an unknown client auto-response from %s. "
2679 "Type 0x%04hx\n", who, reason); 2679 "Type 0x%04hx\n", who, reason);
2680 } break; 2680 } break;
2681 } /* end of switch */ 2681 } /* end of switch */
2682 2682
2683 return 0; 2683 return 0;
2684 } 2684 }
2685 2685
2686 static int gaim_parse_clientauto(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2686 static int purple_parse_clientauto(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2687 va_list ap; 2687 va_list ap;
2688 guint16 chan, reason; 2688 guint16 chan, reason;
2689 char *who; 2689 char *who;
2690 2690
2691 va_start(ap, fr); 2691 va_start(ap, fr);
2693 who = va_arg(ap, char *); 2693 who = va_arg(ap, char *);
2694 reason = (guint16)va_arg(ap, unsigned int); 2694 reason = (guint16)va_arg(ap, unsigned int);
2695 2695
2696 if (chan == 0x0002) { /* File transfer declined */ 2696 if (chan == 0x0002) { /* File transfer declined */
2697 guchar *cookie = va_arg(ap, guchar *); 2697 guchar *cookie = va_arg(ap, guchar *);
2698 return gaim_parse_clientauto_ch2(od, who, reason, cookie); 2698 return purple_parse_clientauto_ch2(od, who, reason, cookie);
2699 } else if (chan == 0x0004) { /* ICQ message */ 2699 } else if (chan == 0x0004) { /* ICQ message */
2700 guint32 state = 0; 2700 guint32 state = 0;
2701 char *msg = NULL; 2701 char *msg = NULL;
2702 if (reason == 0x0003) { 2702 if (reason == 0x0003) {
2703 state = va_arg(ap, guint32); 2703 state = va_arg(ap, guint32);
2704 msg = va_arg(ap, char *); 2704 msg = va_arg(ap, char *);
2705 } 2705 }
2706 return gaim_parse_clientauto_ch4(od, who, reason, state, msg); 2706 return purple_parse_clientauto_ch4(od, who, reason, state, msg);
2707 } 2707 }
2708 2708
2709 va_end(ap); 2709 va_end(ap);
2710 2710
2711 return 1; 2711 return 1;
2712 } 2712 }
2713 2713
2714 static int gaim_parse_genericerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2714 static int purple_parse_genericerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2715 va_list ap; 2715 va_list ap;
2716 guint16 reason; 2716 guint16 reason;
2717 2717
2718 va_start(ap, fr); 2718 va_start(ap, fr);
2719 reason = (guint16) va_arg(ap, unsigned int); 2719 reason = (guint16) va_arg(ap, unsigned int);
2720 va_end(ap); 2720 va_end(ap);
2721 2721
2722 gaim_debug_error("oscar", 2722 purple_debug_error("oscar",
2723 "snac threw error (reason 0x%04hx: %s)\n", reason, 2723 "snac threw error (reason 0x%04hx: %s)\n", reason,
2724 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); 2724 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown");
2725 return 1; 2725 return 1;
2726 } 2726 }
2727 2727
2728 static int gaim_parse_msgerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2728 static int purple_parse_msgerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2729 GaimConnection *gc = od->gc; 2729 PurpleConnection *gc = od->gc;
2730 #ifdef TODOFT 2730 #ifdef TODOFT
2731 OscarData *od = gc->proto_data; 2731 OscarData *od = gc->proto_data;
2732 GaimXfer *xfer; 2732 PurpleXfer *xfer;
2733 #endif 2733 #endif
2734 va_list ap; 2734 va_list ap;
2735 guint16 reason; 2735 guint16 reason;
2736 char *data, *buf; 2736 char *data, *buf;
2737 2737
2738 va_start(ap, fr); 2738 va_start(ap, fr);
2739 reason = (guint16)va_arg(ap, unsigned int); 2739 reason = (guint16)va_arg(ap, unsigned int);
2740 data = va_arg(ap, char *); 2740 data = va_arg(ap, char *);
2741 va_end(ap); 2741 va_end(ap);
2742 2742
2743 gaim_debug_error("oscar", 2743 purple_debug_error("oscar",
2744 "Message error with data %s and reason %hu\n", 2744 "Message error with data %s and reason %hu\n",
2745 (data != NULL ? data : ""), reason); 2745 (data != NULL ? data : ""), reason);
2746 2746
2747 if ((data == NULL) || (*data == '\0')) 2747 if ((data == NULL) || (*data == '\0'))
2748 /* We can't do anything if data is empty */ 2748 /* We can't do anything if data is empty */
2749 return 1; 2749 return 1;
2750 2750
2751 #ifdef TODOFT 2751 #ifdef TODOFT
2752 /* If this was a file transfer request, data is a cookie */ 2752 /* If this was a file transfer request, data is a cookie */
2753 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) { 2753 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) {
2754 gaim_xfer_cancel_remote(xfer); 2754 purple_xfer_cancel_remote(xfer);
2755 return 1; 2755 return 1;
2756 } 2756 }
2757 #endif 2757 #endif
2758 2758
2759 /* Data is assumed to be the destination sn */ 2759 /* Data is assumed to be the destination sn */
2760 buf = g_strdup_printf(_("Unable to send message: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason.")); 2760 buf = g_strdup_printf(_("Unable to send message: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
2761 if (!gaim_conv_present_error(data, gaim_connection_get_account(gc), buf)) { 2761 if (!purple_conv_present_error(data, purple_connection_get_account(gc), buf)) {
2762 g_free(buf); 2762 g_free(buf);
2763 buf = g_strdup_printf(_("Unable to send message to %s:"), data ? data : "(unknown)"); 2763 buf = g_strdup_printf(_("Unable to send message to %s:"), data ? data : "(unknown)");
2764 gaim_notify_error(od->gc, NULL, buf, 2764 purple_notify_error(od->gc, NULL, buf,
2765 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason.")); 2765 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
2766 } 2766 }
2767 g_free(buf); 2767 g_free(buf);
2768 2768
2769 return 1; 2769 return 1;
2770 } 2770 }
2771 2771
2772 static int gaim_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2772 static int purple_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2773 GaimConnection *gc = od->gc; 2773 PurpleConnection *gc = od->gc;
2774 va_list ap; 2774 va_list ap;
2775 guint16 type1, type2; 2775 guint16 type1, type2;
2776 char *sn; 2776 char *sn;
2777 2777
2778 va_start(ap, fr); 2778 va_start(ap, fr);
2785 case 0x0000: { /* Text has been cleared */ 2785 case 0x0000: { /* Text has been cleared */
2786 serv_got_typing_stopped(gc, sn); 2786 serv_got_typing_stopped(gc, sn);
2787 } break; 2787 } break;
2788 2788
2789 case 0x0001: { /* Paused typing */ 2789 case 0x0001: { /* Paused typing */
2790 serv_got_typing(gc, sn, 0, GAIM_TYPED); 2790 serv_got_typing(gc, sn, 0, PURPLE_TYPED);
2791 } break; 2791 } break;
2792 2792
2793 case 0x0002: { /* Typing */ 2793 case 0x0002: { /* Typing */
2794 serv_got_typing(gc, sn, 0, GAIM_TYPING); 2794 serv_got_typing(gc, sn, 0, PURPLE_TYPING);
2795 } break; 2795 } break;
2796 2796
2797 default: { 2797 default: {
2798 /* 2798 /*
2799 * It looks like iChat sometimes sends typing notification 2799 * It looks like iChat sometimes sends typing notification
2800 * with type1=0x0001 and type2=0x000f. Not sure why. 2800 * with type1=0x0001 and type2=0x000f. Not sure why.
2801 */ 2801 */
2802 gaim_debug_info("oscar", "Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2); 2802 purple_debug_info("oscar", "Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2);
2803 } break; 2803 } break;
2804 } 2804 }
2805 2805
2806 return 1; 2806 return 1;
2807 } 2807 }
2808 2808
2809 /* 2809 /*
2810 * We get this error when there was an error in the locate family. This 2810 * We get this error when there was an error in the locate family. This
2811 * happens when you request info of someone who is offline. 2811 * happens when you request info of someone who is offline.
2812 */ 2812 */
2813 static int gaim_parse_locerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2813 static int purple_parse_locerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2814 gchar *buf; 2814 gchar *buf;
2815 va_list ap; 2815 va_list ap;
2816 guint16 reason; 2816 guint16 reason;
2817 char *destn; 2817 char *destn;
2818 2818
2823 2823
2824 if (destn == NULL) 2824 if (destn == NULL)
2825 return 1; 2825 return 1;
2826 2826
2827 buf = g_strdup_printf(_("User information not available: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason.")); 2827 buf = g_strdup_printf(_("User information not available: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
2828 if (!gaim_conv_present_error(destn, gaim_connection_get_account((GaimConnection*)od->gc), buf)) { 2828 if (!purple_conv_present_error(destn, purple_connection_get_account((PurpleConnection*)od->gc), buf)) {
2829 g_free(buf); 2829 g_free(buf);
2830 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); 2830 buf = g_strdup_printf(_("User information for %s unavailable:"), destn);
2831 gaim_notify_error(od->gc, NULL, buf, (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason.")); 2831 purple_notify_error(od->gc, NULL, buf, (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason."));
2832 } 2832 }
2833 g_free(buf); 2833 g_free(buf);
2834 2834
2835 return 1; 2835 return 1;
2836 } 2836 }
2837 2837
2838 static int gaim_parse_userinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2838 static int purple_parse_userinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2839 GaimConnection *gc = od->gc; 2839 PurpleConnection *gc = od->gc;
2840 GaimAccount *account = gaim_connection_get_account(gc); 2840 PurpleAccount *account = purple_connection_get_account(gc);
2841 GaimNotifyUserInfo *user_info; 2841 PurpleNotifyUserInfo *user_info;
2842 gchar *tmp = NULL, *info_utf8 = NULL, *away_utf8 = NULL; 2842 gchar *tmp = NULL, *info_utf8 = NULL, *away_utf8 = NULL;
2843 va_list ap; 2843 va_list ap;
2844 aim_userinfo_t *userinfo; 2844 aim_userinfo_t *userinfo;
2845 2845
2846 va_start(ap, fr); 2846 va_start(ap, fr);
2847 userinfo = va_arg(ap, aim_userinfo_t *); 2847 userinfo = va_arg(ap, aim_userinfo_t *);
2848 va_end(ap); 2848 va_end(ap);
2849 2849
2850 user_info = gaim_notify_user_info_new(); 2850 user_info = purple_notify_user_info_new();
2851 gaim_notify_user_info_add_pair(user_info, _("Screen Name"), userinfo->sn); 2851 purple_notify_user_info_add_pair(user_info, _("Screen Name"), userinfo->sn);
2852 2852
2853 tmp = g_strdup_printf("%d", (int)((userinfo->warnlevel/10.0) + 0.5)); 2853 tmp = g_strdup_printf("%d", (int)((userinfo->warnlevel/10.0) + 0.5));
2854 gaim_notify_user_info_add_pair(user_info, _("Warning Level"), tmp); 2854 purple_notify_user_info_add_pair(user_info, _("Warning Level"), tmp);
2855 g_free(tmp); 2855 g_free(tmp);
2856 2856
2857 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) { 2857 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) {
2858 time_t t = userinfo->onlinesince - od->timeoffset; 2858 time_t t = userinfo->onlinesince - od->timeoffset;
2859 oscar_user_info_add_pair(user_info, _("Online Since"), gaim_date_format_full(localtime(&t))); 2859 oscar_user_info_add_pair(user_info, _("Online Since"), purple_date_format_full(localtime(&t)));
2860 } 2860 }
2861 2861
2862 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { 2862 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) {
2863 time_t t = userinfo->membersince - od->timeoffset; 2863 time_t t = userinfo->membersince - od->timeoffset;
2864 oscar_user_info_add_pair(user_info, _("Member Since"), gaim_date_format_full(localtime(&t))); 2864 oscar_user_info_add_pair(user_info, _("Member Since"), purple_date_format_full(localtime(&t)));
2865 } 2865 }
2866 2866
2867 if (userinfo->capabilities != 0) { 2867 if (userinfo->capabilities != 0) {
2868 tmp = oscar_caps_to_string(userinfo->capabilities); 2868 tmp = oscar_caps_to_string(userinfo->capabilities);
2869 oscar_user_info_add_pair(user_info, _("Capabilities"), tmp); 2869 oscar_user_info_add_pair(user_info, _("Capabilities"), tmp);
2870 g_free(tmp); 2870 g_free(tmp);
2871 } 2871 }
2872 2872
2873 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) { 2873 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) {
2874 tmp = gaim_str_seconds_to_string(userinfo->idletime*60); 2874 tmp = purple_str_seconds_to_string(userinfo->idletime*60);
2875 oscar_user_info_add_pair(user_info, _("Idle"), tmp); 2875 oscar_user_info_add_pair(user_info, _("Idle"), tmp);
2876 g_free(tmp); 2876 g_free(tmp);
2877 } 2877 }
2878 2878
2879 oscar_string_append_info(gc, user_info, NULL, userinfo); 2879 oscar_string_append_info(gc, user_info, NULL, userinfo);
2892 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { 2892 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) {
2893 tmp = oscar_encoding_extract(userinfo->away_encoding); 2893 tmp = oscar_encoding_extract(userinfo->away_encoding);
2894 away_utf8 = oscar_encoding_to_utf8(tmp, userinfo->away, userinfo->away_len); 2894 away_utf8 = oscar_encoding_to_utf8(tmp, userinfo->away, userinfo->away_len);
2895 g_free(tmp); 2895 g_free(tmp);
2896 if (away_utf8 != NULL) { 2896 if (away_utf8 != NULL) {
2897 tmp = gaim_str_sub_away_formatters(away_utf8, gaim_account_get_username(account)); 2897 tmp = purple_str_sub_away_formatters(away_utf8, purple_account_get_username(account));
2898 gaim_notify_user_info_add_section_break(user_info); 2898 purple_notify_user_info_add_section_break(user_info);
2899 oscar_user_info_add_pair(user_info, NULL, tmp); 2899 oscar_user_info_add_pair(user_info, NULL, tmp);
2900 g_free(tmp); 2900 g_free(tmp);
2901 g_free(away_utf8); 2901 g_free(away_utf8);
2902 } 2902 }
2903 } 2903 }
2906 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { 2906 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) {
2907 tmp = oscar_encoding_extract(userinfo->info_encoding); 2907 tmp = oscar_encoding_extract(userinfo->info_encoding);
2908 info_utf8 = oscar_encoding_to_utf8(tmp, userinfo->info, userinfo->info_len); 2908 info_utf8 = oscar_encoding_to_utf8(tmp, userinfo->info, userinfo->info_len);
2909 g_free(tmp); 2909 g_free(tmp);
2910 if (info_utf8 != NULL) { 2910 if (info_utf8 != NULL) {
2911 tmp = gaim_str_sub_away_formatters(info_utf8, gaim_account_get_username(account)); 2911 tmp = purple_str_sub_away_formatters(info_utf8, purple_account_get_username(account));
2912 gaim_notify_user_info_add_section_break(user_info); 2912 purple_notify_user_info_add_section_break(user_info);
2913 oscar_user_info_add_pair(user_info, _("Profile"), tmp); 2913 oscar_user_info_add_pair(user_info, _("Profile"), tmp);
2914 g_free(tmp); 2914 g_free(tmp);
2915 g_free(info_utf8); 2915 g_free(info_utf8);
2916 } 2916 }
2917 } 2917 }
2918 2918
2919 gaim_notify_userinfo(gc, userinfo->sn, user_info, NULL, NULL); 2919 purple_notify_userinfo(gc, userinfo->sn, user_info, NULL, NULL);
2920 gaim_notify_user_info_destroy(user_info); 2920 purple_notify_user_info_destroy(user_info);
2921 2921
2922 return 1; 2922 return 1;
2923 } 2923 }
2924 2924
2925 static int gaim_got_infoblock(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 2925 static int purple_got_infoblock(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
2926 { 2926 {
2927 GaimConnection *gc = od->gc; 2927 PurpleConnection *gc = od->gc;
2928 GaimBuddy *b; 2928 PurpleBuddy *b;
2929 GaimPresence *presence; 2929 PurplePresence *presence;
2930 GaimStatus *status; 2930 PurpleStatus *status;
2931 gchar *message = NULL; 2931 gchar *message = NULL;
2932 2932
2933 va_list ap; 2933 va_list ap;
2934 aim_userinfo_t *userinfo; 2934 aim_userinfo_t *userinfo;
2935 2935
2936 va_start(ap, fr); 2936 va_start(ap, fr);
2937 userinfo = va_arg(ap, aim_userinfo_t *); 2937 userinfo = va_arg(ap, aim_userinfo_t *);
2938 va_end(ap); 2938 va_end(ap);
2939 2939
2940 b = gaim_find_buddy(gaim_connection_get_account(gc), userinfo->sn); 2940 b = purple_find_buddy(purple_connection_get_account(gc), userinfo->sn);
2941 if (b == NULL) 2941 if (b == NULL)
2942 return 1; 2942 return 1;
2943 2943
2944 if (!aim_sn_is_icq(userinfo->sn)) 2944 if (!aim_sn_is_icq(userinfo->sn))
2945 { 2945 {
2946 if (strcmp(gaim_buddy_get_name(b), userinfo->sn)) 2946 if (strcmp(purple_buddy_get_name(b), userinfo->sn))
2947 serv_got_alias(gc, gaim_buddy_get_name(b), userinfo->sn); 2947 serv_got_alias(gc, purple_buddy_get_name(b), userinfo->sn);
2948 else 2948 else
2949 serv_got_alias(gc, gaim_buddy_get_name(b), NULL); 2949 serv_got_alias(gc, purple_buddy_get_name(b), NULL);
2950 } 2950 }
2951 2951
2952 presence = gaim_buddy_get_presence(b); 2952 presence = purple_buddy_get_presence(b);
2953 status = gaim_presence_get_active_status(presence); 2953 status = purple_presence_get_active_status(presence);
2954 2954
2955 if (!gaim_status_is_available(status) && gaim_status_is_online(status)) 2955 if (!purple_status_is_available(status) && purple_status_is_online(status))
2956 { 2956 {
2957 if ((userinfo->flags & AIM_FLAG_AWAY) && 2957 if ((userinfo->flags & AIM_FLAG_AWAY) &&
2958 (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { 2958 (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) {
2959 gchar *charset = oscar_encoding_extract(userinfo->away_encoding); 2959 gchar *charset = oscar_encoding_extract(userinfo->away_encoding);
2960 message = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len); 2960 message = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len);
2961 g_free(charset); 2961 g_free(charset);
2962 gaim_status_set_attr_string(status, "message", message); 2962 purple_status_set_attr_string(status, "message", message);
2963 g_free(message); 2963 g_free(message);
2964 } 2964 }
2965 else 2965 else
2966 /* Set an empty message so that we know not to show "pending" */ 2966 /* Set an empty message so that we know not to show "pending" */
2967 gaim_status_set_attr_string(status, "message", ""); 2967 purple_status_set_attr_string(status, "message", "");
2968 2968
2969 gaim_blist_update_buddy_status(b, status); 2969 purple_blist_update_buddy_status(b, status);
2970 } 2970 }
2971 2971
2972 return 1; 2972 return 1;
2973 } 2973 }
2974 2974
2975 static int gaim_parse_motd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 2975 static int purple_parse_motd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
2976 { 2976 {
2977 char *msg; 2977 char *msg;
2978 guint16 id; 2978 guint16 id;
2979 va_list ap; 2979 va_list ap;
2980 2980
2981 va_start(ap, fr); 2981 va_start(ap, fr);
2982 id = (guint16) va_arg(ap, unsigned int); 2982 id = (guint16) va_arg(ap, unsigned int);
2983 msg = va_arg(ap, char *); 2983 msg = va_arg(ap, char *);
2984 va_end(ap); 2984 va_end(ap);
2985 2985
2986 gaim_debug_misc("oscar", 2986 purple_debug_misc("oscar",
2987 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); 2987 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id);
2988 if (id < 4) 2988 if (id < 4)
2989 gaim_notify_warning(od->gc, NULL, 2989 purple_notify_warning(od->gc, NULL,
2990 _("Your AIM connection may be lost."), NULL); 2990 _("Your AIM connection may be lost."), NULL);
2991 2991
2992 return 1; 2992 return 1;
2993 } 2993 }
2994 2994
2995 static int gaim_chatnav_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 2995 static int purple_chatnav_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
2996 va_list ap; 2996 va_list ap;
2997 guint16 type; 2997 guint16 type;
2998 2998
2999 va_start(ap, fr); 2999 va_start(ap, fr);
3000 type = (guint16) va_arg(ap, unsigned int); 3000 type = (guint16) va_arg(ap, unsigned int);
3007 3007
3008 maxrooms = (guint8) va_arg(ap, unsigned int); 3008 maxrooms = (guint8) va_arg(ap, unsigned int);
3009 exchangecount = va_arg(ap, int); 3009 exchangecount = va_arg(ap, int);
3010 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); 3010 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *);
3011 3011
3012 gaim_debug_misc("oscar", "chat info: Chat Rights:\n"); 3012 purple_debug_misc("oscar", "chat info: Chat Rights:\n");
3013 gaim_debug_misc("oscar", 3013 purple_debug_misc("oscar",
3014 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); 3014 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms);
3015 gaim_debug_misc("oscar", 3015 purple_debug_misc("oscar",
3016 "chat info: \tExchange List: (%d total)\n", exchangecount); 3016 "chat info: \tExchange List: (%d total)\n", exchangecount);
3017 for (i = 0; i < exchangecount; i++) 3017 for (i = 0; i < exchangecount; i++)
3018 gaim_debug_misc("oscar", 3018 purple_debug_misc("oscar",
3019 "chat info: \t\t%hu %s\n", 3019 "chat info: \t\t%hu %s\n",
3020 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); 3020 exchanges[i].number, exchanges[i].name ? exchanges[i].name : "");
3021 while (od->create_rooms) { 3021 while (od->create_rooms) {
3022 struct create_room *cr = od->create_rooms->data; 3022 struct create_room *cr = od->create_rooms->data;
3023 gaim_debug_info("oscar", 3023 purple_debug_info("oscar",
3024 "creating room %s\n", cr->name); 3024 "creating room %s\n", cr->name);
3025 aim_chatnav_createroom(od, conn, cr->name, cr->exchange); 3025 aim_chatnav_createroom(od, conn, cr->name, cr->exchange);
3026 g_free(cr->name); 3026 g_free(cr->name);
3027 od->create_rooms = g_slist_remove(od->create_rooms, cr); 3027 od->create_rooms = g_slist_remove(od->create_rooms, cr);
3028 g_free(cr); 3028 g_free(cr);
3045 createperms = (guint8)va_arg(ap, unsigned int); 3045 createperms = (guint8)va_arg(ap, unsigned int);
3046 unknown = (guint16)va_arg(ap, unsigned int); 3046 unknown = (guint16)va_arg(ap, unsigned int);
3047 name = va_arg(ap, char *); 3047 name = va_arg(ap, char *);
3048 ck = va_arg(ap, char *); 3048 ck = va_arg(ap, char *);
3049 3049
3050 gaim_debug_misc("oscar", 3050 purple_debug_misc("oscar",
3051 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", 3051 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n",
3052 fqcn, exchange, instance, flags, createtime, 3052 fqcn, exchange, instance, flags, createtime,
3053 maxmsglen, maxoccupancy, createperms, unknown, 3053 maxmsglen, maxoccupancy, createperms, unknown,
3054 name, ck); 3054 name, ck);
3055 aim_chat_join(od, exchange, ck, instance); 3055 aim_chat_join(od, exchange, ck, instance);
3056 } 3056 }
3057 break; 3057 break;
3058 default: 3058 default:
3059 gaim_debug_warning("oscar", 3059 purple_debug_warning("oscar",
3060 "chatnav info: unknown type (%04hx)\n", type); 3060 "chatnav info: unknown type (%04hx)\n", type);
3061 break; 3061 break;
3062 } 3062 }
3063 3063
3064 va_end(ap); 3064 va_end(ap);
3065 3065
3066 return 1; 3066 return 1;
3067 } 3067 }
3068 3068
3069 static int gaim_conv_chat_join(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3069 static int purple_conv_chat_join(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3070 va_list ap; 3070 va_list ap;
3071 int count, i; 3071 int count, i;
3072 aim_userinfo_t *info; 3072 aim_userinfo_t *info;
3073 GaimConnection *gc = od->gc; 3073 PurpleConnection *gc = od->gc;
3074 3074
3075 struct chat_connection *c = NULL; 3075 struct chat_connection *c = NULL;
3076 3076
3077 va_start(ap, fr); 3077 va_start(ap, fr);
3078 count = va_arg(ap, int); 3078 count = va_arg(ap, int);
3082 c = find_oscar_chat_by_conn(gc, conn); 3082 c = find_oscar_chat_by_conn(gc, conn);
3083 if (!c) 3083 if (!c)
3084 return 1; 3084 return 1;
3085 3085
3086 for (i = 0; i < count; i++) 3086 for (i = 0; i < count; i++)
3087 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL, GAIM_CBFLAGS_NONE, TRUE); 3087 purple_conv_chat_add_user(PURPLE_CONV_CHAT(c->conv), info[i].sn, NULL, PURPLE_CBFLAGS_NONE, TRUE);
3088 3088
3089 return 1; 3089 return 1;
3090 } 3090 }
3091 3091
3092 static int gaim_conv_chat_leave(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3092 static int purple_conv_chat_leave(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3093 va_list ap; 3093 va_list ap;
3094 int count, i; 3094 int count, i;
3095 aim_userinfo_t *info; 3095 aim_userinfo_t *info;
3096 GaimConnection *gc = od->gc; 3096 PurpleConnection *gc = od->gc;
3097 3097
3098 struct chat_connection *c = NULL; 3098 struct chat_connection *c = NULL;
3099 3099
3100 va_start(ap, fr); 3100 va_start(ap, fr);
3101 count = va_arg(ap, int); 3101 count = va_arg(ap, int);
3105 c = find_oscar_chat_by_conn(gc, conn); 3105 c = find_oscar_chat_by_conn(gc, conn);
3106 if (!c) 3106 if (!c)
3107 return 1; 3107 return 1;
3108 3108
3109 for (i = 0; i < count; i++) 3109 for (i = 0; i < count; i++)
3110 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL); 3110 purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c->conv), info[i].sn, NULL);
3111 3111
3112 return 1; 3112 return 1;
3113 } 3113 }
3114 3114
3115 static int gaim_conv_chat_info_update(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3115 static int purple_conv_chat_info_update(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3116 va_list ap; 3116 va_list ap;
3117 aim_userinfo_t *userinfo; 3117 aim_userinfo_t *userinfo;
3118 struct aim_chat_roominfo *roominfo; 3118 struct aim_chat_roominfo *roominfo;
3119 char *roomname; 3119 char *roomname;
3120 int usercount; 3120 int usercount;
3121 char *roomdesc; 3121 char *roomdesc;
3122 guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; 3122 guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
3123 guint32 creationtime; 3123 guint32 creationtime;
3124 GaimConnection *gc = od->gc; 3124 PurpleConnection *gc = od->gc;
3125 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn); 3125 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn);
3126 3126
3127 if (!ccon) 3127 if (!ccon)
3128 return 1; 3128 return 1;
3129 3129
3139 unknown_d2 = (guint16)va_arg(ap, unsigned int); 3139 unknown_d2 = (guint16)va_arg(ap, unsigned int);
3140 unknown_d5 = (guint16)va_arg(ap, unsigned int); 3140 unknown_d5 = (guint16)va_arg(ap, unsigned int);
3141 maxvisiblemsglen = (guint16)va_arg(ap, unsigned int); 3141 maxvisiblemsglen = (guint16)va_arg(ap, unsigned int);
3142 va_end(ap); 3142 va_end(ap);
3143 3143
3144 gaim_debug_misc("oscar", 3144 purple_debug_misc("oscar",
3145 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", 3145 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n",
3146 maxmsglen, maxvisiblemsglen); 3146 maxmsglen, maxvisiblemsglen);
3147 3147
3148 ccon->maxlen = maxmsglen; 3148 ccon->maxlen = maxmsglen;
3149 ccon->maxvis = maxvisiblemsglen; 3149 ccon->maxvis = maxvisiblemsglen;
3150 3150
3151 return 1; 3151 return 1;
3152 } 3152 }
3153 3153
3154 static int gaim_conv_chat_incoming_msg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3154 static int purple_conv_chat_incoming_msg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3155 GaimConnection *gc = od->gc; 3155 PurpleConnection *gc = od->gc;
3156 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn); 3156 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn);
3157 gchar *utf8; 3157 gchar *utf8;
3158 va_list ap; 3158 va_list ap;
3159 aim_userinfo_t *info; 3159 aim_userinfo_t *info;
3160 int len; 3160 int len;
3179 g_free(utf8); 3179 g_free(utf8);
3180 3180
3181 return 1; 3181 return 1;
3182 } 3182 }
3183 3183
3184 static int gaim_email_parseupdate(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3184 static int purple_email_parseupdate(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3185 va_list ap; 3185 va_list ap;
3186 GaimConnection *gc = od->gc; 3186 PurpleConnection *gc = od->gc;
3187 struct aim_emailinfo *emailinfo; 3187 struct aim_emailinfo *emailinfo;
3188 int havenewmail; 3188 int havenewmail;
3189 char *alertitle, *alerturl; 3189 char *alertitle, *alerturl;
3190 3190
3191 va_start(ap, fr); 3191 va_start(ap, fr);
3193 havenewmail = va_arg(ap, int); 3193 havenewmail = va_arg(ap, int);
3194 alertitle = va_arg(ap, char *); 3194 alertitle = va_arg(ap, char *);
3195 alerturl = va_arg(ap, char *); 3195 alerturl = va_arg(ap, char *);
3196 va_end(ap); 3196 va_end(ap);
3197 3197
3198 if ((emailinfo != NULL) && gaim_account_get_check_mail(gc->account)) { 3198 if ((emailinfo != NULL) && purple_account_get_check_mail(gc->account)) {
3199 gchar *to = g_strdup_printf("%s%s%s", gaim_account_get_username(gaim_connection_get_account(gc)), 3199 gchar *to = g_strdup_printf("%s%s%s", purple_account_get_username(purple_connection_get_account(gc)),
3200 emailinfo->domain ? "@" : "", 3200 emailinfo->domain ? "@" : "",
3201 emailinfo->domain ? emailinfo->domain : ""); 3201 emailinfo->domain ? emailinfo->domain : "");
3202 if (emailinfo->unread && havenewmail) 3202 if (emailinfo->unread && havenewmail)
3203 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); 3203 purple_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL);
3204 g_free(to); 3204 g_free(to);
3205 } 3205 }
3206 3206
3207 if (alertitle) 3207 if (alertitle)
3208 gaim_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); 3208 purple_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : "");
3209 3209
3210 return 1; 3210 return 1;
3211 } 3211 }
3212 3212
3213 static int gaim_icon_error(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3213 static int purple_icon_error(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3214 GaimConnection *gc = od->gc; 3214 PurpleConnection *gc = od->gc;
3215 char *sn; 3215 char *sn;
3216 3216
3217 sn = od->requesticon->data; 3217 sn = od->requesticon->data;
3218 gaim_debug_misc("oscar", "removing %s from hash table\n", sn); 3218 purple_debug_misc("oscar", "removing %s from hash table\n", sn);
3219 od->requesticon = g_slist_remove(od->requesticon, sn); 3219 od->requesticon = g_slist_remove(od->requesticon, sn);
3220 g_free(sn); 3220 g_free(sn);
3221 3221
3222 if (od->icontimer == 0) 3222 if (od->icontimer == 0)
3223 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); 3223 od->icontimer = purple_timeout_add(500, purple_icon_timerfunc, gc);
3224 3224
3225 return 1; 3225 return 1;
3226 } 3226 }
3227 3227
3228 static int gaim_icon_parseicon(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3228 static int purple_icon_parseicon(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3229 GaimConnection *gc = od->gc; 3229 PurpleConnection *gc = od->gc;
3230 GSList *cur; 3230 GSList *cur;
3231 va_list ap; 3231 va_list ap;
3232 char *sn; 3232 char *sn;
3233 guint8 iconcsumtype, *iconcsum, *icon; 3233 guint8 iconcsumtype, *iconcsum, *icon;
3234 guint16 iconcsumlen, iconlen; 3234 guint16 iconcsumlen, iconlen;
3246 * Some AIM clients will send a blank GIF image with iconlen 90 when 3246 * Some AIM clients will send a blank GIF image with iconlen 90 when
3247 * no icon is set. Ignore these. 3247 * no icon is set. Ignore these.
3248 */ 3248 */
3249 if ((iconlen > 0) && (iconlen != 90)) { 3249 if ((iconlen > 0) && (iconlen != 90)) {
3250 char *b16; 3250 char *b16;
3251 GaimBuddy *b; 3251 PurpleBuddy *b;
3252 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), 3252 purple_buddy_icons_set_for_user(purple_connection_get_account(gc),
3253 sn, icon, iconlen); 3253 sn, icon, iconlen);
3254 b16 = gaim_base16_encode(iconcsum, iconcsumlen); 3254 b16 = purple_base16_encode(iconcsum, iconcsumlen);
3255 b = gaim_find_buddy(gc->account, sn); 3255 b = purple_find_buddy(gc->account, sn);
3256 if ((b16 != NULL) && (b != NULL)) { 3256 if ((b16 != NULL) && (b != NULL)) {
3257 gaim_blist_node_set_string((GaimBlistNode*)b, "icon_checksum", b16); 3257 purple_blist_node_set_string((PurpleBlistNode*)b, "icon_checksum", b16);
3258 g_free(b16); 3258 g_free(b16);
3259 } 3259 }
3260 } 3260 }
3261 3261
3262 cur = od->requesticon; 3262 cur = od->requesticon;
3269 } else 3269 } else
3270 cur = cur->next; 3270 cur = cur->next;
3271 } 3271 }
3272 3272
3273 if (od->icontimer == 0) 3273 if (od->icontimer == 0)
3274 od->icontimer = gaim_timeout_add(250, gaim_icon_timerfunc, gc); 3274 od->icontimer = purple_timeout_add(250, purple_icon_timerfunc, gc);
3275 3275
3276 return 1; 3276 return 1;
3277 } 3277 }
3278 3278
3279 static gboolean gaim_icon_timerfunc(gpointer data) { 3279 static gboolean purple_icon_timerfunc(gpointer data) {
3280 GaimConnection *gc = data; 3280 PurpleConnection *gc = data;
3281 OscarData *od = gc->proto_data; 3281 OscarData *od = gc->proto_data;
3282 aim_userinfo_t *userinfo; 3282 aim_userinfo_t *userinfo;
3283 FlapConnection *conn; 3283 FlapConnection *conn;
3284 3284
3285 od->icontimer = 0; 3285 od->icontimer = 0;
3293 return FALSE; 3293 return FALSE;
3294 } 3294 }
3295 3295
3296 if (od->set_icon) { 3296 if (od->set_icon) {
3297 struct stat st; 3297 struct stat st;
3298 char *iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(gaim_connection_get_account(gc))); 3298 char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc)));
3299 if (iconfile == NULL) { 3299 if (iconfile == NULL) {
3300 aim_ssi_delicon(od); 3300 aim_ssi_delicon(od);
3301 } else if (!g_stat(iconfile, &st)) { 3301 } else if (!g_stat(iconfile, &st)) {
3302 guchar *buf = g_malloc(st.st_size); 3302 guchar *buf = g_malloc(st.st_size);
3303 FILE *file = g_fopen(iconfile, "rb"); 3303 FILE *file = g_fopen(iconfile, "rb");
3304 if (file) { 3304 if (file) {
3305 /* XXX - Use g_file_get_contents()? */ 3305 /* XXX - Use g_file_get_contents()? */
3306 fread(buf, 1, st.st_size, file); 3306 fread(buf, 1, st.st_size, file);
3307 fclose(file); 3307 fclose(file);
3308 gaim_debug_info("oscar", 3308 purple_debug_info("oscar",
3309 "Uploading icon to icon server\n"); 3309 "Uploading icon to icon server\n");
3310 aim_bart_upload(od, buf, st.st_size); 3310 aim_bart_upload(od, buf, st.st_size);
3311 } else 3311 } else
3312 gaim_debug_error("oscar", 3312 purple_debug_error("oscar",
3313 "Can't open buddy icon file!\n"); 3313 "Can't open buddy icon file!\n");
3314 g_free(buf); 3314 g_free(buf);
3315 } else { 3315 } else {
3316 gaim_debug_error("oscar", 3316 purple_debug_error("oscar",
3317 "Can't stat buddy icon file!\n"); 3317 "Can't stat buddy icon file!\n");
3318 } 3318 }
3319 g_free(iconfile); 3319 g_free(iconfile);
3320 od->set_icon = FALSE; 3320 od->set_icon = FALSE;
3321 } 3321 }
3322 3322
3323 if (!od->requesticon) { 3323 if (!od->requesticon) {
3324 gaim_debug_misc("oscar", 3324 purple_debug_misc("oscar",
3325 "no more icons to request\n"); 3325 "no more icons to request\n");
3326 return FALSE; 3326 return FALSE;
3327 } 3327 }
3328 3328
3329 userinfo = aim_locate_finduserinfo(od, (char *)od->requesticon->data); 3329 userinfo = aim_locate_finduserinfo(od, (char *)od->requesticon->data);
3334 gchar *sn = od->requesticon->data; 3334 gchar *sn = od->requesticon->data;
3335 od->requesticon = g_slist_remove(od->requesticon, sn); 3335 od->requesticon = g_slist_remove(od->requesticon, sn);
3336 g_free(sn); 3336 g_free(sn);
3337 } 3337 }
3338 3338
3339 od->icontimer = gaim_timeout_add(100, gaim_icon_timerfunc, gc); 3339 od->icontimer = purple_timeout_add(100, purple_icon_timerfunc, gc);
3340 3340
3341 return FALSE; 3341 return FALSE;
3342 } 3342 }
3343 3343
3344 /* 3344 /*
3345 * Received in response to an IM sent with the AIM_IMFLAGS_ACK option. 3345 * Received in response to an IM sent with the AIM_IMFLAGS_ACK option.
3346 */ 3346 */
3347 static int gaim_parse_msgack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3347 static int purple_parse_msgack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3348 va_list ap; 3348 va_list ap;
3349 guint16 type; 3349 guint16 type;
3350 char *sn; 3350 char *sn;
3351 3351
3352 va_start(ap, fr); 3352 va_start(ap, fr);
3353 type = (guint16) va_arg(ap, unsigned int); 3353 type = (guint16) va_arg(ap, unsigned int);
3354 sn = va_arg(ap, char *); 3354 sn = va_arg(ap, char *);
3355 va_end(ap); 3355 va_end(ap);
3356 3356
3357 gaim_debug_info("oscar", "Sent message to %s.\n", sn); 3357 purple_debug_info("oscar", "Sent message to %s.\n", sn);
3358 3358
3359 return 1; 3359 return 1;
3360 } 3360 }
3361 3361
3362 static int gaim_parse_ratechange(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3362 static int purple_parse_ratechange(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3363 static const char *codes[5] = { 3363 static const char *codes[5] = {
3364 "invalid", 3364 "invalid",
3365 "change", 3365 "change",
3366 "warning", 3366 "warning",
3367 "limit", 3367 "limit",
3381 disconnect = va_arg(ap, guint32); 3381 disconnect = va_arg(ap, guint32);
3382 currentavg = va_arg(ap, guint32); 3382 currentavg = va_arg(ap, guint32);
3383 maxavg = va_arg(ap, guint32); 3383 maxavg = va_arg(ap, guint32);
3384 va_end(ap); 3384 va_end(ap);
3385 3385
3386 gaim_debug_misc("oscar", 3386 purple_debug_misc("oscar",
3387 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " 3387 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, "
3388 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", 3388 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n",
3389 (code < 5) ? codes[code] : codes[0], 3389 (code < 5) ? codes[code] : codes[0],
3390 rateclass, 3390 rateclass,
3391 currentavg, maxavg, 3391 currentavg, maxavg,
3393 limit, disconnect, 3393 limit, disconnect,
3394 windowsize); 3394 windowsize);
3395 3395
3396 if (code == AIM_RATE_CODE_LIMIT) 3396 if (code == AIM_RATE_CODE_LIMIT)
3397 { 3397 {
3398 gaim_notify_error(od->gc, NULL, _("Rate limiting error."), 3398 purple_notify_error(od->gc, NULL, _("Rate limiting error."),
3399 _("The last action you attempted could not be " 3399 _("The last action you attempted could not be "
3400 "performed because you are over the rate limit. " 3400 "performed because you are over the rate limit. "
3401 "Please wait 10 seconds and try again.")); 3401 "Please wait 10 seconds and try again."));
3402 } 3402 }
3403 3403
3404 return 1; 3404 return 1;
3405 } 3405 }
3406 3406
3407 static int gaim_parse_evilnotify(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3407 static int purple_parse_evilnotify(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3408 #ifdef CRAZY_WARNING 3408 #ifdef CRAZY_WARNING
3409 va_list ap; 3409 va_list ap;
3410 guint16 newevil; 3410 guint16 newevil;
3411 aim_userinfo_t *userinfo; 3411 aim_userinfo_t *userinfo;
3412 3412
3413 va_start(ap, fr); 3413 va_start(ap, fr);
3414 newevil = (guint16) va_arg(ap, unsigned int); 3414 newevil = (guint16) va_arg(ap, unsigned int);
3415 userinfo = va_arg(ap, aim_userinfo_t *); 3415 userinfo = va_arg(ap, aim_userinfo_t *);
3416 va_end(ap); 3416 va_end(ap);
3417 3417
3418 gaim_prpl_got_account_warning_level(account, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); 3418 purple_prpl_got_account_warning_level(account, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5);
3419 #endif 3419 #endif
3420 3420
3421 return 1; 3421 return 1;
3422 } 3422 }
3423 3423
3424 static int gaim_selfinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3424 static int purple_selfinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3425 int warning_level; 3425 int warning_level;
3426 va_list ap; 3426 va_list ap;
3427 aim_userinfo_t *info; 3427 aim_userinfo_t *info;
3428 3428
3429 va_start(ap, fr); 3429 va_start(ap, fr);
3438 * truncated. 3438 * truncated.
3439 */ 3439 */
3440 warning_level = info->warnlevel/10.0 + 0.5; 3440 warning_level = info->warnlevel/10.0 + 0.5;
3441 3441
3442 #ifdef CRAZY_WARNING 3442 #ifdef CRAZY_WARNING
3443 gaim_presence_set_warning_level(presence, warning_level); 3443 purple_presence_set_warning_level(presence, warning_level);
3444 #endif 3444 #endif
3445 3445
3446 return 1; 3446 return 1;
3447 } 3447 }
3448 3448
3449 static int gaim_connerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3449 static int purple_connerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3450 GaimConnection *gc = od->gc; 3450 PurpleConnection *gc = od->gc;
3451 va_list ap; 3451 va_list ap;
3452 guint16 code; 3452 guint16 code;
3453 char *msg; 3453 char *msg;
3454 3454
3455 va_start(ap, fr); 3455 va_start(ap, fr);
3456 code = (guint16)va_arg(ap, int); 3456 code = (guint16)va_arg(ap, int);
3457 msg = va_arg(ap, char *); 3457 msg = va_arg(ap, char *);
3458 va_end(ap); 3458 va_end(ap);
3459 3459
3460 gaim_debug_info("oscar", "Disconnected. Code is 0x%04x and msg is %s\n", 3460 purple_debug_info("oscar", "Disconnected. Code is 0x%04x and msg is %s\n",
3461 code, (msg != NULL ? msg : "")); 3461 code, (msg != NULL ? msg : ""));
3462 3462
3463 g_return_val_if_fail(fr != NULL, 1); 3463 g_return_val_if_fail(fr != NULL, 1);
3464 g_return_val_if_fail(conn != NULL, 1); 3464 g_return_val_if_fail(conn != NULL, 1);
3465 3465
3466 if (conn->type == SNAC_FAMILY_LOCATE) { 3466 if (conn->type == SNAC_FAMILY_LOCATE) {
3467 if (code == 0x0001) { 3467 if (code == 0x0001) {
3468 gc->wants_to_die = TRUE; 3468 gc->wants_to_die = TRUE;
3469 gaim_connection_error(gc, _("You have signed on from another location.")); 3469 purple_connection_error(gc, _("You have signed on from another location."));
3470 } else { 3470 } else {
3471 gaim_connection_error(gc, _("You have been signed off for an unknown reason.")); 3471 purple_connection_error(gc, _("You have been signed off for an unknown reason."));
3472 } 3472 }
3473 od->killme = TRUE; 3473 od->killme = TRUE;
3474 } else if (conn->type == SNAC_FAMILY_CHAT) { 3474 } else if (conn->type == SNAC_FAMILY_CHAT) {
3475 struct chat_connection *cc; 3475 struct chat_connection *cc;
3476 GaimConversation *conv; 3476 PurpleConversation *conv;
3477 3477
3478 cc = find_oscar_chat_by_conn(gc, conn); 3478 cc = find_oscar_chat_by_conn(gc, conn);
3479 conv = gaim_find_chat(gc, cc->id); 3479 conv = purple_find_chat(gc, cc->id);
3480 3480
3481 if (conv != NULL) 3481 if (conv != NULL)
3482 { 3482 {
3483 gchar *buf; 3483 gchar *buf;
3484 buf = g_strdup_printf(_("You have been disconnected from chat " 3484 buf = g_strdup_printf(_("You have been disconnected from chat "
3485 "room %s."), cc->name); 3485 "room %s."), cc->name);
3486 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_ERROR, time(NULL)); 3486 purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL));
3487 g_free(buf); 3487 g_free(buf);
3488 } 3488 }
3489 oscar_chat_kill(gc, cc); 3489 oscar_chat_kill(gc, cc);
3490 } 3490 }
3491 3491
3492 return 1; 3492 return 1;
3493 } 3493 }
3494 3494
3495 static int gaim_icbm_param_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3495 static int purple_icbm_param_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3496 struct aim_icbmparameters *params; 3496 struct aim_icbmparameters *params;
3497 va_list ap; 3497 va_list ap;
3498 3498
3499 va_start(ap, fr); 3499 va_start(ap, fr);
3500 params = va_arg(ap, struct aim_icbmparameters *); 3500 params = va_arg(ap, struct aim_icbmparameters *);
3501 va_end(ap); 3501 va_end(ap);
3502 3502
3503 /* XXX - evidently this crashes on solaris. i have no clue why 3503 /* XXX - evidently this crashes on solaris. i have no clue why
3504 gaim_debug_misc("oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " 3504 purple_debug_misc("oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, "
3505 "max sender evil = %f, max receiver evil = %f, min msg interval = %u\n", 3505 "max sender evil = %f, max receiver evil = %f, min msg interval = %u\n",
3506 params->maxchan, params->flags, params->maxmsglen, 3506 params->maxchan, params->flags, params->maxmsglen,
3507 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, 3507 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0,
3508 params->minmsginterval); 3508 params->minmsginterval);
3509 */ 3509 */
3516 aim_im_setparams(od, params); 3516 aim_im_setparams(od, params);
3517 3517
3518 return 1; 3518 return 1;
3519 } 3519 }
3520 3520
3521 static int gaim_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 3521 static int purple_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
3522 { 3522 {
3523 GaimConnection *gc = od->gc; 3523 PurpleConnection *gc = od->gc;
3524 GaimAccount *account = gaim_connection_get_account(gc); 3524 PurpleAccount *account = purple_connection_get_account(gc);
3525 va_list ap; 3525 va_list ap;
3526 guint16 maxsiglen; 3526 guint16 maxsiglen;
3527 3527
3528 va_start(ap, fr); 3528 va_start(ap, fr);
3529 maxsiglen = (guint16) va_arg(ap, int); 3529 maxsiglen = (guint16) va_arg(ap, int);
3530 va_end(ap); 3530 va_end(ap);
3531 3531
3532 gaim_debug_misc("oscar", 3532 purple_debug_misc("oscar",
3533 "locate rights: max sig len = %d\n", maxsiglen); 3533 "locate rights: max sig len = %d\n", maxsiglen);
3534 3534
3535 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; 3535 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen;
3536 3536
3537 aim_locate_setcaps(od, gaim_caps); 3537 aim_locate_setcaps(od, purple_caps);
3538 oscar_set_info_and_status(account, TRUE, account->user_info, TRUE, 3538 oscar_set_info_and_status(account, TRUE, account->user_info, TRUE,
3539 gaim_account_get_active_status(account)); 3539 purple_account_get_active_status(account));
3540 3540
3541 return 1; 3541 return 1;
3542 } 3542 }
3543 3543
3544 static int gaim_parse_buddyrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3544 static int purple_parse_buddyrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3545 va_list ap; 3545 va_list ap;
3546 guint16 maxbuddies, maxwatchers; 3546 guint16 maxbuddies, maxwatchers;
3547 3547
3548 va_start(ap, fr); 3548 va_start(ap, fr);
3549 maxbuddies = (guint16) va_arg(ap, unsigned int); 3549 maxbuddies = (guint16) va_arg(ap, unsigned int);
3550 maxwatchers = (guint16) va_arg(ap, unsigned int); 3550 maxwatchers = (guint16) va_arg(ap, unsigned int);
3551 va_end(ap); 3551 va_end(ap);
3552 3552
3553 gaim_debug_misc("oscar", 3553 purple_debug_misc("oscar",
3554 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); 3554 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers);
3555 3555
3556 od->rights.maxbuddies = (guint)maxbuddies; 3556 od->rights.maxbuddies = (guint)maxbuddies;
3557 od->rights.maxwatchers = (guint)maxwatchers; 3557 od->rights.maxwatchers = (guint)maxwatchers;
3558 3558
3559 return 1; 3559 return 1;
3560 } 3560 }
3561 3561
3562 static int gaim_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3562 static int purple_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3563 GaimConnection *gc; 3563 PurpleConnection *gc;
3564 GaimAccount *account; 3564 PurpleAccount *account;
3565 GaimStatus *status; 3565 PurpleStatus *status;
3566 const char *message, *itmsurl; 3566 const char *message, *itmsurl;
3567 char *tmp; 3567 char *tmp;
3568 va_list ap; 3568 va_list ap;
3569 guint16 maxpermits, maxdenies; 3569 guint16 maxpermits, maxdenies;
3570 3570
3571 gc = od->gc; 3571 gc = od->gc;
3572 od = (OscarData *)gc->proto_data; 3572 od = (OscarData *)gc->proto_data;
3573 account = gaim_connection_get_account(gc); 3573 account = purple_connection_get_account(gc);
3574 3574
3575 va_start(ap, fr); 3575 va_start(ap, fr);
3576 maxpermits = (guint16) va_arg(ap, unsigned int); 3576 maxpermits = (guint16) va_arg(ap, unsigned int);
3577 maxdenies = (guint16) va_arg(ap, unsigned int); 3577 maxdenies = (guint16) va_arg(ap, unsigned int);
3578 va_end(ap); 3578 va_end(ap);
3579 3579
3580 gaim_debug_misc("oscar", 3580 purple_debug_misc("oscar",
3581 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); 3581 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies);
3582 3582
3583 od->rights.maxpermits = (guint)maxpermits; 3583 od->rights.maxpermits = (guint)maxpermits;
3584 od->rights.maxdenies = (guint)maxdenies; 3584 od->rights.maxdenies = (guint)maxdenies;
3585 3585
3586 gaim_connection_set_state(gc, GAIM_CONNECTED); 3586 purple_connection_set_state(gc, PURPLE_CONNECTED);
3587 3587
3588 gaim_debug_info("oscar", "buddy list loaded\n"); 3588 purple_debug_info("oscar", "buddy list loaded\n");
3589 3589
3590 aim_clientready(od, conn); 3590 aim_clientready(od, conn);
3591 3591
3592 if (gaim_account_get_user_info(account) != NULL) 3592 if (purple_account_get_user_info(account) != NULL)
3593 serv_set_info(gc, gaim_account_get_user_info(account)); 3593 serv_set_info(gc, purple_account_get_user_info(account));
3594 3594
3595 if (!od->icq) 3595 if (!od->icq)
3596 oscar_format_screenname(gc, account->username); 3596 oscar_format_screenname(gc, account->username);
3597 3597
3598 /* Set our available message based on the current status */ 3598 /* Set our available message based on the current status */
3599 status = gaim_account_get_active_status(account); 3599 status = purple_account_get_active_status(account);
3600 if (gaim_status_is_available(status)) 3600 if (purple_status_is_available(status))
3601 message = gaim_status_get_attr_string(status, "message"); 3601 message = purple_status_get_attr_string(status, "message");
3602 else 3602 else
3603 message = NULL; 3603 message = NULL;
3604 tmp = gaim_markup_strip_html(message); 3604 tmp = purple_markup_strip_html(message);
3605 itmsurl = gaim_status_get_attr_string(status, "itmsurl"); 3605 itmsurl = purple_status_get_attr_string(status, "itmsurl");
3606 aim_srv_setextrainfo(od, FALSE, 0, TRUE, tmp, itmsurl); 3606 aim_srv_setextrainfo(od, FALSE, 0, TRUE, tmp, itmsurl);
3607 g_free(tmp); 3607 g_free(tmp);
3608 3608
3609 aim_srv_setidle(od, 0); 3609 aim_srv_setidle(od, 0);
3610 3610
3611 if (od->icq) { 3611 if (od->icq) {
3612 aim_icq_reqofflinemsgs(od); 3612 aim_icq_reqofflinemsgs(od);
3613 oscar_set_extendedstatus(gc); 3613 oscar_set_extendedstatus(gc);
3614 aim_icq_setsecurity(od, 3614 aim_icq_setsecurity(od,
3615 gaim_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION), 3615 purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION),
3616 gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE)); 3616 purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE));
3617 } 3617 }
3618 3618
3619 aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV); 3619 aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV);
3620 3620
3621 /* 3621 /*
3631 aim_srv_requestnew(od, SNAC_FAMILY_ALERT); 3631 aim_srv_requestnew(od, SNAC_FAMILY_ALERT);
3632 3632
3633 return 1; 3633 return 1;
3634 } 3634 }
3635 3635
3636 static int gaim_offlinemsg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3636 static int purple_offlinemsg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3637 va_list ap; 3637 va_list ap;
3638 struct aim_icq_offlinemsg *msg; 3638 struct aim_icq_offlinemsg *msg;
3639 struct aim_incomingim_ch4_args args; 3639 struct aim_incomingim_ch4_args args;
3640 time_t t; 3640 time_t t;
3641 3641
3642 va_start(ap, fr); 3642 va_start(ap, fr);
3643 msg = va_arg(ap, struct aim_icq_offlinemsg *); 3643 msg = va_arg(ap, struct aim_icq_offlinemsg *);
3644 va_end(ap); 3644 va_end(ap);
3645 3645
3646 gaim_debug_info("oscar", 3646 purple_debug_info("oscar",
3647 "Received offline message. Converting to channel 4 ICBM...\n"); 3647 "Received offline message. Converting to channel 4 ICBM...\n");
3648 args.uin = msg->sender; 3648 args.uin = msg->sender;
3649 args.type = msg->type; 3649 args.type = msg->type;
3650 args.flags = msg->flags; 3650 args.flags = msg->flags;
3651 args.msglen = msg->msglen; 3651 args.msglen = msg->msglen;
3652 args.msg = msg->msg; 3652 args.msg = msg->msg;
3653 t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); 3653 t = purple_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
3654 incomingim_chan4(od, conn, NULL, &args, t); 3654 incomingim_chan4(od, conn, NULL, &args, t);
3655 3655
3656 return 1; 3656 return 1;
3657 } 3657 }
3658 3658
3659 static int gaim_offlinemsgdone(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 3659 static int purple_offlinemsgdone(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
3660 { 3660 {
3661 aim_icq_ackofflinemsgs(od); 3661 aim_icq_ackofflinemsgs(od);
3662 return 1; 3662 return 1;
3663 } 3663 }
3664 3664
3665 static int gaim_icqinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 3665 static int purple_icqinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
3666 { 3666 {
3667 GaimConnection *gc; 3667 PurpleConnection *gc;
3668 GaimAccount *account; 3668 PurpleAccount *account;
3669 GaimBuddy *buddy; 3669 PurpleBuddy *buddy;
3670 struct buddyinfo *bi; 3670 struct buddyinfo *bi;
3671 gchar who[16]; 3671 gchar who[16];
3672 GaimNotifyUserInfo *user_info; 3672 PurpleNotifyUserInfo *user_info;
3673 GString *tmp; 3673 GString *tmp;
3674 gchar *utf8; 3674 gchar *utf8;
3675 gchar *buf; 3675 gchar *buf;
3676 const gchar *alias; 3676 const gchar *alias;
3677 va_list ap; 3677 va_list ap;
3678 struct aim_icq_info *info; 3678 struct aim_icq_info *info;
3679 3679
3680 gc = od->gc; 3680 gc = od->gc;
3681 account = gaim_connection_get_account(gc); 3681 account = purple_connection_get_account(gc);
3682 3682
3683 va_start(ap, fr); 3683 va_start(ap, fr);
3684 info = va_arg(ap, struct aim_icq_info *); 3684 info = va_arg(ap, struct aim_icq_info *);
3685 va_end(ap); 3685 va_end(ap);
3686 3686
3687 if (!info->uin) 3687 if (!info->uin)
3688 return 0; 3688 return 0;
3689 3689
3690 user_info = gaim_notify_user_info_new(); 3690 user_info = purple_notify_user_info_new();
3691 3691
3692 g_snprintf(who, sizeof(who), "%u", info->uin); 3692 g_snprintf(who, sizeof(who), "%u", info->uin);
3693 buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); 3693 buddy = purple_find_buddy(purple_connection_get_account(gc), who);
3694 if (buddy != NULL) 3694 if (buddy != NULL)
3695 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(buddy->account, buddy->name)); 3695 bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(buddy->account, buddy->name));
3696 else 3696 else
3697 bi = NULL; 3697 bi = NULL;
3698 3698
3699 gaim_notify_user_info_add_pair(user_info, _("UIN"), who); 3699 purple_notify_user_info_add_pair(user_info, _("UIN"), who);
3700 oscar_user_info_convert_and_add(account, user_info, _("Nick"), info->nick); 3700 oscar_user_info_convert_and_add(account, user_info, _("Nick"), info->nick);
3701 if ((bi != NULL) && (bi->ipaddr != 0)) { 3701 if ((bi != NULL) && (bi->ipaddr != 0)) {
3702 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", 3702 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu",
3703 (bi->ipaddr & 0xff000000) >> 24, 3703 (bi->ipaddr & 0xff000000) >> 24,
3704 (bi->ipaddr & 0x00ff0000) >> 16, 3704 (bi->ipaddr & 0x00ff0000) >> 16,
3705 (bi->ipaddr & 0x0000ff00) >> 8, 3705 (bi->ipaddr & 0x0000ff00) >> 8,
3706 (bi->ipaddr & 0x000000ff)); 3706 (bi->ipaddr & 0x000000ff));
3707 gaim_notify_user_info_add_pair(user_info, _("IP Address"), tstr); 3707 purple_notify_user_info_add_pair(user_info, _("IP Address"), tstr);
3708 g_free(tstr); 3708 g_free(tstr);
3709 } 3709 }
3710 oscar_user_info_convert_and_add(account, user_info, _("First Name"), info->first); 3710 oscar_user_info_convert_and_add(account, user_info, _("First Name"), info->first);
3711 oscar_user_info_convert_and_add(account, user_info, _("Last Name"), info->last); 3711 oscar_user_info_convert_and_add(account, user_info, _("Last Name"), info->last);
3712 if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email))) { 3712 if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email))) {
3713 buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8); 3713 buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8);
3714 gaim_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf); 3714 purple_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf);
3715 g_free(buf); 3715 g_free(buf);
3716 g_free(utf8); 3716 g_free(utf8);
3717 } 3717 }
3718 if (info->numaddresses && info->email2) { 3718 if (info->numaddresses && info->email2) {
3719 int i; 3719 int i;
3720 for (i = 0; i < info->numaddresses; i++) { 3720 for (i = 0; i < info->numaddresses; i++) {
3721 if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email2[i]))) { 3721 if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(gc->account, info->email2[i]))) {
3722 buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8); 3722 buf = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", utf8, utf8);
3723 gaim_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf); 3723 purple_notify_user_info_add_pair(user_info, _("E-Mail Address"), buf);
3724 g_free(buf); 3724 g_free(buf);
3725 g_free(utf8); 3725 g_free(utf8);
3726 } 3726 }
3727 } 3727 }
3728 } 3728 }
3729 oscar_user_info_convert_and_add(account, user_info, _("Mobile Phone"), info->mobile); 3729 oscar_user_info_convert_and_add(account, user_info, _("Mobile Phone"), info->mobile);
3730 3730
3731 if (info->gender != 0) 3731 if (info->gender != 0)
3732 gaim_notify_user_info_add_pair(user_info, _("Gender"), (info->gender == 1 ? _("Female") : _("Male"))); 3732 purple_notify_user_info_add_pair(user_info, _("Gender"), (info->gender == 1 ? _("Female") : _("Male")));
3733 3733
3734 if ((info->birthyear > 1900) && (info->birthmonth > 0) && (info->birthday > 0)) { 3734 if ((info->birthyear > 1900) && (info->birthmonth > 0) && (info->birthday > 0)) {
3735 /* Initialize the struct properly or strftime() will crash 3735 /* Initialize the struct properly or strftime() will crash
3736 * under some conditions (e.g. Debian sarge w/ LANG=en_HK). */ 3736 * under some conditions (e.g. Debian sarge w/ LANG=en_HK). */
3737 time_t t = time(NULL); 3737 time_t t = time(NULL);
3744 /* To be 100% sure that the fields are re-normalized. 3744 /* To be 100% sure that the fields are re-normalized.
3745 * If you're sure strftime() ALWAYS does this EVERYWHERE, 3745 * If you're sure strftime() ALWAYS does this EVERYWHERE,
3746 * feel free to remove it. --rlaager */ 3746 * feel free to remove it. --rlaager */
3747 mktime(tm); 3747 mktime(tm);
3748 3748
3749 oscar_user_info_convert_and_add(account, user_info, _("Birthday"), gaim_date_format_short(tm)); 3749 oscar_user_info_convert_and_add(account, user_info, _("Birthday"), purple_date_format_short(tm));
3750 } 3750 }
3751 if ((info->age > 0) && (info->age < 255)) { 3751 if ((info->age > 0) && (info->age < 255)) {
3752 char age[5]; 3752 char age[5];
3753 snprintf(age, sizeof(age), "%hhd", info->age); 3753 snprintf(age, sizeof(age), "%hhd", info->age);
3754 gaim_notify_user_info_add_pair(user_info, 3754 purple_notify_user_info_add_pair(user_info,
3755 _("Age"), age); 3755 _("Age"), age);
3756 } 3756 }
3757 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->personalwebpage))) { 3757 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->personalwebpage))) {
3758 buf = g_strdup_printf("<a href=\"%s\">%s</a>", utf8, utf8); 3758 buf = g_strdup_printf("<a href=\"%s\">%s</a>", utf8, utf8);
3759 gaim_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf); 3759 purple_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf);
3760 g_free(buf); 3760 g_free(buf);
3761 g_free(utf8); 3761 g_free(utf8);
3762 } 3762 }
3763 3763
3764 oscar_user_info_convert_and_add(account, user_info, _("Additional Information"), info->info); 3764 oscar_user_info_convert_and_add(account, user_info, _("Additional Information"), info->info);
3765 gaim_notify_user_info_add_section_break(user_info); 3765 purple_notify_user_info_add_section_break(user_info);
3766 3766
3767 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { 3767 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) {
3768 tmp = g_string_sized_new(100); 3768 tmp = g_string_sized_new(100);
3769 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Address"), info->homeaddr); 3769 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Address"), info->homeaddr);
3770 oscar_string_convert_and_append(account, tmp, "\n<br>", _("City"), info->homecity); 3770 oscar_string_convert_and_append(account, tmp, "\n<br>", _("City"), info->homecity);
3771 oscar_string_convert_and_append(account, tmp, "\n<br>", _("State"), info->homestate); 3771 oscar_string_convert_and_append(account, tmp, "\n<br>", _("State"), info->homestate);
3772 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Zip Code"), info->homezip); 3772 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Zip Code"), info->homezip);
3773 3773
3774 gaim_notify_user_info_add_pair(user_info, _("Home Address"), tmp->str); 3774 purple_notify_user_info_add_pair(user_info, _("Home Address"), tmp->str);
3775 gaim_notify_user_info_add_section_break(user_info); 3775 purple_notify_user_info_add_section_break(user_info);
3776 3776
3777 g_string_free(tmp, TRUE); 3777 g_string_free(tmp, TRUE);
3778 } 3778 }
3779 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { 3779 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) {
3780 tmp = g_string_sized_new(100); 3780 tmp = g_string_sized_new(100);
3782 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Address"), info->workaddr); 3782 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Address"), info->workaddr);
3783 oscar_string_convert_and_append(account, tmp, "\n<br>", _("City"), info->workcity); 3783 oscar_string_convert_and_append(account, tmp, "\n<br>", _("City"), info->workcity);
3784 oscar_string_convert_and_append(account, tmp, "\n<br>", _("State"), info->workstate); 3784 oscar_string_convert_and_append(account, tmp, "\n<br>", _("State"), info->workstate);
3785 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Zip Code"), info->workzip); 3785 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Zip Code"), info->workzip);
3786 3786
3787 gaim_notify_user_info_add_pair(user_info, _("Work Address"), tmp->str); 3787 purple_notify_user_info_add_pair(user_info, _("Work Address"), tmp->str);
3788 gaim_notify_user_info_add_section_break(user_info); 3788 purple_notify_user_info_add_section_break(user_info);
3789 3789
3790 g_string_free(tmp, TRUE); 3790 g_string_free(tmp, TRUE);
3791 } 3791 }
3792 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { 3792 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) {
3793 tmp = g_string_sized_new(100); 3793 tmp = g_string_sized_new(100);
3797 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Position"), info->workposition); 3797 oscar_string_convert_and_append(account, tmp, "\n<br>", _("Position"), info->workposition);
3798 if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->workwebpage))) { 3798 if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(gc->account, info->workwebpage))) {
3799 g_string_append_printf(tmp, "\n<br><b>%s:</b> <a href=\"%s\">%s</a>", _("Web Page"), utf8, utf8); 3799 g_string_append_printf(tmp, "\n<br><b>%s:</b> <a href=\"%s\">%s</a>", _("Web Page"), utf8, utf8);
3800 g_free(utf8); 3800 g_free(utf8);
3801 } 3801 }
3802 gaim_notify_user_info_add_pair(user_info, _("Work Information"), tmp->str); 3802 purple_notify_user_info_add_pair(user_info, _("Work Information"), tmp->str);
3803 g_string_free(tmp, TRUE); 3803 g_string_free(tmp, TRUE);
3804 } 3804 }
3805 3805
3806 if (buddy != NULL) 3806 if (buddy != NULL)
3807 alias = gaim_buddy_get_alias(buddy); 3807 alias = purple_buddy_get_alias(buddy);
3808 else 3808 else
3809 alias = who; 3809 alias = who;
3810 gaim_notify_userinfo(gc, who, user_info, NULL, NULL); 3810 purple_notify_userinfo(gc, who, user_info, NULL, NULL);
3811 gaim_notify_user_info_destroy(user_info); 3811 purple_notify_user_info_destroy(user_info);
3812 3812
3813 return 1; 3813 return 1;
3814 } 3814 }
3815 3815
3816 static int gaim_icqalias(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 3816 static int purple_icqalias(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
3817 { 3817 {
3818 GaimConnection *gc = od->gc; 3818 PurpleConnection *gc = od->gc;
3819 GaimAccount *account = gaim_connection_get_account(gc); 3819 PurpleAccount *account = purple_connection_get_account(gc);
3820 gchar who[16], *utf8; 3820 gchar who[16], *utf8;
3821 GaimBuddy *b; 3821 PurpleBuddy *b;
3822 va_list ap; 3822 va_list ap;
3823 struct aim_icq_info *info; 3823 struct aim_icq_info *info;
3824 3824
3825 va_start(ap, fr); 3825 va_start(ap, fr);
3826 info = va_arg(ap, struct aim_icq_info *); 3826 info = va_arg(ap, struct aim_icq_info *);
3827 va_end(ap); 3827 va_end(ap);
3828 3828
3829 if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, info->nick))) { 3829 if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, info->nick))) {
3830 g_snprintf(who, sizeof(who), "%u", info->uin); 3830 g_snprintf(who, sizeof(who), "%u", info->uin);
3831 serv_got_alias(gc, who, utf8); 3831 serv_got_alias(gc, who, utf8);
3832 if ((b = gaim_find_buddy(gc->account, who))) { 3832 if ((b = purple_find_buddy(gc->account, who))) {
3833 gaim_blist_node_set_string((GaimBlistNode*)b, "servernick", utf8); 3833 purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8);
3834 } 3834 }
3835 g_free(utf8); 3835 g_free(utf8);
3836 } 3836 }
3837 3837
3838 return 1; 3838 return 1;
3839 } 3839 }
3840 3840
3841 static int gaim_popup(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 3841 static int purple_popup(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
3842 { 3842 {
3843 GaimConnection *gc = od->gc; 3843 PurpleConnection *gc = od->gc;
3844 gchar *text; 3844 gchar *text;
3845 va_list ap; 3845 va_list ap;
3846 char *msg, *url; 3846 char *msg, *url;
3847 guint16 wid, hei, delay; 3847 guint16 wid, hei, delay;
3848 3848
3853 hei = (guint16) va_arg(ap, int); 3853 hei = (guint16) va_arg(ap, int);
3854 delay = (guint16) va_arg(ap, int); 3854 delay = (guint16) va_arg(ap, int);
3855 va_end(ap); 3855 va_end(ap);
3856 3856
3857 text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url); 3857 text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url);
3858 gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); 3858 purple_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL);
3859 g_free(text); 3859 g_free(text);
3860 3860
3861 return 1; 3861 return 1;
3862 } 3862 }
3863 3863
3864 static void oscar_searchresults_add_buddy_cb(GaimConnection *gc, GList *row, void *user_data) 3864 static void oscar_searchresults_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data)
3865 { 3865 {
3866 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), 3866 purple_blist_request_add_buddy(purple_connection_get_account(gc),
3867 g_list_nth_data(row, 0), NULL, NULL); 3867 g_list_nth_data(row, 0), NULL, NULL);
3868 } 3868 }
3869 3869
3870 static int gaim_parse_searchreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 3870 static int purple_parse_searchreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
3871 { 3871 {
3872 GaimConnection *gc = od->gc; 3872 PurpleConnection *gc = od->gc;
3873 GaimNotifySearchResults *results; 3873 PurpleNotifySearchResults *results;
3874 GaimNotifySearchColumn *column; 3874 PurpleNotifySearchColumn *column;
3875 gchar *secondary; 3875 gchar *secondary;
3876 int i, num; 3876 int i, num;
3877 va_list ap; 3877 va_list ap;
3878 char *email, *SNs; 3878 char *email, *SNs;
3879 3879
3881 email = va_arg(ap, char *); 3881 email = va_arg(ap, char *);
3882 num = va_arg(ap, int); 3882 num = va_arg(ap, int);
3883 SNs = va_arg(ap, char *); 3883 SNs = va_arg(ap, char *);
3884 va_end(ap); 3884 va_end(ap);
3885 3885
3886 results = gaim_notify_searchresults_new(); 3886 results = purple_notify_searchresults_new();
3887 3887
3888 if (results == NULL) { 3888 if (results == NULL) {
3889 gaim_debug_error("oscar", "gaim_parse_searchreply: " 3889 purple_debug_error("oscar", "purple_parse_searchreply: "
3890 "Unable to display the search results.\n"); 3890 "Unable to display the search results.\n");
3891 gaim_notify_error(gc, NULL, 3891 purple_notify_error(gc, NULL,
3892 _("Unable to display the search results."), 3892 _("Unable to display the search results."),
3893 NULL); 3893 NULL);
3894 return 1; 3894 return 1;
3895 } 3895 }
3896 3896
3898 ngettext("The following screen name is associated with %s", 3898 ngettext("The following screen name is associated with %s",
3899 "The following screen names are associated with %s", 3899 "The following screen names are associated with %s",
3900 num), 3900 num),
3901 email); 3901 email);
3902 3902
3903 column = gaim_notify_searchresults_column_new(_("Screen name")); 3903 column = purple_notify_searchresults_column_new(_("Screen name"));
3904 gaim_notify_searchresults_column_add(results, column); 3904 purple_notify_searchresults_column_add(results, column);
3905 3905
3906 for (i = 0; i < num; i++) { 3906 for (i = 0; i < num; i++) {
3907 GList *row = NULL; 3907 GList *row = NULL;
3908 row = g_list_append(row, g_strdup(&SNs[i * (MAXSNLEN + 1)])); 3908 row = g_list_append(row, g_strdup(&SNs[i * (MAXSNLEN + 1)]));
3909 gaim_notify_searchresults_row_add(results, row); 3909 purple_notify_searchresults_row_add(results, row);
3910 } 3910 }
3911 gaim_notify_searchresults_button_add(results, GAIM_NOTIFY_BUTTON_ADD, 3911 purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD,
3912 oscar_searchresults_add_buddy_cb); 3912 oscar_searchresults_add_buddy_cb);
3913 gaim_notify_searchresults(gc, NULL, NULL, secondary, results, NULL, NULL); 3913 purple_notify_searchresults(gc, NULL, NULL, secondary, results, NULL, NULL);
3914 3914
3915 g_free(secondary); 3915 g_free(secondary);
3916 3916
3917 return 1; 3917 return 1;
3918 } 3918 }
3919 3919
3920 static int gaim_parse_searcherror(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3920 static int purple_parse_searcherror(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3921 va_list ap; 3921 va_list ap;
3922 char *email; 3922 char *email;
3923 char *buf; 3923 char *buf;
3924 3924
3925 va_start(ap, fr); 3925 va_start(ap, fr);
3926 email = va_arg(ap, char *); 3926 email = va_arg(ap, char *);
3927 va_end(ap); 3927 va_end(ap);
3928 3928
3929 buf = g_strdup_printf(_("No results found for e-mail address %s"), email); 3929 buf = g_strdup_printf(_("No results found for e-mail address %s"), email);
3930 gaim_notify_error(od->gc, NULL, buf, NULL); 3930 purple_notify_error(od->gc, NULL, buf, NULL);
3931 g_free(buf); 3931 g_free(buf);
3932 3932
3933 return 1; 3933 return 1;
3934 } 3934 }
3935 3935
3936 static int gaim_account_confirm(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3936 static int purple_account_confirm(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3937 GaimConnection *gc = od->gc; 3937 PurpleConnection *gc = od->gc;
3938 guint16 status; 3938 guint16 status;
3939 va_list ap; 3939 va_list ap;
3940 char msg[256]; 3940 char msg[256];
3941 3941
3942 va_start(ap, fr); 3942 va_start(ap, fr);
3943 status = (guint16) va_arg(ap, unsigned int); /* status code of confirmation request */ 3943 status = (guint16) va_arg(ap, unsigned int); /* status code of confirmation request */
3944 va_end(ap); 3944 va_end(ap);
3945 3945
3946 gaim_debug_info("oscar", 3946 purple_debug_info("oscar",
3947 "account confirmation returned status 0x%04x (%s)\n", status, 3947 "account confirmation returned status 0x%04x (%s)\n", status,
3948 status ? "unknown" : "e-mail sent"); 3948 status ? "unknown" : "e-mail sent");
3949 if (!status) { 3949 if (!status) {
3950 g_snprintf(msg, sizeof(msg), _("You should receive an e-mail asking to confirm %s."), 3950 g_snprintf(msg, sizeof(msg), _("You should receive an e-mail asking to confirm %s."),
3951 gaim_account_get_username(gaim_connection_get_account(gc))); 3951 purple_account_get_username(purple_connection_get_account(gc)));
3952 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); 3952 purple_notify_info(gc, NULL, _("Account Confirmation Requested"), msg);
3953 } 3953 }
3954 3954
3955 return 1; 3955 return 1;
3956 } 3956 }
3957 3957
3958 static int gaim_info_change(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3958 static int purple_info_change(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3959 GaimConnection *gc = od->gc; 3959 PurpleConnection *gc = od->gc;
3960 va_list ap; 3960 va_list ap;
3961 guint16 perms, err; 3961 guint16 perms, err;
3962 char *url, *sn, *email; 3962 char *url, *sn, *email;
3963 int change; 3963 int change;
3964 3964
3969 url = va_arg(ap, char *); 3969 url = va_arg(ap, char *);
3970 sn = va_arg(ap, char *); 3970 sn = va_arg(ap, char *);
3971 email = va_arg(ap, char *); 3971 email = va_arg(ap, char *);
3972 va_end(ap); 3972 va_end(ap);
3973 3973
3974 gaim_debug_misc("oscar", 3974 purple_debug_misc("oscar",
3975 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", 3975 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n",
3976 change ? "change" : "request", perms, err, 3976 change ? "change" : "request", perms, err,
3977 (url != NULL) ? url : "(null)", 3977 (url != NULL) ? url : "(null)",
3978 (sn != NULL) ? sn : "(null)", 3978 (sn != NULL) ? sn : "(null)",
3979 (email != NULL) ? email : "(null)"); 3979 (email != NULL) ? email : "(null)");
4002 } break; 4002 } break;
4003 default: { 4003 default: {
4004 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); 4004 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err);
4005 } break; 4005 } break;
4006 } 4006 }
4007 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); 4007 purple_notify_error(gc, NULL, dialog_top, dialog_msg);
4008 g_free(dialog_top); 4008 g_free(dialog_top);
4009 g_free(dialog_msg); 4009 g_free(dialog_msg);
4010 return 1; 4010 return 1;
4011 } 4011 }
4012 4012
4013 if (email != NULL) { 4013 if (email != NULL) {
4014 char *dialog_msg = g_strdup_printf(_("The e-mail address for %s is %s"), 4014 char *dialog_msg = g_strdup_printf(_("The e-mail address for %s is %s"),
4015 gaim_account_get_username(gaim_connection_get_account(gc)), email); 4015 purple_account_get_username(purple_connection_get_account(gc)), email);
4016 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); 4016 purple_notify_info(gc, NULL, _("Account Info"), dialog_msg);
4017 g_free(dialog_msg); 4017 g_free(dialog_msg);
4018 } 4018 }
4019 4019
4020 return 1; 4020 return 1;
4021 } 4021 }
4022 4022
4023 void 4023 void
4024 oscar_keepalive(GaimConnection *gc) 4024 oscar_keepalive(PurpleConnection *gc)
4025 { 4025 {
4026 OscarData *od; 4026 OscarData *od;
4027 FlapConnection *conn; 4027 FlapConnection *conn;
4028 4028
4029 od = (OscarData *)gc->proto_data; 4029 od = (OscarData *)gc->proto_data;
4031 if (conn != NULL) 4031 if (conn != NULL)
4032 flap_connection_send_keepalive(od, conn); 4032 flap_connection_send_keepalive(od, conn);
4033 } 4033 }
4034 4034
4035 unsigned int 4035 unsigned int
4036 oscar_send_typing(GaimConnection *gc, const char *name, GaimTypingState state) 4036 oscar_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state)
4037 { 4037 {
4038 OscarData *od; 4038 OscarData *od;
4039 PeerConnection *conn; 4039 PeerConnection *conn;
4040 4040
4041 od = (OscarData *)gc->proto_data; 4041 od = (OscarData *)gc->proto_data;
4048 else { 4048 else {
4049 /* Don't send if this turkey is in our deny list */ 4049 /* Don't send if this turkey is in our deny list */
4050 GSList *list; 4050 GSList *list;
4051 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); 4051 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next);
4052 if (!list) { 4052 if (!list) {
4053 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); 4053 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(gc->account, name));
4054 if (bi && bi->typingnot) { 4054 if (bi && bi->typingnot) {
4055 if (state == GAIM_TYPING) 4055 if (state == PURPLE_TYPING)
4056 aim_im_sendmtn(od, 0x0001, name, 0x0002); 4056 aim_im_sendmtn(od, 0x0001, name, 0x0002);
4057 else if (state == GAIM_TYPED) 4057 else if (state == PURPLE_TYPED)
4058 aim_im_sendmtn(od, 0x0001, name, 0x0001); 4058 aim_im_sendmtn(od, 0x0001, name, 0x0001);
4059 else 4059 else
4060 aim_im_sendmtn(od, 0x0001, name, 0x0000); 4060 aim_im_sendmtn(od, 0x0001, name, 0x0000);
4061 } 4061 }
4062 } 4062 }
4064 return 0; 4064 return 0;
4065 } 4065 }
4066 4066
4067 /* TODO: Move this into odc.c! */ 4067 /* TODO: Move this into odc.c! */
4068 static void 4068 static void
4069 gaim_odc_send_im(PeerConnection *conn, const char *message, GaimMessageFlags imflags) 4069 purple_odc_send_im(PeerConnection *conn, const char *message, PurpleMessageFlags imflags)
4070 { 4070 {
4071 GString *msg; 4071 GString *msg;
4072 GString *data; 4072 GString *data;
4073 gchar *tmp; 4073 gchar *tmp;
4074 int tmplen; 4074 int tmplen;
4080 msg = g_string_new("<HTML><BODY>"); 4080 msg = g_string_new("<HTML><BODY>");
4081 data = g_string_new("<BINARY>"); 4081 data = g_string_new("<BINARY>");
4082 last = message; 4082 last = message;
4083 4083
4084 /* for each valid IMG tag... */ 4084 /* for each valid IMG tag... */
4085 while (last && *last && gaim_markup_find_tag("img", last, &start, &end, &attribs)) 4085 while (last && *last && purple_markup_find_tag("img", last, &start, &end, &attribs))
4086 { 4086 {
4087 GaimStoredImage *image = NULL; 4087 PurpleStoredImage *image = NULL;
4088 const char *id; 4088 const char *id;
4089 4089
4090 if (start - last) { 4090 if (start - last) {
4091 g_string_append_len(msg, last, start - last); 4091 g_string_append_len(msg, last, start - last);
4092 } 4092 }
4093 4093
4094 id = g_datalist_get_data(&attribs, "id"); 4094 id = g_datalist_get_data(&attribs, "id");
4095 4095
4096 /* ... if it refers to a valid gaim image ... */ 4096 /* ... if it refers to a valid purple image ... */
4097 if (id && (image = gaim_imgstore_get(atoi(id)))) { 4097 if (id && (image = purple_imgstore_get(atoi(id)))) {
4098 /* ... append the message from start to the tag ... */ 4098 /* ... append the message from start to the tag ... */
4099 unsigned long size = gaim_imgstore_get_size(image); 4099 unsigned long size = purple_imgstore_get_size(image);
4100 const char *filename = gaim_imgstore_get_filename(image); 4100 const char *filename = purple_imgstore_get_filename(image);
4101 gpointer imgdata = gaim_imgstore_get_data(image); 4101 gpointer imgdata = purple_imgstore_get_data(image);
4102 4102
4103 oscar_id++; 4103 oscar_id++;
4104 4104
4105 /* ... insert a new img tag with the oscar id ... */ 4105 /* ... insert a new img tag with the oscar id ... */
4106 if (filename) 4106 if (filename)
4131 g_string_append(msg, last); 4131 g_string_append(msg, last);
4132 4132
4133 g_string_append(msg, "</BODY></HTML>"); 4133 g_string_append(msg, "</BODY></HTML>");
4134 4134
4135 /* Convert the message to a good encoding */ 4135 /* Convert the message to a good encoding */
4136 gaim_plugin_oscar_convert_to_best_encoding(conn->od->gc, 4136 purple_plugin_oscar_convert_to_best_encoding(conn->od->gc,
4137 conn->sn, msg->str, &tmp, &tmplen, &charset, &charsubset); 4137 conn->sn, msg->str, &tmp, &tmplen, &charset, &charsubset);
4138 g_string_free(msg, TRUE); 4138 g_string_free(msg, TRUE);
4139 msg = g_string_new_len(tmp, tmplen); 4139 msg = g_string_new_len(tmp, tmplen);
4140 4140
4141 /* Append any binary data that we may have */ 4141 /* Append any binary data that we may have */
4144 msg = g_string_append(msg, "</BINARY>"); 4144 msg = g_string_append(msg, "</BINARY>");
4145 } 4145 }
4146 g_string_free(data, TRUE); 4146 g_string_free(data, TRUE);
4147 4147
4148 peer_odc_send_im(conn, msg->str, msg->len, charset, 4148 peer_odc_send_im(conn, msg->str, msg->len, charset,
4149 imflags & GAIM_MESSAGE_AUTO_RESP); 4149 imflags & PURPLE_MESSAGE_AUTO_RESP);
4150 g_string_free(msg, TRUE); 4150 g_string_free(msg, TRUE);
4151 } 4151 }
4152 4152
4153 int 4153 int
4154 oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimMessageFlags imflags) 4154 oscar_send_im(PurpleConnection *gc, const char *name, const char *message, PurpleMessageFlags imflags)
4155 { 4155 {
4156 OscarData *od; 4156 OscarData *od;
4157 GaimAccount *account; 4157 PurpleAccount *account;
4158 PeerConnection *conn; 4158 PeerConnection *conn;
4159 int ret; 4159 int ret;
4160 char *iconfile; 4160 char *iconfile;
4161 char *tmp1, *tmp2; 4161 char *tmp1, *tmp2;
4162 4162
4163 od = (OscarData *)gc->proto_data; 4163 od = (OscarData *)gc->proto_data;
4164 account = gaim_connection_get_account(gc); 4164 account = purple_connection_get_account(gc);
4165 ret = 0; 4165 ret = 0;
4166 iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(account)); 4166 iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(account));
4167 4167
4168 if (imflags & GAIM_MESSAGE_AUTO_RESP) 4168 if (imflags & PURPLE_MESSAGE_AUTO_RESP)
4169 tmp1 = gaim_str_sub_away_formatters(message, name); 4169 tmp1 = purple_str_sub_away_formatters(message, name);
4170 else 4170 else
4171 tmp1 = g_strdup(message); 4171 tmp1 = g_strdup(message);
4172 4172
4173 conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); 4173 conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM);
4174 if ((conn != NULL) && (conn->ready)) 4174 if ((conn != NULL) && (conn->ready))
4175 { 4175 {
4176 /* If we're directly connected, send a direct IM */ 4176 /* If we're directly connected, send a direct IM */
4177 gaim_odc_send_im(conn, tmp1, imflags); 4177 purple_odc_send_im(conn, tmp1, imflags);
4178 } else { 4178 } else {
4179 struct buddyinfo *bi; 4179 struct buddyinfo *bi;
4180 struct aim_sendimext_args args; 4180 struct aim_sendimext_args args;
4181 struct stat st; 4181 struct stat st;
4182 gsize len; 4182 gsize len;
4183 GaimConversation *conv; 4183 PurpleConversation *conv;
4184 4184
4185 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, account); 4185 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account);
4186 4186
4187 if (strstr(tmp1, "<IMG ")) 4187 if (strstr(tmp1, "<IMG "))
4188 gaim_conversation_write(conv, "", 4188 purple_conversation_write(conv, "",
4189 _("Your IM Image was not sent. " 4189 _("Your IM Image was not sent. "
4190 "You must be Direct Connected to send IM Images."), 4190 "You must be Direct Connected to send IM Images."),
4191 GAIM_MESSAGE_ERROR, time(NULL)); 4191 PURPLE_MESSAGE_ERROR, time(NULL));
4192 4192
4193 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, name)); 4193 bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, name));
4194 if (!bi) { 4194 if (!bi) {
4195 bi = g_new0(struct buddyinfo, 1); 4195 bi = g_new0(struct buddyinfo, 1);
4196 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, name)), bi); 4196 g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, name)), bi);
4197 } 4197 }
4198 4198
4199 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; 4199 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES;
4200 if (od->icq) { 4200 if (od->icq) {
4201 /* We have to present different "features" (whose meaning 4201 /* We have to present different "features" (whose meaning
4203 to offline ICQ buddies. Otherwise, the official 4203 to offline ICQ buddies. Otherwise, the official
4204 ICQ client doesn't treat those messages as being "ANSI- 4204 ICQ client doesn't treat those messages as being "ANSI-
4205 encoded" (and instead, assumes them to be UTF-8). 4205 encoded" (and instead, assumes them to be UTF-8).
4206 For more details, see SF issue 1179452. 4206 For more details, see SF issue 1179452.
4207 */ 4207 */
4208 GaimBuddy *buddy = gaim_find_buddy(gc->account, name); 4208 PurpleBuddy *buddy = purple_find_buddy(gc->account, name);
4209 if (buddy && GAIM_BUDDY_IS_ONLINE(buddy)) { 4209 if (buddy && PURPLE_BUDDY_IS_ONLINE(buddy)) {
4210 args.features = features_icq; 4210 args.features = features_icq;
4211 args.featureslen = sizeof(features_icq); 4211 args.featureslen = sizeof(features_icq);
4212 } else { 4212 } else {
4213 args.features = features_icq_offline; 4213 args.features = features_icq_offline;
4214 args.featureslen = sizeof(features_icq_offline); 4214 args.featureslen = sizeof(features_icq_offline);
4216 args.flags |= AIM_IMFLAGS_OFFLINE; 4216 args.flags |= AIM_IMFLAGS_OFFLINE;
4217 } else { 4217 } else {
4218 args.features = features_aim; 4218 args.features = features_aim;
4219 args.featureslen = sizeof(features_aim); 4219 args.featureslen = sizeof(features_aim);
4220 4220
4221 if (imflags & GAIM_MESSAGE_AUTO_RESP) 4221 if (imflags & PURPLE_MESSAGE_AUTO_RESP)
4222 args.flags |= AIM_IMFLAGS_AWAY; 4222 args.flags |= AIM_IMFLAGS_AWAY;
4223 } 4223 }
4224 4224
4225 if (bi->ico_need) { 4225 if (bi->ico_need) {
4226 gaim_debug_info("oscar", 4226 purple_debug_info("oscar",
4227 "Sending buddy icon request with message\n"); 4227 "Sending buddy icon request with message\n");
4228 args.flags |= AIM_IMFLAGS_BUDDYREQ; 4228 args.flags |= AIM_IMFLAGS_BUDDYREQ;
4229 bi->ico_need = FALSE; 4229 bi->ico_need = FALSE;
4230 } 4230 }
4231 4231
4252 * when we're the ones who initiated the conversation. If 4252 * when we're the ones who initiated the conversation. If
4253 * the other person sends the first IM then they never get 4253 * the other person sends the first IM then they never get
4254 * the icon. We should fix that. 4254 * the icon. We should fix that.
4255 */ 4255 */
4256 if (!bi->ico_informed) { 4256 if (!bi->ico_informed) {
4257 gaim_debug_info("oscar", 4257 purple_debug_info("oscar",
4258 "Claiming to have a buddy icon\n"); 4258 "Claiming to have a buddy icon\n");
4259 args.flags |= AIM_IMFLAGS_HASICON; 4259 args.flags |= AIM_IMFLAGS_HASICON;
4260 bi->ico_me_len = args.iconlen; 4260 bi->ico_me_len = args.iconlen;
4261 bi->ico_me_csum = args.iconsum; 4261 bi->ico_me_csum = args.iconsum;
4262 bi->ico_me_time = args.iconstamp; 4262 bi->ico_me_time = args.iconstamp;
4273 /* 4273 /*
4274 * If we're IMing an SMS user or an ICQ user from an ICQ account, then strip HTML. 4274 * If we're IMing an SMS user or an ICQ user from an ICQ account, then strip HTML.
4275 */ 4275 */
4276 if (aim_sn_is_sms(name)) { 4276 if (aim_sn_is_sms(name)) {
4277 /* Messaging an SMS (mobile) user */ 4277 /* Messaging an SMS (mobile) user */
4278 tmp2 = gaim_unescape_html(tmp1); 4278 tmp2 = purple_unescape_html(tmp1);
4279 } else if (aim_sn_is_icq(gaim_account_get_username(account))) { 4279 } else if (aim_sn_is_icq(purple_account_get_username(account))) {
4280 if (aim_sn_is_icq(name)) 4280 if (aim_sn_is_icq(name))
4281 /* From ICQ to ICQ */ 4281 /* From ICQ to ICQ */
4282 tmp2 = gaim_unescape_html(tmp1); 4282 tmp2 = purple_unescape_html(tmp1);
4283 else 4283 else
4284 /* From ICQ to AIM */ 4284 /* From ICQ to AIM */
4285 tmp2 = g_strdup(tmp1); 4285 tmp2 = g_strdup(tmp1);
4286 } else { 4286 } else {
4287 /* From AIM to AIM and AIM to ICQ */ 4287 /* From AIM to AIM and AIM to ICQ */
4289 } 4289 }
4290 g_free(tmp1); 4290 g_free(tmp1);
4291 tmp1 = tmp2; 4291 tmp1 = tmp2;
4292 len = strlen(tmp1); 4292 len = strlen(tmp1);
4293 4293
4294 gaim_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset); 4294 purple_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset);
4295 gaim_debug_info("oscar", "Sending IM, charset=0x%04hx, charsubset=0x%04hx, length=%d\n", 4295 purple_debug_info("oscar", "Sending IM, charset=0x%04hx, charsubset=0x%04hx, length=%d\n",
4296 args.charset, args.charsubset, args.msglen); 4296 args.charset, args.charsubset, args.msglen);
4297 ret = aim_im_sendch1_ext(od, &args); 4297 ret = aim_im_sendch1_ext(od, &args);
4298 g_free((char *)args.msg); 4298 g_free((char *)args.msg);
4299 } 4299 }
4300 4300
4309 /* 4309 /*
4310 * As of 26 June 2006, ICQ users can request AIM info from 4310 * As of 26 June 2006, ICQ users can request AIM info from
4311 * everyone, and can request ICQ info from ICQ users, and 4311 * everyone, and can request ICQ info from ICQ users, and
4312 * AIM users can only request AIM info. 4312 * AIM users can only request AIM info.
4313 */ 4313 */
4314 void oscar_get_info(GaimConnection *gc, const char *name) { 4314 void oscar_get_info(PurpleConnection *gc, const char *name) {
4315 OscarData *od = (OscarData *)gc->proto_data; 4315 OscarData *od = (OscarData *)gc->proto_data;
4316 4316
4317 if (od->icq && aim_sn_is_icq(name)) 4317 if (od->icq && aim_sn_is_icq(name))
4318 aim_icq_getallinfo(od, name); 4318 aim_icq_getallinfo(od, name);
4319 else 4319 else
4320 aim_locate_getinfoshort(od, name, 0x00000003); 4320 aim_locate_getinfoshort(od, name, 0x00000003);
4321 } 4321 }
4322 4322
4323 #if 0 4323 #if 0
4324 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, 4324 static void oscar_set_dir(PurpleConnection *gc, const char *first, const char *middle, const char *last,
4325 const char *maiden, const char *city, const char *state, const char *country, int web) { 4325 const char *maiden, const char *city, const char *state, const char *country, int web) {
4326 /* XXX - some of these things are wrong, but i'm lazy */ 4326 /* XXX - some of these things are wrong, but i'm lazy */
4327 OscarData *od = (OscarData *)gc->proto_data; 4327 OscarData *od = (OscarData *)gc->proto_data;
4328 aim_locate_setdirinfo(od, first, middle, last, 4328 aim_locate_setdirinfo(od, first, middle, last,
4329 maiden, NULL, NULL, city, state, NULL, 0, web); 4329 maiden, NULL, NULL, city, state, NULL, 0, web);
4330 } 4330 }
4331 #endif 4331 #endif
4332 4332
4333 void oscar_set_idle(GaimConnection *gc, int time) { 4333 void oscar_set_idle(PurpleConnection *gc, int time) {
4334 OscarData *od = (OscarData *)gc->proto_data; 4334 OscarData *od = (OscarData *)gc->proto_data;
4335 aim_srv_setidle(od, time); 4335 aim_srv_setidle(od, time);
4336 } 4336 }
4337 4337
4338 static 4338 static
4339 gchar *gaim_prpl_oscar_convert_to_infotext(const gchar *str, gsize *ret_len, char **encoding) 4339 gchar *purple_prpl_oscar_convert_to_infotext(const gchar *str, gsize *ret_len, char **encoding)
4340 { 4340 {
4341 int charset = 0; 4341 int charset = 0;
4342 char *encoded = NULL; 4342 char *encoded = NULL;
4343 4343
4344 charset = oscar_charset_check(str); 4344 charset = oscar_charset_check(str);
4356 4356
4357 return encoded; 4357 return encoded;
4358 } 4358 }
4359 4359
4360 void 4360 void
4361 oscar_set_info(GaimConnection *gc, const char *rawinfo) 4361 oscar_set_info(PurpleConnection *gc, const char *rawinfo)
4362 { 4362 {
4363 GaimAccount *account; 4363 PurpleAccount *account;
4364 GaimStatus *status; 4364 PurpleStatus *status;
4365 4365
4366 account = gaim_connection_get_account(gc); 4366 account = purple_connection_get_account(gc);
4367 status = gaim_account_get_active_status(account); 4367 status = purple_account_get_active_status(account);
4368 oscar_set_info_and_status(account, TRUE, rawinfo, FALSE, status); 4368 oscar_set_info_and_status(account, TRUE, rawinfo, FALSE, status);
4369 } 4369 }
4370 4370
4371 static void 4371 static void
4372 oscar_set_extendedstatus(GaimConnection *gc) 4372 oscar_set_extendedstatus(PurpleConnection *gc)
4373 { 4373 {
4374 OscarData *od; 4374 OscarData *od;
4375 GaimAccount *account; 4375 PurpleAccount *account;
4376 GaimStatus *status; 4376 PurpleStatus *status;
4377 const gchar *status_id; 4377 const gchar *status_id;
4378 guint32 data = 0x00000000; 4378 guint32 data = 0x00000000;
4379 4379
4380 od = gc->proto_data; 4380 od = gc->proto_data;
4381 account = gaim_connection_get_account(gc); 4381 account = purple_connection_get_account(gc);
4382 status = gaim_account_get_active_status(account); 4382 status = purple_account_get_active_status(account);
4383 status_id = gaim_status_get_id(status); 4383 status_id = purple_status_get_id(status);
4384 4384
4385 data |= AIM_ICQ_STATE_HIDEIP; 4385 data |= AIM_ICQ_STATE_HIDEIP;
4386 if (gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE)) 4386 if (purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE))
4387 data |= AIM_ICQ_STATE_WEBAWARE; 4387 data |= AIM_ICQ_STATE_WEBAWARE;
4388 4388
4389 if (!strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) || !strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE)) 4389 if (!strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) || !strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE))
4390 data |= AIM_ICQ_STATE_NORMAL; 4390 data |= AIM_ICQ_STATE_NORMAL;
4391 else if (!strcmp(status_id, OSCAR_STATUS_ID_AWAY)) 4391 else if (!strcmp(status_id, OSCAR_STATUS_ID_AWAY))
4405 4405
4406 aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL); 4406 aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL);
4407 } 4407 }
4408 4408
4409 static void 4409 static void
4410 oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo, 4410 oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo,
4411 gboolean setstatus, GaimStatus *status) 4411 gboolean setstatus, PurpleStatus *status)
4412 { 4412 {
4413 GaimConnection *gc = gaim_account_get_connection(account); 4413 PurpleConnection *gc = purple_account_get_connection(account);
4414 OscarData *od = gc->proto_data; 4414 OscarData *od = gc->proto_data;
4415 GaimPresence *presence; 4415 PurplePresence *presence;
4416 GaimStatusType *status_type; 4416 PurpleStatusType *status_type;
4417 GaimStatusPrimitive primitive; 4417 PurpleStatusPrimitive primitive;
4418 gboolean invisible; 4418 gboolean invisible;
4419 4419
4420 char *htmlinfo; 4420 char *htmlinfo;
4421 char *info_encoding = NULL; 4421 char *info_encoding = NULL;
4422 char *info = NULL; 4422 char *info = NULL;
4425 const char *htmlaway; 4425 const char *htmlaway;
4426 char *away_encoding = NULL; 4426 char *away_encoding = NULL;
4427 char *away = NULL; 4427 char *away = NULL;
4428 gsize awaylen = 0; 4428 gsize awaylen = 0;
4429 4429
4430 status_type = gaim_status_get_type(status); 4430 status_type = purple_status_get_type(status);
4431 primitive = gaim_status_type_get_primitive(status_type); 4431 primitive = purple_status_type_get_primitive(status_type);
4432 presence = gaim_account_get_presence(account); 4432 presence = purple_account_get_presence(account);
4433 invisible = gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_INVISIBLE); 4433 invisible = purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE);
4434 4434
4435 if (!setinfo) 4435 if (!setinfo)
4436 { 4436 {
4437 /* Do nothing! */ 4437 /* Do nothing! */
4438 } 4438 }
4439 else if (od->rights.maxsiglen == 0) 4439 else if (od->rights.maxsiglen == 0)
4440 { 4440 {
4441 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), 4441 purple_notify_warning(gc, NULL, _("Unable to set AIM profile."),
4442 _("You have probably requested to set your " 4442 _("You have probably requested to set your "
4443 "profile before the login procedure completed. " 4443 "profile before the login procedure completed. "
4444 "Your profile remains unset; try setting it " 4444 "Your profile remains unset; try setting it "
4445 "again when you are fully connected.")); 4445 "again when you are fully connected."));
4446 } 4446 }
4447 else if (rawinfo != NULL) 4447 else if (rawinfo != NULL)
4448 { 4448 {
4449 htmlinfo = gaim_strdup_withhtml(rawinfo); 4449 htmlinfo = purple_strdup_withhtml(rawinfo);
4450 info = gaim_prpl_oscar_convert_to_infotext(htmlinfo, &infolen, &info_encoding); 4450 info = purple_prpl_oscar_convert_to_infotext(htmlinfo, &infolen, &info_encoding);
4451 g_free(htmlinfo); 4451 g_free(htmlinfo);
4452 4452
4453 if (infolen > od->rights.maxsiglen) 4453 if (infolen > od->rights.maxsiglen)
4454 { 4454 {
4455 gchar *errstr; 4455 gchar *errstr;
4456 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " 4456 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte "
4457 "has been exceeded. It has been truncated it for you.", 4457 "has been exceeded. It has been truncated it for you.",
4458 "The maximum profile length of %d bytes " 4458 "The maximum profile length of %d bytes "
4459 "has been exceeded. It has been truncated it for you.", 4459 "has been exceeded. It has been truncated it for you.",
4460 od->rights.maxsiglen), od->rights.maxsiglen); 4460 od->rights.maxsiglen), od->rights.maxsiglen);
4461 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); 4461 purple_notify_warning(gc, NULL, _("Profile too long."), errstr);
4462 g_free(errstr); 4462 g_free(errstr);
4463 } 4463 }
4464 } 4464 }
4465 4465
4466 if (!setstatus) 4466 if (!setstatus)
4467 { 4467 {
4468 /* Do nothing! */ 4468 /* Do nothing! */
4469 } 4469 }
4470 else if (primitive == GAIM_STATUS_AVAILABLE) 4470 else if (primitive == PURPLE_STATUS_AVAILABLE)
4471 { 4471 {
4472 const char *status_html, *itmsurl; 4472 const char *status_html, *itmsurl;
4473 char *status_text = NULL; 4473 char *status_text = NULL;
4474 4474
4475 status_html = gaim_status_get_attr_string(status, "message"); 4475 status_html = purple_status_get_attr_string(status, "message");
4476 if (status_html != NULL) 4476 if (status_html != NULL)
4477 { 4477 {
4478 status_text = gaim_markup_strip_html(status_html); 4478 status_text = purple_markup_strip_html(status_html);
4479 /* If the status_text is longer than 60 character then truncate it */ 4479 /* If the status_text is longer than 60 character then truncate it */
4480 if (strlen(status_text) > 60) 4480 if (strlen(status_text) > 60)
4481 { 4481 {
4482 char *tmp = g_utf8_find_prev_char(status_text, &status_text[58]); 4482 char *tmp = g_utf8_find_prev_char(status_text, &status_text[58]);
4483 strcpy(tmp, "..."); 4483 strcpy(tmp, "...");
4484 } 4484 }
4485 } 4485 }
4486 itmsurl = gaim_status_get_attr_string(status, "itmsurl"); 4486 itmsurl = purple_status_get_attr_string(status, "itmsurl");
4487 4487
4488 aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, itmsurl); 4488 aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, itmsurl);
4489 g_free(status_text); 4489 g_free(status_text);
4490 4490
4491 /* This is needed for us to un-set any previous away message. */ 4491 /* This is needed for us to un-set any previous away message. */
4492 away = g_strdup(""); 4492 away = g_strdup("");
4493 } 4493 }
4494 else if ((primitive == GAIM_STATUS_AWAY) || 4494 else if ((primitive == PURPLE_STATUS_AWAY) ||
4495 (primitive == GAIM_STATUS_EXTENDED_AWAY)) 4495 (primitive == PURPLE_STATUS_EXTENDED_AWAY))
4496 { 4496 {
4497 htmlaway = gaim_status_get_attr_string(status, "message"); 4497 htmlaway = purple_status_get_attr_string(status, "message");
4498 if ((htmlaway == NULL) || (*htmlaway == '\0')) 4498 if ((htmlaway == NULL) || (*htmlaway == '\0'))
4499 htmlaway = _("Away"); 4499 htmlaway = _("Away");
4500 away = gaim_prpl_oscar_convert_to_infotext(htmlaway, &awaylen, &away_encoding); 4500 away = purple_prpl_oscar_convert_to_infotext(htmlaway, &awaylen, &away_encoding);
4501 4501
4502 if (awaylen > od->rights.maxawaymsglen) 4502 if (awaylen > od->rights.maxawaymsglen)
4503 { 4503 {
4504 gchar *errstr; 4504 gchar *errstr;
4505 4505
4506 errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " 4506 errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte "
4507 "has been exceeded. It has been truncated for you.", 4507 "has been exceeded. It has been truncated for you.",
4508 "The maximum away message length of %d bytes " 4508 "The maximum away message length of %d bytes "
4509 "has been exceeded. It has been truncated for you.", 4509 "has been exceeded. It has been truncated for you.",
4510 od->rights.maxawaymsglen), od->rights.maxawaymsglen); 4510 od->rights.maxawaymsglen), od->rights.maxawaymsglen);
4511 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); 4511 purple_notify_warning(gc, NULL, _("Away message too long."), errstr);
4512 g_free(errstr); 4512 g_free(errstr);
4513 } 4513 }
4514 } 4514 }
4515 4515
4516 if (setstatus) 4516 if (setstatus)
4521 g_free(info); 4521 g_free(info);
4522 g_free(away); 4522 g_free(away);
4523 } 4523 }
4524 4524
4525 static void 4525 static void
4526 oscar_set_status_icq(GaimAccount *account, GaimStatus *status) 4526 oscar_set_status_icq(PurpleAccount *account, PurpleStatus *status)
4527 { 4527 {
4528 GaimConnection *gc = gaim_account_get_connection(account); 4528 PurpleConnection *gc = purple_account_get_connection(account);
4529 OscarData *od = NULL; 4529 OscarData *od = NULL;
4530 4530
4531 if (gc) 4531 if (gc)
4532 od = (OscarData *)gc->proto_data; 4532 od = (OscarData *)gc->proto_data;
4533 if (!od) 4533 if (!od)
4534 return; 4534 return;
4535 4535
4536 if (gaim_status_type_get_primitive(gaim_status_get_type(status)) == GAIM_STATUS_INVISIBLE) 4536 if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_INVISIBLE)
4537 account->perm_deny = GAIM_PRIVACY_ALLOW_USERS; 4537 account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS;
4538 else 4538 else
4539 account->perm_deny = GAIM_PRIVACY_DENY_USERS; 4539 account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
4540 4540
4541 if ((od->ssi.received_data) && (aim_ssi_getpermdeny(od->ssi.local) != account->perm_deny)) 4541 if ((od->ssi.received_data) && (aim_ssi_getpermdeny(od->ssi.local) != account->perm_deny))
4542 aim_ssi_setpermdeny(od, account->perm_deny, 0xffffffff); 4542 aim_ssi_setpermdeny(od, account->perm_deny, 0xffffffff);
4543 4543
4544 oscar_set_extendedstatus(gc); 4544 oscar_set_extendedstatus(gc);
4545 } 4545 }
4546 4546
4547 void 4547 void
4548 oscar_set_status(GaimAccount *account, GaimStatus *status) 4548 oscar_set_status(PurpleAccount *account, PurpleStatus *status)
4549 { 4549 {
4550 gaim_debug_info("oscar", "Set status to %s\n", gaim_status_get_name(status)); 4550 purple_debug_info("oscar", "Set status to %s\n", purple_status_get_name(status));
4551 4551
4552 if (!gaim_status_is_active(status)) 4552 if (!purple_status_is_active(status))
4553 return; 4553 return;
4554 4554
4555 if (!gaim_account_is_connected(account)) 4555 if (!purple_account_is_connected(account))
4556 return; 4556 return;
4557 4557
4558 /* Set the AIM-style away message for both AIM and ICQ accounts */ 4558 /* Set the AIM-style away message for both AIM and ICQ accounts */
4559 oscar_set_info_and_status(account, FALSE, NULL, TRUE, status); 4559 oscar_set_info_and_status(account, FALSE, NULL, TRUE, status);
4560 4560
4561 /* Set the ICQ status for ICQ accounts only */ 4561 /* Set the ICQ status for ICQ accounts only */
4562 if (aim_sn_is_icq(gaim_account_get_username(account))) 4562 if (aim_sn_is_icq(purple_account_get_username(account)))
4563 oscar_set_status_icq(account, status); 4563 oscar_set_status_icq(account, status);
4564 } 4564 }
4565 4565
4566 #ifdef CRAZY_WARN 4566 #ifdef CRAZY_WARN
4567 void 4567 void
4568 oscar_warn(GaimConnection *gc, const char *name, gboolean anonymous) { 4568 oscar_warn(PurpleConnection *gc, const char *name, gboolean anonymous) {
4569 OscarData *od = (OscarData *)gc->proto_data; 4569 OscarData *od = (OscarData *)gc->proto_data;
4570 aim_im_warn(od, od->conn, name, anonymous ? AIM_WARN_ANON : 0); 4570 aim_im_warn(od, od->conn, name, anonymous ? AIM_WARN_ANON : 0);
4571 } 4571 }
4572 #endif 4572 #endif
4573 4573
4574 void 4574 void
4575 oscar_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { 4575 oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {
4576 OscarData *od = (OscarData *)gc->proto_data; 4576 OscarData *od = (OscarData *)gc->proto_data;
4577 4577
4578 if (!aim_snvalid(buddy->name)) { 4578 if (!aim_snvalid(buddy->name)) {
4579 gchar *buf; 4579 gchar *buf;
4580 buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name); 4580 buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), buddy->name);
4581 if (!gaim_conv_present_error(buddy->name, gaim_connection_get_account(gc), buf)) 4581 if (!purple_conv_present_error(buddy->name, purple_connection_get_account(gc), buf))
4582 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); 4582 purple_notify_error(gc, NULL, _("Unable To Add"), buf);
4583 g_free(buf); 4583 g_free(buf);
4584 4584
4585 /* Remove from local list */ 4585 /* Remove from local list */
4586 gaim_blist_remove_buddy(buddy); 4586 purple_blist_remove_buddy(buddy);
4587 4587
4588 return; 4588 return;
4589 } 4589 }
4590 4590
4591 if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))) { 4591 if ((od->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))) {
4592 gaim_debug_info("oscar", 4592 purple_debug_info("oscar",
4593 "ssi: adding buddy %s to group %s\n", buddy->name, group->name); 4593 "ssi: adding buddy %s to group %s\n", buddy->name, group->name);
4594 aim_ssi_addbuddy(od, buddy->name, group->name, gaim_buddy_get_alias_only(buddy), NULL, NULL, 0); 4594 aim_ssi_addbuddy(od, buddy->name, group->name, purple_buddy_get_alias_only(buddy), NULL, NULL, 0);
4595 } 4595 }
4596 4596
4597 /* XXX - Should this be done from AIM accounts, as well? */ 4597 /* XXX - Should this be done from AIM accounts, as well? */
4598 if (od->icq) 4598 if (od->icq)
4599 aim_icq_getalias(od, buddy->name); 4599 aim_icq_getalias(od, buddy->name);
4600 } 4600 }
4601 4601
4602 void oscar_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { 4602 void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {
4603 OscarData *od = (OscarData *)gc->proto_data; 4603 OscarData *od = (OscarData *)gc->proto_data;
4604 4604
4605 if (od->ssi.received_data) { 4605 if (od->ssi.received_data) {
4606 gaim_debug_info("oscar", 4606 purple_debug_info("oscar",
4607 "ssi: deleting buddy %s from group %s\n", buddy->name, group->name); 4607 "ssi: deleting buddy %s from group %s\n", buddy->name, group->name);
4608 aim_ssi_delbuddy(od, buddy->name, group->name); 4608 aim_ssi_delbuddy(od, buddy->name, group->name);
4609 } 4609 }
4610 } 4610 }
4611 4611
4612 void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { 4612 void oscar_move_buddy(PurpleConnection *gc, const char *name, const char *old_group, const char *new_group) {
4613 OscarData *od = (OscarData *)gc->proto_data; 4613 OscarData *od = (OscarData *)gc->proto_data;
4614 if (od->ssi.received_data && strcmp(old_group, new_group)) { 4614 if (od->ssi.received_data && strcmp(old_group, new_group)) {
4615 gaim_debug_info("oscar", 4615 purple_debug_info("oscar",
4616 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); 4616 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group);
4617 aim_ssi_movebuddy(od, old_group, new_group, name); 4617 aim_ssi_movebuddy(od, old_group, new_group, name);
4618 } 4618 }
4619 } 4619 }
4620 4620
4621 void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { 4621 void oscar_alias_buddy(PurpleConnection *gc, const char *name, const char *alias) {
4622 OscarData *od = (OscarData *)gc->proto_data; 4622 OscarData *od = (OscarData *)gc->proto_data;
4623 if (od->ssi.received_data) { 4623 if (od->ssi.received_data) {
4624 char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); 4624 char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name);
4625 if (gname) { 4625 if (gname) {
4626 gaim_debug_info("oscar", 4626 purple_debug_info("oscar",
4627 "ssi: changing the alias for buddy %s to %s\n", name, alias ? alias : "(none)"); 4627 "ssi: changing the alias for buddy %s to %s\n", name, alias ? alias : "(none)");
4628 aim_ssi_aliasbuddy(od, gname, name, alias); 4628 aim_ssi_aliasbuddy(od, gname, name, alias);
4629 } 4629 }
4630 } 4630 }
4631 } 4631 }
4632 4632
4633 /* 4633 /*
4634 * FYI, the OSCAR SSI code removes empty groups automatically. 4634 * FYI, the OSCAR SSI code removes empty groups automatically.
4635 */ 4635 */
4636 void oscar_rename_group(GaimConnection *gc, const char *old_name, GaimGroup *group, GList *moved_buddies) { 4636 void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) {
4637 OscarData *od = (OscarData *)gc->proto_data; 4637 OscarData *od = (OscarData *)gc->proto_data;
4638 4638
4639 if (od->ssi.received_data) { 4639 if (od->ssi.received_data) {
4640 if (aim_ssi_itemlist_finditem(od->ssi.local, group->name, NULL, AIM_SSI_TYPE_GROUP)) { 4640 if (aim_ssi_itemlist_finditem(od->ssi.local, group->name, NULL, AIM_SSI_TYPE_GROUP)) {
4641 GList *cur, *groups = NULL; 4641 GList *cur, *groups = NULL;
4642 GaimAccount *account = gaim_connection_get_account(gc); 4642 PurpleAccount *account = purple_connection_get_account(gc);
4643 4643
4644 /* Make a list of what the groups each buddy is in */ 4644 /* Make a list of what the groups each buddy is in */
4645 for (cur = moved_buddies; cur != NULL; cur = cur->next) { 4645 for (cur = moved_buddies; cur != NULL; cur = cur->next) {
4646 GaimBlistNode *node = cur->data; 4646 PurpleBlistNode *node = cur->data;
4647 /* node is GaimBuddy, parent is a GaimContact. 4647 /* node is PurpleBuddy, parent is a PurpleContact.
4648 * We must go two levels up to get the Group */ 4648 * We must go two levels up to get the Group */
4649 groups = g_list_append(groups, 4649 groups = g_list_append(groups,
4650 node->parent->parent); 4650 node->parent->parent);
4651 } 4651 }
4652 4652
4653 gaim_account_remove_buddies(account, moved_buddies, groups); 4653 purple_account_remove_buddies(account, moved_buddies, groups);
4654 gaim_account_add_buddies(account, moved_buddies); 4654 purple_account_add_buddies(account, moved_buddies);
4655 g_list_free(groups); 4655 g_list_free(groups);
4656 gaim_debug_info("oscar", 4656 purple_debug_info("oscar",
4657 "ssi: moved all buddies from group %s to %s\n", old_name, group->name); 4657 "ssi: moved all buddies from group %s to %s\n", old_name, group->name);
4658 } else { 4658 } else {
4659 aim_ssi_rename_group(od, old_name, group->name); 4659 aim_ssi_rename_group(od, old_name, group->name);
4660 gaim_debug_info("oscar", 4660 purple_debug_info("oscar",
4661 "ssi: renamed group %s to %s\n", old_name, group->name); 4661 "ssi: renamed group %s to %s\n", old_name, group->name);
4662 } 4662 }
4663 } 4663 }
4664 } 4664 }
4665 4665
4666 static gboolean gaim_ssi_rerequestdata(gpointer data) { 4666 static gboolean purple_ssi_rerequestdata(gpointer data) {
4667 OscarData *od = data; 4667 OscarData *od = data;
4668 4668
4669 aim_ssi_reqdata(od); 4669 aim_ssi_reqdata(od);
4670 4670
4671 return TRUE; 4671 return TRUE;
4672 } 4672 }
4673 4673
4674 static int gaim_ssi_parseerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 4674 static int purple_ssi_parseerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
4675 GaimConnection *gc = od->gc; 4675 PurpleConnection *gc = od->gc;
4676 va_list ap; 4676 va_list ap;
4677 guint16 reason; 4677 guint16 reason;
4678 4678
4679 va_start(ap, fr); 4679 va_start(ap, fr);
4680 reason = (guint16)va_arg(ap, unsigned int); 4680 reason = (guint16)va_arg(ap, unsigned int);
4681 va_end(ap); 4681 va_end(ap);
4682 4682
4683 gaim_debug_error("oscar", "ssi: SNAC error %hu\n", reason); 4683 purple_debug_error("oscar", "ssi: SNAC error %hu\n", reason);
4684 4684
4685 if (reason == 0x0005) { 4685 if (reason == 0x0005) {
4686 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), 4686 purple_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"),
4687 _("The AIM servers were temporarily unable to send your buddy list. Your buddy list is not lost, and will probably become available in a few hours.")); 4687 _("The AIM servers were temporarily unable to send your buddy list. Your buddy list is not lost, and will probably become available in a few hours."));
4688 if (od->getblisttimer > 0) 4688 if (od->getblisttimer > 0)
4689 gaim_timeout_remove(od->getblisttimer); 4689 purple_timeout_remove(od->getblisttimer);
4690 od->getblisttimer = gaim_timeout_add(30000, gaim_ssi_rerequestdata, od); 4690 od->getblisttimer = purple_timeout_add(30000, purple_ssi_rerequestdata, od);
4691 } 4691 }
4692 4692
4693 oscar_set_extendedstatus(gc); 4693 oscar_set_extendedstatus(gc);
4694 4694
4695 /* Activate SSI */ 4695 /* Activate SSI */
4696 /* Sending the enable causes other people to be able to see you, and you to see them */ 4696 /* Sending the enable causes other people to be able to see you, and you to see them */
4697 /* Make sure your privacy setting/invisibility is set how you want it before this! */ 4697 /* Make sure your privacy setting/invisibility is set how you want it before this! */
4698 gaim_debug_info("oscar", "ssi: activating server-stored buddy list\n"); 4698 purple_debug_info("oscar", "ssi: activating server-stored buddy list\n");
4699 aim_ssi_enable(od); 4699 aim_ssi_enable(od);
4700 4700
4701 return 1; 4701 return 1;
4702 } 4702 }
4703 4703
4704 static int gaim_ssi_parserights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 4704 static int purple_ssi_parserights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
4705 int i; 4705 int i;
4706 va_list ap; 4706 va_list ap;
4707 int numtypes; 4707 int numtypes;
4708 guint16 *maxitems; 4708 guint16 *maxitems;
4709 4709
4710 va_start(ap, fr); 4710 va_start(ap, fr);
4711 numtypes = va_arg(ap, int); 4711 numtypes = va_arg(ap, int);
4712 maxitems = va_arg(ap, guint16 *); 4712 maxitems = va_arg(ap, guint16 *);
4713 va_end(ap); 4713 va_end(ap);
4714 4714
4715 gaim_debug_misc("oscar", "ssi rights:"); 4715 purple_debug_misc("oscar", "ssi rights:");
4716 4716
4717 for (i=0; i<numtypes; i++) 4717 for (i=0; i<numtypes; i++)
4718 gaim_debug_misc(NULL, " max type 0x%04x=%hd,", 4718 purple_debug_misc(NULL, " max type 0x%04x=%hd,",
4719 i, maxitems[i]); 4719 i, maxitems[i]);
4720 4720
4721 gaim_debug_misc(NULL, "\n"); 4721 purple_debug_misc(NULL, "\n");
4722 4722
4723 if (numtypes >= 0) 4723 if (numtypes >= 0)
4724 od->rights.maxbuddies = maxitems[0]; 4724 od->rights.maxbuddies = maxitems[0];
4725 if (numtypes >= 1) 4725 if (numtypes >= 1)
4726 od->rights.maxgroups = maxitems[1]; 4726 od->rights.maxgroups = maxitems[1];
4730 od->rights.maxdenies = maxitems[3]; 4730 od->rights.maxdenies = maxitems[3];
4731 4731
4732 return 1; 4732 return 1;
4733 } 4733 }
4734 4734
4735 static int gaim_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) 4735 static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
4736 { 4736 {
4737 GaimConnection *gc; 4737 PurpleConnection *gc;
4738 GaimAccount *account; 4738 PurpleAccount *account;
4739 GaimGroup *g; 4739 PurpleGroup *g;
4740 GaimBuddy *b; 4740 PurpleBuddy *b;
4741 struct aim_ssi_item *curitem; 4741 struct aim_ssi_item *curitem;
4742 guint32 tmp; 4742 guint32 tmp;
4743 const char *icon_path, *cached_icon_path; 4743 const char *icon_path, *cached_icon_path;
4744 va_list ap; 4744 va_list ap;
4745 guint16 fmtver, numitems; 4745 guint16 fmtver, numitems;
4746 guint32 timestamp; 4746 guint32 timestamp;
4747 4747
4748 gc = od->gc; 4748 gc = od->gc;
4749 od = gc->proto_data; 4749 od = gc->proto_data;
4750 account = gaim_connection_get_account(gc); 4750 account = purple_connection_get_account(gc);
4751 4751
4752 va_start(ap, fr); 4752 va_start(ap, fr);
4753 fmtver = (guint16)va_arg(ap, int); 4753 fmtver = (guint16)va_arg(ap, int);
4754 numitems = (guint16)va_arg(ap, int); 4754 numitems = (guint16)va_arg(ap, int);
4755 timestamp = va_arg(ap, guint32); 4755 timestamp = va_arg(ap, guint32);
4756 va_end(ap); 4756 va_end(ap);
4757 4757
4758 /* Don't attempt to re-request our buddy list later */ 4758 /* Don't attempt to re-request our buddy list later */
4759 if (od->getblisttimer != 0) 4759 if (od->getblisttimer != 0)
4760 gaim_timeout_remove(od->getblisttimer); 4760 purple_timeout_remove(od->getblisttimer);
4761 od->getblisttimer = 0; 4761 od->getblisttimer = 0;
4762 4762
4763 gaim_debug_info("oscar", 4763 purple_debug_info("oscar",
4764 "ssi: syncing local list and server list\n"); 4764 "ssi: syncing local list and server list\n");
4765 4765
4766 if ((timestamp == 0) || (numitems == 0)) { 4766 if ((timestamp == 0) || (numitems == 0)) {
4767 gaim_debug_info("oscar", "Got AIM SSI with a 0 timestamp or 0 numitems--not syncing. This probably means your buddy list is empty.", NULL); 4767 purple_debug_info("oscar", "Got AIM SSI with a 0 timestamp or 0 numitems--not syncing. This probably means your buddy list is empty.", NULL);
4768 return 1; 4768 return 1;
4769 } 4769 }
4770 4770
4771 /* Clean the buddy list */ 4771 /* Clean the buddy list */
4772 aim_ssi_cleanlist(od); 4772 aim_ssi_cleanlist(od);
4773 4773
4774 { /* If not in server list then prune from local list */ 4774 { /* If not in server list then prune from local list */
4775 GaimBlistNode *gnode, *cnode, *bnode; 4775 PurpleBlistNode *gnode, *cnode, *bnode;
4776 GaimBuddyList *blist; 4776 PurpleBuddyList *blist;
4777 GSList *cur, *next; 4777 GSList *cur, *next;
4778 4778
4779 /* Buddies */ 4779 /* Buddies */
4780 cur = NULL; 4780 cur = NULL;
4781 if ((blist = gaim_get_blist()) != NULL) { 4781 if ((blist = purple_get_blist()) != NULL) {
4782 for (gnode = blist->root; gnode; gnode = gnode->next) { 4782 for (gnode = blist->root; gnode; gnode = gnode->next) {
4783 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) 4783 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
4784 continue; 4784 continue;
4785 g = (GaimGroup *)gnode; 4785 g = (PurpleGroup *)gnode;
4786 for (cnode = gnode->child; cnode; cnode = cnode->next) { 4786 for (cnode = gnode->child; cnode; cnode = cnode->next) {
4787 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) 4787 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
4788 continue; 4788 continue;
4789 for (bnode = cnode->child; bnode; bnode = bnode->next) { 4789 for (bnode = cnode->child; bnode; bnode = bnode->next) {
4790 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) 4790 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
4791 continue; 4791 continue;
4792 b = (GaimBuddy *)bnode; 4792 b = (PurpleBuddy *)bnode;
4793 if (b->account == gc->account) { 4793 if (b->account == gc->account) {
4794 if (aim_ssi_itemlist_exists(od->ssi.local, b->name)) { 4794 if (aim_ssi_itemlist_exists(od->ssi.local, b->name)) {
4795 /* If the buddy is an ICQ user then load his nickname */ 4795 /* If the buddy is an ICQ user then load his nickname */
4796 const char *servernick = gaim_blist_node_get_string((GaimBlistNode*)b, "servernick"); 4796 const char *servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick");
4797 char *alias; 4797 char *alias;
4798 if (servernick) 4798 if (servernick)
4799 serv_got_alias(gc, b->name, servernick); 4799 serv_got_alias(gc, b->name, servernick);
4800 4800
4801 /* Store local alias on server */ 4801 /* Store local alias on server */
4802 alias = aim_ssi_getalias(od->ssi.local, g->name, b->name); 4802 alias = aim_ssi_getalias(od->ssi.local, g->name, b->name);
4803 if (!alias && b->alias && strlen(b->alias)) 4803 if (!alias && b->alias && strlen(b->alias))
4804 aim_ssi_aliasbuddy(od, g->name, b->name, b->alias); 4804 aim_ssi_aliasbuddy(od, g->name, b->name, b->alias);
4805 g_free(alias); 4805 g_free(alias);
4806 } else { 4806 } else {
4807 gaim_debug_info("oscar", 4807 purple_debug_info("oscar",
4808 "ssi: removing buddy %s from local list\n", b->name); 4808 "ssi: removing buddy %s from local list\n", b->name);
4809 /* We can't actually remove now because it will screw up our looping */ 4809 /* We can't actually remove now because it will screw up our looping */
4810 cur = g_slist_prepend(cur, b); 4810 cur = g_slist_prepend(cur, b);
4811 } 4811 }
4812 } 4812 }
4816 } 4816 }
4817 4817
4818 while (cur != NULL) { 4818 while (cur != NULL) {
4819 b = cur->data; 4819 b = cur->data;
4820 cur = g_slist_remove(cur, b); 4820 cur = g_slist_remove(cur, b);
4821 gaim_blist_remove_buddy(b); 4821 purple_blist_remove_buddy(b);
4822 } 4822 }
4823 4823
4824 /* Permit list */ 4824 /* Permit list */
4825 if (gc->account->permit) { 4825 if (gc->account->permit) {
4826 next = gc->account->permit; 4826 next = gc->account->permit;
4827 while (next != NULL) { 4827 while (next != NULL) {
4828 cur = next; 4828 cur = next;
4829 next = next->next; 4829 next = next->next;
4830 if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { 4830 if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) {
4831 gaim_debug_info("oscar", 4831 purple_debug_info("oscar",
4832 "ssi: removing permit %s from local list\n", (const char *)cur->data); 4832 "ssi: removing permit %s from local list\n", (const char *)cur->data);
4833 gaim_privacy_permit_remove(account, cur->data, TRUE); 4833 purple_privacy_permit_remove(account, cur->data, TRUE);
4834 } 4834 }
4835 } 4835 }
4836 } 4836 }
4837 4837
4838 /* Deny list */ 4838 /* Deny list */
4840 next = gc->account->deny; 4840 next = gc->account->deny;
4841 while (next != NULL) { 4841 while (next != NULL) {
4842 cur = next; 4842 cur = next;
4843 next = next->next; 4843 next = next->next;
4844 if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { 4844 if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) {
4845 gaim_debug_info("oscar", 4845 purple_debug_info("oscar",
4846 "ssi: removing deny %s from local list\n", (const char *)cur->data); 4846 "ssi: removing deny %s from local list\n", (const char *)cur->data);
4847 gaim_privacy_deny_remove(account, cur->data, TRUE); 4847 purple_privacy_deny_remove(account, cur->data, TRUE);
4848 } 4848 }
4849 } 4849 }
4850 } 4850 }
4851 /* Presence settings (idle time visibility) */ 4851 /* Presence settings (idle time visibility) */
4852 if ((tmp = aim_ssi_getpresence(od->ssi.local)) != 0xFFFFFFFF) 4852 if ((tmp = aim_ssi_getpresence(od->ssi.local)) != 0xFFFFFFFF)
4873 alias_utf8 = oscar_utf8_try_convert(account, alias); 4873 alias_utf8 = oscar_utf8_try_convert(account, alias);
4874 } 4874 }
4875 else 4875 else
4876 alias_utf8 = NULL; 4876 alias_utf8 = NULL;
4877 4877
4878 b = gaim_find_buddy(gc->account, curitem->name); 4878 b = purple_find_buddy(gc->account, curitem->name);
4879 /* Should gname be freed here? -- elb */ 4879 /* Should gname be freed here? -- elb */
4880 /* Not with the current code, but that might be cleaner -- med */ 4880 /* Not with the current code, but that might be cleaner -- med */
4881 g_free(alias); 4881 g_free(alias);
4882 if (b) { 4882 if (b) {
4883 /* Get server stored alias */ 4883 /* Get server stored alias */
4884 if (alias_utf8) { 4884 if (alias_utf8) {
4885 g_free(b->alias); 4885 g_free(b->alias);
4886 b->alias = g_strdup(alias_utf8); 4886 b->alias = g_strdup(alias_utf8);
4887 } 4887 }
4888 } else { 4888 } else {
4889 b = gaim_buddy_new(gc->account, curitem->name, alias_utf8); 4889 b = purple_buddy_new(gc->account, curitem->name, alias_utf8);
4890 4890
4891 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { 4891 if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
4892 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); 4892 g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
4893 gaim_blist_add_group(g, NULL); 4893 purple_blist_add_group(g, NULL);
4894 } 4894 }
4895 4895
4896 gaim_debug_info("oscar", 4896 purple_debug_info("oscar",
4897 "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); 4897 "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans"));
4898 gaim_blist_add_buddy(b, NULL, g, NULL); 4898 purple_blist_add_buddy(b, NULL, g, NULL);
4899 } 4899 }
4900 if (!aim_sncmp(curitem->name, account->username)) { 4900 if (!aim_sncmp(curitem->name, account->username)) {
4901 char *comment = aim_ssi_getcomment(od->ssi.local, gname, curitem->name); 4901 char *comment = aim_ssi_getcomment(od->ssi.local, gname, curitem->name);
4902 if (comment != NULL) 4902 if (comment != NULL)
4903 { 4903 {
4904 gaim_check_comment(od, comment); 4904 purple_check_comment(od, comment);
4905 g_free(comment); 4905 g_free(comment);
4906 } 4906 }
4907 } 4907 }
4908 g_free(gname_utf8); 4908 g_free(gname_utf8);
4909 g_free(alias_utf8); 4909 g_free(alias_utf8);
4918 if (curitem->name) { 4918 if (curitem->name) {
4919 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ 4919 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */
4920 GSList *list; 4920 GSList *list;
4921 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); 4921 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
4922 if (!list) { 4922 if (!list) {
4923 gaim_debug_info("oscar", 4923 purple_debug_info("oscar",
4924 "ssi: adding permit buddy %s to local list\n", curitem->name); 4924 "ssi: adding permit buddy %s to local list\n", curitem->name);
4925 gaim_privacy_permit_add(account, curitem->name, TRUE); 4925 purple_privacy_permit_add(account, curitem->name, TRUE);
4926 } 4926 }
4927 } 4927 }
4928 } break; 4928 } break;
4929 4929
4930 case 0x0003: { /* Deny buddy */ 4930 case 0x0003: { /* Deny buddy */
4931 if (curitem->name) { 4931 if (curitem->name) {
4932 GSList *list; 4932 GSList *list;
4933 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); 4933 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
4934 if (!list) { 4934 if (!list) {
4935 gaim_debug_info("oscar", 4935 purple_debug_info("oscar",
4936 "ssi: adding deny buddy %s to local list\n", curitem->name); 4936 "ssi: adding deny buddy %s to local list\n", curitem->name);
4937 gaim_privacy_deny_add(account, curitem->name, TRUE); 4937 purple_privacy_deny_add(account, curitem->name, TRUE);
4938 } 4938 }
4939 } 4939 }
4940 } break; 4940 } break;
4941 4941
4942 case 0x0004: { /* Permit/deny setting */ 4942 case 0x0004: { /* Permit/deny setting */
4943 if (curitem->data) { 4943 if (curitem->data) {
4944 guint8 permdeny; 4944 guint8 permdeny;
4945 if ((permdeny = aim_ssi_getpermdeny(od->ssi.local)) && (permdeny != account->perm_deny)) { 4945 if ((permdeny = aim_ssi_getpermdeny(od->ssi.local)) && (permdeny != account->perm_deny)) {
4946 gaim_debug_info("oscar", 4946 purple_debug_info("oscar",
4947 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); 4947 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny);
4948 account->perm_deny = permdeny; 4948 account->perm_deny = permdeny;
4949 if (od->icq && account->perm_deny == GAIM_PRIVACY_ALLOW_USERS) { 4949 if (od->icq && account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) {
4950 gaim_presence_set_status_active(account->presence, OSCAR_STATUS_ID_INVISIBLE, TRUE); 4950 purple_presence_set_status_active(account->presence, OSCAR_STATUS_ID_INVISIBLE, TRUE);
4951 } 4951 }
4952 } 4952 }
4953 } 4953 }
4954 } break; 4954 } break;
4955 4955
4956 case 0x0005: { /* Presence setting */ 4956 case 0x0005: { /* Presence setting */
4957 /* We don't want to change Gaim's setting because it applies to all accounts */ 4957 /* We don't want to change Purple's setting because it applies to all accounts */
4958 } break; 4958 } break;
4959 } /* End of switch on curitem->type */ 4959 } /* End of switch on curitem->type */
4960 } /* End of for loop */ 4960 } /* End of for loop */
4961 4961
4962 oscar_set_extendedstatus(gc); 4962 oscar_set_extendedstatus(gc);
4963 4963
4964 /* Activate SSI */ 4964 /* Activate SSI */
4965 /* Sending the enable causes other people to be able to see you, and you to see them */ 4965 /* Sending the enable causes other people to be able to see you, and you to see them */
4966 /* Make sure your privacy setting/invisibility is set how you want it before this! */ 4966 /* Make sure your privacy setting/invisibility is set how you want it before this! */
4967 gaim_debug_info("oscar", 4967 purple_debug_info("oscar",
4968 "ssi: activating server-stored buddy list\n"); 4968 "ssi: activating server-stored buddy list\n");
4969 aim_ssi_enable(od); 4969 aim_ssi_enable(od);
4970 4970
4971 /* 4971 /*
4972 * Make sure our server-stored icon is updated correctly in 4972 * Make sure our server-stored icon is updated correctly in
4973 * the event that the local user set a new icon while this 4973 * the event that the local user set a new icon while this
4974 * account was offline. 4974 * account was offline.
4975 */ 4975 */
4976 icon_path = gaim_account_get_buddy_icon(account); 4976 icon_path = purple_account_get_buddy_icon(account);
4977 cached_icon_path = gaim_buddy_icons_get_full_path(icon_path); 4977 cached_icon_path = purple_buddy_icons_get_full_path(icon_path);
4978 oscar_set_icon(gc, cached_icon_path); 4978 oscar_set_icon(gc, cached_icon_path);
4979 4979
4980 return 1; 4980 return 1;
4981 } 4981 }
4982 4982
4983 static int gaim_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 4983 static int purple_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
4984 GaimConnection *gc = od->gc; 4984 PurpleConnection *gc = od->gc;
4985 va_list ap; 4985 va_list ap;
4986 struct aim_ssi_tmp *retval; 4986 struct aim_ssi_tmp *retval;
4987 4987
4988 va_start(ap, fr); 4988 va_start(ap, fr);
4989 retval = va_arg(ap, struct aim_ssi_tmp *); 4989 retval = va_arg(ap, struct aim_ssi_tmp *);
4990 va_end(ap); 4990 va_end(ap);
4991 4991
4992 while (retval) { 4992 while (retval) {
4993 gaim_debug_misc("oscar", 4993 purple_debug_misc("oscar",
4994 "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack, retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item"); 4994 "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack, retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item");
4995 4995
4996 if (retval->ack != 0xffff) 4996 if (retval->ack != 0xffff)
4997 switch (retval->ack) { 4997 switch (retval->ack) {
4998 case 0x0000: { /* added successfully */ 4998 case 0x0000: { /* added successfully */
4999 } break; 4999 } break;
5000 5000
5001 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ 5001 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */
5002 gchar *buf; 5002 gchar *buf;
5003 buf = g_strdup_printf(_("Could not add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)"))); 5003 buf = g_strdup_printf(_("Could not add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)")));
5004 if ((retval->name != NULL) && !gaim_conv_present_error(retval->name, gaim_connection_get_account(gc), buf)) 5004 if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf))
5005 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); 5005 purple_notify_error(gc, NULL, _("Unable To Add"), buf);
5006 g_free(buf); 5006 g_free(buf);
5007 } 5007 }
5008 5008
5009 case 0x000e: { /* buddy requires authorization */ 5009 case 0x000e: { /* buddy requires authorization */
5010 if ((retval->action == SNAC_SUBTYPE_FEEDBAG_ADD) && (retval->name)) 5010 if ((retval->action == SNAC_SUBTYPE_FEEDBAG_ADD) && (retval->name))
5011 gaim_auth_sendrequest(gc, retval->name); 5011 purple_auth_sendrequest(gc, retval->name);
5012 } break; 5012 } break;
5013 5013
5014 default: { /* La la la */ 5014 default: { /* La la la */
5015 gchar *buf; 5015 gchar *buf;
5016 gaim_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); 5016 purple_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack);
5017 buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason. The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)"))); 5017 buf = g_strdup_printf(_("Could not add the buddy %s for an unknown reason. The most common reason for this is that you have the maximum number of allowed buddies in your buddy list."), (retval->name ? retval->name : _("(no name)")));
5018 if ((retval->name != NULL) && !gaim_conv_present_error(retval->name, gaim_connection_get_account(gc), buf)) 5018 if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf))
5019 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); 5019 purple_notify_error(gc, NULL, _("Unable To Add"), buf);
5020 g_free(buf); 5020 g_free(buf);
5021 } break; 5021 } break;
5022 } 5022 }
5023 5023
5024 retval = retval->next; 5024 retval = retval->next;
5025 } 5025 }
5026 5026
5027 return 1; 5027 return 1;
5028 } 5028 }
5029 5029
5030 static int gaim_ssi_parseadd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 5030 static int purple_ssi_parseadd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
5031 GaimConnection *gc = od->gc; 5031 PurpleConnection *gc = od->gc;
5032 char *gname, *gname_utf8, *alias, *alias_utf8; 5032 char *gname, *gname_utf8, *alias, *alias_utf8;
5033 GaimBuddy *b; 5033 PurpleBuddy *b;
5034 GaimGroup *g; 5034 PurpleGroup *g;
5035 va_list ap; 5035 va_list ap;
5036 guint16 type; 5036 guint16 type;
5037 const char *name; 5037 const char *name;
5038 5038
5039 va_start(ap, fr); 5039 va_start(ap, fr);
5051 if (alias != NULL) 5051 if (alias != NULL)
5052 { 5052 {
5053 if (g_utf8_validate(alias, -1, NULL)) 5053 if (g_utf8_validate(alias, -1, NULL))
5054 alias_utf8 = g_strdup(alias); 5054 alias_utf8 = g_strdup(alias);
5055 else 5055 else
5056 alias_utf8 = oscar_utf8_try_convert(gaim_connection_get_account(gc), alias); 5056 alias_utf8 = oscar_utf8_try_convert(purple_connection_get_account(gc), alias);
5057 } 5057 }
5058 else 5058 else
5059 alias_utf8 = NULL; 5059 alias_utf8 = NULL;
5060 5060
5061 b = gaim_find_buddy(gc->account, name); 5061 b = purple_find_buddy(gc->account, name);
5062 g_free(alias); 5062 g_free(alias);
5063 5063
5064 if (b) { 5064 if (b) {
5065 /* Get server stored alias */ 5065 /* Get server stored alias */
5066 if (alias_utf8) { 5066 if (alias_utf8) {
5067 g_free(b->alias); 5067 g_free(b->alias);
5068 b->alias = g_strdup(alias_utf8); 5068 b->alias = g_strdup(alias_utf8);
5069 } 5069 }
5070 } else { 5070 } else {
5071 b = gaim_buddy_new(gc->account, name, alias_utf8); 5071 b = purple_buddy_new(gc->account, name, alias_utf8);
5072 5072
5073 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { 5073 if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) {
5074 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); 5074 g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans"));
5075 gaim_blist_add_group(g, NULL); 5075 purple_blist_add_group(g, NULL);
5076 } 5076 }
5077 5077
5078 gaim_debug_info("oscar", 5078 purple_debug_info("oscar",
5079 "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); 5079 "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans"));
5080 gaim_blist_add_buddy(b, NULL, g, NULL); 5080 purple_blist_add_buddy(b, NULL, g, NULL);
5081 } 5081 }
5082 g_free(gname_utf8); 5082 g_free(gname_utf8);
5083 g_free(alias_utf8); 5083 g_free(alias_utf8);
5084 5084
5085 return 1; 5085 return 1;
5086 } 5086 }
5087 5087
5088 static int gaim_ssi_authgiven(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 5088 static int purple_ssi_authgiven(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
5089 GaimConnection *gc = od->gc; 5089 PurpleConnection *gc = od->gc;
5090 va_list ap; 5090 va_list ap;
5091 char *sn, *msg; 5091 char *sn, *msg;
5092 gchar *dialog_msg, *nombre; 5092 gchar *dialog_msg, *nombre;
5093 struct name_data *data; 5093 struct name_data *data;
5094 GaimBuddy *buddy; 5094 PurpleBuddy *buddy;
5095 5095
5096 va_start(ap, fr); 5096 va_start(ap, fr);
5097 sn = va_arg(ap, char *); 5097 sn = va_arg(ap, char *);
5098 msg = va_arg(ap, char *); 5098 msg = va_arg(ap, char *);
5099 va_end(ap); 5099 va_end(ap);
5100 5100
5101 gaim_debug_info("oscar", 5101 purple_debug_info("oscar",
5102 "ssi: %s has given you permission to add him to your buddy list\n", sn); 5102 "ssi: %s has given you permission to add him to your buddy list\n", sn);
5103 5103
5104 buddy = gaim_find_buddy(gc->account, sn); 5104 buddy = purple_find_buddy(gc->account, sn);
5105 if (buddy && (gaim_buddy_get_alias_only(buddy))) 5105 if (buddy && (purple_buddy_get_alias_only(buddy)))
5106 nombre = g_strdup_printf("%s (%s)", sn, gaim_buddy_get_alias_only(buddy)); 5106 nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
5107 else 5107 else
5108 nombre = g_strdup(sn); 5108 nombre = g_strdup(sn);
5109 5109
5110 dialog_msg = g_strdup_printf(_("The user %s has given you permission to add you to their buddy list. Do you want to add them?"), nombre); 5110 dialog_msg = g_strdup_printf(_("The user %s has given you permission to add you to their buddy list. Do you want to add them?"), nombre);
5111 data = g_new(struct name_data, 1); 5111 data = g_new(struct name_data, 1);
5112 data->gc = gc; 5112 data->gc = gc;
5113 data->name = g_strdup(sn); 5113 data->name = g_strdup(sn);
5114 data->nick = NULL; 5114 data->nick = NULL;
5115 5115
5116 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, 5116 purple_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg,
5117 GAIM_DEFAULT_ACTION_NONE, data, 5117 PURPLE_DEFAULT_ACTION_NONE, data,
5118 G_CALLBACK(gaim_icq_buddyadd), 5118 G_CALLBACK(purple_icq_buddyadd),
5119 G_CALLBACK(oscar_free_name_data)); 5119 G_CALLBACK(oscar_free_name_data));
5120 5120
5121 g_free(dialog_msg); 5121 g_free(dialog_msg);
5122 g_free(nombre); 5122 g_free(nombre);
5123 5123
5124 return 1; 5124 return 1;
5125 } 5125 }
5126 5126
5127 static int gaim_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 5127 static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
5128 GaimConnection *gc = od->gc; 5128 PurpleConnection *gc = od->gc;
5129 va_list ap; 5129 va_list ap;
5130 char *sn; 5130 char *sn;
5131 char *msg; 5131 char *msg;
5132 GaimAccount *account = gaim_connection_get_account(gc); 5132 PurpleAccount *account = purple_connection_get_account(gc);
5133 gchar *nombre; 5133 gchar *nombre;
5134 gchar *reason = NULL; 5134 gchar *reason = NULL;
5135 struct name_data *data; 5135 struct name_data *data;
5136 GaimBuddy *buddy; 5136 PurpleBuddy *buddy;
5137 5137
5138 va_start(ap, fr); 5138 va_start(ap, fr);
5139 sn = va_arg(ap, char *); 5139 sn = va_arg(ap, char *);
5140 msg = va_arg(ap, char *); 5140 msg = va_arg(ap, char *);
5141 va_end(ap); 5141 va_end(ap);
5142 5142
5143 gaim_debug_info("oscar", 5143 purple_debug_info("oscar",
5144 "ssi: received authorization request from %s\n", sn); 5144 "ssi: received authorization request from %s\n", sn);
5145 5145
5146 buddy = gaim_find_buddy(account, sn); 5146 buddy = purple_find_buddy(account, sn);
5147 if (buddy && (gaim_buddy_get_alias_only(buddy))) 5147 if (buddy && (purple_buddy_get_alias_only(buddy)))
5148 nombre = g_strdup_printf("%s (%s)", sn, gaim_buddy_get_alias_only(buddy)); 5148 nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
5149 else 5149 else
5150 nombre = g_strdup(sn); 5150 nombre = g_strdup(sn);
5151 5151
5152 if (msg != NULL) 5152 if (msg != NULL)
5153 reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg, strlen(msg)); 5153 reason = purple_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg, strlen(msg));
5154 5154
5155 data = g_new(struct name_data, 1); 5155 data = g_new(struct name_data, 1);
5156 data->gc = gc; 5156 data->gc = gc;
5157 data->name = g_strdup(sn); 5157 data->name = g_strdup(sn);
5158 data->nick = NULL; 5158 data->nick = NULL;
5159 5159
5160 gaim_account_request_authorization(account, nombre, NULL, NULL, 5160 purple_account_request_authorization(account, nombre, NULL, NULL,
5161 reason, buddy != NULL, G_CALLBACK(gaim_auth_grant), 5161 reason, buddy != NULL, G_CALLBACK(purple_auth_grant),
5162 G_CALLBACK(gaim_auth_dontgrant_msgprompt), data); 5162 G_CALLBACK(purple_auth_dontgrant_msgprompt), data);
5163 g_free(nombre); 5163 g_free(nombre);
5164 g_free(reason); 5164 g_free(reason);
5165 5165
5166 return 1; 5166 return 1;
5167 } 5167 }
5168 5168
5169 static int gaim_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 5169 static int purple_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
5170 GaimConnection *gc = od->gc; 5170 PurpleConnection *gc = od->gc;
5171 va_list ap; 5171 va_list ap;
5172 char *sn, *msg; 5172 char *sn, *msg;
5173 gchar *dialog_msg, *nombre; 5173 gchar *dialog_msg, *nombre;
5174 guint8 reply; 5174 guint8 reply;
5175 GaimBuddy *buddy; 5175 PurpleBuddy *buddy;
5176 5176
5177 va_start(ap, fr); 5177 va_start(ap, fr);
5178 sn = va_arg(ap, char *); 5178 sn = va_arg(ap, char *);
5179 reply = (guint8)va_arg(ap, int); 5179 reply = (guint8)va_arg(ap, int);
5180 msg = va_arg(ap, char *); 5180 msg = va_arg(ap, char *);
5181 va_end(ap); 5181 va_end(ap);
5182 5182
5183 gaim_debug_info("oscar", 5183 purple_debug_info("oscar",
5184 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); 5184 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply);
5185 5185
5186 buddy = gaim_find_buddy(gc->account, sn); 5186 buddy = purple_find_buddy(gc->account, sn);
5187 if (buddy && (gaim_buddy_get_alias_only(buddy))) 5187 if (buddy && (purple_buddy_get_alias_only(buddy)))
5188 nombre = g_strdup_printf("%s (%s)", sn, gaim_buddy_get_alias_only(buddy)); 5188 nombre = g_strdup_printf("%s (%s)", sn, purple_buddy_get_alias_only(buddy));
5189 else 5189 else
5190 nombre = g_strdup(sn); 5190 nombre = g_strdup(sn);
5191 5191
5192 if (reply) { 5192 if (reply) {
5193 /* Granted */ 5193 /* Granted */
5194 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre); 5194 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre);
5195 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); 5195 purple_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg);
5196 } else { 5196 } else {
5197 /* Denied */ 5197 /* Denied */
5198 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); 5198 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given."));
5199 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); 5199 purple_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg);
5200 } 5200 }
5201 g_free(dialog_msg); 5201 g_free(dialog_msg);
5202 g_free(nombre); 5202 g_free(nombre);
5203 5203
5204 return 1; 5204 return 1;
5205 } 5205 }
5206 5206
5207 static int gaim_ssi_gotadded(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 5207 static int purple_ssi_gotadded(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
5208 GaimConnection *gc = od->gc; 5208 PurpleConnection *gc = od->gc;
5209 va_list ap; 5209 va_list ap;
5210 char *sn; 5210 char *sn;
5211 GaimBuddy *buddy; 5211 PurpleBuddy *buddy;
5212 5212
5213 va_start(ap, fr); 5213 va_start(ap, fr);
5214 sn = va_arg(ap, char *); 5214 sn = va_arg(ap, char *);
5215 va_end(ap); 5215 va_end(ap);
5216 5216
5217 buddy = gaim_find_buddy(gc->account, sn); 5217 buddy = purple_find_buddy(gc->account, sn);
5218 gaim_debug_info("oscar", "ssi: %s added you to their buddy list\n", sn); 5218 purple_debug_info("oscar", "ssi: %s added you to their buddy list\n", sn);
5219 gaim_account_notify_added(gc->account, sn, NULL, (buddy ? gaim_buddy_get_alias_only(buddy) : NULL), NULL); 5219 purple_account_notify_added(gc->account, sn, NULL, (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL);
5220 5220
5221 return 1; 5221 return 1;
5222 } 5222 }
5223 5223
5224 GList *oscar_chat_info(GaimConnection *gc) { 5224 GList *oscar_chat_info(PurpleConnection *gc) {
5225 GList *m = NULL; 5225 GList *m = NULL;
5226 struct proto_chat_entry *pce; 5226 struct proto_chat_entry *pce;
5227 5227
5228 pce = g_new0(struct proto_chat_entry, 1); 5228 pce = g_new0(struct proto_chat_entry, 1);
5229 pce->label = _("_Room:"); 5229 pce->label = _("_Room:");
5241 m = g_list_append(m, pce); 5241 m = g_list_append(m, pce);
5242 5242
5243 return m; 5243 return m;
5244 } 5244 }
5245 5245
5246 GHashTable *oscar_chat_info_defaults(GaimConnection *gc, const char *chat_name) 5246 GHashTable *oscar_chat_info_defaults(PurpleConnection *gc, const char *chat_name)
5247 { 5247 {
5248 GHashTable *defaults; 5248 GHashTable *defaults;
5249 5249
5250 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); 5250 defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
5251 5251
5260 { 5260 {
5261 return g_strdup(g_hash_table_lookup(data, "room")); 5261 return g_strdup(g_hash_table_lookup(data, "room"));
5262 } 5262 }
5263 5263
5264 void 5264 void
5265 oscar_join_chat(GaimConnection *gc, GHashTable *data) 5265 oscar_join_chat(PurpleConnection *gc, GHashTable *data)
5266 { 5266 {
5267 OscarData *od = (OscarData *)gc->proto_data; 5267 OscarData *od = (OscarData *)gc->proto_data;
5268 FlapConnection *conn; 5268 FlapConnection *conn;
5269 char *name, *exchange; 5269 char *name, *exchange;
5270 5270
5271 name = g_hash_table_lookup(data, "room"); 5271 name = g_hash_table_lookup(data, "room");
5272 exchange = g_hash_table_lookup(data, "exchange"); 5272 exchange = g_hash_table_lookup(data, "exchange");
5273 5273
5274 if ((name == NULL) || (*name == '\0')) { 5274 if ((name == NULL) || (*name == '\0')) {
5275 gaim_notify_error(gc, NULL, _("Invalid chat name specified."), NULL); 5275 purple_notify_error(gc, NULL, _("Invalid chat name specified."), NULL);
5276 return; 5276 return;
5277 } 5277 }
5278 5278
5279 gaim_debug_info("oscar", "Attempting to join chat room %s.\n", name); 5279 purple_debug_info("oscar", "Attempting to join chat room %s.\n", name);
5280 5280
5281 if ((conn = flap_connection_getbytype(od, SNAC_FAMILY_CHATNAV))) 5281 if ((conn = flap_connection_getbytype(od, SNAC_FAMILY_CHATNAV)))
5282 { 5282 {
5283 gaim_debug_info("oscar", "chatnav exists, creating room\n"); 5283 purple_debug_info("oscar", "chatnav exists, creating room\n");
5284 aim_chatnav_createroom(od, conn, name, atoi(exchange)); 5284 aim_chatnav_createroom(od, conn, name, atoi(exchange));
5285 } else { 5285 } else {
5286 /* this gets tricky */ 5286 /* this gets tricky */
5287 struct create_room *cr = g_new0(struct create_room, 1); 5287 struct create_room *cr = g_new0(struct create_room, 1);
5288 gaim_debug_info("oscar", "chatnav does not exist, opening chatnav\n"); 5288 purple_debug_info("oscar", "chatnav does not exist, opening chatnav\n");
5289 cr->exchange = atoi(exchange); 5289 cr->exchange = atoi(exchange);
5290 cr->name = g_strdup(name); 5290 cr->name = g_strdup(name);
5291 od->create_rooms = g_slist_prepend(od->create_rooms, cr); 5291 od->create_rooms = g_slist_prepend(od->create_rooms, cr);
5292 aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV); 5292 aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV);
5293 } 5293 }
5294 } 5294 }
5295 5295
5296 void 5296 void
5297 oscar_chat_invite(GaimConnection *gc, int id, const char *message, const char *name) 5297 oscar_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name)
5298 { 5298 {
5299 OscarData *od = (OscarData *)gc->proto_data; 5299 OscarData *od = (OscarData *)gc->proto_data;
5300 struct chat_connection *ccon = find_oscar_chat(gc, id); 5300 struct chat_connection *ccon = find_oscar_chat(gc, id);
5301 5301
5302 if (ccon == NULL) 5302 if (ccon == NULL)
5305 aim_im_sendch2_chatinvite(od, name, message ? message : "", 5305 aim_im_sendch2_chatinvite(od, name, message ? message : "",
5306 ccon->exchange, ccon->name, 0x0); 5306 ccon->exchange, ccon->name, 0x0);
5307 } 5307 }
5308 5308
5309 void 5309 void
5310 oscar_chat_leave(GaimConnection *gc, int id) 5310 oscar_chat_leave(PurpleConnection *gc, int id)
5311 { 5311 {
5312 GaimConversation *conv; 5312 PurpleConversation *conv;
5313 struct chat_connection *cc; 5313 struct chat_connection *cc;
5314 5314
5315 conv = gaim_find_chat(gc, id); 5315 conv = purple_find_chat(gc, id);
5316 5316
5317 g_return_if_fail(conv != NULL); 5317 g_return_if_fail(conv != NULL);
5318 5318
5319 gaim_debug_info("oscar", "Leaving chat room %s\n", conv->name); 5319 purple_debug_info("oscar", "Leaving chat room %s\n", conv->name);
5320 5320
5321 cc = find_oscar_chat(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv))); 5321 cc = find_oscar_chat(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)));
5322 oscar_chat_kill(gc, cc); 5322 oscar_chat_kill(gc, cc);
5323 } 5323 }
5324 5324
5325 int oscar_send_chat(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) { 5325 int oscar_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) {
5326 OscarData *od = (OscarData *)gc->proto_data; 5326 OscarData *od = (OscarData *)gc->proto_data;
5327 GaimConversation *conv = NULL; 5327 PurpleConversation *conv = NULL;
5328 struct chat_connection *c = NULL; 5328 struct chat_connection *c = NULL;
5329 char *buf, *buf2; 5329 char *buf, *buf2;
5330 guint16 charset, charsubset; 5330 guint16 charset, charsubset;
5331 char *charsetstr = NULL; 5331 char *charsetstr = NULL;
5332 int len; 5332 int len;
5333 5333
5334 if (!(conv = gaim_find_chat(gc, id))) 5334 if (!(conv = purple_find_chat(gc, id)))
5335 return -EINVAL; 5335 return -EINVAL;
5336 5336
5337 if (!(c = find_oscar_chat_by_conv(gc, conv))) 5337 if (!(c = find_oscar_chat_by_conv(gc, conv)))
5338 return -EINVAL; 5338 return -EINVAL;
5339 5339
5340 buf = gaim_strdup_withhtml(message); 5340 buf = purple_strdup_withhtml(message);
5341 len = strlen(buf); 5341 len = strlen(buf);
5342 5342
5343 if (strstr(buf, "<IMG ")) 5343 if (strstr(buf, "<IMG "))
5344 gaim_conversation_write(conv, "", 5344 purple_conversation_write(conv, "",
5345 _("Your IM Image was not sent. " 5345 _("Your IM Image was not sent. "
5346 "You cannot send IM Images in AIM chats."), 5346 "You cannot send IM Images in AIM chats."),
5347 GAIM_MESSAGE_ERROR, time(NULL)); 5347 PURPLE_MESSAGE_ERROR, time(NULL));
5348 5348
5349 gaim_plugin_oscar_convert_to_best_encoding(gc, NULL, buf, &buf2, &len, &charset, &charsubset); 5349 purple_plugin_oscar_convert_to_best_encoding(gc, NULL, buf, &buf2, &len, &charset, &charsubset);
5350 /* 5350 /*
5351 * Evan S. suggested that maxvis really does mean "number of 5351 * Evan S. suggested that maxvis really does mean "number of
5352 * visible characters" and not "number of bytes" 5352 * visible characters" and not "number of bytes"
5353 */ 5353 */
5354 if ((len > c->maxlen) || (len > c->maxvis)) { 5354 if ((len > c->maxlen) || (len > c->maxvis)) {
5366 g_free(buf2); 5366 g_free(buf2);
5367 5367
5368 return 0; 5368 return 0;
5369 } 5369 }
5370 5370
5371 const char *oscar_list_icon_icq(GaimAccount *a, GaimBuddy *b) 5371 const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b)
5372 { 5372 {
5373 if ((b == NULL) || (b->name == NULL) || aim_sn_is_sms(b->name)) 5373 if ((b == NULL) || (b->name == NULL) || aim_sn_is_sms(b->name))
5374 { 5374 {
5375 if (a == NULL || aim_sn_is_icq(gaim_account_get_username(a))) 5375 if (a == NULL || aim_sn_is_icq(purple_account_get_username(a)))
5376 return "icq"; 5376 return "icq";
5377 else 5377 else
5378 return "aim"; 5378 return "aim";
5379 } 5379 }
5380 5380
5381 if (aim_sn_is_icq(b->name)) 5381 if (aim_sn_is_icq(b->name))
5382 return "icq"; 5382 return "icq";
5383 return "aim"; 5383 return "aim";
5384 } 5384 }
5385 5385
5386 const char *oscar_list_icon_aim(GaimAccount *a, GaimBuddy *b) 5386 const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b)
5387 { 5387 {
5388 if ((b == NULL) || (b->name == NULL) || aim_sn_is_sms(b->name)) 5388 if ((b == NULL) || (b->name == NULL) || aim_sn_is_sms(b->name))
5389 { 5389 {
5390 if (a != NULL && aim_sn_is_icq(gaim_account_get_username(a))) 5390 if (a != NULL && aim_sn_is_icq(purple_account_get_username(a)))
5391 return "icq"; 5391 return "icq";
5392 else 5392 else
5393 return "aim"; 5393 return "aim";
5394 } 5394 }
5395 5395
5396 if (aim_sn_is_icq(b->name)) 5396 if (aim_sn_is_icq(b->name))
5397 return "icq"; 5397 return "icq";
5398 return "aim"; 5398 return "aim";
5399 } 5399 }
5400 5400
5401 const char* oscar_list_emblem(GaimBuddy *b) 5401 const char* oscar_list_emblem(PurpleBuddy *b)
5402 { 5402 {
5403 GaimConnection *gc = NULL; 5403 PurpleConnection *gc = NULL;
5404 OscarData *od = NULL; 5404 OscarData *od = NULL;
5405 GaimAccount *account = NULL; 5405 PurpleAccount *account = NULL;
5406 GaimPresence *presence; 5406 PurplePresence *presence;
5407 GaimStatus *status; 5407 PurpleStatus *status;
5408 const char *status_id; 5408 const char *status_id;
5409 aim_userinfo_t *userinfo = NULL; 5409 aim_userinfo_t *userinfo = NULL;
5410 5410
5411 account = b->account; 5411 account = b->account;
5412 if (account != NULL) 5412 if (account != NULL)
5414 if (gc != NULL) 5414 if (gc != NULL)
5415 od = gc->proto_data; 5415 od = gc->proto_data;
5416 if (od != NULL) 5416 if (od != NULL)
5417 userinfo = aim_locate_finduserinfo(od, b->name); 5417 userinfo = aim_locate_finduserinfo(od, b->name);
5418 5418
5419 presence = gaim_buddy_get_presence(b); 5419 presence = purple_buddy_get_presence(b);
5420 status = gaim_presence_get_active_status(presence); 5420 status = purple_presence_get_active_status(presence);
5421 status_id = gaim_status_get_id(status); 5421 status_id = purple_status_get_id(status);
5422 5422
5423 if (gaim_presence_is_online(presence) == FALSE) { 5423 if (purple_presence_is_online(presence) == FALSE) {
5424 char *gname; 5424 char *gname;
5425 if ((b->name) && (od) && (od->ssi.received_data) && 5425 if ((b->name) && (od) && (od->ssi.received_data) &&
5426 (gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name)) && 5426 (gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name)) &&
5427 (aim_ssi_waitingforauth(od->ssi.local, gname, b->name))) { 5427 (aim_ssi_waitingforauth(od->ssi.local, gname, b->name))) {
5428 return "not-authorized"; 5428 return "not-authorized";
5440 return "secure"; 5440 return "secure";
5441 } 5441 }
5442 return NULL; 5442 return NULL;
5443 } 5443 }
5444 5444
5445 void oscar_tooltip_text(GaimBuddy *b, GaimNotifyUserInfo *user_info, gboolean full) { 5445 void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) {
5446 GaimConnection *gc = b->account->gc; 5446 PurpleConnection *gc = b->account->gc;
5447 OscarData *od = gc->proto_data; 5447 OscarData *od = gc->proto_data;
5448 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od, b->name); 5448 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od, b->name);
5449 5449
5450 if (GAIM_BUDDY_IS_ONLINE(b)) { 5450 if (PURPLE_BUDDY_IS_ONLINE(b)) {
5451 GaimPresence *presence; 5451 PurplePresence *presence;
5452 GaimStatus *status; 5452 PurpleStatus *status;
5453 const char *message; 5453 const char *message;
5454 5454
5455 if (full) 5455 if (full)
5456 oscar_string_append_info(gc, user_info, b, userinfo); 5456 oscar_string_append_info(gc, user_info, b, userinfo);
5457 5457
5458 presence = gaim_buddy_get_presence(b); 5458 presence = purple_buddy_get_presence(b);
5459 status = gaim_presence_get_active_status(presence); 5459 status = purple_presence_get_active_status(presence);
5460 message = gaim_status_get_attr_string(status, "message"); 5460 message = purple_status_get_attr_string(status, "message");
5461 5461
5462 if (gaim_status_is_available(status)) 5462 if (purple_status_is_available(status))
5463 { 5463 {
5464 if (message != NULL) 5464 if (message != NULL)
5465 { 5465 {
5466 /* Available status messages are plain text */ 5466 /* Available status messages are plain text */
5467 gchar *tmp; 5467 gchar *tmp;
5468 tmp = g_markup_escape_text(message, -1); 5468 tmp = g_markup_escape_text(message, -1);
5469 gaim_notify_user_info_add_pair(user_info, _("Message"), tmp); 5469 purple_notify_user_info_add_pair(user_info, _("Message"), tmp);
5470 g_free(tmp); 5470 g_free(tmp);
5471 } 5471 }
5472 } 5472 }
5473 else 5473 else
5474 { 5474 {
5475 if (message != NULL) 5475 if (message != NULL)
5476 { 5476 {
5477 /* Away messages are HTML */ 5477 /* Away messages are HTML */
5478 gchar *tmp1, *tmp2; 5478 gchar *tmp1, *tmp2;
5479 tmp2 = gaim_markup_strip_html(message); 5479 tmp2 = purple_markup_strip_html(message);
5480 tmp1 = g_markup_escape_text(tmp2, -1); 5480 tmp1 = g_markup_escape_text(tmp2, -1);
5481 g_free(tmp2); 5481 g_free(tmp2);
5482 tmp2 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); 5482 tmp2 = purple_str_sub_away_formatters(tmp1, purple_account_get_username(purple_connection_get_account(gc)));
5483 g_free(tmp1); 5483 g_free(tmp1);
5484 gaim_notify_user_info_add_pair(user_info, _("Away Message"), tmp2); 5484 purple_notify_user_info_add_pair(user_info, _("Away Message"), tmp2);
5485 g_free(tmp2); 5485 g_free(tmp2);
5486 } 5486 }
5487 else 5487 else
5488 { 5488 {
5489 gaim_notify_user_info_add_pair(user_info, _("Away Message"), _("<i>(retrieving)</i>")); 5489 purple_notify_user_info_add_pair(user_info, _("Away Message"), _("<i>(retrieving)</i>"));
5490 } 5490 }
5491 } 5491 }
5492 } 5492 }
5493 } 5493 }
5494 5494
5495 char *oscar_status_text(GaimBuddy *b) 5495 char *oscar_status_text(PurpleBuddy *b)
5496 { 5496 {
5497 GaimConnection *gc; 5497 PurpleConnection *gc;
5498 GaimAccount *account; 5498 PurpleAccount *account;
5499 OscarData *od; 5499 OscarData *od;
5500 const GaimPresence *presence; 5500 const PurplePresence *presence;
5501 const GaimStatus *status; 5501 const PurpleStatus *status;
5502 const char *id; 5502 const char *id;
5503 const char *message; 5503 const char *message;
5504 gchar *ret = NULL; 5504 gchar *ret = NULL;
5505 5505
5506 gc = gaim_account_get_connection(gaim_buddy_get_account(b)); 5506 gc = purple_account_get_connection(purple_buddy_get_account(b));
5507 account = gaim_connection_get_account(gc); 5507 account = purple_connection_get_account(gc);
5508 od = gc->proto_data; 5508 od = gc->proto_data;
5509 presence = gaim_buddy_get_presence(b); 5509 presence = purple_buddy_get_presence(b);
5510 status = gaim_presence_get_active_status(presence); 5510 status = purple_presence_get_active_status(presence);
5511 id = gaim_status_get_id(status); 5511 id = purple_status_get_id(status);
5512 5512
5513 if (!gaim_presence_is_online(presence)) 5513 if (!purple_presence_is_online(presence))
5514 { 5514 {
5515 char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name); 5515 char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, b->name);
5516 if (aim_ssi_waitingforauth(od->ssi.local, gname, b->name)) 5516 if (aim_ssi_waitingforauth(od->ssi.local, gname, b->name))
5517 ret = g_strdup(_("Not Authorized")); 5517 ret = g_strdup(_("Not Authorized"));
5518 else 5518 else
5519 ret = g_strdup(_("Offline")); 5519 ret = g_strdup(_("Offline"));
5520 } 5520 }
5521 else if (gaim_status_is_available(status) && !strcmp(id, OSCAR_STATUS_ID_AVAILABLE)) 5521 else if (purple_status_is_available(status) && !strcmp(id, OSCAR_STATUS_ID_AVAILABLE))
5522 { 5522 {
5523 /* Available */ 5523 /* Available */
5524 message = gaim_status_get_attr_string(status, "message"); 5524 message = purple_status_get_attr_string(status, "message");
5525 if (message != NULL) 5525 if (message != NULL)
5526 { 5526 {
5527 ret = g_markup_escape_text(message, -1); 5527 ret = g_markup_escape_text(message, -1);
5528 gaim_util_chrreplace(ret, '\n', ' '); 5528 purple_util_chrreplace(ret, '\n', ' ');
5529 } 5529 }
5530 } 5530 }
5531 else if (!gaim_status_is_available(status) && !strcmp(id, OSCAR_STATUS_ID_AWAY)) 5531 else if (!purple_status_is_available(status) && !strcmp(id, OSCAR_STATUS_ID_AWAY))
5532 { 5532 {
5533 /* Away */ 5533 /* Away */
5534 message = gaim_status_get_attr_string(status, "message"); 5534 message = purple_status_get_attr_string(status, "message");
5535 if (message != NULL) 5535 if (message != NULL)
5536 { 5536 {
5537 gchar *tmp1, *tmp2; 5537 gchar *tmp1, *tmp2;
5538 tmp1 = gaim_markup_strip_html(message); 5538 tmp1 = purple_markup_strip_html(message);
5539 gaim_util_chrreplace(tmp1, '\n', ' '); 5539 purple_util_chrreplace(tmp1, '\n', ' ');
5540 tmp2 = g_markup_escape_text(tmp1, -1); 5540 tmp2 = g_markup_escape_text(tmp1, -1);
5541 ret = gaim_str_sub_away_formatters(tmp2, gaim_account_get_username(account)); 5541 ret = purple_str_sub_away_formatters(tmp2, purple_account_get_username(account));
5542 g_free(tmp1); 5542 g_free(tmp1);
5543 g_free(tmp2); 5543 g_free(tmp2);
5544 } 5544 }
5545 else 5545 else
5546 { 5546 {
5547 ret = g_strdup(_("Away")); 5547 ret = g_strdup(_("Away"));
5548 } 5548 }
5549 } 5549 }
5550 else 5550 else
5551 ret = g_strdup(gaim_status_get_name(status)); 5551 ret = g_strdup(purple_status_get_name(status));
5552 5552
5553 return ret; 5553 return ret;
5554 } 5554 }
5555 5555
5556 5556
5557 static int oscar_icon_req(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 5557 static int oscar_icon_req(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
5558 GaimConnection *gc = od->gc; 5558 PurpleConnection *gc = od->gc;
5559 va_list ap; 5559 va_list ap;
5560 guint16 type; 5560 guint16 type;
5561 guint8 flags = 0, length = 0; 5561 guint8 flags = 0, length = 0;
5562 guchar *md5 = NULL; 5562 guchar *md5 = NULL;
5563 5563
5576 od->iconconnecting = TRUE; 5576 od->iconconnecting = TRUE;
5577 od->set_icon = TRUE; 5577 od->set_icon = TRUE;
5578 aim_srv_requestnew(od, SNAC_FAMILY_BART); 5578 aim_srv_requestnew(od, SNAC_FAMILY_BART);
5579 } else { 5579 } else {
5580 struct stat st; 5580 struct stat st;
5581 char *iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(gaim_connection_get_account(gc))); 5581 char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc)));
5582 if (iconfile == NULL) { 5582 if (iconfile == NULL) {
5583 aim_ssi_delicon(od); 5583 aim_ssi_delicon(od);
5584 } else if (!g_stat(iconfile, &st)) { 5584 } else if (!g_stat(iconfile, &st)) {
5585 guchar *buf = g_malloc(st.st_size); 5585 guchar *buf = g_malloc(st.st_size);
5586 FILE *file = g_fopen(iconfile, "rb"); 5586 FILE *file = g_fopen(iconfile, "rb");
5587 if (file) { 5587 if (file) {
5588 /* XXX - Use g_file_get_contents()? */ 5588 /* XXX - Use g_file_get_contents()? */
5589 fread(buf, 1, st.st_size, file); 5589 fread(buf, 1, st.st_size, file);
5590 fclose(file); 5590 fclose(file);
5591 gaim_debug_info("oscar", 5591 purple_debug_info("oscar",
5592 "Uploading icon to icon server\n"); 5592 "Uploading icon to icon server\n");
5593 aim_bart_upload(od, buf, st.st_size); 5593 aim_bart_upload(od, buf, st.st_size);
5594 } else 5594 } else
5595 gaim_debug_error("oscar", 5595 purple_debug_error("oscar",
5596 "Can't open buddy icon file!\n"); 5596 "Can't open buddy icon file!\n");
5597 g_free(buf); 5597 g_free(buf);
5598 } else { 5598 } else {
5599 gaim_debug_error("oscar", 5599 purple_debug_error("oscar",
5600 "Can't stat buddy icon file!\n"); 5600 "Can't stat buddy icon file!\n");
5601 } 5601 }
5602 g_free(iconfile); 5602 g_free(iconfile);
5603 } 5603 }
5604 } else if (flags == 0x81) { 5604 } else if (flags == 0x81) {
5605 char *iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(gaim_connection_get_account(gc))); 5605 char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc)));
5606 if (iconfile == NULL) 5606 if (iconfile == NULL)
5607 aim_ssi_delicon(od); 5607 aim_ssi_delicon(od);
5608 else { 5608 else {
5609 aim_ssi_seticon(od, md5, length); 5609 aim_ssi_seticon(od, md5, length);
5610 g_free(iconfile); 5610 g_free(iconfile);
5619 va_end(ap); 5619 va_end(ap);
5620 5620
5621 return 0; 5621 return 0;
5622 } 5622 }
5623 5623
5624 void oscar_set_permit_deny(GaimConnection *gc) { 5624 void oscar_set_permit_deny(PurpleConnection *gc) {
5625 GaimAccount *account = gaim_connection_get_account(gc); 5625 PurpleAccount *account = purple_connection_get_account(gc);
5626 OscarData *od = (OscarData *)gc->proto_data; 5626 OscarData *od = (OscarData *)gc->proto_data;
5627 5627
5628 if (od->ssi.received_data) { 5628 if (od->ssi.received_data) {
5629 switch (account->perm_deny) { 5629 switch (account->perm_deny) {
5630 case GAIM_PRIVACY_ALLOW_ALL: 5630 case PURPLE_PRIVACY_ALLOW_ALL:
5631 aim_ssi_setpermdeny(od, 0x01, 0xffffffff); 5631 aim_ssi_setpermdeny(od, 0x01, 0xffffffff);
5632 break; 5632 break;
5633 case GAIM_PRIVACY_ALLOW_BUDDYLIST: 5633 case PURPLE_PRIVACY_ALLOW_BUDDYLIST:
5634 aim_ssi_setpermdeny(od, 0x05, 0xffffffff); 5634 aim_ssi_setpermdeny(od, 0x05, 0xffffffff);
5635 break; 5635 break;
5636 case GAIM_PRIVACY_ALLOW_USERS: 5636 case PURPLE_PRIVACY_ALLOW_USERS:
5637 aim_ssi_setpermdeny(od, 0x03, 0xffffffff); 5637 aim_ssi_setpermdeny(od, 0x03, 0xffffffff);
5638 break; 5638 break;
5639 case GAIM_PRIVACY_DENY_ALL: 5639 case PURPLE_PRIVACY_DENY_ALL:
5640 aim_ssi_setpermdeny(od, 0x02, 0xffffffff); 5640 aim_ssi_setpermdeny(od, 0x02, 0xffffffff);
5641 break; 5641 break;
5642 case GAIM_PRIVACY_DENY_USERS: 5642 case PURPLE_PRIVACY_DENY_USERS:
5643 aim_ssi_setpermdeny(od, 0x04, 0xffffffff); 5643 aim_ssi_setpermdeny(od, 0x04, 0xffffffff);
5644 break; 5644 break;
5645 default: 5645 default:
5646 aim_ssi_setpermdeny(od, 0x01, 0xffffffff); 5646 aim_ssi_setpermdeny(od, 0x01, 0xffffffff);
5647 break; 5647 break;
5648 } 5648 }
5649 } 5649 }
5650 } 5650 }
5651 5651
5652 void oscar_add_permit(GaimConnection *gc, const char *who) { 5652 void oscar_add_permit(PurpleConnection *gc, const char *who) {
5653 OscarData *od = (OscarData *)gc->proto_data; 5653 OscarData *od = (OscarData *)gc->proto_data;
5654 gaim_debug_info("oscar", "ssi: About to add a permit\n"); 5654 purple_debug_info("oscar", "ssi: About to add a permit\n");
5655 if (od->ssi.received_data) 5655 if (od->ssi.received_data)
5656 aim_ssi_addpermit(od, who); 5656 aim_ssi_addpermit(od, who);
5657 } 5657 }
5658 5658
5659 void oscar_add_deny(GaimConnection *gc, const char *who) { 5659 void oscar_add_deny(PurpleConnection *gc, const char *who) {
5660 OscarData *od = (OscarData *)gc->proto_data; 5660 OscarData *od = (OscarData *)gc->proto_data;
5661 gaim_debug_info("oscar", "ssi: About to add a deny\n"); 5661 purple_debug_info("oscar", "ssi: About to add a deny\n");
5662 if (od->ssi.received_data) 5662 if (od->ssi.received_data)
5663 aim_ssi_adddeny(od, who); 5663 aim_ssi_adddeny(od, who);
5664 } 5664 }
5665 5665
5666 void oscar_rem_permit(GaimConnection *gc, const char *who) { 5666 void oscar_rem_permit(PurpleConnection *gc, const char *who) {
5667 OscarData *od = (OscarData *)gc->proto_data; 5667 OscarData *od = (OscarData *)gc->proto_data;
5668 gaim_debug_info("oscar", "ssi: About to delete a permit\n"); 5668 purple_debug_info("oscar", "ssi: About to delete a permit\n");
5669 if (od->ssi.received_data) 5669 if (od->ssi.received_data)
5670 aim_ssi_delpermit(od, who); 5670 aim_ssi_delpermit(od, who);
5671 } 5671 }
5672 5672
5673 void oscar_rem_deny(GaimConnection *gc, const char *who) { 5673 void oscar_rem_deny(PurpleConnection *gc, const char *who) {
5674 OscarData *od = (OscarData *)gc->proto_data; 5674 OscarData *od = (OscarData *)gc->proto_data;
5675 gaim_debug_info("oscar", "ssi: About to delete a deny\n"); 5675 purple_debug_info("oscar", "ssi: About to delete a deny\n");
5676 if (od->ssi.received_data) 5676 if (od->ssi.received_data)
5677 aim_ssi_deldeny(od, who); 5677 aim_ssi_deldeny(od, who);
5678 } 5678 }
5679 5679
5680 GList * 5680 GList *
5681 oscar_status_types(GaimAccount *account) 5681 oscar_status_types(PurpleAccount *account)
5682 { 5682 {
5683 gboolean is_icq; 5683 gboolean is_icq;
5684 GList *status_types = NULL; 5684 GList *status_types = NULL;
5685 GaimStatusType *type; 5685 PurpleStatusType *type;
5686 5686
5687 g_return_val_if_fail(account != NULL, NULL); 5687 g_return_val_if_fail(account != NULL, NULL);
5688 5688
5689 /* Used to flag some statuses as "user settable" or not */ 5689 /* Used to flag some statuses as "user settable" or not */
5690 is_icq = aim_sn_is_icq(gaim_account_get_username(account)); 5690 is_icq = aim_sn_is_icq(purple_account_get_username(account));
5691 5691
5692 /* Common status types */ 5692 /* Common status types */
5693 /* Really the available message should only be settable for AIM accounts */ 5693 /* Really the available message should only be settable for AIM accounts */
5694 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, 5694 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
5695 OSCAR_STATUS_ID_AVAILABLE, 5695 OSCAR_STATUS_ID_AVAILABLE,
5696 NULL, TRUE, TRUE, FALSE, 5696 NULL, TRUE, TRUE, FALSE,
5697 "message", _("Message"), 5697 "message", _("Message"),
5698 gaim_value_new(GAIM_TYPE_STRING), 5698 purple_value_new(PURPLE_TYPE_STRING),
5699 "itmsurl", _("iTunes Music Store Link"), 5699 "itmsurl", _("iTunes Music Store Link"),
5700 gaim_value_new(GAIM_TYPE_STRING), NULL); 5700 purple_value_new(PURPLE_TYPE_STRING), NULL);
5701 status_types = g_list_prepend(status_types, type); 5701 status_types = g_list_prepend(status_types, type);
5702 5702
5703 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, 5703 type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE,
5704 OSCAR_STATUS_ID_FREE4CHAT, 5704 OSCAR_STATUS_ID_FREE4CHAT,
5705 _("Free For Chat"), TRUE, is_icq, FALSE); 5705 _("Free For Chat"), TRUE, is_icq, FALSE);
5706 status_types = g_list_prepend(status_types, type); 5706 status_types = g_list_prepend(status_types, type);
5707 5707
5708 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY, 5708 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY,
5709 OSCAR_STATUS_ID_AWAY, 5709 OSCAR_STATUS_ID_AWAY,
5710 NULL, TRUE, TRUE, FALSE, 5710 NULL, TRUE, TRUE, FALSE,
5711 "message", _("Message"), 5711 "message", _("Message"),
5712 gaim_value_new(GAIM_TYPE_STRING), NULL); 5712 purple_value_new(PURPLE_TYPE_STRING), NULL);
5713 status_types = g_list_prepend(status_types, type); 5713 status_types = g_list_prepend(status_types, type);
5714 5714
5715 type = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE, 5715 type = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE,
5716 OSCAR_STATUS_ID_INVISIBLE, 5716 OSCAR_STATUS_ID_INVISIBLE,
5717 NULL, TRUE, TRUE, FALSE); 5717 NULL, TRUE, TRUE, FALSE);
5718 status_types = g_list_prepend(status_types, type); 5718 status_types = g_list_prepend(status_types, type);
5719 5719
5720 type = gaim_status_type_new_full(GAIM_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE); 5720 type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE);
5721 status_types = g_list_prepend(status_types, type); 5721 status_types = g_list_prepend(status_types, type);
5722 5722
5723 /* ICQ-specific status types */ 5723 /* ICQ-specific status types */
5724 type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE, 5724 type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE,
5725 OSCAR_STATUS_ID_OCCUPIED, 5725 OSCAR_STATUS_ID_OCCUPIED,
5726 _("Occupied"), TRUE, is_icq, FALSE, 5726 _("Occupied"), TRUE, is_icq, FALSE,
5727 "message", _("Message"), 5727 "message", _("Message"),
5728 gaim_value_new(GAIM_TYPE_STRING), NULL); 5728 purple_value_new(PURPLE_TYPE_STRING), NULL);
5729 status_types = g_list_prepend(status_types, type); 5729 status_types = g_list_prepend(status_types, type);
5730 5730
5731 type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY, 5731 type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY,
5732 OSCAR_STATUS_ID_DND, 5732 OSCAR_STATUS_ID_DND,
5733 _("Do Not Disturb"), TRUE, is_icq, FALSE, 5733 _("Do Not Disturb"), TRUE, is_icq, FALSE,
5734 "message", _("Message"), 5734 "message", _("Message"),
5735 gaim_value_new(GAIM_TYPE_STRING), NULL); 5735 purple_value_new(PURPLE_TYPE_STRING), NULL);
5736 status_types = g_list_prepend(status_types, type); 5736 status_types = g_list_prepend(status_types, type);
5737 5737
5738 type = gaim_status_type_new_with_attrs(GAIM_STATUS_EXTENDED_AWAY, 5738 type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY,
5739 OSCAR_STATUS_ID_NA, 5739 OSCAR_STATUS_ID_NA,
5740 _("Not Available"), TRUE, is_icq, FALSE, 5740 _("Not Available"), TRUE, is_icq, FALSE,
5741 "message", _("Message"), 5741 "message", _("Message"),
5742 gaim_value_new(GAIM_TYPE_STRING), NULL); 5742 purple_value_new(PURPLE_TYPE_STRING), NULL);
5743 status_types = g_list_prepend(status_types, type); 5743 status_types = g_list_prepend(status_types, type);
5744 5744
5745 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, 5745 type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE,
5746 OSCAR_STATUS_ID_OFFLINE, 5746 OSCAR_STATUS_ID_OFFLINE,
5747 NULL, TRUE, TRUE, FALSE); 5747 NULL, TRUE, TRUE, FALSE);
5748 status_types = g_list_prepend(status_types, type); 5748 status_types = g_list_prepend(status_types, type);
5749 5749
5750 status_types = g_list_reverse(status_types); 5750 status_types = g_list_reverse(status_types);
5751 5751
5752 return status_types; 5752 return status_types;
5753 } 5753 }
5754 5754
5755 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { 5755 static void oscar_ssi_editcomment(struct name_data *data, const char *text) {
5756 GaimConnection *gc = data->gc; 5756 PurpleConnection *gc = data->gc;
5757 OscarData *od = gc->proto_data; 5757 OscarData *od = gc->proto_data;
5758 GaimBuddy *b; 5758 PurpleBuddy *b;
5759 GaimGroup *g; 5759 PurpleGroup *g;
5760 5760
5761 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { 5761 if (!(b = purple_find_buddy(purple_connection_get_account(data->gc), data->name))) {
5762 oscar_free_name_data(data); 5762 oscar_free_name_data(data);
5763 return; 5763 return;
5764 } 5764 }
5765 5765
5766 if (!(g = gaim_buddy_get_group(b))) { 5766 if (!(g = purple_buddy_get_group(b))) {
5767 oscar_free_name_data(data); 5767 oscar_free_name_data(data);
5768 return; 5768 return;
5769 } 5769 }
5770 5770
5771 aim_ssi_editcomment(od, g->name, data->name, text); 5771 aim_ssi_editcomment(od, g->name, data->name, text);
5772 5772
5773 if (!aim_sncmp(data->name, gc->account->username)) 5773 if (!aim_sncmp(data->name, gc->account->username))
5774 gaim_check_comment(od, text); 5774 purple_check_comment(od, text);
5775 5775
5776 oscar_free_name_data(data); 5776 oscar_free_name_data(data);
5777 } 5777 }
5778 5778
5779 static void oscar_buddycb_edit_comment(GaimBlistNode *node, gpointer ignore) { 5779 static void oscar_buddycb_edit_comment(PurpleBlistNode *node, gpointer ignore) {
5780 5780
5781 GaimBuddy *buddy; 5781 PurpleBuddy *buddy;
5782 GaimConnection *gc; 5782 PurpleConnection *gc;
5783 OscarData *od; 5783 OscarData *od;
5784 struct name_data *data; 5784 struct name_data *data;
5785 GaimGroup *g; 5785 PurpleGroup *g;
5786 char *comment; 5786 char *comment;
5787 gchar *comment_utf8; 5787 gchar *comment_utf8;
5788 gchar *title; 5788 gchar *title;
5789 5789
5790 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); 5790 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
5791 5791
5792 buddy = (GaimBuddy *) node; 5792 buddy = (PurpleBuddy *) node;
5793 gc = gaim_account_get_connection(buddy->account); 5793 gc = purple_account_get_connection(buddy->account);
5794 od = gc->proto_data; 5794 od = gc->proto_data;
5795 5795
5796 data = g_new(struct name_data, 1); 5796 data = g_new(struct name_data, 1);
5797 5797
5798 if (!(g = gaim_buddy_get_group(buddy))) 5798 if (!(g = purple_buddy_get_group(buddy)))
5799 return; 5799 return;
5800 comment = aim_ssi_getcomment(od->ssi.local, g->name, buddy->name); 5800 comment = aim_ssi_getcomment(od->ssi.local, g->name, buddy->name);
5801 comment_utf8 = comment ? oscar_utf8_try_convert(gc->account, comment) : NULL; 5801 comment_utf8 = comment ? oscar_utf8_try_convert(gc->account, comment) : NULL;
5802 5802
5803 data->gc = gc; 5803 data->gc = gc;
5804 data->name = g_strdup(buddy->name); 5804 data->name = g_strdup(buddy->name);
5805 data->nick = NULL; 5805 data->nick = NULL;
5806 5806
5807 title = g_strdup_printf(_("Buddy Comment for %s"), data->name); 5807 title = g_strdup_printf(_("Buddy Comment for %s"), data->name);
5808 gaim_request_input(gc, title, _("Buddy Comment:"), NULL, 5808 purple_request_input(gc, title, _("Buddy Comment:"), NULL,
5809 comment_utf8, TRUE, FALSE, NULL, 5809 comment_utf8, TRUE, FALSE, NULL,
5810 _("_OK"), G_CALLBACK(oscar_ssi_editcomment), 5810 _("_OK"), G_CALLBACK(oscar_ssi_editcomment),
5811 _("_Cancel"), G_CALLBACK(oscar_free_name_data), 5811 _("_Cancel"), G_CALLBACK(oscar_free_name_data),
5812 data); 5812 data);
5813 g_free(title); 5813 g_free(title);
5833 5833
5834 /* This is called from right-click menu on a buddy node. */ 5834 /* This is called from right-click menu on a buddy node. */
5835 static void 5835 static void
5836 oscar_ask_directim(gpointer object, gpointer ignored) 5836 oscar_ask_directim(gpointer object, gpointer ignored)
5837 { 5837 {
5838 GaimBlistNode *node; 5838 PurpleBlistNode *node;
5839 GaimBuddy *buddy; 5839 PurpleBuddy *buddy;
5840 GaimConnection *gc; 5840 PurpleConnection *gc;
5841 gchar *buf; 5841 gchar *buf;
5842 struct oscar_ask_directim_data *data; 5842 struct oscar_ask_directim_data *data;
5843 5843
5844 node = object; 5844 node = object;
5845 5845
5846 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); 5846 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
5847 5847
5848 buddy = (GaimBuddy *)node; 5848 buddy = (PurpleBuddy *)node;
5849 gc = gaim_account_get_connection(buddy->account); 5849 gc = purple_account_get_connection(buddy->account);
5850 5850
5851 data = g_new0(struct oscar_ask_directim_data, 1); 5851 data = g_new0(struct oscar_ask_directim_data, 1);
5852 data->who = g_strdup(buddy->name); 5852 data->who = g_strdup(buddy->name);
5853 data->od = gc->proto_data; 5853 data->od = gc->proto_data;
5854 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), 5854 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."),
5855 buddy->name); 5855 buddy->name);
5856 5856
5857 gaim_request_action(gc, NULL, buf, 5857 purple_request_action(gc, NULL, buf,
5858 _("Because this reveals your IP address, it " 5858 _("Because this reveals your IP address, it "
5859 "may be considered a security risk. Do you " 5859 "may be considered a security risk. Do you "
5860 "wish to continue?"), 5860 "wish to continue?"),
5861 0, data, 2, 5861 0, data, 2,
5862 _("C_onnect"), G_CALLBACK(oscar_ask_directim_yes_cb), 5862 _("C_onnect"), G_CALLBACK(oscar_ask_directim_yes_cb),
5863 _("_Cancel"), G_CALLBACK(oscar_ask_directim_no_cb)); 5863 _("_Cancel"), G_CALLBACK(oscar_ask_directim_no_cb));
5864 g_free(buf); 5864 g_free(buf);
5865 } 5865 }
5866 5866
5867 static void 5867 static void
5868 oscar_get_aim_info_cb(GaimBlistNode *node, gpointer ignore) 5868 oscar_get_aim_info_cb(PurpleBlistNode *node, gpointer ignore)
5869 { 5869 {
5870 GaimBuddy *buddy; 5870 PurpleBuddy *buddy;
5871 GaimConnection *gc; 5871 PurpleConnection *gc;
5872 5872
5873 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); 5873 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
5874 5874
5875 buddy = (GaimBuddy *)node; 5875 buddy = (PurpleBuddy *)node;
5876 gc = gaim_account_get_connection(buddy->account); 5876 gc = purple_account_get_connection(buddy->account);
5877 5877
5878 aim_locate_getinfoshort(gc->proto_data, gaim_buddy_get_name(buddy), 0x00000003); 5878 aim_locate_getinfoshort(gc->proto_data, purple_buddy_get_name(buddy), 0x00000003);
5879 } 5879 }
5880 5880
5881 static GList * 5881 static GList *
5882 oscar_buddy_menu(GaimBuddy *buddy) { 5882 oscar_buddy_menu(PurpleBuddy *buddy) {
5883 5883
5884 GaimConnection *gc; 5884 PurpleConnection *gc;
5885 OscarData *od; 5885 OscarData *od;
5886 GList *menu; 5886 GList *menu;
5887 GaimMenuAction *act; 5887 PurpleMenuAction *act;
5888 aim_userinfo_t *userinfo; 5888 aim_userinfo_t *userinfo;
5889 5889
5890 gc = gaim_account_get_connection(buddy->account); 5890 gc = purple_account_get_connection(buddy->account);
5891 od = gc->proto_data; 5891 od = gc->proto_data;
5892 userinfo = aim_locate_finduserinfo(od, buddy->name); 5892 userinfo = aim_locate_finduserinfo(od, buddy->name);
5893 menu = NULL; 5893 menu = NULL;
5894 5894
5895 if (od->icq && aim_sn_is_icq(gaim_buddy_get_name(buddy))) 5895 if (od->icq && aim_sn_is_icq(purple_buddy_get_name(buddy)))
5896 { 5896 {
5897 act = gaim_menu_action_new(_("Get AIM Info"), 5897 act = purple_menu_action_new(_("Get AIM Info"),
5898 GAIM_CALLBACK(oscar_get_aim_info_cb), 5898 PURPLE_CALLBACK(oscar_get_aim_info_cb),
5899 NULL, NULL); 5899 NULL, NULL);
5900 menu = g_list_prepend(menu, act); 5900 menu = g_list_prepend(menu, act);
5901 } 5901 }
5902 5902
5903 act = gaim_menu_action_new(_("Edit Buddy Comment"), 5903 act = purple_menu_action_new(_("Edit Buddy Comment"),
5904 GAIM_CALLBACK(oscar_buddycb_edit_comment), 5904 PURPLE_CALLBACK(oscar_buddycb_edit_comment),
5905 NULL, NULL); 5905 NULL, NULL);
5906 menu = g_list_prepend(menu, act); 5906 menu = g_list_prepend(menu, act);
5907 5907
5908 #if 0 5908 #if 0
5909 if (od->icq) 5909 if (od->icq)
5910 { 5910 {
5911 act = gaim_menu_action_new(_("Get Status Msg"), 5911 act = purple_menu_action_new(_("Get Status Msg"),
5912 GAIM_CALLBACK(oscar_get_icqstatusmsg), 5912 PURPLE_CALLBACK(oscar_get_icqstatusmsg),
5913 NULL, NULL); 5913 NULL, NULL);
5914 menu = g_list_prepend(menu, act); 5914 menu = g_list_prepend(menu, act);
5915 } 5915 }
5916 #endif 5916 #endif
5917 5917
5918 if (userinfo && 5918 if (userinfo &&
5919 aim_sncmp(gaim_account_get_username(buddy->account), buddy->name) && 5919 aim_sncmp(purple_account_get_username(buddy->account), buddy->name) &&
5920 GAIM_BUDDY_IS_ONLINE(buddy)) 5920 PURPLE_BUDDY_IS_ONLINE(buddy))
5921 { 5921 {
5922 if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM) 5922 if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM)
5923 { 5923 {
5924 act = gaim_menu_action_new(_("Direct IM"), 5924 act = purple_menu_action_new(_("Direct IM"),
5925 GAIM_CALLBACK(oscar_ask_directim), 5925 PURPLE_CALLBACK(oscar_ask_directim),
5926 NULL, NULL); 5926 NULL, NULL);
5927 menu = g_list_prepend(menu, act); 5927 menu = g_list_prepend(menu, act);
5928 } 5928 }
5929 #if 0 5929 #if 0
5930 /* TODO: This menu item should be added by the core */ 5930 /* TODO: This menu item should be added by the core */
5931 if (userinfo->capabilities & OSCAR_CAPABILITY_GETFILE) { 5931 if (userinfo->capabilities & OSCAR_CAPABILITY_GETFILE) {
5932 act = gaim_menu_action_new(_("Get File"), 5932 act = purple_menu_action_new(_("Get File"),
5933 GAIM_CALLBACK(oscar_ask_getfile), 5933 PURPLE_CALLBACK(oscar_ask_getfile),
5934 NULL, NULL); 5934 NULL, NULL);
5935 menu = g_list_prepend(menu, act); 5935 menu = g_list_prepend(menu, act);
5936 } 5936 }
5937 #endif 5937 #endif
5938 } 5938 }
5941 { 5941 {
5942 char *gname; 5942 char *gname;
5943 gname = aim_ssi_itemlist_findparentname(od->ssi.local, buddy->name); 5943 gname = aim_ssi_itemlist_findparentname(od->ssi.local, buddy->name);
5944 if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, buddy->name)) 5944 if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, buddy->name))
5945 { 5945 {
5946 act = gaim_menu_action_new(_("Re-request Authorization"), 5946 act = purple_menu_action_new(_("Re-request Authorization"),
5947 GAIM_CALLBACK(gaim_auth_sendrequest_menu), 5947 PURPLE_CALLBACK(purple_auth_sendrequest_menu),
5948 NULL, NULL); 5948 NULL, NULL);
5949 menu = g_list_prepend(menu, act); 5949 menu = g_list_prepend(menu, act);
5950 } 5950 }
5951 } 5951 }
5952 5952
5954 5954
5955 return menu; 5955 return menu;
5956 } 5956 }
5957 5957
5958 5958
5959 GList *oscar_blist_node_menu(GaimBlistNode *node) { 5959 GList *oscar_blist_node_menu(PurpleBlistNode *node) {
5960 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { 5960 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
5961 return oscar_buddy_menu((GaimBuddy *) node); 5961 return oscar_buddy_menu((PurpleBuddy *) node);
5962 } else { 5962 } else {
5963 return NULL; 5963 return NULL;
5964 } 5964 }
5965 } 5965 }
5966 5966
5967 static void 5967 static void
5968 oscar_icq_privacy_opts(GaimConnection *gc, GaimRequestFields *fields) 5968 oscar_icq_privacy_opts(PurpleConnection *gc, PurpleRequestFields *fields)
5969 { 5969 {
5970 OscarData *od = gc->proto_data; 5970 OscarData *od = gc->proto_data;
5971 GaimAccount *account = gaim_connection_get_account(gc); 5971 PurpleAccount *account = purple_connection_get_account(gc);
5972 GaimRequestField *f; 5972 PurpleRequestField *f;
5973 gboolean auth, web_aware; 5973 gboolean auth, web_aware;
5974 5974
5975 f = gaim_request_fields_get_field(fields, "authorization"); 5975 f = purple_request_fields_get_field(fields, "authorization");
5976 auth = gaim_request_field_bool_get_value(f); 5976 auth = purple_request_field_bool_get_value(f);
5977 5977
5978 f = gaim_request_fields_get_field(fields, "web_aware"); 5978 f = purple_request_fields_get_field(fields, "web_aware");
5979 web_aware = gaim_request_field_bool_get_value(f); 5979 web_aware = purple_request_field_bool_get_value(f);
5980 5980
5981 gaim_account_set_bool(account, "authorization", auth); 5981 purple_account_set_bool(account, "authorization", auth);
5982 gaim_account_set_bool(account, "web_aware", web_aware); 5982 purple_account_set_bool(account, "web_aware", web_aware);
5983 5983
5984 oscar_set_extendedstatus(gc); 5984 oscar_set_extendedstatus(gc);
5985 aim_icq_setsecurity(od, auth, web_aware); 5985 aim_icq_setsecurity(od, auth, web_aware);
5986 } 5986 }
5987 5987
5988 static void 5988 static void
5989 oscar_show_icq_privacy_opts(GaimPluginAction *action) 5989 oscar_show_icq_privacy_opts(PurplePluginAction *action)
5990 { 5990 {
5991 GaimConnection *gc = (GaimConnection *) action->context; 5991 PurpleConnection *gc = (PurpleConnection *) action->context;
5992 GaimAccount *account = gaim_connection_get_account(gc); 5992 PurpleAccount *account = purple_connection_get_account(gc);
5993 GaimRequestFields *fields; 5993 PurpleRequestFields *fields;
5994 GaimRequestFieldGroup *g; 5994 PurpleRequestFieldGroup *g;
5995 GaimRequestField *f; 5995 PurpleRequestField *f;
5996 gboolean auth, web_aware; 5996 gboolean auth, web_aware;
5997 5997
5998 auth = gaim_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION); 5998 auth = purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION);
5999 web_aware = gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE); 5999 web_aware = purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE);
6000 6000
6001 fields = gaim_request_fields_new(); 6001 fields = purple_request_fields_new();
6002 6002
6003 g = gaim_request_field_group_new(NULL); 6003 g = purple_request_field_group_new(NULL);
6004 6004
6005 f = gaim_request_field_bool_new("authorization", _("Require authorization"), auth); 6005 f = purple_request_field_bool_new("authorization", _("Require authorization"), auth);
6006 gaim_request_field_group_add_field(g, f); 6006 purple_request_field_group_add_field(g, f);
6007 6007
6008 f = gaim_request_field_bool_new("web_aware", _("Web aware (enabling this will cause you to receive SPAM!)"), web_aware); 6008 f = purple_request_field_bool_new("web_aware", _("Web aware (enabling this will cause you to receive SPAM!)"), web_aware);
6009 gaim_request_field_group_add_field(g, f); 6009 purple_request_field_group_add_field(g, f);
6010 6010
6011 gaim_request_fields_add_group(fields, g); 6011 purple_request_fields_add_group(fields, g);
6012 6012
6013 gaim_request_fields(gc, _("ICQ Privacy Options"), _("ICQ Privacy Options"), 6013 purple_request_fields(gc, _("ICQ Privacy Options"), _("ICQ Privacy Options"),
6014 NULL, fields, 6014 NULL, fields,
6015 _("OK"), G_CALLBACK(oscar_icq_privacy_opts), 6015 _("OK"), G_CALLBACK(oscar_icq_privacy_opts),
6016 _("Cancel"), NULL, gc); 6016 _("Cancel"), NULL, gc);
6017 } 6017 }
6018 6018
6019 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { 6019 static void oscar_format_screenname(PurpleConnection *gc, const char *nick) {
6020 OscarData *od = gc->proto_data; 6020 OscarData *od = gc->proto_data;
6021 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { 6021 if (!aim_sncmp(purple_account_get_username(purple_connection_get_account(gc)), nick)) {
6022 if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) { 6022 if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) {
6023 od->setnick = TRUE; 6023 od->setnick = TRUE;
6024 od->newsn = g_strdup(nick); 6024 od->newsn = g_strdup(nick);
6025 aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); 6025 aim_srv_requestnew(od, SNAC_FAMILY_ADMIN);
6026 } else { 6026 } else {
6027 aim_admin_setnick(od, flap_connection_getbytype(od, SNAC_FAMILY_ADMIN), nick); 6027 aim_admin_setnick(od, flap_connection_getbytype(od, SNAC_FAMILY_ADMIN), nick);
6028 } 6028 }
6029 } else { 6029 } else {
6030 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), 6030 purple_notify_error(gc, NULL, _("The new formatting is invalid."),
6031 _("Screen name formatting can change only capitalization and whitespace.")); 6031 _("Screen name formatting can change only capitalization and whitespace."));
6032 } 6032 }
6033 } 6033 }
6034 6034
6035 static void oscar_confirm_account(GaimPluginAction *action) 6035 static void oscar_confirm_account(PurplePluginAction *action)
6036 { 6036 {
6037 GaimConnection *gc; 6037 PurpleConnection *gc;
6038 OscarData *od; 6038 OscarData *od;
6039 FlapConnection *conn; 6039 FlapConnection *conn;
6040 6040
6041 gc = (GaimConnection *)action->context; 6041 gc = (PurpleConnection *)action->context;
6042 od = gc->proto_data; 6042 od = gc->proto_data;
6043 6043
6044 conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); 6044 conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN);
6045 if (conn != NULL) { 6045 if (conn != NULL) {
6046 aim_admin_reqconfirm(od, conn); 6046 aim_admin_reqconfirm(od, conn);
6048 od->conf = TRUE; 6048 od->conf = TRUE;
6049 aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); 6049 aim_srv_requestnew(od, SNAC_FAMILY_ADMIN);
6050 } 6050 }
6051 } 6051 }
6052 6052
6053 static void oscar_show_email(GaimPluginAction *action) 6053 static void oscar_show_email(PurplePluginAction *action)
6054 { 6054 {
6055 GaimConnection *gc = (GaimConnection *) action->context; 6055 PurpleConnection *gc = (PurpleConnection *) action->context;
6056 OscarData *od = gc->proto_data; 6056 OscarData *od = gc->proto_data;
6057 FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); 6057 FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN);
6058 6058
6059 if (conn) { 6059 if (conn) {
6060 aim_admin_getinfo(od, conn, 0x11); 6060 aim_admin_getinfo(od, conn, 0x11);
6062 od->reqemail = TRUE; 6062 od->reqemail = TRUE;
6063 aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); 6063 aim_srv_requestnew(od, SNAC_FAMILY_ADMIN);
6064 } 6064 }
6065 } 6065 }
6066 6066
6067 static void oscar_change_email(GaimConnection *gc, const char *email) 6067 static void oscar_change_email(PurpleConnection *gc, const char *email)
6068 { 6068 {
6069 OscarData *od = gc->proto_data; 6069 OscarData *od = gc->proto_data;
6070 FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); 6070 FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN);
6071 6071
6072 if (conn) { 6072 if (conn) {
6076 od->email = g_strdup(email); 6076 od->email = g_strdup(email);
6077 aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); 6077 aim_srv_requestnew(od, SNAC_FAMILY_ADMIN);
6078 } 6078 }
6079 } 6079 }
6080 6080
6081 static void oscar_show_change_email(GaimPluginAction *action) 6081 static void oscar_show_change_email(PurplePluginAction *action)
6082 { 6082 {
6083 GaimConnection *gc = (GaimConnection *) action->context; 6083 PurpleConnection *gc = (PurpleConnection *) action->context;
6084 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, 6084 purple_request_input(gc, NULL, _("Change Address To:"), NULL, NULL,
6085 FALSE, FALSE, NULL, 6085 FALSE, FALSE, NULL,
6086 _("_OK"), G_CALLBACK(oscar_change_email), 6086 _("_OK"), G_CALLBACK(oscar_change_email),
6087 _("_Cancel"), NULL, 6087 _("_Cancel"), NULL,
6088 gc); 6088 gc);
6089 } 6089 }
6090 6090
6091 static void oscar_show_awaitingauth(GaimPluginAction *action) 6091 static void oscar_show_awaitingauth(PurplePluginAction *action)
6092 { 6092 {
6093 GaimConnection *gc = (GaimConnection *) action->context; 6093 PurpleConnection *gc = (PurpleConnection *) action->context;
6094 OscarData *od = gc->proto_data; 6094 OscarData *od = gc->proto_data;
6095 gchar *nombre, *text, *tmp; 6095 gchar *nombre, *text, *tmp;
6096 GaimBlistNode *gnode, *cnode, *bnode; 6096 PurpleBlistNode *gnode, *cnode, *bnode;
6097 int num=0; 6097 int num=0;
6098 6098
6099 text = g_strdup(""); 6099 text = g_strdup("");
6100 6100
6101 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { 6101 for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
6102 GaimGroup *group = (GaimGroup *)gnode; 6102 PurpleGroup *group = (PurpleGroup *)gnode;
6103 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) 6103 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
6104 continue; 6104 continue;
6105 for (cnode = gnode->child; cnode; cnode = cnode->next) { 6105 for (cnode = gnode->child; cnode; cnode = cnode->next) {
6106 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) 6106 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
6107 continue; 6107 continue;
6108 for (bnode = cnode->child; bnode; bnode = bnode->next) { 6108 for (bnode = cnode->child; bnode; bnode = bnode->next) {
6109 GaimBuddy *buddy = (GaimBuddy *)bnode; 6109 PurpleBuddy *buddy = (PurpleBuddy *)bnode;
6110 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) 6110 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
6111 continue; 6111 continue;
6112 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->ssi.local, group->name, buddy->name)) { 6112 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->ssi.local, group->name, buddy->name)) {
6113 if (gaim_buddy_get_alias_only(buddy)) 6113 if (purple_buddy_get_alias_only(buddy))
6114 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_buddy_get_alias_only(buddy)); 6114 nombre = g_strdup_printf(" %s (%s)", buddy->name, purple_buddy_get_alias_only(buddy));
6115 else 6115 else
6116 nombre = g_strdup_printf(" %s", buddy->name); 6116 nombre = g_strdup_printf(" %s", buddy->name);
6117 tmp = g_strdup_printf("%s%s<br>", text, nombre); 6117 tmp = g_strdup_printf("%s%s<br>", text, nombre);
6118 g_free(text); 6118 g_free(text);
6119 text = tmp; 6119 text = tmp;
6127 if (!num) { 6127 if (!num) {
6128 g_free(text); 6128 g_free(text);
6129 text = g_strdup(_("<i>you are not waiting for authorization</i>")); 6129 text = g_strdup(_("<i>you are not waiting for authorization</i>"));
6130 } 6130 }
6131 6131
6132 gaim_notify_formatted(gc, NULL, _("You are awaiting authorization from " 6132 purple_notify_formatted(gc, NULL, _("You are awaiting authorization from "
6133 "the following buddies"), _("You can re-request " 6133 "the following buddies"), _("You can re-request "
6134 "authorization from these buddies by " 6134 "authorization from these buddies by "
6135 "right-clicking on them and selecting " 6135 "right-clicking on them and selecting "
6136 "\"Re-request Authorization.\""), text, NULL, NULL); 6136 "\"Re-request Authorization.\""), text, NULL, NULL);
6137 g_free(text); 6137 g_free(text);
6138 } 6138 }
6139 6139
6140 static void search_by_email_cb(GaimConnection *gc, const char *email) 6140 static void search_by_email_cb(PurpleConnection *gc, const char *email)
6141 { 6141 {
6142 OscarData *od = (OscarData *)gc->proto_data; 6142 OscarData *od = (OscarData *)gc->proto_data;
6143 6143
6144 aim_search_address(od, email); 6144 aim_search_address(od, email);
6145 } 6145 }
6146 6146
6147 static void oscar_show_find_email(GaimPluginAction *action) 6147 static void oscar_show_find_email(PurplePluginAction *action)
6148 { 6148 {
6149 GaimConnection *gc = (GaimConnection *) action->context; 6149 PurpleConnection *gc = (PurpleConnection *) action->context;
6150 gaim_request_input(gc, _("Find Buddy by E-Mail"), 6150 purple_request_input(gc, _("Find Buddy by E-Mail"),
6151 _("Search for a buddy by e-mail address"), 6151 _("Search for a buddy by e-mail address"),
6152 _("Type the e-mail address of the buddy you are " 6152 _("Type the e-mail address of the buddy you are "
6153 "searching for."), 6153 "searching for."),
6154 NULL, FALSE, FALSE, NULL, 6154 NULL, FALSE, FALSE, NULL,
6155 _("_Search"), G_CALLBACK(search_by_email_cb), 6155 _("_Search"), G_CALLBACK(search_by_email_cb),
6156 _("_Cancel"), NULL, gc); 6156 _("_Cancel"), NULL, gc);
6157 } 6157 }
6158 6158
6159 static void oscar_show_set_info(GaimPluginAction *action) 6159 static void oscar_show_set_info(PurplePluginAction *action)
6160 { 6160 {
6161 GaimConnection *gc = (GaimConnection *) action->context; 6161 PurpleConnection *gc = (PurpleConnection *) action->context;
6162 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); 6162 purple_account_request_change_user_info(purple_connection_get_account(gc));
6163 } 6163 }
6164 6164
6165 static void oscar_show_set_info_icqurl(GaimPluginAction *action) 6165 static void oscar_show_set_info_icqurl(PurplePluginAction *action)
6166 { 6166 {
6167 GaimConnection *gc = (GaimConnection *) action->context; 6167 PurpleConnection *gc = (PurpleConnection *) action->context;
6168 gaim_notify_uri(gc, "http://www.icq.com/whitepages/user_details.php"); 6168 purple_notify_uri(gc, "http://www.icq.com/whitepages/user_details.php");
6169 } 6169 }
6170 6170
6171 static void oscar_change_pass(GaimPluginAction *action) 6171 static void oscar_change_pass(PurplePluginAction *action)
6172 { 6172 {
6173 GaimConnection *gc = (GaimConnection *) action->context; 6173 PurpleConnection *gc = (PurpleConnection *) action->context;
6174 gaim_account_request_change_password(gaim_connection_get_account(gc)); 6174 purple_account_request_change_password(purple_connection_get_account(gc));
6175 } 6175 }
6176 6176
6177 static void oscar_show_chpassurl(GaimPluginAction *action) 6177 static void oscar_show_chpassurl(PurplePluginAction *action)
6178 { 6178 {
6179 GaimConnection *gc = (GaimConnection *) action->context; 6179 PurpleConnection *gc = (PurpleConnection *) action->context;
6180 OscarData *od = gc->proto_data; 6180 OscarData *od = gc->proto_data;
6181 gchar *substituted = gaim_strreplace(od->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); 6181 gchar *substituted = purple_strreplace(od->authinfo->chpassurl, "%s", purple_account_get_username(purple_connection_get_account(gc)));
6182 gaim_notify_uri(gc, substituted); 6182 purple_notify_uri(gc, substituted);
6183 g_free(substituted); 6183 g_free(substituted);
6184 } 6184 }
6185 6185
6186 static void oscar_show_imforwardingurl(GaimPluginAction *action) 6186 static void oscar_show_imforwardingurl(PurplePluginAction *action)
6187 { 6187 {
6188 GaimConnection *gc = (GaimConnection *) action->context; 6188 PurpleConnection *gc = (PurpleConnection *) action->context;
6189 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); 6189 purple_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1");
6190 } 6190 }
6191 6191
6192 void oscar_set_icon(GaimConnection *gc, const char *iconfile) 6192 void oscar_set_icon(PurpleConnection *gc, const char *iconfile)
6193 { 6193 {
6194 OscarData *od = gc->proto_data; 6194 OscarData *od = gc->proto_data;
6195 FILE *file; 6195 FILE *file;
6196 struct stat st; 6196 struct stat st;
6197 6197
6200 } else if (!g_stat(iconfile, &st)) { 6200 } else if (!g_stat(iconfile, &st)) {
6201 guchar *buf = g_malloc(st.st_size); 6201 guchar *buf = g_malloc(st.st_size);
6202 file = g_fopen(iconfile, "rb"); 6202 file = g_fopen(iconfile, "rb");
6203 if (file) 6203 if (file)
6204 { 6204 {
6205 GaimCipher *cipher; 6205 PurpleCipher *cipher;
6206 GaimCipherContext *context; 6206 PurpleCipherContext *context;
6207 guchar md5[16]; 6207 guchar md5[16];
6208 int len; 6208 int len;
6209 6209
6210 /* XXX - Use g_file_get_contents()? */ 6210 /* XXX - Use g_file_get_contents()? */
6211 len = fread(buf, 1, st.st_size, file); 6211 len = fread(buf, 1, st.st_size, file);
6212 fclose(file); 6212 fclose(file);
6213 6213
6214 cipher = gaim_ciphers_find_cipher("md5"); 6214 cipher = purple_ciphers_find_cipher("md5");
6215 context = gaim_cipher_context_new(cipher, NULL); 6215 context = purple_cipher_context_new(cipher, NULL);
6216 gaim_cipher_context_append(context, buf, len); 6216 purple_cipher_context_append(context, buf, len);
6217 gaim_cipher_context_digest(context, 16, md5, NULL); 6217 purple_cipher_context_digest(context, 16, md5, NULL);
6218 gaim_cipher_context_destroy(context); 6218 purple_cipher_context_destroy(context);
6219 6219
6220 aim_ssi_seticon(od, md5, 16); 6220 aim_ssi_seticon(od, md5, 16);
6221 } else 6221 } else
6222 gaim_debug_error("oscar", 6222 purple_debug_error("oscar",
6223 "Can't open buddy icon file!\n"); 6223 "Can't open buddy icon file!\n");
6224 g_free(buf); 6224 g_free(buf);
6225 } else 6225 } else
6226 gaim_debug_error("oscar", "Can't stat buddy icon file!\n"); 6226 purple_debug_error("oscar", "Can't stat buddy icon file!\n");
6227 } 6227 }
6228 6228
6229 /** 6229 /**
6230 * Called by the Gaim core to determine whether or not we're 6230 * Called by the Purple core to determine whether or not we're
6231 * allowed to send a file to this user. 6231 * allowed to send a file to this user.
6232 */ 6232 */
6233 gboolean 6233 gboolean
6234 oscar_can_receive_file(GaimConnection *gc, const char *who) 6234 oscar_can_receive_file(PurpleConnection *gc, const char *who)
6235 { 6235 {
6236 OscarData *od; 6236 OscarData *od;
6237 GaimAccount *account; 6237 PurpleAccount *account;
6238 6238
6239 od = gc->proto_data; 6239 od = gc->proto_data;
6240 account = gaim_connection_get_account(gc); 6240 account = purple_connection_get_account(gc);
6241 6241
6242 if (od != NULL) 6242 if (od != NULL)
6243 { 6243 {
6244 aim_userinfo_t *userinfo; 6244 aim_userinfo_t *userinfo;
6245 userinfo = aim_locate_finduserinfo(od, who); 6245 userinfo = aim_locate_finduserinfo(od, who);
6248 * Don't allowing sending a file to a user that does not support 6248 * Don't allowing sending a file to a user that does not support
6249 * file transfer, and don't allow sending to ourselves. 6249 * file transfer, and don't allow sending to ourselves.
6250 */ 6250 */
6251 if (((userinfo == NULL) || 6251 if (((userinfo == NULL) ||
6252 (userinfo->capabilities & OSCAR_CAPABILITY_SENDFILE)) && 6252 (userinfo->capabilities & OSCAR_CAPABILITY_SENDFILE)) &&
6253 aim_sncmp(who, gaim_account_get_username(account))) 6253 aim_sncmp(who, purple_account_get_username(account)))
6254 { 6254 {
6255 return TRUE; 6255 return TRUE;
6256 } 6256 }
6257 } 6257 }
6258 6258
6259 return FALSE; 6259 return FALSE;
6260 } 6260 }
6261 6261
6262 GaimXfer * 6262 PurpleXfer *
6263 oscar_new_xfer(GaimConnection *gc, const char *who) 6263 oscar_new_xfer(PurpleConnection *gc, const char *who)
6264 { 6264 {
6265 GaimXfer *xfer; 6265 PurpleXfer *xfer;
6266 OscarData *od; 6266 OscarData *od;
6267 GaimAccount *account; 6267 PurpleAccount *account;
6268 PeerConnection *conn; 6268 PeerConnection *conn;
6269 6269
6270 od = gc->proto_data; 6270 od = gc->proto_data;
6271 account = gaim_connection_get_account(gc); 6271 account = purple_connection_get_account(gc);
6272 6272
6273 xfer = gaim_xfer_new(account, GAIM_XFER_SEND, who); 6273 xfer = purple_xfer_new(account, PURPLE_XFER_SEND, who);
6274 if (xfer) 6274 if (xfer)
6275 { 6275 {
6276 gaim_xfer_ref(xfer); 6276 purple_xfer_ref(xfer);
6277 gaim_xfer_set_init_fnc(xfer, peer_oft_sendcb_init); 6277 purple_xfer_set_init_fnc(xfer, peer_oft_sendcb_init);
6278 gaim_xfer_set_cancel_send_fnc(xfer, peer_oft_cb_generic_cancel); 6278 purple_xfer_set_cancel_send_fnc(xfer, peer_oft_cb_generic_cancel);
6279 gaim_xfer_set_request_denied_fnc(xfer, peer_oft_cb_generic_cancel); 6279 purple_xfer_set_request_denied_fnc(xfer, peer_oft_cb_generic_cancel);
6280 gaim_xfer_set_ack_fnc(xfer, peer_oft_sendcb_ack); 6280 purple_xfer_set_ack_fnc(xfer, peer_oft_sendcb_ack);
6281 6281
6282 conn = peer_connection_new(od, OSCAR_CAPABILITY_SENDFILE, who); 6282 conn = peer_connection_new(od, OSCAR_CAPABILITY_SENDFILE, who);
6283 conn->flags |= PEER_CONNECTION_FLAG_INITIATED_BY_ME; 6283 conn->flags |= PEER_CONNECTION_FLAG_INITIATED_BY_ME;
6284 conn->flags |= PEER_CONNECTION_FLAG_APPROVED; 6284 conn->flags |= PEER_CONNECTION_FLAG_APPROVED;
6285 aim_icbm_makecookie(conn->cookie); 6285 aim_icbm_makecookie(conn->cookie);
6289 6289
6290 return xfer; 6290 return xfer;
6291 } 6291 }
6292 6292
6293 /* 6293 /*
6294 * Called by the Gaim core when the user indicates that a 6294 * Called by the Purple core when the user indicates that a
6295 * file is to be sent to a special someone. 6295 * file is to be sent to a special someone.
6296 */ 6296 */
6297 void 6297 void
6298 oscar_send_file(GaimConnection *gc, const char *who, const char *file) 6298 oscar_send_file(PurpleConnection *gc, const char *who, const char *file)
6299 { 6299 {
6300 GaimXfer *xfer; 6300 PurpleXfer *xfer;
6301 6301
6302 xfer = oscar_new_xfer(gc, who); 6302 xfer = oscar_new_xfer(gc, who);
6303 6303
6304 if (file != NULL) 6304 if (file != NULL)
6305 gaim_xfer_request_accepted(xfer, file); 6305 purple_xfer_request_accepted(xfer, file);
6306 else 6306 else
6307 gaim_xfer_request(xfer); 6307 purple_xfer_request(xfer);
6308 } 6308 }
6309 6309
6310 GList * 6310 GList *
6311 oscar_actions(GaimPlugin *plugin, gpointer context) 6311 oscar_actions(PurplePlugin *plugin, gpointer context)
6312 { 6312 {
6313 GaimConnection *gc = (GaimConnection *) context; 6313 PurpleConnection *gc = (PurpleConnection *) context;
6314 OscarData *od = gc->proto_data; 6314 OscarData *od = gc->proto_data;
6315 GList *menu = NULL; 6315 GList *menu = NULL;
6316 GaimPluginAction *act; 6316 PurplePluginAction *act;
6317 6317
6318 act = gaim_plugin_action_new(_("Set User Info..."), 6318 act = purple_plugin_action_new(_("Set User Info..."),
6319 oscar_show_set_info); 6319 oscar_show_set_info);
6320 menu = g_list_prepend(menu, act); 6320 menu = g_list_prepend(menu, act);
6321 6321
6322 if (od->icq) 6322 if (od->icq)
6323 { 6323 {
6324 act = gaim_plugin_action_new(_("Set User Info (URL)..."), 6324 act = purple_plugin_action_new(_("Set User Info (URL)..."),
6325 oscar_show_set_info_icqurl); 6325 oscar_show_set_info_icqurl);
6326 menu = g_list_prepend(menu, act); 6326 menu = g_list_prepend(menu, act);
6327 } 6327 }
6328 6328
6329 act = gaim_plugin_action_new(_("Change Password..."), 6329 act = purple_plugin_action_new(_("Change Password..."),
6330 oscar_change_pass); 6330 oscar_change_pass);
6331 menu = g_list_prepend(menu, act); 6331 menu = g_list_prepend(menu, act);
6332 6332
6333 if (od->authinfo->chpassurl != NULL) 6333 if (od->authinfo->chpassurl != NULL)
6334 { 6334 {
6335 act = gaim_plugin_action_new(_("Change Password (URL)"), 6335 act = purple_plugin_action_new(_("Change Password (URL)"),
6336 oscar_show_chpassurl); 6336 oscar_show_chpassurl);
6337 menu = g_list_prepend(menu, act); 6337 menu = g_list_prepend(menu, act);
6338 6338
6339 act = gaim_plugin_action_new(_("Configure IM Forwarding (URL)"), 6339 act = purple_plugin_action_new(_("Configure IM Forwarding (URL)"),
6340 oscar_show_imforwardingurl); 6340 oscar_show_imforwardingurl);
6341 menu = g_list_prepend(menu, act); 6341 menu = g_list_prepend(menu, act);
6342 } 6342 }
6343 6343
6344 menu = g_list_prepend(menu, NULL); 6344 menu = g_list_prepend(menu, NULL);
6345 6345
6346 if (od->icq) 6346 if (od->icq)
6347 { 6347 {
6348 /* ICQ actions */ 6348 /* ICQ actions */
6349 act = gaim_plugin_action_new(_("Set Privacy Options..."), 6349 act = purple_plugin_action_new(_("Set Privacy Options..."),
6350 oscar_show_icq_privacy_opts); 6350 oscar_show_icq_privacy_opts);
6351 menu = g_list_prepend(menu, act); 6351 menu = g_list_prepend(menu, act);
6352 } 6352 }
6353 else 6353 else
6354 { 6354 {
6355 /* AIM actions */ 6355 /* AIM actions */
6356 act = gaim_plugin_action_new(_("Confirm Account"), 6356 act = purple_plugin_action_new(_("Confirm Account"),
6357 oscar_confirm_account); 6357 oscar_confirm_account);
6358 menu = g_list_prepend(menu, act); 6358 menu = g_list_prepend(menu, act);
6359 6359
6360 act = gaim_plugin_action_new(_("Display Currently Registered E-Mail Address"), 6360 act = purple_plugin_action_new(_("Display Currently Registered E-Mail Address"),
6361 oscar_show_email); 6361 oscar_show_email);
6362 menu = g_list_prepend(menu, act); 6362 menu = g_list_prepend(menu, act);
6363 6363
6364 act = gaim_plugin_action_new(_("Change Currently Registered E-Mail Address..."), 6364 act = purple_plugin_action_new(_("Change Currently Registered E-Mail Address..."),
6365 oscar_show_change_email); 6365 oscar_show_change_email);
6366 menu = g_list_prepend(menu, act); 6366 menu = g_list_prepend(menu, act);
6367 } 6367 }
6368 6368
6369 menu = g_list_prepend(menu, NULL); 6369 menu = g_list_prepend(menu, NULL);
6370 6370
6371 act = gaim_plugin_action_new(_("Show Buddies Awaiting Authorization"), 6371 act = purple_plugin_action_new(_("Show Buddies Awaiting Authorization"),
6372 oscar_show_awaitingauth); 6372 oscar_show_awaitingauth);
6373 menu = g_list_prepend(menu, act); 6373 menu = g_list_prepend(menu, act);
6374 6374
6375 menu = g_list_prepend(menu, NULL); 6375 menu = g_list_prepend(menu, NULL);
6376 6376
6377 act = gaim_plugin_action_new(_("Search for Buddy by E-Mail Address..."), 6377 act = purple_plugin_action_new(_("Search for Buddy by E-Mail Address..."),
6378 oscar_show_find_email); 6378 oscar_show_find_email);
6379 menu = g_list_prepend(menu, act); 6379 menu = g_list_prepend(menu, act);
6380 6380
6381 #if 0 6381 #if 0
6382 act = gaim_plugin_action_new(_("Search for Buddy by Information"), 6382 act = purple_plugin_action_new(_("Search for Buddy by Information"),
6383 show_find_info); 6383 show_find_info);
6384 menu = g_list_prepend(menu, act); 6384 menu = g_list_prepend(menu, act);
6385 #endif 6385 #endif
6386 6386
6387 menu = g_list_reverse(menu); 6387 menu = g_list_reverse(menu);
6388 6388
6389 return menu; 6389 return menu;
6390 } 6390 }
6391 6391
6392 void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) 6392 void oscar_change_passwd(PurpleConnection *gc, const char *old, const char *new)
6393 { 6393 {
6394 OscarData *od = gc->proto_data; 6394 OscarData *od = gc->proto_data;
6395 6395
6396 if (od->icq) { 6396 if (od->icq) {
6397 aim_icq_changepasswd(od, new); 6397 aim_icq_changepasswd(od, new);
6408 } 6408 }
6409 } 6409 }
6410 } 6410 }
6411 6411
6412 void 6412 void
6413 oscar_convo_closed(GaimConnection *gc, const char *who) 6413 oscar_convo_closed(PurpleConnection *gc, const char *who)
6414 { 6414 {
6415 OscarData *od; 6415 OscarData *od;
6416 PeerConnection *conn; 6416 PeerConnection *conn;
6417 6417
6418 od = gc->proto_data; 6418 od = gc->proto_data;
6426 peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); 6426 peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL);
6427 } 6427 }
6428 } 6428 }
6429 6429
6430 static void 6430 static void
6431 recent_buddies_cb(const char *name, GaimPrefType type, 6431 recent_buddies_cb(const char *name, PurplePrefType type,
6432 gconstpointer value, gpointer data) 6432 gconstpointer value, gpointer data)
6433 { 6433 {
6434 GaimConnection *gc = data; 6434 PurpleConnection *gc = data;
6435 OscarData *od = gc->proto_data; 6435 OscarData *od = gc->proto_data;
6436 guint32 presence; 6436 guint32 presence;
6437 6437
6438 presence = aim_ssi_getpresence(od->ssi.local); 6438 presence = aim_ssi_getpresence(od->ssi.local);
6439 6439
6445 aim_ssi_setpresence(od, presence); 6445 aim_ssi_setpresence(od, presence);
6446 } 6446 }
6447 } 6447 }
6448 6448
6449 #ifdef USE_PRPL_PREFERENCES 6449 #ifdef USE_PRPL_PREFERENCES
6450 ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/recent_buddies", _("Use recent buddies group")); 6450 ppref = purple_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/recent_buddies", _("Use recent buddies group"));
6451 gaim_plugin_pref_frame_add(frame, ppref); 6451 purple_plugin_pref_frame_add(frame, ppref);
6452 6452
6453 ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/show_idle", _("Show how long you have been idle")); 6453 ppref = purple_plugin_pref_new_with_name_and_label("/plugins/prpl/oscar/show_idle", _("Show how long you have been idle"));
6454 gaim_plugin_pref_frame_add(frame, ppref); 6454 purple_plugin_pref_frame_add(frame, ppref);
6455 #endif 6455 #endif
6456 6456
6457 const char * 6457 const char *
6458 oscar_normalize(const GaimAccount *account, const char *str) 6458 oscar_normalize(const PurpleAccount *account, const char *str)
6459 { 6459 {
6460 static char buf[BUF_LEN]; 6460 static char buf[BUF_LEN];
6461 char *tmp1, *tmp2; 6461 char *tmp1, *tmp2;
6462 int i, j; 6462 int i, j;
6463 6463
6480 6480
6481 return buf; 6481 return buf;
6482 } 6482 }
6483 6483
6484 gboolean 6484 gboolean
6485 oscar_offline_message(const GaimBuddy *buddy) 6485 oscar_offline_message(const PurpleBuddy *buddy)
6486 { 6486 {
6487 OscarData *od; 6487 OscarData *od;
6488 GaimAccount *account; 6488 PurpleAccount *account;
6489 GaimConnection *gc; 6489 PurpleConnection *gc;
6490 6490
6491 account = gaim_buddy_get_account(buddy); 6491 account = purple_buddy_get_account(buddy);
6492 gc = gaim_account_get_connection(account); 6492 gc = purple_account_get_connection(account);
6493 od = (OscarData *)gc->proto_data; 6493 od = (OscarData *)gc->proto_data;
6494 6494
6495 return (od->icq && aim_sn_is_icq(gaim_account_get_username(account))); 6495 return (od->icq && aim_sn_is_icq(purple_account_get_username(account)));
6496 } 6496 }
6497 6497
6498 /* TODO: Find somewhere to put this instead of including it in a bunch of places. 6498 /* TODO: Find somewhere to put this instead of including it in a bunch of places.
6499 * Maybe just change gaim_accounts_find() to return anything for the prpl if there is no acct_id. 6499 * Maybe just change purple_accounts_find() to return anything for the prpl if there is no acct_id.
6500 */ 6500 */
6501 static GaimAccount *find_acct(const char *prpl, const char *acct_id) 6501 static PurpleAccount *find_acct(const char *prpl, const char *acct_id)
6502 { 6502 {
6503 GaimAccount *acct = NULL; 6503 PurpleAccount *acct = NULL;
6504 6504
6505 /* If we have a specific acct, use it */ 6505 /* If we have a specific acct, use it */
6506 if (acct_id) { 6506 if (acct_id) {
6507 acct = gaim_accounts_find(acct_id, prpl); 6507 acct = purple_accounts_find(acct_id, prpl);
6508 if (acct && !gaim_account_is_connected(acct)) 6508 if (acct && !purple_account_is_connected(acct))
6509 acct = NULL; 6509 acct = NULL;
6510 } else { /* Otherwise find an active account for the protocol */ 6510 } else { /* Otherwise find an active account for the protocol */
6511 GList *l = gaim_accounts_get_all(); 6511 GList *l = purple_accounts_get_all();
6512 while (l) { 6512 while (l) {
6513 if (!strcmp(prpl, gaim_account_get_protocol_id(l->data)) 6513 if (!strcmp(prpl, purple_account_get_protocol_id(l->data))
6514 && gaim_account_is_connected(l->data)) { 6514 && purple_account_is_connected(l->data)) {
6515 acct = l->data; 6515 acct = l->data;
6516 break; 6516 break;
6517 } 6517 }
6518 l = l->next; 6518 l = l->next;
6519 } 6519 }
6525 6525
6526 static gboolean oscar_uri_handler(const char *proto, const char *cmd, GHashTable *params) 6526 static gboolean oscar_uri_handler(const char *proto, const char *cmd, GHashTable *params)
6527 { 6527 {
6528 char *acct_id = g_hash_table_lookup(params, "account"); 6528 char *acct_id = g_hash_table_lookup(params, "account");
6529 char prpl[11]; 6529 char prpl[11];
6530 GaimAccount *acct; 6530 PurpleAccount *acct;
6531 6531
6532 if (g_ascii_strcasecmp(proto, "aim") && g_ascii_strcasecmp(proto, "icq")) 6532 if (g_ascii_strcasecmp(proto, "aim") && g_ascii_strcasecmp(proto, "icq"))
6533 return FALSE; 6533 return FALSE;
6534 6534
6535 g_snprintf(prpl, sizeof(prpl), "prpl-%s", proto); 6535 g_snprintf(prpl, sizeof(prpl), "prpl-%s", proto);
6543 if (!g_ascii_strcasecmp(cmd, "GoIM")) { 6543 if (!g_ascii_strcasecmp(cmd, "GoIM")) {
6544 char *sname = g_hash_table_lookup(params, "screenname"); 6544 char *sname = g_hash_table_lookup(params, "screenname");
6545 if (sname) { 6545 if (sname) {
6546 char *message = g_hash_table_lookup(params, "message"); 6546 char *message = g_hash_table_lookup(params, "message");
6547 6547
6548 GaimConversation *conv = gaim_find_conversation_with_account( 6548 PurpleConversation *conv = purple_find_conversation_with_account(
6549 GAIM_CONV_TYPE_IM, sname, acct); 6549 PURPLE_CONV_TYPE_IM, sname, acct);
6550 if (conv == NULL) 6550 if (conv == NULL)
6551 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, acct, sname); 6551 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname);
6552 gaim_conversation_present(conv); 6552 purple_conversation_present(conv);
6553 6553
6554 if (message) { 6554 if (message) {
6555 /* Spaces are encoded as '+' */ 6555 /* Spaces are encoded as '+' */
6556 g_strdelimit(message, "+", ' '); 6556 g_strdelimit(message, "+", ' ');
6557 gaim_conv_im_send(GAIM_CONV_IM(conv), message); 6557 purple_conv_im_send(PURPLE_CONV_IM(conv), message);
6558 } 6558 }
6559 } 6559 }
6560 /*else 6560 /*else
6561 **If pidgindialogs_im() was in the core, we could use it here. 6561 **If pidgindialogs_im() was in the core, we could use it here.
6562 * It is all gaim_request_* based, but I'm not sure it really belongs in the core 6562 * It is all purple_request_* based, but I'm not sure it really belongs in the core
6563 pidgindialogs_im();*/ 6563 pidgindialogs_im();*/
6564 6564
6565 return TRUE; 6565 return TRUE;
6566 } 6566 }
6567 /* aim:GoChat?roomname=CHATROOMNAME&exchange=4 */ 6567 /* aim:GoChat?roomname=CHATROOMNAME&exchange=4 */
6569 char *rname = g_hash_table_lookup(params, "roomname"); 6569 char *rname = g_hash_table_lookup(params, "roomname");
6570 if (rname) { 6570 if (rname) {
6571 /* This is somewhat hacky, but the params aren't useful after this command */ 6571 /* This is somewhat hacky, but the params aren't useful after this command */
6572 g_hash_table_insert(params, g_strdup("exchange"), g_strdup("4")); 6572 g_hash_table_insert(params, g_strdup("exchange"), g_strdup("4"));
6573 g_hash_table_insert(params, g_strdup("room"), g_strdup(rname)); 6573 g_hash_table_insert(params, g_strdup("room"), g_strdup(rname));
6574 serv_join_chat(gaim_account_get_connection(acct), params); 6574 serv_join_chat(purple_account_get_connection(acct), params);
6575 } 6575 }
6576 /*else 6576 /*else
6577 ** Same as above (except that this would have to be re-written using gaim_request_*) 6577 ** Same as above (except that this would have to be re-written using purple_request_*)
6578 pidgin_blist_joinchat_show(); */ 6578 pidgin_blist_joinchat_show(); */
6579 6579
6580 return TRUE; 6580 return TRUE;
6581 } 6581 }
6582 /* aim:AddBuddy?screenname=SCREENNAME&groupname=GROUPNAME*/ 6582 /* aim:AddBuddy?screenname=SCREENNAME&groupname=GROUPNAME*/
6583 else if (!g_ascii_strcasecmp(cmd, "AddBuddy")) { 6583 else if (!g_ascii_strcasecmp(cmd, "AddBuddy")) {
6584 char *sname = g_hash_table_lookup(params, "screenname"); 6584 char *sname = g_hash_table_lookup(params, "screenname");
6585 char *gname = g_hash_table_lookup(params, "groupname"); 6585 char *gname = g_hash_table_lookup(params, "groupname");
6586 gaim_blist_request_add_buddy(acct, sname, gname, NULL); 6586 purple_blist_request_add_buddy(acct, sname, gname, NULL);
6587 return TRUE; 6587 return TRUE;
6588 } 6588 }
6589 6589
6590 return FALSE; 6590 return FALSE;
6591 } 6591 }
6592 6592
6593 void oscar_init(GaimPluginProtocolInfo *prpl_info) 6593 void oscar_init(PurplePluginProtocolInfo *prpl_info)
6594 { 6594 {
6595 GaimAccountOption *option; 6595 PurpleAccountOption *option;
6596 static gboolean init = FALSE; 6596 static gboolean init = FALSE;
6597 6597
6598 option = gaim_account_option_string_new(_("Server"), "server", OSCAR_DEFAULT_LOGIN_SERVER); 6598 option = purple_account_option_string_new(_("Server"), "server", OSCAR_DEFAULT_LOGIN_SERVER);
6599 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); 6599 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
6600 6600
6601 option = gaim_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT); 6601 option = purple_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT);
6602 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); 6602 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
6603 6603
6604 option = gaim_account_option_bool_new( 6604 option = purple_account_option_bool_new(
6605 _("Always use ICQ proxy server for file transfers\n(slower, but does not reveal your IP address)"), "always_use_rv_proxy", 6605 _("Always use ICQ proxy server for file transfers\n(slower, but does not reveal your IP address)"), "always_use_rv_proxy",
6606 OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY); 6606 OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY);
6607 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); 6607 prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option);
6608 6608
6609 if (init) 6609 if (init)
6610 return; 6610 return;
6611 init = TRUE; 6611 init = TRUE;
6612 6612
6613 /* Preferences */ 6613 /* Preferences */
6614 gaim_prefs_add_none("/plugins/prpl/oscar"); 6614 purple_prefs_add_none("/plugins/prpl/oscar");
6615 gaim_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE); 6615 purple_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE);
6616 gaim_prefs_add_bool("/plugins/prpl/oscar/show_idle", FALSE); 6616 purple_prefs_add_bool("/plugins/prpl/oscar/show_idle", FALSE);
6617 gaim_prefs_remove("/plugins/prpl/oscar/always_use_rv_proxy"); 6617 purple_prefs_remove("/plugins/prpl/oscar/always_use_rv_proxy");
6618 6618
6619 /* protocol handler */ 6619 /* protocol handler */
6620 /* TODO: figure out a good instance to use here */ 6620 /* TODO: figure out a good instance to use here */
6621 gaim_signal_connect(gaim_get_core(), "uri-handler", &init, 6621 purple_signal_connect(purple_get_core(), "uri-handler", &init,
6622 GAIM_CALLBACK(oscar_uri_handler), NULL); 6622 PURPLE_CALLBACK(oscar_uri_handler), NULL);
6623 } 6623 }
6624 6624