aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/io.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-06-04 12:32:37 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2007-06-04 12:32:37 +0100
commitbb95d43e263530805224005ca246addb6bb199fa (patch)
treecd84dcb3955ee957c52bf38d790465d0f3fea48d /protocols/jabber/io.c
parent6286f80d6dc1dc4cb8106b4e209a8578d7cebe56 (diff)
Added a real XML-console to the Jabber module! Add the handle "xmlconsole"
(without any @server part) to your contact list and you'll see all XMPP traffic going in and out, and messages sent to the buddy will be sent as packets to the server.
Diffstat (limited to 'protocols/jabber/io.c')
-rw-r--r--protocols/jabber/io.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c
index 67deb3a6..edde5a8d 100644
--- a/protocols/jabber/io.c
+++ b/protocols/jabber/io.c
@@ -44,6 +44,15 @@ int jabber_write( struct im_connection *ic, char *buf, int len )
struct jabber_data *jd = ic->proto_data;
gboolean ret;
+ if( jd->flags & JFLAG_XMLCONSOLE )
+ {
+ char *msg;
+
+ msg = g_strdup_printf( "TX: %s", buf );
+ imcb_buddy_msg( ic, JABBER_XMLCONSOLE_HANDLE, msg, 0, 0 );
+ g_free( msg );
+ }
+
if( jd->tx_len == 0 )
{
/* If the queue is empty, allocate a new buffer. */
@@ -483,7 +492,27 @@ static xt_status jabber_pkt_misc( struct xt_node *node, gpointer data )
return XT_HANDLED;
}
+static xt_status jabber_xmlconsole( struct xt_node *node, gpointer data )
+{
+ struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
+
+ if( jd->flags & JFLAG_XMLCONSOLE )
+ {
+ char *msg, *pkt;
+
+ pkt = xt_to_string( node );
+ msg = g_strdup_printf( "RX: %s", pkt );
+ imcb_buddy_msg( ic, JABBER_XMLCONSOLE_HANDLE, msg, 0, 0 );
+ g_free( msg );
+ g_free( pkt );
+ }
+
+ return XT_NEXT;
+}
+
static const struct xt_handler_entry jabber_handlers[] = {
+ { NULL, "stream:stream", jabber_xmlconsole },
{ "stream:stream", "<root>", jabber_end_of_stream },
{ "message", "stream:stream", jabber_pkt_message },
{ "presence", "stream:stream", jabber_pkt_presence },