Software /
code /
prosody-modules
Diff
mod_slack_webhooks/mod_slack_webhooks.lua @ 3071:b6cac9d72255
mod_slack_webhooks: Use the correct MUC API
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 30 May 2018 09:10:33 +0200 |
parent | 3000:02fc3b64cbb7 |
child | 3092:0f63e999d0e4 |
line wrap: on
line diff
--- a/mod_slack_webhooks/mod_slack_webhooks.lua Wed May 30 09:08:33 2018 +0200 +++ b/mod_slack_webhooks/mod_slack_webhooks.lua Wed May 30 09:10:33 2018 +0200 @@ -16,9 +16,9 @@ local xml = require "util.xml"; local http = require "net.http"; -local function get_room_by_jid(mod_muc, jid) - if mod_muc.get_room_by_jid then - return mod_muc.get_room_by_jid(jid); +local function get_room_from_jid(mod_muc, jid) + if mod_muc.get_room_from_jid then + return mod_muc.get_room_from_jid(jid); elseif mod_muc.rooms then return mod_muc.rooms[jid]; -- COMPAT 0.9, 0.10 end @@ -37,7 +37,7 @@ local mod_muc = host_session.muc; if not mod_muc then return; end - local this_room = get_room_by_jid(mod_muc, stanza.attr.to); + local this_room = get_room_from_jid(mod_muc, stanza.attr.to); if not this_room then return; end -- no such room local from_room_jid = this_room._jid_nick[stanza.attr.from]; @@ -76,7 +76,7 @@ local headers = request.headers; local bare_room = jid.join(path, module.host); local mod_muc = host_session.muc; - if not get_room_by_jid(mod_muc, bare_room) then + if not get_room_from_jid(mod_muc, bare_room) then module:log("warn", "mod_slack_webhook: invalid JID: %s", bare_room); return 404; end @@ -104,7 +104,7 @@ return 422; end local bare_room = jid.join(path, module.host); - local dest_room = get_room_by_jid(mod_muc, bare_room); + local dest_room = get_room_from_jid(mod_muc, bare_room); local from_nick = default_from_nick; if post_body["username"] then from_nick = post_body["username"];