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
f9cf3929
Commit
f9cf3929
authored
Oct 24, 2013
by
vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some bugs. Fixed interface
parent
fd8a13ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
11 deletions
+38
-11
interface.c
interface.c
+7
-2
interface.h
interface.h
+1
-0
queries.c
queries.c
+12
-1
structures.c
structures.c
+8
-8
structures.h
structures.h
+10
-0
No files found.
interface.c
View file @
f9cf3929
...
@@ -538,7 +538,7 @@ void print_user_name (int id, union user_chat *U) {
...
@@ -538,7 +538,7 @@ void print_user_name (int id, union user_chat *U) {
unknown_user_list
[
unknown_user_list_pos
++
]
=
id
;
unknown_user_list
[
unknown_user_list_pos
++
]
=
id
;
}
}
}
else
{
}
else
{
if
(
U
->
flags
&
20
)
{
if
(
U
->
flags
&
(
FLAG_USER_SELF
|
FLAG_USER_CONTACT
)
)
{
push_color
(
COLOR_REDB
);
push_color
(
COLOR_REDB
);
}
}
if
(
!
U
->
user
.
first_name
)
{
if
(
!
U
->
user
.
first_name
)
{
...
@@ -548,7 +548,7 @@ void print_user_name (int id, union user_chat *U) {
...
@@ -548,7 +548,7 @@ void print_user_name (int id, union user_chat *U) {
}
else
{
}
else
{
printf
(
"%s %s"
,
U
->
user
.
first_name
,
U
->
user
.
last_name
);
printf
(
"%s %s"
,
U
->
user
.
first_name
,
U
->
user
.
last_name
);
}
}
if
(
U
->
flags
&
20
)
{
if
(
U
->
flags
&
(
FLAG_USER_SELF
|
FLAG_USER_CONTACT
)
)
{
pop_color
();
pop_color
();
}
}
}
}
...
@@ -575,6 +575,11 @@ void print_date (long t) {
...
@@ -575,6 +575,11 @@ void print_date (long t) {
}
}
}
}
void
print_date_full
(
long
t
)
{
struct
tm
*
tm
=
localtime
(
&
t
);
printf
(
"[%04d/%02d/%02d %02d:%02d:%02d]"
,
tm
->
tm_year
+
1900
,
tm
->
tm_mon
+
1
,
tm
->
tm_mday
,
tm
->
tm_hour
,
tm
->
tm_min
,
tm
->
tm_sec
);
}
int
our_id
;
int
our_id
;
void
print_service_message
(
struct
message
*
M
)
{
void
print_service_message
(
struct
message
*
M
)
{
...
...
interface.h
View file @
f9cf3929
...
@@ -49,4 +49,5 @@ void pop_color (void);
...
@@ -49,4 +49,5 @@ void pop_color (void);
void
push_color
(
const
char
*
color
);
void
push_color
(
const
char
*
color
);
void
print_start
(
void
);
void
print_start
(
void
);
void
print_end
(
void
);
void
print_end
(
void
);
void
print_date_full
(
long
t
);
#endif
#endif
queries.c
View file @
f9cf3929
...
@@ -444,8 +444,19 @@ int get_contacts_on_answer (struct query *q UU) {
...
@@ -444,8 +444,19 @@ int get_contacts_on_answer (struct query *q UU) {
push_color
(
COLOR_GREEN
);
push_color
(
COLOR_GREEN
);
printf
(
" ("
);
printf
(
" ("
);
printf
(
"%s"
,
U
->
print_name
);
printf
(
"%s"
,
U
->
print_name
);
printf
(
")
\n
"
);
printf
(
")
"
);
pop_color
();
pop_color
();
if
(
U
->
status
.
online
>
0
)
{
printf
(
"online
\n
"
);
}
else
{
if
(
U
->
status
.
online
<
0
)
{
printf
(
"offline. Was online "
);
print_date_full
(
U
->
status
.
when
);
}
else
{
printf
(
"offline permanent"
);
}
printf
(
"
\n
"
);
}
pop_color
();
pop_color
();
print_end
();
print_end
();
}
}
...
...
structures.c
View file @
f9cf3929
...
@@ -66,7 +66,7 @@ void fetch_user (struct user *U) {
...
@@ -66,7 +66,7 @@ void fetch_user (struct user *U) {
assert
(
x
==
CODE_user_empty
||
x
==
CODE_user_self
||
x
==
CODE_user_contact
||
x
==
CODE_user_request
||
x
==
CODE_user_foreign
||
x
==
CODE_user_deleted
);
assert
(
x
==
CODE_user_empty
||
x
==
CODE_user_self
||
x
==
CODE_user_contact
||
x
==
CODE_user_request
||
x
==
CODE_user_foreign
||
x
==
CODE_user_deleted
);
U
->
id
=
fetch_int
();
U
->
id
=
fetch_int
();
if
(
x
==
CODE_user_empty
)
{
if
(
x
==
CODE_user_empty
)
{
U
->
flags
=
1
;
U
->
flags
=
FLAG_EMPTY
;
return
;
return
;
}
}
if
(
x
==
CODE_user_self
)
{
if
(
x
==
CODE_user_self
)
{
...
@@ -98,16 +98,16 @@ void fetch_user (struct user *U) {
...
@@ -98,16 +98,16 @@ void fetch_user (struct user *U) {
s
++
;
s
++
;
}
}
if
(
x
==
CODE_user_deleted
)
{
if
(
x
==
CODE_user_deleted
)
{
U
->
flags
=
2
;
U
->
flags
=
FLAG_DELETED
;
return
;
return
;
}
}
if
(
x
==
CODE_user_self
)
{
if
(
x
==
CODE_user_self
)
{
U
->
flags
=
4
;
U
->
flags
=
FLAG_USER_SELF
;
}
else
{
}
else
{
U
->
access_hash
=
fetch_long
();
U
->
access_hash
=
fetch_long
();
}
}
if
(
x
==
CODE_user_foreign
)
{
if
(
x
==
CODE_user_foreign
)
{
U
->
flags
|=
8
;
U
->
flags
|=
FLAG_USER_FOREIGN
;
}
else
{
}
else
{
U
->
phone
=
fetch_str_dup
();
U
->
phone
=
fetch_str_dup
();
}
}
...
@@ -125,7 +125,7 @@ void fetch_user (struct user *U) {
...
@@ -125,7 +125,7 @@ void fetch_user (struct user *U) {
assert
(
fetch_int
()
==
(
int
)
CODE_bool_false
);
assert
(
fetch_int
()
==
(
int
)
CODE_bool_false
);
}
}
if
(
x
==
CODE_user_contact
)
{
if
(
x
==
CODE_user_contact
)
{
U
->
flags
|=
16
;
U
->
flags
|=
FLAG_USER_CONTACT
;
}
}
}
}
...
@@ -135,11 +135,11 @@ void fetch_chat (struct chat *C) {
...
@@ -135,11 +135,11 @@ void fetch_chat (struct chat *C) {
assert
(
x
==
CODE_chat_empty
||
x
==
CODE_chat
||
x
==
CODE_chat_forbidden
);
assert
(
x
==
CODE_chat_empty
||
x
==
CODE_chat
||
x
==
CODE_chat_forbidden
);
C
->
id
=
-
fetch_int
();
C
->
id
=
-
fetch_int
();
if
(
x
==
CODE_chat_empty
)
{
if
(
x
==
CODE_chat_empty
)
{
C
->
flags
=
1
;
C
->
flags
=
FLAG_EMPTY
;
return
;
return
;
}
}
if
(
x
==
CODE_chat_forbidden
)
{
if
(
x
==
CODE_chat_forbidden
)
{
C
->
flags
|=
8
;
C
->
flags
|=
FLAG_FORBIDDEN
;
}
}
C
->
title
=
fetch_str_dup
();
C
->
title
=
fetch_str_dup
();
C
->
print_title
=
strdup
(
C
->
title
);
C
->
print_title
=
strdup
(
C
->
title
);
...
@@ -161,7 +161,7 @@ void fetch_chat (struct chat *C) {
...
@@ -161,7 +161,7 @@ void fetch_chat (struct chat *C) {
C
->
user_num
=
fetch_int
();
C
->
user_num
=
fetch_int
();
C
->
date
=
fetch_int
();
C
->
date
=
fetch_int
();
if
(
fetch_int
()
==
(
int
)
CODE_bool_true
)
{
if
(
fetch_int
()
==
(
int
)
CODE_bool_true
)
{
C
->
flags
|=
16
;
C
->
flags
|=
FLAG_CHAT_IN_CHAT
;
}
}
C
->
version
=
fetch_int
();
C
->
version
=
fetch_int
();
}
else
{
}
else
{
...
...
structures.h
View file @
f9cf3929
...
@@ -19,6 +19,16 @@
...
@@ -19,6 +19,16 @@
#ifndef __STRUCTURES_H__
#ifndef __STRUCTURES_H__
#define __STRUCTURES_H__
#define __STRUCTURES_H__
#define FLAG_EMPTY 1
#define FLAG_DELETED 2
#define FLAG_FORBIDDEN 4
#define FLAG_USER_SELF 128
#define FLAG_USER_FOREIGN 256
#define FLAG_USER_CONTACT 512
#define FLAG_CHAT_IN_CHAT 128
struct
file_location
{
struct
file_location
{
int
dc
;
int
dc
;
...
...
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