Ejemplo n.º 1
0
void ICQClient::sendCapability()
{
    Buffer cap;
    capability c;
    memcpy(c, capabilities[CAP_SIM], sizeof(c));
    const char *ver = VERSION;
    unsigned char *pack_ver = c + sizeof(capability) - 4;
    *(pack_ver++) = get_ver(ver);
    *(pack_ver++) = get_ver(ver);
    *(pack_ver++) = get_ver(ver);
    unsigned char os_ver;
#ifdef WIN32
    os_ver = 0x80;
#else
    os_ver = 0;
#endif
    *(pack_ver++) = os_ver;
    cap.pack((char*)capabilities[CAP_DIRECT], sizeof(capability));
    cap.pack((char*)capabilities[CAP_SRV_RELAY], sizeof(capability));
	if (getSendFormat() <= 1)
		cap.pack((char*)capabilities[CAP_UTF], sizeof(capability));
	if (getSendFormat() == 0)
		cap.pack((char*)capabilities[CAP_RTF], sizeof(capability));
	if (getTypingNotification())
		cap.pack((char*)capabilities[CAP_TYPING], sizeof(capability));
    cap.pack((char*)c, sizeof(c));
    snac(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_SETxUSERxINFO);
    m_socket->writeBuffer.tlv(0x0005, cap);
    sendPacket();
}
Ejemplo n.º 2
0
void ICQClient::sendCapability(const char *away_msg)
{
    Buffer cap;
    capability c;
    memcpy(c, capabilities[CAP_SIM], sizeof(c));
    const char *ver = VERSION;
    unsigned char *pack_ver = c + sizeof(capability) - 4;
    *(pack_ver++) = get_ver(ver);
    *(pack_ver++) = get_ver(ver);
    *(pack_ver++) = get_ver(ver);
    unsigned char os_ver;
#ifdef WIN32
    os_ver = 0x80;
#else
#ifdef QT_MACOSX_VERSION
    os_ver = 0x40;
#else
    os_ver = 0;
#endif
#endif
    *(pack_ver++) = os_ver;
    if (m_bAIM) {
        cap.pack((char*)capabilities[CAP_AIM_CHAT], sizeof(capability));
        cap.pack((char*)capabilities[CAP_AIM_BUDDYCON], sizeof(capability));
        cap.pack((char*)capabilities[CAP_AIM_IMIMAGE], sizeof(capability));
        cap.pack((char*)capabilities[CAP_AIM_SENDFILE], sizeof(capability));
        cap.pack((char*)capabilities[CAP_AIM_BUDDYLIST], sizeof(capability));
    } else {
        cap.pack((char*)capabilities[CAP_DIRECT], sizeof(capability));
        cap.pack((char*)capabilities[CAP_SRV_RELAY], sizeof(capability));
        if (getSendFormat() <= 1)
            cap.pack((char*)capabilities[CAP_UTF], sizeof(capability));
        if (getSendFormat() == 0)
            cap.pack((char*)capabilities[CAP_RTF], sizeof(capability));
    }
    if (getTypingNotification())
        cap.pack((char*)capabilities[CAP_TYPING], sizeof(capability));
    cap.pack((char*)capabilities[CAP_AIM_SUPPORT], sizeof(capability));
    cap.pack((char*)c, sizeof(c));
    snac(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_SETxUSERxINFO);
    if (m_bAIM) {
        if (data.owner.ProfileFetch.bValue) {
            QString profile;
            if (data.owner.About.ptr)
                profile = QString::fromUtf8(data.owner.About.ptr);
            profile = QString("<HTML>") + profile + "</HTML>";
            encodeString(profile, "text/aolrtf", 1, 2);
        }
        if (away_msg)
            encodeString(QString::fromUtf8(away_msg), "text/plain", 3, 4);
    }
    m_socket->writeBuffer.tlv(0x0005, cap);
    if (m_bAIM)
        m_socket->writeBuffer.tlv(0x0006, "\x00\x04\x00\x02\x00\x02", 6);
    sendPacket();
}