| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2023-09-12 20:02:57 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2023-09-12 20:02:57 UTC |
| parent | 794ec7e6b045da357bdf3859c49f0a523e6d91d3 |
| xmpp/Chat.hx | +15 | -0 |
diff --git a/xmpp/Chat.hx b/xmpp/Chat.hx index bb9e5c9..fb77682 100644 --- a/xmpp/Chat.hx +++ b/xmpp/Chat.hx @@ -1,5 +1,6 @@ package xmpp; +import xmpp.ID; import xmpp.MessageSync; import xmpp.ChatMessage; import xmpp.Chat; @@ -64,4 +65,18 @@ class DirectChat extends Chat { client.chatActivity(this); client.sendStanza(message.asStanza()); } + + public function bookmark() { + stream.sendIq( + new Stanza("iq", { type: "set", id: ID.short() }) + .tag("query", { xmlns: "jabber:iq:roster" }) + .tag("item", { jid: chatId }) + .up().up(), + (response) -> { + if (response.attr.get("type") == "error") return; + stream.sendStanza(new Stanza("presence", { to: chatId, type: "subscribe", id: ID.short() })); + stream.sendStanza(new Stanza("presence", { to: chatId, type: "subscribed", id: ID.short() })); + } + ); + } }