diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -11,6 +11,7 @@ #include "command.h" #include "conn_data.h" #include "db.h" +#include "event.h" #include "net.h" #include "runloop.h" #include "user_data.h" @@ -145,15 +146,34 @@ void srandomdev(void){ } #endif +__attribute__((unused)) +static void dummy_event_handler(const struct event_item *event){ + switch(event->type){ + case EVENT_MESSAGE: + debug("event: <%s>@%s: %s",event->user,event->room,event->message); + break; + + case EVENT_ONLINE: + debug("event: <%s> online=%" PRIi64,event->user,event->num); + break; + + case EVENT_JOIN: + debug("event: <%s> joins %s",event->user,event->room); + break; + } +} + int main(void){ srandomdev(); db_init(); int sock=create_server_socket(); printf("Listening on port %d\n",PORT); + // event_register(dummy_event_handler); runloop_set_timeout(60*1000000,timeout_callback); runloop_add_fd(sock,server_socket_callback,false); runloop_run(); printf("Runloop empty, shutting down\n"); + // event_unregister(dummy_event_handler); db_close(); } |