aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/iq.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-09-24 20:08:07 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-09-24 20:08:07 +0200
commitcfbb3a6e5e11a8d2d162d80958d6ce997104e9d3 (patch)
tree2f6d7e89fa70833e64575fe809e998c0c0e7a7f2 /protocols/jabber/iq.c
parente101506a3e660d3165a89aab0898293b367e2b5b (diff)
Added add_buddy/remove_buddy functions. Removing a contact doesn't seem
to work perfectly though.
Diffstat (limited to 'protocols/jabber/iq.c')
-rw-r--r--protocols/jabber/iq.c43
1 files changed, 43 insertions, 0 deletions
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;
+}