void CXMPPInstMsg::StartRosterEvent(CRoster* pRoster) { CIQStanza IQStanza; CHandler RosterHandler; CIQGetStanza IQGetStanza; string id; // we generate a unique id GenerateId(id); // we build the iq request IQGetStanza.SetId(id); CXMLNode* pXMLNode = new CXMLNode; pXMLNode->SetName("query"); pXMLNode->SetNameSpace("jabber:iq:roster"); IQGetStanza.PushChild(pXMLNode); // we build the filter handler adhoc CXMLFilter* pXMLFilter = new CXMLFilter("iq"); pXMLFilter->SetAttribut("id", id); RosterHandler.AddXMLFilter(pXMLFilter); // we request the filter RequestHandler(&RosterHandler); if(!Send(&IQGetStanza)) throw CXMPPInstMsgException(CXMPPInstMsgException::XMPPIMEC_UPDATEROSTERERROR); if(!Receive(&RosterHandler, &IQStanza)) throw CXMPPInstMsgException(CXMPPInstMsgException::XMPPIMEC_UPDATEROSTERERROR); CommitHandler(&RosterHandler); RemoveId(id); if(IQStanza.GetKindOf() != CIQStanza::SIQKO_RESULT) throw CXMPPInstMsgException(CXMPPInstMsgException::XMPPIMEC_UPDATEROSTERERROR); CXMLNode* pQueryXMLNode =IQStanza.GetChild("query"); for(u32 i = 0 ; i < pQueryXMLNode->GetNumChild() ; i++) { if(pQueryXMLNode->GetChild(i)->GetName() == "item") { CRosterItem RosterItem; RosterItem.SetJid(pQueryXMLNode->GetChild(i)->GetAttribut("jid")); pRoster->UpdateItem(RosterItem); } } RequestHandler(&OnPresenceHandler); }