| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-11-17 03:04:38 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-11-17 03:11:02 UTC |
| parent | be4c52aa33a6ad15d90860d7cfad4f591b2e4b88 |
| borogove/Client.hx | +13 | -1 |
| test/TestClient.hx | +6 | -6 |
diff --git a/borogove/Client.hx b/borogove/Client.hx index 5fb501f..6663c01 100644 --- a/borogove/Client.hx +++ b/borogove/Client.hx @@ -1643,7 +1643,19 @@ class Client extends EventEmitter { submission.set("muc#roomconfig_persistentroom", ["1"]); submission.set("muc#roomconfig_whois", ["anyone"]); submission.set("muc#roomconfig_allowinvites", ["1"]); - return createChannelInternal(name, localpart, service, null, submission); + return createChannelInternal(name, localpart, service, null, submission).then(channel -> { + return new Promise((resolve, reject) -> { + var tok = null; + tok = on("chats/update", (chat: Array<Chat>) -> { + if (chat[0].chatId != channel.chatId) return EventUnhandled; + if (chat[0].uiState == Creating) return EventHandled; + + removeEventListener(tok); + resolve(channel); + return EventHandled; + }); + }); + }); } private function createChannelInternal( diff --git a/test/TestClient.hx b/test/TestClient.hx index 6a33c20..51a8e09 100644 --- a/test/TestClient.hx +++ b/test/TestClient.hx @@ -1820,7 +1820,6 @@ class TestClient extends utest.Test { Assert.equals(Open, channel.uiState); Assert.isTrue(channel.canSend()); Assert.isTrue(persistence.storedChats.indexOf(channel) >= 0); - async.done(); return EventHandled; }); @@ -1874,25 +1873,26 @@ class TestClient extends utest.Test { return EventUnhandled; }); + haxe.Timer.delay(() -> { + final presence: Presence = cast Stanza.parse('<presence xmlns="jabber:client" from="design-team@groups.example.com/test" to="test@example.com"><x xmlns="http://jabber.org/protocol/muc#user"><item affiliation="owner" role="moderator"/><status code="110"/><status code="201"/></x></presence>'); + client.stream.onStanza(presence); + }, 1); client.createChannelInstant("Design Team", false, "design-team", "groups.example.com").then(channel -> { created = channel; Assert.equals("design-team@groups.example.com", channel.chatId); Assert.equals("Design Team", channel.getDisplayName()); - Assert.equals(Creating, channel.uiState); - Assert.isFalse(channel.canSend()); + Assert.equals(Open, channel.uiState); Assert.equals(channel, client.getChat(channel.chatId)); Assert.isTrue(client.getChats().indexOf(channel) >= 0); - Assert.isFalse(persistence.storedChats.indexOf(channel) >= 0); Assert.notNull(channel.creationFormSubmission); Assert.equals("Design Team", channel.creationFormSubmission.get("muc#roomconfig_roomname")[0]); Assert.equals("0", channel.creationFormSubmission.get("muc#roomconfig_membersonly")[0]); Assert.notNull(sentPresence); Assert.equals("design-team@groups.example.com/test", sentPresence.attr.get("to")); Assert.notNull(sentPresence.getChild("x", "http://jabber.org/protocol/muc")); + async.done(); - final presence: Presence = cast Stanza.parse('<presence xmlns="jabber:client" from="design-team@groups.example.com/test" to="test@example.com"><x xmlns="http://jabber.org/protocol/muc#user"><item affiliation="owner" role="moderator"/><status code="110"/><status code="201"/></x></presence>'); - client.stream.onStanza(presence); return null; }, err -> { Assert.fail(err);