soc.2009.transport: 8e0db636: First working version of request_input t...
hanzz at soc.pidgin.im
hanzz at soc.pidgin.im
Wed May 27 09:15:49 EDT 2009
-----------------------------------------------------------------
Revision: 8e0db63608a31bdff3b1973f384246d6220d10d1
Ancestor: 72ae3d6a91ce12a547122d36aa211f06182f967d
Author: hanzz at soc.pidgin.im
Date: 2009-05-27T13:08:25
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/8e0db63608a31bdff3b1973f384246d6220d10d1
Modified files:
adhochandler.cpp adhocrepeater.cpp main.h
ChangeLog:
First working version of request_input through XMPP
-------------- next part --------------
============================================================
--- adhochandler.cpp 9ccfb821ed37956b57e196e88d18b93fcb5e956e
+++ adhochandler.cpp 33124457c0be2701924f80fc2d4885fee46c2e9e
@@ -101,25 +101,11 @@ bool AdhocHandler::handleIq( Stanza *sta
if (node.empty()) return false;
if (to == main->jid()) {
-// if (tag->hasAttribute("action","cancel")){
-// Stanza *response = Stanza::createIqStanza(from, stanza()->id, StanzaIqResult, "", 0);
-// response->addAttribute("from",p->jid);
-//
-// Tag *c = new Tag("command");
-// c->addAttribute("xmlns","http://jabber.org/protocol/commands");
-// c->addAttribute("sessionid",tag->findAttribute("sessionid"));
-// c->addAttribute("node","configuration");
-// c->addAttribute("status","canceled");
-// p->j->send(response);
-//
-// return;
-// }
-
User *user = main->userManager()->getUserByJID(from);
if (user) {
if (user->isConnected() && purple_account_get_connection(user->account())) {
if (hasSession(stanza->from().full())) {
- m_sessions[stanza->from().full()]->handleIq(stanza);
+ return m_sessions[stanza->from().full()]->handleIq(stanza);
}
else {
PurpleConnection *gc = purple_account_get_connection(user->account());
============================================================
--- adhocrepeater.cpp 85f9d1fc75268d509c331d0d186c5f9588388d9f
+++ adhocrepeater.cpp 890b825143a38de9d5bd2151dbf7018ecad45bd3
@@ -68,6 +68,45 @@ bool AdhocRepeater::handleIq(Stanza *sta
AdhocRepeater::~AdhocRepeater() {}
bool AdhocRepeater::handleIq(Stanza *stanza) {
+ Tag *tag = stanza->findChild( "command" );
+ if (tag->hasAttribute("action","cancel")){
+ Stanza *response = Stanza::createIqStanza(stanza->from().full(), stanza->id(), StanzaIqResult, "", 0);
+ response->addAttribute("from", main->jid());
+
+ Tag *c = new Tag("command");
+ c->addAttribute("xmlns","http://jabber.org/protocol/commands");
+ c->addAttribute("sessionid",tag->findAttribute("sessionid"));
+ c->addAttribute("node","configuration");
+ c->addAttribute("status","canceled");
+ main->j->send(response);
+
+ return true;
+ }
+
+ Tag *x = tag->findChildWithAttrib("xmlns","jabber:x:data");
+ if (x) {
+ std::string result("");
+ for(std::list<Tag*>::iterator it = x->children().begin(); it != x->children().end(); ++it){
+ if ((*it)->hasAttribute("var","result")){
+ result = (*it)->findChild("value")->cdata();
+ break;
+ }
+ }
+
+ ((PurpleRequestInputCb) m_ok_cb)(m_requestData, result.c_str());
+
+ Stanza *response = Stanza::createIqStanza(stanza->from().full(), stanza->id(), StanzaIqResult, "", 0);
+ response->addAttribute("from", main->jid());
+
+ Tag *c = new Tag("command");
+ c->addAttribute("xmlns","http://jabber.org/protocol/commands");
+ c->addAttribute("sessionid",tag->findAttribute("sessionid"));
+ c->addAttribute("node","configuration");
+ c->addAttribute("status","completed");
+ main->j->send(response);
+ }
+
+
return true;
}
============================================================
--- main.h ebf615bab1c9769a70100d45479c61f0ccbcc5aa
+++ main.h d60fae49e93f031cade3095d2401c9a210ce8ad3
@@ -176,7 +176,7 @@ public:
SQLClass *sql() { return m_sql; }
GlooxVCardHandler *vcard() { return m_vcard; }
AbstractProtocol *protocol() { return m_protocol; }
- AdhocHandler *adhoc() { m_adhoc; }
+ AdhocHandler *adhoc() { return m_adhoc; }
FileTransferManager* ftManager;
SIProfileFT* ft;
More information about the Commits
mailing list