diff options
author | xengineering <me@xengineering.eu> | 2022-08-21 11:20:37 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2022-08-21 11:21:51 +0200 |
commit | 40aca0691949f41c27704c1f8c4d05fae655cf26 (patch) | |
tree | 9eb7d90fc08a39c2bbeef9158c5dc8e783dae515 /net.c | |
parent | bd516ecdb218f4122acf077bef5a4dbde91653e5 (diff) | |
download | limox-40aca0691949f41c27704c1f8c4d05fae655cf26.tar limox-40aca0691949f41c27704c1f8c4d05fae655cf26.tar.zst limox-40aca0691949f41c27704c1f8c4d05fae655cf26.zip |
Implement message sending
Diffstat (limited to 'net.c')
-rw-r--r-- | net.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -215,3 +215,20 @@ void net_disconnect(void) { state = DISCONNECTED; } + +void net_send_message(const char* sender, const char* content, + const char* recipient) { + + // TODO what happens if client is disconnected and this function is called? + + char* uuid = xmpp_uuid_gen(ctx); + + xmpp_stanza_t* msg = xmpp_message_new(ctx, "chat", recipient, uuid); + xmpp_stanza_set_from(msg, sender); + xmpp_message_set_body(msg, content); + xmpp_send(conn, msg); + + xmpp_free(ctx, msg); + xmpp_free(ctx, uuid); + +} |