# HG changeset patch # User Kim Alvefur # Date 1415613986 -3600 # Node ID f9cb09d451c75d6fc2b7761fee58ed2fe75d1d68 # Parent cb4111a4cd3679ac0be2789603301126e6ba8997 mod_roster_command: Add 'remove' command diff -r cb4111a4cd36 -r f9cb09d451c7 mod_roster_command/mod_roster_command.lua --- a/mod_roster_command/mod_roster_command.lua Sun Nov 09 20:19:36 2014 +0100 +++ b/mod_roster_command/mod_roster_command.lua Mon Nov 10 11:06:26 2014 +0100 @@ -117,6 +117,14 @@ end end +function remove(user_jid, contact_jid) + unsubscribe_both(user_jid, contact_jid); + local user_username, user_host = jid.split(user_jid); + local roster = rostermanager.load_roster(user_username, user_host); + roster[contact_jid] = nil; + rostermanager.save_roster(user_username, user_host, roster); +end + function module.command(arg) local command = arg[1]; if not command then @@ -136,6 +144,9 @@ elseif command == "unsubscribe_both" then unsubscribe_both(arg[1], arg[2]); return 0; + elseif command == "remove" then + remove(arg[1], arg[2]); + return 0; elseif command == "rename" then rename(arg[1], arg[2], arg[3], arg[4]); return 0;