Beispiel #1
0
void ICQClient::sendRoster(ICQEvent *e,
                           unsigned short cmd, const char *name, unsigned short grp_id,
                           unsigned short usr_id, unsigned short subCmd, const char *alias, bool waitAuth)
{
    snac(ICQ_SNACxFAM_LISTS, cmd, true);
    string sName;
    if (name) sName = name;
    toUTF(sName);
    writeBuffer.pack(sName);
    writeBuffer
    << grp_id
    << usr_id
    << subCmd;
    if (alias){
        string sAlias = alias;
        toUTF(sAlias);
        unsigned short size = sAlias.length() + 4 + (waitAuth ? 4 : 0);
        writeBuffer
        << size
        << (unsigned short)0x0131;
        writeBuffer.pack(sAlias);
        if (waitAuth){
            writeBuffer
            << (unsigned short)0x66
            << (unsigned short)0;
        }
    }else{
        writeBuffer << (unsigned short)0;
    }
    sendPacket();
    e->m_nId = m_nMsgSequence - 1;
    listEvents.push_back(e);
}
Beispiel #2
0
void ICQClient::sendRosterGrp(const char *name, unsigned short grpId, unsigned short usrId)
{
    snac(ICQ_SNACxFAM_LISTS, ICQ_SNACxLISTS_RENAME, true);
    string sName = name;
    toUTF(sName);
    writeBuffer.pack(sName);
    writeBuffer
    << grpId
    << (unsigned long) ICQ_GROUPS;
    if (usrId){
        writeBuffer
        << (unsigned short) 6
        << (unsigned short) 0xC8
        << (unsigned short) 2
        << (unsigned short) usrId;
    }else{
        writeBuffer
        << (unsigned short) 4
        << (unsigned short) 0xC8
        << (unsigned short) 0;
    }
    sendPacket();
    MoveUserDummyEvent *e = new MoveUserDummyEvent;
    e->m_nId = m_nMsgSequence - 1;
    listEvents.push_back(e);
}
Beispiel #3
0
void ICQClient::processMsgQueueSMS()
{
    list<ICQEvent*>::iterator it;
    for (it = msgQueue.begin(); it != msgQueue.end();){
        ICQEvent *e = *it;
        if (e->message() == NULL){
            it++;
            continue;
        }
        if (e->message()->Type() != ICQ_MSGxSMS){
            it++;
            continue;
        }
        ICQSMS *msg = static_cast<ICQSMS*>(e->message());
        XmlBranch xmltree("icq_sms_message");
        string destination = "+";
        for (const char *p = msg->Phone.c_str(); *p; p++){
            if ((*p >= '0') && (*p <= '9'))
                destination += *p;
        }
        string text = clearHTML(msg->Message.c_str());
        toUTF(text);
        string sender = name(true);
        char uin[13];
        snprintf(uin, sizeof(uin), "%lu", Uin());
        xmltree.pushnode(new XmlLeaf("destination",destination));
        xmltree.pushnode(new XmlLeaf("text",text));
        xmltree.pushnode(new XmlLeaf("codepage","1252"));
        xmltree.pushnode(new XmlLeaf("encoding","urf8"));
        xmltree.pushnode(new XmlLeaf("senders_UIN",uin));
        xmltree.pushnode(new XmlLeaf("senders_name",sender));
        xmltree.pushnode(new XmlLeaf("delivery_receipt","Yes"));

        /* Time string, format: Wkd, DD Mnm YYYY HH:MM:SS TMZ */
        char timestr[30];
        time_t t;
        struct tm *tm;
        time(&t);
        tm = gmtime(&t);
        strftime(timestr, 30, "%a, %d %b %Y %T %Z", tm);
        xmltree.pushnode(new XmlLeaf("time",string(timestr)));
        string xmlstr = xmltree.toString(0);

        serverRequest(ICQ_SRVxREQ_MORE);
        writeBuffer << ICQ_SRVxREQ_SEND_SMS
        << 0x00010016L << 0x00000000L << 0x00000000L
        << 0x00000000L << 0x00000000L << (unsigned long)(xmlstr.size());
        writeBuffer << xmlstr.c_str();
        sendServerRequest();
        msgQueue.remove(e);
        e->m_nId = m_nMsgSequence;
        varEvents.push_back(e);
        it = msgQueue.begin();
    }
}