aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-05-23 09:35:01 +0200
committertomsmeding <tom.smeding@gmail.com>2017-05-23 09:35:01 +0200
commite5b02b16ba83b55ef12dff19c18cb03d9e1fad32 (patch)
tree82c9c84bf6b07d331304ba7f0b90f078fd5d85c8
parent2678a700401caf1b7e49c98cc1b6db8e416cfc65 (diff)
server: WIP firebase: add cmd_delete_firebase_token
-rw-r--r--command.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/command.c b/command.c
index c5891d5..fcbb64f 100644
--- a/command.c
+++ b/command.c
@@ -306,6 +306,15 @@ static bool cmd_firebase_token(struct conn_data *data,const char *tag,const char
return net_send_ok(data->fd,tag);
}
+static bool cmd_delete_firebase_token(struct conn_data *data,const char *tag,const char **args){
+ if(data->userid==-1){
+ net_send_error(data->fd,tag,"Not logged in");
+ return false;
+ }
+ db_delete_token(data->userid,args[0]);
+ return net_send_ok(data->fd,tag);
+}
+
struct cmd_info{
const char *cmdname;
@@ -327,6 +336,7 @@ static const struct cmd_info commands[]={
{"ping",0,false,cmd_ping},
{"is_online",1,false,cmd_is_online},
{"firebase_token",1,false,cmd_firebase_token},
+ {"delete_firebase_token",1,false,cmd_delete_firebase_token},
};
#define NCOMMANDS (sizeof(commands)/sizeof(commands[0]))