X-Git-Url: http://andersk.mit.edu/gitweb/libfaim.git/blobdiff_plain/a15d82b1157e91e0c5d05170323796d1e7557ad8..89bce17768d14f77b0a3fa612d56372f3b6ded5c:/aim_info.c diff --git a/aim_info.c b/aim_info.c index 8b23757..0abbcf5 100644 --- a/aim_info.c +++ b/aim_info.c @@ -313,6 +313,37 @@ faim_internal int aim_extractuserinfo(u_char *buf, struct aim_userinfo_s *outinf outinfo->idletime = aimutil_get16(&buf[i+4]); break; + /* + * Type = 0x0006: ICQ Online Status + * + * ICQ's Away/DND/etc "enriched" status + * Some decoding of values done by Scott + */ + case 0x0006: + outinfo->icqinfo.status = aimutil_get16(buf+i+2+2+2); + break; + + + /* + * Type = 0x000a + * + * ICQ User IP Address. + * Ahh, the joy of ICQ security. + */ + case 0x000a: + outinfo->icqinfo.ipaddr = aimutil_get32(&buf[i+4]); + break; + + /* Type = 0x000c + * + * random crap containing the IP address, + * apparently a port number, and some Other Stuff. + * + */ + case 0x000c: + memcpy(outinfo->icqinfo.crap, &buf[i+4], 0x25); + break; + /* * Type = 0x000d * @@ -550,7 +581,7 @@ faim_internal int aim_parse_userinfo_middle(struct aim_session_t *sess, */ faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info) { - int i = 0; + int i = 0, numtlv = 0; struct aim_tlvlist_t *tlvlist = NULL; if (!buf || !info) @@ -561,18 +592,36 @@ faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s i += aimutil_put16(buf+i, info->warnlevel); - /* XXX: we only put down five */ - i += aimutil_put16(buf+i, 5); + aim_addtlvtochain16(&tlvlist, 0x0001, info->flags); + numtlv++; + aim_addtlvtochain32(&tlvlist, 0x0002, info->membersince); + numtlv++; + aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince); + numtlv++; + aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime); - /* XXX: should put caps here */ + numtlv++; + +#if ICQ_OSCAR_SUPPORT + if(atoi(info->sn) != 0) { + aim_addtlvtochain16(&tlvlist, 0x0006, info->icqinfo.status); + aim_addtlvtochain32(&tlvlist, 0x000a, info->icqinfo.ipaddr); + } +#endif + + aim_addtlvtochain_caps(&tlvlist, 0x000d, info->capabilities); + numtlv++; + aim_addtlvtochain32(&tlvlist, (unsigned short)((info->flags)&AIM_FLAG_AOL?0x0010:0x000f), info->sessionlen); - - i += aim_writetlvchain(buf+i, buflen-i, &tlvlist); + numtlv++; + + i += aimutil_put16(buf+i, numtlv); /* tlvcount */ + i += aim_writetlvchain(buf+i, buflen-i, &tlvlist); /* tlvs */ aim_freetlvchain(&tlvlist); - + return i; }