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
49eb2291
Commit
49eb2291
authored
Aug 25, 2014
by
vvaltman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interface updates
parent
7bcc3737
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
21 deletions
+54
-21
interface.c
interface.c
+3
-0
loop.c
loop.c
+9
-0
main.c
main.c
+42
-21
No files found.
interface.c
View file @
49eb2291
...
...
@@ -69,6 +69,7 @@
char
*
default_prompt
=
"> "
;
int
msg_num_mode
;
int
disable_colors
;
int
alert_sound
;
extern
int
binlog_read
;
...
...
@@ -1629,12 +1630,14 @@ int color_stack_pos;
const
char
*
color_stack
[
10
];
void
push_color
(
const
char
*
color
)
{
if
(
disable_colors
)
{
return
;
}
assert
(
color_stack_pos
<
10
);
color_stack
[
color_stack_pos
++
]
=
color
;
printf
(
"%s"
,
color
);
}
void
pop_color
(
void
)
{
if
(
disable_colors
)
{
return
;
}
assert
(
color_stack_pos
>
0
);
color_stack_pos
--
;
if
(
color_stack_pos
>=
1
)
{
...
...
loop.c
View file @
49eb2291
...
...
@@ -394,6 +394,10 @@ void read_auth_file (void) {
close
(
auth_file_fd
);
}
void
dlist_cb
(
void
*
callback_extra
,
int
success
,
int
size
,
tgl_peer_id_t
peers
[],
int
last_msg_id
[],
int
unread_count
[])
{
d_got_ok
=
1
;
}
int
loop
(
void
)
{
//on_start ();
tgl_set_callback
(
&
upd_cb
);
...
...
@@ -544,6 +548,11 @@ int loop (void) {
tgl_do_get_difference
(
sync_from_start
,
get_difference_callback
,
0
);
net_loop
(
0
,
dgot
);
assert
(
!
(
tgl_state
.
locks
&
TGL_LOCK_DIFF
));
if
(
wait_dialog_list
)
{
d_got_ok
=
0
;
tgl_do_get_dialog_list
(
dlist_cb
,
0
);
net_loop
(
0
,
dgot
);
}
#ifdef USE_LUA
lua_diff_end
();
#endif
...
...
main.c
View file @
49eb2291
...
...
@@ -92,6 +92,7 @@ extern int log_level;
int
sync_from_start
;
int
allow_weak_random
;
char
*
lua_file
;
int
disable_colors
;
void
set_default_username
(
const
char
*
s
)
{
if
(
default_username
)
{
...
...
@@ -375,22 +376,24 @@ void inner_main (void) {
void
usage
(
void
)
{
printf
(
"%s Usage
\n
"
,
PROGNAME
);
printf
(
" -h this help list
\n
"
);
printf
(
" -u username specify username
\n
"
);
printf
(
" -k public-key specify server public key
\n
"
);
printf
(
" -v verbose
\n
"
);
printf
(
" -l [1-3] log level
\n
"
);
printf
(
" -L log-file log net file
\n
"
);
printf
(
" -u specify username (would not be asked during authorization)
\n
"
);
printf
(
" -k specify location of public key (possible multiple entries)
\n
"
);
printf
(
" -v increase verbosity (0-ERROR 1-WARNIN 2-NOTICE 3+-DEBUG-levels)
\n
"
);
printf
(
" -N message num mode
\n
"
);
printf
(
" -c config-file specify config file
\n
"
);
printf
(
" -p prefix specify prefix
\n
"
);
printf
(
" -f sync from start
\n
"
);
#ifdef HAVE_LIBCONFIG
printf
(
" -c config file name
\n
"
);
printf
(
" -p use specified profile
\n
"
);
#else
printf
(
" -B enable binlog
\n
"
);
printf
(
" -E disable auto accept
\n
"
);
printf
(
" -w allow weak random
\n
"
);
printf
(
" -s specify lua script
\n
"
);
printf
(
" -W wait dialog list
\n
"
);
printf
(
"
\n
"
);
#endif
printf
(
" -l log level
\n
"
);
printf
(
" -f during authorization fetch all messages since registration
\n
"
);
printf
(
" -E diable auto accept of encrypted chats
\n
"
);
#ifdef USE_LUA
printf
(
" -s lua script file
\n
"
);
#endif
printf
(
" -W send dialog_list query and wait for answer before reading input
\n
"
);
printf
(
" -C disable color output
\n
"
);
exit
(
1
);
}
...
...
@@ -408,7 +411,17 @@ int wait_dialog_list;
void
args_parse
(
int
argc
,
char
**
argv
)
{
int
opt
=
0
;
while
((
opt
=
getopt
(
argc
,
argv
,
"u:hk:vn:Nc:p:l:fBEs:wW"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"u:hk:vNl:fEwWC"
#ifdef HAVE_LIBCONFIG
"c:p:"
#else
"B"
#endif
#ifdef USE_LUA
"c"
#endif
))
!=
-
1
)
{
switch
(
opt
)
{
case
'u'
:
set_default_username
(
optarg
);
...
...
@@ -424,6 +437,7 @@ void args_parse (int argc, char **argv) {
case
'N'
:
msg_num_mode
++
;
break
;
#ifdef HAVE_LIBCONFIG
case
'c'
:
config_filename
=
tstrdup
(
optarg
);
break
;
...
...
@@ -431,6 +445,11 @@ void args_parse (int argc, char **argv) {
prefix
=
tstrdup
(
optarg
);
assert
(
strlen
(
prefix
)
<=
100
);
break
;
#else
case
'B'
:
binlog_enabled
=
1
;
break
;
#endif
case
'l'
:
log_level
=
atoi
(
optarg
);
break
;
...
...
@@ -440,9 +459,6 @@ void args_parse (int argc, char **argv) {
case
'f'
:
sync_from_start
=
1
;
break
;
case
'B'
:
binlog_enabled
=
1
;
break
;
//case 'L':
// if (log_net_file) {
// usage ();
...
...
@@ -457,12 +473,17 @@ void args_parse (int argc, char **argv) {
case
'w'
:
allow_weak_random
=
1
;
break
;
#ifdef USE_LUA
case
's'
:
lua_file
=
tstrdup
(
optarg
);
break
;
#endif
case
'W'
:
wait_dialog_list
=
1
;
break
;
case
'C'
:
disable_colors
++
;
break
;
case
'h'
:
default:
usage
();
...
...
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