# HG changeset patch # User Kim Alvefur # Date 1343504202 -7200 # Node ID 685403a6fee13f11fe29a660b78e01f13ead28dd # Parent 656ce68c478137a76d056dcbb459b8fbf470fdd6 mod_storage_sql: Add method for removing all data belonging to a user diff -r 656ce68c4781 -r 685403a6fee1 plugins/mod_storage_sql.lua --- a/plugins/mod_storage_sql.lua Sat Jul 28 21:36:36 2012 +0200 +++ b/plugins/mod_storage_sql.lua Sat Jul 28 21:36:42 2012 +0200 @@ -370,4 +370,12 @@ 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);