version 1.5, 2013/03/24 09:27:20 |
version 1.6, 2013/03/24 09:54:10 |
|
|
* Show client message log. |
* Show client message log. |
*/ |
*/ |
|
|
enum cmd_retval cmd_show_messages_exec(struct cmd *, struct cmd_ctx *); |
enum cmd_retval cmd_show_messages_exec(struct cmd *, struct cmd_q *); |
|
|
const struct cmd_entry cmd_show_messages_entry = { |
const struct cmd_entry cmd_show_messages_entry = { |
"show-messages", "showmsgs", |
"show-messages", "showmsgs", |
|
|
}; |
}; |
|
|
enum cmd_retval |
enum cmd_retval |
cmd_show_messages_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_show_messages_exec(struct cmd *self, struct cmd_q *cmdq) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct client *c; |
struct client *c; |
|
|
char *tim; |
char *tim; |
u_int i; |
u_int i; |
|
|
if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL) |
if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL) |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
|
|
for (i = 0; i < ARRAY_LENGTH(&c->message_log); i++) { |
for (i = 0; i < ARRAY_LENGTH(&c->message_log); i++) { |
|
|
tim = ctime(&msg->msg_time); |
tim = ctime(&msg->msg_time); |
*strchr(tim, '\n') = '\0'; |
*strchr(tim, '\n') = '\0'; |
|
|
ctx->print(ctx, "%s %s", tim, msg->msg); |
cmdq_print(cmdq, "%s %s", tim, msg->msg); |
} |
} |
|
|
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |