aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/jabber')
-rw-r--r--protocols/jabber/Makefile2
-rw-r--r--protocols/jabber/conference.c2
-rw-r--r--protocols/jabber/io.c33
-rw-r--r--protocols/jabber/iq.c3
-rw-r--r--protocols/jabber/jabber.c9
-rw-r--r--protocols/jabber/jabber.h5
-rw-r--r--protocols/jabber/message.c24
-rw-r--r--protocols/jabber/sasl.c3
-rw-r--r--protocols/jabber/si.c6
9 files changed, 73 insertions, 14 deletions
diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile
index 20bc1259..b5c3b107 100644
--- a/protocols/jabber/Makefile
+++ b/protocols/jabber/Makefile
@@ -37,7 +37,7 @@ $(objects): ../../Makefile.settings Makefile
$(objects): %.o: $(_SRCDIR_)%.c
@echo '*' Compiling $<
- @$(CC) -c $(CFLAGS) $< -o $@
+ @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
jabber_mod.o: $(objects)
@echo '*' Linking jabber_mod.o
diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c
index 0a66b461..c8930f83 100644
--- a/protocols/jabber/conference.c
+++ b/protocols/jabber/conference.c
@@ -3,7 +3,7 @@
* BitlBee - An IRC to IM gateway *
* Jabber module - Conference rooms *
* *
-* Copyright 2007 Wilmer van der Gaast <wilmer@gaast.net> *
+* Copyright 2007-2012 Wilmer van der Gaast <wilmer@gaast.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c
index 5b9149af..6f79b2d1 100644
--- a/protocols/jabber/io.c
+++ b/protocols/jabber/io.c
@@ -3,7 +3,7 @@
* BitlBee - An IRC to IM gateway *
* Jabber module - I/O stuff (plain, SSL), queues, etc *
* *
-* Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net> *
+* Copyright 2006-2012 Wilmer van der Gaast <wilmer@gaast.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -452,8 +452,39 @@ static xt_status jabber_pkt_proceed_tls( struct xt_node *node, gpointer data )
static xt_status jabber_pkt_stream_error( struct xt_node *node, gpointer data )
{
struct im_connection *ic = data;
+ struct jabber_data *jd = ic->proto_data;
int allow_reconnect = TRUE;
struct jabber_error *err;
+ struct xt_node *host;
+
+ if( !( ic->flags & OPT_LOGGED_IN ) &&
+ ( host = xt_find_node( node->children, "see-other-host" ) ) &&
+ host->text )
+ {
+ char *s;
+ int port = set_getint( &ic->acc->set, "port" );
+
+ /* Let's try to obey this request, if we're not logged
+ in yet (i.e. not have too much state yet). */
+ if( jd->ssl )
+ ssl_disconnect( jd->ssl );
+ closesocket( jd->fd );
+ b_event_remove( jd->r_inpa );
+ b_event_remove( jd->w_inpa );
+
+ jd->ssl = NULL;
+ jd->r_inpa = jd->w_inpa = 0;
+ jd->flags &= JFLAG_XMLCONSOLE;
+
+ s = strchr( host->text, ':' );
+ if( s != NULL )
+ sscanf( s + 1, "%d", &port );
+
+ imcb_log( ic, "Redirected to %s", host->text );
+ jd->fd = proxy_connect( host->text, port, jabber_connected_plain, ic );
+
+ return XT_ABORT;
+ }
err = jabber_error_parse( node, XMLNS_STREAM_ERROR );
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c
index b5a37a30..31b92049 100644
--- a/protocols/jabber/iq.c
+++ b/protocols/jabber/iq.c
@@ -3,7 +3,7 @@
* BitlBee - An IRC to IM gateway *
* Jabber module - IQ packets *
* *
-* Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net> *
+* Copyright 2006-2012 Wilmer van der Gaast <wilmer@gaast.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -127,6 +127,7 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data )
XMLNS_CHATSTATES,
XMLNS_MUC,
XMLNS_PING,
+ XMLNS_RECEIPTS,
XMLNS_SI,
XMLNS_BYTESTREAMS,
XMLNS_FILETRANSFER,
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index dbae9ff9..dab4afdf 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -3,7 +3,7 @@
* BitlBee - An IRC to IM gateway *
* Jabber module - Main file *
* *
-* Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net> *
+* Copyright 2006-2013 Wilmer van der Gaast <wilmer@gaast.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -84,7 +84,7 @@ static void jabber_init( account_t *acc )
s = set_add( &acc->set, "ssl", "false", set_eval_bool, acc );
s->flags |= ACC_SET_OFFLINE_ONLY;
- s = set_add( &acc->set, "tls", "try", set_eval_tls, acc );
+ s = set_add( &acc->set, "tls", "true", set_eval_tls, acc );
s->flags |= ACC_SET_OFFLINE_ONLY;
s = set_add( &acc->set, "tls_verify", "true", set_eval_bool, acc );
@@ -95,7 +95,8 @@ static void jabber_init( account_t *acc )
s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc );
s->flags |= ACC_SET_OFFLINE_ONLY;
- acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE;
+ acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE |
+ ACC_FLAG_HANDLE_DOMAINS;
}
static void jabber_generate_id_hash( struct jabber_data *jd );
@@ -230,7 +231,7 @@ void jabber_connect( struct im_connection *ic )
non-standard ports... */
if( set_getbool( &acc->set, "ssl" ) )
{
- jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), FALSE, jabber_connected_ssl, ic );
+ jd->ssl = ssl_connect( connect_to, set_getint( &acc->set, "port" ), set_getbool( &acc->set, "tls_verify" ), jabber_connected_ssl, ic );
jd->fd = jd->ssl ? ssl_getfd( jd->ssl ) : -1;
}
else
diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h
index d11d2fe8..006da9a3 100644
--- a/protocols/jabber/jabber.h
+++ b/protocols/jabber/jabber.h
@@ -3,7 +3,7 @@
* BitlBee - An IRC to IM gateway *
* Jabber module - Main file *
* *
-* Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net> *
+* Copyright 2006-2013 Wilmer van der Gaast <wilmer@gaast.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -195,7 +195,7 @@ struct jabber_transfer
struct sockaddr_storage saddr;
};
-#define JABBER_XMLCONSOLE_HANDLE "xmlconsole"
+#define JABBER_XMLCONSOLE_HANDLE "_xmlconsole"
#define JABBER_OAUTH_HANDLE "jabber_oauth"
/* Prefixes to use for packet IDs (mainly for IQ packets ATM). Usually the
@@ -226,6 +226,7 @@ struct jabber_transfer
#define XMLNS_TIME_OLD "jabber:iq:time" /* XEP-0090 */
#define XMLNS_TIME "urn:xmpp:time" /* XEP-0202 */
#define XMLNS_PING "urn:xmpp:ping" /* XEP-0199 */
+#define XMLNS_RECEIPTS "urn:xmpp:receipts" /* XEP-0184 */
#define XMLNS_VCARD "vcard-temp" /* XEP-0054 */
#define XMLNS_DELAY "jabber:x:delay" /* XEP-0091 */
#define XMLNS_XDATA "jabber:x:data" /* XEP-0004 */
diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c
index 85c71c9d..1c832bee 100644
--- a/protocols/jabber/message.c
+++ b/protocols/jabber/message.c
@@ -3,7 +3,7 @@
* BitlBee - An IRC to IM gateway *
* Jabber module - Handling of message(s) (tags), etc *
* *
-* Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net> *
+* Copyright 2006-2012 Wilmer van der Gaast <wilmer@gaast.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -28,12 +28,34 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
struct im_connection *ic = data;
char *from = xt_find_attr( node, "from" );
char *type = xt_find_attr( node, "type" );
+ char *id = xt_find_attr( node, "id" );
struct xt_node *body = xt_find_node( node->children, "body" ), *c;
+ struct xt_node *request = xt_find_node( node->children, "request" );
struct jabber_buddy *bud = NULL;
char *s, *room = NULL, *reason = NULL;
if( !from )
return XT_HANDLED; /* Consider this packet corrupted. */
+
+ if( request && id )
+ {
+ /* Send a message receipt (XEP-0184), looking like this:
+ * <message
+ * from='kingrichard@royalty.england.lit/throne'
+ * id='bi29sg183b4v'
+ * to='northumberland@shakespeare.lit/westminster'>
+ * <received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>
+ * </message> */
+ struct xt_node *received, *receipt;
+
+ received = xt_new_node( "received", NULL, NULL );
+ xt_add_attr( received, "xmlns", XMLNS_RECEIPTS );
+ xt_add_attr( received, "id", id );
+ receipt = jabber_make_packet( "message", NULL, from, received );
+
+ jabber_write_packet( ic, receipt );
+ xt_free_node( receipt );
+ }
bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT );
diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c
index f25d44c4..450b5b28 100644
--- a/protocols/jabber/sasl.c
+++ b/protocols/jabber/sasl.c
@@ -3,7 +3,7 @@
* BitlBee - An IRC to IM gateway *
* Jabber module - SASL authentication *
* *
-* Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net> *
+* Copyright 2006-2012 Wilmer van der Gaast <wilmer@gaast.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -386,6 +386,7 @@ xt_status sasl_pkt_challenge( struct xt_node *node, gpointer data )
else
{
/* We found rspauth, but don't really care... */
+ g_free( s );
}
s = reply ? tobase64( reply ) : NULL;
diff --git a/protocols/jabber/si.c b/protocols/jabber/si.c
index 4b0e57c4..f5f3b2fe 100644
--- a/protocols/jabber/si.c
+++ b/protocols/jabber/si.c
@@ -292,9 +292,11 @@ int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, st
requestok = FALSE;
}
- *s = '/';
+ if( s )
+ *s = '/';
}
- else
+
+ if( !requestok )
{
reply = jabber_make_error_packet( node, "item-not-found", "cancel", NULL );
if (!jabber_write_packet( ic, reply ))