Mercurial > pidgin
annotate src/protocols/oscar/info.c @ 4853:fbfdacf7c611
[gaim-migrate @ 5180]
This is better auto-getting of icons for oscar.
Ethan made me write a tobase16 fucntion and a from16 function (and he
done gave me some good advice for that, too) which convert to and
from arbitrary data and a null terminated string of hex. I use these
to get and store the md5 checksum for each icon sent to you. This way,
Gaim will request the icon when the md5sum differs. Er, so the md5sum
is stored in blist.xml.
Previously, Gaim would only request the icon if you did not have any
buddy icon for the other person. Now it will request it if the local
md5sum differs from the server md5sum.
To sum it up again, if their icon changes, gaim will request the new one.
I tried using the base64 functions, but they look like they want to
work with null terminated strings, rather than arbitrary data.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 22 Mar 2003 07:29:34 +0000 |
parents | a4d3243499bb |
children | 773135edda4a |
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 |
4811 | 306 /* |
307 * Setting this lets AIM users receive messages from | |
308 * ICQ users, and ICQ users receive messages from AIM | |
309 * users. | |
310 */ | |
311 {AIM_CAPS_INTEROPERATE, | |
312 {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1, | |
313 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, | |
314 | |
4650 | 315 {AIM_CAPS_ICQUTF8, |
3952 | 316 {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1, |
4650 | 317 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, |
318 | |
319 {AIM_CAPS_ICQUNKNOWN, | |
320 {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8, | |
321 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}}, | |
322 | |
323 /* | |
324 {AIM_CAPS_ICQ2GO, | |
325 {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd, | |
326 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}}, | |
327 */ | |
3952 | 328 |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
329 {AIM_CAPS_ICQRTF, |
4650 | 330 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
331 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}, |
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
332 |
3952 | 333 /* supposed to be ICQRTF? |
334 {AIM_CAPS_TRILLUNKNOWN, | |
335 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, | |
336 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, */ | |
337 | |
4650 | 338 {AIM_CAPS_APINFO, |
339 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, | |
340 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, | |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
341 |
2920 | 342 {AIM_CAPS_TRILLIANCRYPT, |
343 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb, | |
344 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}, | |
345 | |
4650 | 346 {AIM_CAPS_EMPTY, |
347 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, | |
2979 | 349 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
350 {AIM_CAPS_LAST} |
2086 | 351 }; |
352 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
353 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
354 * 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
|
355 * are not naturally bounded. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
356 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
357 */ |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
358 faim_internal fu32_t aim_getcap(aim_session_t *sess, aim_bstream_t *bs, int len) |
2086 | 359 { |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
360 fu32_t flags = 0; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
361 int offset; |
2086 | 362 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
363 for (offset = 0; aim_bstream_empty(bs) && (offset < len); offset += 0x10) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
364 fu8_t *cap; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
365 int i, identified; |
2086 | 366 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
367 cap = aimbs_getraw(bs, 0x10); |
2086 | 368 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
369 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
|
370 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
371 if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
372 flags |= aim_caps[i].flag; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
373 identified++; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
374 break; /* should only match once... */ |
2086 | 375 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
376 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
377 } |
2086 | 378 |
2920 | 379 if (!identified) { |
380 faimdprintf(sess, 0, "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", | |
381 cap[0], cap[1], cap[2], cap[3], | |
382 cap[4], cap[5], | |
383 cap[6], cap[7], | |
384 cap[8], cap[9], | |
385 cap[10], cap[11], cap[12], cap[13], | |
386 cap[14], cap[15]); | |
387 } | |
2086 | 388 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
389 free(cap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
390 } |
2086 | 391 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
392 return flags; |
2086 | 393 } |
394 | |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
395 faim_internal int aim_putcap(aim_bstream_t *bs, fu32_t caps) |
2086 | 396 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
397 int i; |
2086 | 398 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
399 if (!bs) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
400 return -EINVAL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
401 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
402 for (i = 0; aim_bstream_empty(bs); i++) { |
2086 | 403 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
404 if (aim_caps[i].flag == AIM_CAPS_LAST) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
405 break; |
2086 | 406 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
407 if (caps & aim_caps[i].flag) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
408 aimbs_putraw(bs, aim_caps[i].data, 0x10); |
2086 | 409 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
410 } |
2086 | 411 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
412 return 0; |
2086 | 413 } |
414 | |
3459 | 415 static void dumptlv(aim_session_t *sess, fu16_t type, aim_bstream_t *bs, fu8_t len) |
416 { | |
417 int i; | |
418 | |
419 if (!sess || !bs || !len) | |
420 return; | |
421 | |
422 faimdprintf(sess, 0, "userinfo: type =0x%04x\n", type); | |
423 faimdprintf(sess, 0, "userinfo: length=0x%04x\n", len); | |
424 | |
425 faimdprintf(sess, 0, "userinfo: value:\n"); | |
426 | |
427 for (i = 0; i < len; i++) { | |
428 if ((i % 8) == 0) | |
429 faimdprintf(sess, 0, "\nuserinfo: "); | |
430 | |
431 faimdprintf(sess, 0, "0x%2x ", aimbs_get8(bs)); | |
432 } | |
433 | |
434 faimdprintf(sess, 0, "\n"); | |
435 | |
436 return; | |
437 } | |
438 | |
2086 | 439 /* |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
440 * 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
|
441 * routine to extract it in its standard form. |
2086 | 442 */ |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
443 faim_internal int aim_extractuserinfo(aim_session_t *sess, aim_bstream_t *bs, aim_userinfo_t *outinfo) |
2086 | 444 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
445 int curtlv, tlvcnt; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
446 fu8_t snlen; |
2086 | 447 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
448 if (!bs || !outinfo) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
449 return -EINVAL; |
2086 | 450 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
451 /* Clear out old data first */ |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
452 memset(outinfo, 0x00, sizeof(aim_userinfo_t)); |
2086 | 453 |
2246
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 * Screen name. Stored as an unterminated string prepended with a |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
456 * byte containing its length. |
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 snlen = aimbs_get8(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
459 aimbs_getrawbuf(bs, outinfo->sn, snlen); |
2086 | 460 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
461 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
462 * Warning Level. Stored as an unsigned short. |
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 outinfo->warnlevel = aimbs_get16(bs); |
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 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
467 * TLV Count. Unsigned short representing the number of |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
468 * Type-Length-Value triples that follow. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
469 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
470 tlvcnt = aimbs_get16(bs); |
2086 | 471 |
2246
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 * Parse out the Type-Length-Value triples as they're found. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
474 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
475 for (curtlv = 0; curtlv < tlvcnt; curtlv++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
476 int endpos; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
477 fu16_t type, length; |
2086 | 478 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
479 type = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
480 length = aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
481 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
482 endpos = aim_bstream_curpos(bs) + length; |
2086 | 483 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
484 if (type == 0x0001) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
485 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
486 * Type = 0x0001: User flags |
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 * Specified as any of the following ORed together: |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
489 * 0x0001 Trial (user less than 60days) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
490 * 0x0002 Unknown bit 2 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
491 * 0x0004 AOL Main Service user |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
492 * 0x0008 Unknown bit 4 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
493 * 0x0010 Free (AIM) user |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
494 * 0x0020 Away |
2315
7ec21662ffc2
[gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
495 * 0x0400 ActiveBuddy |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
496 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
497 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
498 outinfo->flags = aimbs_get16(bs); |
2993 | 499 outinfo->present |= AIM_USERINFO_PRESENT_FLAGS; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
500 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
501 } else if (type == 0x0002) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
502 /* |
3459 | 503 * Type = 0x0002: Account creation time. |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
504 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
505 * The time/date that the user originally registered for |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
506 * the service, stored in time_t format. |
3459 | 507 * |
508 * I'm not sure how this differs from type 5 ("member | |
509 * since"). | |
510 * | |
511 * Note: This is the field formerly known as "member | |
512 * since". All these years and I finally found out | |
513 * that I got the name wrong. | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
514 */ |
3459 | 515 outinfo->createtime = aimbs_get32(bs); |
516 outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
517 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
518 } else if (type == 0x0003) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
519 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
520 * Type = 0x0003: On-Since date. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
521 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
522 * The time/date that the user started their current |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
523 * session, stored in time_t format. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
524 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
525 outinfo->onlinesince = aimbs_get32(bs); |
2993 | 526 outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE; |
2086 | 527 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
528 } else if (type == 0x0004) { |
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 * Type = 0x0004: Idle time. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
531 * |
4443 | 532 * Number of minutes since the user actively used the |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
533 * service. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
534 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
535 * Note that the client tells the server when to start |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
536 * counting idle times, so this may or may not be |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
537 * related to reality. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
538 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
539 outinfo->idletime = aimbs_get16(bs); |
2993 | 540 outinfo->present |= AIM_USERINFO_PRESENT_IDLE; |
3952 | 541 |
3459 | 542 } else if (type == 0x0005) { |
543 /* | |
544 * Type = 0x0005: Member since date. | |
545 * | |
546 * The time/date that the user originally registered for | |
547 * the service, stored in time_t format. | |
548 * | |
549 * This is sometimes sent instead of type 2 ("account | |
550 * creation time"), particularly in the self-info. | |
3952 | 551 * And particularly for ICQ? |
3459 | 552 */ |
553 outinfo->membersince = aimbs_get32(bs); | |
554 outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE; | |
2086 | 555 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
556 } else if (type == 0x0006) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
557 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
558 * Type = 0x0006: ICQ Online Status |
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 * ICQ's Away/DND/etc "enriched" status. Some decoding |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
561 * of values done by Scott <darkagl@pcnet.com> |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
562 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
563 aimbs_get16(bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
564 outinfo->icqinfo.status = aimbs_get16(bs); |
2993 | 565 outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS; |
2086 | 566 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
567 } else if (type == 0x000a) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
568 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
569 * Type = 0x000a |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
570 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
571 * ICQ User IP Address. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
572 * Ahh, the joy of ICQ security. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
573 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
574 outinfo->icqinfo.ipaddr = aimbs_get32(bs); |
2993 | 575 outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR; |
2086 | 576 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
577 } else if (type == 0x000c) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
578 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
579 * Type = 0x000c |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
580 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
581 * random crap containing the IP address, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
582 * apparently a port number, and some Other Stuff. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
583 * |
4342 | 584 * Format is: |
585 * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43 | |
586 * | |
587 * | |
2246
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 aimbs_getrawbuf(bs, outinfo->icqinfo.crap, 0x25); |
2993 | 590 outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA; |
2086 | 591 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
592 } else if (type == 0x000d) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
593 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
594 * Type = 0x000d |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
595 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
596 * Capability information. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
597 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
598 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
599 outinfo->capabilities = aim_getcap(sess, bs, length); |
2993 | 600 outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; |
2246
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 } else if (type == 0x000e) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
603 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
604 * Type = 0x000e |
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 * Unknown. Always of zero length, and always only |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
607 * on AOL users. |
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 * Ignore. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
610 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
611 */ |
2086 | 612 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
613 } else if ((type == 0x000f) || (type == 0x0010)) { |
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 * Type = 0x000f: Session Length. (AIM) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
616 * Type = 0x0010: Session Length. (AOL) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
617 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
618 * The duration, in seconds, of the user's current |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
619 * session. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
620 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
621 * Which TLV type this comes in depends on the |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
622 * service the user is using (AIM or AOL). |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
623 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
624 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
625 outinfo->sessionlen = aimbs_get32(bs); |
2993 | 626 outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
627 |
3459 | 628 } else if (type == 0x001d) { |
629 /* | |
4804 | 630 * Type = 0x001d |
3459 | 631 * |
4804 | 632 * Buddy icon information. This contains the info |
633 * about the buddy icon that the user has stored on | |
634 * the server. | |
3459 | 635 */ |
4853 | 636 int flags, number, len; |
637 fu8_t *csum; | |
638 | |
4826 | 639 while (aim_bstream_curpos(bs) < endpos) { |
4853 | 640 flags = aimbs_get16(bs); |
641 number = aimbs_get8(bs); | |
642 len = aimbs_get8(bs); | |
643 if ((flags & 0x0001) && (number == 0x01) && (len < 30)) { | |
644 csum = aimbs_getraw(bs, len); | |
645 memcpy(outinfo->iconcsum, csum, len); | |
646 outinfo->iconcsumlen = len; | |
647 free(csum); | |
648 } else | |
649 aim_bstream_advance(bs, len); | |
4809 | 650 } |
3459 | 651 |
652 } else if (type == 0x001e) { | |
653 /* | |
654 * Type 30: Unknown. | |
655 * | |
656 * Always four bytes, but it doesn't look like an int. | |
657 */ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
658 } else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
659 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
660 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
661 * Reaching here indicates that either AOL has |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
662 * added yet another TLV for us to deal with, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
663 * or the parsing has gone Terribly Wrong. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
664 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
665 * Either way, inform the owner and attempt |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
666 * recovery. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
667 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
668 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
669 faimdprintf(sess, 0, "userinfo: **warning: unexpected TLV:\n"); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
670 faimdprintf(sess, 0, "userinfo: sn =%s\n", outinfo->sn); |
3459 | 671 dumptlv(sess, type, bs, length); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
672 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
673 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
674 /* Save ourselves. */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
675 aim_bstream_setpos(bs, endpos); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
676 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
677 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
678 return 0; |
2086 | 679 } |
680 | |
681 /* | |
682 * Inverse of aim_extractuserinfo() | |
683 */ | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
684 faim_internal int aim_putuserinfo(aim_bstream_t *bs, aim_userinfo_t *info) |
2086 | 685 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
686 aim_tlvlist_t *tlvlist = NULL; |
2086 | 687 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
688 if (!bs || !info) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
689 return -EINVAL; |
2086 | 690 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
691 aimbs_put8(bs, strlen(info->sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
692 aimbs_putraw(bs, info->sn, strlen(info->sn)); |
2086 | 693 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
694 aimbs_put16(bs, info->warnlevel); |
2086 | 695 |
696 | |
3459 | 697 if (info->present & AIM_USERINFO_PRESENT_FLAGS) |
698 aim_addtlvtochain16(&tlvlist, 0x0001, info->flags); | |
699 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
700 aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince); | |
701 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
702 aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince); | |
703 if (info->present & AIM_USERINFO_PRESENT_IDLE) | |
704 aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime); | |
2086 | 705 |
3952 | 706 /* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */ |
2086 | 707 #if ICQ_OSCAR_SUPPORT |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
708 if (atoi(info->sn) != 0) { |
3459 | 709 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) |
710 aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status); | |
711 if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) | |
712 aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
713 } |
2086 | 714 #endif |
715 | |
3459 | 716 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
717 aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities); | |
718 | |
719 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
720 aim_addtlvtochain32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); | |
2086 | 721 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
722 aimbs_put16(bs, aim_counttlvchain(&tlvlist)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
723 aim_writetlvchain(bs, &tlvlist); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
724 aim_freetlvchain(&tlvlist); |
2086 | 725 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
726 return 0; |
2086 | 727 } |
728 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
729 /* |
3952 | 730 * Subtype 0x000b - Huh? What is this? |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
731 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
732 faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn) |
2086 | 733 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
734 aim_frame_t *fr; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
735 aim_snacid_t snacid; |
2086 | 736 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
737 if (!sess || !conn || !sn) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
738 return -EINVAL; |
2086 | 739 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
740 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
|
741 return -ENOMEM; |
2086 | 742 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
743 snacid = aim_cachesnac(sess, 0x0002, 0x000b, 0x0000, NULL, 0); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
744 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
745 aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
746 aimbs_put8(&fr->data, strlen(sn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
747 aimbs_putraw(&fr->data, sn, strlen(sn)); |
2086 | 748 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
749 aim_tx_enqueue(sess, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
750 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
751 return 0; |
2086 | 752 } |
753 | |
2122 | 754 /* |
3952 | 755 * Subtype 0x0003 |
756 * | |
2122 | 757 * Normally contains: |
758 * t(0001) - short containing max profile length (value = 1024) | |
759 * t(0002) - short - unknown (value = 16) [max MIME type length?] | |
2315
7ec21662ffc2
[gaim-migrate @ 2325]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
760 * t(0003) - short - unknown (value = 10) |
3213 | 761 * t(0004) - short - unknown (value = 2048) [ICQ only?] |
2122 | 762 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
763 static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 764 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
765 aim_tlvlist_t *tlvlist; |
2122 | 766 aim_rxcallback_t userfunc; |
767 int ret = 0; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
768 fu16_t maxsiglen = 0; |
2086 | 769 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
770 tlvlist = aim_readtlvchain(bs); |
2086 | 771 |
2122 | 772 if (aim_gettlv(tlvlist, 0x0001, 1)) |
773 maxsiglen = aim_gettlv16(tlvlist, 0x0001, 1); | |
2086 | 774 |
2122 | 775 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
776 ret = userfunc(sess, rx, maxsiglen); | |
2086 | 777 |
2122 | 778 aim_freetlvchain(&tlvlist); |
779 | |
780 return ret; | |
2086 | 781 } |
782 | |
3952 | 783 /* Subtype 0x0006 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
784 static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 785 { |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
786 aim_userinfo_t userinfo; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
787 char *text_encoding = NULL, *text = NULL; |
4151 | 788 int textlen = 0; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
789 aim_rxcallback_t userfunc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
790 aim_tlvlist_t *tlvlist; |
4151 | 791 aim_tlv_t *text_tlv = NULL; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
792 aim_snac_t *origsnac = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
793 struct aim_priv_inforeq *inforeq; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
794 int ret = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
795 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
796 origsnac = aim_remsnac(sess, snac->id); |
2086 | 797 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
798 if (!origsnac || !origsnac->data) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
799 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
|
800 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
801 } |
2086 | 802 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
803 inforeq = (struct aim_priv_inforeq *)origsnac->data; |
2086 | 804 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
805 if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && |
2920 | 806 (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) && |
807 (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
808 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
|
809 return 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
810 } |
2086 | 811 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
812 aim_extractuserinfo(sess, bs, &userinfo); |
2086 | 813 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
814 tlvlist = aim_readtlvchain(bs); |
2086 | 815 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
816 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
817 * Depending on what informational text was requested, different |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
818 * TLVs will appear here. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
819 * |
2920 | 820 * Profile will be 1 and 2, away message will be 3 and 4, caps |
821 * will be 5. | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
822 */ |
2920 | 823 if (inforeq->infotype == AIM_GETINFO_GENERALINFO) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
824 text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1); |
4151 | 825 text_tlv = aim_gettlv(tlvlist, 0x0002, 1); |
2920 | 826 } else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
827 text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1); |
4151 | 828 text_tlv = aim_gettlv(tlvlist, 0x0004, 1); |
2920 | 829 } else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) { |
830 aim_tlv_t *ct; | |
831 | |
832 if ((ct = aim_gettlv(tlvlist, 0x0005, 1))) { | |
833 aim_bstream_t cbs; | |
834 | |
835 aim_bstream_init(&cbs, ct->value, ct->length); | |
836 | |
837 userinfo.capabilities = aim_getcap(sess, &cbs, ct->length); | |
2993 | 838 userinfo.present = AIM_USERINFO_PRESENT_CAPABILITIES; |
2920 | 839 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
840 } |
2086 | 841 |
4151 | 842 if (text_tlv) { |
843 text = text_tlv->value; | |
844 textlen = text_tlv->length; | |
845 } | |
846 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
847 if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) |
4151 | 848 ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text, textlen); |
2086 | 849 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
850 free(text_encoding); |
2086 | 851 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
852 aim_freetlvchain(&tlvlist); |
2086 | 853 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
854 if (origsnac) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
855 free(origsnac->data); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
856 free(origsnac); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
857 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
858 return ret; |
2086 | 859 } |
860 | |
3952 | 861 /* |
862 * Subtype 0x0009 - Set directory profile data. | |
863 * | |
864 * This is not the same as aim_bos_setprofile! | |
865 * privacy: 1 to allow searching, 0 to disallow. | |
866 * | |
867 */ | |
868 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) | |
869 { | |
870 aim_frame_t *fr; | |
871 aim_snacid_t snacid; | |
872 aim_tlvlist_t *tl = NULL; | |
873 | |
874 aim_addtlvtochain16(&tl, 0x000a, privacy); | |
875 | |
876 if (first) | |
877 aim_addtlvtochain_raw(&tl, 0x0001, strlen(first), first); | |
878 if (last) | |
879 aim_addtlvtochain_raw(&tl, 0x0002, strlen(last), last); | |
880 if (middle) | |
881 aim_addtlvtochain_raw(&tl, 0x0003, strlen(middle), middle); | |
882 if (maiden) | |
883 aim_addtlvtochain_raw(&tl, 0x0004, strlen(maiden), maiden); | |
884 | |
885 if (state) | |
886 aim_addtlvtochain_raw(&tl, 0x0007, strlen(state), state); | |
887 if (city) | |
888 aim_addtlvtochain_raw(&tl, 0x0008, strlen(city), city); | |
889 | |
890 if (nickname) | |
891 aim_addtlvtochain_raw(&tl, 0x000c, strlen(nickname), nickname); | |
892 if (zip) | |
893 aim_addtlvtochain_raw(&tl, 0x000d, strlen(zip), zip); | |
894 | |
895 if (street) | |
896 aim_addtlvtochain_raw(&tl, 0x0021, strlen(street), street); | |
897 | |
898 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) | |
899 return -ENOMEM; | |
900 | |
901 snacid = aim_cachesnac(sess, 0x0002, 0x0009, 0x0000, NULL, 0); | |
902 | |
903 aim_putsnac(&fr->data, 0x0002, 0x0009, 0x0000, snacid); | |
904 aim_writetlvchain(&fr->data, &tl); | |
905 aim_freetlvchain(&tl); | |
906 | |
907 aim_tx_enqueue(sess, fr); | |
908 | |
909 return 0; | |
910 } | |
911 | |
912 /* | |
913 * Subtype 0x000f | |
914 * | |
915 * XXX pass these in better | |
916 * | |
917 */ | |
918 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) | |
919 { | |
920 aim_frame_t *fr; | |
921 aim_snacid_t snacid; | |
922 aim_tlvlist_t *tl = NULL; | |
923 | |
924 /* ?? privacy ?? */ | |
925 aim_addtlvtochain16(&tl, 0x000a, privacy); | |
926 | |
927 if (interest1) | |
928 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest1), interest1); | |
929 if (interest2) | |
930 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest2), interest2); | |
931 if (interest3) | |
932 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest3), interest3); | |
933 if (interest4) | |
934 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest4), interest4); | |
935 if (interest5) | |
936 aim_addtlvtochain_raw(&tl, 0x0000b, strlen(interest5), interest5); | |
937 | |
938 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) | |
939 return -ENOMEM; | |
940 | |
941 snacid = aim_cachesnac(sess, 0x0002, 0x000f, 0x0000, NULL, 0); | |
942 | |
943 aim_putsnac(&fr->data, 0x0002, 0x000f, 0x0000, 0); | |
944 aim_writetlvchain(&fr->data, &tl); | |
945 aim_freetlvchain(&tl); | |
946 | |
947 aim_tx_enqueue(sess, fr); | |
948 | |
949 return 0; | |
950 } | |
951 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
952 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
2086 | 953 { |
954 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
955 if (snac->subtype == 0x0003) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
956 return rights(sess, mod, rx, snac, bs); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
957 else if (snac->subtype == 0x0006) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
958 return userinfo(sess, mod, rx, snac, bs); |
2086 | 959 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
960 return 0; |
2086 | 961 } |
962 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
963 faim_internal int locate_modfirst(aim_session_t *sess, aim_module_t *mod) |
2086 | 964 { |
965 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
966 mod->family = 0x0002; |
2672 | 967 mod->version = 0x0001; |
4071 | 968 mod->toolid = 0x0110; |
969 mod->toolversion = 0x0629; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
970 mod->flags = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
971 strncpy(mod->name, "locate", sizeof(mod->name)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
972 mod->snachandler = snachandler; |
2086 | 973 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2122
diff
changeset
|
974 return 0; |
2086 | 975 } |