projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b43f479
)
MUC: Update all config form handlers to take advantage of the new per-option events
author
Matthew Wild
<mwild1@gmail.com>
Fri, 11 Dec 2015 15:33:58 +0000
(15:33 +0000)
committer
Matthew Wild
<mwild1@gmail.com>
Fri, 11 Dec 2015 15:33:58 +0000
(15:33 +0000)
plugins/muc/affiliation_notify.lib.lua
patch
|
blob
|
history
plugins/muc/description.lib.lua
patch
|
blob
|
history
plugins/muc/hidden.lib.lua
patch
|
blob
|
history
plugins/muc/history.lib.lua
patch
|
blob
|
history
plugins/muc/members_only.lib.lua
patch
|
blob
|
history
plugins/muc/moderated.lib.lua
patch
|
blob
|
history
plugins/muc/name.lib.lua
patch
|
blob
|
history
plugins/muc/password.lib.lua
patch
|
blob
|
history
plugins/muc/persistent.lib.lua
patch
|
blob
|
history
plugins/muc/subject.lib.lua
patch
|
blob
|
history
plugins/muc/whois.lib.lua
patch
|
blob
|
history
diff --git
a/plugins/muc/affiliation_notify.lib.lua
b/plugins/muc/affiliation_notify.lib.lua
index e2ecbc3be5e994d6b5eb348c0bd5b0dddc5d7a44..0b9ab32597545e2a1468921d8008d7cdc7099e9c 100644
(file)
--- a/
plugins/muc/affiliation_notify.lib.lua
+++ b/
plugins/muc/affiliation_notify.lib.lua
@@
-37,9
+37,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_affiliationnotify"];
- if new ~= nil and set_affiliation_notify(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_affiliationnotify", function(event)
+ if set_affiliation_notify(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/description.lib.lua
b/plugins/muc/description.lib.lua
index 30852922f44cd7f0461f984845712bed72889784..c4b1bd093c7df86d1e060e419ae9e16426b5dd84 100644
(file)
--- a/
plugins/muc/description.lib.lua
+++ b/
plugins/muc/description.lib.lua
@@
-30,9
+30,8
@@
end
module:hook("muc-disco#info", add_form_option);
module:hook("muc-config-form", add_form_option);
module:hook("muc-disco#info", add_form_option);
module:hook("muc-config-form", add_form_option);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_roomdesc"];
- if new ~= nil and set_description(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomdesc", function(event)
+ if set_description(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/hidden.lib.lua
b/plugins/muc/hidden.lib.lua
index 5ce43db8e71f11c00a990b193bea68ebe339d268..35ca302636e618226f5440958903318e338a2ca3 100644
(file)
--- a/
plugins/muc/hidden.lib.lua
+++ b/
plugins/muc/hidden.lib.lua
@@
-28,9
+28,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_publicroom"];
- if new ~= nil and set_hidden(event.room, not new) then
+module:hook("muc-config-submitted/muc#roomconfig_publicroom", function(event)
+ if set_hidden(event.room, not event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/history.lib.lua
b/plugins/muc/history.lib.lua
index d685abf2e11c0fcbad8c7cf6efcd7a8454e4c9f3..65b1a31f32291b813f46637524824d0eedacac18 100644
(file)
--- a/
plugins/muc/history.lib.lua
+++ b/
plugins/muc/history.lib.lua
@@
-23,7
+23,9
@@
local function get_historylength(room)
end
local function set_historylength(room, length)
end
local function set_historylength(room, length)
- length = assert(tonumber(length), "Length not a valid number");
+ if length then
+ length = assert(tonumber(length), "Length not a valid number");
+ end
if length == default_history_length then length = nil; end
room._data.history_length = length;
return true;
if length == default_history_length then length = nil; end
room._data.history_length = length;
return true;
@@
-38,9
+40,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_historylength"];
- if new ~= nil and set_historylength(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_historylength", function(event)
+ if set_historylength(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/members_only.lib.lua
b/plugins/muc/members_only.lib.lua
index 90e916174837effd85106dafa62bbe349de97b8b..5e29a68d9eba821916d7f23e78212ec55457ec73 100644
(file)
--- a/
plugins/muc/members_only.lib.lua
+++ b/
plugins/muc/members_only.lib.lua
@@
-61,9
+61,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_membersonly"];
- if new ~= nil and set_members_only(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_membersonly", function(event)
+ if set_members_only(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/moderated.lib.lua
b/plugins/muc/moderated.lib.lua
index c375b7ada816bc14a8fe8106ceb57a9eb80ccf69..26dcb05823acdf66f0bfba1b4d9c7185b2b04ab3 100644
(file)
--- a/
plugins/muc/moderated.lib.lua
+++ b/
plugins/muc/moderated.lib.lua
@@
-32,9
+32,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_moderatedroom"];
- if new ~= nil and set_moderated(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_moderatedroom", function(event)
+ if set_moderated(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/name.lib.lua
b/plugins/muc/name.lib.lua
index 49d1246717899aa366be5ab63e259cd8b680617b..d9bfc4cf0f0a2315ca447ef7daaaa9c4ecf9d5de 100644
(file)
--- a/
plugins/muc/name.lib.lua
+++ b/
plugins/muc/name.lib.lua
@@
-34,9
+34,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_roomname"];
- if new ~= nil and set_name(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomname", function(event)
+ if set_name(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/password.lib.lua
b/plugins/muc/password.lib.lua
index 48486d730b57f0398a9cf1e0860e393289295d22..8c33aa9a3e376288bf6065ff2acff662f3439f68 100644
(file)
--- a/
plugins/muc/password.lib.lua
+++ b/
plugins/muc/password.lib.lua
@@
-34,9
+34,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_roomsecret"];
- if new ~= nil and set_password(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_roomsecret", function(event)
+ if set_password(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/persistent.lib.lua
b/plugins/muc/persistent.lib.lua
index ccf6fffe41effa35c53d87802da9ccba9e747d1d..a72bcbb54bb19354bed042a2473e63c8ce3f278a 100644
(file)
--- a/
plugins/muc/persistent.lib.lua
+++ b/
plugins/muc/persistent.lib.lua
@@
-28,9
+28,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_persistentroom"];
- if new ~= nil and set_persistent(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_persistentroom", function(event)
+ if set_persistent(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/subject.lib.lua
b/plugins/muc/subject.lib.lua
index d1895b4d51e2180f3d9e8121fae061a471a5f454..0b4e6fd6cf35c59c7abfb7d3e934097eb12e8df2 100644
(file)
--- a/
plugins/muc/subject.lib.lua
+++ b/
plugins/muc/subject.lib.lua
@@
-38,9
+38,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_changesubject"];
- if new ~= nil and set_changesubject(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_changesubject", function(event)
+ if set_changesubject(event.room, event.value) then
event.status_codes["104"] = true;
end
end);
event.status_codes["104"] = true;
end
end);
diff --git
a/plugins/muc/whois.lib.lua
b/plugins/muc/whois.lib.lua
index f89e60876fadd4e6bf09986a5cadeb8a8a23ec2a..a8e1f8d419bd0c89591e0b11dfa72633bc690692 100644
(file)
--- a/
plugins/muc/whois.lib.lua
+++ b/
plugins/muc/whois.lib.lua
@@
-41,9
+41,8
@@
module:hook("muc-config-form", function(event)
});
end);
});
end);
-module:hook("muc-config-submitted", function(event)
- local new = event.fields["muc#roomconfig_whois"];
- if new ~= nil and set_whois(event.room, new) then
+module:hook("muc-config-submitted/muc#roomconfig_whois", function(event)
+ if set_whois(event.room, event.value) then
local code = (new == 'moderators') and "173" or "172";
event.status_codes[code] = true;
end
local code = (new == 'moderators') and "173" or "172";
event.status_codes[code] = true;
end