aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/iq.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-10-12 19:48:58 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-10-12 19:48:58 +0200
commit259edd40f5e332791a44f7547346bf799f1f7327 (patch)
tree498572c9e849bab47b6c67a059f791d8dd0998c3 /protocols/jabber/iq.c
parentb56b220e4280a75577f79b9dbcaf6eb2d7336873 (diff)
Special message when the XMPP session is ended because of a concurrent
login, and now sending proper error responses to IQ packets we can't handle.
Diffstat (limited to 'protocols/jabber/iq.c')
-rw-r--r--protocols/jabber/iq.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c
index e39f3064..265fae53 100644
--- a/protocols/jabber/iq.c
+++ b/protocols/jabber/iq.c
@@ -29,7 +29,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
struct jabber_data *jd = gc->proto_data;
struct xt_node *c, *reply = NULL;
char *type, *s;
- int st;
+ int st, pack = 1;
type = xt_find_attr( node, "type" );
@@ -100,22 +100,34 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
else
{
xt_free_node( reply );
- reply = NULL;
+ reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
+ pack = 0;
}
-
- /* If we recognized the xmlns and managed to generate a reply,
- finish and send it. */
- if( reply )
+ }
+ else if( strcmp( type, "set" ) == 0 )
+ {
+ xt_free_node( reply );
+ reply = jabber_make_error_packet( node, "feature-not-implemented", "cancel" );
+ pack = 0;
+ }
+
+ /* If we recognized the xmlns and managed to generate a reply,
+ finish and send it. */
+ if( reply )
+ {
+ /* Normally we still have to pack it into an iq-result
+ packet, but for errors, for example, we don't. */
+ if( pack )
{
reply = jabber_make_packet( "iq", "result", xt_find_attr( node, "from" ), reply );
if( ( s = xt_find_attr( node, "id" ) ) )
xt_add_attr( reply, "id", s );
-
- st = jabber_write_packet( gc, reply );
- xt_free_node( reply );
- if( !st )
- return XT_ABORT;
}
+
+ st = jabber_write_packet( gc, reply );
+ xt_free_node( reply );
+ if( !st )
+ return XT_ABORT;
}
return XT_HANDLED;