Comparison

plugins/muc/name.lib.lua @ 11057:13eee48071c8

MUC: Don't default room name to JID localpart (API breaking change) Behavior with turning empty name into localpart was originally introduced in 711eb5bf94b4 This has caused some problems for clients, making it difficult to differentiate between a room actually named like the localpart from a room without a name. Breaking: The function signature of the :get_name() method changes from always returning a string to optional string.
author Kim Alvefur <zash@zash.se>
date Sat, 29 Aug 2020 18:51:13 +0200
parent 9034:1c709e3d2e5e
comparison
equal deleted inserted replaced
11056:0b0a42542456 11057:13eee48071c8
5 -- 5 --
6 -- This project is MIT/X11 licensed. Please see the 6 -- This project is MIT/X11 licensed. Please see the
7 -- COPYING file in the source package for more information. 7 -- COPYING file in the source package for more information.
8 -- 8 --
9 9
10 local jid_split = require "util.jid".split;
11
12 local function get_name(room) 10 local function get_name(room)
13 return room._data.name or jid_split(room.jid); 11 return room._data.name;
14 end 12 end
15 13
16 local function set_name(room, name) 14 local function set_name(room, name)
17 if name == "" then name = nil; end 15 if name == "" then name = nil; end
18 if room._data.name == name then return false; end 16 if room._data.name == name then return false; end