git » sdk » commit af411fa

Use some muc config values if present

author Stephen Paul Weber
2025-11-11 15:33:02 UTC
committer Stephen Paul Weber
2025-11-11 15:54:32 UTC
parent 0cff124d691a3546d81ca8eb5afb8ba44e4d39b7

Use some muc config values if present

borogove/Chat.hx +17 -0

diff --git a/borogove/Chat.hx b/borogove/Chat.hx
index d78d992..448b0b7 100644
--- a/borogove/Chat.hx
+++ b/borogove/Chat.hx
@@ -1137,6 +1137,23 @@ class Channel extends Chat {
 		persistence.lastId(client.accountId(), chatId).then(doSync);
 	}
 
+	override public function getDisplayName() {
+		if (this.displayName == chatId) {
+			final title = (info()?.field("muc#roomconfig_roomname")?.value ?? []).join("\n");
+			if (title != null && title != "") return title;
+		}
+
+		return super.getDisplayName();
+	}
+
+	public function description() {
+		return (info()?.field("muc#roominfo_description")?.value ?? []).join("\n");
+	}
+
+	private function info() {
+		return disco?.data?.find(d -> d.field("FORM_TYPE")?.value?.at(0) == "http://jabber.org/protocol/muc#roominfo");
+	}
+
 	@:allow(borogove)
 	override private function getCaps():KeyValueIterator<String, Caps> {
 		return {