summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-03-20 20:46:25 +0000
committerFreeArtMan <dos21h@gmail.com>2017-03-20 20:46:25 +0000
commit3402dd6ff49bb1567def4e7bfba1f877ffbd0786 (patch)
treef3068c56fcac0deca4e30e304263f288f4bf8bb7
parent0ae9dc3dfe4b1bd24a0d0385480d9ad7d07d0976 (diff)
downloadagni-3402dd6ff49bb1567def4e7bfba1f877ffbd0786.tar.gz
agni-3402dd6ff49bb1567def4e7bfba1f877ffbd0786.zip
Small clean up
-rw-r--r--agni.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/agni.c b/agni.c
index 08259ba..e4dbe34 100644
--- a/agni.c
+++ b/agni.c
@@ -358,11 +358,6 @@ int th_start_client(void *data)
PERM();
}
-
-
-
-
-
atomic_fetch_add(&cfg->running,1);
printf("Start client\n");
printf("Server %d\n",cfg->tid);
@@ -428,7 +423,6 @@ int th_start_client(void *data)
ib = irc_buf_create();
if (ib == NULL)
{
- PNL();
PERM();
//return 0;
}
@@ -450,15 +444,12 @@ int th_start_client(void *data)
PRINT("MQ_EVENT IN\n");
if (mq_ntf_read(mq, MQ_IN, in_buf, in_attr.mq_msgsize) == -1)
{
- PNL();
printf("Cant read input message \n");
} else
{
- //PNL();
in_buf[in_attr.mq_msgsize-1] = 0x0;
PRINT("Recieve %s\n", in_buf);
}
- PNL();
break;
default:
printf("Unknown event type\n");
@@ -490,41 +481,31 @@ int th_start_client(void *data)
memset(match_resp, 0, sizeof(tble_cmd_resp));
if (match_resp != NULL)
{
- //PNL();
match_resp->qid = mq_cmd_id(recv_cmd);
//for now any type is ok, make time consistant, for this usage
//match_cmd->type = QCMD_NONE
- //PNL();
match_resp->resp = alloc_new_str_s(paramPtr, paramSz);
- //PNL();
//check if command match
int cmd_id = tbl_qcmd_resp(qtbl, match_resp);
if (cmd_id > 0)
{
- PRINT("%d\n",cmd_id);
tble_qcmd *cmd = tbl_qcmd_match_id(qtbl, cmd_id);
- PNL();
if (cmd != NULL)
{
int buf_sz = TH_CONN_BUF_SZ>128?128:TH_CONN_BUF_SZ;
- PNL();
char *resp_user = token_new_str(cmd->tok,0);
char *sep = strchr(resp_user,'!');
resp_user[sep-resp_user] = 0x0;
- PNL();
memset(cmd_buf, 0, buf_sz);
- PNL();
//prepare response
int fret = snprintf(cmd_buf, buf_sz,":%s PRIVMSG %s :%s \r\n",cfg->user,resp_user,match_resp->resp);
- PRINT("cmd_buf %s \n", cmd_buf);
write(conn, cmd_buf, fret);
free(resp_user);
-
}
}
@@ -592,8 +573,6 @@ int th_start_client(void *data)
memset(cmd_buf,0,128);
char *uname = token_new_str(itok,0);
char *msg = token_new_str(itok,3);
-
- PRINT("msg %s\n", msg);
char *sep = strchr(uname,'!');
uname[sep-uname] = 0x0;
@@ -621,9 +600,7 @@ int th_start_client(void *data)
|TBL_PF_QCMD_TID
|TBL_PF_QCMD_TIDX);
}
-
- PRINT("msg %s\n", msg);
-
+
//create command and send to mq
mq_cmd *privcmd = mq_cmd_create(qcmd->cid,"PRIVMSG",strlen("PRIVMSG"),msg,strlen(msg));
char *bufPtr;
@@ -637,7 +614,7 @@ int th_start_client(void *data)
free(msg);
free(uname);
- printf("OUT<<Send %d\n", fret);
+ //printf("OUT<<Send %d\n", fret);
}
token_destroy(itok);