Changeset 7869e48 for libfaim/locate.c
- Timestamp:
- Jan 12, 2013, 1:43:13 PM (11 years ago)
- Children:
- e3a0d71, 4485285
- Parents:
- 4626016
- git-author:
- Jason Gross <jgross@mit.edu> (01/12/13 13:13:18)
- git-committer:
- Jason Gross <jgross@mit.edu> (01/12/13 13:43:13)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfaim/locate.c
r6e3980e r7869e48 3 3 * 4 4 * The functions here are responsible for requesting and parsing information- 5 * gathering SNACs. Or something like that. This family contains the SNACs 5 * gathering SNACs. Or something like that. This family contains the SNACs 6 6 * for getting and setting info, away messages, directory profile thingy, etc. 7 7 */ … … 14 14 15 15 /* 16 * Capability blocks. 16 * Capability blocks. 17 17 * 18 18 * These are CLSIDs. They should actually be of the form: … … 36 36 */ 37 37 {AIM_CAPS_ICHAT, 38 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 38 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 39 39 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 40 40 41 41 {AIM_CAPS_SECUREIM, 42 {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1, 42 {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1, 43 43 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 44 44 45 45 {AIM_CAPS_VIDEO, 46 {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 47 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 48 49 /* 50 * Not really sure about this one. In an email from 51 * 26 Sep 2003, Matthew Sachs suggested that, "this 46 {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 47 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 48 49 /* 50 * Not really sure about this one. In an email from 51 * 26 Sep 2003, Matthew Sachs suggested that, "this 52 52 * is probably the capability for the SMS features." 53 53 */ 54 54 {AIM_CAPS_SMS, 55 {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1, 55 {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1, 56 56 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 57 57 58 58 {AIM_CAPS_GENERICUNKNOWN, 59 {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1, 59 {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1, 60 60 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 61 61 62 62 {AIM_CAPS_GENERICUNKNOWN, 63 {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1, 63 {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1, 64 64 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 65 65 66 66 {AIM_CAPS_GENERICUNKNOWN, 67 {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1, 67 {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1, 68 68 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 69 69 70 70 {AIM_CAPS_HIPTOP, 71 {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1, 71 {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1, 72 72 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 73 73 74 74 {AIM_CAPS_VOICE, 75 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 75 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 76 76 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 77 77 78 78 {AIM_CAPS_SENDFILE, 79 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 79 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 80 80 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 81 81 82 82 {AIM_CAPS_ICQ_DIRECT, 83 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, 83 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, 84 84 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 85 85 86 86 {AIM_CAPS_DIRECTIM, 87 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, 87 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, 88 88 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 89 89 90 90 {AIM_CAPS_BUDDYICON, 91 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 91 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 92 92 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 93 93 … … 108 108 109 109 /* 110 * Indeed, there are two of these. The former appears to be correct, 111 * but in some versions of winaim, the second one is set. Either they 112 * forgot to fix endianness, or they made a typo. It really doesn't 110 * Indeed, there are two of these. The former appears to be correct, 111 * but in some versions of winaim, the second one is set. Either they 112 * forgot to fix endianness, or they made a typo. It really doesn't 113 113 * matter which. 114 114 */ … … 125 125 126 126 /* 127 * Setting this lets AIM users receive messages from ICQ users, and ICQ 128 * users receive messages from AIM users. It also lets ICQ users show 129 * up in buddy lists for AIM users, and AIM users show up in buddy lists 130 * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy, 131 * in that if you add a user to your deny list, you will not be able to 132 * see them as online (previous you could still see them, but they 127 * Setting this lets AIM users receive messages from ICQ users, and ICQ 128 * users receive messages from AIM users. It also lets ICQ users show 129 * up in buddy lists for AIM users, and AIM users show up in buddy lists 130 * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy, 131 * in that if you add a user to your deny list, you will not be able to 132 * see them as online (previous you could still see them, but they 133 133 * couldn't see you. 134 134 */ … … 149 149 */ 150 150 {AIM_CAPS_CHAT, 151 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 151 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 152 152 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 153 153 … … 164 164 /* This is added by the servers and it only shows up for ourselves... */ 165 165 {AIM_CAPS_GENERICUNKNOWN, 166 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 166 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 167 167 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, 168 168 169 {AIM_CAPS_APINFO, 169 {AIM_CAPS_APINFO, 170 170 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, 171 171 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, … … 183 183 184 184 /* 185 * Add the userinfo to our linked list. If we already have userinfo 185 * Add the userinfo to our linked list. If we already have userinfo 186 186 * for this buddy, then just overwrite parts of the old data. 187 187 * @param userinfo Contains the new information for the buddy. … … 260 260 261 261 /** 262 * Remove this screen name from our queue. If this info was resquested 262 * Remove this screen name from our queue. If this info was resquested 263 263 * by our info request queue, then pop the next element off of the queue. 264 264 * 265 265 * @param sess The aim session. 266 266 * @param sn Screen name of the info we just received. 267 * @return True if the request was explicit (client requested the info), 267 * @return True if the request was explicit (client requested the info), 268 268 * false if the request was implicit (libfaim request the info). 269 269 */ … … 450 450 451 451 /* 452 * AIM is fairly regular about providing user info. This is a generic 452 * AIM is fairly regular about providing user info. This is a generic 453 453 * routine to extract it in its standard form. 454 454 */ … … 465 465 466 466 /* 467 * Screen name. Stored as an unterminated string prepended with a 467 * Screen name. Stored as an unterminated string prepended with a 468 468 * byte containing its length. 469 469 */ … … 477 477 478 478 /* 479 * TLV Count. Unsigned short representing the number of 479 * TLV Count. Unsigned short representing the number of 480 480 * Type-Length-Value triples that follow. 481 481 */ 482 482 tlvcnt = aimbs_get16(bs); 483 483 484 /* 484 /* 485 485 * Parse out the Type-Length-Value triples as they're found. 486 486 */ … … 497 497 /* 498 498 * Type = 0x0001: User flags 499 * 499 * 500 500 * Specified as any of the following ORed together: 501 501 * 0x0001 Trial (user less than 60days) … … 503 503 * 0x0004 AOL Main Service user 504 504 * 0x0008 Unknown bit 4 505 * 0x0010 Free (AIM) user 505 * 0x0010 Free (AIM) user 506 506 * 0x0020 Away 507 507 * 0x0400 ActiveBuddy … … 513 513 } else if (type == 0x0002) { 514 514 /* 515 * Type = 0x0002: Account creation time. 515 * Type = 0x0002: Account creation time. 516 516 * 517 517 * The time/date that the user originally registered for … … 532 532 * Type = 0x0003: On-Since date. 533 533 * 534 * The time/date that the user started their current 534 * The time/date that the user started their current 535 535 * session, stored in time_t format. 536 536 */ … … 542 542 * Type = 0x0004: Idle time. 543 543 * 544 * Number of minutes since the user actively used the 544 * Number of minutes since the user actively used the 545 545 * service. 546 546 * 547 547 * Note that the client tells the server when to start 548 * counting idle times, so this may or may not be 548 * counting idle times, so this may or may not be 549 549 * related to reality. 550 550 */ … … 554 554 } else if (type == 0x0005) { 555 555 /* 556 * Type = 0x0005: Member since date. 556 * Type = 0x0005: Member since date. 557 557 * 558 558 * The time/date that the user originally registered for … … 570 570 * Type = 0x0006: ICQ Online Status 571 571 * 572 * ICQ's Away/DND/etc "enriched" status. Some decoding 572 * ICQ's Away/DND/etc "enriched" status. Some decoding 573 573 * of values done by Scott <darkagl@pcnet.com> 574 574 */ … … 595 595 596 596 } else if (type == 0x000c) { 597 /* 597 /* 598 598 * Type = 0x000c 599 599 * … … 603 603 * Format is: 604 604 * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43 605 * 605 * 606 606 * 607 607 */ … … 632 632 * Type = 0x0010: Session Length. (AOL) 633 633 * 634 * The duration, in seconds, of the user's current 634 * The duration, in seconds, of the user's current 635 635 * session. 636 636 * … … 646 646 * Type = 0x0019 647 647 * 648 * OSCAR short capability information. A shortened 648 * OSCAR short capability information. A shortened 649 649 * form of the normal capabilities. 650 650 */ … … 656 656 * Type = 0x001a 657 657 * 658 * AOL short capability information. A shortened 658 * AOL short capability information. A shortened 659 659 * form of the normal capabilities. 660 660 */ … … 673 673 * Buddy icon information and available messages. 674 674 * 675 * This almost seems like the AIM protocol guys gave 676 * the iChat guys a Type, and the iChat guys tried to 677 * cram as much cool shit into it as possible. Then 678 * the Windows AIM guys were like, "hey, that's 675 * This almost seems like the AIM protocol guys gave 676 * the iChat guys a Type, and the iChat guys tried to 677 * cram as much cool shit into it as possible. Then 678 * the Windows AIM guys were like, "hey, that's 679 679 * pretty neat, let's copy those prawns." 680 680 * 681 * In that spirit, this can contain a custom message, 682 * kind of like an away message, but you're not away 683 * (it's called an "available" message). Or it can 684 * contain information about the buddy icon the user 681 * In that spirit, this can contain a custom message, 682 * kind of like an away message, but you're not away 683 * (it's called an "available" message). Or it can 684 * contain information about the buddy icon the user 685 685 * has stored on the server. 686 686 */ … … 748 748 /* 749 749 * Reaching here indicates that either AOL has 750 * added yet another TLV for us to deal with, 750 * added yet another TLV for us to deal with, 751 751 * or the parsing has gone Terribly Wrong. 752 752 * … … 805 805 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) 806 806 aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities); 807 807 808 808 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) 809 809 aim_tlvlist_add_32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); … … 846 846 847 847 /* 848 * Remove this screen name from our queue. If the client requested 849 * this buddy's info explicitly, then notify them that we do not have 848 * Remove this screen name from our queue. If the client requested 849 * this buddy's info explicitly, then notify them that we do not have 850 850 * info for this buddy. 851 851 */ … … 915 915 * away are set, respectively, and their value may or may not be 916 916 * restricted to a few choices. I am currently aware of: 917 * 917 * 918 918 * us-ascii Just that 919 919 * unicode-2-0 UCS2-BE 920 * 920 * 921 921 * profile_len and awaymsg_len MUST be set similarly, and they MUST 922 922 * be the length of their respective strings in bytes. … … 925 925 * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the 926 926 * obvious equivalent). 927 * 927 * 928 928 */ 929 929 faim_export int aim_locate_setprofile(aim_session_t *sess, … … 1048 1048 1049 1049 snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, NULL, 0); 1050 1050 1051 1051 aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid); 1052 1052 aimbs_put16(&fr->data, infotype); … … 1104 1104 1105 1105 /* 1106 * Remove this screen name from our queue. If the client requested 1107 * this buddy's info explicitly, then notify them that we have info 1106 * Remove this screen name from our queue. If the client requested 1107 * this buddy's info explicitly, then notify them that we have info 1108 1108 * for this buddy. 1109 1109 */ … … 1116 1116 } 1117 1117 1118 /* 1118 /* 1119 1119 * Subtype 0x0009 - Set directory profile data. 1120 1120 * … … 1123 1123 * 1124 1124 */ 1125 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) 1125 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) 1126 1126 { 1127 1127 aim_conn_t *conn; … … 1189 1189 1190 1190 snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0); 1191 1191 1192 1192 aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid); 1193 1193 aimbs_put8(&fr->data, strlen(sn)); … … 1201 1201 /* 1202 1202 * Subtype 0x000f 1203 * 1203 * 1204 1204 * XXX pass these in better 1205 1205 * … … 1244 1244 1245 1245 /* 1246 * Subtype 0x0015 - Request the info a user using the short method. This is 1246 * Subtype 0x0015 - Request the info a user using the short method. This is 1247 1247 * what iChat uses. It normally is VERY leniently rate limited. 1248 1248 *
Note: See TracChangeset
for help on using the changeset viewer.