Changeset 1444be5 for protocols/jabber/message.c
- Timestamp:
- 2012-10-17T07:23:00Z (12 years ago)
- Branches:
- master
- Children:
- 91ae87d
- Parents:
- 13df515
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/message.c
r13df515 r1444be5 24 24 #include "jabber.h" 25 25 26 static unsigned int next_receipt_id = 1; 27 26 28 xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) 27 29 { 28 30 struct im_connection *ic = data; 31 struct jabber_data *jd = ic->proto_data; 29 32 char *from = xt_find_attr( node, "from" ); 30 33 char *type = xt_find_attr( node, "type" ); 34 char *id = xt_find_attr( node, "id" ); 31 35 struct xt_node *body = xt_find_node( node->children, "body" ), *c; 36 struct xt_node *request = xt_find_node( node->children, "request" ); 37 struct xt_node *received, *receipt; 32 38 struct jabber_buddy *bud = NULL; 33 39 char *s, *room = NULL, *reason = NULL; … … 35 41 if( !from ) 36 42 return XT_HANDLED; /* Consider this packet corrupted. */ 43 44 if( request && id ) 45 { 46 /* Send a message receipt (XEP-0184), looking like this: 47 * <message 48 * from='kingrichard@royalty.england.lit/throne' 49 * id='bi29sg183b4v' 50 * to='northumberland@shakespeare.lit/westminster'> 51 * <received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/> 52 * </message> */ 53 received = xt_new_node( "received", NULL, NULL ); 54 xt_add_attr( received, "xmlns", XMLNS_RECEIPTS ); 55 xt_add_attr( received, "id", id ); 56 receipt = jabber_make_packet( "message", NULL, from, received ); 57 xt_add_attr( receipt, "from", jd->me ); 58 59 char *id = g_strdup_printf( "%sRCPT%05x", JABBER_PACKET_ID, ( next_receipt_id++ ) & 0xfffff ); 60 xt_add_attr( receipt, "id", id ); 61 g_free( id ); 62 63 jabber_write_packet( ic, receipt ); 64 xt_free_node( receipt ); 65 } 37 66 38 67 bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT );
Note: See TracChangeset
for help on using the changeset viewer.