xmpp: ALLOW SENDING MESSAGES

This commit is contained in:
2022-01-02 16:21:31 +01:00
parent ca11e31876
commit 2ee72c0345
8 changed files with 40 additions and 14 deletions

View File

@@ -129,6 +129,16 @@ class XmppConnection {
void sendRawXML(XMLNode node) {
this._socket.write(node.toXml());
}
void sendMessage(String body, String to) async {
await this.sendStanza(Stanza.message(
to: to,
type: "normal",
children: [
XMLNode(tag: "body", text: body)
]
));
}
Future<XMLNode> sendStanza(Stanza stanza, { bool addFrom = true, bool addId = true }) {
// Add extra data in case it was not set