mirror of
https://github.com/bjc/prosody.git
synced 2025-04-01 20:27:39 +03:00
Roster updates
- Added support for item.ask attribute in rostermanager and mod_roster - Updated roster docs - Removed old code from rostermanager
This commit is contained in:
parent
7bf903298c
commit
869f2859c3
3 changed files with 5 additions and 13 deletions
|
@ -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)
|
||||
|
|
|
@ -9,7 +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 | true - a value of true indicates subscription is pending
|
||||
boolean ask = nil | "subscribe" - a value of true indicates subscription is pending
|
||||
}
|
||||
|
||||
The roster is available as
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue