aboutsummaryrefslogtreecommitdiffstats
path: root/agni.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-10-29 15:44:42 +0000
committerFreeArtMan <dos21h@gmail.com>2017-10-29 15:44:42 +0000
commitbb57317f22b94970d78a97915763b0dbe1d7742d (patch)
tree92982a2bd0b179c8b147deacb4f8ad505c1b2aee /agni.c
parentbed9bfcdf6b7740cc32ccf260f024e7c0a4e7503 (diff)
downloadagni-bb57317f22b94970d78a97915763b0dbe1d7742d.tar.gz
agni-bb57317f22b94970d78a97915763b0dbe1d7742d.zip
Make rpc and todo command working, with sqlite shitz
Diffstat (limited to 'agni.c')
-rw-r--r--agni.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/agni.c b/agni.c
index 891261b..520ef45 100644
--- a/agni.c
+++ b/agni.c
@@ -134,6 +134,33 @@ tble_cmd_resp* cllbk_wrapper( void *(*call)(void *), tble_cmd_param *param)
}
/*
+convert irc ident to 3 newly alocated string
+*/
+int irciedent_parse(char *ident, rpc_request *req)
+{
+ int count1, count2;
+ sds params1 = sdsnew(ident), params2;
+ sds *tokens1, *tokens2;
+
+ tokens1 = sdssplitlen(params1, sdslen(params1), "!", 1, &count1);
+
+ req->user = alloc_new_str(tokens1[0]);
+
+ params2 = sdsnew(tokens1[1]);
+ tokens2 = sdssplitlen(params2, sdslen(params2), "@", 1, &count2);
+
+ req->mask = alloc_new_str(tokens2[0]);
+ req->server = alloc_new_str(tokens2[1]);
+
+ sdsfree(params1);
+ sdsfree(params2);
+ sdsfreesplitres(tokens1, count1);
+ sdsfreesplitres(tokens2, count2);
+
+ return 0;
+}
+
+/*
return unique ID, with atomic counter should work in all cases
*/
_Atomic int _glbl_id=0;
@@ -556,9 +583,7 @@ int th_start_client(void *data)
}
req = rpc_req_new(qcmd->cmd, qcmd->param, qcmd->cid);
- req->user = alloc_new_str("U-ser");
- req->mask = alloc_new_str("M-ask");
- req->server = alloc_new_str("S-erver");
+ irciedent_parse(qcmd->ircident, req);
rpc_req_marsh(req, &nb_req);
buf_nb = nb_create(nb_req);