Software / code / prosody
Comparison
plugins/mod_smacks.lua @ 12977:74b9e05af71e
plugins: Prefix module imports with prosody namespace
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 24 Mar 2023 13:15:28 +0100 |
| parent | 12851:ffa75a9ce907 |
| child | 13023:cbe58f747d48 |
comparison
equal
deleted
inserted
replaced
| 12976:a187600ec7d6 | 12977:74b9e05af71e |
|---|---|
| 43 ):with_labels(); | 43 ):with_labels(); |
| 44 local sessions_expired = module:measure("sessions_expired", "counter"); | 44 local sessions_expired = module:measure("sessions_expired", "counter"); |
| 45 local sessions_started = module:measure("sessions_started", "counter"); | 45 local sessions_started = module:measure("sessions_started", "counter"); |
| 46 | 46 |
| 47 | 47 |
| 48 local datetime = require "util.datetime"; | 48 local datetime = require "prosody.util.datetime"; |
| 49 local add_filter = require "util.filters".add_filter; | 49 local add_filter = require "prosody.util.filters".add_filter; |
| 50 local jid = require "util.jid"; | 50 local jid = require "prosody.util.jid"; |
| 51 local smqueue = require "util.smqueue"; | 51 local smqueue = require "prosody.util.smqueue"; |
| 52 local st = require "util.stanza"; | 52 local st = require "prosody.util.stanza"; |
| 53 local timer = require "util.timer"; | 53 local timer = require "prosody.util.timer"; |
| 54 local new_id = require "util.id".short; | 54 local new_id = require "prosody.util.id".short; |
| 55 local watchdog = require "util.watchdog"; | 55 local watchdog = require "prosody.util.watchdog"; |
| 56 local it = require"util.iterators"; | 56 local it = require"prosody.util.iterators"; |
| 57 | 57 |
| 58 local sessionmanager = require "core.sessionmanager"; | 58 local sessionmanager = require "prosody.core.sessionmanager"; |
| 59 | 59 |
| 60 local xmlns_errors = "urn:ietf:params:xml:ns:xmpp-stanzas"; | 60 local xmlns_errors = "urn:ietf:params:xml:ns:xmpp-stanzas"; |
| 61 local xmlns_delay = "urn:xmpp:delay"; | 61 local xmlns_delay = "urn:xmpp:delay"; |
| 62 local xmlns_mam2 = "urn:xmpp:mam:2"; | 62 local xmlns_mam2 = "urn:xmpp:mam:2"; |
| 63 local xmlns_sm2 = "urn:xmpp:sm:2"; | 63 local xmlns_sm2 = "urn:xmpp:sm:2"; |
| 102 local function clear_old_session(session, id) | 102 local function clear_old_session(session, id) |
| 103 session_registry[registry_key(session, id)] = nil; | 103 session_registry[registry_key(session, id)] = nil; |
| 104 return old_session_registry:set(session.username, id or session.resumption_token, nil) | 104 return old_session_registry:set(session.username, id or session.resumption_token, nil) |
| 105 end | 105 end |
| 106 | 106 |
| 107 local ack_errors = require"util.error".init("mod_smacks", xmlns_sm3, { | 107 local ack_errors = require"prosody.util.error".init("mod_smacks", xmlns_sm3, { |
| 108 head = { condition = "undefined-condition"; text = "Client acknowledged more stanzas than sent by server" }; | 108 head = { condition = "undefined-condition"; text = "Client acknowledged more stanzas than sent by server" }; |
| 109 tail = { condition = "undefined-condition"; text = "Client acknowledged less stanzas than already acknowledged" }; | 109 tail = { condition = "undefined-condition"; text = "Client acknowledged less stanzas than already acknowledged" }; |
| 110 pop = { condition = "internal-server-error"; text = "Something went wrong with Stream Management" }; | 110 pop = { condition = "internal-server-error"; text = "Something went wrong with Stream Management" }; |
| 111 overflow = { condition = "resource-constraint", text = "Too many unacked stanzas remaining, session can't be resumed" } | 111 overflow = { condition = "resource-constraint", text = "Too many unacked stanzas remaining, session can't be resumed" } |
| 112 }); | 112 }); |
| 113 | 113 |
| 114 local enable_errors = require "util.error".init("mod_smacks", xmlns_sm3, { | 114 local enable_errors = require "prosody.util.error".init("mod_smacks", xmlns_sm3, { |
| 115 already_enabled = { condition = "unexpected-request", text = "Stream management is already enabled" }; | 115 already_enabled = { condition = "unexpected-request", text = "Stream management is already enabled" }; |
| 116 bind_required = { condition = "unexpected-request", text = "Client must bind a resource before enabling stream management" }; | 116 bind_required = { condition = "unexpected-request", text = "Client must bind a resource before enabling stream management" }; |
| 117 unavailable = { condition = "service-unavailable", text = "Stream management is not available for this stream" }; | 117 unavailable = { condition = "service-unavailable", text = "Stream management is not available for this stream" }; |
| 118 -- Resumption | 118 -- Resumption |
| 119 expired = { condition = "item-not-found", text = "Session expired, and cannot be resumed" }; | 119 expired = { condition = "item-not-found", text = "Session expired, and cannot be resumed" }; |