Apply IDNA to ASCII on hostnames.
[prosody.git] / core / rostermanager.lua
index 7d8d4ee1dcaf848f76275fc02fd245b1f537946a..a08f989dbd81633c7a25ef04499f94b2ba3c8ca7 100644 (file)
@@ -1,8 +1,6 @@
 
-local mainlog = log;
-local function log(type, message)
-       mainlog(type, "rostermanager", message);
-end
+
+local log = require "util.logger".init("rostermanager");
 
 local setmetatable = setmetatable;
 local format = string.format;
@@ -11,9 +9,7 @@ local pairs, ipairs = pairs, ipairs;
 
 local hosts = hosts;
 
-require "util.datamanager"
-
-local datamanager = datamanager;
+local datamanager = require "util.datamanager"
 local st = require "util.stanza";
 
 module "rostermanager"
@@ -61,8 +57,8 @@ function roster_push(username, host, jid)
                else
                        stanza:tag("item", {jid = jid, subscription = "remove"});
                end
-               stanza:up();
-               stanza:up();
+               stanza:up(); -- move out from item
+               stanza:up(); -- move out from stanza
                -- stanza ready
                for _, session in pairs(hosts[host].sessions[username].sessions) do
                        if session.interested then
@@ -236,7 +232,7 @@ function unsubscribed(username, host, jid)
                if item.subscription == "from" then
                        item.subscription = "none";
                        changed = true;
-               elseif item.subscription == both then
+               elseif item.subscription == "both" then
                        item.subscription = "to";
                        changed = true;
                end