Changeset cf02dd6
- Timestamp:
- Dec 10, 2003, 3:20:45 PM (21 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
- Location:
- libfaim
- Files:
-
- 3 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
libfaim/Makefile.in
r862371b rcf02dd6 5 5 OBJS=admin.o adverts.o auth.o bos.o buddylist.o bstream.o \ 6 6 chat.o chatnav.o conn.o email.o ft.o icq.o im.o \ 7 in fo.o invite.o md5.o meta.o misc.o msgcookie.o newsearch.o \7 invite.o md5.o misc.o msgcookie.o locate.o \ 8 8 popups.o rxhandlers.o rxqueue.o search.o service.o \ 9 9 snac.o ssi.o stats.o tlv.o translate.o txqueue.o \ 10 util.o 10 util.o odir.o bart.o 11 11 CFLAGS=@CFLAGS@ -I. -DAIM_BUILDDATE=\"x\" -DAIM_BUILDTIME=\"x\" 12 12 -
libfaim/admin.c
re374dee rcf02dd6 111 111 aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); 112 112 113 aim_ addtlvtochain_raw(&tl, 0x0001, strlen(newnick), newnick);114 115 aim_ writetlvchain(&fr->data, &tl);116 aim_ freetlvchain(&tl);113 aim_tlvlist_add_raw(&tl, 0x0001, strlen(newnick), newnick); 114 115 aim_tlvlist_write(&fr->data, &tl); 116 aim_tlvlist_free(&tl); 117 117 118 118 aim_tx_enqueue(sess, fr); … … 139 139 140 140 /* new password TLV t(0002) */ 141 aim_ addtlvtochain_raw(&tl, 0x0002, strlen(newpw), newpw);141 aim_tlvlist_add_raw(&tl, 0x0002, strlen(newpw), newpw); 142 142 143 143 /* current password TLV t(0012) */ 144 aim_ addtlvtochain_raw(&tl, 0x0012, strlen(curpw), curpw);145 146 aim_ writetlvchain(&fr->data, &tl);147 aim_ freetlvchain(&tl);144 aim_tlvlist_add_raw(&tl, 0x0012, strlen(curpw), curpw); 145 146 aim_tlvlist_write(&fr->data, &tl); 147 aim_tlvlist_free(&tl); 148 148 149 149 aim_tx_enqueue(sess, fr); … … 168 168 aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); 169 169 170 aim_ addtlvtochain_raw(&tl, 0x0011, strlen(newemail), newemail);171 172 aim_ writetlvchain(&fr->data, &tl);173 aim_ freetlvchain(&tl);170 aim_tlvlist_add_raw(&tl, 0x0011, strlen(newemail), newemail); 171 172 aim_tlvlist_write(&fr->data, &tl); 173 aim_tlvlist_free(&tl); 174 174 175 175 aim_tx_enqueue(sess, fr); … … 205 205 /* This is 0x0013 if unable to confirm at this time */ 206 206 207 tl = aim_ readtlvchain(bs);207 tl = aim_tlvlist_read(bs); 208 208 209 209 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) -
libfaim/aim.h
re374dee rcf02dd6 78 78 #ifndef TRUE 79 79 #define TRUE (!FALSE) 80 #endif 81 82 #ifndef bool 83 #define bool fu8_t 80 84 #endif 81 85 … … 206 210 } 207 211 212 #define CLIENTINFO_AIM_5_5_3415 { \ 213 "AOL Instant Messenger, version 5.5.3415/WIN32", \ 214 0x0109, \ 215 0x0005, 0x0005, \ 216 0x0000, 0x0057, \ 217 0x000000ef, \ 218 "us", "en", \ 219 } 220 208 221 #define CLIENTINFO_ICHAT_1_0 { \ 209 222 "Apple iChat", \ … … 244 257 } 245 258 246 #define CLIENTINFO_ICQB asic_14_3_1068 { \259 #define CLIENTINFO_ICQBASIC_14_3_1068 { \ 247 260 "ICQBasic", \ 248 261 0x010a, \ … … 253 266 } 254 267 255 #define CLIENTINFO_N etscape_7_0_1 { \268 #define CLIENTINFO_NETSCAPE_7_0_1 { \ 256 269 "Netscape 2000 an approved user of AOL Instant Messenger (SM)", \ 257 270 0x1d0d, \ … … 366 379 } aim_msgcookie_t; 367 380 368 /* Values for sess->flags */369 #define AIM_SESS_FLAGS_SNACLOGIN 0x00000001370 #define AIM_SESS_FLAGS_XORLOGIN 0x00000002371 #define AIM_SESS_FLAGS_NONBLOCKCONNECT 0x00000004372 #define AIM_SESS_FLAGS_DONTTIMEOUTONICBM 0x00000008373 374 381 /* 375 382 * AIM Session: The main client-data interface. … … 427 434 } socksproxy; 428 435 429 fu32_t flags; /* AIM_SESS_FLAGS_ */436 bool nonblocking; 430 437 431 438 int debug; … … 445 452 struct aim_authresp_info *authinfo; 446 453 struct aim_emailinfo *emailinfo; 454 455 struct { 456 struct aim_userinfo_s *userinfo; 457 struct userinfo_node *torequest; 458 struct userinfo_node *requested; 459 int waiting_for_response; 460 } locate; 447 461 448 462 /* Server-stored information (ssi) */ … … 475 489 476 490 491 477 492 /* 478 493 * Get command from connections … … 540 555 faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn); 541 556 faim_export int aim_send_login(aim_session_t *, aim_conn_t *, const char *, const char *, struct client_info_s *, const char *key); 542 faim_export int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest);543 557 faim_export void aim_purge_rxqueue(aim_session_t *); 544 558 faim_export void aim_cleansnacs(aim_session_t *, int maxage); … … 571 585 typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va); 572 586 faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t); 573 faim_export void aim_session_init(aim_session_t *, fu32_t flags, int debuglevel);587 faim_export void aim_session_init(aim_session_t *, bool nonblocking, int debuglevel); 574 588 faim_export void aim_session_kill(aim_session_t *); 575 589 faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password); … … 580 594 581 595 582 /* service.c */596 /* 0x0001 - service.c */ 583 597 faim_export int aim_srv_setavailmsg(aim_session_t *sess, char *msg); 598 faim_export int aim_srv_setidle(aim_session_t *sess, fu32_t idletime); 584 599 585 600 … … 600 615 faim_export int aim_nop(aim_session_t *, aim_conn_t *); 601 616 faim_export int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn); 602 faim_export int aim_bos_setidle(aim_session_t *, aim_conn_t *, fu32_t);603 617 faim_export int aim_bos_changevisibility(aim_session_t *, aim_conn_t *, int, const char *); 604 faim_export int aim_bos_setbuddylist(aim_session_t *, aim_conn_t *, const char *);605 faim_export int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile_encoding, const char *profile, const int profile_len, const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len, fu32_t caps);606 618 faim_export int aim_bos_setgroupperm(aim_session_t *, aim_conn_t *, fu32_t mask); 607 619 faim_export int aim_bos_setprivacyflags(aim_session_t *, aim_conn_t *, fu32_t); … … 609 621 faim_export int aim_reqservice(aim_session_t *, aim_conn_t *, fu16_t); 610 622 faim_export int aim_bos_reqrights(aim_session_t *, aim_conn_t *); 611 faim_export int aim_bos_reqbuddyrights(aim_session_t *, aim_conn_t *);612 faim_export int aim_bos_reqlocaterights(aim_session_t *, aim_conn_t *);613 faim_export int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy);614 faim_export int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy);615 623 faim_export int aim_setextstatus(aim_session_t *sess, fu32_t status); 616 624 … … 936 944 937 945 938 /* info.c */946 /* 0x0002 - locate.c */ 939 947 /* 940 948 * AIM User Info, Standard Form. 941 949 */ 942 #define AIM_FLAG_UNCONFIRMED 950 #define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ 943 951 #define AIM_FLAG_ADMINISTRATOR 0x0002 944 #define AIM_FLAG_AOL 0x0004945 #define AIM_FLAG_OSCAR_PAY 0x0008946 #define AIM_FLAG_FREE 0x0010947 #define AIM_FLAG_AWAY 0x0020948 #define AIM_FLAG_ICQ 0x0040949 #define AIM_FLAG_WIRELESS 0x0080950 #define AIM_FLAG_UNKNOWN100 0x0100951 #define AIM_FLAG_UNKNOWN200 0x0200952 #define AIM_FLAG_ACTIVEBUDDY 953 #define AIM_FLAG_UNKNOWN800 0x0800954 #define AIM_FLAG_ABINTERNAL 955 #define AIM_FLAG_ALLUSERS 0x001f952 #define AIM_FLAG_AOL 0x0004 953 #define AIM_FLAG_OSCAR_PAY 0x0008 954 #define AIM_FLAG_FREE 0x0010 955 #define AIM_FLAG_AWAY 0x0020 956 #define AIM_FLAG_ICQ 0x0040 957 #define AIM_FLAG_WIRELESS 0x0080 958 #define AIM_FLAG_UNKNOWN100 0x0100 959 #define AIM_FLAG_UNKNOWN200 0x0200 960 #define AIM_FLAG_ACTIVEBUDDY 0x0400 961 #define AIM_FLAG_UNKNOWN800 0x0800 962 #define AIM_FLAG_ABINTERNAL 0x1000 963 #define AIM_FLAG_ALLUSERS 0x001f 956 964 957 965 #define AIM_USERINFO_PRESENT_FLAGS 0x00000001 … … 966 974 #define AIM_USERINFO_PRESENT_CREATETIME 0x00000200 967 975 968 typedef struct { 969 char sn[MAXSNLEN+1]; 976 struct userinfo_node { 977 char *sn; 978 struct userinfo_node *next; 979 }; 980 981 typedef struct aim_userinfo_s { 982 char *sn; 970 983 fu16_t warnlevel; /* evil percent * 10 (999 = 99.9%) */ 971 984 fu16_t idletime; /* in seconds */ … … 982 995 } icqinfo; 983 996 fu32_t present; 997 984 998 fu16_t iconcsumlen; 985 999 fu8_t *iconcsum; 986 char *availmsg_encoding; 987 char *availmsg; 988 int availmsg_len; 1000 1001 char *info; 1002 char *info_encoding; 1003 fu16_t info_len; 1004 1005 char *avail; 1006 char *avail_encoding; 1007 fu16_t avail_len; 1008 1009 char *away; 1010 char *away_encoding; 1011 fu16_t away_len; 1012 1013 struct aim_userinfo_s *next; 989 1014 } aim_userinfo_t; 990 1015 991 faim_export const char *aim_userinfo_sn(aim_userinfo_t *ui); 992 faim_export fu16_t aim_userinfo_flags(aim_userinfo_t *ui); 993 faim_export fu16_t aim_userinfo_idle(aim_userinfo_t *ui); 994 faim_export float aim_userinfo_warnlevel(aim_userinfo_t *ui); 995 faim_export time_t aim_userinfo_createtime(aim_userinfo_t *ui); 996 faim_export time_t aim_userinfo_membersince(aim_userinfo_t *ui); 997 faim_export time_t aim_userinfo_onlinesince(aim_userinfo_t *ui); 998 faim_export fu32_t aim_userinfo_sessionlen(aim_userinfo_t *ui); 999 faim_export int aim_userinfo_hascap(aim_userinfo_t *ui, fu32_t cap); 1000 1001 #define AIM_CAPS_BUDDYICON 0x00000001 1002 #define AIM_CAPS_VOICE 0x00000002 1003 #define AIM_CAPS_DIRECTIM 0x00000004 1004 #define AIM_CAPS_CHAT 0x00000008 1005 #define AIM_CAPS_GETFILE 0x00000010 1006 #define AIM_CAPS_SENDFILE 0x00000020 1007 #define AIM_CAPS_GAMES 0x00000040 1008 #define AIM_CAPS_SAVESTOCKS 0x00000080 1016 #define AIM_CAPS_BUDDYICON 0x00000001 1017 #define AIM_CAPS_VOICE 0x00000002 1018 #define AIM_CAPS_DIRECTIM 0x00000004 1019 #define AIM_CAPS_CHAT 0x00000008 1020 #define AIM_CAPS_GETFILE 0x00000010 1021 #define AIM_CAPS_SENDFILE 0x00000020 1022 #define AIM_CAPS_GAMES 0x00000040 1023 #define AIM_CAPS_SAVESTOCKS 0x00000080 1009 1024 #define AIM_CAPS_SENDBUDDYLIST 0x00000100 1010 #define AIM_CAPS_GAMES2 0x000002001011 #define AIM_CAPS_ICQ 0x000004001012 #define AIM_CAPS_APINFO 0x000008001013 #define AIM_CAPS_ICQRTF 0x000010001014 #define AIM_CAPS_EMPTY 0x000020001025 #define AIM_CAPS_GAMES2 0x00000200 1026 #define AIM_CAPS_ICQ_DIRECT 0x00000400 1027 #define AIM_CAPS_APINFO 0x00000800 1028 #define AIM_CAPS_ICQRTF 0x00001000 1029 #define AIM_CAPS_EMPTY 0x00002000 1015 1030 #define AIM_CAPS_ICQSERVERRELAY 0x00004000 1016 #define AIM_CAPS_ICQUTF8OLD 0x000080001031 #define AIM_CAPS_ICQUTF8OLD 0x00008000 1017 1032 #define AIM_CAPS_TRILLIANCRYPT 0x00010000 1018 #define AIM_CAPS_ICQUTF8 0x000200001033 #define AIM_CAPS_ICQUTF8 0x00020000 1019 1034 #define AIM_CAPS_INTEROPERATE 0x00040000 1020 #define AIM_CAPS_ICHAT 0x00080000 1021 #define AIM_CAPS_HIPTOP 0x00100000 1022 #define AIM_CAPS_SECUREIM 0x00200000 1023 #define AIM_CAPS_LAST 0x00400000 1024 1025 faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn); 1035 #define AIM_CAPS_ICHAT 0x00080000 1036 #define AIM_CAPS_HIPTOP 0x00100000 1037 #define AIM_CAPS_SECUREIM 0x00200000 1038 #define AIM_CAPS_SMS 0x00400000 1039 #define AIM_CAPS_GENERICUNKNOWN 0x00800000 1040 #define AIM_CAPS_VIDEO 0x01000000 1041 #define AIM_CAPS_LAST 0x02000000 1026 1042 1027 1043 #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 … … 1029 1045 1030 1046 faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, fu32_t offset, fu32_t len, const fu8_t *buf, fu8_t flag); 1031 1032 #define AIM_GETINFO_GENERALINFO 0x000011033 #define AIM_GETINFO_AWAYMESSAGE 0x000031034 #define AIM_GETINFO_CAPABILITIES 0x00041035 1047 1036 1048 struct aim_invite_priv { … … 1058 1070 #define AIM_COOKIETYPE_OFTICON 0x15 1059 1071 1060 /* 0x0005 */ faim_export int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, fu16_t); 1072 faim_export aim_userinfo_t *aim_locate_finduserinfo(aim_session_t *sess, const char *sn); 1073 1074 /* 0x0002 */ faim_export int aim_locate_reqrights(aim_session_t *sess); 1075 /* 0x0004 */ faim_export int aim_locate_setprofile(aim_session_t *sess, const char *profile_encoding, const char *profile, const int profile_len, const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len); 1076 /* 0x0004 */ faim_export int aim_locate_setcaps(aim_session_t *sess, fu32_t caps); 1077 /* 0x0005 */ faim_export int aim_locate_getinfo(aim_session_t *sess, const char *, fu16_t); 1078 /* 0x0009 */ faim_export int aim_locate_setdirinfo(aim_session_t *sess, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy); 1079 /* 0x000b */ faim_export int aim_locate_000b(aim_session_t *sess, const char *sn); 1080 /* 0x000f */ faim_export int aim_locate_setinterests(aim_session_t *sess, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy); 1081 /* 0x0015 */ faim_export int aim_locate_getinfoshort(aim_session_t *sess, const char *sn, fu32_t flags); 1061 1082 1062 1083 1063 1084 1064 1085 /* 0x0003 - buddylist.c */ 1065 /* 0x0004 */ faim_export int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *); 1066 /* 0x0005 */ faim_export int aim_remove_buddy(aim_session_t *, aim_conn_t *, const char *); 1067 /* 0x000b */ faim_export int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info); 1068 /* 0x000c */ faim_export int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn); 1086 /* 0x0002 */ faim_export int aim_buddylist_reqrights(aim_session_t *, aim_conn_t *); 1087 /* 0x0004 */ faim_export int aim_buddylist_set(aim_session_t *, aim_conn_t *, const char *); 1088 /* 0x0004 */ faim_export int aim_buddylist_addbuddy(aim_session_t *, aim_conn_t *, const char *); 1089 /* 0x0005 */ faim_export int aim_buddylist_removebuddy(aim_session_t *, aim_conn_t *, const char *); 1090 /* 0x000b */ faim_export int aim_buddylist_oncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info); 1091 /* 0x000c */ faim_export int aim_buddylist_offgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn); 1069 1092 1070 1093 … … 1194 1217 faim_export fu32_t aim_ssi_getpresence(struct aim_ssi_item *list); 1195 1218 faim_export char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn); 1219 faim_export char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn); 1196 1220 faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn); 1197 1221 … … 1205 1229 faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn); 1206 1230 faim_export int aim_ssi_aliasbuddy(aim_session_t *sess, const char *gn, const char *sn, const char *alias); 1231 faim_export int aim_ssi_editcomment(aim_session_t *sess, const char *gn, const char *sn, const char *alias); 1207 1232 faim_export int aim_ssi_rename_group(aim_session_t *sess, const char *oldgn, const char *newgn); 1208 1233 faim_export int aim_ssi_cleanlist(aim_session_t *sess); … … 1211 1236 faim_export int aim_ssi_setpresence(aim_session_t *sess, fu32_t presence); 1212 1237 faim_export int aim_ssi_seticon(aim_session_t *sess, fu8_t *iconsum, fu16_t iconsumlen); 1238 faim_export int aim_ssi_delicon(aim_session_t *sess); 1213 1239 1214 1240 … … 1326 1352 }; 1327 1353 1328 faim_export int aim_email_sendcookies(aim_session_t *sess, aim_conn_t *conn); 1329 faim_export int aim_email_activate(aim_session_t *sess, aim_conn_t *conn); 1330 1331 1332 1354 faim_export int aim_email_sendcookies(aim_session_t *sess); 1355 faim_export int aim_email_activate(aim_session_t *sess); 1356 1357 1358 1359 #if defined(FAIM_INTERNAL) || defined(FAIM_NEED_TLV) 1333 1360 /* tlv.c - TLV handling */ 1334 #if defined(FAIM_INTERNAL) || defined(FAIM_NEED_TLV) 1335 /* Generic TLV structure.*/1361 1362 /* TLV structure */ 1336 1363 typedef struct aim_tlv_s { 1337 1364 fu16_t type; … … 1340 1367 } aim_tlv_t; 1341 1368 1342 /* List of above.*/1369 /* TLV List structure */ 1343 1370 typedef struct aim_tlvlist_s { 1344 1371 aim_tlv_t *tlv; … … 1346 1373 } aim_tlvlist_t; 1347 1374 1348 /* TLV-handling functions */ 1349 1350 #if 0 1351 /* Very, very raw TLV handling. */ 1352 faim_internal int aim_puttlv_8(fu8_t *buf, const fu16_t t, const fu8_t v); 1353 faim_internal int aim_puttlv_16(fu8_t *buf, const fu16_t t, const fu16_t v); 1354 faim_internal int aim_puttlv_32(fu8_t *buf, const fu16_t t, const fu32_t v); 1355 faim_internal int aim_puttlv_raw(fu8_t *buf, const fu16_t t, const fu16_t l, const fu8_t *v); 1356 #endif 1357 1358 /* TLV list handling. */ 1359 faim_internal aim_tlvlist_t *aim_readtlvchain(aim_bstream_t *bs); 1360 faim_internal aim_tlvlist_t *aim_readtlvchain_num(aim_bstream_t *bs, fu16_t num); 1361 faim_internal aim_tlvlist_t *aim_readtlvchain_len(aim_bstream_t *bs, fu16_t len); 1375 /* TLV handling functions */ 1376 faim_internal aim_tlv_t *aim_tlv_gettlv(aim_tlvlist_t *list, fu16_t type, const int nth); 1377 faim_internal char *aim_tlv_getstr(aim_tlvlist_t *list, const fu16_t type, const int nth); 1378 faim_internal fu8_t aim_tlv_get8(aim_tlvlist_t *list, const fu16_t type, const int nth); 1379 faim_internal fu16_t aim_tlv_get16(aim_tlvlist_t *list, const fu16_t type, const int nth); 1380 faim_internal fu32_t aim_tlv_get32(aim_tlvlist_t *list, const fu16_t type, const int nth); 1381 1382 /* TLV list handling functions */ 1383 faim_internal aim_tlvlist_t *aim_tlvlist_read(aim_bstream_t *bs); 1384 faim_internal aim_tlvlist_t *aim_tlvlist_readnum(aim_bstream_t *bs, fu16_t num); 1385 faim_internal aim_tlvlist_t *aim_tlvlist_readlen(aim_bstream_t *bs, fu16_t len); 1362 1386 faim_internal aim_tlvlist_t *aim_tlvlist_copy(aim_tlvlist_t *orig); 1387 1388 faim_internal int aim_tlvlist_count(aim_tlvlist_t **list); 1389 faim_internal int aim_tlvlist_size(aim_tlvlist_t **list); 1363 1390 faim_internal int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two); 1364 faim_internal void aim_freetlvchain(aim_tlvlist_t **list); 1365 faim_internal aim_tlv_t *aim_gettlv(aim_tlvlist_t *, fu16_t t, const int n); 1366 faim_internal char *aim_gettlv_str(aim_tlvlist_t *, const fu16_t t, const int n); 1367 faim_internal fu8_t aim_gettlv8(aim_tlvlist_t *list, const fu16_t type, const int num); 1368 faim_internal fu16_t aim_gettlv16(aim_tlvlist_t *list, const fu16_t t, const int n); 1369 faim_internal fu32_t aim_gettlv32(aim_tlvlist_t *list, const fu16_t t, const int n); 1370 faim_internal int aim_writetlvchain(aim_bstream_t *bs, aim_tlvlist_t **list); 1371 faim_internal int aim_addtlvtochain8(aim_tlvlist_t **list, const fu16_t t, const fu8_t v); 1372 faim_internal int aim_addtlvtochain16(aim_tlvlist_t **list, const fu16_t t, const fu16_t v); 1373 faim_internal int aim_addtlvtochain32(aim_tlvlist_t **list, const fu16_t type, const fu32_t v); 1374 faim_internal int aim_addtlvtochain_raw(aim_tlvlist_t **list, const fu16_t t, const fu16_t l, const fu8_t *v); 1375 faim_internal int aim_addtlvtochain_caps(aim_tlvlist_t **list, const fu16_t t, const fu32_t caps); 1376 faim_internal int aim_addtlvtochain_noval(aim_tlvlist_t **list, const fu16_t type); 1377 faim_internal int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *ui); 1378 faim_internal int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl); 1379 faim_internal int aim_counttlvchain(aim_tlvlist_t **list); 1380 faim_internal int aim_sizetlvchain(aim_tlvlist_t **list); 1391 faim_internal int aim_tlvlist_write(aim_bstream_t *bs, aim_tlvlist_t **list); 1392 faim_internal void aim_tlvlist_free(aim_tlvlist_t **list); 1393 1394 faim_internal int aim_tlvlist_add_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t length, const fu8_t *value); 1395 faim_internal int aim_tlvlist_add_noval(aim_tlvlist_t **list, const fu16_t type); 1396 faim_internal int aim_tlvlist_add_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value); 1397 faim_internal int aim_tlvlist_add_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value); 1398 faim_internal int aim_tlvlist_add_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value); 1399 faim_internal int aim_tlvlist_add_caps(aim_tlvlist_t **list, const fu16_t type, const fu32_t caps); 1400 faim_internal int aim_tlvlist_add_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *userinfo); 1401 faim_internal int aim_tlvlist_add_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl); 1402 1403 faim_internal int aim_tlvlist_replace_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t lenth, const fu8_t *value); 1404 faim_internal int aim_tlvlist_replace_noval(aim_tlvlist_t **list, const fu16_t type); 1405 faim_internal int aim_tlvlist_replace_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value); 1406 faim_internal int aim_tlvlist_replace_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value); 1407 faim_internal int aim_tlvlist_replace_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value); 1408 1409 faim_internal void aim_tlvlist_remove(aim_tlvlist_t **list, const fu16_t type); 1381 1410 #endif /* FAIM_INTERNAL */ 1382 1411 -
libfaim/aim_cbtypes.h
ra0a5179 rcf02dd6 212 212 #define AIM_CB_SSI_REQDATA 0x0004 213 213 #define AIM_CB_SSI_REQIFCHANGED 0x0005 214 #define AIM_CB_SSI_REQLIST 0x0005215 214 #define AIM_CB_SSI_LIST 0x0006 216 215 #define AIM_CB_SSI_ACTIVATE 0x0007 -
libfaim/aim_internal.h
re374dee rcf02dd6 47 47 faim_internal int chat_modfirst(aim_session_t *sess, aim_module_t *mod); 48 48 faim_internal int locate_modfirst(aim_session_t *sess, aim_module_t *mod); 49 faim_internal int general_modfirst(aim_session_t *sess, aim_module_t *mod);49 faim_internal int service_modfirst(aim_session_t *sess, aim_module_t *mod); 50 50 faim_internal int invite_modfirst(aim_session_t *sess, aim_module_t *mod); 51 51 faim_internal int translate_modfirst(aim_session_t *sess, aim_module_t *mod); … … 189 189 faim_internal void aim_conn_addgroup(aim_conn_t *conn, fu16_t group); 190 190 191 faim_internal fu32_t aim_getcap(aim_session_t *sess, aim_bstream_t *bs, int len);192 faim_internal int aim_putcap(aim_bstream_t *bs, fu32_t caps);193 194 191 faim_internal int aim_cachecookie(aim_session_t *sess, aim_msgcookie_t *cookie); 195 192 faim_internal aim_msgcookie_t *aim_uncachecookie(aim_session_t *sess, fu8_t *cookie, int type); … … 200 197 faim_internal int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie); 201 198 199 /* 0x0002 - locate.c */ 200 faim_internal void aim_locate_requestuserinfo(aim_session_t *sess, const char *sn); 201 faim_internal fu32_t aim_locate_getcaps(aim_session_t *sess, aim_bstream_t *bs, int len); 202 faim_internal fu32_t aim_locate_getcaps_short(aim_session_t *sess, aim_bstream_t *bs, int len); 203 faim_internal int aim_putcap(aim_bstream_t *bs, fu32_t caps); 202 204 faim_internal void aim_info_free(aim_userinfo_t *); 203 205 faim_internal int aim_info_extract(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *); … … 205 207 206 208 faim_internal int aim_chat_readroominfo(aim_bstream_t *bs, struct aim_chat_roominfo *outinfo); 207 208 faim_internal void faimdprintf(aim_session_t *sess, int dlevel, const char *format, ...);209 209 210 210 faim_internal void aim_conn_kill_chat(aim_session_t *sess, aim_conn_t *conn); … … 216 216 faim_internal int aim_rates_delparam(aim_session_t *, aim_conn_t *); 217 217 218 faim_internal void faimdprintf(aim_session_t *sess, int dlevel, const char *format, ...); 219 218 220 #ifndef FAIM_INTERNAL_INSANE 219 221 #define printf() printf called inside libfaim -
libfaim/auth.c
re374dee rcf02dd6 12 12 #include "md5.h" 13 13 14 static int aim_encode_password(const char *password, fu8_t *encoded); 15 16 /* 14 #include <ctype.h> 15 16 /** 17 * Encode a password using old XOR method 18 * 19 * This takes a const pointer to a (null terminated) string 20 * containing the unencoded password. It also gets passed 21 * an already allocated buffer to store the encoded password. 22 * This buffer should be the exact length of the password without 23 * the null. The encoded password buffer /is not %NULL terminated/. 24 * 25 * The encoding_table seems to be a fixed set of values. We'll 26 * hope it doesn't change over time! 27 * 28 * This is only used for the XOR method, not the better MD5 method. 29 * 30 * @param password Incoming password. 31 * @param encoded Buffer to put encoded password. 32 */ 33 static int aim_encode_password(const char *password, fu8_t *encoded) 34 { 35 fu8_t encoding_table[] = { 36 #if 0 /* old v1 table */ 37 0xf3, 0xb3, 0x6c, 0x99, 38 0x95, 0x3f, 0xac, 0xb6, 39 0xc5, 0xfa, 0x6b, 0x63, 40 0x69, 0x6c, 0xc3, 0x9f 41 #else /* v2.1 table, also works for ICQ */ 42 0xf3, 0x26, 0x81, 0xc4, 43 0x39, 0x86, 0xdb, 0x92, 44 0x71, 0xa3, 0xb9, 0xe6, 45 0x53, 0x7a, 0x95, 0x7c 46 #endif 47 }; 48 int i; 49 50 for (i = 0; i < strlen(password); i++) 51 encoded[i] = (password[i] ^ encoding_table[i]); 52 53 return 0; 54 } 55 56 #ifdef USE_OLD_MD5 57 static int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest) 58 { 59 md5_state_t state; 60 61 md5_init(&state); 62 md5_append(&state, (const md5_byte_t *)key, strlen(key)); 63 md5_append(&state, (const md5_byte_t *)password, strlen(password)); 64 md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); 65 md5_finish(&state, (md5_byte_t *)digest); 66 67 return 0; 68 } 69 #else 70 static int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest) 71 { 72 md5_state_t state; 73 fu8_t passdigest[16]; 74 75 md5_init(&state); 76 md5_append(&state, (const md5_byte_t *)password, strlen(password)); 77 md5_finish(&state, (md5_byte_t *)&passdigest); 78 79 md5_init(&state); 80 md5_append(&state, (const md5_byte_t *)key, strlen(key)); 81 md5_append(&state, (const md5_byte_t *)&passdigest, 16); 82 md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); 83 md5_finish(&state, (md5_byte_t *)digest); 84 85 return 0; 86 } 87 #endif 88 89 /* 90 * The FLAP version is sent by itself at the beginning of authorization 91 * connections. The FLAP version is also sent before the cookie when connecting 92 * for other services (BOS, chatnav, chat, etc.). 93 */ 94 faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn) 95 { 96 aim_frame_t *fr; 97 98 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4))) 99 return -ENOMEM; 100 101 aimbs_put32(&fr->data, 0x00000001); 102 103 aim_tx_enqueue(sess, fr); 104 105 return 0; 106 } 107 108 /* 17 109 * This just pushes the passed cookie onto the passed connection, without 18 110 * the SNAC header or any of that. … … 31 123 32 124 aimbs_put32(&fr->data, 0x00000001); 33 aim_addtlvtochain_raw(&tl, 0x0006, length, chipsahoy); 34 aim_writetlvchain(&fr->data, &tl); 35 aim_freetlvchain(&tl); 36 37 aim_tx_enqueue(sess, fr); 38 39 return 0; 40 } 41 42 /* 43 * Normally the FLAP version is sent as the first few bytes of the cookie, 44 * meaning you generally never call this. 45 * 46 * But there are times when something might want it seperate. Specifically, 47 * libfaim sends this internally when doing SNAC login. 48 * 49 */ 50 faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn) 51 { 52 aim_frame_t *fr; 53 54 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4))) 55 return -ENOMEM; 56 57 aimbs_put32(&fr->data, 0x00000001); 58 59 aim_tx_enqueue(sess, fr); 60 61 return 0; 62 } 63 64 /* 65 * This is a bit confusing. 66 * 67 * Normal SNAC login goes like this: 68 * - connect 69 * - server sends flap version 70 * - client sends flap version 71 * - client sends screen name (17/6) 72 * - server sends hash key (17/7) 73 * - client sends auth request (17/2 -- aim_send_login) 74 * - server yells 75 * 76 * XOR login (for ICQ) goes like this: 77 * - connect 78 * - server sends flap version 79 * - client sends auth request which contains flap version (aim_send_login) 80 * - server yells 81 * 82 * For the client API, we make them implement the most complicated version, 83 * and for the simpler version, we fake it and make it look like the more 84 * complicated process. 85 * 86 * This is done by giving the client a faked key, just so we can convince 87 * them to call aim_send_login right away, which will detect the session 88 * flag that says this is XOR login and ignore the key, sending an ICQ 89 * login request instead of the normal SNAC one. 90 * 91 * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. 92 * 93 * XXX This may cause problems if the client relies on callbacks only 94 * being called from the context of aim_rxdispatch()... 95 * 96 */ 97 static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn) 98 { 99 aim_frame_t fr; 100 aim_rxcallback_t userfunc; 101 102 sess->flags &= ~AIM_SESS_FLAGS_SNACLOGIN; 103 sess->flags |= AIM_SESS_FLAGS_XORLOGIN; 104 105 fr.conn = conn; 106 107 if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007))) 108 userfunc(sess, &fr, ""); 109 110 return 0; 111 } 112 113 /* 114 * In AIM 3.5 protocol, the first stage of login is to request login from the 115 * Authorizer, passing it the screen name for verification. If the name is 116 * invalid, a 0017/0003 is spit back, with the standard error contents. If 117 * valid, a 0017/0007 comes back, which is the signal to send it the main 118 * login command (0017/0002). 119 * 120 */ 121 faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn) 122 { 123 aim_frame_t *fr; 124 aim_snacid_t snacid; 125 aim_tlvlist_t *tl = NULL; 126 127 if (!sess || !conn || !sn) 128 return -EINVAL; 129 130 if ((sn[0] >= '0') && (sn[0] <= '9')) 131 return goddamnicq(sess, conn, sn); 132 133 sess->flags |= AIM_SESS_FLAGS_SNACLOGIN; 134 135 aim_sendflapver(sess, conn); 136 137 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn)))) 138 return -ENOMEM; 139 140 snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); 141 aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); 142 143 aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn); 144 aim_writetlvchain(&fr->data, &tl); 145 aim_freetlvchain(&tl); 125 aim_tlvlist_add_raw(&tl, 0x0006, length, chipsahoy); 126 aim_tlvlist_write(&fr->data, &tl); 127 aim_tlvlist_free(&tl); 146 128 147 129 aim_tx_enqueue(sess, fr); … … 174 156 175 157 aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */ 176 aim_ addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn);177 aim_ addtlvtochain_raw(&tl, 0x0002, passwdlen, password_encoded);158 aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); 159 aim_tlvlist_add_raw(&tl, 0x0002, passwdlen, password_encoded); 178 160 179 161 if (ci->clientstring) 180 aim_ addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring);181 aim_ addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid);182 aim_ addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major);183 aim_ addtlvtochain16(&tl, 0x0018, (fu16_t)ci->minor);184 aim_ addtlvtochain16(&tl, 0x0019, (fu16_t)ci->point);185 aim_ addtlvtochain16(&tl, 0x001a, (fu16_t)ci->build);186 aim_ addtlvtochain32(&tl, 0x0014, (fu32_t)ci->distrib); /* distribution chan */187 aim_ addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), ci->lang);188 aim_ addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), ci->country);189 190 aim_ writetlvchain(&fr->data, &tl);162 aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); 163 aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid); 164 aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major); 165 aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor); 166 aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point); 167 aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build); 168 aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); /* distribution chan */ 169 aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); 170 aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country); 171 172 aim_tlvlist_write(&fr->data, &tl); 191 173 192 174 free(password_encoded); 193 aim_ freetlvchain(&tl);175 aim_tlvlist_free(&tl); 194 176 195 177 aim_tx_enqueue(sess, fr); … … 199 181 200 182 /* 201 * send_login(int socket, char *sn, char *password)202 * 183 * Subtype 0x0002 184 * 203 185 * This is the initial login request packet. 204 186 * … … 237 219 return -EINVAL; 238 220 239 /* 240 * What the XORLOGIN flag _really_ means is that its an ICQ login, 241 * which is really stupid and painful, so its not done here. 242 * 243 */ 244 if (sess->flags & AIM_SESS_FLAGS_XORLOGIN) 221 /* If we're signing on an ICQ account then use the older, XOR login method */ 222 if (isdigit(sn[0])) 245 223 return goddamnicq2(sess, conn, sn, password, ci); 246 247 224 248 225 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) … … 252 229 aim_putsnac(&fr->data, 0x0017, 0x0002, 0x0000, snacid); 253 230 254 aim_ addtlvtochain_raw(&tl, 0x0001, strlen(sn), sn);231 aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); 255 232 256 233 aim_encode_password_md5(password, key, digest); 257 aim_ addtlvtochain_raw(&tl, 0x0025, 16, digest);258 259 /* 260 * Newer versions of winaim have an empty type x004c TLV here.261 */ 234 aim_tlvlist_add_raw(&tl, 0x0025, 16, digest); 235 236 #ifndef USE_OLD_MD5 237 aim_tlvlist_add_noval(&tl, 0x004c); 238 #endif 262 239 263 240 if (ci->clientstring) 264 aim_ addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring);265 aim_ addtlvtochain16(&tl, 0x0016, (fu16_t)ci->clientid);266 aim_ addtlvtochain16(&tl, 0x0017, (fu16_t)ci->major);267 aim_ addtlvtochain16(&tl, 0x0018, (fu16_t)ci->minor);268 aim_ addtlvtochain16(&tl, 0x0019, (fu16_t)ci->point);269 aim_ addtlvtochain16(&tl, 0x001a, (fu16_t)ci->build);270 aim_ addtlvtochain32(&tl, 0x0014, (fu32_t)ci->distrib);271 aim_ addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), ci->country);272 aim_ addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), ci->lang);241 aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); 242 aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid); 243 aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major); 244 aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor); 245 aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point); 246 aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build); 247 aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); 248 aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); 249 aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country); 273 250 274 251 #ifndef NOSSI … … 277 254 * to use SSI. 278 255 */ 279 aim_ addtlvtochain8(&tl, 0x004a, 0x01);256 aim_tlvlist_add_8(&tl, 0x004a, 0x01); 280 257 #endif 281 258 282 aim_ writetlvchain(&fr->data, &tl);283 284 aim_ freetlvchain(&tl);259 aim_tlvlist_write(&fr->data, &tl); 260 261 aim_tlvlist_free(&tl); 285 262 286 263 aim_tx_enqueue(sess, fr); 287 288 return 0;289 }290 291 faim_export int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest)292 {293 md5_state_t state;294 295 md5_init(&state);296 md5_append(&state, (const md5_byte_t *)key, strlen(key));297 md5_append(&state, (const md5_byte_t *)password, strlen(password));298 md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING));299 md5_finish(&state, (md5_byte_t *)digest);300 301 return 0;302 }303 304 /**305 * aim_encode_password - Encode a password using old XOR method306 * @password: incoming password307 * @encoded: buffer to put encoded password308 *309 * This takes a const pointer to a (null terminated) string310 * containing the unencoded password. It also gets passed311 * an already allocated buffer to store the encoded password.312 * This buffer should be the exact length of the password without313 * the null. The encoded password buffer /is not %NULL terminated/.314 *315 * The encoding_table seems to be a fixed set of values. We'll316 * hope it doesn't change over time!317 *318 * This is only used for the XOR method, not the better MD5 method.319 *320 */321 static int aim_encode_password(const char *password, fu8_t *encoded)322 {323 fu8_t encoding_table[] = {324 #if 0 /* old v1 table */325 0xf3, 0xb3, 0x6c, 0x99,326 0x95, 0x3f, 0xac, 0xb6,327 0xc5, 0xfa, 0x6b, 0x63,328 0x69, 0x6c, 0xc3, 0x9f329 #else /* v2.1 table, also works for ICQ */330 0xf3, 0x26, 0x81, 0xc4,331 0x39, 0x86, 0xdb, 0x92,332 0x71, 0xa3, 0xb9, 0xe6,333 0x53, 0x7a, 0x95, 0x7c334 #endif335 };336 int i;337 338 for (i = 0; i < strlen(password); i++)339 encoded[i] = (password[i] ^ encoding_table[i]);340 264 341 265 return 0; … … 349 273 * The client should check the value passed as errorcode. If 350 274 * its nonzero, there was an error. 351 *352 275 */ 353 276 static int parse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) … … 365 288 * from what is parsed here. 366 289 */ 367 tlvlist = aim_ readtlvchain(bs);290 tlvlist = aim_tlvlist_read(bs); 368 291 369 292 /* … … 371 294 */ 372 295 memset(sess->sn, 0, sizeof(sess->sn)); 373 if (aim_ gettlv(tlvlist, 0x0001, 1)) {374 info->sn = aim_ gettlv_str(tlvlist, 0x0001, 1);296 if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) { 297 info->sn = aim_tlv_getstr(tlvlist, 0x0001, 1); 375 298 strncpy(sess->sn, info->sn, sizeof(sess->sn)); 376 299 } … … 380 303 * have an error url. 381 304 */ 382 if (aim_ gettlv(tlvlist, 0x0008, 1))383 info->errorcode = aim_ gettlv16(tlvlist, 0x0008, 1);384 if (aim_ gettlv(tlvlist, 0x0004, 1))385 info->errorurl = aim_ gettlv_str(tlvlist, 0x0004, 1);305 if (aim_tlv_gettlv(tlvlist, 0x0008, 1)) 306 info->errorcode = aim_tlv_get16(tlvlist, 0x0008, 1); 307 if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) 308 info->errorurl = aim_tlv_getstr(tlvlist, 0x0004, 1); 386 309 387 310 /* 388 311 * BOS server address. 389 312 */ 390 if (aim_ gettlv(tlvlist, 0x0005, 1))391 info->bosip = aim_ gettlv_str(tlvlist, 0x0005, 1);313 if (aim_tlv_gettlv(tlvlist, 0x0005, 1)) 314 info->bosip = aim_tlv_getstr(tlvlist, 0x0005, 1); 392 315 393 316 /* 394 317 * Authorization cookie. 395 318 */ 396 if (aim_ gettlv(tlvlist, 0x0006, 1)) {319 if (aim_tlv_gettlv(tlvlist, 0x0006, 1)) { 397 320 aim_tlv_t *tmptlv; 398 321 399 tmptlv = aim_ gettlv(tlvlist, 0x0006, 1);322 tmptlv = aim_tlv_gettlv(tlvlist, 0x0006, 1); 400 323 401 324 info->cookielen = tmptlv->length; … … 410 333 * XXX - Not really true! 411 334 */ 412 if (aim_ gettlv(tlvlist, 0x0011, 1))413 info->email = aim_ gettlv_str(tlvlist, 0x0011, 1);335 if (aim_tlv_gettlv(tlvlist, 0x0011, 1)) 336 info->email = aim_tlv_getstr(tlvlist, 0x0011, 1); 414 337 415 338 /* … … 427 350 * 428 351 */ 429 if (aim_ gettlv(tlvlist, 0x0013, 1))430 info->regstatus = aim_ gettlv16(tlvlist, 0x0013, 1);431 432 if (aim_ gettlv(tlvlist, 0x0040, 1))433 info->latestbeta.build = aim_ gettlv32(tlvlist, 0x0040, 1);434 if (aim_ gettlv(tlvlist, 0x0041, 1))435 info->latestbeta.url = aim_ gettlv_str(tlvlist, 0x0041, 1);436 if (aim_ gettlv(tlvlist, 0x0042, 1))437 info->latestbeta.info = aim_ gettlv_str(tlvlist, 0x0042, 1);438 if (aim_ gettlv(tlvlist, 0x0043, 1))439 info->latestbeta.name = aim_ gettlv_str(tlvlist, 0x0043, 1);440 if (aim_ gettlv(tlvlist, 0x0048, 1))441 ; /* no idea what this is*/442 443 if (aim_ gettlv(tlvlist, 0x0044, 1))444 info->latestrelease.build = aim_ gettlv32(tlvlist, 0x0044, 1);445 if (aim_ gettlv(tlvlist, 0x0045, 1))446 info->latestrelease.url = aim_ gettlv_str(tlvlist, 0x0045, 1);447 if (aim_ gettlv(tlvlist, 0x0046, 1))448 info->latestrelease.info = aim_ gettlv_str(tlvlist, 0x0046, 1);449 if (aim_ gettlv(tlvlist, 0x0047, 1))450 info->latestrelease.name = aim_ gettlv_str(tlvlist, 0x0047, 1);451 if (aim_ gettlv(tlvlist, 0x0049, 1))452 ; /* no idea what this is*/352 if (aim_tlv_gettlv(tlvlist, 0x0013, 1)) 353 info->regstatus = aim_tlv_get16(tlvlist, 0x0013, 1); 354 355 if (aim_tlv_gettlv(tlvlist, 0x0040, 1)) 356 info->latestbeta.build = aim_tlv_get32(tlvlist, 0x0040, 1); 357 if (aim_tlv_gettlv(tlvlist, 0x0041, 1)) 358 info->latestbeta.url = aim_tlv_getstr(tlvlist, 0x0041, 1); 359 if (aim_tlv_gettlv(tlvlist, 0x0042, 1)) 360 info->latestbeta.info = aim_tlv_getstr(tlvlist, 0x0042, 1); 361 if (aim_tlv_gettlv(tlvlist, 0x0043, 1)) 362 info->latestbeta.name = aim_tlv_getstr(tlvlist, 0x0043, 1); 363 if (aim_tlv_gettlv(tlvlist, 0x0048, 1)) 364 ; /* beta serial */ 365 366 if (aim_tlv_gettlv(tlvlist, 0x0044, 1)) 367 info->latestrelease.build = aim_tlv_get32(tlvlist, 0x0044, 1); 368 if (aim_tlv_gettlv(tlvlist, 0x0045, 1)) 369 info->latestrelease.url = aim_tlv_getstr(tlvlist, 0x0045, 1); 370 if (aim_tlv_gettlv(tlvlist, 0x0046, 1)) 371 info->latestrelease.info = aim_tlv_getstr(tlvlist, 0x0046, 1); 372 if (aim_tlv_gettlv(tlvlist, 0x0047, 1)) 373 info->latestrelease.name = aim_tlv_getstr(tlvlist, 0x0047, 1); 374 if (aim_tlv_gettlv(tlvlist, 0x0049, 1)) 375 ; /* lastest release serial */ 453 376 454 377 /* 455 378 * URL to change password. 456 379 */ 457 if (aim_ gettlv(tlvlist, 0x0054, 1))458 info->chpassurl = aim_ gettlv_str(tlvlist, 0x0054, 1);380 if (aim_tlv_gettlv(tlvlist, 0x0054, 1)) 381 info->chpassurl = aim_tlv_getstr(tlvlist, 0x0054, 1); 459 382 460 383 /* 461 384 * Unknown. Seen on an @mac.com screen name with value of 0x003f 462 385 */ 463 if (aim_ gettlv(tlvlist, 0x0055, 1))386 if (aim_tlv_gettlv(tlvlist, 0x0055, 1)) 464 387 ; 465 388 … … 469 392 ret = userfunc(sess, rx, info); 470 393 471 aim_ freetlvchain(&tlvlist);394 aim_tlvlist_free(&tlvlist); 472 395 473 396 return ret; … … 475 398 476 399 /* 400 * Subtype 0x0007 (kind of) - Send a fake type 0x0007 SNAC to the client 401 * 402 * This is a bit confusing. 403 * 404 * Normal SNAC login goes like this: 405 * - connect 406 * - server sends flap version 407 * - client sends flap version 408 * - client sends screen name (17/6) 409 * - server sends hash key (17/7) 410 * - client sends auth request (17/2 -- aim_send_login) 411 * - server yells 412 * 413 * XOR login (for ICQ) goes like this: 414 * - connect 415 * - server sends flap version 416 * - client sends auth request which contains flap version (aim_send_login) 417 * - server yells 418 * 419 * For the client API, we make them implement the most complicated version, 420 * and for the simpler version, we fake it and make it look like the more 421 * complicated process. 422 * 423 * This is done by giving the client a faked key, just so we can convince 424 * them to call aim_send_login right away, which will detect the session 425 * flag that says this is XOR login and ignore the key, sending an ICQ 426 * login request instead of the normal SNAC one. 427 * 428 * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. 429 * 430 * XXX This may cause problems if the client relies on callbacks only 431 * being called from the context of aim_rxdispatch()... 432 * 433 */ 434 static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn) 435 { 436 aim_frame_t fr; 437 aim_rxcallback_t userfunc; 438 439 fr.conn = conn; 440 441 if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007))) 442 userfunc(sess, &fr, ""); 443 444 return 0; 445 } 446 447 /* 448 * Subtype 0x0006 449 * 450 * In AIM 3.5 protocol, the first stage of login is to request login from the 451 * Authorizer, passing it the screen name for verification. If the name is 452 * invalid, a 0017/0003 is spit back, with the standard error contents. If 453 * valid, a 0017/0007 comes back, which is the signal to send it the main 454 * login command (0017/0002). 455 * 456 */ 457 faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn) 458 { 459 aim_frame_t *fr; 460 aim_snacid_t snacid; 461 aim_tlvlist_t *tl = NULL; 462 463 if (!sess || !conn || !sn) 464 return -EINVAL; 465 466 if (isdigit(sn[0])) 467 return goddamnicq(sess, conn, sn); 468 469 aim_sendflapver(sess, conn); 470 471 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn) /*+8*/ ))) 472 return -ENOMEM; 473 474 snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); 475 aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); 476 477 aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); 478 /* aim_tlvlist_add_noval(&tl, 0x004b); 479 aim_tlvlist_add_noval(&tl, 0x005a); */ 480 aim_tlvlist_write(&fr->data, &tl); 481 aim_tlvlist_free(&tl); 482 483 aim_tx_enqueue(sess, fr); 484 485 return 0; 486 } 487 488 /* 489 * Subtype 0x0007 490 * 477 491 * Middle handler for 0017/0007 SNACs. Contains the auth key prefixed 478 492 * by only its length in a two byte word. -
libfaim/bos.c
re374dee rcf02dd6 13 13 faim_export int aim_bos_reqrights(aim_session_t *sess, aim_conn_t *conn) 14 14 { 15 return aim_genericreq_n (sess, conn, 0x0009, 0x0002);15 return aim_genericreq_n_snacid(sess, conn, 0x0009, 0x0002); 16 16 } 17 17 … … 27 27 * TLVs follow 28 28 */ 29 tlvlist = aim_ readtlvchain(bs);29 tlvlist = aim_tlvlist_read(bs); 30 30 31 31 /* 32 32 * TLV type 0x0001: Maximum number of buddies on permit list. 33 33 */ 34 if (aim_ gettlv(tlvlist, 0x0001, 1))35 maxpermits = aim_ gettlv16(tlvlist, 0x0001, 1);34 if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) 35 maxpermits = aim_tlv_get16(tlvlist, 0x0001, 1); 36 36 37 37 /* 38 38 * TLV type 0x0002: Maximum number of buddies on deny list. 39 39 */ 40 if (aim_ gettlv(tlvlist, 0x0002, 1))41 maxdenies = aim_ gettlv16(tlvlist, 0x0002, 1);40 if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) 41 maxdenies = aim_tlv_get16(tlvlist, 0x0002, 1); 42 42 43 43 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 44 44 ret = userfunc(sess, rx, maxpermits, maxdenies); 45 45 46 aim_ freetlvchain(&tlvlist);46 aim_tlvlist_free(&tlvlist); 47 47 48 48 return ret; -
libfaim/buddylist.c
re374dee rcf02dd6 15 15 * 16 16 */ 17 faim_export int aim_b os_reqbuddyrights(aim_session_t *sess, aim_conn_t *conn)18 { 19 return aim_genericreq_n (sess, conn, 0x0003, 0x0002);17 faim_export int aim_buddylist_reqrights(aim_session_t *sess, aim_conn_t *conn) 18 { 19 return aim_genericreq_n_snacid(sess, conn, 0x0003, 0x0002); 20 20 } 21 21 … … 34 34 * TLVs follow 35 35 */ 36 tlvlist = aim_ readtlvchain(bs);36 tlvlist = aim_tlvlist_read(bs); 37 37 38 38 /* 39 39 * TLV type 0x0001: Maximum number of buddies. 40 40 */ 41 if (aim_ gettlv(tlvlist, 0x0001, 1))42 maxbuddies = aim_ gettlv16(tlvlist, 0x0001, 1);41 if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) 42 maxbuddies = aim_tlv_get16(tlvlist, 0x0001, 1); 43 43 44 44 /* … … 50 50 * 51 51 */ 52 if (aim_ gettlv(tlvlist, 0x0002, 1))53 maxwatchers = aim_ gettlv16(tlvlist, 0x0002, 1);52 if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) 53 maxwatchers = aim_tlv_get16(tlvlist, 0x0002, 1); 54 54 55 55 /* … … 62 62 ret = userfunc(sess, rx, maxbuddies, maxwatchers); 63 63 64 aim_ freetlvchain(&tlvlist);64 aim_tlvlist_free(&tlvlist); 65 65 66 66 return ret; … … 74 74 * 75 75 */ 76 faim_export int aim_ add_buddy(aim_session_t *sess, aim_conn_t *conn, const char *sn)76 faim_export int aim_buddylist_addbuddy(aim_session_t *sess, aim_conn_t *conn, const char *sn) 77 77 { 78 78 aim_frame_t *fr; … … 106 106 * 107 107 */ 108 faim_export int aim_b os_setbuddylist(aim_session_t *sess, aim_conn_t *conn, const char *buddy_list)108 faim_export int aim_buddylist_set(aim_session_t *sess, aim_conn_t *conn, const char *buddy_list) 109 109 { 110 110 aim_frame_t *fr; … … 154 154 * 155 155 */ 156 faim_export int aim_ remove_buddy(aim_session_t *sess, aim_conn_t *conn, const char *sn)156 faim_export int aim_buddylist_removebuddy(aim_session_t *sess, aim_conn_t *conn, const char *sn) 157 157 { 158 158 aim_frame_t *fr; … … 182 182 * 183 183 */ 184 faim_export int aim_ sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info)184 faim_export int aim_buddylist_oncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info) 185 185 { 186 186 aim_frame_t *fr; … … 209 209 * 210 210 */ 211 faim_export int aim_ sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn)211 faim_export int aim_buddylist_offgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn) 212 212 { 213 213 aim_frame_t *fr; … … 253 253 ret = userfunc(sess, rx, &userinfo); 254 254 255 if (snac->subtype == 0x000b) 256 aim_locate_requestuserinfo(sess, userinfo.sn); 255 257 aim_info_free(&userinfo); 256 258 -
libfaim/chat.c
re374dee rcf02dd6 104 104 aimbs_put16(&bs, instance); 105 105 106 aim_ addtlvtochain_raw(list, type, aim_bstream_curpos(&bs), buf);106 aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf); 107 107 108 108 free(buf); … … 144 144 145 145 aim_addtlvtochain_chatroom(&tl, 0x0001, exchange, roomname, instance); 146 aim_ writetlvchain(&fr->data, &tl);147 aim_ freetlvchain(&tl);146 aim_tlvlist_write(&fr->data, &tl); 147 aim_tlvlist_free(&tl); 148 148 149 149 aim_tx_enqueue(sess, fr); … … 250 250 aim_putcap(&hdrbs, AIM_CAPS_CHAT); 251 251 252 aim_ addtlvtochain16(&itl, 0x000a, 0x0001);253 aim_ addtlvtochain_noval(&itl, 0x000f);254 aim_ addtlvtochain_raw(&itl, 0x000c, strlen(msg), msg);252 aim_tlvlist_add_16(&itl, 0x000a, 0x0001); 253 aim_tlvlist_add_noval(&itl, 0x000f); 254 aim_tlvlist_add_raw(&itl, 0x000c, strlen(msg), msg); 255 255 aim_addtlvtochain_chatroom(&itl, 0x2711, exchange, roomname, instance); 256 aim_ writetlvchain(&hdrbs, &itl);257 258 aim_ addtlvtochain_raw(&otl, 0x0005, aim_bstream_curpos(&hdrbs), hdr);259 260 aim_ writetlvchain(&fr->data, &otl);256 aim_tlvlist_write(&hdrbs, &itl); 257 258 aim_tlvlist_add_raw(&otl, 0x0005, aim_bstream_curpos(&hdrbs), hdr); 259 260 aim_tlvlist_write(&fr->data, &otl); 261 261 262 262 free(hdr); 263 aim_ freetlvchain(&itl);264 aim_ freetlvchain(&otl);263 aim_tlvlist_free(&itl); 264 aim_tlvlist_free(&otl); 265 265 266 266 aim_tx_enqueue(sess, fr); … … 308 308 * Everything else are TLVs. 309 309 */ 310 tlvlist = aim_ readtlvchain(bs);310 tlvlist = aim_tlvlist_read(bs); 311 311 312 312 /* 313 313 * TLV type 0x006a is the room name in Human Readable Form. 314 314 */ 315 if (aim_ gettlv(tlvlist, 0x006a, 1))316 roomname = aim_ gettlv_str(tlvlist, 0x006a, 1);315 if (aim_tlv_gettlv(tlvlist, 0x006a, 1)) 316 roomname = aim_tlv_getstr(tlvlist, 0x006a, 1); 317 317 318 318 /* 319 319 * Type 0x006f: Number of occupants. 320 320 */ 321 if (aim_ gettlv(tlvlist, 0x006f, 1))322 usercount = aim_ gettlv16(tlvlist, 0x006f, 1);321 if (aim_tlv_gettlv(tlvlist, 0x006f, 1)) 322 usercount = aim_tlv_get16(tlvlist, 0x006f, 1); 323 323 324 324 /* 325 325 * Type 0x0073: Occupant list. 326 326 */ 327 if (aim_ gettlv(tlvlist, 0x0073, 1)) {327 if (aim_tlv_gettlv(tlvlist, 0x0073, 1)) { 328 328 int curoccupant = 0; 329 329 aim_tlv_t *tmptlv; 330 330 aim_bstream_t occbs; 331 331 332 tmptlv = aim_ gettlv(tlvlist, 0x0073, 1);332 tmptlv = aim_tlv_gettlv(tlvlist, 0x0073, 1); 333 333 334 334 /* Allocate enough userinfo structs for all occupants */ … … 344 344 * Type 0x00c9: Flags. (AIM_CHATROOM_FLAG) 345 345 */ 346 if (aim_ gettlv(tlvlist, 0x00c9, 1))347 flags = aim_ gettlv16(tlvlist, 0x00c9, 1);346 if (aim_tlv_gettlv(tlvlist, 0x00c9, 1)) 347 flags = aim_tlv_get16(tlvlist, 0x00c9, 1); 348 348 349 349 /* 350 350 * Type 0x00ca: Creation time (4 bytes) 351 351 */ 352 if (aim_ gettlv(tlvlist, 0x00ca, 1))353 creationtime = aim_ gettlv32(tlvlist, 0x00ca, 1);352 if (aim_tlv_gettlv(tlvlist, 0x00ca, 1)) 353 creationtime = aim_tlv_get32(tlvlist, 0x00ca, 1); 354 354 355 355 /* 356 356 * Type 0x00d1: Maximum Message Length 357 357 */ 358 if (aim_ gettlv(tlvlist, 0x00d1, 1))359 maxmsglen = aim_ gettlv16(tlvlist, 0x00d1, 1);358 if (aim_tlv_gettlv(tlvlist, 0x00d1, 1)) 359 maxmsglen = aim_tlv_get16(tlvlist, 0x00d1, 1); 360 360 361 361 /* 362 362 * Type 0x00d2: Unknown. (2 bytes) 363 363 */ 364 if (aim_ gettlv(tlvlist, 0x00d2, 1))365 unknown_d2 = aim_ gettlv16(tlvlist, 0x00d2, 1);364 if (aim_tlv_gettlv(tlvlist, 0x00d2, 1)) 365 unknown_d2 = aim_tlv_get16(tlvlist, 0x00d2, 1); 366 366 367 367 /* 368 368 * Type 0x00d3: Room Description 369 369 */ 370 if (aim_ gettlv(tlvlist, 0x00d3, 1))371 roomdesc = aim_ gettlv_str(tlvlist, 0x00d3, 1);370 if (aim_tlv_gettlv(tlvlist, 0x00d3, 1)) 371 roomdesc = aim_tlv_getstr(tlvlist, 0x00d3, 1); 372 372 373 373 /* 374 374 * Type 0x000d4: Unknown (flag only) 375 375 */ 376 if (aim_ gettlv(tlvlist, 0x000d4, 1))376 if (aim_tlv_gettlv(tlvlist, 0x000d4, 1)) 377 377 ; 378 378 … … 380 380 * Type 0x00d5: Unknown. (1 byte) 381 381 */ 382 if (aim_ gettlv(tlvlist, 0x00d5, 1))383 unknown_d5 = aim_ gettlv8(tlvlist, 0x00d5, 1);382 if (aim_tlv_gettlv(tlvlist, 0x00d5, 1)) 383 unknown_d5 = aim_tlv_get8(tlvlist, 0x00d5, 1); 384 384 385 385 … … 387 387 * Type 0x00d6: Encoding 1 ("us-ascii") 388 388 */ 389 if (aim_ gettlv(tlvlist, 0x000d6, 1))389 if (aim_tlv_gettlv(tlvlist, 0x000d6, 1)) 390 390 ; 391 391 … … 393 393 * Type 0x00d7: Language 1 ("en") 394 394 */ 395 if (aim_ gettlv(tlvlist, 0x000d7, 1))395 if (aim_tlv_gettlv(tlvlist, 0x000d7, 1)) 396 396 ; 397 397 … … 399 399 * Type 0x00d8: Encoding 2 ("us-ascii") 400 400 */ 401 if (aim_ gettlv(tlvlist, 0x000d8, 1))401 if (aim_tlv_gettlv(tlvlist, 0x000d8, 1)) 402 402 ; 403 403 … … 405 405 * Type 0x00d9: Language 2 ("en") 406 406 */ 407 if (aim_ gettlv(tlvlist, 0x000d9, 1))407 if (aim_tlv_gettlv(tlvlist, 0x000d9, 1)) 408 408 ; 409 409 … … 411 411 * Type 0x00da: Maximum visible message length 412 412 */ 413 if (aim_ gettlv(tlvlist, 0x000da, 1))414 maxvisiblemsglen = aim_ gettlv16(tlvlist, 0x00da, 1);413 if (aim_tlv_gettlv(tlvlist, 0x000da, 1)) 414 maxvisiblemsglen = aim_tlv_get16(tlvlist, 0x00da, 1); 415 415 416 416 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { … … 438 438 free(roomname); 439 439 free(roomdesc); 440 aim_ freetlvchain(&tlvlist);440 aim_tlvlist_free(&tlvlist); 441 441 442 442 return ret; … … 516 516 * Type 1: Flag meaning this message is destined to the room. 517 517 */ 518 aim_ addtlvtochain_noval(&otl, 0x0001);518 aim_tlvlist_add_noval(&otl, 0x0001); 519 519 520 520 /* … … 522 522 */ 523 523 if (!(flags & AIM_CHATFLAGS_NOREFLECT)) 524 aim_ addtlvtochain_noval(&otl, 0x0006);524 aim_tlvlist_add_noval(&otl, 0x0006); 525 525 526 526 /* … … 528 528 */ 529 529 if (flags & AIM_CHATFLAGS_AWAY) 530 aim_ addtlvtochain_noval(&otl, 0x0007);530 aim_tlvlist_add_noval(&otl, 0x0007); 531 531 532 532 /* 533 533 * SubTLV: Type 1: Message 534 534 */ 535 aim_ addtlvtochain_raw(&itl, 0x0001, msglen, msg);535 aim_tlvlist_add_raw(&itl, 0x0001, msglen, msg); 536 536 537 537 /* … … 542 542 * 543 543 */ 544 aim_ addtlvtochain_frozentlvlist(&otl, 0x0005, &itl);545 546 aim_ writetlvchain(&fr->data, &otl);547 548 aim_ freetlvchain(&itl);549 aim_ freetlvchain(&otl);544 aim_tlvlist_add_frozentlvlist(&otl, 0x0005, &itl); 545 546 aim_tlvlist_write(&fr->data, &otl); 547 548 aim_tlvlist_free(&itl); 549 aim_tlvlist_free(&otl); 550 550 551 551 aim_tx_enqueue(sess, fr); … … 621 621 * Start parsing TLVs right away. 622 622 */ 623 otl = aim_ readtlvchain(bs);623 otl = aim_tlvlist_read(bs); 624 624 625 625 /* 626 626 * Type 0x0003: Source User Information 627 627 */ 628 if (aim_ gettlv(otl, 0x0003, 1)) {628 if (aim_tlv_gettlv(otl, 0x0003, 1)) { 629 629 aim_tlv_t *userinfotlv; 630 630 aim_bstream_t tbs; 631 631 632 userinfotlv = aim_ gettlv(otl, 0x0003, 1);632 userinfotlv = aim_tlv_gettlv(otl, 0x0003, 1); 633 633 634 634 aim_bstream_init(&tbs, userinfotlv->value, userinfotlv->length); … … 640 640 * room (as opposed to a whisper). 641 641 */ 642 if (aim_ gettlv(otl, 0x0001, 1))642 if (aim_tlv_gettlv(otl, 0x0001, 1)) 643 643 ; 644 644 … … 646 646 * Type 0x0005: Message Block. Conains more TLVs. 647 647 */ 648 if (aim_ gettlv(otl, 0x0005, 1)) {648 if (aim_tlv_gettlv(otl, 0x0005, 1)) { 649 649 aim_tlvlist_t *itl; 650 650 aim_tlv_t *msgblock; 651 651 aim_bstream_t tbs; 652 652 653 msgblock = aim_ gettlv(otl, 0x0005, 1);653 msgblock = aim_tlv_gettlv(otl, 0x0005, 1); 654 654 aim_bstream_init(&tbs, msgblock->value, msgblock->length); 655 itl = aim_ readtlvchain(&tbs);655 itl = aim_tlvlist_read(&tbs); 656 656 657 657 /* 658 658 * Type 0x0001: Message. 659 659 */ 660 if (aim_ gettlv(itl, 0x0001, 1))661 msg = aim_ gettlv_str(itl, 0x0001, 1);662 663 aim_ freetlvchain(&itl);660 if (aim_tlv_gettlv(itl, 0x0001, 1)) 661 msg = aim_tlv_getstr(itl, 0x0001, 1); 662 663 aim_tlvlist_free(&itl); 664 664 } 665 665 … … 670 670 free(cookie); 671 671 free(msg); 672 aim_ freetlvchain(&otl);672 aim_tlvlist_free(&otl); 673 673 674 674 return ret; -
libfaim/chatnav.c
re374dee rcf02dd6 68 68 aimbs_put8(&fr->data, 0x01); 69 69 70 aim_ addtlvtochain_raw(&tl, 0x00d3, strlen(name), name);71 aim_ addtlvtochain_raw(&tl, 0x00d6, strlen(charset), charset);72 aim_ addtlvtochain_raw(&tl, 0x00d7, strlen(lang), lang);70 aim_tlvlist_add_raw(&tl, 0x00d3, strlen(name), name); 71 aim_tlvlist_add_raw(&tl, 0x00d6, strlen(charset), charset); 72 aim_tlvlist_add_raw(&tl, 0x00d7, strlen(lang), lang); 73 73 74 74 /* tlvcount */ 75 aimbs_put16(&fr->data, aim_ counttlvchain(&tl));76 aim_ writetlvchain(&fr->data, &tl);77 78 aim_ freetlvchain(&tl);75 aimbs_put16(&fr->data, aim_tlvlist_count(&tl)); 76 aim_tlvlist_write(&fr->data, &tl); 77 78 aim_tlvlist_free(&tl); 79 79 80 80 aim_tx_enqueue(sess, fr); … … 93 93 aim_tlvlist_t *tlvlist, *innerlist; 94 94 95 tlvlist = aim_ readtlvchain(bs);95 tlvlist = aim_tlvlist_read(bs); 96 96 97 97 /* 98 98 * Type 0x0002: Maximum concurrent rooms. 99 99 */ 100 if (aim_ gettlv(tlvlist, 0x0002, 1))101 maxrooms = aim_ gettlv8(tlvlist, 0x0002, 1);100 if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) 101 maxrooms = aim_tlv_get8(tlvlist, 0x0002, 1); 102 102 103 103 /* … … 108 108 * 109 109 */ 110 for (curexchange = 0; ((exchangetlv = aim_ gettlv(tlvlist, 0x0003, curexchange+1))); ) {110 for (curexchange = 0; ((exchangetlv = aim_tlv_gettlv(tlvlist, 0x0003, curexchange+1))); ) { 111 111 aim_bstream_t tbs; 112 112 … … 119 119 /* exchange number */ 120 120 exchanges[curexchange-1].number = aimbs_get16(&tbs); 121 innerlist = aim_ readtlvchain(&tbs);121 innerlist = aim_tlvlist_read(&tbs); 122 122 123 123 /* … … 127 127 * 128 128 */ 129 if (aim_ gettlv(innerlist, 0x000a, 1))129 if (aim_tlv_gettlv(innerlist, 0x000a, 1)) 130 130 ; 131 131 … … 133 133 * Type 0x000d: Unknown. 134 134 */ 135 if (aim_ gettlv(innerlist, 0x000d, 1))135 if (aim_tlv_gettlv(innerlist, 0x000d, 1)) 136 136 ; 137 137 … … 139 139 * Type 0x0004: Unknown 140 140 */ 141 if (aim_ gettlv(innerlist, 0x0004, 1))141 if (aim_tlv_gettlv(innerlist, 0x0004, 1)) 142 142 ; 143 143 … … 145 145 * Type 0x0002: Unknown 146 146 */ 147 if (aim_ gettlv(innerlist, 0x0002, 1)) {147 if (aim_tlv_gettlv(innerlist, 0x0002, 1)) { 148 148 fu16_t classperms; 149 149 150 classperms = aim_ gettlv16(innerlist, 0x0002, 1);150 classperms = aim_tlv_get16(innerlist, 0x0002, 1); 151 151 152 152 faimdprintf(sess, 1, "faim: class permissions %x\n", classperms); … … 162 162 * 163 163 */ 164 if (aim_ gettlv(innerlist, 0x00c9, 1))165 exchanges[curexchange-1].flags = aim_ gettlv16(innerlist, 0x00c9, 1);164 if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) 165 exchanges[curexchange-1].flags = aim_tlv_get16(innerlist, 0x00c9, 1); 166 166 167 167 /* 168 168 * Type 0x00ca: Creation Date 169 169 */ 170 if (aim_ gettlv(innerlist, 0x00ca, 1))170 if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) 171 171 ; 172 172 … … 174 174 * Type 0x00d0: Mandatory Channels? 175 175 */ 176 if (aim_ gettlv(innerlist, 0x00d0, 1))176 if (aim_tlv_gettlv(innerlist, 0x00d0, 1)) 177 177 ; 178 178 … … 180 180 * Type 0x00d1: Maximum Message length 181 181 */ 182 if (aim_ gettlv(innerlist, 0x00d1, 1))182 if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) 183 183 ; 184 184 … … 186 186 * Type 0x00d2: Maximum Occupancy? 187 187 */ 188 if (aim_ gettlv(innerlist, 0x00d2, 1))188 if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) 189 189 ; 190 190 … … 192 192 * Type 0x00d3: Exchange Description 193 193 */ 194 if (aim_ gettlv(innerlist, 0x00d3, 1))195 exchanges[curexchange-1].name = aim_ gettlv_str(innerlist, 0x00d3, 1);194 if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) 195 exchanges[curexchange-1].name = aim_tlv_getstr(innerlist, 0x00d3, 1); 196 196 else 197 197 exchanges[curexchange-1].name = NULL; … … 200 200 * Type 0x00d4: Exchange Description URL 201 201 */ 202 if (aim_ gettlv(innerlist, 0x00d4, 1))202 if (aim_tlv_gettlv(innerlist, 0x00d4, 1)) 203 203 ; 204 204 … … 211 211 * 212 212 */ 213 if (aim_ gettlv(innerlist, 0x00d5, 1)) {213 if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) { 214 214 fu8_t createperms; 215 215 216 createperms = aim_ gettlv8(innerlist, 0x00d5, 1);216 createperms = aim_tlv_get8(innerlist, 0x00d5, 1); 217 217 } 218 218 … … 220 220 * Type 0x00d6: Character Set (First Time) 221 221 */ 222 if (aim_ gettlv(innerlist, 0x00d6, 1))223 exchanges[curexchange-1].charset1 = aim_ gettlv_str(innerlist, 0x00d6, 1);222 if (aim_tlv_gettlv(innerlist, 0x00d6, 1)) 223 exchanges[curexchange-1].charset1 = aim_tlv_getstr(innerlist, 0x00d6, 1); 224 224 else 225 225 exchanges[curexchange-1].charset1 = NULL; … … 228 228 * Type 0x00d7: Language (First Time) 229 229 */ 230 if (aim_ gettlv(innerlist, 0x00d7, 1))231 exchanges[curexchange-1].lang1 = aim_ gettlv_str(innerlist, 0x00d7, 1);230 if (aim_tlv_gettlv(innerlist, 0x00d7, 1)) 231 exchanges[curexchange-1].lang1 = aim_tlv_getstr(innerlist, 0x00d7, 1); 232 232 else 233 233 exchanges[curexchange-1].lang1 = NULL; … … 236 236 * Type 0x00d8: Character Set (Second Time) 237 237 */ 238 if (aim_ gettlv(innerlist, 0x00d8, 1))239 exchanges[curexchange-1].charset2 = aim_ gettlv_str(innerlist, 0x00d8, 1);238 if (aim_tlv_gettlv(innerlist, 0x00d8, 1)) 239 exchanges[curexchange-1].charset2 = aim_tlv_getstr(innerlist, 0x00d8, 1); 240 240 else 241 241 exchanges[curexchange-1].charset2 = NULL; … … 244 244 * Type 0x00d9: Language (Second Time) 245 245 */ 246 if (aim_ gettlv(innerlist, 0x00d9, 1))247 exchanges[curexchange-1].lang2 = aim_ gettlv_str(innerlist, 0x00d9, 1);246 if (aim_tlv_gettlv(innerlist, 0x00d9, 1)) 247 exchanges[curexchange-1].lang2 = aim_tlv_getstr(innerlist, 0x00d9, 1); 248 248 else 249 249 exchanges[curexchange-1].lang2 = NULL; … … 252 252 * Type 0x00da: Unknown 253 253 */ 254 if (aim_ gettlv(innerlist, 0x00da, 1))255 ; 256 257 aim_ freetlvchain(&innerlist);254 if (aim_tlv_gettlv(innerlist, 0x00da, 1)) 255 ; 256 257 aim_tlvlist_free(&innerlist); 258 258 } 259 259 … … 272 272 } 273 273 free(exchanges); 274 aim_ freetlvchain(&tlvlist);274 aim_tlvlist_free(&tlvlist); 275 275 276 276 return ret; … … 290 290 aim_bstream_t bbbs; 291 291 292 tlvlist = aim_ readtlvchain(bs);293 294 if (!(bigblock = aim_ gettlv(tlvlist, 0x0004, 1))) {292 tlvlist = aim_tlvlist_read(bs); 293 294 if (!(bigblock = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { 295 295 faimdprintf(sess, 0, "no bigblock in top tlv in create room response\n"); 296 aim_ freetlvchain(&tlvlist);296 aim_tlvlist_free(&tlvlist); 297 297 return 0; 298 298 } … … 308 308 if (detaillevel != 0x02) { 309 309 faimdprintf(sess, 0, "unknown detaillevel in create room response (0x%02x)\n", detaillevel); 310 aim_ freetlvchain(&tlvlist);310 aim_tlvlist_free(&tlvlist); 311 311 free(ck); 312 312 return 0; … … 315 315 unknown = aimbs_get16(&bbbs); 316 316 317 innerlist = aim_ readtlvchain(&bbbs);318 319 if (aim_ gettlv(innerlist, 0x006a, 1))320 fqcn = aim_ gettlv_str(innerlist, 0x006a, 1);321 322 if (aim_ gettlv(innerlist, 0x00c9, 1))323 flags = aim_ gettlv16(innerlist, 0x00c9, 1);324 325 if (aim_ gettlv(innerlist, 0x00ca, 1))326 createtime = aim_ gettlv32(innerlist, 0x00ca, 1);327 328 if (aim_ gettlv(innerlist, 0x00d1, 1))329 maxmsglen = aim_ gettlv16(innerlist, 0x00d1, 1);330 331 if (aim_ gettlv(innerlist, 0x00d2, 1))332 maxoccupancy = aim_ gettlv16(innerlist, 0x00d2, 1);333 334 if (aim_ gettlv(innerlist, 0x00d3, 1))335 name = aim_ gettlv_str(innerlist, 0x00d3, 1);336 337 if (aim_ gettlv(innerlist, 0x00d5, 1))338 createperms = aim_ gettlv8(innerlist, 0x00d5, 1);317 innerlist = aim_tlvlist_read(&bbbs); 318 319 if (aim_tlv_gettlv(innerlist, 0x006a, 1)) 320 fqcn = aim_tlv_getstr(innerlist, 0x006a, 1); 321 322 if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) 323 flags = aim_tlv_get16(innerlist, 0x00c9, 1); 324 325 if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) 326 createtime = aim_tlv_get32(innerlist, 0x00ca, 1); 327 328 if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) 329 maxmsglen = aim_tlv_get16(innerlist, 0x00d1, 1); 330 331 if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) 332 maxoccupancy = aim_tlv_get16(innerlist, 0x00d2, 1); 333 334 if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) 335 name = aim_tlv_getstr(innerlist, 0x00d3, 1); 336 337 if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) 338 createperms = aim_tlv_get8(innerlist, 0x00d5, 1); 339 339 340 340 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { … … 345 345 free(name); 346 346 free(fqcn); 347 aim_ freetlvchain(&innerlist);348 aim_ freetlvchain(&tlvlist);347 aim_tlvlist_free(&innerlist); 348 aim_tlvlist_free(&tlvlist); 349 349 350 350 return ret; -
libfaim/conn.c
re374dee rcf02dd6 192 192 193 193 /** 194 * aim_connrst - Clears out connection list, killing remaining connections. 195 * @sess: Session to be cleared 196 * 197 * Clears out the connection list and kills any connections left. 198 * 194 * Clears out connection list, killing remaining connections. 195 * 196 * @param sess Session to be cleared 199 197 */ 200 198 static void aim_connrst(aim_session_t *sess) … … 218 216 219 217 /** 220 * aim_conn_init - Reset a connection to default values. 221 * @deadconn: Connection to be reset 222 * 218 * Reset a connection to default values. 223 219 * Initializes and/or resets a connection structure. 224 220 * 221 * @param deadconn Connection to be reset 225 222 */ 226 223 static void aim_conn_init(aim_conn_t *deadconn) … … 533 530 fd = socket(hp->h_addrtype, SOCK_STREAM, 0); 534 531 535 if (sess-> flags & AIM_SESS_FLAGS_NONBLOCKCONNECT)532 if (sess->nonblocking) 536 533 fcntl(fd, F_SETFL, O_NONBLOCK); /* XXX save flags */ 537 534 538 535 if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) { 539 if (sess-> flags & AIM_SESS_FLAGS_NONBLOCKCONNECT) {536 if (sess->nonblocking) { 540 537 if ((errno == EINPROGRESS) || (errno == EINTR)) { 541 538 if (statusret) … … 853 850 854 851 /** 855 * aim_session_init - Initializes a session structure 856 * @sess: Session to initialize 857 * @flags: Flags to use. Any of %AIM_SESS_FLAGS %OR'd together. 858 * @debuglevel: Level of debugging output (zero is least) 859 * 860 * Sets up the initial values for a session. 861 * 862 */ 863 faim_export void aim_session_init(aim_session_t *sess, fu32_t flags, int debuglevel) 852 * Initializes a session structure by setting the initial values 853 * stuff in the aim_session_t struct. 854 * 855 * @param sess Session to initialize. 856 * @param nonblocking Set to true if you want connections to be non-blocking. 857 * @param debuglevel Level of debugging output (zero is least). 858 */ 859 faim_export void aim_session_init(aim_session_t *sess, bool nonblocking, int debuglevel) 864 860 { 865 861 … … 873 869 aim_initsnachash(sess); 874 870 sess->msgcookies = NULL; 875 sess->icq_info = NULL; 876 sess->oft_info = NULL; 877 sess->snacid_next = 0x00000001; 878 879 sess->flags = 0; 871 sess->nonblocking = nonblocking; 880 872 sess->debug = debuglevel; 881 873 sess->debugcb = defaultdebugcb; 882 883 874 sess->modlistv = NULL; 884 875 sess->snacid_next = 0x00000001; 876 877 sess->locate.userinfo = NULL; 878 sess->locate.torequest = NULL; 879 sess->locate.requested = NULL; 880 sess->locate.waiting_for_response = FALSE; 885 881 sess->ssi.received_data = 0; 886 882 sess->ssi.numitems = 0; … … 890 886 sess->ssi.timestamp = (time_t)0; 891 887 sess->ssi.waiting_for_ack = 0; 892 888 sess->icq_info = NULL; 893 889 sess->authinfo = NULL; 894 890 sess->emailinfo = NULL; 895 896 /* 897 * Default to SNAC login unless XORLOGIN is explicitly set. 898 */ 899 if (!(flags & AIM_SESS_FLAGS_XORLOGIN)) 900 sess->flags |= AIM_SESS_FLAGS_SNACLOGIN; 901 sess->flags |= flags; 891 sess->oft_info = NULL; 902 892 903 893 /* … … 907 897 aim_tx_setenqueue(sess, AIM_TX_QUEUED, NULL); 908 898 909 910 899 /* 911 900 * Register all the modules for this session... 912 901 */ 913 902 aim__registermodule(sess, misc_modfirst); /* load the catch-all first */ 914 aim__registermodule(sess, general_modfirst);903 aim__registermodule(sess, service_modfirst); 915 904 aim__registermodule(sess, locate_modfirst); 916 905 aim__registermodule(sess, buddylist_modfirst); … … 926 915 aim__registermodule(sess, chatnav_modfirst); 927 916 aim__registermodule(sess, chat_modfirst); 928 /* aim__registermodule(sess, odir_modfirst); */ /* kretch */929 /* aim__registermodule(sess, bart_modfirst); */ /* kretch */917 aim__registermodule(sess, odir_modfirst); 918 aim__registermodule(sess, bart_modfirst); 930 919 /* missing 0x11 - 0x12 */ 931 920 aim__registermodule(sess, ssi_modfirst); … … 1058 1047 aim_tx_enqueue(sess, fr); 1059 1048 1049 /* clean out SNACs over 60sec old */ 1050 aim_cleansnacs(sess, 60); 1051 1060 1052 return 0; 1061 1053 } -
libfaim/email.c
re374dee rcf02dd6 19 19 * @return Return 0 if no errors, otherwise return the error number. 20 20 */ 21 faim_export int aim_email_sendcookies(aim_session_t *sess, aim_conn_t *conn) 22 { 21 faim_export int aim_email_sendcookies(aim_session_t *sess) 22 { 23 aim_conn_t *conn; 23 24 aim_frame_t *fr; 24 25 aim_snacid_t snacid; 25 26 26 if (!sess || ! conn)27 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_EML))) 27 28 return -EINVAL; 28 29 … … 81 82 fu8_t *cookie8, *cookie16; 82 83 int tmp, havenewmail = 0; /* Used to tell the client we have _new_ mail */ 84 85 char *alertitle = NULL, *alerturl = NULL; 83 86 84 87 cookie8 = aimbs_getraw(bs, 8); /* Possibly the code used to log you in to mail? */ … … 105 108 new->cookie16 = cookie16; 106 109 107 tlvlist = aim_ readtlvchain_num(bs, aimbs_get16(bs));108 109 tmp = aim_ gettlv16(tlvlist, 0x0080, 1);110 tlvlist = aim_tlvlist_readnum(bs, aimbs_get16(bs)); 111 112 tmp = aim_tlv_get16(tlvlist, 0x0080, 1); 110 113 if (tmp) { 111 114 if (new->nummsgs < tmp) … … 118 121 new->nummsgs++; /* We know we have at least 1 new email */ 119 122 } 120 new->url = aim_ gettlv_str(tlvlist, 0x0007, 1);121 if (!(new->unread = aim_ gettlv8(tlvlist, 0x0081, 1))) {123 new->url = aim_tlv_getstr(tlvlist, 0x0007, 1); 124 if (!(new->unread = aim_tlv_get8(tlvlist, 0x0081, 1))) { 122 125 havenewmail = 0; 123 126 new->nummsgs = 0; 124 127 } 125 new->domain = aim_gettlv_str(tlvlist, 0x0082, 1); 126 new->flag = aim_gettlv16(tlvlist, 0x0084, 1); 127 128 new->domain = aim_tlv_getstr(tlvlist, 0x0082, 1); 129 new->flag = aim_tlv_get16(tlvlist, 0x0084, 1); 130 131 alertitle = aim_tlv_getstr(tlvlist, 0x0005, 1); 132 alerturl = aim_tlv_getstr(tlvlist, 0x000d, 1); 133 128 134 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 129 ret = userfunc(sess, rx, new, havenewmail); 130 131 aim_freetlvchain(&tlvlist); 135 ret = userfunc(sess, rx, new, havenewmail, alertitle, (alerturl ? alerturl + 2 : NULL)); 136 137 aim_tlvlist_free(&tlvlist); 138 139 free(alertitle); 140 free(alerturl); 132 141 133 142 return ret; … … 141 150 * @return Return 0 if no errors, otherwise return the error number. 142 151 */ 143 faim_export int aim_email_activate(aim_session_t *sess, aim_conn_t *conn) 144 { 152 faim_export int aim_email_activate(aim_session_t *sess) 153 { 154 aim_conn_t *conn; 145 155 aim_frame_t *fr; 146 156 aim_snacid_t snacid; 147 157 148 if (!sess || ! conn)158 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_EML))) 149 159 return -EINVAL; 150 160 -
libfaim/ft.c
re374dee rcf02dd6 259 259 return 0; /* not an error */ 260 260 261 if ( addr.sa_family != AF_INET) { /* just in case IPv6 really is happening */261 if ((addr.sa_family != AF_INET) && (addr.sa_family != AF_INET6)) { /* just in case IPv6 really is happening */ 262 262 close(acceptfd); 263 263 aim_conn_close(cur); -
libfaim/icq.c
re374dee rcf02dd6 317 317 318 318 aim_tx_enqueue(sess, fr); 319 320 return 0; 321 } 322 323 /* 324 * Send an SMS message. This is the non-US way. The US-way is to IM 325 * their cell phone number (+19195551234). 326 * 327 * We basically construct and send an XML message. The format is: 328 * <icq_sms_message> 329 * <destination>full_phone_without_leading_+</destination> 330 * <text>message</text> 331 * <codepage>1252</codepage> 332 * <senders_UIN>self_uin</senders_UIN> 333 * <senders_name>self_name</senders_name> 334 * <delivery_receipt>Yes|No</delivery_receipt> 335 * <time>Wkd, DD Mmm YYYY HH:MM:SS TMZ</time> 336 * </icq_sms_message> 337 * 338 * Yeah hi Peter, whaaaat's happening. If there's any way to use 339 * a codepage other than 1252 that would be great. Thaaaanks. 340 */ 341 faim_export int aim_icq_sendsms(aim_session_t *sess, const char *name, const char *msg, const char *alias) 342 { 343 aim_conn_t *conn; 344 aim_frame_t *fr; 345 aim_snacid_t snacid; 346 int bslen, xmllen; 347 char *xml, timestr[30]; 348 time_t t; 349 struct tm *tm; 350 351 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) 352 return -EINVAL; 353 354 if (!name || !msg || !alias) 355 return -EINVAL; 356 357 time(&t); 358 tm = gmtime(&t); 359 strftime(timestr, 30, "%a, %d %b %Y %T %Z", tm); 360 361 /* The length of xml included the null terminating character */ 362 xmllen = 225 + strlen(name) + strlen(msg) + strlen(sess->sn) + strlen(alias) + strlen(timestr) + 1; 363 364 if (!(xml = (char *)malloc(xmllen*sizeof(char)))) 365 return -ENOMEM; 366 snprintf(xml, xmllen, "<icq_sms_message>\n" 367 "\t<destination>%s</destination>\n" 368 "\t<text>%s</text>\n" 369 "\t<codepage>1252</codepage>\n" 370 "\t<senders_UIN>%s</senders_UIN>\n" 371 "\t<senders_name>%s</senders_name>\n" 372 "\t<delivery_receipt>Yes</delivery_receipt>\n" 373 "\t<time>%s</time>\n" 374 "</icq_sms_message>\n", 375 name, msg, sess->sn, alias, timestr); 376 377 bslen = 37 + xmllen; 378 379 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) { 380 free(xml); 381 return -ENOMEM; 382 } 383 384 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); 385 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); 386 387 /* For simplicity, don't bother using a tlvlist */ 388 aimbs_put16(&fr->data, 0x0001); 389 aimbs_put16(&fr->data, bslen); 390 391 aimbs_putle16(&fr->data, bslen - 2); 392 aimbs_putle32(&fr->data, atoi(sess->sn)); 393 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ 394 aimbs_putle16(&fr->data, snacid); /* eh. */ 395 396 /* From libicq200-0.3.2/src/SNAC-SRV.cpp */ 397 aimbs_putle16(&fr->data, 0x8214); 398 aimbs_put16(&fr->data, 0x0001); 399 aimbs_put16(&fr->data, 0x0016); 400 aimbs_put32(&fr->data, 0x00000000); 401 aimbs_put32(&fr->data, 0x00000000); 402 aimbs_put32(&fr->data, 0x00000000); 403 aimbs_put32(&fr->data, 0x00000000); 404 405 aimbs_put16(&fr->data, 0x0000); 406 aimbs_put16(&fr->data, xmllen); 407 aimbs_putraw(&fr->data, xml, xmllen); 408 409 aim_tx_enqueue(sess, fr); 410 411 free(xml); 319 412 320 413 return 0; … … 368 461 fu16_t cmdlen, cmd, reqid; 369 462 370 if (!(tl = aim_ readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) {371 aim_ freetlvchain(&tl);463 if (!(tl = aim_tlvlist_read(bs)) || !(datatlv = aim_tlv_gettlv(tl, 0x0001, 1))) { 464 aim_tlvlist_free(&tl); 372 465 faimdprintf(sess, 0, "corrupt ICQ response\n"); 373 466 return 0; … … 549 642 } 550 643 551 aim_ freetlvchain(&tl);644 aim_tlvlist_free(&tl); 552 645 553 646 return ret; -
libfaim/im.c
re374dee rcf02dd6 167 167 return -EINVAL; 168 168 169 return aim_genericreq_n (sess, conn, 0x0004, 0x0004);169 return aim_genericreq_n_snacid(sess, conn, 0x0004, 0x0004); 170 170 } 171 171 … … 390 390 aim_tx_enqueue(sess, fr); 391 391 392 /* Move this to receive aim_flap_nop and send aim_flap_nop */ 393 if (!(sess->flags & AIM_SESS_FLAGS_DONTTIMEOUTONICBM)) 394 aim_cleansnacs(sess, 60); /* clean out SNACs over 60sec old */ 392 /* clean out SNACs over 60sec old */ 393 aim_cleansnacs(sess, 60); 395 394 396 395 return 0; … … 633 632 aim_im_puticbm(&fr->data, ck, 0x0002, sn); 634 633 635 aim_ addtlvtochain_noval(&tl, 0x0003);634 aim_tlvlist_add_noval(&tl, 0x0003); 636 635 637 636 hdrlen = 2+8+16+6+8+6+4; … … 643 642 aim_putcap(&hdrbs, AIM_CAPS_DIRECTIM); 644 643 645 aim_ addtlvtochain16(&itl, 0x000a, 0x0001);646 aim_ addtlvtochain_raw(&itl, 0x0003, 4, ip);647 aim_ addtlvtochain16(&itl, 0x0005, port);648 aim_ addtlvtochain_noval(&itl, 0x000f);644 aim_tlvlist_add_16(&itl, 0x000a, 0x0001); 645 aim_tlvlist_add_raw(&itl, 0x0003, 4, ip); 646 aim_tlvlist_add_16(&itl, 0x0005, port); 647 aim_tlvlist_add_noval(&itl, 0x000f); 649 648 650 aim_ writetlvchain(&hdrbs, &itl);651 652 aim_ addtlvtochain_raw(&tl, 0x0005, aim_bstream_curpos(&hdrbs), hdr);653 654 aim_ writetlvchain(&fr->data, &tl);649 aim_tlvlist_write(&hdrbs, &itl); 650 651 aim_tlvlist_add_raw(&tl, 0x0005, aim_bstream_curpos(&hdrbs), hdr); 652 653 aim_tlvlist_write(&fr->data, &tl); 655 654 656 655 free(hdr); 657 aim_ freetlvchain(&itl);658 aim_ freetlvchain(&tl);656 aim_tlvlist_free(&itl); 657 aim_tlvlist_free(&tl); 659 658 660 659 aim_tx_enqueue(sess, fr); … … 688 687 aim_bstream_t bs; 689 688 690 aim_ addtlvtochain16(&subtl, 0x000a, 0x0001);691 aim_ addtlvtochain_noval(&subtl, 0x000f);692 /* aim_ addtlvtochain_raw(&subtl, 0x000e, 2, "en");693 aim_ addtlvtochain_raw(&subtl, 0x000d, 8, "us-ascii");694 aim_ addtlvtochain_raw(&subtl, 0x000c, 24, "Please accept this file."); */689 aim_tlvlist_add_16(&subtl, 0x000a, 0x0001); 690 aim_tlvlist_add_noval(&subtl, 0x000f); 691 /* aim_tlvlist_add_raw(&subtl, 0x000e, 2, "en"); 692 aim_tlvlist_add_raw(&subtl, 0x000d, 8, "us-ascii"); 693 aim_tlvlist_add_raw(&subtl, 0x000c, 24, "Please accept this file."); */ 695 694 if (oft_info->clientip) { 696 695 fu8_t ip[4]; … … 703 702 i++; 704 703 } 705 aim_ addtlvtochain_raw(&subtl, 0x0003, 4, ip);704 aim_tlvlist_add_raw(&subtl, 0x0003, 4, ip); 706 705 } 707 aim_ addtlvtochain16(&subtl, 0x0005, oft_info->port);706 aim_tlvlist_add_16(&subtl, 0x0005, oft_info->port); 708 707 709 708 /* TLV t(2711) */ … … 719 718 aimbs_put8(&bs, 0x00); 720 719 721 aim_ addtlvtochain_raw(&subtl, 0x2711, bs.len, bs.data);720 aim_tlvlist_add_raw(&subtl, 0x2711, bs.len, bs.data); 722 721 free(buf); 723 722 } … … 729 728 730 729 /* TLV t(0005) - Encompasses everything from above. Gee. */ 731 buflen = 2+8+16+aim_ sizetlvchain(&subtl);730 buflen = 2+8+16+aim_tlvlist_size(&subtl); 732 731 buf = malloc(buflen); 733 732 aim_bstream_init(&bs, buf, buflen); … … 735 734 aimbs_putraw(&bs, oft_info->cookie, 8); 736 735 aim_putcap(&bs, AIM_CAPS_SENDFILE); 737 aim_ writetlvchain(&bs, &subtl);738 aim_ freetlvchain(&subtl);739 aim_ addtlvtochain_raw(&tl, 0x0005, bs.len, bs.data);736 aim_tlvlist_write(&bs, &subtl); 737 aim_tlvlist_free(&subtl); 738 aim_tlvlist_add_raw(&tl, 0x0005, bs.len, bs.data); 740 739 free(buf); 741 740 742 741 /* TLV t(0003) - Request an ack */ 743 aim_ addtlvtochain_noval(&tl, 0x0003);744 } 745 746 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 11+strlen(oft_info->sn) + aim_ sizetlvchain(&tl))))742 aim_tlvlist_add_noval(&tl, 0x0003); 743 } 744 745 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 11+strlen(oft_info->sn) + aim_tlvlist_size(&tl)))) 747 746 return -ENOMEM; 748 747 … … 754 753 755 754 /* All that crap from above (the 0x0005 TLV and the 0x0003 TLV) */ 756 aim_ writetlvchain(&fr->data, &tl);757 aim_ freetlvchain(&tl);755 aim_tlvlist_write(&fr->data, &tl); 756 aim_tlvlist_free(&tl); 758 757 759 758 aim_tx_enqueue(sess, fr); … … 1033 1032 sn = aimbs_getstr(bs, snlen); 1034 1033 1035 tlvlist = aim_ readtlvchain(bs);1036 1037 if (aim_ gettlv(tlvlist, 0x0003, 1))1034 tlvlist = aim_tlvlist_read(bs); 1035 1036 if (aim_tlv_gettlv(tlvlist, 0x0003, 1)) 1038 1037 icbmflags |= AIM_IMFLAGS_ACK; 1039 if (aim_ gettlv(tlvlist, 0x0004, 1))1038 if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) 1040 1039 icbmflags |= AIM_IMFLAGS_AWAY; 1041 1040 1042 if ((msgblock = aim_ gettlv(tlvlist, 0x0002, 1))) {1041 if ((msgblock = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { 1043 1042 aim_bstream_t mbs; 1044 1043 int featurelen, msglen; … … 1065 1064 1066 1065 free(sn); 1067 aim_ freetlvchain(&tlvlist);1066 aim_tlvlist_free(&tlvlist); 1068 1067 1069 1068 return ret; … … 1655 1654 * There's another block of TLVs embedded in the type 5 here. 1656 1655 */ 1657 block1 = aim_ gettlv(tlvlist, 0x0005, 1);1656 block1 = aim_tlv_gettlv(tlvlist, 0x0005, 1); 1658 1657 aim_bstream_init(&bbs, block1->value, block1->length); 1659 1658 … … 1678 1677 * identify what type of rendezvous this is. 1679 1678 */ 1680 args.reqclass = aim_ getcap(sess, &bbs, 0x10);1679 args.reqclass = aim_locate_getcaps(sess, &bbs, 0x10); 1681 1680 1682 1681 /* … … 1686 1685 * Ack packets for instance have nothing more to them. 1687 1686 */ 1688 list2 = aim_ readtlvchain(&bbs);1687 list2 = aim_tlvlist_read(&bbs); 1689 1688 1690 1689 /* … … 1693 1692 * XXX - I don't like this. Maybe just read in an int? Or inet_ntoa... 1694 1693 */ 1695 if (aim_ gettlv(list2, 0x0002, 1)) {1694 if (aim_tlv_gettlv(list2, 0x0002, 1)) { 1696 1695 aim_tlv_t *iptlv; 1697 1696 1698 iptlv = aim_ gettlv(list2, 0x0002, 1);1697 iptlv = aim_tlv_gettlv(list2, 0x0002, 1); 1699 1698 if (iptlv->length == 4) 1700 snprintf(proxyip, sizeof(proxyip), "%hh d.%hhd.%hhd.%hhd",1699 snprintf(proxyip, sizeof(proxyip), "%hhu.%hhu.%hhu.%hhu", 1701 1700 iptlv->value[0], iptlv->value[1], 1702 1701 iptlv->value[2], iptlv->value[3]); … … 1706 1705 * IP address from the perspective of the client. 1707 1706 */ 1708 if (aim_ gettlv(list2, 0x0003, 1)) {1707 if (aim_tlv_gettlv(list2, 0x0003, 1)) { 1709 1708 aim_tlv_t *iptlv; 1710 1709 1711 iptlv = aim_ gettlv(list2, 0x0003, 1);1710 iptlv = aim_tlv_gettlv(list2, 0x0003, 1); 1712 1711 if (iptlv->length == 4) 1713 snprintf(clientip, sizeof(clientip), "%hh d.%hhd.%hhd.%hhd",1712 snprintf(clientip, sizeof(clientip), "%hhu.%hhu.%hhu.%hhu", 1714 1713 iptlv->value[0], iptlv->value[1], 1715 1714 iptlv->value[2], iptlv->value[3]); … … 1721 1720 * This is added by the server. 1722 1721 */ 1723 if (aim_ gettlv(list2, 0x0004, 1)) {1722 if (aim_tlv_gettlv(list2, 0x0004, 1)) { 1724 1723 aim_tlv_t *iptlv; 1725 1724 1726 iptlv = aim_ gettlv(list2, 0x0004, 1);1725 iptlv = aim_tlv_gettlv(list2, 0x0004, 1); 1727 1726 if (iptlv->length == 4) 1728 snprintf(verifiedip, sizeof(verifiedip), "%hh d.%hhd.%hhd.%hhd",1727 snprintf(verifiedip, sizeof(verifiedip), "%hhu.%hhu.%hhu.%hhu", 1729 1728 iptlv->value[0], iptlv->value[1], 1730 1729 iptlv->value[2], iptlv->value[3]); … … 1734 1733 * Port number for something. 1735 1734 */ 1736 if (aim_ gettlv(list2, 0x0005, 1))1737 args.port = aim_ gettlv16(list2, 0x0005, 1);1735 if (aim_tlv_gettlv(list2, 0x0005, 1)) 1736 args.port = aim_tlv_get16(list2, 0x0005, 1); 1738 1737 1739 1738 /* … … 1742 1741 * 0x0002 - "I will accept this file from you" 1743 1742 */ 1744 if (aim_ gettlv(list2, 0x000a, 1))1743 if (aim_tlv_gettlv(list2, 0x000a, 1)) 1745 1744 ; 1746 1745 … … 1748 1747 * Error code. 1749 1748 */ 1750 if (aim_ gettlv(list2, 0x000b, 1))1751 args.errorcode = aim_ gettlv16(list2, 0x000b, 1);1749 if (aim_tlv_gettlv(list2, 0x000b, 1)) 1750 args.errorcode = aim_tlv_get16(list2, 0x000b, 1); 1752 1751 1753 1752 /* 1754 1753 * Invitation message / chat description. 1755 1754 */ 1756 if (aim_ gettlv(list2, 0x000c, 1))1757 args.msg = aim_ gettlv_str(list2, 0x000c, 1);1755 if (aim_tlv_gettlv(list2, 0x000c, 1)) 1756 args.msg = aim_tlv_getstr(list2, 0x000c, 1); 1758 1757 1759 1758 /* 1760 1759 * Character set. 1761 1760 */ 1762 if (aim_ gettlv(list2, 0x000d, 1))1763 args.encoding = aim_ gettlv_str(list2, 0x000d, 1);1761 if (aim_tlv_gettlv(list2, 0x000d, 1)) 1762 args.encoding = aim_tlv_getstr(list2, 0x000d, 1); 1764 1763 1765 1764 /* 1766 1765 * Language. 1767 1766 */ 1768 if (aim_ gettlv(list2, 0x000e, 1))1769 args.language = aim_ gettlv_str(list2, 0x000e, 1);1767 if (aim_tlv_gettlv(list2, 0x000e, 1)) 1768 args.language = aim_tlv_getstr(list2, 0x000e, 1); 1770 1769 1771 1770 /* … … 1774 1773 * Maybe means we should connect directly to transfer the file? 1775 1774 */ 1776 if (aim_ gettlv(list2, 0x000f, 1))1775 if (aim_tlv_gettlv(list2, 0x000f, 1)) 1777 1776 ; 1778 1777 … … 1782 1781 * Maybe means we should proxy the file transfer through an AIM server? 1783 1782 */ 1784 if (aim_ gettlv(list2, 0x0010, 1))1783 if (aim_tlv_gettlv(list2, 0x0010, 1)) 1785 1784 ; 1786 1785 … … 1798 1797 * Service Data blocks are module-specific in format. 1799 1798 */ 1800 if ((servdatatlv = aim_ gettlv(list2, 0x2711 /* 10001 */, 1))) {1799 if ((servdatatlv = aim_tlv_gettlv(list2, 0x2711 /* 10001 */, 1))) { 1801 1800 1802 1801 aim_bstream_init(&sdbs, servdatatlv->value, servdatatlv->length); … … 1832 1831 free((char *)args.language); 1833 1832 1834 aim_ freetlvchain(&list2);1833 aim_tlvlist_free(&list2); 1835 1834 1836 1835 return ret; … … 1848 1847 * Make a bstream for the meaty part. Yum. Meat. 1849 1848 */ 1850 if (!(block = aim_ gettlv(tlvlist, 0x0005, 1)))1849 if (!(block = aim_tlv_gettlv(tlvlist, 0x0005, 1))) 1851 1850 return -1; 1852 1851 aim_bstream_init(&meat, block->value, block->length); … … 1947 1946 * further data is derived from what is parsed here. 1948 1947 */ 1949 tlvlist = aim_ readtlvchain(bs);1948 tlvlist = aim_tlvlist_read(bs); 1950 1949 1951 1950 ret = incomingim_ch2(sess, mod, rx, snac, channel, &userinfo, tlvlist, cookie); 1952 1951 1953 aim_ freetlvchain(&tlvlist);1952 aim_tlvlist_free(&tlvlist); 1954 1953 1955 1954 } else if (channel == 4) { 1956 1955 aim_tlvlist_t *tlvlist; 1957 1956 1958 tlvlist = aim_ readtlvchain(bs);1957 tlvlist = aim_tlvlist_read(bs); 1959 1958 ret = incomingim_ch4(sess, mod, rx, snac, channel, &userinfo, tlvlist, cookie); 1960 aim_ freetlvchain(&tlvlist);1959 aim_tlvlist_free(&tlvlist); 1961 1960 1962 1961 } else { … … 2056 2055 aimbs_putraw(&fr->data, sender, strlen(sender)); 2057 2056 2058 aim_ addtlvtochain16(&tl, 0x0003, code);2059 aim_ writetlvchain(&fr->data, &tl);2060 aim_ freetlvchain(&tl);2057 aim_tlvlist_add_16(&tl, 0x0003, code); 2058 aim_tlvlist_write(&fr->data, &tl); 2059 aim_tlvlist_free(&tl); 2061 2060 2062 2061 aim_tx_enqueue(sess, fr); -
libfaim/misc.c
r862371b rcf02dd6 12 12 /* 13 13 * Generic routine for sending commands. 14 *15 14 * 16 15 * I know I can do this in a smarter way...but I'm not thinking straight -
libfaim/odir.c
r07ab1cb rcf02dd6 31 31 32 32 /* Create a TLV chain, write it to the outgoing frame, then free the chain */ 33 aim_ addtlvtochain_raw(&tl, 0x001c, strlen(region), region);34 aim_ addtlvtochain16(&tl, 0x000a, 0x0001); /* Type of search */35 aim_ addtlvtochain_raw(&tl, 0x0005, strlen(email), email);36 37 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_ sizetlvchain(&tl))))33 aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); 34 aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */ 35 aim_tlvlist_add_raw(&tl, 0x0005, strlen(email), email); 36 37 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) 38 38 return -ENOMEM; 39 39 snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); 40 40 aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); 41 41 42 aim_ writetlvchain(&fr->data, &tl);43 aim_ freetlvchain(&tl);42 aim_tlvlist_write(&fr->data, &tl); 43 aim_tlvlist_free(&tl); 44 44 45 45 aim_tx_enqueue(sess, fr); … … 80 80 81 81 /* Create a TLV chain, write it to the outgoing frame, then free the chain */ 82 aim_ addtlvtochain_raw(&tl, 0x001c, strlen(region), region);83 aim_ addtlvtochain16(&tl, 0x000a, 0x0000); /* Type of search */82 aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); 83 aim_tlvlist_add_16(&tl, 0x000a, 0x0000); /* Type of search */ 84 84 if (first) 85 aim_ addtlvtochain_raw(&tl, 0x0001, strlen(first), first);85 aim_tlvlist_add_raw(&tl, 0x0001, strlen(first), first); 86 86 if (last) 87 aim_ addtlvtochain_raw(&tl, 0x0002, strlen(last), last);87 aim_tlvlist_add_raw(&tl, 0x0002, strlen(last), last); 88 88 if (middle) 89 aim_ addtlvtochain_raw(&tl, 0x0003, strlen(middle), middle);89 aim_tlvlist_add_raw(&tl, 0x0003, strlen(middle), middle); 90 90 if (maiden) 91 aim_ addtlvtochain_raw(&tl, 0x0004, strlen(maiden), maiden);91 aim_tlvlist_add_raw(&tl, 0x0004, strlen(maiden), maiden); 92 92 if (country) 93 aim_ addtlvtochain_raw(&tl, 0x0006, strlen(country), country);93 aim_tlvlist_add_raw(&tl, 0x0006, strlen(country), country); 94 94 if (state) 95 aim_ addtlvtochain_raw(&tl, 0x0007, strlen(state), state);95 aim_tlvlist_add_raw(&tl, 0x0007, strlen(state), state); 96 96 if (city) 97 aim_ addtlvtochain_raw(&tl, 0x0008, strlen(city), city);97 aim_tlvlist_add_raw(&tl, 0x0008, strlen(city), city); 98 98 if (nick) 99 aim_ addtlvtochain_raw(&tl, 0x000c, strlen(nick), nick);99 aim_tlvlist_add_raw(&tl, 0x000c, strlen(nick), nick); 100 100 if (zip) 101 aim_ addtlvtochain_raw(&tl, 0x000d, strlen(zip), zip);101 aim_tlvlist_add_raw(&tl, 0x000d, strlen(zip), zip); 102 102 if (address) 103 aim_ addtlvtochain_raw(&tl, 0x0021, strlen(address), address);104 105 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_ sizetlvchain(&tl))))103 aim_tlvlist_add_raw(&tl, 0x0021, strlen(address), address); 104 105 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) 106 106 return -ENOMEM; 107 107 snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); 108 108 aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); 109 109 110 aim_ writetlvchain(&fr->data, &tl);111 aim_ freetlvchain(&tl);110 aim_tlvlist_write(&fr->data, &tl); 111 aim_tlvlist_free(&tl); 112 112 113 113 aim_tx_enqueue(sess, fr); … … 135 135 136 136 /* Create a TLV chain, write it to the outgoing frame, then free the chain */ 137 aim_ addtlvtochain_raw(&tl, 0x001c, strlen(region), region);138 aim_ addtlvtochain16(&tl, 0x000a, 0x0001); /* Type of search */137 aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); 138 aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */ 139 139 if (interest) 140 aim_ addtlvtochain_raw(&tl, 0x0001, strlen(interest), interest);141 142 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_ sizetlvchain(&tl))))140 aim_tlvlist_add_raw(&tl, 0x0001, strlen(interest), interest); 141 142 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) 143 143 return -ENOMEM; 144 144 snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); 145 145 aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); 146 146 147 aim_ writetlvchain(&fr->data, &tl);148 aim_ freetlvchain(&tl);147 aim_tlvlist_write(&fr->data, &tl); 148 aim_tlvlist_free(&tl); 149 149 150 150 aim_tx_enqueue(sess, fr); … … 174 174 while (numresults) { 175 175 struct aim_odir *new; 176 aim_tlvlist_t *tl = aim_ readtlvchain_num(bs, aimbs_get16(bs));176 aim_tlvlist_t *tl = aim_tlvlist_readnum(bs, aimbs_get16(bs)); 177 177 new = (struct aim_odir *)malloc(sizeof(struct aim_odir)); 178 new->first = aim_ gettlv_str(tl, 0x0001, 1);179 new->last = aim_ gettlv_str(tl, 0x0002, 1);180 new->middle = aim_ gettlv_str(tl, 0x0003, 1);181 new->maiden = aim_ gettlv_str(tl, 0x0004, 1);182 new->email = aim_ gettlv_str(tl, 0x0005, 1);183 new->country = aim_ gettlv_str(tl, 0x0006, 1);184 new->state = aim_ gettlv_str(tl, 0x0007, 1);185 new->city = aim_ gettlv_str(tl, 0x0008, 1);186 new->sn = aim_ gettlv_str(tl, 0x0009, 1);187 new->interest = aim_ gettlv_str(tl, 0x000b, 1);188 new->nick = aim_ gettlv_str(tl, 0x000c, 1);189 new->zip = aim_ gettlv_str(tl, 0x000d, 1);190 new->region = aim_ gettlv_str(tl, 0x001c, 1);191 new->address = aim_ gettlv_str(tl, 0x0021, 1);178 new->first = aim_tlv_getstr(tl, 0x0001, 1); 179 new->last = aim_tlv_getstr(tl, 0x0002, 1); 180 new->middle = aim_tlv_getstr(tl, 0x0003, 1); 181 new->maiden = aim_tlv_getstr(tl, 0x0004, 1); 182 new->email = aim_tlv_getstr(tl, 0x0005, 1); 183 new->country = aim_tlv_getstr(tl, 0x0006, 1); 184 new->state = aim_tlv_getstr(tl, 0x0007, 1); 185 new->city = aim_tlv_getstr(tl, 0x0008, 1); 186 new->sn = aim_tlv_getstr(tl, 0x0009, 1); 187 new->interest = aim_tlv_getstr(tl, 0x000b, 1); 188 new->nick = aim_tlv_getstr(tl, 0x000c, 1); 189 new->zip = aim_tlv_getstr(tl, 0x000d, 1); 190 new->region = aim_tlv_getstr(tl, 0x001c, 1); 191 new->address = aim_tlv_getstr(tl, 0x0021, 1); 192 192 new->next = results; 193 193 results = new; -
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 &n