aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/jabber')
-rw-r--r--protocols/jabber/message.c16
-rw-r--r--protocols/jabber/si.c6
2 files changed, 14 insertions, 8 deletions
diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c
index ce5017fb..6e40e521 100644
--- a/protocols/jabber/message.c
+++ b/protocols/jabber/message.c
@@ -30,7 +30,7 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
char *type = xt_find_attr( node, "type" );
struct xt_node *body = xt_find_node( node->children, "body" ), *c;
struct jabber_buddy *bud = NULL;
- char *s;
+ char *s, *room = NULL, *reason = NULL;
if( !from )
return XT_HANDLED; /* Consider this packet corrupted. */
@@ -51,19 +51,19 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
for( c = node->children; ( c = xt_find_node( c, "x" ) ); c = c->next )
{
- char *ns = xt_find_attr( c, "xmlns" ), *room;
- struct xt_node *inv, *reason;
+ char *ns = xt_find_attr( c, "xmlns" );
+ struct xt_node *inv;
if( ns && strcmp( ns, XMLNS_MUC_USER ) == 0 &&
( inv = xt_find_node( c->children, "invite" ) ) )
{
+ /* This is an invitation. Set some vars which
+ will be passed to imcb_chat_invite() below. */
room = from;
if( ( from = xt_find_attr( inv, "from" ) ) == NULL )
from = room;
-
- g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room );
- if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 )
- g_string_append( fullmsg, reason->text );
+ if( ( inv = xt_find_node( inv->children, "reason" ) ) && inv->text_len > 0 )
+ reason = inv->text;
}
}
@@ -103,6 +103,8 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
if( fullmsg->len > 0 )
imcb_buddy_msg( ic, from, fullmsg->str,
0, jabber_get_timestamp( node ) );
+ if( room )
+ imcb_chat_invite( ic, room, from, reason );
g_string_free( fullmsg, TRUE );
diff --git a/protocols/jabber/si.c b/protocols/jabber/si.c
index 58c0e17f..4b0e57c4 100644
--- a/protocols/jabber/si.c
+++ b/protocols/jabber/si.c
@@ -261,6 +261,10 @@ int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, st
requestok = TRUE;
break;
}
+ else
+ {
+ c = c->next;
+ }
if ( !requestok )
imcb_log( ic, "WARNING: Unsupported file transfer request from %s", ini_jid);
@@ -372,7 +376,7 @@ void jabber_si_answer_request( file_transfer_t *ft ) {
static xt_status jabber_si_handle_response(struct im_connection *ic, struct xt_node *node, struct xt_node *orig )
{
struct xt_node *c, *d;
- char *ini_jid, *tgt_jid, *iq_id, *cmp;
+ char *ini_jid = NULL, *tgt_jid, *iq_id, *cmp;
GSList *tflist;
struct jabber_transfer *tf=NULL;
struct jabber_data *jd = ic->proto_data;