aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/message.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2012-10-28 23:54:21 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2012-10-28 23:54:21 +0000
commit91ae87dbaf907a767b9bf881c6f7de39d03be45e (patch)
treefa6ed2e8f3f91cf99f71b30dff2786cec31843eb /protocols/jabber/message.c
parent4d82e50a6bdc15ed39723c1dac23027b83330be1 (diff)
parent1444be5c948f8b4509cfe3cb30992da74f12b5b8 (diff)
Merging XEP-0184 support patch from Michael Stapelberg, #999.
Diffstat (limited to 'protocols/jabber/message.c')
-rw-r--r--protocols/jabber/message.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c
index 85c71c9d..58c1c815 100644
--- a/protocols/jabber/message.c
+++ b/protocols/jabber/message.c
@@ -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 );