aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/iq.c
diff options
context:
space:
mode:
authorulim <a.sporto+bee@gmail.com>2007-11-28 22:07:30 +0100
committerulim <a.sporto+bee@gmail.com>2007-11-28 22:07:30 +0100
commit2c2df7dd91930345a9b22a8bb61327d1dcc7e3d5 (patch)
treece4aa38f4022e5a14cc8b8a8534f287f274daaeb /protocols/jabber/iq.c
parent221a27346f768b9626f2a0281ff774790858a0c2 (diff)
Initial import of jabber file receive and DCC send support. This introduces
only a few changes to bitlbees code, mainly the addition of the "transfers" command. This is known to work with Kopete, Psi, and Pidgin (formerly known as gaim). At least with Pidgin also over a proxy. DCC has only been tested with irssi. IPV6 is untested but should work. Currently, only receiving via SOCKS5BYTESREAMS is implemented. I'm not sure if the alternative(in-band bytestreams IBB) is worth implementing since I didn't see a client yet that can do it. Additionally, it is probably very slow and needs support by the server as well.
Diffstat (limited to 'protocols/jabber/iq.c')
-rw-r--r--protocols/jabber/iq.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c
index 595718fb..df0102b8 100644
--- a/protocols/jabber/iq.c
+++ b/protocols/jabber/iq.c
@@ -103,6 +103,9 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
XMLNS_TIME,
XMLNS_CHATSTATES,
XMLNS_MUC,
+ XMLNS_SI,
+ XMLNS_BYTESTREAMS,
+ XMLNS_FILETRANSFER,
NULL };
const char **f;
@@ -122,24 +125,26 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
else
{
xt_free_node( reply );
- reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
+ reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL );
pack = 0;
}
}
else if( strcmp( type, "set" ) == 0 )
{
- if( !( c = xt_find_node( node->children, "query" ) ) ||
+ if( ( c = xt_find_node( node->children, "si" ) ) &&
+ ( strcmp( xt_find_attr( c, "xmlns" ), XMLNS_SI ) == 0 ) )
+ {
+ return jabber_si_handle_request( ic, node, c );
+ } else if( !( c = xt_find_node( node->children, "query" ) ) ||
!( s = xt_find_attr( c, "xmlns" ) ) )
{
imcb_log( ic, "WARNING: Received incomplete IQ-%s packet", type );
return XT_HANDLED;
- }
-
+ } else if( strcmp( s, XMLNS_ROSTER ) == 0 )
+ {
/* This is a roster push. XMPP servers send this when someone
was added to (or removed from) the buddy list. AFAIK they're
sent even if we added this buddy in our own session. */
- if( strcmp( s, XMLNS_ROSTER ) == 0 )
- {
int bare_len = strlen( ic->acc->user );
if( ( s = xt_find_attr( node, "from" ) ) == NULL ||
@@ -156,14 +161,17 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
imcb_log( ic, "WARNING: %s tried to fake a roster push!", s ? s : "(unknown)" );
xt_free_node( reply );
- reply = jabber_make_error_packet( node, "not-allowed", "cancel" );
+ reply = jabber_make_error_packet( node, "not-allowed", "cancel", NULL );
pack = 0;
}
- }
- else
+ } else if( strcmp( s, XMLNS_BYTESTREAMS ) == 0 )
+ {
+ /* Bytestream Request (stage 2 of file transfer) */
+ return jabber_bs_request( ic, node, c );
+ } else
{
xt_free_node( reply );
- reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
+ reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel", NULL );
pack = 0;
}
}