summaryrefslogtreecommitdiff
path: root/src/base/checkFront.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/checkFront.c')
-rw-r--r--src/base/checkFront.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/base/checkFront.c b/src/base/checkFront.c
index 53984fb..571cdd3 100644
--- a/src/base/checkFront.c
+++ b/src/base/checkFront.c
@@ -24,6 +24,7 @@ static checkfront_t *newCheck(char *s, int type, int id)
checkfront_t *new;
assert(s != NULL);
+
new = malloc(sizeof(checkfront_t));
memset(new, 0, sizeof(checkfront_t));
new->msg = strdup(s);
@@ -31,6 +32,7 @@ static checkfront_t *newCheck(char *s, int type, int id)
new->id = id;
new->type = type;
new->count = 0;
+
return new;
}
@@ -50,6 +52,7 @@ void addMsgInCheckFront(list_t * list, char *msg, int type, int id)
{
if (type == CHECK_FRONT_TYPE_CHECK)
incID(id);
+
addList(list, newCheck(msg, type, id));
}
@@ -59,32 +62,33 @@ void eventMsgInCheckFront(client_t * client)
int i;
currentTime = getMyTime();
+
for (i = 0; i < client->listSendMsg->count; i++) {
checkfront_t *this;
this = (checkfront_t *) client->listSendMsg->list[i];
+
switch (this->type) {
- case CHECK_FRONT_TYPE_SIMPLE:
- sendClient(client, this->msg);
- delListItem(client->listSendMsg, i, destroyCheck);
- i--;
- break;
- case CHECK_FRONT_TYPE_CHECK:
- if (this->count == 0
- || currentTime - this->time > CHECK_FRONT_SEND_TIME_INTERVAL) {
+ case CHECK_FRONT_TYPE_SIMPLE:
sendClient(client, this->msg);
- this->time = currentTime;
- this->count++;
- }
- if (this->count > CHECK_FRONT_MAX_COUNT_SEND) {
- delID(this->id);
delListItem(client->listSendMsg, i, destroyCheck);
i--;
- }
- break;
- default:
- assert(!_("Bad type of front!"));
- break;
+ break;
+ case CHECK_FRONT_TYPE_CHECK:
+ if (this->count == 0 || currentTime - this->time > CHECK_FRONT_SEND_TIME_INTERVAL) {
+ sendClient(client, this->msg);
+ this->time = currentTime;
+ this->count++;
+ }
+ if (this->count > CHECK_FRONT_MAX_COUNT_SEND) {
+ delID(this->id);
+ delListItem(client->listSendMsg, i, destroyCheck);
+ i--;
+ }
+ break;
+ default:
+ assert(!_("Bad type of front!"));
+ break;
}
}
}
@@ -97,6 +101,7 @@ void delMsgInCheckFront(list_t * listCheckFront, int id)
checkfront_t *this;
this = (checkfront_t *) listCheckFront->list[i];
+
if (this->id == id) {
delID(this->id);
delListItem(listCheckFront, i, destroyCheck);