Software / code / prosody
Comparison
core/rostermanager.lua @ 9671:e50559a42dfe
rostermanager, mod_presence: Store stanza for incoming subscription requests (fixes #689) (thanks Zash, Ge0rG)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 01 Dec 2018 22:13:24 +0000 |
| parent | 9303:72f0862978ef |
| child | 9705:42a3e3a28248 |
comparison
equal
deleted
inserted
replaced
| 9670:73e1bdc001ce | 9671:e50559a42dfe |
|---|---|
| 261 return item and (item.subscription == "to" or item.subscription == "both"), err; | 261 return item and (item.subscription == "to" or item.subscription == "both"), err; |
| 262 end | 262 end |
| 263 | 263 |
| 264 function is_contact_pending_in(username, host, jid) | 264 function is_contact_pending_in(username, host, jid) |
| 265 local roster = load_roster(username, host); | 265 local roster = load_roster(username, host); |
| 266 return roster[false].pending[jid]; | 266 return roster[false].pending[jid] ~= nil; |
| 267 end | 267 end |
| 268 local function set_contact_pending_in(username, host, jid) | 268 local function set_contact_pending_in(username, host, jid, stanza) |
| 269 local roster = load_roster(username, host); | 269 local roster = load_roster(username, host); |
| 270 local item = roster[jid]; | 270 local item = roster[jid]; |
| 271 if item and (item.subscription == "from" or item.subscription == "both") then | 271 if item and (item.subscription == "from" or item.subscription == "both") then |
| 272 return; -- false | 272 return; -- false |
| 273 end | 273 end |
| 274 roster[false].pending[jid] = true; | 274 roster[false].pending[jid] = st.is_stanza(stanza) and st.preserialize(stanza) or true; |
| 275 return save_roster(username, host, roster, jid); | 275 return save_roster(username, host, roster, jid); |
| 276 end | 276 end |
| 277 function is_contact_pending_out(username, host, jid) | 277 function is_contact_pending_out(username, host, jid) |
| 278 local roster = load_roster(username, host); | 278 local roster = load_roster(username, host); |
| 279 local item = roster[jid]; | 279 local item = roster[jid]; |