Changeset

7352:50b24b3476e6

MUC: Provide a noop stub room:save() method
author Kim Alvefur <zash@zash.se>
date Thu, 14 Apr 2016 21:23:09 +0200 (2016-04-14)
parents 7350:24e2369b67f9
children 7353:ca31d3271cf8
files plugins/muc/affiliation_notify.lib.lua plugins/muc/description.lib.lua plugins/muc/hidden.lib.lua plugins/muc/members_only.lib.lua plugins/muc/moderated.lib.lua plugins/muc/muc.lib.lua plugins/muc/name.lib.lua plugins/muc/password.lib.lua plugins/muc/persistent.lib.lua plugins/muc/subject.lib.lua plugins/muc/whois.lib.lua
diffstat 11 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/affiliation_notify.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/affiliation_notify.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -24,7 +24,7 @@
 	affiliation_notify = affiliation_notify and true or nil;
 	if room._data.affiliation_notify == affiliation_notify then return false; end
 	room._data.affiliation_notify = affiliation_notify;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
--- a/plugins/muc/description.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/description.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -15,7 +15,7 @@
 	if description == "" then description = nil; end
 	if get_description(room) == description then return false; end
 	room._data.description = description;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
--- a/plugins/muc/hidden.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/hidden.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -15,7 +15,7 @@
 	hidden = hidden and true or nil;
 	if get_hidden(room) == hidden then return false; end
 	room._data.hidden = hidden;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
--- a/plugins/muc/members_only.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/members_only.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -44,7 +44,7 @@
 			module:fire_event("muc-occupant-left", {room = room; nick = occupant.nick; occupant = occupant;});
 		end
 	end
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
--- a/plugins/muc/moderated.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/moderated.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -15,7 +15,7 @@
 	moderated = moderated and true or nil;
 	if get_moderated(room) == moderated then return false; end
 	room._data.moderated = moderated;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
--- a/plugins/muc/muc.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/muc.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -36,6 +36,10 @@
 	return "MUC room ("..self.jid..")";
 end
 
+function room_mt.save()
+	-- overriden by mod_muc.lua
+end
+
 function room_mt:get_occupant_jid(real_jid)
 	return self._jid_nick[real_jid]
 end
@@ -695,7 +699,7 @@
 		end
 		event.field, event.value = nil, nil;
 
-		if self.save then self:save(true); end
+		self:save(true);
 		origin.send(st.reply(stanza));
 
 		if next(event.status_codes) then
--- a/plugins/muc/name.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/name.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -17,7 +17,7 @@
 	if name == "" or name == (jid_split(room.jid)) then name = nil; end
 	if room._data.name == name then return false; end
 	room._data.name = name;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
--- a/plugins/muc/password.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/password.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -17,7 +17,7 @@
 	if password == "" then password = nil; end
 	if room._data.password == password then return false; end
 	room._data.password = password;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
--- a/plugins/muc/persistent.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/persistent.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -15,7 +15,7 @@
 	persistent = persistent and true or nil;
 	if get_persistent(room) == persistent then return false; end
 	room._data.persistent = persistent;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
--- a/plugins/muc/subject.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/subject.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -25,7 +25,7 @@
 	changesubject = changesubject and true or nil;
 	if get_changesubject(room) == changesubject then return false; end
 	room._data.changesubject = changesubject;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end
 
@@ -61,7 +61,7 @@
 	if old_subject == subject and old_from == from then return false; end
 	room._data.subject_from = from;
 	room._data.subject = subject;
-	if room.save then room:save(); end
+	room:save();
 	local msg = create_subject_message(from, subject);
 	room:broadcast_message(msg);
 	return true;
--- a/plugins/muc/whois.lib.lua	Tue Apr 12 19:35:55 2016 +0200
+++ b/plugins/muc/whois.lib.lua	Thu Apr 14 21:23:09 2016 +0200
@@ -20,7 +20,7 @@
 	assert(valid_whois[whois], "Invalid whois value")
 	if get_whois(room) == whois then return false; end
 	room._data.whois = whois;
-	if room.save then room:save(true); end
+	room:save(true);
 	return true;
 end