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
efc7673a
Commit
efc7673a
authored
Dec 23, 2013
by
Vysheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge github.com:vysheng/tg
parents
1dcbce52
069fe471
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
3 deletions
+19
-3
README.md
README.md
+1
-1
configure.ac
configure.ac
+0
-1
interface.c
interface.c
+5
-0
loop.c
loop.c
+8
-1
queries.c
queries.c
+5
-0
No files found.
README.md
View file @
efc7673a
## Telegram messenger CLI [![Build Status](https://travis-ci.org/
lwhsu/tg.png)](https://travis-ci.org/lwhsu
/tg)
## Telegram messenger CLI [![Build Status](https://travis-ci.org/
vysheng/tg.png)](https://travis-ci.org/vysheng
/tg)
Command-line interface for
[
Telegram
](
http://telegram.org
)
. Uses readline interface.
...
...
configure.ac
View file @
efc7673a
...
...
@@ -22,7 +22,6 @@ AC_CHECK_FUNC([backtrace],
)
if test "x$BT" = "x" ; then
AC_MSG_RESULT([no])
AC_CHECK_LIB([execinfo], [backtrace])
[ EXTRA_LIBS="${EXTRA_LIBS} -lexecinfo" ; ]
fi
...
...
interface.c
View file @
efc7673a
...
...
@@ -49,6 +49,8 @@ char *default_prompt = "> ";
int
unread_messages
;
int
msg_num_mode
;
int
safe_quit
;
int
in_readline
;
int
readline_active
;
...
...
@@ -304,6 +306,7 @@ char *commands[] = {
"status_offline"
,
"contacts_search"
,
"quit"
,
"safe_quit"
,
"send_audio"
,
"load_audio"
,
"view_audio"
,
...
...
@@ -1062,6 +1065,8 @@ void interpreter (char *line UU) {
chat_mode_id
=
id
;
}
else
if
(
IS_WORD
(
"quit"
))
{
exit
(
0
);
}
else
if
(
IS_WORD
(
"safe_quit"
))
{
safe_quit
=
1
;
}
}
#undef IS_WORD
...
...
loop.c
View file @
efc7673a
...
...
@@ -59,6 +59,8 @@ extern int binlog_enabled;
extern
int
unknown_user_list_pos
;
extern
int
unknown_user_list
[];
int
register_mode
;
extern
int
safe_quit
;
extern
int
queries_num
;
int
unread_messages
;
void
got_it
(
char
*
line
,
int
len
);
...
...
@@ -93,10 +95,15 @@ void net_loop (int flags, int (*is_end)(void)) {
}
}
connections_poll_result
(
fds
+
cc
,
x
-
cc
);
if
(
safe_quit
&&
!
queries_num
)
{
printf
(
"All done. Exit
\n
"
);
rl_callback_handler_remove
();
exit
(
0
);
}
if
(
unknown_user_list_pos
)
{
do_get_user_list_info_silent
(
unknown_user_list_pos
,
unknown_user_list
);
unknown_user_list_pos
=
0
;
}
}
}
}
...
...
queries.c
View file @
efc7673a
...
...
@@ -66,6 +66,8 @@ long long cur_downloaded_bytes;
extern
int
binlog_enabled
;
extern
int
sync_from_start
;
int
queries_num
;
void
out_peer_id
(
peer_id_t
id
);
#define QUERY_TIMEOUT 6.0
...
...
@@ -150,6 +152,7 @@ struct query *send_query (struct dc *DC, int ints, void *data, struct query_meth
insert_event_timer
(
&
q
->
ev
);
q
->
extra
=
extra
;
queries_num
++
;
return
q
;
}
...
...
@@ -188,6 +191,7 @@ void query_error (long long id) {
free
(
q
->
data
);
free
(
q
);
}
queries_num
--
;
}
#define MAX_PACKED_SIZE (1 << 24)
...
...
@@ -255,6 +259,7 @@ void query_result (long long id UU) {
in_ptr
=
end
;
in_end
=
eend
;
}
queries_num
--
;
}
#define event_timer_cmp(a,b) ((a)->timeout > (b)->timeout ? 1 : ((a)->timeout < (b)->timeout ? -1 : (memcmp (a, b, sizeof (struct event_timer)))))
...
...
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