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
a3a4e63a
Commit
a3a4e63a
authored
Oct 13, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'grishka-master'
parents
a6c00cde
8d9861af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
interface.c
interface.c
+7
-4
main.c
main.c
+6
-1
No files found.
interface.c
View file @
a3a4e63a
...
...
@@ -103,6 +103,7 @@ struct in_ev *notify_ev;
extern
int
usfd
;
extern
int
sfd
;
extern
int
use_ids
;
int
is_same_word
(
const
char
*
s
,
size_t
l
,
const
char
*
word
)
{
return
s
&&
word
&&
strlen
(
word
)
==
l
&&
!
memcmp
(
s
,
word
,
l
);
...
...
@@ -2374,7 +2375,9 @@ void print_user_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *U) {
if
((
U
->
flags
&
FLAG_DELETED
))
{
mprintf
(
ev
,
"deleted user#%d"
,
tgl_get_peer_id
(
id
));
}
else
if
(
!
(
U
->
flags
&
FLAG_CREATED
))
{
mprintf
(
ev
,
"empty user#%d"
,
tgl_get_peer_id
(
id
));
mprintf
(
ev
,
"user#%d"
,
tgl_get_peer_id
(
id
));
}
else
if
(
use_ids
)
{
mprintf
(
ev
,
"user#%d"
,
tgl_get_peer_id
(
id
));
}
else
if
(
!
U
->
user
.
first_name
||
!
strlen
(
U
->
user
.
first_name
))
{
mprintf
(
ev
,
"%s"
,
U
->
user
.
last_name
);
}
else
if
(
!
U
->
user
.
last_name
||
!
strlen
(
U
->
user
.
last_name
))
{
...
...
@@ -2392,7 +2395,7 @@ void print_user_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *U) {
void
print_chat_name
(
struct
in_ev
*
ev
,
tgl_peer_id_t
id
,
tgl_peer_t
*
C
)
{
assert
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_CHAT
);
mpush_color
(
ev
,
COLOR_MAGENTA
);
if
(
!
C
)
{
if
(
!
C
||
use_ids
)
{
mprintf
(
ev
,
"chat#%d"
,
tgl_get_peer_id
(
id
));
}
else
{
mprintf
(
ev
,
"%s"
,
C
->
chat
.
title
);
...
...
@@ -2403,7 +2406,7 @@ void print_chat_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C) {
void
print_encr_chat_name
(
struct
in_ev
*
ev
,
tgl_peer_id_t
id
,
tgl_peer_t
*
C
)
{
assert
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_ENCR_CHAT
);
mpush_color
(
ev
,
COLOR_MAGENTA
);
if
(
!
C
)
{
if
(
!
C
||
use_ids
)
{
mprintf
(
ev
,
"encr_chat#%d"
,
tgl_get_peer_id
(
id
));
}
else
{
mprintf
(
ev
,
"%s"
,
C
->
print_name
);
...
...
@@ -2414,7 +2417,7 @@ void print_encr_chat_name (struct in_ev *ev, tgl_peer_id_t id, tgl_peer_t *C) {
void
print_encr_chat_name_full
(
struct
in_ev
*
ev
,
tgl_peer_id_t
id
,
tgl_peer_t
*
C
)
{
assert
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_ENCR_CHAT
);
mpush_color
(
ev
,
COLOR_MAGENTA
);
if
(
!
C
)
{
if
(
!
C
||
use_ids
)
{
mprintf
(
ev
,
"encr_chat#%d"
,
tgl_get_peer_id
(
id
));
}
else
{
mprintf
(
ev
,
"%s"
,
C
->
print_name
);
...
...
main.c
View file @
a3a4e63a
...
...
@@ -111,6 +111,7 @@ int readline_disabled;
int
disable_output
;
int
reset_authorization
;
int
port
;
int
use_ids
;
char
*
start_command
;
void
set_default_username
(
const
char
*
s
)
{
...
...
@@ -465,6 +466,7 @@ void usage (void) {
printf
(
" -P <port> port to listen for input commands
\n
"
);
printf
(
" -S <socket-name> unix socket to create
\n
"
);
printf
(
" -e <commands> make commands end exit
\n
"
);
printf
(
" -I use user and chat IDs in updates instead of names
\n
"
);
exit
(
1
);
}
...
...
@@ -567,7 +569,7 @@ char *unix_socket;
void
args_parse
(
int
argc
,
char
**
argv
)
{
int
opt
=
0
;
while
((
opt
=
getopt
(
argc
,
argv
,
"u:hk:vNl:fEwWCRdL:DU:G:qP:S:e:"
while
((
opt
=
getopt
(
argc
,
argv
,
"u:hk:vNl:fEwWCRdL:DU:G:qP:S:e:
I
"
#ifdef HAVE_LIBCONFIG
"c:p:"
#else
...
...
@@ -659,6 +661,9 @@ void args_parse (int argc, char **argv) {
case
'e'
:
start_command
=
optarg
;
break
;
case
'I'
:
use_ids
++
;
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