From cfbb3a6e5e11a8d2d162d80958d6ce997104e9d3 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 24 Sep 2006 20:08:07 +0200 Subject: Added add_buddy/remove_buddy functions. Removing a contact doesn't seem to work perfectly though. --- protocols/jabber/iq.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'protocols/jabber/iq.c') diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 5c108379..ac5e0932 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -183,3 +183,46 @@ int jabber_get_roster( struct gaim_connection *gc ) xt_free_node( node ); return st; } + +int jabber_add_to_roster( struct gaim_connection *gc, char *handle, char *name ) +{ + struct xt_node *node; + int st; + + /* Build the item entry */ + node = xt_new_node( "item", NULL, NULL ); + xt_add_attr( node, "jid", handle ); + if( name ) + xt_add_attr( node, "name", name ); + + /* And pack it into a roster-add packet */ + node = xt_new_node( "query", NULL, node ); + xt_add_attr( node, "xmlns", "jabber:iq:roster" ); + node = jabber_make_packet( "iq", "set", NULL, node ); + + st = jabber_write_packet( gc, node ); + + xt_free_node( node ); + return st; +} + +int jabber_remove_from_roster( struct gaim_connection *gc, char *handle ) +{ + struct xt_node *node; + int st; + + /* Build the item entry */ + node = xt_new_node( "item", NULL, NULL ); + xt_add_attr( node, "jid", handle ); + xt_add_attr( node, "subscription", "remove" ); + + /* And pack it into a roster-add packet */ + node = xt_new_node( "query", NULL, node ); + xt_add_attr( node, "xmlns", "jabber:iq:roster" ); + node = jabber_make_packet( "iq", "set", NULL, node ); + + st = jabber_write_packet( gc, node ); + + xt_free_node( node ); + return st; +} -- cgit v1.2.3