Fix capped whoip/history messages due to limit of 1024 bytes imposed wrongly on outgoing server generated messages.

This commit is contained in:
Jan Vidar Krey 2009-08-02 21:58:12 +02:00
parent cfb8a9f322
commit 077bffd74f

View File

@ -330,13 +330,13 @@ static int command_whoip(struct hub_info* hub, struct hub_user* user, struct hub
} }
char tmp[128]; char tmp[128];
snprintf(tmp, 128, "Found %d match%s:", (int) ret, ((ret != 1) ? "es" : "")); snprintf(tmp, 128, "*** %s: Found %d match%s:", cmd->prefix, (int) ret, ((ret != 1) ? "es" : ""));
char* buffer = hub_malloc(((MAX_NICK_LEN + INET6_ADDRSTRLEN + 5) * ret) + strlen(tmp) + 3); char* buffer = hub_malloc(((MAX_NICK_LEN + INET6_ADDRSTRLEN + 5) * ret) + strlen(tmp) + 3);
buffer[0] = 0; buffer[0] = 0;
strcat(buffer, tmp); strcat(buffer, tmp);
strcat(buffer, "\n"); strcat(buffer, "\n");
u = (struct hub_user*) list_get_first(users); u = (struct hub_user*) list_get_first(users);
while (u) while (u)
{ {
@ -348,9 +348,9 @@ static int command_whoip(struct hub_info* hub, struct hub_user* user, struct hub
} }
strcat(buffer, "\n"); strcat(buffer, "\n");
ret = command_status(hub, user, cmd, buffer); send_message(hub, user, buffer);
hub_free(buffer); hub_free(buffer);
return ret; return 0;
} }
static int command_broadcast(struct hub_info* hub, struct hub_user* user, struct hub_command* cmd) static int command_broadcast(struct hub_info* hub, struct hub_user* user, struct hub_command* cmd)
@ -376,7 +376,7 @@ static int command_history(struct hub_info* hub, struct hub_user* user, struct h
} }
char tmp[128]; char tmp[128];
snprintf(tmp, 128, "Found %d message%s:", (int) ret, ((ret != 1) ? "s" : "")); snprintf(tmp, 128, "*** %s: Found %d message%s:", cmd->prefix, (int) ret, ((ret != 1) ? "s" : ""));
bufsize = strlen(tmp); bufsize = strlen(tmp);
message = (char*) list_get_first(messages); message = (char*) list_get_first(messages);
while (message) while (message)
@ -403,9 +403,9 @@ static int command_history(struct hub_info* hub, struct hub_user* user, struct h
} }
strcat(buffer, "\n"); strcat(buffer, "\n");
ret = command_status(hub, user, cmd, buffer); send_message(hub, user, buffer);
hub_free(buffer); hub_free(buffer);
return ret; return 0;
} }
static int command_log(struct hub_info* hub, struct hub_user* user, struct hub_command* cmd) static int command_log(struct hub_info* hub, struct hub_user* user, struct hub_command* cmd)