Mercurial > pidgin
annotate src/protocols/oscar/info.c @ 4660:92f401df564a
[gaim-migrate @ 4971]
Thanks to The Nathan Walp for telling me I'm dumb before giving
Herman a chance to chastise.
Man, was that poetic or what?
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 07 Mar 2003 05:40:02 +0000 |
parents | 4938d12f6d48 |
children | 9810ce8e7a96 |
rev | line source |
---|---|
2086 | 1 /* |
3952 | 2 * Family 0x0002 - Information. |
2086 | 3 * |
4 * The functions here are responsible for requesting and parsing information- | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
5 * gathering SNACs. Or something like that. |
2086 | 6 * |
7 */ | |
8 | |
9 #define FAIM_INTERNAL | |
10 #include <aim.h> | |
4156
d833bacc054f
[gaim-migrate @ 4384]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4151
diff
changeset
|
11 #ifdef _WIN32 |
d833bacc054f
[gaim-migrate @ 4384]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4151
diff
changeset
|
12 #include "win32dep.h" |
d833bacc054f
[gaim-migrate @ 4384]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4151
diff
changeset
|
13 #endif |
2086 | 14 |
15 struct aim_priv_inforeq { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
16 char sn[MAXSNLEN+1]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
17 fu16_t infotype; |
2086 | 18 }; |
19 | |
3952 | 20 /* |
21 * Subtype 0x0002 | |
22 * | |
23 * Request Location services rights. | |
24 * | |
25 */ | |
26 faim_export int aim_bos_reqlocaterights(aim_session_t *sess, aim_conn_t *conn) | |
27 { | |
28 return aim_genericreq_n(sess, conn, 0x0002, 0x0002); | |
29 } | |
30 | |
31 /* | |
32 * Subtype 0x0004 | |
33 * | |
34 * Gives BOS your profile. | |
4151 | 35 * |
36 * profile_encoding and awaymsg_encoding MUST be set if profile or | |
37 * away are set, respectively, and their value may or may not be | |
38 * restricted to a few choices. I am currently aware of: | |
39 * | |
40 * us-ascii Just that | |
41 * unicode-2-0 UCS2-BE | |
42 * | |
43 * profile_len and awaymsg_len MUST be set similarly, and they MUST | |
44 * be the length of their respective strings in bytes. | |
45 * | |
46 * To get the previous behavior of awaymsg == "" un-setting the away | |
47 * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the | |
48 * obvious equivalent). | |
3952 | 49 * |
50 */ | |
4151 | 51 faim_export int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, |
52 const char *profile_encoding, const char *profile, const int profile_len, | |
53 const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len, | |
54 fu32_t caps) | |
3952 | 55 { |
4151 | 56 static const char defencoding[] = {"text/aolrtf; charset=\"%s\""}; |
3952 | 57 aim_frame_t *fr; |
58 aim_tlvlist_t *tl = NULL; | |
59 aim_snacid_t snacid; | |
4151 | 60 char *encoding; |
61 | |
62 if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) { | |
63 return -EINVAL; | |
64 } | |
3952 | 65 |
66 /* Build to packet first to get real length */ | |
67 if (profile) { | |
4151 | 68 /* no + 1 here because of %s */ |
69 encoding = malloc(strlen(defencoding) + strlen(profile_encoding)); | |
70 if (encoding == NULL) { | |
71 return -ENOMEM; | |
72 } | |
73 snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding); | |
74 aim_addtlvtochain_raw(&tl, 0x0001, strlen(encoding), encoding); | |
75 aim_addtlvtochain_raw(&tl, 0x0002, profile_len, profile); | |
76 free(encoding); | |
3952 | 77 } |
78 | |
79 /* | |
80 * So here's how this works: | |
81 * - You are away when you have a non-zero-length type 4 TLV stored. | |
82 * - You become unaway when you clear the TLV with a zero-length | |
83 * type 4 TLV. | |
84 * - If you do not send the type 4 TLV, your status does not change | |
85 * (that is, if you were away, you'll remain away). | |
86 */ | |
87 if (awaymsg) { | |
4151 | 88 if (awaymsg_len) { |
89 encoding = malloc(strlen(defencoding) + strlen(awaymsg_encoding)); | |
90 if (encoding == NULL) { | |
91 return -ENOMEM; | |
92 } | |
93 snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding); | |
94 aim_addtlvtochain_raw(&tl, 0x0003, strlen(encoding), encoding); | |
95 aim_addtlvtochain_raw(&tl, 0x0004, awaymsg_len, awaymsg); | |
96 free(encoding); | |
3952 | 97 } else |
98 aim_addtlvtochain_noval(&tl, 0x0004); | |
99 } | |
100 | |
101 aim_addtlvtochain_caps(&tl, 0x0005, caps); | |
102 | |
103 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_sizetlvchain(&tl)))) | |
104 return -ENOMEM; | |
105 | |
106 snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0); | |
107 | |
108 aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid); | |
109 aim_writetlvchain(&fr->data, &tl); | |
110 aim_freetlvchain(&tl); | |
111 | |
112 aim_tx_enqueue(sess, fr); | |
113 | |
114 return 0; | |
115 } | |
116 | |
117 /* | |
118 * Subtype 0x0005 - Request info of another AIM user. | |
119 * | |
120 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
121 faim_export int aim_getinfo(aim_session_t *sess, aim_conn_t *conn, const char *sn, fu16_t infotype) |
2086 | 122 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
123 struct aim_priv_inforeq privdata; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
124 aim_frame_t *fr; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
125 aim_snacid_t snacid; |
2086 | 126 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
127 if (!sess || !conn || !sn) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
128 return -EINVAL; |
2086 | 129 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
130 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn)))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
131 return -ENOMEM; |
2086 | 132 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
133 strncpy(privdata.sn, sn, sizeof(privdata.sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
134 privdata.infotype = infotype; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
135 snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, &privdata, sizeof(struct aim_priv_inforeq)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
136 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
137 aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
138 aimbs_put16(&fr->data, infotype); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
139 aimbs_put8(&fr->data, strlen(sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
140 aimbs_putraw(&fr->data, sn, strlen(sn)); |
2086 | 141 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
142 aim_tx_enqueue(sess, fr); |
2086 | 143 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
144 return 0; |
2086 | 145 } |
146 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
147 faim_export const char *aim_userinfo_sn(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
148 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
149 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
150 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
151 return NULL; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
152 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
153 return ui->sn; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
154 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
155 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
156 faim_export fu16_t aim_userinfo_flags(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
157 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
158 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
159 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
160 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
161 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
162 return ui->flags; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
163 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
164 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
165 faim_export fu16_t aim_userinfo_idle(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
166 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
167 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
168 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
169 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
170 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
171 return ui->idletime; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
172 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
173 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
174 faim_export float aim_userinfo_warnlevel(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
175 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
176 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
177 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
178 return 0.00; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
179 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
180 return (ui->warnlevel / 10); |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
181 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
182 |
3459 | 183 faim_export time_t aim_userinfo_createtime(aim_userinfo_t *ui) |
184 { | |
185 | |
186 if (!ui) | |
187 return 0; | |
188 | |
189 return (time_t)ui->createtime; | |
190 } | |
191 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
192 faim_export time_t aim_userinfo_membersince(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
193 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
194 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
195 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
196 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
197 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
198 return (time_t)ui->membersince; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
199 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
200 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
201 faim_export time_t aim_userinfo_onlinesince(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
202 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
203 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
204 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
205 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
206 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
207 return (time_t)ui->onlinesince; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
208 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
209 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
210 faim_export fu32_t aim_userinfo_sessionlen(aim_userinfo_t *ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
211 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
212 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
213 if (!ui) |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
214 return 0; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
215 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
216 return ui->sessionlen; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
217 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
218 |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
219 faim_export int aim_userinfo_hascap(aim_userinfo_t *ui, fu32_t cap) |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
220 { |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
221 |
2993 | 222 if (!ui || !(ui->present & AIM_USERINFO_PRESENT_CAPABILITIES)) |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
223 return -1; |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
224 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
225 return !!(ui->capabilities & cap); |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
226 } |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
227 |
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
228 |
2086 | 229 /* |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
230 * Capability blocks. |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
231 * |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
232 * These are CLSIDs. They should actually be of the form: |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
233 * |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
234 * {0x0946134b, 0x4c7f, 0x11d1, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
235 * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}}, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
236 * |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
237 * But, eh. |
2086 | 238 */ |
239 static const struct { | |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
240 fu32_t flag; |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
241 fu8_t data[16]; |
2086 | 242 } aim_caps[] = { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
243 |
2669 | 244 /* |
245 * Chat is oddball. | |
246 */ | |
247 {AIM_CAPS_CHAT, | |
248 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
249 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
250 |
2669 | 251 /* |
252 * These are mostly in order. | |
253 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
254 {AIM_CAPS_VOICE, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
255 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
256 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
2086 | 257 |
2669 | 258 {AIM_CAPS_SENDFILE, |
259 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, | |
260 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
261 | |
262 /* | |
263 * Advertised by the EveryBuddy client. | |
264 */ | |
2734
9fc65bb80596
[gaim-migrate @ 2747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
265 {AIM_CAPS_ICQ, |
2669 | 266 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, |
267 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
268 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
269 {AIM_CAPS_IMIMAGE, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
270 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
271 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
272 |
2669 | 273 {AIM_CAPS_BUDDYICON, |
274 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, | |
275 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
276 | |
277 {AIM_CAPS_SAVESTOCKS, | |
278 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1, | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
279 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
280 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
281 {AIM_CAPS_GETFILE, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
282 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
283 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
2086 | 284 |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
285 {AIM_CAPS_ICQSERVERRELAY, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
286 {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
287 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
288 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
289 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
290 * Indeed, there are two of these. The former appears to be correct, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
291 * but in some versions of winaim, the second one is set. Either they |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
292 * forgot to fix endianness, or they made a typo. It really doesn't |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
293 * matter which. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
294 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
295 {AIM_CAPS_GAMES, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
296 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
297 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
298 {AIM_CAPS_GAMES2, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
299 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
300 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
2086 | 301 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
302 {AIM_CAPS_SENDBUDDYLIST, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
303 {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
304 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
2086 | 305 |
4650 | 306 {AIM_CAPS_ICQUTF8, |
3952 | 307 {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1, |
4650 | 308 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
309 | |
310 {AIM_CAPS_ICQUNKNOWN, | |
311 {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8, | |
312 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}}, | |
313 | |
314 /* | |
315 {AIM_CAPS_ICQ2GO, | |
316 {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd, | |
317 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}}, | |
318 */ | |
3952 | 319 |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
320 {AIM_CAPS_ICQRTF, |
4650 | 321 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
322 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
323 |
3952 | 324 /* supposed to be ICQRTF? |
325 {AIM_CAPS_TRILLUNKNOWN, | |
326 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, | |
327 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, */ | |
328 | |
4650 | 329 {AIM_CAPS_APINFO, |
330 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, | |
331 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, | |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
332 |
2920 | 333 {AIM_CAPS_TRILLIANCRYPT, |
334 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb, | |
335 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}, | |
336 | |
4650 | 337 {AIM_CAPS_EMPTY, |
338 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, | |
2979 | 340 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
341 {AIM_CAPS_LAST} |
2086 | 342 }; |
343 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
344 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
345 * This still takes a length parameter even with a bstream because capabilities |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
346 * are not naturally bounded. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
347 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
348 */ |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
349 faim_internal fu32_t aim_getcap(aim_session_t *sess, aim_bstream_t *bs, int len) |
2086 | 350 { |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
351 fu32_t flags = 0; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
352 int offset; |
2086 | 353 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
354 for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x10) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
355 fu8_t *cap; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
356 int i, identified; |
2086 | 357 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
358 cap = aimbs_getraw(bs, 0x10); |
2086 | 359 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
360 for (i = 0, identified = 0; !(aim_caps[i].flag & AIM_CAPS_LAST); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
361 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
362 if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
363 flags |= aim_caps[i].flag; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
364 identified++; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
365 break; /* should only match once... */ |
2086 | 366 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
367 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
368 } |
2086 | 369 |
2920 | 370 if (!identified) { |
371 faimdprintf(sess, 0, "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", | |
372 cap[0], cap[1], cap[2], cap[3], | |
373 cap[4], cap[5], | |
374 cap[6], cap[7], | |
375 cap[8], cap[9], | |
376 cap[10], cap[11], cap[12], cap[13], | |
377 cap[14], cap[15]); | |
378 } | |
2086 | 379 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
380 free(cap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
381 } |
2086 | 382 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
383 return flags; |
2086 | 384 } |
385 | |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
386 faim_internal int aim_putcap(aim_bstream_t *bs, fu32_t caps) |
2086 | 387 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
388 int i; |
2086 | 389 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
390 if (!bs) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
391 return -EINVAL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
392 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
393 for (i = 0; aim_bstream_empty(bs); i++) { |
2086 | 394 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
395 if (aim_caps[i].flag == AIM_CAPS_LAST) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
396 break; |
2086 | 397 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
398 if (caps & aim_caps[i].flag) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
399 aimbs_putraw(bs, aim_caps[i].data, 0x10); |
2086 | 400 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
401 } |
2086 | 402 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
403 return 0; |
2086 | 404 } |
405 | |
3459 | 406 static void dumptlv(aim_session_t *sess, fu16_t type, aim_bstream_t *bs, fu8_t len) |
407 { | |
408 int i; | |
409 | |
410 if (!sess || !bs || !len) | |
411 return; | |
412 | |
413 faimdprintf(sess, 0, "userinfo: type =0x%04x\n", type); | |
414 faimdprintf(sess, 0, "userinfo: length=0x%04x\n", len); | |
415 | |
416 faimdprintf(sess, 0, "userinfo: value:\n"); | |
417 | |
418 for (i = 0; i < len; i++) { | |
419 if ((i % 8) == 0) | |
420 faimdprintf(sess, 0, "\nuserinfo: "); | |
421 | |
422 faimdprintf(sess, 0, "0x%2x ", aimbs_get8(bs)); | |
423 } | |
424 | |
425 faimdprintf(sess, 0, "\n"); | |
426 | |
427 return; | |
428 } | |
429 | |
2086 | 430 /* |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
431 * AIM is fairly regular about providing user info. This is a generic |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
432 * routine to extract it in its standard form. |
2086 | 433 */ |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
434 faim_internal int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *outinfo) |
2086 | 435 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
436 int curtlv, tlvcnt; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
437 fu8_t snlen; |
2086 | 438 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
439 if (!bs || !outinfo) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
440 return -EINVAL; |
2086 | 441 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
442 /* Clear out old data first */ |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
443 memset(outinfo, 0x00, sizeof(aim_userinfo_t)); |
2086 | 444 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
445 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
446 * Screen name. Stored as an unterminated string prepended with a |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
447 * byte containing its length. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
448 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
449 snlen = aimbs_get8(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
450 aimbs_getrawbuf(bs, outinfo->sn, snlen); |
2086 | 451 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
452 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
453 * Warning Level. Stored as an unsigned short. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
454 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
455 outinfo->warnlevel = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
456 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
457 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
458 * TLV Count. Unsigned short representing the number of |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
459 * Type-Length-Value triples that follow. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
460 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
461 tlvcnt = aimbs_get16(bs); |
2086 | 462 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
463 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
464 * Parse out the Type-Length-Value triples as they're found. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
465 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
466 for (curtlv = 0; curtlv < tlvcnt; curtlv++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
467 int endpos; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
468 fu16_t type, length; |
2086 | 469 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
470 type = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
471 length = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
472 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
473 endpos = aim_bstream_curpos(bs) + length; |
2086 | 474 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
475 if (type == 0x0001) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
476 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
477 * Type = 0x0001: User flags |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
478 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
479 * Specified as any of the following ORed together: |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
480 * 0x0001 Trial (user less than 60days) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
481 * 0x0002 Unknown bit 2 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
482 * 0x0004 AOL Main Service user |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
483 * 0x0008 Unknown bit 4 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
484 * 0x0010 Free (AIM) user |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
485 * 0x0020 Away |
2315
7ec21662ffc2
[gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
486 * 0x0400 ActiveBuddy |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
487 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
488 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
489 outinfo->flags = aimbs_get16(bs); |
2993 | 490 outinfo->present |= AIM_USERINFO_PRESENT_FLAGS; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
491 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
492 } else if (type == 0x0002) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
493 /* |
3459 | 494 * Type = 0x0002: Account creation time. |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
495 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
496 * The time/date that the user originally registered for |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
497 * the service, stored in time_t format. |
3459 | 498 * |
499 * I'm not sure how this differs from type 5 ("member | |
500 * since"). | |
501 * | |
502 * Note: This is the field formerly known as "member | |
503 * since". All these years and I finally found out | |
504 * that I got the name wrong. | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
505 */ |
3459 | 506 outinfo->createtime = aimbs_get32(bs); |
507 outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
508 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
509 } else if (type == 0x0003) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
510 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
511 * Type = 0x0003: On-Since date. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
512 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
513 * The time/date that the user started their current |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
514 * session, stored in time_t format. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
515 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
516 outinfo->onlinesince = aimbs_get32(bs); |
2993 | 517 outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE; |
2086 | 518 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
519 } else if (type == 0x0004) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
520 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
521 * Type = 0x0004: Idle time. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
522 * |
4443 | 523 * Number of minutes since the user actively used the |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
524 * service. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
525 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
526 * Note that the client tells the server when to start |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
527 * counting idle times, so this may or may not be |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
528 * related to reality. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
529 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
530 outinfo->idletime = aimbs_get16(bs); |
2993 | 531 outinfo->present |= AIM_USERINFO_PRESENT_IDLE; |
3952 | 532 |
3459 | 533 } else if (type == 0x0005) { |
534 /* | |
535 * Type = 0x0005: Member since date. | |
536 * | |
537 * The time/date that the user originally registered for | |
538 * the service, stored in time_t format. | |
539 * | |
540 * This is sometimes sent instead of type 2 ("account | |
541 * creation time"), particularly in the self-info. | |
3952 | 542 * And particularly for ICQ? |
3459 | 543 */ |
544 outinfo->membersince = aimbs_get32(bs); | |
545 outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE; | |
2086 | 546 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
547 } else if (type == 0x0006) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
548 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
549 * Type = 0x0006: ICQ Online Status |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
550 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
551 * ICQ's Away/DND/etc "enriched" status. Some decoding |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
552 * of values done by Scott <darkagl@pcnet.com> |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
553 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
554 aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
555 outinfo->icqinfo.status = aimbs_get16(bs); |
2993 | 556 outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS; |
2086 | 557 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
558 } else if (type == 0x000a) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
559 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
560 * Type = 0x000a |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
561 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
562 * ICQ User IP Address. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
563 * Ahh, the joy of ICQ security. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
564 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
565 outinfo->icqinfo.ipaddr = aimbs_get32(bs); |
2993 | 566 outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR; |
2086 | 567 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
568 } else if (type == 0x000c) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
569 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
570 * Type = 0x000c |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
571 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
572 * random crap containing the IP address, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
573 * apparently a port number, and some Other Stuff. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
574 * |
4342 | 575 * Format is: |
576 * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43 | |
577 * | |
578 * | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
579 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
580 aimbs_getrawbuf(bs, outinfo->icqinfo.crap, 0x25); |
2993 | 581 outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA; |
2086 | 582 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
583 } else if (type == 0x000d) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
584 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
585 * Type = 0x000d |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
586 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
587 * Capability information. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
588 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
589 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
590 outinfo->capabilities = aim_getcap(sess, bs, length); |
2993 | 591 outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
592 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
593 } else if (type == 0x000e) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
594 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
595 * Type = 0x000e |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
596 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
597 * Unknown. Always of zero length, and always only |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
598 * on AOL users. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
599 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
600 * Ignore. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
601 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
602 */ |
2086 | 603 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
604 } else if ((type == 0x000f) || (type == 0x0010)) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
605 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
606 * Type = 0x000f: Session Length. (AIM) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
607 * Type = 0x0010: Session Length. (AOL) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
608 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
609 * The duration, in seconds, of the user's current |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
610 * session. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
611 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
612 * Which TLV type this comes in depends on the |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
613 * service the user is using (AIM or AOL). |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
614 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
615 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
616 outinfo->sessionlen = aimbs_get32(bs); |
2993 | 617 outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
618 |
3459 | 619 } else if (type == 0x001d) { |
620 /* | |
621 * Type 29: Unknown. | |
622 * | |
623 * Currently very rare. Always 18 bytes of mostly zero. | |
624 */ | |
625 | |
626 } else if (type == 0x001e) { | |
627 /* | |
628 * Type 30: Unknown. | |
629 * | |
630 * Always four bytes, but it doesn't look like an int. | |
631 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
632 } else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
633 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
634 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
635 * Reaching here indicates that either AOL has |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
636 * added yet another TLV for us to deal with, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
637 * or the parsing has gone Terribly Wrong. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
638 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
639 * Either way, inform the owner and attempt |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
640 * recovery. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
641 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
642 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
643 faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV:\n"); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
644 faimdprintf(sess, 0, "userinfo: sn =%s\n", outinfo->sn); |
3459 | 645 dumptlv(sess, type, bs, length); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
646 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
647 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
648 /* Save ourselves. */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
649 aim_bstream_setpos(bs, endpos); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
650 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
651 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
652 return 0; |
2086 | 653 } |
654 | |
655 /* | |
656 * Inverse of aim_extractuserinfo() | |
657 */ | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
658 faim_internal int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info) |
2086 | 659 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
660 aim_tlvlist_t *tlvlist = NULL; |
2086 | 661 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
662 if (!bs || !info) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
663 return -EINVAL; |
2086 | 664 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
665 aimbs_put8(bs, strlen(info->sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
666 aimbs_putraw(bs, info->sn, strlen(info->sn)); |
2086 | 667 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
668 aimbs_put16(bs, info->warnlevel); |
2086 | 669 |
670 | |
3459 | 671 if (info->present & AIM_USERINFO_PRESENT_FLAGS) |
672 aim_addtlvtochain16(&tlvlist, 0x0001, info->flags); | |
673 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
674 aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince); | |
675 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
676 aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince); | |
677 if (info->present & AIM_USERINFO_PRESENT_IDLE) | |
678 aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime); | |
2086 | 679 |
3952 | 680 /* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */ |
2086 | 681 #if ICQ_OSCAR_SUPPORT |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
682 if (atoi(info->sn) != 0) { |
3459 | 683 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) |
684 aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status); | |
685 if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) | |
686 aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
687 } |
2086 | 688 #endif |
689 | |
3459 | 690 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
691 aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities); | |
692 | |
693 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
694 aim_addtlvtochain32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); | |
2086 | 695 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
696 aimbs_put16(bs, aim_counttlvchain(&tlvlist)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
697 aim_writetlvchain(bs, &tlvlist); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
698 aim_freetlvchain(&tlvlist); |
2086 | 699 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
700 return 0; |
2086 | 701 } |
702 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
703 /* |
3952 | 704 * Subtype 0x000b - Huh? What is this? |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
705 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
706 faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn) |
2086 | 707 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
708 aim_frame_t *fr; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
709 aim_snacid_t snacid; |
2086 | 710 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
711 if (!sess || !conn || !sn) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
712 return -EINVAL; |
2086 | 713 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
714 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+1+strlen(sn)))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
715 return -ENOMEM; |
2086 | 716 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
717 snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
718 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
719 aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
720 aimbs_put8(&fr->data, strlen(sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
721 aimbs_putraw(&fr->data, sn, strlen(sn)); |
2086 | 722 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
723 aim_tx_enqueue(sess, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
724 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
725 return 0; |
2086 | 726 } |
727 | |
2122 | 728 /* |
3952 | 729 * Subtype 0x0003 |
730 * | |
2122 | 731 * Normally contains: |
732 * t(0001) - short containing max profile length (value = 1024) | |
733 * t(0002) - short - unknown (value = 16) [max MIME type length?] | |
2315
7ec21662ffc2
[gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
734 * t(0003) - short - unknown (value = 10) |
3213 | 735 * t(0004) - short - unknown (value = 2048) [ICQ only?] |
2122 | 736 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
737 static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 738 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
739 aim_tlvlist_t *tlvlist; |
2122 | 740 aim_rxcallback_t userfunc; |
741 int ret = 0; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
742 fu16_t maxsiglen = 0; |
2086 | 743 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
744 tlvlist = aim_readtlvchain(bs); |
2086 | 745 |
2122 | 746 if (aim_gettlv(tlvlist, 0x0001, 1)) |
747 maxsiglen = aim_gettlv16(tlvlist, 0x0001, 1); | |
2086 | 748 |
2122 | 749 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
750 ret = userfunc(sess, rx, maxsiglen); | |
2086 | 751 |
2122 | 752 aim_freetlvchain(&tlvlist); |
753 | |
754 return ret; | |
2086 | 755 } |
756 | |
3952 | 757 /* Subtype 0x0006 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
758 static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 759 { |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
760 aim_userinfo_t userinfo; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
761 char *text_encoding = NULL, *text = NULL; |
4151 | 762 int textlen = 0; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
763 aim_rxcallback_t userfunc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
764 aim_tlvlist_t *tlvlist; |
4151 | 765 aim_tlv_t *text_tlv = NULL; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
766 aim_snac_t *origsnac = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
767 struct aim_priv_inforeq *inforeq; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
768 int ret = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
769 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
770 origsnac = aim_remsnac(sess, snac->id); |
2086 | 771 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
772 if (!origsnac || !origsnac->data) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
773 faimdprintf(sess, 0, "parse_userinfo_middle: major problem: no snac stored!\n"); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
774 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
775 } |
2086 | 776 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
777 inforeq = (struct aim_priv_inforeq *)origsnac->data; |
2086 | 778 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
779 if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && |
2920 | 780 (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) && |
781 (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
782 faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
783 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
784 } |
2086 | 785 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
786 aim_extractuserinfo(sess, bs, &userinfo); |
2086 | 787 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
788 tlvlist = aim_readtlvchain(bs); |
2086 | 789 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
790 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
791 * Depending on what informational text was requested, different |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
792 * TLVs will appear here. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
793 * |
2920 | 794 * Profile will be 1 and 2, away message will be 3 and 4, caps |
795 * will be 5. | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
796 */ |
2920 | 797 if (inforeq->infotype == AIM_GETINFO_GENERALINFO) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
798 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1); |
4151 | 799 text_tlv = aim_gettlv(tlvlist, 0x0002, 1); |
2920 | 800 } else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
801 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1); |
4151 | 802 text_tlv = aim_gettlv(tlvlist, 0x0004, 1); |
2920 | 803 } else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) { |
804 aim_tlv_t *ct; | |
805 | |
806 if ((ct = aim_gettlv(tlvlist, 0x0005, 1))) { | |
807 aim_bstream_t cbs; | |
808 | |
809 aim_bstream_init(&cbs, ct->value, ct->length); | |
810 | |
811 userinfo.capabilities = aim_getcap(sess, &cbs, ct->length); | |
2993 | 812 userinfo.present = AIM_USERINFO_PRESENT_CAPABILITIES; |
2920 | 813 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
814 } |
2086 | 815 |
4151 | 816 if (text_tlv) { |
817 text = text_tlv->value; | |
818 textlen = text_tlv->length; | |
819 } | |
820 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
821 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
4151 | 822 ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text, textlen); |
2086 | 823 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
824 free(text_encoding); |
2086 | 825 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
826 aim_freetlvchain(&tlvlist); |
2086 | 827 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
828 if (origsnac) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
829 free(origsnac->data); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
830 free(origsnac); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
831 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
832 return ret; |
2086 | 833 } |
834 | |
3952 | 835 /* |
836 * Subtype 0x0009 - Set directory profile data. | |
837 * | |
838 * This is not the same as aim_bos_setprofile! | |
839 * privacy: 1 to allow searching, 0 to disallow. | |
840 * | |
841 */ | |
842 faim_export int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy) | |
843 { | |
844 aim_frame_t *fr; | |
845 aim_snacid_t snacid; | |
846 aim_tlvlist_t *tl = NULL; | |
847 | |
848 aim_addtlvtochain16(&tl, 0x000a, privacy); | |
849 | |
850 if (first) | |
851 aim_addtlvtochain_raw(&tl, 0x0001, strlen(first), first); | |
852 if (last) | |
853 aim_addtlvtochain_raw(&tl, 0x0002, strlen(last), last); | |
854 if (middle) | |
855 aim_addtlvtochain_raw(&tl, 0x0003, strlen(middle), middle); | |
856 if (maiden) | |
857 aim_addtlvtochain_raw(&tl, 0x0004, strlen(maiden), maiden); | |
858 | |
859 if (state) | |
860 aim_addtlvtochain_raw(&tl, 0x0007, strlen(state), state); | |
861 if (city) | |
862 aim_addtlvtochain_raw(&tl, 0x0008, strlen(city), city); | |
863 | |
864 if (nickname) | |
865 aim_addtlvtochain_raw(&tl, 0x000c, strlen(nickname), nickname); | |
866 if (zip) | |
867 aim_addtlvtochain_raw(&tl, 0x000d, strlen(zip), zip); | |
868 | |
869 if (street) | |
870 aim_addtlvtochain_raw(&tl, 0x0021, strlen(street), street); | |
871 | |
872 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) | |
873 return -ENOMEM; | |
874 | |
875 snacid = aim_cachesnac(sess, 0x0002, 0x0009, 0x0000, NULL, 0); | |
876 | |
877 aim_putsnac(&fr->data, 0x0002, 0x0009, 0x0000, snacid); | |
878 aim_writetlvchain(&fr->data, &tl); | |
879 aim_freetlvchain(&tl); | |
880 | |
881 aim_tx_enqueue(sess, fr); | |
882 | |
883 return 0; | |
884 } | |
885 | |
886 /* | |
887 * Subtype 0x000f | |
888 * | |
889 * XXX pass these in better | |
890 * | |
891 */ | |
892 faim_export int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy) | |
893 { | |
894 aim_frame_t *fr; | |
895 aim_snacid_t snacid; | |
896 aim_tlvlist_t *tl = NULL; | |
897 | |
898 /* ?? privacy ?? */ | |
899 aim_addtlvtochain16(&tl, 0x000a, privacy); | |
900 | |
901 if (interest1) | |
902 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest1), interest1); | |
903 if (interest2) | |
904 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest2), interest2); | |
905 if (interest3) | |
906 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest3), interest3); | |
907 if (interest4) | |
908 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest4), interest4); | |
909 if (interest5) | |
910 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest5), interest5); | |
911 | |
912 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) | |
913 return -ENOMEM; | |
914 | |
915 snacid = aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); | |
916 | |
917 aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0); | |
918 aim_writetlvchain(&fr->data, &tl); | |
919 aim_freetlvchain(&tl); | |
920 | |
921 aim_tx_enqueue(sess, fr); | |
922 | |
923 return 0; | |
924 } | |
925 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
926 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 927 { |
928 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
929 if (snac->subtype == 0x0003) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
930 return rights(sess, mod, rx, snac, bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
931 else if (snac->subtype == 0x0006) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
932 return userinfo(sess, mod, rx, snac, bs); |
2086 | 933 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
934 return 0; |
2086 | 935 } |
936 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
937 faim_internal int locate_modfirst(aim_session_t *sess, aim_module_t *mod) |
2086 | 938 { |
939 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
940 mod->family = 0x0002; |
2672 | 941 mod->version = 0x0001; |
4071 | 942 mod->toolid = 0x0110; |
943 mod->toolversion = 0x0629; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
944 mod->flags = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
945 strncpy(mod->name, "locate", sizeof(mod->name)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
946 mod->snachandler = snachandler; |
2086 | 947 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
948 return 0; |
2086 | 949 } |