Changeset

4982:8a4b17e2e984

mod_muc_badge: If room has no title use localpart of room's jid (fixes #1767) Without this patch Prosody shows an HTTP 500 error (Lua 5.1) or a "nil" label in the SVG badge (Lua 5.2) if room has no title set.
author Citronalco <geierb@geierb.de>
date Tue, 02 Aug 2022 23:45:00 +0200
parents 4981:f0fe95f9e21c
children 4983:7c77058a1ac5
files mod_muc_badge/mod_muc_badge.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_badge/mod_muc_badge.lua	Wed Aug 03 03:14:17 2022 +0200
+++ b/mod_muc_badge/mod_muc_badge.lua	Tue Aug 02 23:45:00 2022 +0200
@@ -23,6 +23,7 @@
 module:depends"http";
 
 local jid_prep = require "util.jid".prep;
+local jid_split = require "util.jid".split;
 
 -- Support both old and new MUC code
 local mod_muc = module:depends"muc";
@@ -76,7 +77,7 @@
 			for _ in pairs(room._occupants) do
 				count = count + 1;
 			end
-			local badge_label = (" %s "):format(room:get_name());
+			local badge_label = (" %s "):format(room:get_name() or jid_split(jid));
 			local badge_count = (" %s "):format(string.format(number, count));
 
 			local response = event.response;