soc.2009.transport: a06bdf16: Updated Gloox patch for gloox-trunk bran...

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Tue Jul 28 10:25:45 EDT 2009


-----------------------------------------------------------------
Revision: a06bdf16fe7e16f4944ef6bf154a97e625d55d2d
Ancestor: 86b6627f93b0a39748fb6c42536551b66c26642a
Author: hanzz at soc.pidgin.im
Date: 2009-07-28T14:22:47
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/a06bdf16fe7e16f4944ef6bf154a97e625d55d2d

Modified files:
        main.cpp main.h patches/01-gloox-filetransfer-component.diff

ChangeLog: 

Updated Gloox patch for gloox-trunk branch

-------------- next part --------------
============================================================
--- main.cpp	84f655306ca251b822c4dc375efc5387f0f78850
+++ main.cpp	d625d200bffadea66158bcd6057b77e99c97073c
@@ -54,42 +54,42 @@ namespace gloox {
 			virtual ~HiComponent() {};
 
 			// unfortunately we can't override const std::string variant
-			virtual void send(Tag *tag) {
-				std::string tagxml;
-				std::string outxml;
-				if (!tag)
-					return;
-
-				try {
-					tagxml = tag->xml();
-					outxml.resize(tagxml.size(), 0);
-
-					// replace invalid utf-8 characters
-					utf8::replace_invalid(tagxml.begin(), tagxml.end(), outxml.begin(), '?');
-
-					// replace invalid xml characters
-					for (std::string::iterator it = outxml.begin(); it != outxml.end(); ++it) {
-						if (((unsigned char)*it) < 0x20 && (*it != 0x09 && *it != 0x0A && *it != 0x0D)) {
-							*it = '?';
-						}
-					}
-					send(outxml);
-				} catch (...) {     // replace_invalid can throw exception? wtf!
-				}
-
-				delete tag;
-			}
-		protected:
-			void send( const std::string & xml) {    // copied from ClientBase::send(std::string), why have private function which handles protected data ??
-				if( m_connection && m_connection->state() == StateConnected ) {
-					if( m_compression && m_compressionActive )
-						m_compression->compress( xml );
-					else if( m_encryption && m_encryptionActive )
-						m_encryption->encrypt( xml );
-					else
-						m_connection->send( xml );
-				}
-			}
+// 			virtual void send(Tag *tag) {
+// 				std::string tagxml;
+// 				std::string outxml;
+// 				if (!tag)
+// 					return;
+// 
+// 				try {
+// 					tagxml = tag->xml();
+// 					outxml.resize(tagxml.size(), 0);
+// 
+// 					// replace invalid utf-8 characters
+// 					utf8::replace_invalid(tagxml.begin(), tagxml.end(), outxml.begin(), '?');
+// 
+// 					// replace invalid xml characters
+// 					for (std::string::iterator it = outxml.begin(); it != outxml.end(); ++it) {
+// 						if (((unsigned char)*it) < 0x20 && (*it != 0x09 && *it != 0x0A && *it != 0x0D)) {
+// 							*it = '?';
+// 						}
+// 					}
+// 					send(outxml);
+// 				} catch (...) {     // replace_invalid can throw exception? wtf!
+// 				}
+// 
+// 				delete tag;
+// 			}
+// 		protected:
+// 			void send( const std::string & xml) {    // copied from ClientBase::send(std::string), why have private function which handles protected data ??
+// 				if( m_connection && m_connection->state() == StateConnected ) {
+// 					if( m_compression && m_compressionActive )
+// 						m_compression->compress( xml );
+// 					else if( m_encryption && m_encryptionActive )
+// 						m_encryption->encrypt( xml );
+// 					else
+// 						m_connection->send( xml );
+// 				}
+// 			}
 	};
 };
 
@@ -596,6 +596,8 @@ GlooxMessageHandler::GlooxMessageHandler
 	Log().Get("gloox") << "connecting to: " << m_configuration.server << " as " << m_configuration.jid << " with password " << m_configuration.password;
 	j = new HiComponent("jabber:component:accept",m_configuration.server,m_configuration.jid,m_configuration.password,m_configuration.port);
 
+	j->logInstance().registerLogHandler( LogLevelDebug, LogAreaAll, this );
+
 	GMainLoop *loop = g_main_loop_new(NULL, FALSE);
 	signal(SIGCHLD, SIG_IGN);
 
============================================================
--- main.h	3fe64e732da79ea76c5fd34a9fe5848aad9d6ef5
+++ main.h	c97f96e6e96086ae6d951caeaa369997782b746e
@@ -119,6 +119,10 @@ typedef enum { 	TRANSPORT_FEATURE_TYPING
 				TRANSPORT_FEATURE_FILETRANSFER = 16
 				} TransportFeatures;
 
+typedef enum {	ExtGateway = 1024,
+				ExtStats = 1025
+} MyStanzaExtensions;
+
 struct fileTransferData{
 	std::string from;
 	std::string to;
@@ -155,13 +159,18 @@ struct Configuration {
 	std::string sqlType;	// database type
 };
 
-class GlooxMessageHandler : public MessageHandler,ConnectionListener,PresenceHandler,SubscriptionHandler
+class GlooxMessageHandler : public MessageHandler,ConnectionListener,PresenceHandler,SubscriptionHandler, LogHandler
 {
 
 public:
 	GlooxMessageHandler(const std::string &config);
 	~GlooxMessageHandler();
-	
+
+    virtual void handleLog( LogLevel level, LogArea area, const std::string& message )
+    {
+      printf("log: level: %d, area: %d, %s\n", level, area, message.c_str() );
+    }
+
 	static GlooxMessageHandler *instance() { return m_pInstance; }
 	
 	// Purple related
============================================================
--- patches/01-gloox-filetransfer-component.diff	754a1cc3b2a7733c5c1c6a52c6ce099574476461
+++ patches/01-gloox-filetransfer-component.diff	6a69b74a179b5cc8ecc4ffe62808a2e18fab6555
@@ -222,6 +222,15 @@ Index: siprofileft.cpp
            m_handler->handleFTBytestream( ibb );
          }
          break;
+@@ -131,7 +131,7 @@
+     df.addField( dff );
+     feature->addChild( df.tag() );
+ 
+-    m_manager->acceptSI( to, id, 0, feature );
++    m_manager->acceptSI( to, from, id, 0, feature );
+   }
+ 
+   void SIProfileFT::declineFT( const JID& to, const std::string& sid, SIManager::SIError reason,
 @@ -166,7 +166,7 @@
        m_socks5Manager->addStreamHost( jid, host, port );
    }


More information about the Commits mailing list