summaryrefslogtreecommitdiff
path: root/net_rewrite.c
blob: 3ab9726d30c56448bceefeb339c133cf3bae238e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
}