soc.2009.transport: af7f11c2: Simple support for PurpleCmd

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Wed Jun 10 13:20:34 EDT 2009


-----------------------------------------------------------------
Revision: af7f11c24eada1ea8c8cb553c1e1b605f62f92f8
Ancestor: d21cd2f64ef6854df36a0aede0d6c112fa1fd5e6
Author: hanzz at soc.pidgin.im
Date: 2009-06-10T17:17:36
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/af7f11c24eada1ea8c8cb553c1e1b605f62f92f8

Modified files:
        user.cpp

ChangeLog: 

Simple support for PurpleCmd

-------------- next part --------------
============================================================
--- user.cpp	505f60568710fbdc8484555e42eadd816da7d227
+++ user.cpp	c98029abb8d2339b62c30857ddc5570ec4dff862
@@ -25,6 +25,7 @@
 #include "usermanager.h"
 #include "gloox/chatstate.h"
 #include "muchandler.h"
+#include "cmds.h"
 
 /*
  * Called when contact list has been received from legacy network.
@@ -643,13 +644,23 @@ void User::receivedMessage(const Message
 	else{
 		conv = m_conversations[msg.to().username()];
 	}
+	
+	std::string body = msg.body();
+	
+	if (body.find("/transport ") == 0) {
+		PurpleCmdStatus status;
+		char *error;
+		body.erase(0,11);
+		status = purple_cmd_do_command(conv, body.c_str(), body.c_str(), &error);
+	}
+	
 	// send this message
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
 		PurpleConvIm *im = purple_conversation_get_im_data(conv);
-		purple_conv_im_send(im,msg.body().c_str());
+		purple_conv_im_send(im,body.c_str());
 	}
 	else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
-		purple_conv_chat_send(PURPLE_CONV_CHAT(conv), msg.body().c_str());
+		purple_conv_chat_send(PURPLE_CONV_CHAT(conv), body.c_str());
 	}
 }
 


More information about the Commits mailing list