Changeset e374dee for libfaim/service.c
- Timestamp:
- Oct 10, 2003, 5:12:30 PM (22 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:
- fe6f1d3
- Parents:
- f4d0975
- File:
-
- 1 edited
-
libfaim/service.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libfaim/service.c
r862371b re374dee 120 120 redir.group = aim_gettlv16(tlvlist, 0x000d, 1); 121 121 redir.ip = aim_gettlv_str(tlvlist, 0x0005, 1); 122 redir.cookielen = aim_gettlv(tlvlist, 0x0006, 1)->length; 122 123 redir.cookie = aim_gettlv_str(tlvlist, 0x0006, 1); 123 124 … … 392 393 static int ratechange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 393 394 { 395 int ret = 0; 394 396 aim_rxcallback_t userfunc; 395 397 fu16_t code, rateclass; … … 408 410 409 411 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 410 ret urnuserfunc(sess, rx, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg);411 412 return 0;412 ret = userfunc(sess, rx, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg); 413 414 return ret; 413 415 } 414 416 … … 429 431 static int serverpause(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 430 432 { 433 int ret = 0; 431 434 aim_rxcallback_t userfunc; 432 435 433 436 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 434 ret urnuserfunc(sess, rx);435 436 return 0;437 ret = userfunc(sess, rx); 438 439 return ret; 437 440 } 438 441 … … 477 480 static int serverresume(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 478 481 { 482 int ret = 0; 479 483 aim_rxcallback_t userfunc; 480 484 481 485 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 482 ret urnuserfunc(sess, rx);483 484 return 0;486 ret = userfunc(sess, rx); 487 488 return ret; 485 489 } 486 490 … … 494 498 static int selfinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 495 499 { 500 int ret = 0; 496 501 aim_rxcallback_t userfunc; 497 502 aim_userinfo_t userinfo; 498 503 499 aim_ extractuserinfo(sess, bs, &userinfo);504 aim_info_extract(sess, bs, &userinfo); 500 505 501 506 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 502 return userfunc(sess, rx, &userinfo); 503 504 return 0; 507 ret = userfunc(sess, rx, &userinfo); 508 509 aim_info_free(&userinfo); 510 511 return ret; 505 512 } 506 513 … … 508 515 static int evilnotify(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 509 516 { 517 int ret = 0; 510 518 aim_rxcallback_t userfunc; 511 519 fu16_t newevil; … … 517 525 518 526 if (aim_bstream_empty(bs)) 519 aim_ extractuserinfo(sess, bs, &userinfo);527 aim_info_extract(sess, bs, &userinfo); 520 528 521 529 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 522 return userfunc(sess, rx, newevil, &userinfo); 523 524 return 0; 530 ret = userfunc(sess, rx, newevil, &userinfo); 531 532 aim_info_free(&userinfo); 533 534 return ret; 525 535 } 526 536 … … 725 735 726 736 /* 727 * Subtype 0x001e - Set Extended Status 728 * 729 * Currently only works if using ICQ. 730 * 731 */ 732 faim_export int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, fu32_t status) 733 { 737 * Subtype 0x001e - Extended Status 738 * 739 * Sets your ICQ status (available, away, do not disturb, etc.) 740 * 741 * These are the same TLVs seen in user info. You can 742 * also set 0x0008 and 0x000c. 743 */ 744 faim_export int aim_setextstatus(aim_session_t *sess, fu32_t status) 745 { 746 aim_conn_t *conn; 734 747 aim_frame_t *fr; 735 748 aim_snacid_t snacid; … … 737 750 fu32_t data; 738 751 739 data = 0x00030000 | status; /* yay for error checking ;^) */ 752 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) 753 return -EINVAL; 754 755 data = AIM_ICQ_STATE_HIDEIP | AIM_ICQ_STATE_WEBAWARE | status; /* yay for error checking ;^) */ 740 756 741 757 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8))) … … 749 765 aim_freetlvchain(&tl); 750 766 767 aim_tx_enqueue(sess, fr); 768 769 return 0; 770 } 771 772 /* 773 * Subtype 0x001e - Extended Status. 774 * 775 * Sets your "available" message. This is currently only supported by iChat 776 * and Gaim. 777 * 778 * These are the same TLVs seen in user info. You can 779 * also set 0x0008 and 0x000c. 780 */ 781 faim_export int aim_srv_setavailmsg(aim_session_t *sess, char *msg) 782 { 783 aim_conn_t *conn; 784 aim_frame_t *fr; 785 aim_snacid_t snacid; 786 787 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0001))) 788 return -EINVAL; 789 790 if (msg) { 791 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(msg) + 8))) 792 return -ENOMEM; 793 794 snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0); 795 aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid); 796 797 aimbs_put16(&fr->data, 0x001d); 798 aimbs_put16(&fr->data, strlen(msg)+8); 799 aimbs_put16(&fr->data, 0x0002); 800 aimbs_put8(&fr->data, 0x04); 801 aimbs_put8(&fr->data, strlen(msg)+4); 802 aimbs_put16(&fr->data, strlen(msg)); 803 aimbs_putraw(&fr->data, msg, strlen(msg)); 804 aimbs_put16(&fr->data, 0x0000); 805 } else { 806 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + 8))) 807 return -ENOMEM; 808 809 snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0); 810 aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid); 811 812 aimbs_put16(&fr->data, 0x001d); 813 aimbs_put16(&fr->data, 0x0008); 814 aimbs_put16(&fr->data, 0x0002); 815 aimbs_put16(&fr->data, 0x0404); 816 aimbs_put16(&fr->data, 0x0000); 817 aimbs_put16(&fr->data, 0x0000); 818 } 819 751 820 aim_tx_enqueue(sess, fr); 752 821 … … 794 863 static int memrequest(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 795 864 { 865 int ret = 0; 796 866 aim_rxcallback_t userfunc; 797 867 fu32_t offset, len; … … 808 878 809 879 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) 810 ret urnuserfunc(sess, rx, offset, len, modname);880 ret = userfunc(sess, rx, offset, len, modname); 811 881 812 882 free(modname); 813 883 aim_freetlvchain(&list); 814 884 815 return 0;885 return ret; 816 886 } 817 887 … … 924 994 925 995 return 0; 996 } 997 998 /* 999 * Subtype 0x0021 - Receive our extended status 1000 * 1001 * This is used for iChat's "available" messages, and maybe ICQ extended 1002 * status messages? It's also used to tell the client whether or not it 1003 * needs to upload an SSI buddy icon... who engineers this stuff, anyway? 1004 */ 1005 static int aim_parse_extstatus(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 1006 { 1007 int ret = 0; 1008 aim_rxcallback_t userfunc; 1009 fu16_t type; 1010 fu8_t flags, length; 1011 1012 type = aimbs_get16(bs); 1013 flags = aimbs_get8(bs); 1014 length = aimbs_get8(bs); 1015 1016 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { 1017 switch (type) { 1018 case 0x0000: 1019 case 0x0001: { /* buddy icon checksum */ 1020 /* not sure what the difference between 1 and 0 is */ 1021 fu8_t *md5 = aimbs_getraw(bs, length); 1022 ret = userfunc(sess, rx, type, flags, length, md5); 1023 free(md5); 1024 } break; 1025 case 0x0002: { /* available message */ 1026 /* there is a second length that is just for the message */ 1027 char *msg = aimbs_getstr(bs, aimbs_get16(bs)); 1028 ret = userfunc(sess, rx, msg); 1029 free(msg); 1030 } break; 1031 } 1032 } 1033 1034 return ret; 926 1035 } 927 1036 … … 953 1062 else if (snac->subtype == 0x001f) 954 1063 return memrequest(sess, mod, rx, snac, bs); 1064 else if (snac->subtype == 0x0021) 1065 return aim_parse_extstatus(sess, mod, rx, snac, bs); 955 1066 956 1067 return 0; … … 963 1074 mod->version = 0x0003; 964 1075 mod->toolid = 0x0110; 965 mod->toolversion = 0x0 47b;1076 mod->toolversion = 0x0629; 966 1077 mod->flags = 0; 967 1078 strncpy(mod->name, "general", sizeof(mod->name));
Note: See TracChangeset
for help on using the changeset viewer.
