aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/offlinemessage.lua2
-rw-r--r--core/rostermanager.lua14
-rw-r--r--core/stanza_router.lua1
-rw-r--r--doc/roster_format.txt1
-rw-r--r--main.lua4
-rw-r--r--plugins/mod_roster.lua2
-rw-r--r--util/datamanager.lua1
7 files changed, 10 insertions, 15 deletions
diff --git a/core/offlinemessage.lua b/core/offlinemessage.lua
index dda9b7d8..ebb357ba 100644
--- a/core/offlinemessage.lua
+++ b/core/offlinemessage.lua
@@ -11,3 +11,5 @@ function new(user, host, stanza)
t_insert(offlinedata, stanza);
return datamanager.store(user, host, "offlinemsg", offlinedata);
end
+
+return _M; \ No newline at end of file
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index 26a14256..c39d28ed 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -18,17 +18,6 @@ local st = require "util.stanza";
module "rostermanager"
---[[function getroster(username, host)
- return {
- ["mattj@localhost"] = true,
- ["tobias@getjabber.ath.cx"] = true,
- ["waqas@getjabber.ath.cx"] = true,
- ["thorns@getjabber.ath.cx"] = true,
- ["idw@getjabber.ath.cx"] = true,
- }
- --return datamanager.load(username, host, "roster") or {};
-end]]
-
function add_to_roster(session, jid, item)
if session.roster then
local old_item = session.roster[jid];
@@ -65,7 +54,7 @@ function roster_push(username, host, jid)
local stanza = st.iq({type="set"});
stanza:tag("query", {xmlns = "jabber:iq:roster"});
if item then
- stanza:tag("item", {jid = jid, subscription = item.subscription, name = item.name});
+ stanza:tag("item", {jid = jid, subscription = item.subscription, name = item.name, ask = item.ask});
for group in pairs(item.groups) do
stanza:tag("group"):text(group):up();
end
@@ -94,6 +83,7 @@ function load_roster(username, host)
return roster;
end
-- Attempt to load roster for non-loaded user
+ -- TODO also support loading for offline user
end
function save_roster(username, host)
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 905de6e3..5062bc23 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -151,7 +151,6 @@ function core_handle_stanza(origin, stanza)
end
end
--- TODO: Does this function belong here?
function is_authorized_to_see_presence(origin, username, host)
local roster = datamanager.load(username, host, "roster") or {};
local item = roster[origin.username.."@"..origin.host];
diff --git a/doc/roster_format.txt b/doc/roster_format.txt
index 9094b5a1..132dbf4e 100644
--- a/doc/roster_format.txt
+++ b/doc/roster_format.txt
@@ -9,6 +9,7 @@ table roster_item {
string subscription = "none" | "to" | "from" | "both"
string name = Opaque string set by client. (optional)
set groups = a set of opaque strings set by the client
+ boolean ask = nil | "subscribe" - a value of true indicates subscription is pending
}
The roster is available as
diff --git a/main.lua b/main.lua
index cd6077f1..a379c826 100644
--- a/main.lua
+++ b/main.lua
@@ -1,4 +1,4 @@
-require "luarocks.require"
+pcall(require, "luarocks.require")
local server = require "net.server"
require "lxp"
@@ -31,7 +31,7 @@ require "util.stanza"
require "util.jid"
------------------------------------------------------------------------
-
+
-- Locals for faster access --
local t_insert = table.insert;
local t_concat = table.concat;
diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua
index 8a20f76d..d02f77a5 100644
--- a/plugins/mod_roster.lua
+++ b/plugins/mod_roster.lua
@@ -19,6 +19,7 @@ add_iq_handler("c2s", "jabber:iq:roster",
roster:tag("item", {
jid = jid,
subscription = session.roster[jid].subscription,
+ ask = session.roster[jid].ask,
name = session.roster[jid].name,
});
for group in pairs(session.roster[jid].groups) do
@@ -54,6 +55,7 @@ add_iq_handler("c2s", "jabber:iq:roster",
if r_item.name == "" then r_item.name = nil; end
if session.roster[item.attr.jid] then
r_item.subscription = session.roster[item.attr.jid].subscription;
+ r_item.ask = session.roster[item.attr.jid].ask;
else
r_item.subscription = "none";
end
diff --git a/util/datamanager.lua b/util/datamanager.lua
index f4ae958c..43e23dc3 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -93,3 +93,4 @@ function store(username, host, datastore, data)
return true;
end
+return _M; \ No newline at end of file