# HG changeset patch # User Kim Alvefur # Date 1527664233 -7200 # Node ID b6cac9d722555c54f023ded58bd6c60961c542da # Parent c271bfa3d6252c98d267840e22122d0b5aa492c3 mod_slack_webhooks: Use the correct MUC API diff -r c271bfa3d625 -r b6cac9d72255 mod_slack_webhooks/mod_slack_webhooks.lua --- 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"];