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
82cf0315
Commit
82cf0315
authored
Jun 09, 2015
by
luckydonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added to group chats: "admin": peer, members.<user>.inviter
parent
77cfd51d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
json-tg.c
json-tg.c
+7
-3
No files found.
json-tg.c
View file @
82cf0315
...
...
@@ -57,16 +57,20 @@ void json_pack_user (json_t *res, tgl_peer_t *P) {
void
json_pack_chat
(
json_t
*
res
,
tgl_peer_t
*
P
)
{
assert
(
P
->
chat
.
title
);
assert
(
json_object_set
(
res
,
"title"
,
json_string
(
P
->
chat
.
title
))
>=
0
);
tgl_peer_id_t
admin_id
=
TGL_MK_USER
(
P
->
chat
.
admin_id
);
assert
(
json_object_set
(
res
,
"admin"
,
json_pack_peer
(
admin_id
,
tgl_peer_get
(
TLS
,
admin_id
)))
>=
0
);
assert
(
json_object_set
(
res
,
"members_num"
,
json_integer
(
P
->
chat
.
users_num
))
>=
0
);
if
(
P
->
chat
.
user_list
)
{
json_t
*
m
=
json_array
();
assert
(
m
);
int
i
;
for
(
i
=
0
;
i
<
P
->
chat
.
users_num
;
i
++
)
{
tgl_peer_id_t
id
=
TGL_MK_USER
(
P
->
chat
.
user_list
[
i
].
user_id
);
assert
(
json_array_append
(
m
,
json_pack_peer
(
id
,
tgl_peer_get
(
TLS
,
id
)))
>=
0
);
tgl_peer_id_t
user_id
=
TGL_MK_USER
(
P
->
chat
.
user_list
[
i
].
user_id
);
tgl_peer_id_t
inviter_id
=
TGL_MK_USER
(
P
->
chat
.
user_list
[
i
].
inviter_id
);
json_t
*
peer
=
json_pack_peer
(
user_id
,
tgl_peer_get
(
TLS
,
user_id
));
assert
(
json_object_set
(
peer
,
"inviter"
,
json_pack_peer
(
inviter_id
,
tgl_peer_get
(
TLS
,
user_id
)))
>=
0
);
assert
(
json_array_append
(
m
,
peer
)
>=
0
);
}
assert
(
json_object_set
(
res
,
"members"
,
m
)
>=
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