Mercurial > pidgin.yaz
annotate src/protocols/oscar/icq.c @ 4735:66c2388046fb
[gaim-migrate @ 5050]
This patch is from Ka-Hing Cheung. It readds tooltips and the hand cursor
for GtkIMHtml links.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 13 Mar 2003 06:56:40 +0000 |
parents | eab1309693b8 |
children | 1762496d502a |
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 |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
192 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
|
193 { |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
194 aim_conn_t *conn; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
195 aim_frame_t *fr; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
196 aim_snacid_t snacid; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
197 int bslen; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
198 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
199 if (!uin || uin[0] < '0' || uin[0] > '9') |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
200 return -EINVAL; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
201 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
202 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
203 return -EINVAL; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
204 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
205 bslen = 2 + 4 + 2 + 2 + 2 + 4; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
206 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
207 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
|
208 return -ENOMEM; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
209 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
210 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
211 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
212 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
213 /* For simplicity, don't bother using a tlvlist */ |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
214 aimbs_put16(&fr->data, 0x0001); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
215 aimbs_put16(&fr->data, bslen); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
216 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
217 aimbs_putle16(&fr->data, bslen - 2); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
218 aimbs_putle32(&fr->data, atoi(sess->sn)); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
219 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
220 aimbs_putle16(&fr->data, snacid); /* eh. */ |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
221 aimbs_putle16(&fr->data, 0x051f); /* shrug. */ |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
222 aimbs_putle32(&fr->data, atoi(uin)); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
223 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
224 aim_tx_enqueue(sess, fr); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
225 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
226 return 0; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
227 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
228 |
4617 | 229 faim_export int aim_icq_sendxmlreq(aim_session_t *sess, const char *xml) |
4151 | 230 { |
231 aim_conn_t *conn; | |
232 aim_frame_t *fr; | |
233 aim_snacid_t snacid; | |
234 int bslen; | |
235 | |
4617 | 236 if (!xml || !strlen(xml)) |
4151 | 237 return -EINVAL; |
238 | |
239 if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) | |
240 return -EINVAL; | |
241 | |
4617 | 242 bslen = 2 + 10 + 2 + strlen(xml) + 1; |
4151 | 243 |
244 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) | |
245 return -ENOMEM; | |
246 | |
247 snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); | |
248 aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); | |
249 | |
250 /* For simplicity, don't bother using a tlvlist */ | |
251 aimbs_put16(&fr->data, 0x0001); | |
252 aimbs_put16(&fr->data, bslen); | |
253 | |
254 aimbs_putle16(&fr->data, bslen - 2); | |
255 aimbs_putle32(&fr->data, atoi(sess->sn)); | |
256 aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ | |
257 aimbs_putle16(&fr->data, snacid); /* eh. */ | |
4617 | 258 aimbs_putle16(&fr->data, 0x0998); /* shrug. */ |
259 aimbs_putle16(&fr->data, strlen(xml) + 1); | |
260 aimbs_putraw(&fr->data, xml, strlen(xml) + 1); | |
4151 | 261 |
262 aim_tx_enqueue(sess, fr); | |
263 | |
264 return 0; | |
265 } | |
266 | |
4624 | 267 static void aim_icq_freeinfo(struct aim_icq_info *info) { |
4625 | 268 int i; |
269 | |
4624 | 270 if (!info) |
271 return; | |
272 free(info->nick); | |
273 free(info->first); | |
274 free(info->last); | |
275 free(info->email); | |
276 free(info->homecity); | |
277 free(info->homestate); | |
278 free(info->homephone); | |
279 free(info->homefax); | |
280 free(info->homeaddr); | |
281 free(info->mobile); | |
282 free(info->homezip); | |
283 free(info->personalwebpage); | |
4625 | 284 if (info->email2) |
285 for (i = 0; i < info->numaddresses; i++) | |
286 free(info->email2[i]); | |
4624 | 287 free(info->email2); |
288 free(info->workcity); | |
289 free(info->workstate); | |
290 free(info->workphone); | |
291 free(info->workfax); | |
292 free(info->workaddr); | |
293 free(info->workzip); | |
294 free(info->workcompany); | |
295 free(info->workdivision); | |
296 free(info->workposition); | |
297 free(info->workwebpage); | |
298 free(info->info); | |
299 free(info); | |
300 } | |
301 | |
4617 | 302 /** |
303 * Subtype 0x0003 - Response to 0x0015/0x002, contains an ICQesque packet. | |
2703 | 304 */ |
305 static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | |
306 { | |
307 int ret = 0; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
308 aim_tlvlist_t *tl; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
309 aim_tlv_t *datatlv; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
310 aim_bstream_t qbs; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
311 fu32_t ouruin; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
312 fu16_t cmdlen, cmd, reqid; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
313 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
314 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
|
315 aim_freetlvchain(&tl); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
316 faimdprintf(sess, 0, "corrupt ICQ response\n"); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
317 return 0; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
318 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
319 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
320 aim_bstream_init(&qbs, datatlv->value, datatlv->length); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
321 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
322 cmdlen = aimbs_getle16(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
323 ouruin = aimbs_getle32(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
324 cmd = aimbs_getle16(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
325 reqid = aimbs_getle16(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
326 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
327 faimdprintf(sess, 1, "icq response: %d bytes, %ld, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid); |
2703 | 328 |
4075 | 329 if (cmd == 0x0041) { /* offline message */ |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
330 struct aim_icq_offlinemsg msg; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
331 aim_rxcallback_t userfunc; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
332 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
333 memset(&msg, 0, sizeof(msg)); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
334 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
335 msg.sender = aimbs_getle32(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
336 msg.year = aimbs_getle16(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
337 msg.month = aimbs_getle8(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
338 msg.day = aimbs_getle8(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
339 msg.hour = aimbs_getle8(&qbs); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
340 msg.minute = aimbs_getle8(&qbs); |
4173 | 341 msg.type = aimbs_getle8(&qbs); |
342 msg.flags = aimbs_getle8(&qbs); | |
4076 | 343 msg.msglen = aimbs_getle16(&qbs); |
344 msg.msg = aimbs_getstr(&qbs, msg.msglen); | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
345 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
346 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
|
347 ret = userfunc(sess, rx, &msg); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
348 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
349 free(msg.msg); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
350 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
351 } else if (cmd == 0x0042) { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
352 aim_rxcallback_t userfunc; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
353 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
354 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
|
355 ret = userfunc(sess, rx); |
4151 | 356 |
357 } else if (cmd == 0x07da) { /* information */ | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
358 fu16_t subtype; |
4151 | 359 struct aim_icq_info *info; |
360 aim_rxcallback_t userfunc; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
361 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
362 subtype = aimbs_getle16(&qbs); |
4151 | 363 aim_bstream_advance(&qbs, 1); /* 0x0a */ |
364 | |
4624 | 365 /* find other data from the same request */ |
366 for (info = sess->icq_info; info && (info->reqid != reqid); info = info->next); | |
367 if (!info) { | |
368 info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); | |
369 info->reqid = reqid; | |
370 info->next = sess->icq_info; | |
371 sess->icq_info = info; | |
372 } | |
373 | |
4151 | 374 switch (subtype) { |
4664 | 375 case 0x00a0: { /* hide ip status */ |
376 /* nothing */ | |
377 } break; | |
378 | |
4617 | 379 case 0x00aa: { /* password change status */ |
4664 | 380 /* nothing */ |
4617 | 381 } break; |
382 | |
4624 | 383 case 0x00c8: { /* general and "home" information */ |
4151 | 384 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
385 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
386 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4624 | 387 info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
4151 | 388 info->homecity = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
389 info->homestate = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4624 | 390 info->homephone = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
391 info->homefax = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4151 | 392 info->homeaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
4624 | 393 info->mobile = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
4151 | 394 info->homezip = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
395 info->homecountry = aimbs_getle16(&qbs); | |
4625 | 396 /* 0x0a 00 02 00 */ |
397 /* 1 byte timezone? */ | |
398 /* 1 byte hide email flag? */ | |
4151 | 399 } break; |
400 | |
4624 | 401 case 0x00dc: { /* personal information */ |
402 info->age = aimbs_getle8(&qbs); | |
403 info->unknown = aimbs_getle8(&qbs); | |
404 info->gender = aimbs_getle8(&qbs); | |
4151 | 405 info->personalwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
4624 | 406 info->birthyear = aimbs_getle16(&qbs); |
407 info->birthmonth = aimbs_getle8(&qbs); | |
408 info->birthday = aimbs_getle8(&qbs); | |
409 info->language1 = aimbs_getle8(&qbs); | |
410 info->language2 = aimbs_getle8(&qbs); | |
411 info->language3 = aimbs_getle8(&qbs); | |
4625 | 412 /* 0x00 00 01 00 00 01 00 00 00 00 00 */ |
4151 | 413 } break; |
414 | |
415 case 0x00d2: { /* work information */ | |
416 info->workcity = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
417 info->workstate = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4624 | 418 info->workphone = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
419 info->workfax = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4151 | 420 info->workaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
421 info->workzip = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
422 info->workcountry = aimbs_getle16(&qbs); | |
423 info->workcompany = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
424 info->workdivision = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
425 info->workposition = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4625 | 426 aim_bstream_advance(&qbs, 2); /* 0x01 00 */ |
4151 | 427 info->workwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
428 } break; | |
429 | |
430 case 0x00e6: { /* additional personal information */ | |
4624 | 431 info->info = aimbs_getstr(&qbs, aimbs_getle16(&qbs)-1); |
432 } break; | |
433 | |
434 case 0x00eb: { /* email address(es) */ | |
4625 | 435 int i; |
4624 | 436 info->numaddresses = aimbs_getle16(&qbs); |
4625 | 437 info->email2 = (char **)calloc(info->numaddresses, sizeof(char *)); |
438 for (i = 0; i < info->numaddresses; i++) { | |
439 info->email2[i] = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
440 if (i+1 != info->numaddresses) | |
441 aim_bstream_advance(&qbs, 1); /* 0x00 */ | |
442 } | |
4151 | 443 } break; |
444 | |
445 case 0x00f0: { /* personal interests */ | |
446 } break; | |
447 | |
448 case 0x00fa: { /* past background and current organizations */ | |
449 } break; | |
450 | |
451 case 0x010e: { /* unknown */ | |
4625 | 452 /* 0x00 00 */ |
4151 | 453 } break; |
454 | |
455 case 0x019a: { /* simple info */ | |
456 aim_bstream_advance(&qbs, 2); | |
457 info->uin = aimbs_getle32(&qbs); | |
458 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
459 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
460 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
461 info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); | |
4154 | 462 /* Then 0x00 02 00 00 00 00 00 */ |
4151 | 463 } break; |
464 } /* End switch statement */ | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
465 |
4624 | 466 if (!(snac->flags & 0x0001)) { |
467 if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO))) | |
4151 | 468 ret = userfunc(sess, rx, info); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2733
diff
changeset
|
469 |
4624 | 470 if (sess->icq_info == info) { |
471 sess->icq_info = info->next; | |
472 } else { | |
473 struct aim_icq_info *cur; | |
474 for (cur=sess->icq_info; (cur->next && (cur->next!=info)); cur=cur->next); | |
475 if (cur->next) | |
476 cur->next = cur->next->next; | |
477 } | |
478 aim_icq_freeinfo(info); | |
479 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2703
diff
changeset
|
480 } |
2703 | 481 |
2732
efa3e7115cb5
[gaim-migrate @ 2745]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2731
diff
changeset
|
482 aim_freetlvchain(&tl); |
2731
e9e624d8803e
[gaim-migrate @ 2744]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
483 |
2703 | 484 return ret; |
485 } | |
486 | |
487 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) | |
488 { | |
489 | |
490 if (snac->subtype == 0x0003) | |
491 return icqresponse(sess, mod, rx, snac, bs); | |
492 | |
493 return 0; | |
494 } | |
495 | |
496 faim_internal int icq_modfirst(aim_session_t *sess, aim_module_t *mod) | |
497 { | |
498 | |
499 mod->family = 0x0015; | |
500 mod->version = 0x0001; | |
501 mod->toolid = 0x0110; | |
4071 | 502 mod->toolversion = 0x047c; |
2703 | 503 mod->flags = 0; |
504 strncpy(mod->name, "icq", sizeof(mod->name)); | |
505 mod->snachandler = snachandler; | |
506 | |
507 return 0; | |
508 } |