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
d289aeb8
Commit
d289aeb8
authored
Oct 23, 2013
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark messages as read after history query
parent
bb9a6143
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
1 deletion
+38
-1
queries.c
queries.c
+38
-1
No files found.
queries.c
View file @
d289aeb8
...
...
@@ -541,6 +541,39 @@ void do_send_text (union user_chat *U, char *file_name) {
}
}
int
mark_read_on_receive
(
struct
query
*
q
UU
)
{
assert
(
fetch_int
()
==
(
int
)
CODE_messages_affected_history
);
fetch_int
();
// pts
fetch_int
();
// seq
fetch_int
();
// offset
return
0
;
}
struct
query_methods
mark_read_methods
=
{
.
on_answer
=
mark_read_on_receive
};
void
do_messages_mark_read
(
union
user_chat
*
U
,
int
max_id
)
{
clear_packet
();
out_int
(
CODE_messages_read_history
);
if
(
U
->
id
<
0
)
{
out_int
(
CODE_input_peer_chat
);
out_int
(
-
U
->
id
);
}
else
{
if
(
U
->
user
.
access_hash
)
{
out_int
(
CODE_input_peer_foreign
);
out_int
(
U
->
id
);
out_long
(
U
->
user
.
access_hash
);
}
else
{
out_int
(
CODE_input_peer_contact
);
out_int
(
U
->
id
);
}
}
out_int
(
max_id
);
out_int
(
0
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
mark_read_methods
,
0
);
}
int
get_history_on_answer
(
struct
query
*
q
UU
)
{
static
struct
message
*
ML
[
10000
];
int
i
;
...
...
@@ -560,6 +593,7 @@ int get_history_on_answer (struct query *q UU) {
}
}
if
(
n
>
10000
)
{
n
=
10000
;
}
int
sn
=
n
;
for
(
i
=
n
-
1
;
i
>=
0
;
i
--
)
{
print_message
(
ML
[
i
]);
}
...
...
@@ -573,6 +607,9 @@ int get_history_on_answer (struct query *q UU) {
for
(
i
=
0
;
i
<
n
;
i
++
)
{
fetch_alloc_user
();
}
if
(
sn
>
0
)
{
do_messages_mark_read
(
q
->
extra
,
ML
[
0
]
->
id
);
}
return
0
;
}
...
...
@@ -600,7 +637,7 @@ void do_get_history (union user_chat *U, int limit) {
out_int
(
0
);
out_int
(
0
);
out_int
(
limit
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
get_history_methods
,
0
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
get_history_methods
,
U
);
}
int
get_dialogs_on_answer
(
struct
query
*
q
UU
)
{
...
...
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