summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-09-19 21:17:36 +0200
committerxengineering <me@xengineering.eu>2022-09-19 21:17:36 +0200
commitc79d5eb4df8edda0703c2a1b3d9d4a3f5430533c (patch)
tree9b157ba4ba338490cc44b91f39bfbd6d53d8d762
parent003b60fdc1d1f9b8dac131eac1a19dca34bcd98a (diff)
downloadlimox-c79d5eb4df8edda0703c2a1b3d9d4a3f5430533c.tar
limox-c79d5eb4df8edda0703c2a1b3d9d4a3f5430533c.tar.zst
limox-c79d5eb4df8edda0703c2a1b3d9d4a3f5430533c.zip
Write basic structure of net_rewrite.c
-rw-r--r--net_rewrite.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/net_rewrite.c b/net_rewrite.c
index 8b13789..3ab9726 100644
--- a/net_rewrite.c
+++ b/net_rewrite.c
@@ -1 +1,55 @@
+
+#include <stdio.h>
+
+#include <strophe.h>
+
+
+// the state of net
+typedef enum {
+ DISCONNECTED, // initial state
+} net_state_t;
+
+
+// these variables stay initialized for the whole runtime
+static net_state_t state;
+static xmpp_log_t* log;
+static xmpp_ctx_t* ctx;
+
+
+void net_init(void) {
+
+ printf("limox: net_init()\n");
+
+ xmpp_initialize();
+ log = xmpp_get_default_logger(XMPP_LEVEL_DEBUG); // or NULL for silence
+ ctx = xmpp_ctx_new(NULL, log);
+
+ state = DISCONNECTED;
+}
+
+void net_run_once(void) {
+ // TODO
+}
+
+void net_quit(void) {
+
+ printf("limox: net_quit()\n");
+
+ xmpp_ctx_free(ctx);
+ xmpp_shutdown();
+
+}
+
+void net_connect(const char* jid, const char* password) {
+ // TODO
+}
+
+void net_disconnect(void) {
+ // TODO
+}
+
+void net_send_message(const char* sender, const char* content,
+ const char* recipient) {
+ // TODO
+}