| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-04-27 02:58:31 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-04-27 02:58:31 UTC |
| parent | b9f4276e2cd76ea22ad89cf2a5b20c9711df2c6b |
| borogove/AvailableChatIterator.hx | +3 | -2 |
| borogove/Chat.hx | +12 | -1 |
| borogove/queries/RosterGet.hx | +3 | -2 |
diff --git a/borogove/AvailableChatIterator.hx b/borogove/AvailableChatIterator.hx index d0a9f0d..2b97757 100644 --- a/borogove/AvailableChatIterator.hx +++ b/borogove/AvailableChatIterator.hx @@ -69,16 +69,17 @@ class AvailableChatIterator { })); } + final lowerQ = query.toLowerCase(); for (chat in client.chats) { if (chat.chatId != client.accountId()) { - if (chat.chatId.contains(query.toLowerCase()) || chat.getDisplayName().toLowerCase().contains(query.toLowerCase())) { + if (chat.chatId.contains(lowerQ) || chat.getDisplayName().toLowerCase().contains(lowerQ) || Util.existsFast(chat.getTags(), t -> t.toLowerCase() == lowerQ)) { final channel = Util.downcast(chat, Channel); results.push(Promise.resolve(new AvailableChat(chat.chatId, chat.getDisplayName(), chat.chatId, channel == null || channel.disco == null ? new Caps("", [], [], []) : channel.disco))); } for (p in chat.getParticipants()) { final details = chat.getParticipantDetails(p); - if (details.chat != null && (details.chat.chatId.contains(query.toLowerCase()) || (details.chat.displayName ?? "").toLowerCase().contains(query.toLowerCase()))) { + if (details.chat != null && (details.chat.chatId.contains(lowerQ) || (details.chat.displayName ?? "").toLowerCase().contains(lowerQ))) { results.push(Promise.resolve(details.chat)); } } diff --git a/borogove/Chat.hx b/borogove/Chat.hx index 70302a5..a712306 100644 --- a/borogove/Chat.hx +++ b/borogove/Chat.hx @@ -528,11 +528,15 @@ abstract class Chat { } @:allow(borogove) - private function updateFromRoster(item: { fn: Null<String>, subscription: String }) { + private function updateFromRoster(item: { fn: Null<String>, subscription: String, groups: Array<String> }) { isBookmarked = true; setTrusted(item.subscription == "both" || item.subscription == "from"); if (item.fn != null && item.fn != "") displayName = item.fn; if (uiState == Invited) uiState = Open; + extensions.removeChildren("group", "jabber:iq:roster"); + for (group in item.groups) { + extensions.textTag("group", group, { xmlns: "jabber:iq:roster" }); + } } /** @@ -628,6 +632,13 @@ abstract class Chat { return displayName; } + /** + Tags on this Chat + **/ + public function getTags() { + return extensions.allTags("group", "jabber:iq:roster").map(g -> g.getText()); + } + @:allow(borogove) private function setThreadSubject(threadId: String, subject: String) { this.threads.set(threadId, subject); diff --git a/borogove/queries/RosterGet.hx b/borogove/queries/RosterGet.hx index b599b39..ee0a554 100644 --- a/borogove/queries/RosterGet.hx +++ b/borogove/queries/RosterGet.hx @@ -14,7 +14,7 @@ class RosterGet extends GenericQuery { public var queryId:String = null; public var ver:String = null; private var responseStanza:Stanza; - private var result: Array<{ jid: String, fn: String, subscription: String }>; + private var result: Array<{ jid: String, fn: String, subscription: String, groups: Array<String> }>; public function new(?ver: String) { var attr: DynamicAccess<String> = { xmlns: xmlns }; @@ -45,7 +45,8 @@ class RosterGet extends GenericQuery { result = q.allTags("item").map((item) -> { jid: item.attr.get("jid"), fn: item.attr.get("name"), - subscription: item.attr.get("subscription") + subscription: item.attr.get("subscription"), + groups: item.allTags("group").map(g -> g.getText()) }); } return result;