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
65c5cbe1
Commit
65c5cbe1
authored
Oct 24, 2013
by
vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unread count
parent
f9cf3929
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
interface.c
interface.c
+12
-3
loop.c
loop.c
+2
-0
mtproto-client.c
mtproto-client.c
+5
-0
No files found.
interface.c
View file @
65c5cbe1
...
...
@@ -35,10 +35,18 @@
#include "structures.h"
#include "mtproto-common.h"
char
*
default_prompt
=
">"
;
char
*
default_prompt
=
"> "
;
int
unread_messages
;
char
*
get_default_prompt
(
void
)
{
static
char
buf
[
100
];
if
(
unread_messages
)
{
sprintf
(
buf
,
COLOR_RED
"[%d unread]"
COLOR_NORMAL
"%s"
,
unread_messages
,
default_prompt
);
return
buf
;
}
else
{
return
default_prompt
;
}
}
char
*
complete_none
(
const
char
*
text
UU
,
int
state
UU
)
{
...
...
@@ -385,7 +393,8 @@ void print_start (void) {
void
print_end
(
void
)
{
assert
(
prompt_was
);
if
(
readline_active
)
{
rl_restore_prompt
();
rl_set_prompt
(
get_default_prompt
());
rl_redisplay
();
rl_replace_line
(
saved_line
,
0
);
rl_point
=
saved_point
;
rl_redisplay
();
...
...
loop.c
View file @
65c5cbe1
...
...
@@ -48,6 +48,7 @@ int default_dc_num;
extern
int
unknown_user_list_pos
;
extern
int
unknown_user_list
[];
int
unread_messages
;
void
net_loop
(
int
flags
,
int
(
*
is_end
)(
void
))
{
while
(
!
is_end
())
{
struct
pollfd
fds
[
101
];
...
...
@@ -75,6 +76,7 @@ void net_loop (int flags, int (*is_end)(void)) {
}
work_timers
();
if
((
flags
&
1
)
&&
(
fds
[
0
].
revents
&
POLLIN
))
{
unread_messages
=
0
;
rl_callback_read_char
();
}
connections_poll_result
(
fds
+
cc
,
x
-
cc
);
...
...
mtproto-client.c
View file @
65c5cbe1
...
...
@@ -633,6 +633,8 @@ int auth_work_start (struct connection *c UU) {
void
rpc_execute_answer
(
struct
connection
*
c
,
long
long
msg_id
UU
);
int
unread_messages
;
int
our_id
;
void
work_update
(
struct
connection
*
c
UU
,
long
long
msg_id
UU
)
{
unsigned
op
=
fetch_int
();
switch
(
op
)
{
...
...
@@ -640,6 +642,7 @@ void work_update (struct connection *c UU, long long msg_id UU) {
{
struct
message
*
M
=
fetch_alloc_message
();
fetch_int
();
//pts
unread_messages
++
;
print_message
(
M
);
break
;
};
...
...
@@ -936,12 +939,14 @@ void work_updates (struct connection *c, long long msg_id) {
void
work_update_short_message
(
struct
connection
*
c
UU
,
long
long
msg_id
UU
)
{
assert
(
fetch_int
()
==
(
int
)
CODE_update_short_message
);
struct
message
*
M
=
fetch_alloc_message_short
();
unread_messages
++
;
print_message
(
M
);
}
void
work_update_short_chat_message
(
struct
connection
*
c
UU
,
long
long
msg_id
UU
)
{
assert
(
fetch_int
()
==
CODE_update_short_chat_message
);
struct
message
*
M
=
fetch_alloc_message_short_chat
();
unread_messages
++
;
print_message
(
M
);
}
...
...
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