MUC: Persist data in room:set_password() when called programmatically.

Sun, 13 Jun 2010 20:05:45 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Sun, 13 Jun 2010 20:05:45 +0500
changeset 3249
95daf6398dbb
parent 3248
f8d14ea3ad0e
child 3250
38402e874b45

MUC: Persist data in room:set_password() when called programmatically.

plugins/muc/muc.lib.lua file | annotate | diff | comparison | revisions
--- a/plugins/muc/muc.lib.lua	Sun Jun 13 19:19:03 2010 +0500
+++ b/plugins/muc/muc.lib.lua	Sun Jun 13 20:05:45 2010 +0500
@@ -240,8 +240,10 @@
 
 function room_mt:set_password(password)
 	if password == "" or type(password) ~= "string" then password = nil; end
-	self._data.password = password;
-	return password;
+	if self._data.password ~= password then
+		self._data.password = password;
+		if self.save then self:save(true); end
+	end
 end
 function room_mt:get_password()
 	return self._data.password;

mercurial