[b7d3cc34] | 1 | /* |
---|
| 2 | * Encapsulated ICQ. |
---|
| 3 | * |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #include <aim.h> |
---|
| 7 | #include "icq.h" |
---|
| 8 | |
---|
| 9 | int aim_icq_reqofflinemsgs(aim_session_t *sess) |
---|
| 10 | { |
---|
| 11 | aim_conn_t *conn; |
---|
| 12 | aim_frame_t *fr; |
---|
| 13 | aim_snacid_t snacid; |
---|
| 14 | int bslen; |
---|
| 15 | |
---|
| 16 | if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
---|
| 17 | return -EINVAL; |
---|
| 18 | |
---|
| 19 | bslen = 2 + 4 + 2 + 2; |
---|
| 20 | |
---|
| 21 | if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
---|
| 22 | return -ENOMEM; |
---|
| 23 | |
---|
| 24 | snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
---|
| 25 | aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
---|
| 26 | |
---|
| 27 | /* For simplicity, don't bother using a tlvlist */ |
---|
| 28 | aimbs_put16(&fr->data, 0x0001); |
---|
| 29 | aimbs_put16(&fr->data, bslen); |
---|
| 30 | |
---|
| 31 | aimbs_putle16(&fr->data, bslen - 2); |
---|
| 32 | aimbs_putle32(&fr->data, atoi(sess->sn)); |
---|
| 33 | aimbs_putle16(&fr->data, 0x003c); /* I command thee. */ |
---|
| 34 | aimbs_putle16(&fr->data, snacid); /* eh. */ |
---|
| 35 | |
---|
| 36 | aim_tx_enqueue(sess, fr); |
---|
| 37 | |
---|
| 38 | return 0; |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | int aim_icq_ackofflinemsgs(aim_session_t *sess) |
---|
| 42 | { |
---|
| 43 | aim_conn_t *conn; |
---|
| 44 | aim_frame_t *fr; |
---|
| 45 | aim_snacid_t snacid; |
---|
| 46 | int bslen; |
---|
| 47 | |
---|
| 48 | if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
---|
| 49 | return -EINVAL; |
---|
| 50 | |
---|
| 51 | bslen = 2 + 4 + 2 + 2; |
---|
| 52 | |
---|
| 53 | if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
---|
| 54 | return -ENOMEM; |
---|
| 55 | |
---|
| 56 | snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
---|
| 57 | aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
---|
| 58 | |
---|
| 59 | /* For simplicity, don't bother using a tlvlist */ |
---|
| 60 | aimbs_put16(&fr->data, 0x0001); |
---|
| 61 | aimbs_put16(&fr->data, bslen); |
---|
| 62 | |
---|
| 63 | aimbs_putle16(&fr->data, bslen - 2); |
---|
| 64 | aimbs_putle32(&fr->data, atoi(sess->sn)); |
---|
| 65 | aimbs_putle16(&fr->data, 0x003e); /* I command thee. */ |
---|
| 66 | aimbs_putle16(&fr->data, snacid); /* eh. */ |
---|
| 67 | |
---|
| 68 | aim_tx_enqueue(sess, fr); |
---|
| 69 | |
---|
| 70 | return 0; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | int aim_icq_sendxmlreq(aim_session_t *sess, const char *xml) |
---|
| 74 | { |
---|
| 75 | aim_conn_t *conn; |
---|
| 76 | aim_frame_t *fr; |
---|
| 77 | aim_snacid_t snacid; |
---|
| 78 | int bslen; |
---|
| 79 | |
---|
| 80 | if (!xml || !strlen(xml)) |
---|
| 81 | return -EINVAL; |
---|
| 82 | |
---|
| 83 | if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
---|
| 84 | return -EINVAL; |
---|
| 85 | |
---|
| 86 | bslen = 2 + 10 + 2 + strlen(xml) + 1; |
---|
| 87 | |
---|
| 88 | if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
---|
| 89 | return -ENOMEM; |
---|
| 90 | |
---|
| 91 | snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
---|
| 92 | aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
---|
| 93 | |
---|
| 94 | /* For simplicity, don't bother using a tlvlist */ |
---|
| 95 | aimbs_put16(&fr->data, 0x0001); |
---|
| 96 | aimbs_put16(&fr->data, bslen); |
---|
| 97 | |
---|
| 98 | aimbs_putle16(&fr->data, bslen - 2); |
---|
| 99 | aimbs_putle32(&fr->data, atoi(sess->sn)); |
---|
| 100 | aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ |
---|
| 101 | aimbs_putle16(&fr->data, snacid); /* eh. */ |
---|
| 102 | aimbs_putle16(&fr->data, 0x0998); /* shrug. */ |
---|
| 103 | aimbs_putle16(&fr->data, strlen(xml) + 1); |
---|
| 104 | aimbs_putraw(&fr->data, (guint8 *)xml, strlen(xml) + 1); |
---|
| 105 | |
---|
| 106 | aim_tx_enqueue(sess, fr); |
---|
| 107 | |
---|
| 108 | return 0; |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | int aim_icq_getallinfo(aim_session_t *sess, const char *uin) |
---|
| 112 | { |
---|
| 113 | aim_conn_t *conn; |
---|
| 114 | aim_frame_t *fr; |
---|
| 115 | aim_snacid_t snacid; |
---|
| 116 | int bslen; |
---|
| 117 | struct aim_icq_info *info; |
---|
| 118 | |
---|
| 119 | if (!uin || uin[0] < '0' || uin[0] > '9') |
---|
| 120 | return -EINVAL; |
---|
| 121 | |
---|
| 122 | if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
---|
| 123 | return -EINVAL; |
---|
| 124 | |
---|
| 125 | bslen = 2 + 4 + 2 + 2 + 2 + 4; |
---|
| 126 | |
---|
| 127 | if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
---|
| 128 | return -ENOMEM; |
---|
| 129 | |
---|
| 130 | snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
---|
| 131 | aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
---|
| 132 | |
---|
| 133 | /* For simplicity, don't bother using a tlvlist */ |
---|
| 134 | aimbs_put16(&fr->data, 0x0001); |
---|
| 135 | aimbs_put16(&fr->data, bslen); |
---|
| 136 | |
---|
| 137 | aimbs_putle16(&fr->data, bslen - 2); |
---|
| 138 | aimbs_putle32(&fr->data, atoi(sess->sn)); |
---|
| 139 | aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ |
---|
| 140 | aimbs_putle16(&fr->data, snacid); /* eh. */ |
---|
| 141 | aimbs_putle16(&fr->data, 0x04b2); /* shrug. */ |
---|
| 142 | aimbs_putle32(&fr->data, atoi(uin)); |
---|
| 143 | |
---|
| 144 | aim_tx_enqueue(sess, fr); |
---|
| 145 | |
---|
| 146 | /* Keep track of this request and the ICQ number and request ID */ |
---|
| 147 | info = g_new0(struct aim_icq_info, 1); |
---|
| 148 | info->reqid = snacid; |
---|
| 149 | info->uin = atoi(uin); |
---|
| 150 | info->next = sess->icq_info; |
---|
| 151 | sess->icq_info = info; |
---|
| 152 | |
---|
| 153 | return 0; |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin) |
---|
| 157 | { |
---|
| 158 | aim_conn_t *conn; |
---|
| 159 | aim_frame_t *fr; |
---|
| 160 | aim_snacid_t snacid; |
---|
| 161 | int bslen; |
---|
| 162 | |
---|
| 163 | if (!uin || uin[0] < '0' || uin[0] > '9') |
---|
| 164 | return -EINVAL; |
---|
| 165 | |
---|
| 166 | if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) |
---|
| 167 | return -EINVAL; |
---|
| 168 | |
---|
| 169 | bslen = 2 + 4 + 2 + 2 + 2 + 4; |
---|
| 170 | |
---|
| 171 | if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) |
---|
| 172 | return -ENOMEM; |
---|
| 173 | |
---|
| 174 | snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); |
---|
| 175 | aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); |
---|
| 176 | |
---|
| 177 | /* For simplicity, don't bother using a tlvlist */ |
---|
| 178 | aimbs_put16(&fr->data, 0x0001); |
---|
| 179 | aimbs_put16(&fr->data, bslen); |
---|
| 180 | |
---|
| 181 | aimbs_putle16(&fr->data, bslen - 2); |
---|
| 182 | aimbs_putle32(&fr->data, atoi(sess->sn)); |
---|
| 183 | aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ |
---|
| 184 | aimbs_putle16(&fr->data, snacid); /* eh. */ |
---|
| 185 | aimbs_putle16(&fr->data, 0x051f); /* shrug. */ |
---|
| 186 | aimbs_putle32(&fr->data, atoi(uin)); |
---|
| 187 | |
---|
| 188 | aim_tx_enqueue(sess, fr); |
---|
| 189 | |
---|
| 190 | return 0; |
---|
| 191 | } |
---|
| 192 | |
---|
| 193 | static void aim_icq_freeinfo(struct aim_icq_info *info) { |
---|
| 194 | int i; |
---|
| 195 | |
---|
| 196 | if (!info) |
---|
| 197 | return; |
---|
| 198 | g_free(info->nick); |
---|
| 199 | g_free(info->first); |
---|
| 200 | g_free(info->last); |
---|
| 201 | g_free(info->email); |
---|
| 202 | g_free(info->homecity); |
---|
| 203 | g_free(info->homestate); |
---|
| 204 | g_free(info->homephone); |
---|
| 205 | g_free(info->homefax); |
---|
| 206 | g_free(info->homeaddr); |
---|
| 207 | g_free(info->mobile); |
---|
| 208 | g_free(info->homezip); |
---|
| 209 | g_free(info->personalwebpage); |
---|
| 210 | if (info->email2) |
---|
| 211 | for (i = 0; i < info->numaddresses; i++) |
---|
| 212 | g_free(info->email2[i]); |
---|
| 213 | g_free(info->email2); |
---|
| 214 | g_free(info->workcity); |
---|
| 215 | g_free(info->workstate); |
---|
| 216 | g_free(info->workphone); |
---|
| 217 | g_free(info->workfax); |
---|
| 218 | g_free(info->workaddr); |
---|
| 219 | g_free(info->workzip); |
---|
| 220 | g_free(info->workcompany); |
---|
| 221 | g_free(info->workdivision); |
---|
| 222 | g_free(info->workposition); |
---|
| 223 | g_free(info->workwebpage); |
---|
| 224 | g_free(info->info); |
---|
| 225 | g_free(info); |
---|
| 226 | } |
---|
| 227 | |
---|
| 228 | /** |
---|
| 229 | * Subtype 0x0003 - Response to 0x0015/0x002, contains an ICQesque packet. |
---|
| 230 | */ |
---|
| 231 | static int icqresponse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
---|
| 232 | { |
---|
| 233 | int ret = 0; |
---|
| 234 | aim_tlvlist_t *tl; |
---|
| 235 | aim_tlv_t *datatlv; |
---|
| 236 | aim_bstream_t qbs; |
---|
[d18db32f] | 237 | guint16 cmd, reqid; |
---|
[b7d3cc34] | 238 | |
---|
| 239 | if (!(tl = aim_readtlvchain(bs)) || !(datatlv = aim_gettlv(tl, 0x0001, 1))) { |
---|
| 240 | aim_freetlvchain(&tl); |
---|
[84b045d] | 241 | imcb_error(sess->aux_data, "corrupt ICQ response\n"); |
---|
[b7d3cc34] | 242 | return 0; |
---|
| 243 | } |
---|
| 244 | |
---|
| 245 | aim_bstream_init(&qbs, datatlv->value, datatlv->length); |
---|
| 246 | |
---|
[d18db32f] | 247 | aimbs_getle16(&qbs); /* cmdlen */ |
---|
| 248 | aimbs_getle32(&qbs); /* ouruin */ |
---|
[b7d3cc34] | 249 | cmd = aimbs_getle16(&qbs); |
---|
| 250 | reqid = aimbs_getle16(&qbs); |
---|
| 251 | |
---|
| 252 | if (cmd == 0x0041) { /* offline message */ |
---|
| 253 | guint16 msglen; |
---|
| 254 | struct aim_icq_offlinemsg msg; |
---|
| 255 | aim_rxcallback_t userfunc; |
---|
| 256 | |
---|
| 257 | memset(&msg, 0, sizeof(msg)); |
---|
| 258 | |
---|
| 259 | msg.sender = aimbs_getle32(&qbs); |
---|
| 260 | msg.year = aimbs_getle16(&qbs); |
---|
| 261 | msg.month = aimbs_getle8(&qbs); |
---|
| 262 | msg.day = aimbs_getle8(&qbs); |
---|
| 263 | msg.hour = aimbs_getle8(&qbs); |
---|
| 264 | msg.minute = aimbs_getle8(&qbs); |
---|
| 265 | msg.type = aimbs_getle16(&qbs); |
---|
| 266 | msglen = aimbs_getle16(&qbs); |
---|
| 267 | msg.msg = aimbs_getstr(&qbs, msglen); |
---|
| 268 | |
---|
| 269 | if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG))) |
---|
| 270 | ret = userfunc(sess, rx, &msg); |
---|
| 271 | |
---|
| 272 | g_free(msg.msg); |
---|
| 273 | |
---|
| 274 | } else if (cmd == 0x0042) { |
---|
| 275 | aim_rxcallback_t userfunc; |
---|
| 276 | |
---|
| 277 | if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE))) |
---|
| 278 | ret = userfunc(sess, rx); |
---|
| 279 | } else if (cmd == 0x07da) { /* information */ |
---|
| 280 | guint16 subtype; |
---|
| 281 | struct aim_icq_info *info; |
---|
| 282 | aim_rxcallback_t userfunc; |
---|
| 283 | |
---|
| 284 | subtype = aimbs_getle16(&qbs); |
---|
| 285 | aim_bstream_advance(&qbs, 1); /* 0x0a */ |
---|
| 286 | |
---|
| 287 | /* find another data from the same request */ |
---|
| 288 | for (info = sess->icq_info; info && (info->reqid != reqid); info = info->next); |
---|
| 289 | |
---|
| 290 | if (!info) { |
---|
| 291 | info = g_new0(struct aim_icq_info, 1); |
---|
| 292 | info->reqid = reqid; |
---|
| 293 | info->next = sess->icq_info; |
---|
| 294 | sess->icq_info = info; |
---|
| 295 | } |
---|
| 296 | |
---|
| 297 | switch (subtype) { |
---|
| 298 | case 0x00a0: { /* hide ip status */ |
---|
| 299 | /* nothing */ |
---|
| 300 | } break; |
---|
| 301 | case 0x00aa: { /* password change status */ |
---|
| 302 | /* nothing */ |
---|
| 303 | } break; |
---|
| 304 | case 0x00c8: { /* general and "home" information */ |
---|
| 305 | info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 306 | info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 307 | info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 308 | info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 309 | info->homecity = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 310 | info->homestate = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 311 | info->homephone = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 312 | info->homefax = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 313 | info->homeaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 314 | info->mobile = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 315 | info->homezip = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 316 | info->homecountry = aimbs_getle16(&qbs); |
---|
| 317 | /* 0x0a 00 02 00 */ |
---|
| 318 | /* 1 byte timezone? */ |
---|
| 319 | /* 1 byte hide email flag? */ |
---|
| 320 | } break; |
---|
| 321 | case 0x00dc: { /* personal information */ |
---|
| 322 | info->age = aimbs_getle8(&qbs); |
---|
| 323 | info->unknown = aimbs_getle8(&qbs); |
---|
| 324 | info->gender = aimbs_getle8(&qbs); |
---|
| 325 | info->personalwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 326 | info->birthyear = aimbs_getle16(&qbs); |
---|
| 327 | info->birthmonth = aimbs_getle8(&qbs); |
---|
| 328 | info->birthday = aimbs_getle8(&qbs); |
---|
| 329 | info->language1 = aimbs_getle8(&qbs); |
---|
| 330 | info->language2 = aimbs_getle8(&qbs); |
---|
| 331 | info->language3 = aimbs_getle8(&qbs); |
---|
| 332 | /* 0x00 00 01 00 00 01 00 00 00 00 00 */ |
---|
| 333 | } break; |
---|
| 334 | case 0x00d2: { /* work information */ |
---|
| 335 | info->workcity = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 336 | info->workstate = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 337 | info->workphone = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 338 | info->workfax = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 339 | info->workaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 340 | info->workzip = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 341 | info->workcountry = aimbs_getle16(&qbs); |
---|
| 342 | info->workcompany = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 343 | info->workdivision = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 344 | info->workposition = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 345 | aim_bstream_advance(&qbs, 2); /* 0x01 00 */ |
---|
| 346 | info->workwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 347 | } break; |
---|
| 348 | case 0x00e6: { /* additional personal information */ |
---|
| 349 | info->info = aimbs_getstr(&qbs, aimbs_getle16(&qbs)-1); |
---|
| 350 | } break; |
---|
| 351 | case 0x00eb: { /* email address(es) */ |
---|
| 352 | int i; |
---|
| 353 | info->numaddresses = aimbs_getle16(&qbs); |
---|
| 354 | info->email2 = g_new0(char *, info->numaddresses); |
---|
| 355 | for (i = 0; i < info->numaddresses; i++) { |
---|
| 356 | info->email2[i] = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 357 | if (i+1 != info->numaddresses) |
---|
| 358 | aim_bstream_advance(&qbs, 1); /* 0x00 */ |
---|
| 359 | } |
---|
| 360 | } break; |
---|
| 361 | case 0x00f0: { /* personal interests */ |
---|
| 362 | } break; |
---|
| 363 | case 0x00fa: { /* past background and current organizations */ |
---|
| 364 | } break; |
---|
| 365 | case 0x0104: { /* alias info */ |
---|
| 366 | info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 367 | info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 368 | info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 369 | aim_bstream_advance(&qbs, aimbs_getle16(&qbs)); |
---|
| 370 | /* email address? */ |
---|
| 371 | /* Then 0x00 02 00 */ |
---|
| 372 | } break; |
---|
| 373 | case 0x010e: { /* unknown */ |
---|
| 374 | /* 0x00 00 */ |
---|
| 375 | } break; |
---|
| 376 | |
---|
| 377 | case 0x019a: { /* simple info */ |
---|
| 378 | aim_bstream_advance(&qbs, 2); |
---|
| 379 | info->uin = aimbs_getle32(&qbs); |
---|
| 380 | info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 381 | info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 382 | info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 383 | info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs)); |
---|
| 384 | /* Then 0x00 02 00 00 00 00 00 */ |
---|
| 385 | } break; |
---|
| 386 | } /* End switch statement */ |
---|
| 387 | |
---|
| 388 | |
---|
| 389 | if (!(snac->flags & 0x0001)) { |
---|
| 390 | if (subtype != 0x0104) |
---|
| 391 | if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO))) |
---|
| 392 | ret = userfunc(sess, rx, info); |
---|
| 393 | |
---|
| 394 | /* Bitlbee - not supported, yet |
---|
| 395 | if (info->uin && info->nick) |
---|
| 396 | if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS))) |
---|
| 397 | ret = userfunc(sess, rx, info); |
---|
| 398 | */ |
---|
| 399 | |
---|
| 400 | if (sess->icq_info == info) { |
---|
| 401 | sess->icq_info = info->next; |
---|
| 402 | } else { |
---|
| 403 | struct aim_icq_info *cur; |
---|
| 404 | for (cur=sess->icq_info; (cur->next && (cur->next!=info)); cur=cur->next); |
---|
| 405 | if (cur->next) |
---|
| 406 | cur->next = cur->next->next; |
---|
| 407 | } |
---|
| 408 | aim_icq_freeinfo(info); |
---|
| 409 | } |
---|
| 410 | } |
---|
| 411 | |
---|
| 412 | aim_freetlvchain(&tl); |
---|
| 413 | |
---|
| 414 | return ret; |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) |
---|
| 418 | { |
---|
| 419 | |
---|
| 420 | if (snac->subtype == 0x0003) |
---|
| 421 | return icqresponse(sess, mod, rx, snac, bs); |
---|
| 422 | |
---|
| 423 | return 0; |
---|
| 424 | } |
---|
| 425 | |
---|
| 426 | int icq_modfirst(aim_session_t *sess, aim_module_t *mod) |
---|
| 427 | { |
---|
| 428 | |
---|
| 429 | mod->family = 0x0015; |
---|
| 430 | mod->version = 0x0001; |
---|
| 431 | mod->toolid = 0x0110; |
---|
| 432 | mod->toolversion = 0x047c; |
---|
| 433 | mod->flags = 0; |
---|
| 434 | strncpy(mod->name, "icq", sizeof(mod->name)); |
---|
| 435 | mod->snachandler = snachandler; |
---|
| 436 | |
---|
| 437 | return 0; |
---|
| 438 | } |
---|
| 439 | |
---|
| 440 | |
---|