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
27d21948
Commit
27d21948
authored
May 27, 2015
by
vvaltman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'luckydonald-master'
parents
66f1da63
9268a89d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
json-tg.c
json-tg.c
+44
-0
No files found.
json-tg.c
View file @
27d21948
...
...
@@ -245,6 +245,49 @@ json_t *json_pack_media (struct tgl_message_media *M) {
return
res
;
}
json_t
*
json_pack_typing
(
enum
tgl_typing_status
status
)
{
json_t
*
res
=
json_object
();
switch
(
status
)
{
case
tgl_typing_none
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"doing nothing"
))
>=
0
);
break
;
case
tgl_typing_typing
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"typing"
))
>=
0
);
break
;
case
tgl_typing_cancel
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"deleting typed message"
))
>=
0
);
break
;
case
tgl_typing_record_video
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"recording video"
))
>=
0
);
break
;
case
tgl_typing_upload_video
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"uploading video"
))
>=
0
);
break
;
case
tgl_typing_record_audio
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"recording audio"
))
>=
0
);
break
;
case
tgl_typing_upload_audio
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"uploading audio"
))
>=
0
);
break
;
case
tgl_typing_upload_photo
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"uploading photo"
))
>=
0
);
break
;
case
tgl_typing_upload_document
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"uploading document"
))
>=
0
);
break
;
case
tgl_typing_geo
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"choosing location"
))
>=
0
);
break
;
case
tgl_typing_choose_contact
:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"choosing contact"
))
>=
0
);
break
;
default:
assert
(
json_object_set
(
res
,
"status"
,
json_string
(
"???"
))
>=
0
);
break
;
}
return
res
;
}
json_t
*
json_pack_service
(
struct
tgl_message
*
M
)
{
json_t
*
res
=
json_object
();
switch
(
M
->
action
.
type
)
{
...
...
@@ -308,6 +351,7 @@ json_t *json_pack_service (struct tgl_message *M) {
break
;
case
tgl_message_action_typing
:
assert
(
json_object_set
(
res
,
"type"
,
json_string
(
"typing"
))
>=
0
);
assert
(
json_array_append
(
res
,
json_pack_typing
(
M
->
action
.
typing
))
>=
0
);
break
;
case
tgl_message_action_noop
:
assert
(
json_object_set
(
res
,
"type"
,
json_string
(
"noop"
))
>=
0
);
...
...
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