From 066faa6e4eadbb95f982d50aaabde03a6254a669 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 28 Jul 2012 21:36:42 +0200 Subject: mod_storage_sql: Add method for removing all data belonging to a user --- plugins/mod_storage_sql.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index 211f4d5f..6d19eee6 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -370,4 +370,12 @@ function driver:list_stores(username) -- Not to be confused with the list store return stores; end +function driver:purge(username) + local stmt, err = dosql("DELETE FROM `prosody` WHERE `host`=? AND `user`=?", host, username); + if not stmt then return stmt, err; end + local changed, err = stmt:affected(); + if not changed then return changed, err; end + return true, changed; +end + module:add_item("data-driver", driver); -- cgit v1.2.3