void RegistrationManager::send(const Jreen::RegistrationData &data) { Q_D(RegistrationManager); ConnectionIQ iq(IQ::Set, d->service); iq.addPayload(new RegistrationQuery(data)); d->sendIQ(iq, SLOT(_q_result_received(Jreen::IQ))); }
void Client::createSession() { notifyStreamEvent( StreamEventSessionCreation ); IQ iq( IQ::Set, JID(), getID() ); iq.addExtension( new SessionCreation() ); send( iq, this, CtxSessionEstablishment ); }
static int JabbeSearchrRenewFields(HWND hwndDlg, JabberSearchData * dat) { char szServerName[100]; EnableWindow(GetDlgItem(hwndDlg, IDC_GO),FALSE); GetDlgItemTextA(hwndDlg,IDC_SERVER,szServerName,sizeof(szServerName)); dat->CurrentHeight = 0; dat->curPos = 0; SetScrollPos( GetDlgItem( hwndDlg, IDC_VSCROLL ), SB_CTL, 0, FALSE ); JabberSearchFreeData( hwndDlg, dat ); JabberSearchRefreshFrameScroll( hwndDlg, dat ); if ( jabberOnline ) SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,TranslateT("Please wait...\r\nConnecting search server...")); else SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,TranslateT("You have to be connected to server")); if ( !jabberOnline ) return 0; searchHandleDlg = hwndDlg; int iqId = JabberSerialNext(); XmlNodeIq iq( "get", iqId, szServerName ); XmlNode* query = iq.addChild( "query" ); query->addAttr( "xmlns", "jabber:iq:search" ); JabberIqAdd( iqId, IQ_PROC_GETSEARCHFIELDS, JabberIqResultGetSearchFields ); JabberSend( jabberThreadInfo->s, iq ); return iqId; }
BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) { struct tm *gmt; time_t ltime; TCHAR stime[100], *dtime; _tzset(); time(<ime); gmt = gmtime(<ime); mir_sntprintf(stime, _countof(stime), _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec); dtime = _tctime(<ime); dtime[24] = 0; XmlNodeIq iq(_T("result"), pInfo); HXML queryNode = iq << XQUERY(JABBER_FEAT_ENTITY_TIME_OLD); queryNode << XCHILD(_T("utc"), stime); LPCTSTR szTZName = TimeZone_GetName(NULL); if (szTZName) queryNode << XCHILD(_T("tz"), szTZName); queryNode << XCHILD(_T("display"), dtime); m_ThreadInfo->send(iq); return TRUE; }
VCardReply *VCardManager::store(const Jreen::VCard::Ptr &vcard) { Q_D(VCardManager); IQ iq(IQ::Set, JID()); iq.addExtension(vcard); return new VCardReply(d->client->jid().bareJID(), NULL, d->client->send(iq)); }
/** * Send game report containing numerous game properties to the server. * * @param data A JS array of game statistics */ void XmppClient::SendIqGameReport(ScriptInterface& scriptInterface, CScriptVal data) { glooxwrapper::JID xpartamuppJid(m_xpartamuppId); jsval dataval = data.get(); // Setup some base stanza attributes GameReport* game = new GameReport(); glooxwrapper::Tag* report = glooxwrapper::Tag::allocate("game"); // Iterate through all the properties reported and add them to the stanza. std::vector<std::string> properties; scriptInterface.EnumeratePropertyNamesWithPrefix(dataval, "", properties); for (std::vector<int>::size_type i = 0; i != properties.size(); i++) { std::wstring value; scriptInterface.GetProperty(dataval, properties[i].c_str(), value); report->addAttribute(properties[i], utf8_from_wstring(value)); } // Add stanza to IQ game->m_GameReport.push_back(report); // Send IQ glooxwrapper::IQ iq(gloox::IQ::Set, xpartamuppJid); iq.addExtension(game); DbgXMPP("SendGameReport [" << tag_xml(iq) << "]"); m_client->send(iq); };
/** * Send a request to register a game to the server. * * @param data A JS array of game attributes */ void XmppClient::SendIqRegisterGame(ScriptInterface& scriptInterface, CScriptVal data) { glooxwrapper::JID xpartamuppJid(m_xpartamuppId); jsval dataval = data.get(); // Setup some base stanza attributes GameListQuery* g = new GameListQuery(); g->m_Command = "register"; glooxwrapper::Tag* game = glooxwrapper::Tag::allocate("game"); // Add a fake ip which will be overwritten by the ip stamp XMPP module on the server. game->addAttribute("ip", "fake"); // Iterate through all the properties reported and add them to the stanza. std::vector<std::string> properties; scriptInterface.EnumeratePropertyNamesWithPrefix(dataval, "", properties); for (std::vector<int>::size_type i = 0; i != properties.size(); i++) { std::wstring value; scriptInterface.GetProperty(dataval, properties[i].c_str(), value); game->addAttribute(properties[i], utf8_from_wstring(value)); } // Push the stanza onto the IQ g->m_GameList.push_back(game); // Send IQ glooxwrapper::IQ iq(gloox::IQ::Set, xpartamuppJid); iq.addExtension(g); DbgXMPP("SendIqRegisterGame [" << tag_xml(iq) << "]"); m_client->send(iq); }
void btnRemove_OnClick(CCtrlFilterListView *) { if (!m_proto->m_bJabberOnline) return; int iItem = m_lvBookmarks.GetNextItem(-1, LVNI_SELECTED); if (iItem < 0) return; TCHAR *address = (TCHAR *)m_lvBookmarks.GetItemData(iItem); if (address == NULL) return; JABBER_LIST_ITEM *item = m_proto->ListGetItemPtr(LIST_BOOKMARK, address); if (item == NULL) return; m_btnAdd.Disable(); m_btnEdit.Disable(); m_btnRemove.Disable(); m_proto->ListRemove(LIST_BOOKMARK, address); m_lvBookmarks.SetItemState(iItem, 0, LVIS_SELECTED); // Unselect the item XmlNodeIq iq( m_proto->AddIQ(&CJabberProto::OnIqResultSetBookmarks, JABBER_IQ_TYPE_SET)); m_proto->SetBookmarkRequest(iq); m_proto->m_ThreadInfo->send(iq); }
static void JabberAdminSet( const TCHAR* to, const char* ns, const char* szItem, const TCHAR* itemVal, const char* var, const TCHAR* varVal ) { XmlNodeIq iq( "set", NOID, to ); XmlNode* query = iq.addQuery( ns ); XmlNode* item = query->addChild( "item" ); item->addAttr( szItem, itemVal ); item->addAttr( var, varVal ); JabberSend( jabberThreadInfo->s, iq ); }
void SOCKS5BytestreamManager::rejectSOCKS5Bytestream( const JID& from, const std::string& id, StanzaError reason ) { IQ iq( IQ::Error, from, id ); switch( reason ) { case StanzaErrorForbidden: case StanzaErrorNotAcceptable: { iq.addExtension( new Error( StanzaErrorTypeAuth, reason ) ); break; } case StanzaErrorFeatureNotImplemented: case StanzaErrorNotAllowed: default: { iq.addExtension( new Error( StanzaErrorTypeCancel, reason ) ); break; } } m_parent->send( iq ); }
void CJabberProto::SetMucConfig( HXML node, void *from ) { if ( m_ThreadInfo && from ) { XmlNodeIq iq( _T("set"), SerialNext(), ( TCHAR* )from ); HXML query = iq << XQUERY( xmlnsOwner ); xmlAddChild( query, node ); m_ThreadInfo->send( iq ); } }
void FlexibleOffline::messageOperation( int context, const StringList& msgs ) { const std::string& id = m_parent->getID(); IQ::IqType iqType = context == FORequestMsgs ? IQ::Get : IQ::Set; IQ iq( iqType, JID(), id ); iq.addExtension( new Offline( context, msgs ) ); m_parent->send( iq, this, context ); }
int main(int ac, char **av) { int i; i = 1; while (i < ac) { if (std::string("-h") == av[i]) return (usage()); i++; } if (ac == 3) { int u = my_atoi(av[1]); int o = my_atoi(av[2]); IQ iq(u, o); iq.Do_Calc(); iq.End(); } else if (ac == 4) { int u = my_atoi(av[1]); int o = my_atoi(av[2]); int max = my_atoi(av[3]); IQ iq(u, o, max); iq.Do_Calc(); iq.End(); } else if (ac == 5) { int u = my_atoi(av[1]); int o = my_atoi(av[2]); int min = my_atoi(av[3]); int max = my_atoi(av[4]); IQ iq(u, o, min, max); iq.Do_Calc(); iq.End(); } else { std::cerr << "Error in args." << std::endl; return (84); } return (0); }
IQReply *Jingle::send(JingleSession *session, Action action, const QList<Content> &contents) { JingleSessionPrivate *d = JingleSessionPrivate::get(session); Jingle::Ptr jingle = create(session, action); jingle->contents = contents; IQ iq(IQ::Set, d->other); iq.addExtension(jingle); return d->client->send(iq); }
void Registration::createAccount( DataForm* form ) { if( !m_parent || !form ) return; IQ iq( IQ::Set, m_to ); iq.addExtension( new Query( form ) ); m_parent->send( iq, this, CreateAccount ); }
void btnSave_OnClick(CCtrlButton *) { XmlNodeIq iq(_T("set")); HXML query = iq << XQUERY( _T(JABBER_FEAT_PRIVATE_STORAGE)); HXML storage = query << XCHILDNS(_T("storage"), _T(JABBER_FEAT_MIRANDA_NOTES)); m_proto->m_notes.SaveXml(storage); m_proto->m_ThreadInfo->send(iq); EnableControls(); }
void NonSaslAuth::doAuth( const std::string& sid ) { m_sid = sid; const std::string& id = m_parent->getID(); IQ iq( IQ::Get, m_parent->jid().server(), id ); iq.addExtension( new Query( m_parent->username() ) ); m_parent->send( iq, this, TrackRequestAuthFields ); }
void Registration::removeAccount() { if( !m_parent || !m_parent->authed() ) return; IQ iq( IQ::Set, m_to ); iq.addExtension( new Query( true ) ); m_parent->send( iq, this, RemoveAccount ); }
void SIManager::acceptSI( const JID& to, const std::string& id, Tag* child1, Tag* child2, const JID& from ) { IQ iq( IQ::Result, to, id ); iq.addExtension( new SI( child1, child2 ) ); if( from ) iq.setFrom( from ); m_parent->send( iq ); }
void Registration::fetchRegistrationFields() { if( !m_parent || m_parent->state() != StateConnected ) return; IQ iq( IQ::Get, m_to ); iq.addExtension( new Query() ); m_parent->send( iq, this, FetchRegistrationFields ); }
void CJabberProto::AddContactToRoster(const TCHAR *jid, const TCHAR *nick, const TCHAR *grpName) { XmlNodeIq iq(_T("set"), SerialNext()); HXML query = iq << XQUERY(JABBER_FEAT_IQ_ROSTER) << XCHILD(_T("item")) << XATTR(_T("jid"), jid) << XATTR(_T("name"), nick); if (grpName) query << XCHILD(_T("group"), grpName); m_ThreadInfo->send(iq); }
static void JabberAdminGet( const TCHAR* to, const char* ns, const char* var, const TCHAR* varVal, JABBER_IQ_PFUNC foo ) { int id = JabberSerialNext(); JabberIqAdd( id, IQ_PROC_NONE, foo ); XmlNodeIq iq( "get", id, to ); XmlNode* query = iq.addQuery( ns ); XmlNode* item = query->addChild( "item" ); item->addAttr( var, varVal ); JabberSend( jabberThreadInfo->s, iq ); }
/** * Request the leaderboard data from the server. */ void XmppClient::SendIqGetBoardList() { glooxwrapper::JID xpartamuppJid(m_xpartamuppId); // Send IQ glooxwrapper::IQ iq(gloox::IQ::Get, xpartamuppJid); iq.addExtension(new BoardListQuery()); DbgXMPP("SendIqGetBoardList [" << tag_xml(iq) << "]"); m_client->send(iq); }
void RosterManager::remove( const JID& jid ) { if( !jid ) return; IQ iq( IQ::Set, JID(), m_parent->getID() ); iq.addExtension( new Query( jid ) ); m_parent->send( iq, this, RemoveRosterItem ); }
void RosterManager::add( const JID& jid, const std::string& name, const StringList& groups ) { if( !jid ) return; IQ iq( IQ::Set, JID(), m_parent->getID() ); iq.addExtension( new Query( jid, name, groups) ); m_parent->send( iq, this, AddRosterItem ); }
void RosterManager::fill() { if( !m_parent ) return; m_privateXML->requestXML( "roster", XMLNS_ROSTER_DELIMITER, this ); IQ iq( IQ::Get, JID(), m_parent->getID() ); iq.addExtension( new Query() ); m_parent->send( iq, this, RequestRoster ); }
bool Client::bindOperation( const std::string& resource, bool bind ) { if( !( m_streamFeatures & StreamFeatureUnbind ) && m_resourceBound ) return false; IQ iq( IQ::Set, JID(), getID() ); iq.addExtension( new ResourceBind( resource, bind ) ); send( iq, this, bind ? CtxResourceBind : CtxResourceUnbind ); return true; }
void Search::fetchSearchFields( const JID& directory, SearchHandler* sh ) { if( !m_parent || !directory || !sh ) return; const std::string& id = m_parent->getID(); IQ iq( IQ::Get, directory, id ); iq.addExtension( new Query() ); m_track[id] = sh; m_parent->send( iq, this, FetchSearchFields ); }
std::string PrivacyManager::operation( IdType context, const std::string& name ) { const std::string& id = m_parent->getID(); IQ::IqType iqType = IQ::Set; if( context == PLRequestNames || context == PLRequestList ) iqType = IQ::Get; IQ iq( iqType, JID(), id ); iq.addExtension( new Query( context, name ) ); m_parent->send( iq, this, context ); return id; }
HWND __cdecl CJabberProto::SearchAdvanced( HWND hwndDlg ) { if ( !m_bJabberOnline || !hwndDlg ) return 0; //error JabberSearchData * dat=(JabberSearchData *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); if ( !dat ) return 0; //error // check if server connected (at least one field exists) if ( dat->nJSInfCount == 0 ) return 0; // formating request BOOL fRequestNotEmpty=FALSE; // get server name TCHAR szServerName[100]; GetDlgItemText( hwndDlg, IDC_SERVER, szServerName, SIZEOF( szServerName )); // formating query int iqId = SerialNext(); XmlNodeIq iq( _T("set"), iqId, szServerName ); HXML query = iq << XQUERY( _T("jabber:iq:search")); if ( m_tszSelectedLang ) iq << XATTR( _T("xml:lang"), m_tszSelectedLang ); // i'm sure :) // next can be 2 cases: // Forms: XEP-0055 Example 7 if ( dat->fSearchRequestIsXForm ) { fRequestNotEmpty=TRUE; HXML n = JabberFormGetData(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode); xmlAddChild( query, n ); xi.destroyNode( n ); } else { //and Simple fields: XEP-0055 Example 3 for ( int i=0; i<dat->nJSInfCount; i++ ) { TCHAR szFieldValue[100]; GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, SIZEOF(szFieldValue)); if ( szFieldValue[0] != _T('\0')) { xmlAddChild( query, dat->pJSInf[i].szFieldName, szFieldValue ); fRequestNotEmpty=TRUE; } } } if ( fRequestNotEmpty ) { // register search request result handler IqAdd( iqId, IQ_PROC_GETSEARCH, &CJabberProto::OnIqResultAdvancedSearch ); // send request m_ThreadInfo->send( iq ); return ( HWND )iqId; } return 0; }