Software /
code /
prosody-modules
Comparison
mod_http_roster_admin/mod_http_roster_admin.lua @ 3316:9d8098f4b652
mod_http_roster_admin: Explicitly set 'id' attribute on roster pushes
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 13 Sep 2018 16:14:41 +0100 |
parent | 2631:2bfa7d476092 |
child | 3338:7d2400710d65 |
comparison
equal
deleted
inserted
replaced
3315:bbf20293bc43 | 3316:9d8098f4b652 |
---|---|
20 local set = require "util.set"; | 20 local set = require "util.set"; |
21 local rm = require "core.rostermanager"; | 21 local rm = require "core.rostermanager"; |
22 local st = require "util.stanza"; | 22 local st = require "util.stanza"; |
23 local array = require "util.array"; | 23 local array = require "util.array"; |
24 | 24 |
25 local new_id = require "util.id".short; | |
26 | |
25 local host = module.host; | 27 local host = module.host; |
26 local sessions = hosts[host].sessions; | 28 local sessions = hosts[host].sessions; |
27 | 29 |
28 local roster_url = module:get_option_string("http_roster_url", "http://localhost/%s"); | 30 local roster_url = module:get_option_string("http_roster_url", "http://localhost/%s"); |
29 | 31 |
30 -- Send a roster push to the named user, with the given roster, for the specified | 32 -- Send a roster push to the named user, with the given roster, for the specified |
31 -- contact's roster entry. Used to notify clients of changes/removals. | 33 -- contact's roster entry. Used to notify clients of changes/removals. |
32 local function roster_push(username, roster, contact_jid) | 34 local function roster_push(username, roster, contact_jid) |
33 local stanza = st.iq({type="set"}) | 35 local stanza = st.iq({type="set", id=new_id()}) |
34 :tag("query", {xmlns = "jabber:iq:roster" }); | 36 :tag("query", {xmlns = "jabber:iq:roster" }); |
35 local item = roster[contact_jid]; | 37 local item = roster[contact_jid]; |
36 if item then | 38 if item then |
37 stanza:tag("item", {jid = contact_jid, subscription = item.subscription, name = item.name, ask = item.ask}); | 39 stanza:tag("item", {jid = contact_jid, subscription = item.subscription, name = item.name, ask = item.ask}); |
38 for group in pairs(item.groups) do | 40 for group in pairs(item.groups) do |