aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/iq.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-17 13:56:52 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-17 13:56:52 +0000
commit75554d0a484d21f95fcf24394f89c541a650acaf (patch)
tree51d9dc322baeb2e542fc13d9ba69e74f70a87636 /protocols/jabber/iq.c
parente5e795dae28c7871a47040436454a456fb338820 (diff)
parentf9928cb319c2879a56b7280f09723b26035982d0 (diff)
Merging in 1.2.5.
Diffstat (limited to 'protocols/jabber/iq.c')
-rw-r--r--protocols/jabber/iq.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c
index 875b5c81..1b76a761 100644
--- a/protocols/jabber/iq.c
+++ b/protocols/jabber/iq.c
@@ -297,24 +297,39 @@ static xt_status jabber_finish_iq_auth( struct im_connection *ic, struct xt_node
xt_status jabber_pkt_bind_sess( struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
{
struct jabber_data *jd = ic->proto_data;
- struct xt_node *c;
+ struct xt_node *c, *reply = NULL;
char *s;
- if( ( c = xt_find_node( node->children, "bind" ) ) )
+ if( node && ( c = xt_find_node( node->children, "bind" ) ) )
{
c = xt_find_node( c->children, "jid" );
if( c && c->text_len && ( s = strchr( c->text, '/' ) ) &&
strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 )
imcb_log( ic, "Server changed session resource string to `%s'", s + 1 );
-
- jd->flags &= ~JFLAG_WAIT_BIND;
}
- else
+
+ if( jd->flags & JFLAG_WANT_BIND )
{
- jd->flags &= ~JFLAG_WAIT_SESSION;
+ reply = xt_new_node( "bind", NULL, xt_new_node( "resource", set_getstr( &ic->acc->set, "resource" ), NULL ) );
+ xt_add_attr( reply, "xmlns", XMLNS_BIND );
+ jd->flags &= ~JFLAG_WANT_BIND;
+ }
+ else if( jd->flags & JFLAG_WANT_SESSION )
+ {
+ reply = xt_new_node( "session", NULL, NULL );
+ xt_add_attr( reply, "xmlns", XMLNS_SESSION );
+ jd->flags &= ~JFLAG_WANT_SESSION;
}
- if( ( jd->flags & ( JFLAG_WAIT_BIND | JFLAG_WAIT_SESSION ) ) == 0 )
+ if( reply != NULL )
+ {
+ reply = jabber_make_packet( "iq", "set", NULL, reply );
+ jabber_cache_add( ic, reply, jabber_pkt_bind_sess );
+
+ if( !jabber_write_packet( ic, reply ) )
+ return XT_ABORT;
+ }
+ else if( ( jd->flags & ( JFLAG_WANT_BIND | JFLAG_WANT_SESSION ) ) == 0 )
{
if( !jabber_get_roster( ic ) )
return XT_ABORT;