annotate src/protocols/oscar/locate.c @ 7025:db041f206848

[gaim-migrate @ 7588] Recognize some more caps to make faceprint happy. Luke, I can't reproduce your thing committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 29 Sep 2003 21:20:20 +0000
parents 4375bf2d9020
children 237ad253dd34
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * Family 0x0002 - Locate.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * The functions here are responsible for requesting and parsing information-
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 * gathering SNACs. Or something like that. This family contains the SNACs
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * for getting and setting info, away messages, directory profile thingy, etc.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 #define FAIM_INTERNAL
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 #include <aim.h>
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 #ifdef _WIN32
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 #include "win32dep.h"
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 #endif
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 struct node {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 char *sn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 struct node *next;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 };
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 /**
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 * Keep an aim_userinfo_t for each user we are aware of.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 static aim_userinfo_t *infos = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 static struct node *request_queue = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 static int waiting_for_response = FALSE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 * Capability blocks.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 * These are CLSIDs. They should actually be of the form:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 * {0x0946134b, 0x4c7f, 0x11d1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 * But, eh.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 static const struct {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 fu32_t flag;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 fu8_t data[16];
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 } aim_caps[] = {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43 * These are in ascending numerical order.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45 {AIM_CAPS_ICHAT,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
48
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49 {AIM_CAPS_SECUREIM,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
50 {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
51 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
52
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
53 /*
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
54 * Not really sure about this one. In an email from
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
55 * 26 Sep 2003, Matthew Sachs suggested that, "this
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
56 * is probably the capability for the SMS features."
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
57 */
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
58 {AIM_CAPS_SMS,
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
59 {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1,
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
60 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
61
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
62 {AIM_CAPS_APPLESOMETHIN1,
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
63 {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1,
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
64 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
65
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
66 {AIM_CAPS_APPLESOMETHIN2,
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
67 {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1,
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
68 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
69
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
70 {AIM_CAPS_APPLESOMETHIN3,
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
71 {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1,
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
72 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
73
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
74 {AIM_CAPS_HIPTOP,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
75 {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
78 {AIM_CAPS_VOICE,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82 {AIM_CAPS_SENDFILE,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
83 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
84 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
85
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
86 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87 * Advertised by the EveryBuddy client.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
89 {AIM_CAPS_ICQ,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
91 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
92
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93 {AIM_CAPS_DIRECTIM,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
94 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
95 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
96
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
97 {AIM_CAPS_BUDDYICON,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
99 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
102 * Windows AIM calls this "Add-ins," which is probably more accurate
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
103 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
104 {AIM_CAPS_SAVESTOCKS,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 {AIM_CAPS_GETFILE,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
110 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
111
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
112 {AIM_CAPS_ICQSERVERRELAY,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
113 {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
114 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
115
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
116 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
117 * Indeed, there are two of these. The former appears to be correct,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
118 * but in some versions of winaim, the second one is set. Either they
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
119 * forgot to fix endianness, or they made a typo. It really doesn't
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
120 * matter which.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
121 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
122 {AIM_CAPS_GAMES,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
123 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
124 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
125 {AIM_CAPS_GAMES2,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
126 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
127 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
128
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
129 {AIM_CAPS_SENDBUDDYLIST,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
130 {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
131 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
132
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
133 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
134 * Setting this lets AIM users receive messages from ICQ users, and ICQ
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
135 * users receive messages from AIM users. It also lets ICQ users show
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
136 * up in buddy lists for AIM users, and AIM users show up in buddy lists
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
137 * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
138 * in that if you add a user to your deny list, you will not be able to
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
139 * see them as online (previous you could still see them, but they
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
140 * couldn't see you.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
141 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
142 {AIM_CAPS_INTEROPERATE,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
144 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
145
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
146 {AIM_CAPS_ICQUTF8,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
147 {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
148 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
149
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
150 {AIM_CAPS_ICQUTF8OLD,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
154 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155 * Chat is oddball.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157 {AIM_CAPS_CHAT,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
158 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
159 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
161 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162 {AIM_CAPS_ICQ2GO,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
163 {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
164 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
165 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
166
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 {AIM_CAPS_ICQRTF,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
168 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
170
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171 /* supposed to be ICQRTF?
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 {AIM_CAPS_TRILLUNKNOWN,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
173 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
174 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
176 {AIM_CAPS_APINFO,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
179
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180 {AIM_CAPS_TRILLIANCRYPT,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
181 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
182 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
183
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
184 {AIM_CAPS_EMPTY,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
185 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
187
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
188 {AIM_CAPS_LAST}
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
189 };
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
190
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
192 * Add the userinfo to our linked list. If we already have userinfo
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
193 * for this buddy, then just overwrite parts of the old data.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
194 * @param userinfo Contains the new information for the buddy.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
195 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196 static void aim_locate_adduserinfo(aim_userinfo_t *userinfo) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197 aim_userinfo_t *cur;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
198
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
199 cur = aim_locate_finduserinfo(userinfo->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
200
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 if (cur == NULL) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202 cur = (aim_userinfo_t *)calloc(1, sizeof(aim_userinfo_t));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
203 cur->sn = strdup(userinfo->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
204 cur->next = infos;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205 infos = cur;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
206 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208 cur->warnlevel = userinfo->warnlevel;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
209 cur->idletime = userinfo->idletime;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 if (userinfo->flags != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
211 cur->flags = userinfo->flags;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
212 if (userinfo->createtime != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
213 cur->createtime = userinfo->createtime;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
214 if (userinfo->membersince != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215 cur->membersince = userinfo->membersince;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216 if (userinfo->onlinesince != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
217 cur->onlinesince = userinfo->onlinesince;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
218 if (userinfo->sessionlen != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
219 cur->sessionlen = userinfo->sessionlen;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
220 if (userinfo->capabilities != 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
221 cur->capabilities = userinfo->capabilities;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
222 cur->present |= userinfo->present;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
223
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
224 if ((userinfo->away != NULL) && (userinfo->away_len > 0)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
225 free(cur->away);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
226 free(cur->away_encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
227 cur->away = (char *)malloc(userinfo->away_len);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
228 memcpy(cur->away, userinfo->away, userinfo->away_len);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
229 cur->away_encoding = strdup(userinfo->away_encoding); /* XXX - This seems to leak occasionally */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
230 cur->away_len = userinfo->away_len;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
231 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
232
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
233 if ((userinfo->info != NULL) && (userinfo->info_len > 0)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
234 free(cur->info);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
235 free(cur->info_encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
236 cur->info = (char *)malloc(userinfo->info_len);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
237 memcpy(cur->info, userinfo->info, userinfo->info_len);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
238 cur->info_encoding = strdup(userinfo->info_encoding); /* XXX - This seems to leak occasionally */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
239 cur->info_len = userinfo->info_len;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
240 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
241 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
242
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
243 static void aim_locate_dorequest(aim_session_t *sess) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
244 struct node *cur = request_queue;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
245
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
246 if (cur == NULL)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
247 return;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
248
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
249 if (waiting_for_response == TRUE)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
250 return;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
251
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
252 waiting_for_response = TRUE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
253 aim_locate_getinfoshort(sess, cur->sn, 0x00000007);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
254 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
255
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
256 faim_internal void aim_locate_requestuserinfo(aim_session_t *sess, const char *sn) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
257 struct node *cur;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
258
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
259 cur = (struct node *)malloc(sizeof(struct node));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
260 cur->sn = strdup(sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
261 cur->next = request_queue;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
262 request_queue = cur;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
263
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
264 aim_locate_dorequest(sess);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
265 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
266
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
267 faim_export aim_userinfo_t *aim_locate_finduserinfo(const char *sn) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
268 aim_userinfo_t *cur = infos;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
269
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
270 while (cur != NULL) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
271 if (aim_sncmp(cur->sn, sn) == 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
272 return cur;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
273 cur = cur->next;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
274 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
275
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
276 return NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
277 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
278
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
279 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
280 * This still takes a length parameter even with a bstream because capabilities
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
281 * are not naturally bounded.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
282 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
283 faim_internal fu32_t aim_getcap(aim_session_t *sess, aim_bstream_t *bs, int len)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
284 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
285 fu32_t flags = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
286 int offset;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
287
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
288 for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x10) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
289 fu8_t *cap;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
290 int i, identified;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
291
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
292 cap = aimbs_getraw(bs, 0x10);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
293
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
294 for (i = 0, identified = 0; !(aim_caps[i].flag & AIM_CAPS_LAST); i++) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
295
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
296 if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
297 flags |= aim_caps[i].flag;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
298 identified++;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
299 break; /* should only match once... */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
300
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
301 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
302 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
303
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
304 if (!identified) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
305 faimdprintf(sess, 0, "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
306 cap[0], cap[1], cap[2], cap[3],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
307 cap[4], cap[5],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
308 cap[6], cap[7],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
309 cap[8], cap[9],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
310 cap[10], cap[11], cap[12], cap[13],
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
311 cap[14], cap[15]);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
312 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
313
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
314 free(cap);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
315 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
316
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
317 return flags;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
318 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
319
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
320 faim_internal int aim_putcap(aim_bstream_t *bs, fu32_t caps)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
321 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
322 int i;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
323
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
324 if (!bs)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
325 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
326
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
327 for (i = 0; aim_bstream_empty(bs); i++) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
328
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
329 if (aim_caps[i].flag == AIM_CAPS_LAST)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
330 break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
331
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
332 if (caps & aim_caps[i].flag)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
333 aimbs_putraw(bs, aim_caps[i].data, 0x10);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
334
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
335 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
336
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
337 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
338 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
339
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
340 static void dumptlv(aim_session_t *sess, fu16_t type, aim_bstream_t *bs, fu8_t len)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
341 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
342 int i;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
343
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
344 if (!sess || !bs || !len)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
345 return;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
346
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
347 faimdprintf(sess, 0, "userinfo: type =0x%04x\n", type);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
348 faimdprintf(sess, 0, "userinfo: length=0x%04x\n", len);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
349 faimdprintf(sess, 0, "userinfo: value:\n");
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
350
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
351 for (i = 0; i < len; i++) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
352 if ((i % 8) == 0)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
353 faimdprintf(sess, 0, "\nuserinfo: ");
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
354 faimdprintf(sess, 0, "0x%2x ", aimbs_get8(bs));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
355 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
356
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
357 faimdprintf(sess, 0, "\n");
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
358
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
359 return;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
360 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
361
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
362 faim_internal void aim_info_free(aim_userinfo_t *info)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
363 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
364 free(info->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
365 free(info->iconcsum);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
366 free(info->info);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
367 free(info->info_encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
368 free(info->avail);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
369 free(info->avail_encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
370 free(info->away);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
371 free(info->away_encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
372 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
373
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
374 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
375 * AIM is fairly regular about providing user info. This is a generic
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
376 * routine to extract it in its standard form.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
377 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
378 faim_internal int aim_info_extract(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *outinfo)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
379 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
380 int curtlv, tlvcnt;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
381 fu8_t snlen;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
382
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
383 if (!bs || !outinfo)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
384 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
385
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
386 /* Clear out old data first */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
387 memset(outinfo, 0x00, sizeof(aim_userinfo_t));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
388
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
389 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
390 * Screen name. Stored as an unterminated string prepended with a
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
391 * byte containing its length.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
392 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
393 snlen = aimbs_get8(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
394 outinfo->sn = aimbs_getstr(bs, snlen);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
395
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
396 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
397 * Warning Level. Stored as an unsigned short.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
398 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
399 outinfo->warnlevel = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
400
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
401 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
402 * TLV Count. Unsigned short representing the number of
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
403 * Type-Length-Value triples that follow.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
404 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
405 tlvcnt = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
406
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
407 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
408 * Parse out the Type-Length-Value triples as they're found.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
409 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
410 for (curtlv = 0; curtlv < tlvcnt; curtlv++) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
411 int endpos;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
412 fu16_t type, length;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
413
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
414 type = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
415 length = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
416
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
417 endpos = aim_bstream_curpos(bs) + length;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
418
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
419 if (type == 0x0001) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
420 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
421 * Type = 0x0001: User flags
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
422 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
423 * Specified as any of the following ORed together:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
424 * 0x0001 Trial (user less than 60days)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
425 * 0x0002 Unknown bit 2
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
426 * 0x0004 AOL Main Service user
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
427 * 0x0008 Unknown bit 4
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
428 * 0x0010 Free (AIM) user
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
429 * 0x0020 Away
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
430 * 0x0400 ActiveBuddy
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
431 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
432 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
433 outinfo->flags = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
434 outinfo->present |= AIM_USERINFO_PRESENT_FLAGS;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
435
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
436 } else if (type == 0x0002) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
437 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
438 * Type = 0x0002: Account creation time.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
439 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
440 * The time/date that the user originally registered for
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
441 * the service, stored in time_t format.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
442 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
443 * I'm not sure how this differs from type 5 ("member
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
444 * since").
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
445 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
446 * Note: This is the field formerly known as "member
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
447 * since". All these years and I finally found out
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
448 * that I got the name wrong.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
449 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
450 outinfo->createtime = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
451 outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
452
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
453 } else if (type == 0x0003) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
454 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
455 * Type = 0x0003: On-Since date.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
456 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
457 * The time/date that the user started their current
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
458 * session, stored in time_t format.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
459 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
460 outinfo->onlinesince = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
461 outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
462
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
463 } else if (type == 0x0004) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
464 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
465 * Type = 0x0004: Idle time.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
466 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
467 * Number of minutes since the user actively used the
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
468 * service.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
469 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
470 * Note that the client tells the server when to start
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
471 * counting idle times, so this may or may not be
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
472 * related to reality.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
473 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
474 outinfo->idletime = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
475 outinfo->present |= AIM_USERINFO_PRESENT_IDLE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
476
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
477 } else if (type == 0x0005) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
478 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
479 * Type = 0x0005: Member since date.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
480 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
481 * The time/date that the user originally registered for
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
482 * the service, stored in time_t format.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
483 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
484 * This is sometimes sent instead of type 2 ("account
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
485 * creation time"), particularly in the self-info.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
486 * And particularly for ICQ?
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
487 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
488 outinfo->membersince = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
489 outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
490
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
491 } else if (type == 0x0006) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
492 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
493 * Type = 0x0006: ICQ Online Status
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
494 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
495 * ICQ's Away/DND/etc "enriched" status. Some decoding
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
496 * of values done by Scott <darkagl@pcnet.com>
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
497 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
498 aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
499 outinfo->icqinfo.status = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
500 outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
501
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
502 } else if (type == 0x000a) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
503 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
504 * Type = 0x000a
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
505 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
506 * ICQ User IP Address.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
507 * Ahh, the joy of ICQ security.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
508 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
509 outinfo->icqinfo.ipaddr = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
510 outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
511
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
512 } else if (type == 0x000c) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
513 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
514 * Type = 0x000c
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
515 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
516 * random crap containing the IP address,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
517 * apparently a port number, and some Other Stuff.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
518 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
519 * Format is:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
520 * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
521 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
522 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
523 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
524 aimbs_getrawbuf(bs, outinfo->icqinfo.crap, 0x25);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
525 outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
526
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
527 } else if (type == 0x000d) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
528 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
529 * Type = 0x000d
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
530 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
531 * Capability information.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
532 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
533 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
534 outinfo->capabilities = aim_getcap(sess, bs, length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
535 outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
536
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
537 } else if (type == 0x000e) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
538 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
539 * Type = 0x000e
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
540 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
541 * Unknown. Always of zero length, and always only
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
542 * on AOL users.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
543 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
544 * Ignore.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
545 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
546 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
547
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
548 } else if ((type == 0x000f) || (type == 0x0010)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
549 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
550 * Type = 0x000f: Session Length. (AIM)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
551 * Type = 0x0010: Session Length. (AOL)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
552 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
553 * The duration, in seconds, of the user's current
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
554 * session.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
555 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
556 * Which TLV type this comes in depends on the
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
557 * service the user is using (AIM or AOL).
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
558 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
559 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
560 outinfo->sessionlen = aimbs_get32(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
561 outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
562
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
563 } else if (type == 0x0019) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
564 /* faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV type 0x0019: from %s\n", outinfo->sn); */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
565
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
566 } else if (type == 0x001b) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
567 /* faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV type 0x001b: from %s\n", outinfo->sn); */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
568
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
569 } else if (type == 0x001d) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
570 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
571 * Type = 0x001d
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
572 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
573 * Buddy icon information and available messages.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
574 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
575 * This almost seems like the AIM protocol guys gave
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
576 * the iChat guys a Type, and the iChat guys tried to
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
577 * cram as much cool shit into it as possible. Then
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
578 * the Windows AIM guys were like, "hey, that's
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
579 * pretty neat, let's copy those prawns."
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
580 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
581 * In that spirit, this can contain a custom message,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
582 * kind of like an away message, but you're not away
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
583 * (it's called an "available" message). Or it can
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
584 * contain information about the buddy icon the user
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
585 * has stored on the server.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
586 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
587 int type2, number, length2;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
588
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
589 while (aim_bstream_curpos(bs) < endpos) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
590 type2 = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
591 number = aimbs_get8(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
592 length2 = aimbs_get8(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
593
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
594 switch (type2) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
595 case 0x0000: { /* This is an official buddy icon? */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
596 /* This is always 5 bytes of "0x02 01 d2 04 72"? */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
597 aim_bstream_advance(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
598 } break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
599
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
600 case 0x0001: { /* A buddy icon checksum */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
601 if ((length2 > 0) && (number == 0x01)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
602 free(outinfo->iconcsum);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
603 outinfo->iconcsum = aimbs_getraw(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
604 outinfo->iconcsumlen = length2;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
605 } else
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
606 aim_bstream_advance(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
607 } break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
608
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
609 case 0x0002: { /* An available message */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
610 if (length2 > 4) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
611 free(outinfo->avail);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
612 outinfo->avail_len = aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
613 outinfo->avail = aimbs_getstr(bs, outinfo->avail_len);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
614 if (aimbs_get16(bs) == 0x0001) { /* We have an encoding */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
615 aimbs_get16(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
616 outinfo->avail_encoding = aimbs_getstr(bs, aimbs_get16(bs));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
617 } else {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
618 /* No explicit encoding, client should use UTF-8 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
619 outinfo->avail_encoding = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
620 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
621 } else
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
622 aim_bstream_advance(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
623 } break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
624
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
625 default: {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
626 aim_bstream_advance(bs, length2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
627 } break;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
628 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
629 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
630
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
631 } else if (type == 0x001e) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
632 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
633 * Type 30: Unknown.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
634 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
635 * Always four bytes, but it doesn't look like an int.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
636 */
7025
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
637
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
638 } else if (type == 0x001f) {
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
639 /*
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
640 * Type 31: Unknown.
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
641 *
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
642 * Seen on a buddy using DeadAIM. Data was 4 bytes:
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
643 * 0x00 00 00 10
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
644 */
db041f206848 [gaim-migrate @ 7588]
Mark Doliner <mark@kingant.net>
parents: 7011
diff changeset
645
7011
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
646 } else {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
647
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
648 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
649 * Reaching here indicates that either AOL has
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
650 * added yet another TLV for us to deal with,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
651 * or the parsing has gone Terribly Wrong.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
652 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
653 * Either way, inform the owner and attempt
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
654 * recovery.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
655 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
656 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
657 faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV:\n");
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
658 faimdprintf(sess, 0, "userinfo: sn =%s\n", outinfo->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
659 dumptlv(sess, type, bs, length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
660 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
661
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
662 /* Save ourselves. */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
663 aim_bstream_setpos(bs, endpos);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
664 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
665
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
666 aim_locate_adduserinfo(outinfo);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
667
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
668 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
669 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
670
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
671 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
672 * Inverse of aim_info_extract()
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
673 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
674 faim_internal int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
675 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
676 aim_tlvlist_t *tlvlist = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
677
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
678 if (!bs || !info)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
679 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
680
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
681 aimbs_put8(bs, strlen(info->sn));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
682 aimbs_putraw(bs, info->sn, strlen(info->sn));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
683
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
684 aimbs_put16(bs, info->warnlevel);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
685
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
686 if (info->present & AIM_USERINFO_PRESENT_FLAGS)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
687 aim_addtlvtochain16(&tlvlist, 0x0001, info->flags);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
688 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
689 aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
690 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
691 aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
692 if (info->present & AIM_USERINFO_PRESENT_IDLE)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
693 aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
694
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
695 /* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
696 #if ICQ_OSCAR_SUPPORT
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
697 if (atoi(info->sn) != 0) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
698 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
699 aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
700 if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
701 aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
702 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
703 #endif
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
704
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
705 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
706 aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
707
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
708 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
709 aim_addtlvtochain32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
710
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
711 aimbs_put16(bs, aim_counttlvchain(&tlvlist));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
712 aim_writetlvchain(bs, &tlvlist);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
713 aim_freetlvchain(&tlvlist);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
714
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
715 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
716 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
717
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
718 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
719 * Subtype 0x0002
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
720 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
721 * Request Location services rights.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
722 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
723 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
724 faim_export int aim_locate_reqrights(aim_session_t *sess)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
725 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
726 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
727
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
728 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
729 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
730
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
731 return aim_genericreq_n(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_REQRIGHTS);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
732 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
733
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
734 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
735 * Subtype 0x0003
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
736 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
737 * Normally contains:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
738 * t(0001) - short containing max profile length (value = 1024)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
739 * t(0002) - short - unknown (value = 16) [max MIME type length?]
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
740 * t(0003) - short - unknown (value = 10)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
741 * t(0004) - short - unknown (value = 2048) [ICQ only?]
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
742 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
743 static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
744 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
745 aim_tlvlist_t *tlvlist;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
746 aim_rxcallback_t userfunc;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
747 int ret = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
748 fu16_t maxsiglen = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
749
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
750 tlvlist = aim_readtlvchain(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
751
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
752 if (aim_gettlv(tlvlist, 0x0001, 1))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
753 maxsiglen = aim_gettlv16(tlvlist, 0x0001, 1);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
754
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
755 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
756 ret = userfunc(sess, rx, maxsiglen);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
757
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
758 aim_freetlvchain(&tlvlist);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
759
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
760 return ret;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
761 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
762
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
763 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
764 * Subtype 0x0004
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
765 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
766 * Gives BOS your profile.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
767 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
768 * profile_encoding and awaymsg_encoding MUST be set if profile or
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
769 * away are set, respectively, and their value may or may not be
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
770 * restricted to a few choices. I am currently aware of:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
771 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
772 * us-ascii Just that
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
773 * unicode-2-0 UCS2-BE
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
774 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
775 * profile_len and awaymsg_len MUST be set similarly, and they MUST
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
776 * be the length of their respective strings in bytes.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
777 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
778 * To get the previous behavior of awaymsg == "" un-setting the away
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
779 * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
780 * obvious equivalent).
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
781 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
782 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
783 faim_export int aim_locate_setprofile(aim_session_t *sess,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
784 const char *profile_encoding, const char *profile, const int profile_len,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
785 const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len,
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
786 fu32_t caps)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
787 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
788 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
789 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
790 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
791 aim_tlvlist_t *tl = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
792 char *encoding;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
793 static const char defencoding[] = {"text/aolrtf; charset=\"%s\""};
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
794
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
795 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
796 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
797
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
798 if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
799 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
800 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
801
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
802 /* Build the packet first to get real length */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
803 if (profile) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
804 /* no + 1 here because of %s */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
805 encoding = malloc(strlen(defencoding) + strlen(profile_encoding));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
806 if (encoding == NULL) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
807 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
808 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
809 snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
810 aim_addtlvtochain_raw(&tl, 0x0001, strlen(encoding), encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
811 aim_addtlvtochain_raw(&tl, 0x0002, profile_len, profile);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
812 free(encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
813 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
814
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
815 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
816 * So here's how this works:
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
817 * - You are away when you have a non-zero-length type 4 TLV stored.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
818 * - You become unaway when you clear the TLV with a zero-length
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
819 * type 4 TLV.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
820 * - If you do not send the type 4 TLV, your status does not change
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
821 * (that is, if you were away, you'll remain away).
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
822 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
823 if (awaymsg) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
824 if (awaymsg_len) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
825 encoding = malloc(strlen(defencoding) + strlen(awaymsg_encoding));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
826 if (encoding == NULL) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
827 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
828 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
829 snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
830 aim_addtlvtochain_raw(&tl, 0x0003, strlen(encoding), encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
831 aim_addtlvtochain_raw(&tl, 0x0004, awaymsg_len, awaymsg);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
832 free(encoding);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
833 } else
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
834 aim_addtlvtochain_noval(&tl, 0x0004);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
835 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
836
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
837 aim_addtlvtochain_caps(&tl, 0x0005, caps);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
838
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
839 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_sizetlvchain(&tl))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
840 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
841
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
842 snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
843 aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
844
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
845 aim_writetlvchain(&fr->data, &tl);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
846 aim_freetlvchain(&tl);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
847
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
848 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
849
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
850 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
851 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
852
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
853 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
854 * Subtype 0x0005 - Request info of another AIM user.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
855 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
856 * @param sn The screenname whose info you wish to request.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
857 * @param infotype The type of info you wish to request.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
858 * 0x0001 - Info/profile
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
859 * 0x0003 - Away message
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
860 * 0x0004 - Capabilities
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
861 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
862 faim_export int aim_locate_getinfo(aim_session_t *sess, const char *sn, fu16_t infotype)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
863 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
864 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
865 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
866 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
867
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
868 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
869 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
870
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
871 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
872 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
873
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
874 snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
875
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
876 aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
877 aimbs_put16(&fr->data, infotype);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
878 aimbs_put8(&fr->data, strlen(sn));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
879 aimbs_putraw(&fr->data, sn, strlen(sn));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
880
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
881 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
882
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
883 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
884 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
885
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
886 /* Subtype 0x0006 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
887 static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
888 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
889 int ret = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
890 aim_rxcallback_t userfunc;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
891 aim_userinfo_t *userinfo, *userinfo2;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
892 aim_tlvlist_t *tlvlist;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
893 aim_tlv_t *tlv = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
894 int was_explicit;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
895 struct node *cur, *del;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
896
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
897 userinfo = (aim_userinfo_t *)malloc(sizeof(aim_userinfo_t));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
898 aim_info_extract(sess, bs, userinfo);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
899 tlvlist = aim_readtlvchain(bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
900
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
901 /* Profile will be 1 and 2 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
902 userinfo->info_encoding = aim_gettlv_str(tlvlist, 0x0001, 1);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
903 if ((tlv = aim_gettlv(tlvlist, 0x0002, 1))) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
904 userinfo->info = (char *)malloc(tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
905 memcpy(userinfo->info, tlv->value, tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
906 userinfo->info_len = tlv->length;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
907 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
908
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
909 /* Away message will be 3 and 4 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
910 userinfo->away_encoding = aim_gettlv_str(tlvlist, 0x0003, 1);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
911 if ((tlv = aim_gettlv(tlvlist, 0x0004, 1))) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
912 userinfo->away = (char *)malloc(tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
913 memcpy(userinfo->away, tlv->value, tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
914 userinfo->away_len = tlv->length;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
915 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
916
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
917 /* Caps will be 5 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
918 if ((tlv = aim_gettlv(tlvlist, 0x0005, 1))) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
919 aim_bstream_t cbs;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
920 aim_bstream_init(&cbs, tlv->value, tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
921 userinfo->capabilities = aim_getcap(sess, &cbs, tlv->length);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
922 userinfo->present = AIM_USERINFO_PRESENT_CAPABILITIES;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
923 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
924 aim_freetlvchain(&tlvlist);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
925
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
926 aim_locate_adduserinfo(userinfo);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
927 userinfo2 = aim_locate_finduserinfo(userinfo->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
928 aim_info_free(userinfo);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
929 free(userinfo);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
930
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
931 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
932 * Remove this screen name from our queue. If the client requested
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
933 * this buddy's info explicitly, then notify them that we have info
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
934 * for this buddy.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
935 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
936 was_explicit = TRUE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
937 while ((request_queue != NULL) && (aim_sncmp(userinfo2->sn, request_queue->sn) == 0)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
938 del = request_queue;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
939 request_queue = del->next;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
940 was_explicit = FALSE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
941 free(del->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
942 free(del);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
943 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
944 cur = request_queue;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
945 while ((cur != NULL) && (cur->next != NULL)) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
946 if (aim_sncmp(userinfo2->sn, cur->next->sn) == 0) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
947 del = cur->next;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
948 cur->next = del->next;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
949 was_explicit = FALSE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
950 free(del->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
951 free(del);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
952 } else
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
953 cur = cur->next;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
954 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
955
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
956 if (was_explicit == TRUE) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
957 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
958 ret = userfunc(sess, rx, userinfo2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
959 } else {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
960 waiting_for_response = FALSE;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
961 aim_locate_dorequest(sess);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
962 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
963
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
964 return ret;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
965 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
966
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
967 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
968 * Subtype 0x0009 - Set directory profile data.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
969 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
970 * This is not the same as aim_location_setprofile!
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
971 * privacy: 1 to allow searching, 0 to disallow.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
972 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
973 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
974 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)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
975 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
976 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
977 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
978 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
979 aim_tlvlist_t *tl = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
980
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
981 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
982 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
983
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
984 aim_addtlvtochain16(&tl, 0x000a, privacy);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
985
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
986 if (first)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
987 aim_addtlvtochain_raw(&tl, 0x0001, strlen(first), first);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
988 if (last)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
989 aim_addtlvtochain_raw(&tl, 0x0002, strlen(last), last);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
990 if (middle)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
991 aim_addtlvtochain_raw(&tl, 0x0003, strlen(middle), middle);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
992 if (maiden)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
993 aim_addtlvtochain_raw(&tl, 0x0004, strlen(maiden), maiden);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
994
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
995 if (state)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
996 aim_addtlvtochain_raw(&tl, 0x0007, strlen(state), state);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
997 if (city)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
998 aim_addtlvtochain_raw(&tl, 0x0008, strlen(city), city);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
999
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1000 if (nickname)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1001 aim_addtlvtochain_raw(&tl, 0x000c, strlen(nickname), nickname);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1002 if (zip)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1003 aim_addtlvtochain_raw(&tl, 0x000d, strlen(zip), zip);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1004
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1005 if (street)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1006 aim_addtlvtochain_raw(&tl, 0x0021, strlen(street), street);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1007
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1008 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1009 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1010
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1011 snacid = aim_cachesnac(sess, 0x0002, 0x0009, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1012
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1013 aim_putsnac(&fr->data, 0x0002, 0x0009, 0x0000, snacid);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1014 aim_writetlvchain(&fr->data, &tl);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1015 aim_freetlvchain(&tl);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1016
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1017 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1018
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1019 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1020 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1021
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1022 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1023 * Subtype 0x000b - Huh? What is this?
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1024 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1025 faim_export int aim_locate_000b(aim_session_t *sess, const char *sn)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1026 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1027 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1028 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1029 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1030
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1031 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1032
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1033 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1034 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1035
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1036 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1037 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1038
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1039 snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1040
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1041 aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1042 aimbs_put8(&fr->data, strlen(sn));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1043 aimbs_putraw(&fr->data, sn, strlen(sn));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1044
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1045 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1046
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1047 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1048 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1049
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1050 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1051 * Subtype 0x000f
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1052 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1053 * XXX pass these in better
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1054 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1055 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1056 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)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1057 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1058 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1059 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1060 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1061 aim_tlvlist_t *tl = NULL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1062
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1063 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1064 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1065
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1066 /* ?? privacy ?? */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1067 aim_addtlvtochain16(&tl, 0x000a, privacy);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1068
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1069 if (interest1)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1070 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest1), interest1);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1071 if (interest2)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1072 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest2), interest2);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1073 if (interest3)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1074 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest3), interest3);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1075 if (interest4)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1076 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest4), interest4);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1077 if (interest5)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1078 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest5), interest5);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1079
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1080 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1081 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1082
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1083 snacid = aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1084
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1085 aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1086 aim_writetlvchain(&fr->data, &tl);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1087 aim_freetlvchain(&tl);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1088
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1089 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1090
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1091 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1092 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1093
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1094 /*
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1095 * Subtype 0x0015 - Request the info a user using the short method. This is
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1096 * what iChat uses. It normally is VERY leniently rate limited.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1097 *
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1098 * @param sn The screen name whose info you wish to request.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1099 * @param flags The bitmask which specifies the type of info you wish to request.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1100 * 0x00000001 - Info/profile.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1101 * 0x00000002 - Away message.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1102 * 0x00000004 - Capabilities.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1103 * 0x00000008 - Certification.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1104 * @return Return 0 if no errors, otherwise return the error number.
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1105 */
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1106 faim_export int aim_locate_getinfoshort(aim_session_t *sess, const char *sn, fu32_t flags)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1107 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1108 aim_conn_t *conn;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1109 aim_frame_t *fr;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1110 aim_snacid_t snacid;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1111
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1112 if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC)) || !sn)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1113 return -EINVAL;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1114
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1115 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+1+strlen(sn))))
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1116 return -ENOMEM;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1117
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1118 snacid = aim_cachesnac(sess, 0x0002, 0x0015, 0x0000, NULL, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1119
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1120 aim_putsnac(&fr->data, 0x0002, 0x0015, 0x0000, 0);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1121 aimbs_put32(&fr->data, flags);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1122 aimbs_put8(&fr->data, strlen(sn));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1123 aimbs_putraw(&fr->data, sn, strlen(sn));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1124
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1125 aim_tx_enqueue(sess, fr);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1126
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1127 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1128 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1129
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1130 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1131 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1132
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1133 if (snac->subtype == 0x0003)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1134 return rights(sess, mod, rx, snac, bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1135 else if (snac->subtype == 0x0006)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1136 return userinfo(sess, mod, rx, snac, bs);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1137
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1138 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1139 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1140
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1141 static void locate_shutdown(aim_session_t *sess, aim_module_t *mod)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1142 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1143 aim_userinfo_t *del;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1144
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1145 while (infos) {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1146 del = infos;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1147 infos = infos->next;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1148 free(del->sn);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1149 free(del->info);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1150 free(del->avail);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1151 free(del->away);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1152 free(del);
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1153 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1154 }
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1155
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1156 faim_internal int locate_modfirst(aim_session_t *sess, aim_module_t *mod)
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1157 {
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1158
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1159 mod->family = AIM_CB_FAM_LOC;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1160 mod->version = 0x0001;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1161 mod->toolid = 0x0110;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1162 mod->toolversion = 0x0629;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1163 mod->flags = 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1164 strncpy(mod->name, "locate", sizeof(mod->name));
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1165 mod->snachandler = snachandler;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1166 mod->shutdown = locate_shutdown;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1167
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1168 return 0;
4375bf2d9020 [gaim-migrate @ 7574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1169 }