Software /
code /
prosody
Comparison
plugins/mod_privacy.lua @ 3068:fc7c693e094a
mod_privacy: Remove validation that checks a roster group you block actually exists - it would be time-consuming on large rosters, and isn't important (or correct?) anyway.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 21 May 2010 19:19:29 +0100 |
parent | 2925:692b3c6c5bd2 |
child | 3069:c3df9053e0a9 |
comparison
equal
deleted
inserted
replaced
3066:5e5137057b5f | 3068:fc7c693e094a |
---|---|
158 for _,tag in ipairs(item.tags) do | 158 for _,tag in ipairs(item.tags) do |
159 tmp[tag.name] = true; | 159 tmp[tag.name] = true; |
160 end | 160 end |
161 end | 161 end |
162 | 162 |
163 if tmp.type == "group" then | 163 if tmp.type == "subscription" then |
164 local found = false; | |
165 local roster = load_roster(origin.username, origin.host); | |
166 for jid,item in pairs(roster) do | |
167 if item.groups ~= nil then | |
168 for group in pairs(item.groups) do | |
169 if group == tmp.value then | |
170 found = true; | |
171 break; | |
172 end | |
173 end | |
174 if found == true then | |
175 break; | |
176 end | |
177 end | |
178 end | |
179 if found == false then | |
180 return {"cancel", "item-not-found", "Specifed roster group not existing."}; | |
181 end | |
182 elseif tmp.type == "subscription" then | |
183 if tmp.value ~= "both" and | 164 if tmp.value ~= "both" and |
184 tmp.value ~= "to" and | 165 tmp.value ~= "to" and |
185 tmp.value ~= "from" and | 166 tmp.value ~= "from" and |
186 tmp.value ~= "none" then | 167 tmp.value ~= "none" then |
187 return {"cancel", "bad-request", "Subscription value must be both, to, from or none."}; | 168 return {"cancel", "bad-request", "Subscription value must be both, to, from or none."}; |