Logo Search packages:      
Sourcecode: gabber version File versions  Download package

Presence PresenceDB::findExact ( const string &  jid  )  const

Find the Presence Packet for an exact user/resource JabberID. This function will throw XCP_InvalidJID if the JID is not found.

A Presence Packet.

Definition at line 163 of file jabberoo-presencedb.cc.

     PresenceDB::db::const_iterator it = find_or_throw(jid);

     // If the list is empty, throw an exception
     if (it->second.begin() == it->second.end())
        throw XCP_InvalidJID();

     // otherwise check for a resource
     string::size_type i = jid.find("/");
     if (i != string::npos)
        list<Presence> l= it->second;

        //return matching resource
        // Identify any existing items w/ this JID 
        iterator it2 = find_if(l.begin(), l.end(), pred_presence_jid(jid));

        // if we didn't find an entry, throw an exception
        if (it2 == l.end())
             throw XCP_InvalidJID();

        // return presence matching the full JID
        return *it2;
        //return the first item in the list
        return *find_or_throw(jid)->second.begin();

Generated by  Doxygen 1.6.0   Back to index