Changeset

5040:685403a6fee1

mod_storage_sql: Add method for removing all data belonging to a user
author Kim Alvefur <zash@zash.se>
date Sat, 28 Jul 2012 21:36:42 +0200
parents 5039:656ce68c4781
children 5041:be204204cc5f
files plugins/mod_storage_sql.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);