diff options
-rw-r--r-- | agni.c | 13 | ||||
-rw-r--r-- | tbl_qcmd.c | 5 |
2 files changed, 13 insertions, 5 deletions
@@ -485,6 +485,7 @@ int th_start_client(void *data) //wrong tble_cmd_resp *match_resp = malloc(sizeof(tble_cmd_resp)); + memset(match_resp, 0, sizeof(tble_cmd_resp)); if (match_resp != NULL) { PNL(); @@ -496,14 +497,14 @@ int th_start_client(void *data) PNL(); //check if command match - //int cmd_id = tbl_qcmd_resp(qtbl, match_resp); - //if (cmd_id > 0) + int cmd_id = tbl_qcmd_resp(qtbl, match_resp); + if (cmd_id > 0) { PNL(); - // PRINT("%d\n",cmd_id); + PRINT("%d\n",cmd_id); } - tbl_cmd_param_free(match_resp); + tbl_cmd_resp_free(match_resp); } //lets memleak here @@ -583,6 +584,7 @@ int th_start_client(void *data) qcmd->state = QCMD_NONE; qcmd->cmd = alloc_new_str("PRIVMSG"); qcmd->param = alloc_new_str(msg); + tbl_qcmd_add_tok(qcmd, itok); tbl_qcmd_add(qtbl, qcmd); tbl_qcmd_print_tbl(qtbl,TBL_PF_QCMD_ID |TBL_PF_QCMD_CID @@ -823,6 +825,9 @@ int th_event_manager(void *data) char msg[] = "Forever"; mq_cmd *privcmd = mq_cmd_create(mq_cmd_id(recv_cmd),"PRIVMSG",strlen("PRIVMSG"),msg,strlen(msg)); + int id = mq_cmd_id(recv_cmd); + PRINT("%d\n",id); + char *cmdBuf = mq_cmd_buf(privcmd); mq_ntf_write(mq, MQ_IN, cmdBuf, strlen(cmdBuf)); cmdBuf = NULL; @@ -373,7 +373,7 @@ int tbl_qcmd_resp(tbl_qcmd *tbl, tble_cmd_resp *resp) //check this for particular checks if ((single_cmd->cid == resp->qid)) { - return i; + return single_cmd->id; } } @@ -414,8 +414,11 @@ int tbl_cmd_param_free(tble_cmd_param *param) return -1; } + PNL(); free(param->cmd); + PNL(); free(param->param); + PNL(); free(param); return 0; |