aboutsummaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-05-08 22:06:47 +0200
committertomsmeding <tom.smeding@gmail.com>2017-05-08 22:08:56 +0200
commita7a0ce278e661bf5d3f2b47556d8c30469d2bd6c (patch)
treedef6c7b56df0b21351c4f1b0766163426ee47649 /command.c
parent886fc77026a2a805e5d166b2f87bd24720ad9ea4 (diff)
server: Add event system
Diffstat (limited to 'command.c')
-rw-r--r--command.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/command.c b/command.c
index b0b9a26..0ae7fa3 100644
--- a/command.c
+++ b/command.c
@@ -7,6 +7,7 @@
#include "broadcast.h"
#include "command.h"
#include "db.h"
+#include "event.h"
#include "net.h"
#include "user_data.h"
#include "util.h"
@@ -160,6 +161,8 @@ static bool cmd_invite(struct conn_data *data,const char *tag,const char **args)
char *invitebuf=NULL;
i64 invitebuflen=asprintf(&invitebuf,"_push invite %s\n",roomname);
+ event_emit_join(make_timestamp(),username,roomname);
+
struct db_user_list members=db_list_members(roomid);
for(i64 i=0;i<members.count;i++){
i64 nfds;
@@ -208,6 +211,8 @@ static bool cmd_send(struct conn_data *data,const char *tag,const char **args){
char *username=db_get_username(data->userid);
i64 pushbuflen=asprintf(&pushbuf,"_push message %s %s %" PRIi64 " %s\n",
roomname,username,timestamp,message);
+
+ event_emit_message(timestamp,message,username,roomname);
free(username);
struct db_user_list members=db_list_members(roomid);