示例#1
0
bool JabberClient::add_contact(const char *jid)
{
    Contact *contact;
    if (findContact(jid, NULL, false, contact)) {
        Event e(EventContactChanged, contact);
        e.process();
        return false;
    }
    AddRequest *req = new AddRequest(this, jid);
    req->start_element("query");
    req->add_attribute("xmlns", "jabber:iq:roster");
    req->start_element("item");
    req->add_attribute("jid", jid);
    req->send();
    m_requests.push_back(req);
    return true;
}
示例#2
0
void JabberClient::add_contact(const char *id, const char *host)
{
    Contact *contact;
    if (findContact(id, host, NULL, false, contact)){
        Event e(EventContactChanged, contact);
        e.process();
        return;
    }
    string name = id;
    name += '@';
    name += host;
    AddRequest *req = new AddRequest(this, id, host);
    req->start_element("query");
    req->add_attribute("xmlns", "jabber:iq:roster");
    req->start_element("item");
    req->add_attribute("jid", name.c_str());
    req->send();
    m_requests.push_back(req);
}