Mercurial > pidgin
annotate src/protocols/oscar/icq.c @ 5167:d9073c83a8a0
[gaim-migrate @ 5531]
Changed "view history" to "view log" in the conversation windows. This makes
it consistent with the right click menu in the buddy list. I chose "log"
over "history" because I feel it describes the action more accurately.
I also added sweet little status text thingies for oscar people. Most
importantly it shows "Not Authorized" for ICQ peeps, but it also shows
"Away" and "Not Available" and "Free For Chat" and what not. It's cool.
Robot101 suggested it, and it's a leap frog from faceprint's code.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 18 Apr 2003 19:20:45 +0000 |
parents | 46fb754a3c10 |
children | bfe98c4d331e |
rev | line source |
---|---|
2703 | 1 /* |
3952 | 2 * Family 0x0015 - Encapsulated ICQ. |
2703 | 3 * |
4 */ | |
5 | |
6 #define FAIM_INTERNAL | |
7 #include <aim.h> | |
8 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
9 faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
10 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
11 aim_conn_t *conn; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
12 aim_frame_t *fr; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
13 aim_snacid_t snacid; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
14 int bslen; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
15 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
16 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
17 return -EINVAL; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
18 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
19 bslen = 2 + 4 + 2 + 2; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
20 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
21 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
22 return -ENOMEM; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
23 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
24 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
25 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
26 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
27 /* For simplicity, don't bother using a tlvlist */ |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
28 aimbs_put16(&fr->data, 0x0001); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
29 aimbs_put16(&fr->data, bslen); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
30 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
31 aimbs_putle16(&fr->data, bslen - 2); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
32 aimbs_putle32(&fr->data, atoi(sess->sn)); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
33 aimbs_putle16(&fr->data, 0x003c); /* I command thee. */ |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
34 aimbs_putle16(&fr->data, snacid); /* eh. */ |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
35 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
36 aim_tx_enqueue(sess, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
37 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
38 return 0; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
39 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
40 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
41 faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
42 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
43 aim_conn_t *conn; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
44 aim_frame_t *fr; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
45 aim_snacid_t snacid; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
46 int bslen; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
47 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
48 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
49 return -EINVAL; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
50 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
51 bslen = 2 + 4 + 2 + 2; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
52 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
53 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
54 return -ENOMEM; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
55 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
56 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
57 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
58 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
59 /* For simplicity, don't bother using a tlvlist */ |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
60 aimbs_put16(&fr->data, 0x0001); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
61 aimbs_put16(&fr->data, bslen); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
62 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
63 aimbs_putle16(&fr->data, bslen - 2); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
64 aimbs_putle32(&fr->data, atoi(sess->sn)); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
65 aimbs_putle16(&fr->data, 0x003e); /* I command thee. */ |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
66 aimbs_putle16(&fr->data, snacid); /* eh. */ |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
67 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
68 aim_tx_enqueue(sess, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
69 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
70 return 0; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
71 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
72 |
4664 | 73 faim_export int aim_icq_hideip(aim_session_t *sess) |
74 { | |
75 aim_conn_t *conn; | |
76 aim_frame_t *fr; | |
77 aim_snacid_t snacid; | |
78 int bslen; | |
79 | |
80 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
81 return -EINVAL; | |
82 | |
83 bslen = 2+4+2+2+2+4; | |
84 | |
85 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
86 return -ENOMEM; | |
87 | |
88 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
89 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
90 | |
91 /* For simplicity, don't bother using a tlvlist */ | |
92 aimbs_put16(&fr->data, 0x0001); | |
93 aimbs_put16(&fr->data, bslen); | |
94 | |
95 aimbs_putle16(&fr->data, bslen - 2); | |
96 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
97 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
98 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
99 aimbs_putle16(&fr->data, 0x0424); /* shrug. */ | |
100 aimbs_putle16(&fr->data, 0x0001); | |
101 aimbs_putle16(&fr->data, 0x0001); | |
102 | |
103 aim_tx_enqueue(sess, fr); | |
104 | |
105 return 0; | |
106 } | |
107 | |
4617 | 108 faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd) |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
109 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
110 aim_conn_t *conn; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
111 aim_frame_t *fr; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
112 aim_snacid_t snacid; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
113 int bslen; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
114 |
4617 | 115 if (!passwd) |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
116 return -EINVAL; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
117 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
118 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
119 return -EINVAL; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
120 |
4617 | 121 bslen = 2+4+2+2+2+2+strlen(passwd)+1; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
122 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
123 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
124 return -ENOMEM; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
125 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
126 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
127 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
128 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
129 /* For simplicity, don't bother using a tlvlist */ |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
130 aimbs_put16(&fr->data, 0x0001); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
131 aimbs_put16(&fr->data, bslen); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
132 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
133 aimbs_putle16(&fr->data, bslen - 2); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
134 aimbs_putle32(&fr->data, atoi(sess->sn)); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
135 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
136 aimbs_putle16(&fr->data, snacid); /* eh. */ |
4617 | 137 aimbs_putle16(&fr->data, 0x042e); /* shrug. */ |
138 aimbs_putle16(&fr->data, strlen(passwd)+1); | |
139 aimbs_putraw(&fr->data, passwd, strlen(passwd)); | |
140 aimbs_putle8(&fr->data, '\0'); | |
141 | |
142 aim_tx_enqueue(sess, fr); | |
143 | |
144 return 0; | |
145 } | |
146 | |
147 faim_export int aim_icq_getallinfo(aim_session_t *sess, const char *uin) | |
148 { | |
149 aim_conn_t *conn; | |
150 aim_frame_t *fr; | |
151 aim_snacid_t snacid; | |
152 int bslen; | |
4624 | 153 struct aim_icq_info *info; |
4617 | 154 |
155 if (!uin || uin[0] < '0' || uin[0] > '9') | |
156 return -EINVAL; | |
157 | |
158 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
159 return -EINVAL; | |
160 | |
161 bslen = 2 + 4 + 2 + 2 + 2 + 4; | |
162 | |
163 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
164 return -ENOMEM; | |
165 | |
166 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
167 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
168 | |
169 /* For simplicity, don't bother using a tlvlist */ | |
170 aimbs_put16(&fr->data, 0x0001); | |
171 aimbs_put16(&fr->data, bslen); | |
172 | |
173 aimbs_putle16(&fr->data, bslen - 2); | |
174 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
175 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
176 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
177 aimbs_putle16(&fr->data, 0x04b2); /* shrug. */ | |
178 aimbs_putle32(&fr->data, atoi(uin)); | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
179 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
180 aim_tx_enqueue(sess, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
181 |
4624 | 182 /* Keep track of this request and the ICQ number and request ID */ |
183 info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); | |
184 info->reqid = snacid; | |
4625 | 185 info->uin = atoi(uin); |
4624 | 186 info->next = sess->icq_info; |
187 sess->icq_info = info; | |
188 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
189 return 0; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
190 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
191 |
4759 | 192 faim_export int aim_icq_getalias(aim_session_t *sess, const char *uin) |
193 { | |
194 aim_conn_t *conn; | |
195 aim_frame_t *fr; | |
196 aim_snacid_t snacid; | |
197 int bslen; | |
4784 | 198 struct aim_icq_info *info; |
4759 | 199 |
200 if (!uin || uin[0] < '0' || uin[0] > '9') | |
201 return -EINVAL; | |
202 | |
203 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
204 return -EINVAL; | |
205 | |
206 bslen = 2 + 4 + 2 + 2 + 2 + 4; | |
207 | |
208 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
209 return -ENOMEM; | |
210 | |
211 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
212 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
213 | |
214 /* For simplicity, don't bother using a tlvlist */ | |
215 aimbs_put16(&fr->data, 0x0001); | |
216 aimbs_put16(&fr->data, bslen); | |
217 | |
218 aimbs_putle16(&fr->data, bslen - 2); | |
219 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
220 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
221 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
222 aimbs_putle16(&fr->data, 0x04ba); /* shrug. */ | |
223 aimbs_putle32(&fr->data, atoi(uin)); | |
224 | |
225 aim_tx_enqueue(sess, fr); | |
226 | |
4784 | 227 /* Keep track of this request and the ICQ number and request ID */ |
228 info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); | |
229 info->reqid = snacid; | |
230 info->uin = atoi(uin); | |
231 info->next = sess->icq_info; | |
232 sess->icq_info = info; | |
233 | |
4759 | 234 return 0; |
235 } | |
236 | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
237 faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
238 { |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
239 aim_conn_t *conn; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
240 aim_frame_t *fr; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
241 aim_snacid_t snacid; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
242 int bslen; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
243 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
244 if (!uin || uin[0] < '0' || uin[0] > '9') |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
245 return -EINVAL; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
246 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
247 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
248 return -EINVAL; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
249 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
250 bslen = 2 + 4 + 2 + 2 + 2 + 4; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
251 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
252 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
253 return -ENOMEM; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
254 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
255 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
256 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
257 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
258 /* For simplicity, don't bother using a tlvlist */ |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
259 aimbs_put16(&fr->data, 0x0001); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
260 aimbs_put16(&fr->data, bslen); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
261 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
262 aimbs_putle16(&fr->data, bslen - 2); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
263 aimbs_putle32(&fr->data, atoi(sess->sn)); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
264 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
265 aimbs_putle16(&fr->data, snacid); /* eh. */ |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
266 aimbs_putle16(&fr->data, 0x051f); /* shrug. */ |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
267 aimbs_putle32(&fr->data, atoi(uin)); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
268 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
269 aim_tx_enqueue(sess, fr); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
270 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
271 return 0; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
272 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
273 |
4617 | 274 faim_export int aim_icq_sendxmlreq(aim_session_t *sess, const char *xml) |
4151 | 275 { |
276 aim_conn_t *conn; | |
277 aim_frame_t *fr; | |
278 aim_snacid_t snacid; | |
279 int bslen; | |
280 | |
4617 | 281 if (!xml || !strlen(xml)) |
4151 | 282 return -EINVAL; |
283 | |
284 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
285 return -EINVAL; | |
286 | |
4617 | 287 bslen = 2 + 10 + 2 + strlen(xml) + 1; |
4151 | 288 |
289 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
290 return -ENOMEM; | |
291 | |
292 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
293 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
294 | |
295 /* For simplicity, don't bother using a tlvlist */ | |
296 aimbs_put16(&fr->data, 0x0001); | |
297 aimbs_put16(&fr->data, bslen); | |
298 | |
299 aimbs_putle16(&fr->data, bslen - 2); | |
300 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
301 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
302 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
4617 | 303 aimbs_putle16(&fr->data, 0x0998); /* shrug. */ |
304 aimbs_putle16(&fr->data, strlen(xml) + 1); | |
305 aimbs_putraw(&fr->data, xml, strlen(xml) + 1); | |
4151 | 306 |
307 aim_tx_enqueue(sess, fr); | |
308 | |
309 return 0; | |
310 } | |
311 | |
4624 | 312 static void aim_icq_freeinfo(struct aim_icq_info *info) { |
4625 | 313 int i; |
314 | |
4624 | 315 if (!info) |
316 return; | |
317 free(info->nick); | |
318 free(info->first); | |
319 free(info->last); | |
320 free(info->email); | |
321 free(info->homecity); | |
322 free(info->homestate); | |
323 free(info->homephone); | |
324 free(info->homefax); | |
325 free(info->homeaddr); | |
326 free(info->mobile); | |
327 free(info->homezip); | |
328 free(info->personalwebpage); | |
4625 | 329 if (info->email2) |
330 for (i = 0; i < info->numaddresses; i++) | |
331 free(info->email2[i]); | |
4624 | 332 free(info->email2); |
333 free(info->workcity); | |
334 free(info->workstate); | |
335 free(info->workphone); | |
336 free(info->workfax); | |
337 free(info->workaddr); | |
338 free(info->workzip); | |
339 free(info->workcompany); | |
340 free(info->workdivision); | |
341 free(info->workposition); | |
342 free(info->workwebpage); | |
343 free(info->info); | |
344 free(info); | |
345 } | |
346 | |
4617 | 347 /** |
348 * Subtype 0x0003 - Response to 0x0015/0x002, contains an ICQesque packet. | |
2703 | 349 */ |
350 static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | |
351 { | |
352 int ret = 0; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
353 aim_tlvlist_t *tl; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
354 aim_tlv_t *datatlv; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
355 aim_bstream_t qbs; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
356 fu32_t ouruin; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
357 fu16_t cmdlen, cmd, reqid; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
358 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
359 if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) { |
2733
eeac6ea7ade6
[gaim-migrate @ 2746]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2732
diff
changeset
|
360 aim_freetlvchain(&tl); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
361 faimdprintf(sess, 0, "corrupt ICQ response\n"); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
362 return 0; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
363 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
364 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
365 aim_bstream_init(&qbs, datatlv->value, datatlv->length); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
366 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
367 cmdlen = aimbs_getle16(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
368 ouruin = aimbs_getle32(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
369 cmd = aimbs_getle16(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
370 reqid = aimbs_getle16(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
371 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
372 faimdprintf(sess, 1, "icq response: %d bytes, %ld, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid); |
2703 | 373 |
4075 | 374 if (cmd == 0x0041) { /* offline message */ |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
375 struct aim_icq_offlinemsg msg; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
376 aim_rxcallback_t userfunc; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
377 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
378 memset(&msg, 0, sizeof(msg)); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
379 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
380 msg.sender = aimbs_getle32(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
381 msg.year = aimbs_getle16(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
382 msg.month = aimbs_getle8(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
383 msg.day = aimbs_getle8(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
384 msg.hour = aimbs_getle8(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
385 msg.minute = aimbs_getle8(&qbs); |
4173 | 386 msg.type = aimbs_getle8(&qbs); |
387 msg.flags = aimbs_getle8(&qbs); | |
4076 | 388 msg.msglen = aimbs_getle16(&qbs); |
389 msg.msg = aimbs_getstr(&qbs, msg.msglen); | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
390 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
391 if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG))) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
392 ret = userfunc(sess, rx, &msg); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
393 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
394 free(msg.msg); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
395 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
396 } else if (cmd == 0x0042) { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
397 aim_rxcallback_t userfunc; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
398 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
399 if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE))) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
400 ret = userfunc(sess, rx); |
4151 | 401 |
402 } else if (cmd == 0x07da) { /* information */ | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
403 fu16_t subtype; |
4151 | 404 struct aim_icq_info *info; |
405 aim_rxcallback_t userfunc; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
406 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
407 subtype = aimbs_getle16(&qbs); |
4151 | 408 aim_bstream_advance(&qbs, 1); /* 0x0a */ |
409 | |
4624 | 410 /* find other data from the same request */ |
411 for (info = sess->icq_info; info && (info->reqid != reqid); info = info->next); | |
412 if (!info) { | |
413 info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); | |
414 info->reqid = reqid; | |
415 info->next = sess->icq_info; | |
416 sess->icq_info = info; | |
417 } | |
418 | |
4151 | 419 switch (subtype) { |
4664 | 420 case 0x00a0: { /* hide ip status */ |
421 /* nothing */ | |
422 } break; | |
423 | |
4617 | 424 case 0x00aa: { /* password change status */ |
4664 | 425 /* nothing */ |
4617 | 426 } break; |
427 | |
4624 | 428 case 0x00c8: { /* general and "home" information */ |
4151 | 429 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
430 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
431 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4624 | 432 info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
4151 | 433 info->homecity = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
434 info->homestate = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4624 | 435 info->homephone = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
436 info->homefax = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4151 | 437 info->homeaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
4624 | 438 info->mobile = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
4151 | 439 info->homezip = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
440 info->homecountry = aimbs_getle16(&qbs); | |
4625 | 441 /* 0x0a 00 02 00 */ |
442 /* 1 byte timezone? */ | |
443 /* 1 byte hide email flag? */ | |
4151 | 444 } break; |
445 | |
4624 | 446 case 0x00dc: { /* personal information */ |
447 info->age = aimbs_getle8(&qbs); | |
448 info->unknown = aimbs_getle8(&qbs); | |
449 info->gender = aimbs_getle8(&qbs); | |
4151 | 450 info->personalwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
4624 | 451 info->birthyear = aimbs_getle16(&qbs); |
452 info->birthmonth = aimbs_getle8(&qbs); | |
453 info->birthday = aimbs_getle8(&qbs); | |
454 info->language1 = aimbs_getle8(&qbs); | |
455 info->language2 = aimbs_getle8(&qbs); | |
456 info->language3 = aimbs_getle8(&qbs); | |
4625 | 457 /* 0x00 00 01 00 00 01 00 00 00 00 00 */ |
4151 | 458 } break; |
459 | |
460 case 0x00d2: { /* work information */ | |
461 info->workcity = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
462 info->workstate = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4624 | 463 info->workphone = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
464 info->workfax = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4151 | 465 info->workaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
466 info->workzip = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
467 info->workcountry = aimbs_getle16(&qbs); | |
468 info->workcompany = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
469 info->workdivision = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
470 info->workposition = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4625 | 471 aim_bstream_advance(&qbs, 2); /* 0x01 00 */ |
4151 | 472 info->workwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
473 } break; | |
474 | |
475 case 0x00e6: { /* additional personal information */ | |
4624 | 476 info->info = aimbs_getstr(&qbs, aimbs_getle16(&qbs)-1); |
477 } break; | |
478 | |
479 case 0x00eb: { /* email address(es) */ | |
4625 | 480 int i; |
4624 | 481 info->numaddresses = aimbs_getle16(&qbs); |
4625 | 482 info->email2 = (char **)calloc(info->numaddresses, sizeof(char *)); |
483 for (i = 0; i < info->numaddresses; i++) { | |
484 info->email2[i] = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
485 if (i+1 != info->numaddresses) | |
486 aim_bstream_advance(&qbs, 1); /* 0x00 */ | |
487 } | |
4151 | 488 } break; |
489 | |
490 case 0x00f0: { /* personal interests */ | |
491 } break; | |
492 | |
493 case 0x00fa: { /* past background and current organizations */ | |
494 } break; | |
495 | |
4759 | 496 case 0x0104: { /* alias info */ |
497 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
498 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
499 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
500 aim_bstream_advance(&qbs, aimbs_getle16(&qbs)); /* email address? */ | |
501 /* Then 0x00 02 00 */ | |
502 } break; | |
503 | |
4151 | 504 case 0x010e: { /* unknown */ |
4625 | 505 /* 0x00 00 */ |
4151 | 506 } break; |
507 | |
508 case 0x019a: { /* simple info */ | |
509 aim_bstream_advance(&qbs, 2); | |
510 info->uin = aimbs_getle32(&qbs); | |
511 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
512 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
513 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
514 info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4154 | 515 /* Then 0x00 02 00 00 00 00 00 */ |
4151 | 516 } break; |
517 } /* End switch statement */ | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
518 |
4624 | 519 if (!(snac->flags & 0x0001)) { |
4784 | 520 if (subtype != 0x0104) |
4759 | 521 if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO))) |
522 ret = userfunc(sess, rx, info); | |
523 | |
524 if (info->uin && info->nick) | |
525 if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS))) | |
526 ret = userfunc(sess, rx, info); | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
527 |
4624 | 528 if (sess->icq_info == info) { |
529 sess->icq_info = info->next; | |
530 } else { | |
531 struct aim_icq_info *cur; | |
532 for (cur=sess->icq_info; (cur->next && (cur->next!=info)); cur=cur->next); | |
533 if (cur->next) | |
534 cur->next = cur->next->next; | |
535 } | |
536 aim_icq_freeinfo(info); | |
537 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
538 } |
2703 | 539 |
2732
efa3e7115cb5
[gaim-migrate @ 2745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2731
diff
changeset
|
540 aim_freetlvchain(&tl); |
2731
e9e624d8803e
[gaim-migrate @ 2744]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
541 |
2703 | 542 return ret; |
543 } | |
544 | |
545 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | |
546 { | |
547 | |
548 if (snac->subtype == 0x0003) | |
549 return icqresponse(sess, mod, rx, snac, bs); | |
550 | |
551 return 0; | |
552 } | |
553 | |
4830 | 554 static void icq_shutdown(aim_session_t *sess, aim_module_t *mod) |
555 { | |
556 struct aim_icq_info *del; | |
557 | |
558 while (sess->icq_info) { | |
559 del = sess->icq_info; | |
560 sess->icq_info = sess->icq_info->next; | |
561 aim_icq_freeinfo(del); | |
562 } | |
563 | |
564 return; | |
565 } | |
566 | |
2703 | 567 faim_internal int icq_modfirst(aim_session_t *sess, aim_module_t *mod) |
568 { | |
569 | |
570 mod->family = 0x0015; | |
571 mod->version = 0x0001; | |
572 mod->toolid = 0x0110; | |
4071 | 573 mod->toolversion = 0x047c; |
2703 | 574 mod->flags = 0; |
575 strncpy(mod->name, "icq", sizeof(mod->name)); | |
576 mod->snachandler = snachandler; | |
4830 | 577 mod->shutdown = icq_shutdown; |
2703 | 578 |
579 return 0; | |
580 } |