Commit 95094949 authored by luckydonald's avatar luckydonald

Added out-of-range error status. (@vysheng: Not sure if I did that correctly.)

parent d30885e9
...@@ -1122,13 +1122,21 @@ void do_history (struct command *command, int arg_num, struct arg args[], struct ...@@ -1122,13 +1122,21 @@ void do_history (struct command *command, int arg_num, struct arg args[], struct
tgl_do_get_history (TLS, args[0].P->id, args[2].num != NOT_FOUND ? args[2].num : 0, args[1].num != NOT_FOUND ? args[1].num : 40, offline_mode, print_msg_list_gw, ev); tgl_do_get_history (TLS, args[0].P->id, args[2].num != NOT_FOUND ? args[2].num : 0, args[1].num != NOT_FOUND ? args[1].num : 40, offline_mode, print_msg_list_gw, ev);
} }
void print_fail (struct in_ev *ev);
void do_send_typing (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) { void do_send_typing (struct command *command, int arg_num, struct arg args[], struct in_ev *ev) {
assert (arg_num == 2); assert (arg_num == 2);
if (ev) { ev->refcnt ++; }
enum tgl_typing_status status = tgl_typing_typing; //de enum tgl_typing_status status = tgl_typing_typing; //de
if (args[1].num != NOT_FOUND && args[1].num >= 0 && args[1].num <= 10) { if (args[1].num != NOT_FOUND) {
if (args[1].num > 0 && args[1].num > 10) {
TLS->error_code = ENOSYS;
TLS->error = strdup("illegal typing status");
print_fail(ev);
return;
}
status = (enum tgl_typing_status) args[1].num; // if the status parameter is given, and is in range. status = (enum tgl_typing_status) args[1].num; // if the status parameter is given, and is in range.
} }
if (ev) { ev->refcnt ++; }
tgl_do_send_typing (TLS, args[0].P->id, status, print_success_gw, ev); tgl_do_send_typing (TLS, args[0].P->id, status, print_success_gw, ev);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment