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 @@
...
@@ -69,6 +69,7 @@
char
*
default_prompt
=
"> "
;
char
*
default_prompt
=
"> "
;
int
msg_num_mode
;
int
msg_num_mode
;
int
disable_colors
;
int
alert_sound
;
int
alert_sound
;
extern
int
binlog_read
;
extern
int
binlog_read
;
...
@@ -1629,12 +1630,14 @@ int color_stack_pos;
...
@@ -1629,12 +1630,14 @@ int color_stack_pos;
const
char
*
color_stack
[
10
];
const
char
*
color_stack
[
10
];
void
push_color
(
const
char
*
color
)
{
void
push_color
(
const
char
*
color
)
{
if
(
disable_colors
)
{
return
;
}
assert
(
color_stack_pos
<
10
);
assert
(
color_stack_pos
<
10
);
color_stack
[
color_stack_pos
++
]
=
color
;
color_stack
[
color_stack_pos
++
]
=
color
;
printf
(
"%s"
,
color
);
printf
(
"%s"
,
color
);
}
}
void
pop_color
(
void
)
{
void
pop_color
(
void
)
{
if
(
disable_colors
)
{
return
;
}
assert
(
color_stack_pos
>
0
);
assert
(
color_stack_pos
>
0
);
color_stack_pos
--
;
color_stack_pos
--
;
if
(
color_stack_pos
>=
1
)
{
if
(
color_stack_pos
>=
1
)
{
...
...
loop.c
View file @
49eb2291
...
@@ -394,6 +394,10 @@ void read_auth_file (void) {
...
@@ -394,6 +394,10 @@ void read_auth_file (void) {
close
(
auth_file_fd
);
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
)
{
int
loop
(
void
)
{
//on_start ();
//on_start ();
tgl_set_callback
(
&
upd_cb
);
tgl_set_callback
(
&
upd_cb
);
...
@@ -544,6 +548,11 @@ int loop (void) {
...
@@ -544,6 +548,11 @@ int loop (void) {
tgl_do_get_difference
(
sync_from_start
,
get_difference_callback
,
0
);
tgl_do_get_difference
(
sync_from_start
,
get_difference_callback
,
0
);
net_loop
(
0
,
dgot
);
net_loop
(
0
,
dgot
);
assert
(
!
(
tgl_state
.
locks
&
TGL_LOCK_DIFF
));
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
#ifdef USE_LUA
lua_diff_end
();
lua_diff_end
();
#endif
#endif
...
...
main.c
View file @
49eb2291
...
@@ -92,6 +92,7 @@ extern int log_level;
...
@@ -92,6 +92,7 @@ extern int log_level;
int
sync_from_start
;
int
sync_from_start
;
int
allow_weak_random
;
int
allow_weak_random
;
char
*
lua_file
;
char
*
lua_file
;
int
disable_colors
;
void
set_default_username
(
const
char
*
s
)
{
void
set_default_username
(
const
char
*
s
)
{
if
(
default_username
)
{
if
(
default_username
)
{
...
@@ -375,22 +376,24 @@ void inner_main (void) {
...
@@ -375,22 +376,24 @@ void inner_main (void) {
void
usage
(
void
)
{
void
usage
(
void
)
{
printf
(
"%s Usage
\n
"
,
PROGNAME
);
printf
(
"%s Usage
\n
"
,
PROGNAME
);
printf
(
" -h this help list
\n
"
);
printf
(
" -u specify username (would not be asked during authorization)
\n
"
);
printf
(
" -u username specify username
\n
"
);
printf
(
" -k specify location of public key (possible multiple entries)
\n
"
);
printf
(
" -k public-key specify server public key
\n
"
);
printf
(
" -v increase verbosity (0-ERROR 1-WARNIN 2-NOTICE 3+-DEBUG-levels)
\n
"
);
printf
(
" -v verbose
\n
"
);
printf
(
" -l [1-3] log level
\n
"
);
printf
(
" -L log-file log net file
\n
"
);
printf
(
" -N message num mode
\n
"
);
printf
(
" -N message num mode
\n
"
);
printf
(
" -c config-file specify config file
\n
"
);
#ifdef HAVE_LIBCONFIG
printf
(
" -p prefix specify prefix
\n
"
);
printf
(
" -c config file name
\n
"
);
printf
(
" -f sync from start
\n
"
);
printf
(
" -p use specified profile
\n
"
);
#else
printf
(
" -B enable binlog
\n
"
);
printf
(
" -B enable binlog
\n
"
);
printf
(
" -E disable auto accept
\n
"
);
#endif
printf
(
" -w allow weak random
\n
"
);
printf
(
" -l log level
\n
"
);
printf
(
" -s specify lua script
\n
"
);
printf
(
" -f during authorization fetch all messages since registration
\n
"
);
printf
(
" -W wait dialog list
\n
"
);
printf
(
" -E diable auto accept of encrypted chats
\n
"
);
printf
(
"
\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
);
exit
(
1
);
}
}
...
@@ -408,7 +411,17 @@ int wait_dialog_list;
...
@@ -408,7 +411,17 @@ int wait_dialog_list;
void
args_parse
(
int
argc
,
char
**
argv
)
{
void
args_parse
(
int
argc
,
char
**
argv
)
{
int
opt
=
0
;
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
)
{
switch
(
opt
)
{
case
'u'
:
case
'u'
:
set_default_username
(
optarg
);
set_default_username
(
optarg
);
...
@@ -424,6 +437,7 @@ void args_parse (int argc, char **argv) {
...
@@ -424,6 +437,7 @@ void args_parse (int argc, char **argv) {
case
'N'
:
case
'N'
:
msg_num_mode
++
;
msg_num_mode
++
;
break
;
break
;
#ifdef HAVE_LIBCONFIG
case
'c'
:
case
'c'
:
config_filename
=
tstrdup
(
optarg
);
config_filename
=
tstrdup
(
optarg
);
break
;
break
;
...
@@ -431,6 +445,11 @@ void args_parse (int argc, char **argv) {
...
@@ -431,6 +445,11 @@ void args_parse (int argc, char **argv) {
prefix
=
tstrdup
(
optarg
);
prefix
=
tstrdup
(
optarg
);
assert
(
strlen
(
prefix
)
<=
100
);
assert
(
strlen
(
prefix
)
<=
100
);
break
;
break
;
#else
case
'B'
:
binlog_enabled
=
1
;
break
;
#endif
case
'l'
:
case
'l'
:
log_level
=
atoi
(
optarg
);
log_level
=
atoi
(
optarg
);
break
;
break
;
...
@@ -440,9 +459,6 @@ void args_parse (int argc, char **argv) {
...
@@ -440,9 +459,6 @@ void args_parse (int argc, char **argv) {
case
'f'
:
case
'f'
:
sync_from_start
=
1
;
sync_from_start
=
1
;
break
;
break
;
case
'B'
:
binlog_enabled
=
1
;
break
;
//case 'L':
//case 'L':
// if (log_net_file) {
// if (log_net_file) {
// usage ();
// usage ();
...
@@ -457,12 +473,17 @@ void args_parse (int argc, char **argv) {
...
@@ -457,12 +473,17 @@ void args_parse (int argc, char **argv) {
case
'w'
:
case
'w'
:
allow_weak_random
=
1
;
allow_weak_random
=
1
;
break
;
break
;
#ifdef USE_LUA
case
's'
:
case
's'
:
lua_file
=
tstrdup
(
optarg
);
lua_file
=
tstrdup
(
optarg
);
break
;
break
;
#endif
case
'W'
:
case
'W'
:
wait_dialog_list
=
1
;
wait_dialog_list
=
1
;
break
;
break
;
case
'C'
:
disable_colors
++
;
break
;
case
'h'
:
case
'h'
:
default:
default:
usage
();
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