Changeset cf02dd6 for libfaim/oscar.c
- Timestamp:
- Dec 10, 2003, 3:20:45 PM (20 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- b1fe407
- Parents:
- 8c46404
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfaim/oscar.c
r07ab1cb rcf02dd6 31 31 #include "buddyicon.h" 32 32 #include "conversation.h" 33 #include "core.h" 33 34 #include "debug.h" 34 35 #include "ft.h" … … 41 42 #include "request.h" 42 43 #include "util.h" 43 #include "html.h"44 44 45 45 #include "aim.h" 46 46 #include "md5.h" 47 48 /* XXX CORE/UI */49 #include "gtkinternal.h"50 #include "gaim.h"51 52 47 53 48 #define UC_AOL 0x02 … … 61 56 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" 62 57 58 #define OSCAR_CONNECT_STEPS 6 59 63 60 static GaimPlugin *my_protocol = NULL; 64 61 65 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE ;66 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE ;62 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; 63 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; 67 64 68 65 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; 69 66 static fu8_t features_icq[] = {0x01, 0x06}; 70 67 71 struct oscar_data { 68 typedef struct _OscarData OscarData; 69 struct _OscarData { 72 70 aim_session_t *sess; 73 71 aim_conn_t *conn; … … 101 99 gboolean killme; 102 100 gboolean icq; 103 GSList *evilhack;104 101 guint icontimer; 105 102 guint getblisttimer; … … 151 148 }; 152 149 153 /* Various PRPL-specific buddy info that we want to keep track of */ 150 /* 151 * Various PRPL-specific buddy info that we want to keep track of 152 * Some other info is maintained by locate.c, and I'd like to move 153 * the rest of this to libfaim, mostly im.c 154 */ 154 155 struct buddyinfo { 155 time_t signon;156 int caps;157 156 gboolean typingnot; 158 157 gchar *availmsg; … … 168 167 time_t ico_time; 169 168 gboolean ico_need; 170 171 fu16_t iconcsumlen; 172 fu8_t *iconcsum; 169 gboolean ico_sent; 173 170 }; 174 171 … … 219 216 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); 220 217 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); 221 static int gaim_parse_user _info(aim_session_t *, aim_frame_t *, ...);218 static int gaim_parse_userinfo (aim_session_t *, aim_frame_t *, ...); 222 219 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); 223 220 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); 224 static int gaim_c hat_join (aim_session_t *, aim_frame_t *, ...);225 static int gaim_c hat_leave (aim_session_t *, aim_frame_t *, ...);226 static int gaim_c hat_info_update (aim_session_t *, aim_frame_t *, ...);227 static int gaim_c hat_incoming_msg(aim_session_t *, aim_frame_t *, ...);221 static int gaim_conv_chat_join (aim_session_t *, aim_frame_t *, ...); 222 static int gaim_conv_chat_leave (aim_session_t *, aim_frame_t *, ...); 223 static int gaim_conv_chat_info_update (aim_session_t *, aim_frame_t *, ...); 224 static int gaim_conv_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); 228 225 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); 229 226 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); … … 284 281 285 282 /* prpl actions - remove this at some point */ 283 /* Because I don't like forward declarations? I think that was why... */ 286 284 static void oscar_set_info(GaimConnection *gc, const char *text); 287 285 … … 295 293 struct buddyinfo *bi = data; 296 294 g_free(bi->availmsg); 297 g_free(bi->iconcsum);298 295 g_free(bi); 299 296 } … … 384 381 } 385 382 386 static struct direct_im *find_direct_im( struct oscar_data *od, const char *who) {383 static struct direct_im *find_direct_im(OscarData *od, const char *who) { 387 384 GSList *d = od->direct_ims; 388 385 struct direct_im *m = NULL; … … 428 425 429 426 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { 430 GSList *g = (( struct oscar_data *)gc->proto_data)->oscar_chats;427 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; 431 428 struct chat_connection *c = NULL; 432 429 … … 444 441 static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, 445 442 aim_conn_t *conn) { 446 GSList *g = (( struct oscar_data *)gc->proto_data)->oscar_chats;443 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; 447 444 struct chat_connection *c = NULL; 448 445 … … 460 457 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { 461 458 GaimConnection *gc = sess->aux_data; 462 struct oscar_data *od = (struct oscar_data *)gc->proto_data;459 OscarData *od = (OscarData *)gc->proto_data; 463 460 GaimConversation *cnv; 464 461 struct direct_im *dim; … … 496 493 aim_session_t *sess = aim_conn_getsess(conn); 497 494 GaimConnection *gc = sess ? sess->aux_data : NULL; 498 struct oscar_data *od;495 OscarData *od; 499 496 500 497 if (!gc) { 501 /* gc is null. we return, else we seg SIGSEG on next line. */502 498 gaim_debug(GAIM_DEBUG_INFO, "oscar", 503 499 "oscar callback for closed connection (1).\n"); … … 505 501 } 506 502 507 od = ( struct oscar_data *)gc->proto_data;503 od = (OscarData *)gc->proto_data; 508 504 509 505 if (!g_list_find(gaim_connections_get_all(), gc)) { … … 606 602 607 603 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { 608 char *s = g_strdup_vprintf(format, va);609 char buf[256];610 char *t;611 604 GaimConnection *gc = sess->aux_data; 612 613 g_snprintf(buf, sizeof(buf), "%s %d: ", gaim_account_get_username(gaim_connection_get_account(gc)), level); 614 t = g_strconcat(buf, s, NULL); 615 gaim_debug(GAIM_DEBUG_INFO, "oscar", t); 616 if (t[strlen(t)-1] != '\n') 605 gchar *s = g_strdup_vprintf(format, va); 606 gchar *buf; 607 608 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s); 609 gaim_debug(GAIM_DEBUG_INFO, "oscar", buf); 610 if (buf[strlen(buf)-1] != '\n') 617 611 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); 618 g_free( t);612 g_free(buf); 619 613 g_free(s); 620 614 } … … 623 617 { 624 618 GaimConnection *gc = data; 625 struct oscar_data *od;619 OscarData *od; 626 620 aim_session_t *sess; 627 621 aim_conn_t *conn; … … 635 629 sess = od->sess; 636 630 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); 637 638 631 conn->fd = source; 639 632 … … 645 638 aim_conn_completeconnect(sess, conn); 646 639 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); 640 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); 641 647 642 gaim_debug(GAIM_DEBUG_INFO, "oscar", 648 "Password sent, waiting for response\n"); 643 "Screen name sent, waiting for response\n"); 644 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); 649 645 } 650 646 … … 652 648 aim_session_t *sess; 653 649 aim_conn_t *conn; 654 char buf[256];655 650 GaimConnection *gc = gaim_account_get_connection(account); 656 struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1);651 OscarData *od = gc->proto_data = g_new0(OscarData, 1); 657 652 658 653 gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); … … 667 662 668 663 sess = g_new0(aim_session_t, 1); 669 670 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); 664 aim_session_init(sess, TRUE, 0); 671 665 aim_setdebuggingcb(sess, oscar_debug); 672 673 /* we need an immediate queue because we don't use a while-loop to 674 * see if things need to be sent. */ 666 /* 667 * We need an immediate queue because we don't use a while-loop 668 * to see if things need to be sent. 669 */ 675 670 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); 676 671 od->sess = sess; … … 685 680 } 686 681 687 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account));688 gaim_connection_update_progress(gc, buf, 2, 5);689 690 682 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); 691 683 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); … … 699 691 return; 700 692 } 701 aim_request_login(sess, conn, gaim_account_get_username(account)); 693 694 gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); 702 695 } 703 696 704 697 static void oscar_close(GaimConnection *gc) { 705 struct oscar_data *od = (struct oscar_data *)gc->proto_data;698 OscarData *od = (OscarData *)gc->proto_data; 706 699 707 700 while (od->oscar_chats) { … … 733 726 } 734 727 g_hash_table_destroy(od->buddyinfo); 735 while (od->evilhack) {736 g_free(od->evilhack->data);737 od->evilhack = g_slist_remove(od->evilhack, od->evilhack->data);738 }739 728 while (od->create_rooms) { 740 729 struct create_room *cr = od->create_rooms->data; … … 773 762 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { 774 763 GaimConnection *gc = data; 775 struct oscar_data *od;764 OscarData *od; 776 765 aim_session_t *sess; 777 766 aim_conn_t *bosconn; … … 794 783 aim_conn_completeconnect(sess, bosconn); 795 784 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); 785 796 786 gaim_connection_update_progress(gc, 797 _("Connection established, cookie sent"), 4, 5);787 _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); 798 788 } 799 789 … … 834 824 struct aim_oft_info *oft_info = xfer->data; 835 825 GaimConnection *gc = oft_info->sess->aux_data; 836 struct oscar_data *od = gc->proto_data;826 OscarData *od = gc->proto_data; 837 827 838 828 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { … … 900 890 struct aim_oft_info *oft_info = xfer->data; 901 891 GaimConnection *gc = oft_info->sess->aux_data; 902 struct oscar_data *od = gc->proto_data;892 OscarData *od = gc->proto_data; 903 893 904 894 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); … … 919 909 struct aim_oft_info *oft_info = xfer->data; 920 910 GaimConnection *gc = oft_info->sess->aux_data; 921 struct oscar_data *od = gc->proto_data;911 OscarData *od = gc->proto_data; 922 912 923 913 gaim_debug(GAIM_DEBUG_INFO, "oscar", … … 936 926 struct aim_oft_info *oft_info = xfer->data; 937 927 GaimConnection *gc = oft_info->sess->aux_data; 938 struct oscar_data *od = gc->proto_data;928 OscarData *od = gc->proto_data; 939 929 940 930 gaim_debug(GAIM_DEBUG_INFO, "oscar", … … 1007 997 1008 998 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { 1009 struct oscar_data *od = (struct oscar_data *)gc->proto_data;999 OscarData *od = (OscarData *)gc->proto_data; 1010 1000 GaimXfer *xfer; 1011 1001 struct aim_oft_info *oft_info; … … 1038 1028 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { 1039 1029 GaimConnection *gc = sess->aux_data; 1040 struct oscar_data *od = gc->proto_data;1030 OscarData *od = gc->proto_data; 1041 1031 GaimAccount *account = gc->account; 1042 1032 aim_conn_t *bosconn; … … 1136 1126 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); 1137 1127 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); 1138 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user _info, 0);1128 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_userinfo, 0); 1139 1129 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); 1140 1130 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0); … … 1163 1153 #endif 1164 1154 1165 ((struct oscar_data *)gc->proto_data)->conn = bosconn;1155 od->conn = bosconn; 1166 1156 for (i = 0; i < (int)strlen(info->bosip); i++) { 1167 1157 if (info->bosip[i] == ':') { … … 1182 1172 gaim_input_remove(gc->inpa); 1183 1173 1174 gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); 1175 1184 1176 return 1; 1185 1177 } 1186 1178 1179 /* XXX - Should use gaim_url_fetch for the below stuff */ 1187 1180 struct pieceofcrap { 1188 1181 GaimConnection *gc; … … 1198 1191 { 1199 1192 struct pieceofcrap *pos = data; 1200 struct oscar_data *od = pos->gc->proto_data;1193 OscarData *od = pos->gc->proto_data; 1201 1194 char in = '\0'; 1202 1195 int x = 0; … … 1217 1210 "this is fixed. Check %s for updates."), GAIM_WEBSITE); 1218 1211 gaim_notify_warning(pos->gc, NULL, 1219 _("Gaim was Unable to get a valid AIM login hash."),1212 _("Gaim was unable to get a valid AIM login hash."), 1220 1213 buf); 1221 1214 gaim_input_remove(pos->inpa); … … 1247 1240 "this is fixed. Check %s for updates."), GAIM_WEBSITE); 1248 1241 gaim_notify_warning(pos->gc, NULL, 1249 _("Gaim was Unable to get a valid AIM login hash."),1242 _("Gaim was unable to get a valid AIM login hash."), 1250 1243 buf); 1251 1244 g_free(buf); … … 1335 1328 "this is fixed. Check %s for updates."), GAIM_WEBSITE); 1336 1329 gaim_notify_warning(pos->gc, NULL, 1337 _("Gaim was Unable to get a valid login hash."),1330 _("Gaim was unable to get a valid login hash."), 1338 1331 buf); 1339 1332 } … … 1343 1336 1344 1337 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { 1345 char *key;1346 va_list ap;1347 1338 GaimConnection *gc = sess->aux_data; 1339 OscarData *od = gc->proto_data; 1348 1340 GaimAccount *account = gaim_connection_get_account(gc); 1349 1341 GaimAccount *ac = gaim_connection_get_account(gc); 1350 struct oscar_data *od = gc->proto_data; 1342 #if 0 1343 struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; 1344 #endif 1345 va_list ap; 1346 char *key; 1351 1347 1352 1348 va_start(ap, fr); … … 1359 1355 gaim_account_get_password(account), &info, key); 1360 1356 } else { 1361 #if 01362 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};1363 #endif1364 1357 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; 1365 1358 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), 1366 1359 gaim_account_get_password(account), &info, key); 1367 1360 } 1361 1362 gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); 1368 1363 1369 1364 return 1; … … 1376 1371 1377 1372 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, 0x0001, gaim_parse_genericerr, 0); 1378 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_c hat_join, 0);1379 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_c hat_leave, 0);1380 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_c hat_info_update, 0);1381 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_c hat_incoming_msg, 0);1373 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_conv_chat_join, 0); 1374 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_conv_chat_leave, 0); 1375 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_conv_chat_info_update, 0); 1376 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0); 1382 1377 1383 1378 aim_clientready(sess, fr->conn); … … 1407 1402 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); 1408 1403 1409 aim_email_sendcookies(sess , fr->conn);1410 aim_email_activate(sess , fr->conn);1404 aim_email_sendcookies(sess); 1405 aim_email_activate(sess); 1411 1406 aim_clientready(sess, fr->conn); 1412 1407 … … 1416 1411 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { 1417 1412 GaimConnection *gc = sess->aux_data; 1418 struct oscar_data *od = gc->proto_data;1413 OscarData *od = gc->proto_data; 1419 1414 1420 1415 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); … … 1435 1430 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { 1436 1431 GaimConnection *gc = data; 1437 struct oscar_data *od;1432 OscarData *od; 1438 1433 aim_session_t *sess; 1439 1434 aim_conn_t *tstconn; … … 1464 1459 { 1465 1460 GaimConnection *gc = data; 1466 struct oscar_data *od;1461 OscarData *od; 1467 1462 aim_session_t *sess; 1468 1463 aim_conn_t *tstconn; … … 1494 1489 struct chat_connection *ccon = data; 1495 1490 GaimConnection *gc = ccon->gc; 1496 struct oscar_data *od;1491 OscarData *od; 1497 1492 aim_session_t *sess; 1498 1493 aim_conn_t *tstconn; … … 1526 1521 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { 1527 1522 GaimConnection *gc = data; 1528 struct oscar_data *od;1523 OscarData *od; 1529 1524 aim_session_t *sess; 1530 1525 aim_conn_t *tstconn; … … 1555 1550 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { 1556 1551 GaimConnection *gc = data; 1557 struct oscar_data *od;1552 OscarData *od; 1558 1553 aim_session_t *sess; 1559 1554 aim_conn_t *tstconn; … … 1748 1743 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { 1749 1744 GaimConnection *gc = sess->aux_data; 1750 struct oscar_data *od = gc->proto_data;1745 OscarData *od = gc->proto_data; 1751 1746 struct buddyinfo *bi; 1752 1747 time_t time_idle = 0, signon = 0; … … 1789 1784 } 1790 1785 1791 if (caps & AIM_CAPS_ICQ )1792 caps ^= AIM_CAPS_ICQ ;1786 if (caps & AIM_CAPS_ICQ_DIRECT) 1787 caps ^= AIM_CAPS_ICQ_DIRECT; 1793 1788 1794 1789 if (info->present & AIM_USERINFO_PRESENT_IDLE) { … … 1805 1800 gaim_connection_set_display_name(gc, info->sn); 1806 1801 1807 bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn));1802 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, info->sn)); 1808 1803 if (!bi) { 1809 1804 bi = g_new0(struct buddyinfo, 1); 1810 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi); 1811 } 1812 bi->signon = info->onlinesince ? info->onlinesince : (info->sessionlen + time(NULL)); 1813 if (caps) 1814 bi->caps = caps; 1805 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, info->sn)), bi); 1806 } 1815 1807 bi->typingnot = FALSE; 1816 1808 bi->ico_informed = FALSE; … … 1819 1811 /* Available message stuff */ 1820 1812 free(bi->availmsg); 1821 if (info->avail msg)1822 if (info->avail msg_encoding) {1823 gchar *enc = g_strdup_printf("charset=\"%s\"", info->avail msg_encoding);1824 bi->availmsg = oscar_encoding_to_utf8(enc, info->avail msg, info->availmsg_len);1813 if (info->avail != NULL) 1814 if (info->avail_encoding) { 1815 gchar *enc = g_strdup_printf("charset=\"%s\"", info->avail_encoding); 1816 bi->availmsg = oscar_encoding_to_utf8(enc, info->avail, info->avail_len); 1825 1817 g_free(enc); 1826 1818 } else { 1827 1819 /* No explicit encoding means utf8. Yay. */ 1828 bi->availmsg = g_strdup(info->avail msg);1820 bi->availmsg = g_strdup(info->avail); 1829 1821 } 1830 1822 else … … 1833 1825 /* Server stored icon stuff */ 1834 1826 if (info->iconcsumlen) { 1835 char *b16, *saved_b16; 1836 GaimBuddy *b; 1837 1838 free(bi->iconcsum); 1839 bi->iconcsum = malloc(info->iconcsumlen); 1840 memcpy(bi->iconcsum, info->iconcsum, info->iconcsumlen); 1841 bi->iconcsumlen = info->iconcsumlen; 1842 b16 = tobase16(bi->iconcsum, bi->iconcsumlen); 1827 const char *filename = NULL, *saved_b16 = NULL; 1828 char *b16 = NULL; 1829 GaimBuddy *b = NULL; 1830 1831 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); 1843 1832 b = gaim_find_buddy(gc->account, info->sn); 1844 saved_b16 = gaim_buddy_get_setting(b, "icon_checksum"); 1833 /* 1834 * If for some reason the checksum is valid, but cached file is not.. 1835 * we want to know. 1836 */ 1837 filename = gaim_buddy_get_setting(b, "buddy_icon"); 1838 if (filename != NULL) { 1839 if (g_file_test(filename, G_FILE_TEST_EXISTS)) 1840 saved_b16 = gaim_buddy_get_setting(b, "icon_checksum"); 1841 } else 1842 saved_b16 = NULL; 1843 1845 1844 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { 1846 1845 GSList *cur = od->requesticon; … … 1848 1847 cur = cur->next; 1849 1848 if (!cur) { 1850 od->requesticon = g_slist_append(od->requesticon, strdup(normalize(info->sn)));1849 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn))); 1851 1850 if (od->icontimer) 1852 1851 g_source_remove(od->icontimer); … … 1854 1853 } 1855 1854 } 1856 g_free(saved_b16);1857 1855 g_free(b16); 1858 1856 } … … 1865 1863 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { 1866 1864 GaimConnection *gc = sess->aux_data; 1867 struct oscar_data *od = gc->proto_data;1865 OscarData *od = gc->proto_data; 1868 1866 va_list ap; 1869 1867 aim_userinfo_t *info; … … 1875 1873 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); 1876 1874 1877 g_hash_table_remove(od->buddyinfo, normalize(info->sn));1875 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); 1878 1876 1879 1877 return 1; … … 1890 1888 struct direct_im *dim = data; 1891 1889 GaimConnection *gc = dim->gc; 1892 struct oscar_data *od = gc->proto_data;1890 OscarData *od = gc->proto_data; 1893 1891 GaimConversation *cnv; 1894 1892 char buf[256]; … … 1929 1927 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { 1930 1928 GaimConnection *gc = sess->aux_data; 1931 struct oscar_data *od = (struct oscar_data *)gc->proto_data;1929 OscarData *od = (OscarData *)gc->proto_data; 1932 1930 GaimXfer *xfer; 1933 1931 struct aim_oft_info *oft_info; … … 2002 2000 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { 2003 2001 GaimConnection *gc = sess->aux_data; 2004 struct oscar_data *od = gc->proto_data;2002 OscarData *od = gc->proto_data; 2005 2003 GaimXfer *xfer; 2006 2004 struct aim_oft_info *oft_info; … … 2047 2045 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { 2048 2046 GaimConnection *gc = sess->aux_data; 2049 struct oscar_data *od = gc->proto_data;2047 OscarData *od = gc->proto_data; 2050 2048 GaimXfer *xfer; 2051 2049 va_list ap; … … 2079 2077 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { 2080 2078 GaimConnection *gc = sess->aux_data; 2081 struct oscar_data *od = gc->proto_data;2079 OscarData *od = gc->proto_data; 2082 2080 GaimXfer *xfer; 2083 2081 va_list ap; … … 2104 2102 static void accept_direct_im(struct ask_direct *d) { 2105 2103 GaimConnection *gc = d->gc; 2106 struct oscar_data *od;2104 OscarData *od; 2107 2105 struct direct_im *dim; 2108 2106 char *host; int port = 4443; … … 2114 2112 } 2115 2113 2116 od = ( struct oscar_data *)gc->proto_data;2114 od = (OscarData *)gc->proto_data; 2117 2115 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); 2118 2116 … … 2163 2161 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { 2164 2162 GaimConnection *gc = sess->aux_data; 2165 struct oscar_data *od = gc->proto_data;2166 char *tmp;2167 Gaim ImFlags flags = 0;2163 OscarData *od = gc->proto_data; 2164 gchar *tmp; 2165 GaimConvImFlags flags = 0; 2168 2166 gsize convlen; 2169 2167 GError *err = NULL; … … 2171 2169 const char *iconfile; 2172 2170 2173 bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn));2171 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, userinfo->sn)); 2174 2172 if (!bi) { 2175 2173 bi = g_new0(struct buddyinfo, 1); 2176 g_hash_table_insert(od->buddyinfo, g_strdup( normalize(userinfo->sn)), bi);2174 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, userinfo->sn)), bi); 2177 2175 } 2178 2176 2179 2177 if (args->icbmflags & AIM_IMFLAGS_AWAY) 2180 flags |= GAIM_ IM_AUTO_RESP;2178 flags |= GAIM_CONV_IM_AUTO_RESP; 2181 2179 2182 2180 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) … … 2197 2195 2198 2196 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && 2199 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) ) {2197 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { 2200 2198 FILE *file; 2201 2199 struct stat st; … … 2241 2239 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2242 2240 "Unicode IM conversion: %s\n", err->message); 2243 tmp = strdup(_("(There was an error receiving this message)"));2241 tmp = g_strdup(_("(There was an error receiving this message)")); 2244 2242 g_error_free(err); 2245 2243 } … … 2263 2261 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2264 2262 "ISO-8859-1 IM conversion: %s\n", err->message); 2265 tmp = strdup(_("(There was an error receiving this message)"));2263 tmp = g_strdup(_("(There was an error receiving this message)")); 2266 2264 g_error_free(err); 2267 2265 } 2268 2266 } 2269 2267 2270 /* strip_linefeed(tmp); */2268 /* gaim_str_strip_cr(tmp); */ 2271 2269 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); 2272 2270 g_free(tmp); … … 2277 2275 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { 2278 2276 GaimConnection *gc = sess->aux_data; 2279 struct oscar_data *od = gc->proto_data;2277 OscarData *od = gc->proto_data; 2280 2278 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); 2281 2279 … … 2438 2436 2439 2437 if (g_list_find(gaim_connections_get_all(), gc)) { 2440 struct oscar_data *od = gc->proto_data;2438 OscarData *od = gc->proto_data; 2441 2439 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); 2442 2440 GaimGroup *group = gaim_find_buddys_group(buddy); … … 2464 2462 2465 2463 if (g_list_find(gaim_connections_get_all(), gc)) { 2466 /* struct oscar_data *od = gc->proto_data; */2464 /* OscarData *od = gc->proto_data; */ 2467 2465 /* XXX - Take the buddy out of our buddy list */ 2468 2466 } … … 2502 2500 2503 2501 if (g_list_find(gaim_connections_get_all(), gc)) { 2504 struct oscar_data *od = gc->proto_data;2502 OscarData *od = gc->proto_data; 2505 2503 #ifdef NOSSI 2506 2504 GaimBuddy *buddy; … … 2509 2507 buddy = gaim_find_buddy(gc->account, data->name); 2510 2508 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message); 2511 show_got_added(gc, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL);2509 gaim_account_notify_added(gc->account, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); 2512 2510 #else 2513 2511 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); … … 2523 2521 2524 2522 if (g_list_find(gaim_connections_get_all(), gc)) { 2525 struct oscar_data *od = gc->proto_data;2523 OscarData *od = gc->proto_data; 2526 2524 #ifdef NOSSI 2527 2525 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); … … 2540 2538 } 2541 2539 2542 /* When someone sends you contacts*/2543 static void gaim_icq_ contactadd(struct name_data *data) {2540 /* When someone sends you buddies */ 2541 static void gaim_icq_buddyadd(struct name_data *data) { 2544 2542 GaimConnection *gc = data->gc; 2545 2543 2546 2544 if (g_list_find(gaim_connections_get_all(), gc)) { 2547 show_add_buddy(gc, data->name, NULL, data->nick);2545 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick); 2548 2546 } 2549 2547 … … 2568 2566 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); 2569 2567 for (i=0; msg1[i]; i++) { 2570 strip_linefeed(msg1[i]);2568 gaim_str_strip_cr(msg1[i]); 2571 2569 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); 2572 2570 if (err) { … … 2595 2593 case 0x04: { /* Someone sent you a URL */ 2596 2594 if (i >= 2) { 2597 gchar *uin = g_strdup_printf("%u", args->uin); 2598 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", msg2[1], msg2[0]); 2599 serv_got_im(gc, uin, message, 0, time(NULL)); 2600 g_free(uin); 2601 g_free(message); 2595 if (msg2[1] != NULL) { 2596 gchar *uin = g_strdup_printf("%u", args->uin); 2597 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", 2598 msg2[1], 2599 (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]); 2600 serv_got_im(gc, uin, message, 0, time(NULL)); 2601 g_free(uin); 2602 g_free(message); 2603 } 2602 2604 } 2603 2605 } break; … … 2626 2628 case 0x07: { /* Someone has denied you authorization */ 2627 2629 if (i >= 1) { 2628 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your contactlist for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given."));2630 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); 2629 2631 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), 2630 2632 dialog_msg); … … 2634 2636 2635 2637 case 0x08: { /* Someone has granted you authorization */ 2636 gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your contactlist."), args->uin);2638 gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin); 2637 2639 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", 2638 2640 dialog_msg); … … 2666 2668 case 0x12: { 2667 2669 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ 2668 /* Someone added you to their contactlist? */2670 /* Someone added you to their buddy list? */ 2669 2671 } break; 2670 2672 2671 case 0x13: { /* Someone has sent you some ICQ contacts */2673 case 0x13: { /* Someone has sent you some ICQ buddies */ 2672 2674 int i, num; 2673 2675 gchar **text; … … 2679 2681 for (i=0; i<num; i++) { 2680 2682 struct name_data *data = g_new(struct name_data, 1); 2681 gchar *message = g_strdup_printf(_("ICQ user %u has sent you a contact: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]);2683 gchar *message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); 2682 2684 data->gc = gc; 2683 2685 data->name = g_strdup(text[i*2+1]); … … 2685 2687 2686 2688 gaim_request_action(gc, NULL, message, 2687 _("Do you want to add this contact"2688 "to your Buddy List?"),2689 _("Do you want to add this buddy " 2690 "to your buddy list?"), 2689 2691 0, data, 2, 2690 _("Add"), G_CALLBACK(gaim_icq_ contactadd),2692 _("Add"), G_CALLBACK(gaim_icq_buddyadd), 2691 2693 _("Decline"), G_CALLBACK(oscar_free_name_data)); 2692 2694 g_free(message); … … 2696 2698 } break; 2697 2699 2698 case 0x1a: { /* Someone has sent you a greeting card or requested contacts? */2700 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */ 2699 2701 /* This is boring and silly. */ 2700 2702 } break; … … 2851 2853 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { 2852 2854 GaimConnection *gc = sess->aux_data; 2853 struct oscar_data *od = gc->proto_data;2855 OscarData *od = gc->proto_data; 2854 2856 2855 2857 /* BBB */ … … 2881 2883 char *status_msg = gaim_icq_status(state); 2882 2884 char *dialog_msg, **splitmsg; 2883 struct oscar_data *od = gc->proto_data;2884 GSList *l = od->evilhack;2885 gboolean evilhack = FALSE;2886 2885 2887 2886 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ 2888 2887 splitmsg = g_strsplit(msg, "\r\n", 0); 2889 2888 2890 /* If who is in od->evilhack, then we're just getting the away message, otherwise this 2891 * will just get appended to the info box (which is already showing). */ 2892 while (l) { 2893 char *x = l->data; 2894 if (!strcmp(x, normalize(who))) { 2895 evilhack = TRUE; 2896 g_free(x); 2897 od->evilhack = g_slist_remove(od->evilhack, x); 2898 break; 2899 } 2900 l = l->next; 2901 } 2902 2903 if (evilhack) 2904 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); 2905 else 2906 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<HR>%s"), status_msg, g_strjoinv("<BR>", splitmsg)); 2907 g_show_info_text(gc, who, 2, dialog_msg, NULL); 2889 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); 2890 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, dialog_msg, NULL, NULL); 2908 2891 2909 2892 g_free(status_msg); … … 2974 2957 #if 0 2975 2958 GaimConnection *gc = sess->aux_data; 2976 struct oscar_data *od = gc->proto_data;2959 OscarData *od = gc->proto_data; 2977 2960 GaimXfer *xfer; 2978 2961 #endif … … 3040 3023 } 3041 3024 3025 /* 3026 * We get this error when there was an error in the locate family. This 3027 * happens when you request info of someone who is offline. 3028 */ 3042 3029 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { 3043 char *buf;3030 gchar *buf; 3044 3031 va_list ap; 3045 3032 fu16_t reason; … … 3051 3038 va_end(ap); 3052 3039 3053 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); 3054 gaim_notify_error(sess->aux_data, NULL, buf, 3055 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); 3056 g_free(buf); 3040 if (destn != NULL) { 3041 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); 3042 gaim_notify_error(sess->aux_data, NULL, buf, 3043 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); 3044 g_free(buf); 3045 } 3057 3046 3058 3047 return 1; … … 3092 3081 break; 3093 3082 case AIM_CAPS_DIRECTIM: 3094 tmp = _(" Direct IM");3083 tmp = _("AIM Direct IM"); 3095 3084 break; 3096 3085 case AIM_CAPS_CHAT: … … 3113 3102 tmp = _("Send Buddy List"); 3114 3103 break; 3115 case AIM_CAPS_ICQ :3116 tmp = _(" EveryBuddy Bug");3104 case AIM_CAPS_ICQ_DIRECT: 3105 tmp = _("ICQ Direct Connect"); 3117 3106 break; 3118 3107 case AIM_CAPS_APINFO: … … 3141 3130 break; 3142 3131 case AIM_CAPS_SECUREIM: 3143 tmp = _("Secure IM"); 3132 tmp = _("Security Enabled"); 3133 break; 3134 case AIM_CAPS_VIDEO: 3135 tmp = _("Video Chat"); 3144 3136 break; 3145 3137 default: … … 3157 3149 } 3158 3150 3159 static int gaim_parse_user _info(aim_session_t *sess, aim_frame_t *fr, ...) {3151 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { 3160 3152 GaimConnection *gc = sess->aux_data; 3161 struct oscar_data *od = gc->proto_data; 3162 gchar *header; 3163 GSList *l = od->evilhack; 3164 gboolean evilhack = FALSE; 3165 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; 3153 GString *text; 3154 gchar *info_utf8 = NULL, *away_utf8 = NULL; 3155 const char *final = NULL; 3166 3156 va_list ap; 3167 aim_userinfo_t *info; 3168 fu16_t infotype; 3169 char *text_enc = NULL, *text = NULL, *utf8 = NULL; 3170 int text_len; 3171 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); 3157 aim_userinfo_t *userinfo; 3172 3158 3173 3159 va_start(ap, fr); 3174 info = va_arg(ap, aim_userinfo_t *); 3175 infotype = (fu16_t) va_arg(ap, unsigned int); 3176 text_enc = va_arg(ap, char *); 3177 text = va_arg(ap, char *); 3178 text_len = va_arg(ap, int); 3160 userinfo = va_arg(ap, aim_userinfo_t *); 3179 3161 va_end(ap); 3180 3162 3181 if (text_len > 0) { 3182 if (!(utf8 = oscar_encoding_to_utf8(text_enc, text, text_len))) { 3183 utf8 = g_strdup(_("<i>Unable to display information because it was sent in an unknown encoding.</i>")); 3184 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 3185 "Encountered an unknown encoding while parsing userinfo\n"); 3186 } 3187 } 3188 3189 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) { 3190 onlinesince = g_strdup_printf(_("Online Since : <b>%s</b><br>\n"), 3191 asctime(localtime((time_t *)&info->onlinesince))); 3192 } 3193 3194 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { 3195 membersince = g_strdup_printf(_("Member Since : <b>%s</b><br>\n"), 3196 asctime(localtime((time_t *)&info->membersince))); 3197 } 3198 3199 if (info->present & AIM_USERINFO_PRESENT_IDLE) { 3200 gchar *itime = sec_to_text(info->idletime*60); 3201 idle = g_strdup_printf(_("Idle : <b>%s</b>"), itime); 3163 text = g_string_new(""); 3164 g_string_append_printf(text, _("Username: <b>%s</b><br>\n"), userinfo->sn); 3165 g_string_append_printf(text, _("Warning Level: <b>%d%%</b><br>\n"), (int)((userinfo->warnlevel/10.0) + 0.5)); 3166 3167 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) 3168 g_string_append_printf(text, _("Online Since: <b>%s</b><br>\n"), 3169 asctime(localtime((time_t *)&userinfo->onlinesince))); 3170 3171 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) 3172 g_string_append_printf(text, _("Member Since: <b>%s</b><br>\n"), 3173 asctime(localtime((time_t *)&userinfo->membersince))); 3174 3175 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) { 3176 gchar *itime = gaim_str_seconds_to_string(userinfo->idletime*60); 3177 g_string_append_printf(text, _("Idle: <b>%s</b>"), itime); 3202 3178 g_free(itime); 3203 3179 } else 3204 idle = g_strdup(_("Idle: <b>Active</b>")); 3205 3206 header = g_strdup_printf(_("Username : <b>%s</b> %s <br>\n" 3207 "Warning Level : <b>%d %%</b><br>\n" 3208 "%s" 3209 "%s" 3210 "%s\n" 3211 "<hr>\n"), 3212 info->sn, 3213 /* images(info->flags), */ 3214 "", 3215 (int)((info->warnlevel/10.0) + 0.5), 3216 onlinesince ? onlinesince : "", 3217 membersince ? membersince : "", 3218 idle ? idle : ""); 3219 3220 g_free(onlinesince); 3221 g_free(membersince); 3222 g_free(idle); 3223 3224 while (l) { 3225 char *x = l->data; 3226 if (!strcmp(x, normalize(info->sn))) { 3227 evilhack = TRUE; 3228 g_free(x); 3229 od->evilhack = g_slist_remove(od->evilhack, x); 3230 break; 3231 } 3232 l = l->next; 3233 } 3234 3235 if (infotype == AIM_GETINFO_AWAYMESSAGE) { 3236 if (evilhack) { 3237 g_show_info_text(gc, info->sn, 2, 3238 header, 3239 (utf8 && *utf8) ? away_subs(utf8, username) : 3240 _("<i>User has no away message</i>"), NULL); 3241 } else { 3242 g_show_info_text(gc, info->sn, 0, 3243 header, 3244 (utf8 && *utf8) ? away_subs(utf8, username) : NULL, 3245 (utf8 && *utf8) ? "<hr>" : NULL, 3246 NULL); 3247 } 3248 } else if (infotype == AIM_GETINFO_CAPABILITIES) { 3249 g_show_info_text(gc, info->sn, 2, 3250 header, 3251 "<i>", _("Client Capabilities: "), 3252 caps_string(info->capabilities), 3253 "</i>", 3254 NULL); 3255 } else { 3256 g_show_info_text(gc, info->sn, 1, 3257 (utf8 && *utf8) ? away_subs(utf8, username) : _("<i>No Information Provided</i>"), 3258 NULL); 3259 } 3260 3261 g_free(header); 3262 g_free(utf8); 3180 g_string_append_printf(text, _("Idle: <b>Active</b>")); 3181 3182 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { 3183 away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len); 3184 if (away_utf8 != NULL) { 3185 g_string_append_printf(text, "<hr>%s", away_utf8); 3186 g_free(away_utf8); 3187 } 3188 } 3189 3190 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { 3191 info_utf8 = oscar_encoding_to_utf8(userinfo->info_encoding, userinfo->info, userinfo->info_len); 3192 if (info_utf8 != NULL) { 3193 g_string_append_printf(text, "<hr>%s", info_utf8); 3194 g_free(info_utf8); 3195 } 3196 } 3197 3198 final = gaim_str_sub_away_formatters(text->str, gaim_account_get_username(gaim_connection_get_account(gc))); 3199 g_string_free(text, TRUE); 3200 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, final, NULL, NULL); 3263 3201 3264 3202 return 1; … … 3288 3226 fu16_t type; 3289 3227 GaimConnection *gc = sess->aux_data; 3290 struct oscar_data *od = (struct oscar_data *)gc->proto_data;3228 OscarData *od = (OscarData *)gc->proto_data; 3291 3229 3292 3230 va_start(ap, fr); … … 3363 3301 } 3364 3302 3365 static int gaim_c hat_join(aim_session_t *sess, aim_frame_t *fr, ...) {3303 static int gaim_conv_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { 3366 3304 va_list ap; 3367 3305 int count, i; … … 3381 3319 3382 3320 for (i = 0; i < count; i++) 3383 gaim_c hat_add_user(GAIM_CHAT(c->cnv), info[i].sn, NULL);3321 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL); 3384 3322 3385 3323 return 1; 3386 3324 } 3387 3325 3388 static int gaim_c hat_leave(aim_session_t *sess, aim_frame_t *fr, ...) {3326 static int gaim_conv_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { 3389 3327 va_list ap; 3390 3328 int count, i; … … 3404 3342 3405 3343 for (i = 0; i < count; i++) 3406 gaim_c hat_remove_user(GAIM_CHAT(c->cnv), info[i].sn, NULL);3344 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL); 3407 3345 3408 3346 return 1; 3409 3347 } 3410 3348 3411 static int gaim_c hat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) {3349 static int gaim_conv_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { 3412 3350 va_list ap; 3413 3351 aim_userinfo_t *userinfo; … … 3445 3383 } 3446 3384 3447 static int gaim_c hat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) {3385 static int gaim_conv_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { 3448 3386 GaimConnection *gc = sess->aux_data; 3449 3387 va_list ap; … … 3467 3405 struct aim_emailinfo *emailinfo; 3468 3406 int havenewmail; 3407 char *alertitle, *alerturl; 3469 3408 3470 3409 va_start(ap, fr); 3471 3410 emailinfo = va_arg(ap, struct aim_emailinfo *); 3472 3411 havenewmail = va_arg(ap, int); 3412 alertitle = va_arg(ap, char *); 3413 alerturl = va_arg(ap, char *); 3473 3414 va_end(ap); 3474 3415 … … 3479 3420 g_free(to); 3480 3421 } 3422 3423 if (alertitle) 3424 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); 3481 3425 3482 3426 return 1; … … 3485 3429 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { 3486 3430 GaimConnection *gc = sess->aux_data; 3487 struct oscar_data *od = gc->proto_data;3431 OscarData *od = gc->proto_data; 3488 3432 char *sn; 3489 3433 … … 3503 3447 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { 3504 3448 GaimConnection *gc = sess->aux_data; 3505 struct oscar_data *od = gc->proto_data;3449 OscarData *od = gc->proto_data; 3506 3450 GSList *cur; 3507 3451 va_list ap; … … 3523 3467 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), 3524 3468 sn, icon, iconlen); 3525 b16 = tobase16(iconcsum, iconcsumlen);3469 b16 = gaim_base16_encode(iconcsum, iconcsumlen); 3526 3470 if (b16) { 3527 3471 gaim_buddy_set_setting(b, "icon_checksum", b16); 3528 3472 gaim_blist_save(); 3529 free(b16);3473 g_free(b16); 3530 3474 } 3531 3475 } … … 3551 3495 static gboolean gaim_icon_timerfunc(gpointer data) { 3552 3496 GaimConnection *gc = data; 3553 struct oscar_data *od = gc->proto_data;3554 struct buddyinfo *bi;3497 OscarData *od = gc->proto_data; 3498 aim_userinfo_t *userinfo; 3555 3499 aim_conn_t *conn; 3556 3500 … … 3595 3539 } 3596 3540 3597 bi = g_hash_table_lookup(od->buddyinfo, (char *)od->requesticon->data);3598 if ( bi && (bi->iconcsumlen > 0)) {3599 aim_bart_request(od->sess, od->requesticon->data, bi->iconcsum, bi->iconcsumlen);3541 userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data); 3542 if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) { 3543 aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen); 3600 3544 return FALSE; 3601 3545 } else { … … 3690 3634 va_end(ap); 3691 3635 3692 serv_got_eviled(gc, (userinfo && userinfo->sn [0]) ? userinfo->sn : NULL, (newevil/10.0) + 0.5);3636 serv_got_eviled(gc, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); 3693 3637 3694 3638 return 1; … … 3714 3658 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { 3715 3659 GaimConnection *gc = sess->aux_data; 3716 struct oscar_data *od = gc->proto_data;3660 OscarData *od = gc->proto_data; 3717 3661 va_list ap; 3718 3662 fu16_t code; … … 3740 3684 3741 3685 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { 3686 GaimConnection *gc = sess->aux_data; 3742 3687 3743 3688 aim_reqpersonalinfo(sess, fr->conn); 3744 3689 3745 3690 #ifndef NOSSI 3746 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting ssilist\n");3691 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting rights and list\n"); 3747 3692 aim_ssi_reqrights(sess); 3748 3693 aim_ssi_reqdata(sess); 3749 3694 #endif 3750 3695 3751 aim_ bos_reqlocaterights(sess, fr->conn);3752 aim_b os_reqbuddyrights(sess, fr->conn);3696 aim_locate_reqrights(sess); 3697 aim_buddylist_reqrights(sess, fr->conn); 3753 3698 aim_im_reqparams(sess); 3754 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi ?*/3699 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */ 3755 3700 3756 3701 #ifdef NOSSI 3702 gaim_debug(GAIM_DEBUG_INFO, "oscar", "bos: requesting rights\n"); 3703 aim_bos_reqrights(sess, fr->conn); 3757 3704 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); 3758 3705 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); 3759 3706 #endif 3760 3707 3708 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); 3709 3761 3710 return 1; 3762 3711 } … … 3764 3713 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { 3765 3714 GaimConnection *gc = sess->aux_data; 3766 struct oscar_data *od = gc->proto_data;3715 OscarData *od = gc->proto_data; 3767 3716 3768 3717 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); … … 3839 3788 { 3840 3789 GaimConnection *gc = sess->aux_data; 3841 struct oscar_data *od = (struct oscar_data *)gc->proto_data;3790 OscarData *od = (OscarData *)gc->proto_data; 3842 3791 va_list ap; 3843 3792 fu16_t maxsiglen; … … 3853 3802 3854 3803 if (od->icq) 3855 aim_ bos_setprofile(sess, fr->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq);3804 aim_locate_setcaps(od->sess, caps_icq); 3856 3805 else 3857 oscar_set_info(gc, gc->account->user_info); 3806 aim_locate_setcaps(od->sess, caps_aim); 3807 oscar_set_info(gc, gc->account->user_info); 3858 3808 3859 3809 return 1; … … 3864 3814 fu16_t maxbuddies, maxwatchers; 3865 3815 GaimConnection *gc = sess->aux_data; 3866 struct oscar_data *od = (struct oscar_data *)gc->proto_data;3816 OscarData *od = (OscarData *)gc->proto_data; 3867 3817 3868 3818 va_start(ap, fr); … … 3881 3831 3882 3832 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { 3833 GaimConnection *gc = sess->aux_data; 3834 OscarData *od = (OscarData *)gc->proto_data; 3835 va_list ap; 3883 3836 fu16_t maxpermits, maxdenies; 3884 va_list ap;3885 GaimConnection *gc = sess->aux_data;3886 struct oscar_data *od = (struct oscar_data *)gc->proto_data;3887 3837 3888 3838 va_start(ap, fr); … … 3904 3854 aim_clientready(sess, fr->conn); 3905 3855 aim_srv_setavailmsg(sess, NULL); 3906 aim_ bos_setidle(sess, fr->conn, 0);3856 aim_srv_setidle(sess, 0); 3907 3857 3908 3858 if (od->icq) { … … 3935 3885 args.msglen = msg->msglen; 3936 3886 args.msg = msg->msg; 3937 t = g et_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);3887 t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); 3938 3888 incomingim_chan4(sess, fr->conn, NULL, &args, t); 3939 3889 … … 3946 3896 return 1; 3947 3897 } 3898 3899 #if 0 3900 /* 3901 * Update, 2003-11-09: 3902 * Joseph S. Myers, a gcc dude, fixed this for gcc 3.4! Rock on! 3903 * 3904 * It may not be my place to do this, but... 3905 * I feel pretty strongly that the "last 2 digits" warning is ridiculously 3906 * stupid, and should not exist for % switches (%x in our case) that request 3907 * a year in the preferred representation for the current locale. For that 3908 * reason I've chosen to not use this workaround (n., see kluge). 3909 * 3910 * I have a date. I want to show it to the user in the "preferred" way. 3911 * Whether that displays a 2 digit year is perfectly fine--after all, it's 3912 * what the locale wanted. 3913 * 3914 * If I have a necessity for a full representation of the year in the current 3915 * locale, then I'll use a switch that returns a full representation of the 3916 * year. 3917 * 3918 * If you think the preferred locale should show 4 digits instead of 2 digits 3919 * (because you're anal, or whatever), then change the f***ing locale. 3920 * 3921 * I guess the bottom line is--I'm trying to show a date to the user how they 3922 * prefer to see it, why the hell does gcc want me to change that? 3923 * 3924 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3190 3925 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8714 3926 */ 3927 3928 /* 3929 * This function was recommended by the STRFTIME(3) man page to remove the 3930 * "last 2 digits" warning. 3931 */ 3932 static size_t my_strftime(char *s, size_t max, const char *fmt, 3933 const struct tm *tm) 3934 { 3935 return strftime(s, max, fmt, tm); 3936 } 3937 #endif 3948 3938 3949 3939 static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) … … 3966 3956 g_snprintf(who, sizeof(who), "%u", info->uin); 3967 3957 buf = g_strdup_printf("<b>%s:</b> %s", _("UIN"), who); 3968 if (info->nick && info->nick[0] && (utf8 = gaim_ try_conv_to_utf8(info->nick))) {3958 if (info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { 3969 3959 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Nick"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 3970 3960 } 3971 if (info->first && info->first[0] && (utf8 = gaim_ try_conv_to_utf8(info->first))) {3961 if (info->first && info->first[0] && (utf8 = gaim_utf8_try_convert(info->first))) { 3972 3962 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("First Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 3973 3963 } 3974 if (info->last && info->last[0] && (utf8 = gaim_ try_conv_to_utf8(info->last))) {3964 if (info->last && info->last[0] && (utf8 = gaim_utf8_try_convert(info->last))) { 3975 3965 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Last Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 3976 3966 } 3977 if (info->email && info->email[0] && (utf8 = gaim_ try_conv_to_utf8(info->email))) {3967 if (info->email && info->email[0] && (utf8 = gaim_utf8_try_convert(info->email))) { 3978 3968 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Email Address"), ":</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); 3979 3969 } … … 3981 3971 int i; 3982 3972 for (i = 0; i < info->numaddresses; i++) { 3983 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_ try_conv_to_utf8(info->email2[i]))) {3973 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_utf8_try_convert(info->email2[i]))) { 3984 3974 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Email Address"), ":</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); 3985 3975 } 3986 3976 } 3987 3977 } 3988 if (info->mobile && info->mobile[0] && (utf8 = gaim_ try_conv_to_utf8(info->mobile))) {3978 if (info->mobile && info->mobile[0] && (utf8 = gaim_utf8_try_convert(info->mobile))) { 3989 3979 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Mobile Phone"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 3990 3980 } … … 4006 3996 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Age"), ":</b> ", age, NULL); g_free(tmp); 4007 3997 } 4008 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_ try_conv_to_utf8(info->personalwebpage))) {3998 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_utf8_try_convert(info->personalwebpage))) { 4009 3999 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Personal Web Page"), ":</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); 4010 4000 } 4011 if (info->info && info->info[0] && (utf8 = gaim_ try_conv_to_utf8(info->info))) {4001 if (info->info && info->info[0] && (utf8 = gaim_utf8_try_convert(info->info))) { 4012 4002 tmp = buf; buf = g_strconcat(tmp, "<hr><b>", _("Additional Information"), ":</b><br>", utf8, NULL); g_free(tmp); g_free(utf8); 4013 4003 } … … 4015 4005 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { 4016 4006 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Home Address"), ":</b>", NULL); g_free(tmp); 4017 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_ try_conv_to_utf8(info->homeaddr))) {4007 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_utf8_try_convert(info->homeaddr))) { 4018 4008 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4019 4009 } 4020 if (info->homecity && info->homecity[0] && (utf8 = gaim_ try_conv_to_utf8(info->homecity))) {4010 if (info->homecity && info->homecity[0] && (utf8 = gaim_utf8_try_convert(info->homecity))) { 4021 4011 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4022 4012 } 4023 if (info->homestate && info->homestate[0] && (utf8 = gaim_ try_conv_to_utf8(info->homestate))) {4013 if (info->homestate && info->homestate[0] && (utf8 = gaim_utf8_try_convert(info->homestate))) { 4024 4014 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4025 4015 } 4026 if (info->homezip && info->homezip[0] && (utf8 = gaim_ try_conv_to_utf8(info->homezip))) {4016 if (info->homezip && info->homezip[0] && (utf8 = gaim_utf8_try_convert(info->homezip))) { 4027 4017 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4028 4018 } … … 4031 4021 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { 4032 4022 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Address"), ":</b>", NULL); g_free(tmp); 4033 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_ try_conv_to_utf8(info->workaddr))) {4023 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_utf8_try_convert(info->workaddr))) { 4034 4024 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4035 4025 } 4036 if (info->workcity && info->workcity[0] && (utf8 = gaim_ try_conv_to_utf8(info->workcity))) {4026 if (info->workcity && info->workcity[0] && (utf8 = gaim_utf8_try_convert(info->workcity))) { 4037 4027 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4038 4028 } 4039 if (info->workstate && info->workstate[0] && (utf8 = gaim_ try_conv_to_utf8(info->workstate))) {4029 if (info->workstate && info->workstate[0] && (utf8 = gaim_utf8_try_convert(info->workstate))) { 4040 4030 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4041 4031 } 4042 if (info->workzip && info->workzip[0] && (utf8 = gaim_ try_conv_to_utf8(info->workzip))) {4032 if (info->workzip && info->workzip[0] && (utf8 = gaim_utf8_try_convert(info->workzip))) { 4043 4033 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4044 4034 } … … 4047 4037 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { 4048 4038 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Information"), ":</b>", NULL); g_free(tmp); 4049 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_ try_conv_to_utf8(info->workcompany))) {4039 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_utf8_try_convert(info->workcompany))) { 4050 4040 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Company"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4051 4041 } 4052 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_ try_conv_to_utf8(info->workdivision))) {4042 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_utf8_try_convert(info->workdivision))) { 4053 4043 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Division"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4054 4044 } 4055 if (info->workposition && info->workposition[0] && (utf8 = gaim_ try_conv_to_utf8(info->workposition))) {4045 if (info->workposition && info->workposition[0] && (utf8 = gaim_utf8_try_convert(info->workposition))) { 4056 4046 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Position"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); 4057 4047 } 4058 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_ try_conv_to_utf8(info->workwebpage))) {4048 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_utf8_try_convert(info->workwebpage))) { 4059 4049 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Web Page"), ":</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); 4060 4050 } … … 4083 4073 va_end(ap); 4084 4074 4085 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_ try_conv_to_utf8(info->nick))) {4075 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { 4086 4076 g_snprintf(who, sizeof(who), "%u", info->uin); 4087 4077 serv_got_alias(gc, who, utf8); … … 4098 4088 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...) 4099 4089 { 4090 GaimConnection *gc = sess->aux_data; 4091 gchar *text; 4092 va_list ap; 4100 4093 char *msg, *url; 4101 4094 fu16_t wid, hei, delay; 4102 va_list ap;4103 4095 4104 4096 va_start(ap, fr); … … 4110 4102 va_end(ap); 4111 4103 4112 serv_got_popup(msg, url, wid, hei); 4104 text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url); 4105 gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); 4106 g_free(text); 4113 4107 4114 4108 return 1; 4115 4109 } 4116 4110 4117 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { 4111 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) 4112 { 4118 4113 GaimConnection *gc = sess->aux_data; 4119 4114 gchar *secondary; … … 4248 4243 4249 4244 static void oscar_keepalive(GaimConnection *gc) { 4250 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4245 OscarData *od = (OscarData *)gc->proto_data; 4251 4246 aim_flap_nop(od->sess, od->conn); 4252 4247 } 4253 4248 4254 4249 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { 4255 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4250 OscarData *od = (OscarData *)gc->proto_data; 4256 4251 struct direct_im *dim = find_direct_im(od, name); 4257 4252 if (dim) … … 4267 4262 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); 4268 4263 if (!list) { 4269 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name));4264 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); 4270 4265 if (bi && bi->typingnot) { 4271 4266 if (typing == GAIM_TYPING) … … 4281 4276 } 4282 4277 static void oscar_ask_direct_im(GaimConnection *gc, const char *name); 4283 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, Gaim ImFlags);4284 4285 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, Gaim ImFlags imflags) {4286 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4278 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags); 4279 4280 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { 4281 OscarData *od = (OscarData *)gc->proto_data; 4287 4282 struct direct_im *dim = find_direct_im(od, name); 4288 4283 int ret = 0; … … 4294 4289 /* If we're directly connected, send a direct IM */ 4295 4290 ret = gaim_odc_send_im(od->sess, dim->conn, message, imflags); 4296 } else if (imflags & GAIM_ IM_IMAGES) {4291 } else if (imflags & GAIM_CONV_IM_IMAGES) { 4297 4292 /* Trying to send an IM image outside of a direct connection. */ 4298 4293 oscar_ask_direct_im(gc, name); … … 4304 4299 gsize len; 4305 4300 4306 bi = g_hash_table_lookup(od->buddyinfo, normalize(name));4301 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); 4307 4302 if (!bi) { 4308 4303 bi = g_new0(struct buddyinfo, 1); 4309 g_hash_table_insert(od->buddyinfo, g_strdup( normalize(name)), bi);4304 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi); 4310 4305 } 4311 4306 … … 4319 4314 args.featureslen = sizeof(features_aim); 4320 4315 4321 if (imflags & GAIM_ IM_AUTO_RESP)4316 if (imflags & GAIM_CONV_IM_AUTO_RESP) 4322 4317 args.flags |= AIM_IMFLAGS_AWAY; 4323 4318 } … … 4341 4336 args.iconstamp = st.st_mtime; 4342 4337 4343 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) 4338 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { 4344 4339 bi->ico_informed = FALSE; 4340 bi->ico_sent = FALSE; 4341 } 4345 4342 4346 4343 if (!bi->ico_informed) { … … 4362 4359 /* For ICQ send newlines as CR/LF, for AIM send newlines as <BR> */ 4363 4360 if (isdigit(name[0])) 4364 tmpmsg = add_cr(message);4361 tmpmsg = gaim_str_add_cr(message); 4365 4362 else 4366 tmpmsg = strdup_withhtml(message);4363 tmpmsg = gaim_strdup_withhtml(message); 4367 4364 len = strlen(tmpmsg); 4368 4365 … … 4421 4418 } 4422 4419 4423 static void oscar_get_info(GaimConnection *g, const char *name) { 4424 struct oscar_data *od = (struct oscar_data *)g->proto_data; 4425 if (od->icq) 4420 static void oscar_get_info(GaimConnection *gc, const char *name) { 4421 OscarData *od = (OscarData *)gc->proto_data; 4422 4423 if (od->icq && isdigit(name[0])) 4426 4424 aim_icq_getallinfo(od->sess, name); 4427 4425 else 4428 /* people want the away message on the top, so we get the away message 4429 * first and then get the regular info, since it's too difficult to 4430 * insert in the middle. i hate people. */ 4431 aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE); 4432 } 4433 4434 static void oscar_get_away(GaimConnection *g, const char *who) { 4435 struct oscar_data *od = (struct oscar_data *)g->proto_data; 4426 aim_locate_getinfoshort(od->sess, name, 0x00000003); 4427 } 4428 4429 static void oscar_get_away(GaimConnection *gc, const char *who) { 4430 OscarData *od = (OscarData *)gc->proto_data; 4436 4431 if (od->icq) { 4437 GaimBuddy *budlight = gaim_find_buddy(g ->account, who);4432 GaimBuddy *budlight = gaim_find_buddy(gc->account, who); 4438 4433 if (budlight) 4439 4434 if ((budlight->uc & 0xffff0000) >> 16) … … 4444 4439 else 4445 4440 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 4446 "Error: Could not find %s in local contactlist, therefore unable to request status message.\n", who);4441 "Error: Could not find %s in local buddy list, therefore unable to request status message.\n", who); 4447 4442 } else 4448 aim_ getinfo(od->sess, od->conn, who, AIM_GETINFO_GENERALINFO);4449 } 4450 4451 static void oscar_set_dir(GaimConnection *g , const char *first, const char *middle, const char *last,4443 aim_locate_getinfoshort(od->sess, who, 0x00000002); 4444 } 4445 4446 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, 4452 4447 const char *maiden, const char *city, const char *state, const char *country, int web) { 4453 4448 /* XXX - some of these things are wrong, but i'm lazy */ 4454 struct oscar_data *od = (struct oscar_data *)g->proto_data;4455 aim_ setdirectoryinfo(od->sess, od->conn, first, middle, last,4449 OscarData *od = (OscarData *)gc->proto_data; 4450 aim_locate_setdirinfo(od->sess, first, middle, last, 4456 4451 maiden, NULL, NULL, city, state, NULL, 0, web); 4457 4452 } 4458 4453 4459 4454 static void oscar_set_idle(GaimConnection *gc, int time) { 4460 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4461 aim_ bos_setidle(od->sess, od->conn, time);4455 OscarData *od = (OscarData *)gc->proto_data; 4456 aim_srv_setidle(od->sess, time); 4462 4457 } 4463 4458 4464 4459 static void oscar_set_info(GaimConnection *gc, const char *text) { 4465 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4460 OscarData *od = (OscarData *)gc->proto_data; 4466 4461 fu32_t flags = 0; 4467 4462 char *text_html = NULL; … … 4476 4471 "again when you are fully connected.")); 4477 4472 4478 if (od->icq) 4479 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); 4480 else { 4481 if (!text) { 4482 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_aim); 4483 return; 4484 } 4473 if (!text) { 4474 aim_locate_setprofile(od->sess, NULL, "", 0, NULL, NULL, 0); 4475 return; 4476 } 4485 4477 4486 text_html = strdup_withhtml(text); 4487 flags = oscar_encoding_check(text_html); 4488 if (flags & AIM_IMFLAGS_UNICODE) { 4489 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); 4490 aim_bos_setprofile(od->sess, od->conn, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); 4491 g_free(msg); 4492 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { 4493 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); 4494 aim_bos_setprofile(od->sess, od->conn, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); 4495 g_free(msg); 4496 } else { 4497 msglen = strlen(text_html); 4498 aim_bos_setprofile(od->sess, od->conn, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); 4499 } 4500 4501 if (msglen > od->rights.maxsiglen) { 4502 gchar *errstr; 4503 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " 4504 "has been exceeded. Gaim has truncated it for you.", 4505 "The maximum profile length of %d bytes " 4506 "has been exceeded. Gaim has truncated it for you.", 4507 od->rights.maxsiglen), od->rights.maxsiglen); 4508 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); 4509 g_free(errstr); 4510 } 4511 4512 g_free(text_html); 4513 4514 } 4478 text_html = gaim_strdup_withhtml(text); 4479 flags = oscar_encoding_check(text_html); 4480 if (flags & AIM_IMFLAGS_UNICODE) { 4481 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); 4482 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); 4483 g_free(msg); 4484 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { 4485 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); 4486 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); 4487 g_free(msg); 4488 } else { 4489 msglen = strlen(text_html); 4490 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); 4491 } 4492 4493 if (msglen > od->rights.maxsiglen) { 4494 gchar *errstr; 4495 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " 4496 "has been exceeded. Gaim has truncated it for you.", 4497 "The maximum profile length of %d bytes " 4498 "has been exceeded. Gaim has truncated it for you.", 4499 od->rights.maxsiglen), od->rights.maxsiglen); 4500 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); 4501 g_free(errstr); 4502 } 4503 4504 g_free(text_html); 4515 4505 4516 4506 return; 4517 4507 } 4518 4508 4519 static void oscar_set_away_aim(GaimConnection *gc, struct oscar_data *od, const char *text)4509 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *text) 4520 4510 { 4521 4511 fu32_t flags = 0; … … 4538 4528 4539 4529 if (!text) { 4540 aim_ bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, "", 0, caps_aim);4530 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); 4541 4531 return; 4542 4532 } 4543 4533 4544 text_html = strdup_withhtml(text);4534 text_html = gaim_strdup_withhtml(text); 4545 4535 flags = oscar_encoding_check(text_html); 4546 4536 if (flags & AIM_IMFLAGS_UNICODE) { 4547 4537 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); 4548 aim_ bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "unicode-2-0", msg,4549 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen) , caps_aim);4538 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, 4539 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); 4550 4540 g_free(msg); 4551 4541 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); 4552 4542 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { 4553 4543 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); 4554 aim_ bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "iso-8859-1", msg,4555 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen) , caps_aim);4544 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, 4545 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); 4556 4546 g_free(msg); 4557 4547 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); 4558 4548 } else { 4559 4549 msglen = strlen(text_html); 4560 aim_ bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", text_html,4561 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen) , caps_aim);4550 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, 4551 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); 4562 4552 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); 4563 4553 } … … 4579 4569 } 4580 4570 4581 static void oscar_set_away_icq(GaimConnection *gc, struct oscar_data *od, const char *state, const char *message)4571 static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message) 4582 4572 { 4583 4573 GaimAccount *account = gaim_connection_get_account(gc); … … 4631 4621 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) 4632 4622 { 4633 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4623 OscarData *od = (OscarData *)gc->proto_data; 4634 4624 4635 4625 if (od->icq) … … 4642 4632 4643 4633 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { 4644 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4634 OscarData *od = (OscarData *)gc->proto_data; 4645 4635 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); 4646 4636 } … … 4648 4638 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, 4649 4639 const char *maiden, const char *city, const char *state, const char *country, const char *email) { 4650 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4640 OscarData *od = (OscarData *)gc->proto_data; 4651 4641 if (strlen(email)) 4652 4642 aim_search_address(od->sess, od->conn, email); … … 4654 4644 4655 4645 static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { 4656 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4646 OscarData *od = (OscarData *)gc->proto_data; 4657 4647 #ifdef NOSSI 4658 4648 aim_add_buddy(od->sess, od->conn, name); … … 4673 4663 4674 4664 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { 4675 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4665 OscarData *od = (OscarData *)gc->proto_data; 4676 4666 #ifdef NOSSI 4677 4667 char buf[MSG_LEN]; … … 4679 4669 while (buddies) { 4680 4670 if (n > MSG_LEN - 18) { 4681 aim_b os_setbuddylist(od->sess, od->conn, buf);4671 aim_buddylist_set(od->sess, od->conn, buf); 4682 4672 n = 0; 4683 4673 } … … 4685 4675 buddies = buddies->next; 4686 4676 } 4687 aim_b os_setbuddylist(od->sess, od->conn, buf);4677 aim_buddylist_set(od->sess, od->conn, buf); 4688 4678 #else 4689 4679 if (od->sess->ssi.received_data) { 4690 4680 while (buddies) { 4691 GaimBuddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data); 4692 GaimGroup *group = gaim_find_buddys_group(buddy); 4693 if (buddy && group) { 4694 gaim_debug(GAIM_DEBUG_INFO, "oscar", 4695 "ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name); 4696 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); 4697 } 4681 oscar_add_buddy(gc, (const char *)buddies->data, NULL); 4698 4682 buddies = buddies->next; 4699 4683 } … … 4703 4687 4704 4688 static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { 4705 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4689 OscarData *od = (OscarData *)gc->proto_data; 4706 4690 #ifdef NOSSI 4707 4691 aim_remove_buddy(od->sess, od->conn, name); … … 4716 4700 4717 4701 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { 4718 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4702 OscarData *od = (OscarData *)gc->proto_data; 4719 4703 #ifdef NOSSI 4720 4704 GList *cur; … … 4735 4719 #ifndef NOSSI 4736 4720 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { 4737 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4721 OscarData *od = (OscarData *)gc->proto_data; 4738 4722 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { 4739 4723 gaim_debug(GAIM_DEBUG_INFO, "oscar", … … 4744 4728 4745 4729 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { 4746 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4730 OscarData *od = (OscarData *)gc->proto_data; 4747 4731 if (od->sess->ssi.received_data) { 4748 4732 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); … … 4756 4740 4757 4741 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { 4758 struct oscar_data *od = (struct oscar_data *)g->proto_data;4742 OscarData *od = (OscarData *)g->proto_data; 4759 4743 4760 4744 if (od->sess->ssi.received_data) { … … 4780 4764 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { 4781 4765 GaimConnection *gc = sess->aux_data; 4782 struct oscar_data *od = gc->proto_data;4766 OscarData *od = gc->proto_data; 4783 4767 va_list ap; 4784 4768 fu16_t reason; … … 4807 4791 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { 4808 4792 GaimConnection *gc = sess->aux_data; 4809 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4793 OscarData *od = (OscarData *)gc->proto_data; 4810 4794 int numtypes, i; 4811 4795 fu16_t *maxitems; … … 4840 4824 GaimConnection *gc = sess->aux_data; 4841 4825 GaimAccount *account = gaim_connection_get_account(gc); 4842 struct oscar_data *od = (struct oscar_data *)gc->proto_data;4826 OscarData *od = (OscarData *)gc->proto_data; 4843 4827 struct aim_ssi_item *curitem; 4844 4828 int tmp; … … 4862 4846 /* Add from server list to local list */ 4863 4847 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { 4848 if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL))) 4864 4849 switch (curitem->type) { 4865 4850 case 0x0000: { /* Buddy */ 4866 4851 if (curitem->name) { 4867 4852 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); 4868 char *gname_utf8 = g aim_try_conv_to_utf8(gname);4853 char *gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; 4869 4854 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); 4870 char *alias_utf8 = gaim_try_conv_to_utf8(alias);4855 char *alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; 4871 4856 GaimBuddy *buddy = gaim_find_buddy(gc->account, curitem->name); 4872 4857 /* Should gname be freed here? -- elb */ … … 4893 4878 export = TRUE; 4894 4879 } 4895 free(gname_utf8);4896 free(alias_utf8);4880 g_free(gname_utf8); 4881 g_free(alias_utf8); 4897 4882 } 4898 4883 } break; … … 4958 4943 GaimGroup *group; 4959 4944 GaimBuddy *buddy; 4960 struct gaim_buddy_list *blist;4945 GaimBuddyList *blist; 4961 4946 GSList *cur; 4962 4947 … … 4975 4960 buddy = (GaimBuddy *)bnode; 4976 4961 if (buddy->account == gc->account) { 4977 gchar *servernick = gaim_buddy_get_setting(buddy, "servernick");4978 if (servernick) {4962 const char *servernick = gaim_buddy_get_setting(buddy, "servernick"); 4963 if (servernick) 4979 4964 serv_got_alias(gc, buddy->name, servernick); 4980 g_free(servernick); 4981 } 4965 4982 4966 if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) { 4983 4967 /* Store local alias on server */ … … 5061 5045 } 5062 5046 5063 case 0x000e: { /* contactrequires authorization */5047 case 0x000e: { /* buddy requires authorization */ 5064 5048 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) 5065 5049 gaim_auth_sendrequest(gc, retval->name); … … 5112 5096 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, 5113 5097 0, data, 5114 G_CALLBACK(gaim_icq_ contactadd),5098 G_CALLBACK(gaim_icq_buddyadd), 5115 5099 G_CALLBACK(oscar_free_name_data)); 5116 5100 … … 5185 5169 if (reply) { 5186 5170 /* Granted */ 5187 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your contactlist."), nombre);5171 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre); 5188 5172 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); 5189 5173 } else { 5190 5174 /* Denied */ 5191 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your contactlist for the following reason:\n%s"), nombre, msg ? msg : _("No reason given."));5175 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.")); 5192 5176 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); 5193 5177 } … … 5211 5195 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5212 5196 "ssi: %s added you to their buddy list\n", sn); 5213 show_got_added(gc, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL);5197 gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); 5214 5198 5215 5199 return 1; … … 5238 5222 5239 5223 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { 5240 struct oscar_data *od = (struct oscar_data *)g->proto_data;5224 OscarData *od = (OscarData *)g->proto_data; 5241 5225 aim_conn_t *cur; 5242 5226 char *name, *exchange; … … 5264 5248 5265 5249 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { 5266 struct oscar_data *od = (struct oscar_data *)g->proto_data;5250 OscarData *od = (OscarData *)g->proto_data; 5267 5251 struct chat_connection *ccon = find_oscar_chat(g, id); 5268 5252 … … 5275 5259 5276 5260 static void oscar_chat_leave(GaimConnection *g, int id) { 5277 struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL;5261 OscarData *od = g ? (OscarData *)g->proto_data : NULL; 5278 5262 GSList *bcs = g->buddy_chats; 5279 5263 GaimConversation *b = NULL; … … 5284 5268 count++; 5285 5269 b = (GaimConversation *)bcs->data; 5286 if (id == gaim_c hat_get_id(GAIM_CHAT(b)))5270 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))) 5287 5271 break; 5288 5272 bcs = bcs->next; … … 5296 5280 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); 5297 5281 5298 c = find_oscar_chat(g, gaim_c hat_get_id(GAIM_CHAT(b)));5282 c = find_oscar_chat(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); 5299 5283 if (c != NULL) { 5300 5284 if (od) … … 5309 5293 } 5310 5294 /* we do this because with Oscar it doesn't tell us we left */ 5311 serv_got_chat_left(g, gaim_c hat_get_id(GAIM_CHAT(b)));5295 serv_got_chat_left(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); 5312 5296 } 5313 5297 5314 5298 static int oscar_chat_send(GaimConnection *g, int id, const char *message) { 5315 struct oscar_data *od = (struct oscar_data *)g->proto_data;5299 OscarData *od = (OscarData *)g->proto_data; 5316 5300 GSList *bcs = g->buddy_chats; 5317 5301 GaimConversation *b = NULL; … … 5322 5306 while (bcs) { 5323 5307 b = (GaimConversation *)bcs->data; 5324 if (id == gaim_c hat_get_id(GAIM_CHAT(b)))5308 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))) 5325 5309 break; 5326 5310 bcs = bcs->next; … … 5357 5341 return -E2BIG; 5358 5342 5359 buf2 = strip_html(buf);5343 buf2 = gaim_markup_strip_html(buf); 5360 5344 if (strlen(buf2) > c->maxvis) { 5361 5345 g_free(buf2); … … 5384 5368 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) 5385 5369 { 5370 GaimAccount *account = NULL; 5371 GaimConnection *gc = NULL; 5372 OscarData *od = NULL; 5386 5373 char *emblems[4] = {NULL,NULL,NULL,NULL}; 5387 5374 int i = 0; 5375 aim_userinfo_t *userinfo = NULL; 5376 5377 if (b != NULL) 5378 account = b->account; 5379 if (account != NULL) 5380 gc = account->gc; 5381 if (gc != NULL) 5382 od = gc->proto_data; 5388 5383 5389 5384 if (!GAIM_BUDDY_IS_ONLINE(b)) { 5390 GaimAccount *account;5391 GaimConnection *gc;5392 struct oscar_data *od;5393 5385 char *gname; 5394 if ((b->name) && (account = b->account) && (gc = account->gc) && 5395 (od = gc->proto_data) && (od->sess->ssi.received_data) && 5386 if ((b->name) && (od) && (od->sess->ssi.received_data) && 5396 5387 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && 5397 5388 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { … … 5432 5423 /* if (b->uc & UC_UNCONFIRMED && i < 4) 5433 5424 emblems[i++] = "unconfirmed"; */ 5425 5426 if ((i < 4) && (od != NULL)) { 5427 userinfo = aim_locate_finduserinfo(od->sess, b->name); 5428 if ((userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_SECUREIM)) 5429 emblems[i++] = "secure"; 5430 } 5431 5434 5432 *se = emblems[0]; 5435 5433 *sw = emblems[1]; … … 5440 5438 static char *oscar_tooltip_text(GaimBuddy *b) { 5441 5439 GaimConnection *gc = b->account->gc; 5442 struct oscar_data *od = gc->proto_data; 5443 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); 5444 gchar *tmp, *yay = g_strdup(""); 5440 OscarData *od = gc->proto_data; 5441 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); 5442 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); 5443 gchar *tmp = NULL, *ret = g_strdup(""); 5445 5444 5446 5445 if (GAIM_BUDDY_IS_ONLINE(b)) { 5447 5446 if (isdigit(b->name[0])) { 5448 char * tmp, *status;5447 char *status; 5449 5448 status = gaim_icq_status((b->uc & 0xffff0000) >> 16); 5450 tmp = yay;5451 yay= g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL);5449 tmp = ret; 5450 ret = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); 5452 5451 g_free(tmp); 5453 5452 g_free(status); 5454 5453 } 5455 5454 5456 if ( bi) {5457 char *tstr = sec_to_text(time(NULL) - bi->signon +5455 if (userinfo != NULL) { 5456 char *tstr = gaim_str_seconds_to_string(time(NULL) - userinfo->onlinesince + 5458 5457 (gc->login_time_official ? gc->login_time_official - gc->login_time : 0)); 5459 tmp = yay; 5460 yay = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL); 5461 free(tmp); 5462 free(tstr); 5463 5464 if (bi->ipaddr) { 5465 char *tstr = g_strdup_printf("%hhd.%hhd.%hhd.%hhd", 5466 (bi->ipaddr & 0xff000000) >> 24, 5467 (bi->ipaddr & 0x00ff0000) >> 16, 5468 (bi->ipaddr & 0x0000ff00) >> 8, 5469 (bi->ipaddr & 0x000000ff)); 5470 tmp = yay; 5471 yay = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL); 5472 free(tmp); 5473 free(tstr); 5474 } 5475 5476 if (bi->caps) { 5477 char *caps = caps_string(bi->caps); 5478 tmp = yay; 5479 yay = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); 5480 free(tmp); 5481 } 5482 5483 if (bi->availmsg && !(b->uc & UC_UNAVAILABLE)) { 5484 gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); 5485 tmp = yay; 5486 yay = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL); 5487 free(tmp); 5488 g_free(escaped); 5458 tmp = ret; 5459 ret = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL); 5460 g_free(tmp); 5461 g_free(tstr); 5462 } 5463 5464 if ((bi != NULL) && (bi->ipaddr)) { 5465 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", 5466 (bi->ipaddr & 0xff000000) >> 24, 5467 (bi->ipaddr & 0x00ff0000) >> 16, 5468 (bi->ipaddr & 0x0000ff00) >> 8, 5469 (bi->ipaddr & 0x000000ff)); 5470 tmp = ret; 5471 ret = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL); 5472 g_free(tmp); 5473 g_free(tstr); 5474 } 5475 5476 if ((userinfo != NULL) && (userinfo->capabilities)) { 5477 char *caps = caps_string(userinfo->capabilities); 5478 tmp = ret; 5479 ret = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); 5480 g_free(tmp); 5481 } 5482 5483 if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) { 5484 gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); 5485 tmp = ret; 5486 ret = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL); 5487 g_free(tmp); 5488 g_free(escaped); 5489 } 5490 5491 if ((userinfo != NULL) && (userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { 5492 gchar *away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len); 5493 if (away_utf8 != NULL) { 5494 gchar *tmp1, *tmp2; 5495 const char *tmp3; 5496 tmp1 = gaim_strreplace(away_utf8, "<BR>", "\n"); 5497 tmp2 = gaim_markup_strip_html(tmp1); 5498 g_free(tmp1); 5499 tmp1 = g_markup_escape_text(tmp2, strlen(tmp2)); 5500 g_free(tmp2); 5501 tmp3 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); 5502 g_free(tmp1); 5503 tmp = ret; 5504 ret = g_strconcat(tmp, _("<b>Away Message:</b> "), tmp3, "\n", NULL); 5505 g_free(tmp); 5506 g_free(away_utf8); 5489 5507 } 5490 5508 } … … 5492 5510 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); 5493 5511 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { 5494 tmp = yay;5495 yay= g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL);5512 tmp = ret; 5513 ret = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); 5496 5514 g_free(tmp); 5497 5515 } else { 5498 tmp = yay;5499 yay= g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL);5516 tmp = ret; 5517 ret = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); 5500 5518 g_free(tmp); 5501 5519 } … … 5503 5521 5504 5522 /* remove the trailing newline character */ 5505 if ( yay)5506 yay[strlen(yay)-1] = '\0';5507 return yay;5523 if (ret) 5524 ret[strlen(ret)-1] = '\0'; 5525 return ret; 5508 5526 } 5509 5527 5510 5528 static char *oscar_status_text(GaimBuddy *b) { 5511 5529 GaimConnection *gc = b->account->gc; 5512 struct oscar_data *od = gc->proto_data;5530 OscarData *od = gc->proto_data; 5513 5531 gchar *ret = NULL; 5514 5532 … … 5519 5537 ret = g_strdup(_("Away")); 5520 5538 } else if (GAIM_BUDDY_IS_ONLINE(b)) { 5521 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name));5539 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); 5522 5540 if (bi->availmsg) 5523 5541 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); … … 5536 5554 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { 5537 5555 GaimConnection *gc = sess->aux_data; 5538 struct oscar_data *od = gc->proto_data;5556 OscarData *od = gc->proto_data; 5539 5557 va_list ap; 5540 5558 fu16_t type; 5541 5559 fu8_t flags = 0, length = 0; 5542 5560 char *md5 = NULL; 5561 5543 5562 5544 5563 va_start(ap, fr); … … 5598 5617 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { 5599 5618 GaimConnection *gc = sess->aux_data; 5600 struct oscar_data *od = (struct oscar_data *)gc->proto_data;5619 OscarData *od = (OscarData *)gc->proto_data; 5601 5620 GaimConversation *cnv; 5602 5621 struct direct_im *dim; … … 5646 5665 double percent; 5647 5666 GaimConnection *gc = sess->aux_data; 5648 struct oscar_data *od = (struct oscar_data *)gc->proto_data;5667 OscarData *od = (OscarData *)gc->proto_data; 5649 5668 GaimConversation *c; 5650 5669 struct direct_im *dim; … … 5662 5681 } 5663 5682 /* XXX is this really necessary? */ 5664 while (gtk_events_pending()) 5665 gtk_main_iteration(); 5683 gaim_core_mainloop_finish_events(); 5666 5684 5667 5685 c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); … … 5705 5723 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { 5706 5724 GaimConnection *gc = sess->aux_data; 5707 Gaim ImFlags imflags = 0;5725 GaimConvImFlags imflags = 0; 5708 5726 GString *newmsg = g_string_new(""); 5709 5727 GSList *images = NULL; … … 5726 5744 5727 5745 if (isawaymsg) 5728 imflags |= GAIM_ IM_AUTO_RESP;5746 imflags |= GAIM_CONV_IM_AUTO_RESP; 5729 5747 5730 5748 /* message has a binary trailer */ … … 5790 5808 /* set the flag if we caught any images */ 5791 5809 if (images) 5792 imflags |= GAIM_ IM_IMAGES;5810 imflags |= GAIM_CONV_IM_IMAGES; 5793 5811 } else { 5794 5812 g_string_append_len(newmsg, msg, len); … … 5840 5858 } 5841 5859 5842 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, Gaim ImFlags imflags) {5860 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimConvImFlags imflags) { 5843 5861 char *buf; 5844 5862 size_t len; 5845 5863 int ret; 5846 5864 5847 if (imflags & GAIM_ IM_IMAGES) {5865 if (imflags & GAIM_CONV_IM_IMAGES) { 5848 5866 GString *msg = g_string_new(""); 5849 5867 GString *data = g_string_new("<BINARY>"); … … 5872 5890 g_string_append_printf(msg, 5873 5891 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", 5874 image->filename, oscar_id, image->size);5892 image->filename, oscar_id, (int)image->size); 5875 5893 else 5876 5894 g_string_append_printf(msg, 5877 5895 "<IMG ID=\"%d\" DATASIZE=\"%d\">", 5878 oscar_id, image->size);5896 oscar_id, (int)image->size); 5879 5897 5880 5898 /* ... and append the data to the binary section ... */ 5881 5899 g_string_append_printf(data, "<DATA ID=\"%d\" SIZE=\"%d\">", 5882 oscar_id, image->size);5900 oscar_id, (int)image->size); 5883 5901 data = g_string_append_len(data, image->data, image->size); 5884 5902 data = g_string_append(data, "</DATA>"); … … 5915 5933 5916 5934 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ 5917 if (imflags & GAIM_ IM_AUTO_RESP)5935 if (imflags & GAIM_CONV_IM_AUTO_RESP) 5918 5936 ret = aim_odc_send_im(sess, conn, buf, len, 0, 1); 5919 5937 else … … 5937 5955 static void oscar_direct_im(struct ask_do_dir_im *data) { 5938 5956 GaimConnection *gc = data->gc; 5939 struct oscar_data *od;5957 OscarData *od; 5940 5958 struct direct_im *dim; 5941 5959 … … 5946 5964 } 5947 5965 5948 od = ( struct oscar_data *)gc->proto_data;5966 od = (OscarData *)gc->proto_data; 5949 5967 5950 5968 dim = find_direct_im(od, data->who); … … 6002 6020 static void oscar_set_permit_deny(GaimConnection *gc) { 6003 6021 GaimAccount *account = gaim_connection_get_account(gc); 6004 struct oscar_data *od = (struct oscar_data *)gc->proto_data;6022 OscarData *od = (OscarData *)gc->proto_data; 6005 6023 #ifdef NOSSI 6006 6024 GSList *list, *g = gaim_blist_groups(), *g1; … … 6066 6084 oscar_set_permit_deny(gc); 6067 6085 #else 6068 struct oscar_data *od = (struct oscar_data *)gc->proto_data;6086 OscarData *od = (OscarData *)gc->proto_data; 6069 6087 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); 6070 6088 if (od->sess->ssi.received_data) … … 6078 6096 oscar_set_permit_deny(gc); 6079 6097 #else 6080 struct oscar_data *od = (struct oscar_data *)gc->proto_data;6098 OscarData *od = (OscarData *)gc->proto_data; 6081 6099 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); 6082 6100 if (od->sess->ssi.received_data) … … 6090 6108 oscar_set_permit_deny(gc); 6091 6109 #else 6092 struct oscar_data *od = (struct oscar_data *)gc->proto_data;6110 OscarData *od = (OscarData *)gc->proto_data; 6093 6111 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); 6094 6112 if (od->sess->ssi.received_data) … … 6102 6120 oscar_set_permit_deny(gc); 6103 6121 #else 6104 struct oscar_data *od = (struct oscar_data *)gc->proto_data;6122 OscarData *od = (OscarData *)gc->proto_data; 6105 6123 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); 6106 6124 if (od->sess->ssi.received_data) … … 6111 6129 static GList *oscar_away_states(GaimConnection *gc) 6112 6130 { 6113 struct oscar_data *od = gc->proto_data;6131 OscarData *od = gc->proto_data; 6114 6132 GList *m = NULL; 6115 6133 … … 6128 6146 } 6129 6147 6148 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { 6149 OscarData *od = data->gc->proto_data; 6150 GaimBuddy *b; 6151 GaimGroup *g; 6152 6153 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { 6154 oscar_free_name_data(data); 6155 return; 6156 } 6157 6158 if (!(g = gaim_find_buddys_group(b))) { 6159 oscar_free_name_data(data); 6160 return; 6161 } 6162 6163 aim_ssi_editcomment(od->sess, g->name, data->name, text); 6164 oscar_free_name_data(data); 6165 } 6166 6167 static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { 6168 OscarData *od = gc->proto_data; 6169 struct name_data *data = g_new(struct name_data, 1); 6170 GaimBuddy *b; 6171 GaimGroup *g; 6172 char *comment; 6173 gchar *comment_utf8; 6174 6175 if (!(b = gaim_find_buddy(gaim_connection_get_account(gc), name))) 6176 return; 6177 if (!(g = gaim_find_buddys_group(b))) 6178 return; 6179 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, name); 6180 comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; 6181 6182 data->gc = gc; 6183 data->name = g_strdup(name); 6184 data->nick = NULL; 6185 6186 gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, 6187 comment_utf8, TRUE, FALSE, 6188 _("OK"), G_CALLBACK(oscar_ssi_editcomment), 6189 _("Cancel"), G_CALLBACK(oscar_free_name_data), 6190 data); 6191 6192 free(comment); 6193 g_free(comment_utf8); 6194 } 6195 6130 6196 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { 6131 struct oscar_data *od = gc->proto_data;6197 OscarData *od = gc->proto_data; 6132 6198 GList *m = NULL; 6133 6199 struct proto_buddy_menu *pbm; 6200 6201 pbm = g_new0(struct proto_buddy_menu, 1); 6202 pbm->label = _("Edit Buddy Comment"); 6203 pbm->callback = oscar_buddycb_edit_comment; 6204 pbm->gc = gc; 6205 m = g_list_append(m, pbm); 6134 6206 6135 6207 if (od->icq) { … … 6143 6215 } else { 6144 6216 GaimBuddy *b = gaim_find_buddy(gc->account, who); 6145 struct buddyinfo *bi;6217 aim_userinfo_t *userinfo; 6146 6218 6147 6219 if (b) 6148 bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name));6149 6150 if (b && bi&& aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) {6151 if ( bi->caps & AIM_CAPS_DIRECTIM) {6220 userinfo = aim_locate_finduserinfo(od->sess, b->name); 6221 6222 if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { 6223 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { 6152 6224 pbm = g_new0(struct proto_buddy_menu, 1); 6153 6225 pbm->label = _("Direct IM"); … … 6157 6229 } 6158 6230 6159 if ( bi->caps & AIM_CAPS_SENDFILE) {6231 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { 6160 6232 pbm = g_new0(struct proto_buddy_menu, 1); 6161 6233 pbm->label = _("Send File"); … … 6165 6237 } 6166 6238 #if 0 6167 if ( bi->caps & AIM_CAPS_GETFILE) {6239 if (userinfo->capabilities & AIM_CAPS_GETFILE) { 6168 6240 pbm = g_new0(struct proto_buddy_menu, 1); 6169 6241 pbm->label = _("Get File"); … … 6191 6263 6192 6264 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { 6193 struct oscar_data *od = gc->proto_data;6265 OscarData *od = gc->proto_data; 6194 6266 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { 6195 6267 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { … … 6217 6289 static void oscar_confirm_account(GaimConnection *gc) 6218 6290 { 6219 struct oscar_data *od = gc->proto_data;6291 OscarData *od = gc->proto_data; 6220 6292 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); 6221 6293 … … 6230 6302 static void oscar_show_email(GaimConnection *gc) 6231 6303 { 6232 struct oscar_data *od = gc->proto_data;6304 OscarData *od = gc->proto_data; 6233 6305 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); 6234 6306 … … 6243 6315 static void oscar_change_email(GaimConnection *gc, const char *email) 6244 6316 { 6245 struct oscar_data *od = gc->proto_data;6317 OscarData *od = gc->proto_data; 6246 6318 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); 6247 6319 … … 6266 6338 static void oscar_show_awaitingauth(GaimConnection *gc) 6267 6339 { 6268 struct oscar_data *od = gc->proto_data;6340 OscarData *od = gc->proto_data; 6269 6341 gchar *nombre, *text, *tmp; 6270 6342 GaimBlistNode *gnode, *cnode, *bnode; … … 6312 6384 } 6313 6385 6386 static void search_by_email_cb(GaimConnection *gc, const char *email) 6387 { 6388 serv_dir_search(gc, "", "", "", "", "", "", "", email); 6389 } 6390 6391 static void oscar_show_find_email(GaimConnection *gc) 6392 { 6393 gaim_request_input(gc, _("Find Buddy by E-mail"), 6394 _("Search for a buddy by e-mail address"), 6395 _("Type the e-mail address of the buddy you are " 6396 "searching for."), 6397 NULL, FALSE, FALSE, 6398 _("Search"), G_CALLBACK(search_by_email_cb), 6399 _("Cancel"), NULL, gc); 6400 } 6401 6314 6402 #if 0 6315 6403 static void oscar_setavailmsg(GaimConnection *gc, char *text) { 6316 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 6317 6404 OscarData *od = (OscarData *)gc->proto_data; 6405 6406 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); 6318 6407 aim_srv_setavailmsg(od->sess, text); 6319 6408 } … … 6321 6410 static void oscar_show_setavailmsg(GaimConnection *gc) 6322 6411 { 6323 gaim_request_input(gc, NULL, _("Available Message:"), 6324 NULL, _("Please talk to me, I'm lonely! (and single)"), TRUE, FALSE, 6412 gaim_request_input(gc, NULL, _("Available Message:"), NULL, 6413 _("I'm doing work and hoping for a distraction--IM me!"), 6414 TRUE, FALSE, 6325 6415 _("OK"), G_CALLBACK(oscar_setavailmsg), 6326 6416 _("Cancel"), NULL, … … 6329 6419 #endif 6330 6420 6421 static void oscar_show_set_info(GaimConnection *gc) 6422 { 6423 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); 6424 } 6425 6426 static void oscar_change_pass(GaimConnection *gc) 6427 { 6428 gaim_account_request_change_password(gaim_connection_get_account(gc)); 6429 } 6430 6331 6431 static void oscar_show_chpassurl(GaimConnection *gc) 6332 6432 { 6333 struct oscar_data *od = gc->proto_data;6433 OscarData *od = gc->proto_data; 6334 6434 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); 6335 6435 gaim_notify_uri(gc, substituted); … … 6337 6437 } 6338 6438 6439 static void oscar_show_imforwardingurl(GaimConnection *gc) 6440 { 6441 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); 6442 } 6443 6339 6444 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) 6340 6445 { 6341 struct oscar_data *od = gc->proto_data;6446 OscarData *od = gc->proto_data; 6342 6447 aim_session_t *sess = od->sess; 6343 6448 FILE *file; … … 6372 6477 static GList *oscar_actions(GaimConnection *gc) 6373 6478 { 6374 struct oscar_data *od = gc->proto_data;6479 OscarData *od = gc->proto_data; 6375 6480 struct proto_actions_menu *pam; 6376 6481 GList *m = NULL; … … 6378 6483 pam = g_new0(struct proto_actions_menu, 1); 6379 6484 pam->label = _("Set User Info"); 6380 pam->callback = show_set_info;6485 pam->callback = oscar_show_set_info; 6381 6486 pam->gc = gc; 6382 6487 m = g_list_append(m, pam); … … 6392 6497 pam = g_new0(struct proto_actions_menu, 1); 6393 6498 pam->label = _("Change Password"); 6394 pam->callback = show_change_passwd;6499 pam->callback = oscar_change_pass; 6395 6500 pam->gc = gc; 6396 6501 m = g_list_append(m, pam); … … 6404 6509 } 6405 6510 6511 if (od->sess->authinfo->chpassurl) { 6512 pam = g_new0(struct proto_actions_menu, 1); 6513 pam->label = _("Configure IM Forwarding (URL)"); 6514 pam->callback = oscar_show_imforwardingurl; 6515 pam->gc = gc; 6516 m = g_list_append(m, pam); 6517 } 6518 6406 6519 if (!od->icq) { 6407 6520 /* AIM actions */ … … 6445 6558 pam = g_new0(struct proto_actions_menu, 1); 6446 6559 pam->label = _("Search for Buddy by Email"); 6447 pam->callback = show_find_email;6560 pam->callback = oscar_show_find_email; 6448 6561 pam->gc = gc; 6449 6562 m = g_list_append(m, pam); … … 6460 6573 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) 6461 6574 { 6462 struct oscar_data *od = gc->proto_data;6575 OscarData *od = gc->proto_data; 6463 6576 6464 6577 if (od->icq) { … … 6479 6592 static void oscar_convo_closed(GaimConnection *gc, const char *who) 6480 6593 { 6481 struct oscar_data *od = gc->proto_data;6594 OscarData *od = gc->proto_data; 6482 6595 struct direct_im *dim = find_direct_im(od, who); 6483 6596
Note: See TracChangeset
for help on using the changeset viewer.