mod_privacy: Return the correct item-not-found instead of bad-request when a non...
authorMatthew Wild <mwild1@gmail.com>
Fri, 2 Jul 2010 18:55:08 +0000 (19:55 +0100)
committerMatthew Wild <mwild1@gmail.com>
Fri, 2 Jul 2010 18:55:08 +0000 (19:55 +0100)
plugins/mod_privacy.lua

index 10f44950a47151287e8eee57efca4a86fb497522..2f3b4863ac2cce8388db3d38d51fba987eb5795d 100644 (file)
@@ -93,8 +93,10 @@ function activateList(privacy_lists, origin, stanza, which, name)
        elseif which == "active" and list then
                origin.activePrivacyList = name;
                origin.send(st.reply(stanza));
+       elseif not list then
+               return {"cancel", "item-not-found", "No such list: "..name};
        else
-               return {"modify", "bad-request", "Either not active or default given or unknown list name specified."};
+               return {"modify", "bad-request", "No list chosen to be active or default."};
        end
        return true;
 end
@@ -438,9 +440,7 @@ function preCheckOutgoing(e)
                        e.stanza.attr.from = e.stanza.attr.from .. "/" .. session.resource;
                end
        end
-       if session.username then -- FIXME do properly
-               return checkIfNeedToBeBlocked(e, session);
-       end
+       return checkIfNeedToBeBlocked(e, session);
 end
 
 module:hook("pre-message/full", preCheckOutgoing, 500);