Added out-of-range error status. (@vysheng: Not sure if I did that correctly.)
This commit is contained in:
parent
d30885e9dc
commit
95094949ce
12
interface.c
12
interface.c
@ -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);
|
||||
}
|
||||
|
||||
void print_fail (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);
|
||||
if (ev) { ev->refcnt ++; }
|
||||
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.
|
||||
}
|
||||
if (ev) { ev->refcnt ++; }
|
||||
tgl_do_send_typing (TLS, args[0].P->id, status, print_success_gw, ev);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user