Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
95094949
Commit
95094949
authored
May 20, 2015
by
luckydonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added out-of-range error status. (@vysheng: Not sure if I did that correctly.)
parent
d30885e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
interface.c
interface.c
+12
-4
No files found.
interface.c
View file @
95094949
...
...
@@ -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
);
}
...
...
@@ -1677,14 +1685,14 @@ void print_fail (struct in_ev *ev) {
void
fail_interface
(
struct
tgl_state
*
TLS
,
struct
in_ev
*
ev
,
int
error_code
,
const
char
*
format
,
...)
__attribute__
((
format
(
printf
,
4
,
5
)));
void
fail_interface
(
struct
tgl_state
*
TLS
,
struct
in_ev
*
ev
,
int
error_code
,
const
char
*
format
,
...)
{
static
char
error
[
1001
];
va_list
ap
;
va_start
(
ap
,
format
);
int
error_len
=
vsnprintf
(
error
,
1000
,
format
,
ap
);
va_end
(
ap
);
if
(
error_len
>
1000
)
{
error_len
=
1000
;
}
error
[
error_len
]
=
0
;
mprint_start
(
ev
);
if
(
!
enable_json
)
{
mprintf
(
ev
,
"FAIL: %d: %s
\n
"
,
error_code
,
error
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment