soc.2009.transport: 37285cd9: Fixed AdhocHandler

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Tue Jun 2 07:06:10 EDT 2009


-----------------------------------------------------------------
Revision: 37285cd95d40d787d202f0341750b168233c549d
Ancestor: b97d78bafab066932e3dbc1209cc36a8c4f61a82
Author: hanzz at soc.pidgin.im
Date: 2009-06-02T11:02:27
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/37285cd95d40d787d202f0341750b168233c549d

Modified files:
        adhochandler.cpp adhochandler.h main.cpp main.h

ChangeLog: 

Fixed AdhocHandler

-------------- next part --------------
============================================================
--- adhochandler.cpp	43cd1f2292250d82ea4f889c4e4917c245b21d73
+++ adhochandler.cpp	e70fc56370be6e2056c0fd5c55ae8f29ed98bb61
@@ -23,28 +23,31 @@
  #include "log.h"
  #include "adhocrepeater.h"
  #include "gloox/disconodehandler.h"
+ #include "gloox/adhoc.h"
  
-AdhocHandler::AdhocHandler(GlooxMessageHandler *m) {
+GlooxAdhocHandler::GlooxAdhocHandler(GlooxMessageHandler *m) {
 	main = m;
 	main->j->registerIqHandler( this, ExtAdhocCommand );
+	main->j->registerStanzaExtension( new Adhoc::Command() );
 	main->j->disco()->addFeature( XMLNS_ADHOC_COMMANDS );
 	main->j->disco()->registerNodeHandler( this, XMLNS_ADHOC_COMMANDS );
 	main->j->disco()->registerNodeHandler( this, std::string() );
 
 }
 
-AdhocHandler::~AdhocHandler() { }
+GlooxAdhocHandler::~GlooxAdhocHandler() { }
 
-StringList AdhocHandler::handleDiscoNodeFeatures (const JID &from, const std::string &node) {
+StringList GlooxAdhocHandler::handleDiscoNodeFeatures (const JID &from, const std::string &node) {
 	StringList features;
 	features.push_back( XMLNS_ADHOC_COMMANDS );
 	return features;
 }
 
-Disco::ItemList AdhocHandler::handleDiscoNodeItems( const JID &_from, const JID &_to, const std::string& node ) {
+Disco::ItemList GlooxAdhocHandler::handleDiscoNodeItems( const JID &_from, const JID &_to, const std::string& node ) {
 	Disco::ItemList lst;
 	std::string from = _from.bare();
 	std::string to = _to.bare();
+	Log().Get("GlooxAdhocHandler") << "items" << from << to;
 // 	if (node.empty()) {
 // 		lst.push_back( new Disco::Item( main->jid(), XMLNS_ADHOC_COMMANDS, "Ad-Hoc Commands" ) );
 // 	}
@@ -98,14 +101,14 @@ Disco::ItemList AdhocHandler::handleDisc
 	return lst;
 }
 
-Disco::IdentityList AdhocHandler::handleDiscoNodeIdentities( const JID& jid, const std::string& node ) {
+Disco::IdentityList GlooxAdhocHandler::handleDiscoNodeIdentities( const JID& jid, const std::string& node ) {
 	Disco::IdentityList l;
 	l.push_back( new Disco::Identity( "automation",node == XMLNS_ADHOC_COMMANDS ? "command-list" : "command-node",node == XMLNS_ADHOC_COMMANDS ? "Ad-Hoc Commands" : "") );
 	return l;
 }
 
-bool AdhocHandler::handleIq( const IQ &stanza ) {
-	Log().Get("AdhocHandler") << "handleIq";
+bool GlooxAdhocHandler::handleIq( const IQ &stanza ) {
+	Log().Get("GlooxAdhocHandler") << "handleIq";
 	std::string to = stanza.to().bare();
 	std::string from = stanza.from().bare();
 	Tag *tag = stanza.tag()->findChild( "command" );
@@ -183,7 +186,7 @@ bool AdhocHandler::handleIq( const IQ &s
 	return true;
 }
 
-bool AdhocHandler::hasSession(const std::string &jid) {
+bool GlooxAdhocHandler::hasSession(const std::string &jid) {
 	std::map<std::string,AdhocRepeater *> ::iterator iter = m_sessions.begin();
 	iter = m_sessions.find(jid);
 	if(iter != m_sessions.end())
@@ -191,11 +194,11 @@ bool AdhocHandler::hasSession(const std:
 	return false;
 }
 
-void AdhocHandler::handleIqID( const IQ &iq, int context ) {
+void GlooxAdhocHandler::handleIqID( const IQ &iq, int context ) {
 }
 
-void AdhocHandler::handleDiscoInfo(const JID &jid, const Disco::Info &info, int context) {}
-void AdhocHandler::handleDiscoItems(const JID &jid, const Disco::Items &items, int context) {}
-void AdhocHandler::handleDiscoError(const JID &jid, const Error *error, int context) {}
+void GlooxAdhocHandler::handleDiscoInfo(const JID &jid, const Disco::Info &info, int context) {}
+void GlooxAdhocHandler::handleDiscoItems(const JID &jid, const Disco::Items &items, int context) {}
+void GlooxAdhocHandler::handleDiscoError(const JID &jid, const Error *error, int context) {}
 
 
============================================================
--- adhochandler.h	f56c6db2bb4ac45a45f88102743cd9331d3fd493
+++ adhochandler.h	7920176d349062588e36f37e3df881e8d08207a2
@@ -30,11 +30,11 @@ class AdhocRepeater;
 class GlooxMessageHandler;
 class AdhocRepeater;
 
-class AdhocHandler : public DiscoNodeHandler, public DiscoHandler, public IqHandler
+class GlooxAdhocHandler : public DiscoNodeHandler, public DiscoHandler, public IqHandler
 {
 	public:
-		AdhocHandler(GlooxMessageHandler *m);
-		~AdhocHandler();
+		GlooxAdhocHandler(GlooxMessageHandler *m);
+		~GlooxAdhocHandler();
 		StringList handleDiscoNodeFeatures (const JID &from, const std::string &node);
 		Disco::IdentityList handleDiscoNodeIdentities( const JID& jid, const std::string& node );
 		Disco::ItemList handleDiscoNodeItems (const JID &from, const JID &to, const std::string &node=EmptyString);
============================================================
--- main.cpp	ef59cb5491a0d73dc4021f3511742bb8efbc2410
+++ main.cpp	fd8864b76aedcde227d20db610dacc105899a9c8
@@ -483,7 +483,7 @@ GlooxMessageHandler::GlooxMessageHandler
  	m_discoInfoHandler=new GlooxDiscoInfoHandler(this);
  	j->registerIqHandler(m_discoInfoHandler,XMLNS_DISCO_INFO);
 	
-	m_adhoc = new AdhocHandler(this);
+	m_adhoc = new GlooxAdhocHandler(this);
 	
 	ftManager = new FileTransferManager();
 	ft = new SIProfileFT(j, ftManager );
============================================================
--- main.h	310864c7991695d48dd28fa203dc3e44c4ebc134
+++ main.h	36b3fe9647dd758c3df775c11dd0cdb18d8a4a62
@@ -91,7 +91,7 @@ class AbstractProtocol;
 class FileTranferManager;
 class UserManager;
 class AbstractProtocol;
-class AdhocHandler;
+// class AdhocHandler;
 class AdhocRepeater;
 
 struct User;
@@ -181,7 +181,7 @@ public:
 	SQLClass *sql() { return m_sql; }
 	GlooxVCardHandler *vcard() { return m_vcard; }
 	AbstractProtocol *protocol() { return m_protocol; }
-	AdhocHandler *adhoc() { return m_adhoc; }
+	GlooxAdhocHandler *adhoc() { return m_adhoc; }
 	
 	FileTransferManager* ftManager;
 	SIProfileFT* ft;
@@ -214,7 +214,7 @@ private:
 	GlooxStatsHandler *m_stats;
 	GlooxVCardHandler *m_vcard;
 // 	std::list <GlooxAdhocHandler *> m_adhoc_handlers;
-	AdhocHandler *m_adhoc;
+	GlooxAdhocHandler *m_adhoc;
 	
 	GIOChannel *connectIO;
 	


More information about the Commits mailing list