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
c721eca5
Commit
c721eca5
authored
Aug 25, 2014
by
vvaltman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed problems with read mark. Deleted unused code
parent
48c07091
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
277 deletions
+4
-277
queries.c
queries.c
+2
-2
structures.c
structures.c
+2
-2
updates.c
updates.c
+0
-273
No files found.
queries.c
View file @
c721eca5
...
...
@@ -1124,7 +1124,6 @@ static int get_history_on_answer (struct query *q UU) {
if
(
q
->
callback
)
{
((
void
(
*
)(
void
*
,
int
,
int
,
struct
tgl_message
**
))
q
->
callback
)
(
q
->
callback_extra
,
1
,
sn
,
ML
);
}
tfree
(
ML
,
sizeof
(
void
*
)
*
n
);
/*for (i = n - 1; i >= 0; i--) {
print_message (ML[i]);
...
...
@@ -1132,6 +1131,8 @@ static int get_history_on_answer (struct query *q UU) {
if
(
sn
>
0
&&
q
->
extra
)
{
tgl_do_messages_mark_read
(
*
(
tgl_peer_id_t
*
)
&
(
q
->
extra
),
ML
[
0
]
->
id
,
0
,
0
);
}
tfree
(
ML
,
sizeof
(
void
*
)
*
n
);
return
0
;
}
...
...
@@ -3026,7 +3027,6 @@ void tgl_do_create_group_chat (tgl_peer_id_t id, char *chat_topic, void (*callba
}
/* }}} */
/* {{{ Delete msg */
static
int
delete_msg_on_answer
(
struct
query
*
q
UU
)
{
...
...
structures.c
View file @
c721eca5
...
...
@@ -649,7 +649,7 @@ void tglf_fetch_message_short (struct tgl_message *M) {
//tglu_fetch_seq ();
fetch_int
();
bl_do_create_message_text
(
id
,
from_id
,
TGL_PEER_USER
,
to_id
,
date
,
0
,
l
,
s
);
bl_do_create_message_text
(
id
,
from_id
,
TGL_PEER_USER
,
to_id
,
date
,
1
,
l
,
s
);
}
else
{
fetch_int
();
// id
fetch_int
();
// from_id
...
...
@@ -679,7 +679,7 @@ void tglf_fetch_message_short_chat (struct tgl_message *M) {
//tglu_fetch_seq ();
fetch_int
();
bl_do_create_message_text
(
id
,
from_id
,
TGL_PEER_CHAT
,
to_id
,
date
,
0
,
l
,
s
);
bl_do_create_message_text
(
id
,
from_id
,
TGL_PEER_CHAT
,
to_id
,
date
,
1
,
l
,
s
);
}
else
{
fetch_int
();
// id
fetch_int
();
// from_id
...
...
updates.c
View file @
c721eca5
...
...
@@ -29,35 +29,12 @@
void
tglu_fetch_pts
(
void
)
{
int
p
=
fetch_int
();
if
(
p
<=
tgl_state
.
pts
)
{
return
;
}
/*if (p != tgl_state.pts + 1) {
if (tgl_state.pts) {
//vlogprintf (E_NOTICE, "Hole in pts p = %d, pts = %d\n", p, tgl_state.pts);
// get difference should be here
tgl_state.pts = p;
} else {
tgl_state.pts = p;
}
} else {
tgl_state.pts ++;
}*/
bl_do_set_pts
(
tgl_state
.
pts
);
}
void
tglu_fetch_qts
(
void
)
{
int
p
=
fetch_int
();
if
(
p
<=
tgl_state
.
qts
)
{
return
;
}
/*if (p != tgl_state.qts + 1) {
if (tgl_state.qts) {
//logprintf ("Hole in qts\n");
// get difference should be here
tgl_state.qts = p;
} else {
tgl_state.qts = p;
}
} else {
tgl_state.qts ++;
}*/
bl_do_set_qts
(
tgl_state
.
qts
);
}
...
...
@@ -69,18 +46,6 @@ void tglu_fetch_date (void) {
}
}
/*void tglu_fetch_seq (void) {
int x = fetch_int ();
if (x > tgl_state.seq + 1) {
vlogprintf (E_NOTICE, "Hole in seq: seq = %d, x = %d\n", tgl_state.seq, x);
//tgl_do_get_difference ();
//seq = x;
} else if (x == tgl_state.seq + 1) {
tgl_state.seq = x;
bl_do_set_seq (tgl_state.seq);
}
}*/
static
void
fetch_dc_option
(
void
)
{
assert
(
fetch_int
()
==
CODE_dc_option
);
int
id
=
fetch_int
();
...
...
@@ -102,13 +67,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
struct
tgl_message
*
M
=
tglf_fetch_alloc_message
();
assert
(
M
);
tglu_fetch_pts
();
//if (tgl_state.callback.new_msg) {
// tgl_state.callback.new_msg (M);
//}
//unread_messages ++;
//print_message (M);
//update_prompt ();
break
;
};
case
CODE_update_message_i_d
:
...
...
@@ -136,14 +94,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
}
}
tglu_fetch_pts
();
/*if (log_level >= 1) {
print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" %d messages marked as read\n", n);
pop_color ();
print_end ();
}*/
}
break
;
case
CODE_update_user_typing
:
...
...
@@ -154,16 +104,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
if
(
tgl_state
.
callback
.
type_notification
&&
U
)
{
tgl_state
.
callback
.
type_notification
((
void
*
)
U
);
}
/*if (log_level >= 2) {
print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" User ");
print_user_name (id, U);
printf (" is typing....\n");
pop_color ();
print_end ();
}*/
}
break
;
case
CODE_update_chat_user_typing
:
...
...
@@ -178,18 +118,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
tgl_state
.
callback
.
type_in_chat_notification
((
void
*
)
U
,
(
void
*
)
C
);
}
}
/*if (log_level >= 2) {
print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" User ");
print_user_name (id, U);
printf (" is typing in chat ");
print_chat_name (chat_id, C);
printf ("....\n");
pop_color ();
print_end ();
}*/
}
break
;
case
CODE_update_user_status
:
...
...
@@ -202,17 +130,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
if
(
tgl_state
.
callback
.
status_notification
)
{
tgl_state
.
callback
.
status_notification
((
void
*
)
U
);
}
/*if (log_level >= 3) {
print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" User ");
print_user_name (user_id, U);
printf (" is now ");
printf ("%s\n", (U->user.status.online > 0) ? "online" : "offline");
pop_color ();
print_end ();
}*/
}
else
{
struct
tgl_user_status
t
;
tglf_fetch_user_status
(
&
t
);
...
...
@@ -230,16 +147,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
char
*
l
=
fetch_str
(
l2
);
struct
tgl_user
*
U
=
&
UC
->
user
;
bl_do_user_set_real_name
(
U
,
f
,
l1
,
l
,
l2
);
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" User ");
print_user_name (user_id, UC);
printf (" changed name to ");
print_user_name (user_id, UC);
printf ("\n");
pop_color ();
print_end ();*/
}
else
{
fetch_skip_str
();
fetch_skip_str
();
...
...
@@ -270,15 +177,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
tglf_fetch_file_location
(
&
big
);
}
bl_do_set_user_profile_photo
(
U
,
photo_id
,
&
big
,
&
small
);
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" User ");
print_user_name (user_id, UC);
printf (" updated profile photo\n");
pop_color ();
print_end ();*/
}
else
{
struct
tgl_file_location
t
;
unsigned
y
=
fetch_int
();
...
...
@@ -297,12 +195,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
{
assert
(
fetch_int
()
==
CODE_vector
);
int
n
=
fetch_int
();
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" Restored %d messages\n", n);
pop_color ();
print_end ();*/
fetch_skip
(
n
);
tglu_fetch_pts
();
}
...
...
@@ -311,12 +203,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
{
assert
(
fetch_int
()
==
CODE_vector
);
int
n
=
fetch_int
();
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" Deleted %d messages\n", n);
pop_color ();
print_end ();*/
fetch_skip
(
n
);
tglu_fetch_pts
();
}
...
...
@@ -353,18 +239,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
fetch_int
();
// version
}
}
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" Chat ");
print_chat_name (chat_id, C);
if (x == CODE_chat_participants) {
printf (" changed list: now %d members\n", n);
} else {
printf (" changed list, but we are forbidden to know about it (Why this update even was sent to us?\n");
}
pop_color ();
print_end ();*/
}
break
;
case
CODE_update_contact_registered
:
...
...
@@ -375,28 +249,12 @@ void tglu_work_update (struct connection *c, long long msg_id) {
if
(
tgl_state
.
callback
.
user_registered
&&
U
)
{
tgl_state
.
callback
.
user_registered
((
void
*
)
U
);
}
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" User ");
print_user_name (user_id, U);
printf (" registered\n");
pop_color ();
print_end ();*/
}
break
;
case
CODE_update_contact_link
:
{
tgl_peer_id_t
user_id
=
TGL_MK_USER
(
fetch_int
());
tgl_peer_t
*
U
=
tgl_peer_get
(
user_id
);
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" Updated link with user ");
print_user_name (user_id, U);
printf ("\n");
pop_color ();
print_end ();*/
unsigned
t
=
fetch_int
();
assert
(
t
==
CODE_contacts_my_link_empty
||
t
==
CODE_contacts_my_link_requested
||
t
==
CODE_contacts_my_link_contact
);
if
(
t
==
CODE_contacts_my_link_requested
)
{
...
...
@@ -418,14 +276,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
if
(
tgl_state
.
callback
.
user_activated
&&
U
)
{
tgl_state
.
callback
.
user_activated
((
void
*
)
U
);
}
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" User ");
print_user_name (user_id, U);
printf (" activated\n");
pop_color ();
print_end ();*/
}
break
;
case
CODE_update_new_authorization
:
...
...
@@ -434,13 +284,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
fetch_int
();
// date
char
*
s
=
fetch_str_dup
();
char
*
location
=
fetch_str_dup
();
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" New autorization: device='%s' location='%s'\n",
s, location);
pop_color ();
print_end ();*/
if
(
tgl_state
.
callback
.
new_authorization
)
{
tgl_state
.
callback
.
new_authorization
(
s
,
location
);
}
...
...
@@ -452,74 +295,19 @@ void tglu_work_update (struct connection *c, long long msg_id) {
{
struct
tgl_message
*
M
=
tglf_fetch_alloc_geo_message
();
assert
(
M
);
//if (tgl_state.callback.new_msg) {
// tgl_state.callback.new_msg (M);
//}
//unread_messages ++;
//print_message (M);
//update_prompt ();
}
break
;
case
CODE_update_new_encrypted_message
:
{
struct
tgl_message
*
M
=
tglf_fetch_alloc_encrypted_message
();
assert
(
M
);
//unread_messages ++;
//print_message (M);
//update_prompt ();
tglu_fetch_qts
();
//if (tgl_state.callback.new_msg) {
// tgl_state.callback.new_msg (M);
//}
}
break
;
case
CODE_update_encryption
:
{
struct
tgl_secret_chat
*
E
=
tglf_fetch_alloc_encrypted_chat
();
vlogprintf
(
E_DEBUG
,
"Secret chat state = %d
\n
"
,
E
->
state
);
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
switch (E->state) {
case sc_none:
break;
case sc_waiting:
printf (" Encrypted chat ");
print_encr_chat_name (E->id, (void *)E);
printf (" is now in wait state\n");
break;
case sc_request:
printf (" Encrypted chat ");
print_encr_chat_name (E->id, (void *)E);
printf (" is now in request state. Sending request ok\n");
break;
case sc_ok:
printf (" Encrypted chat ");
print_encr_chat_name (E->id, (void *)E);
printf (" is now in ok state\n");
break;
case sc_deleted:
printf (" Encrypted chat ");
print_encr_chat_name (E->id, (void *)E);
printf (" is now in deleted state\n");
break;
}
pop_color ();
print_end ();*/
/*if (E->state == sc_request) {
if (tgl_state.callback.secret_chat_update) {
tgl_state.callback.secret_chat_request (E);
}
} else if (E->state == sc_ok) {
if (tgl_state.callback.secret_chat_established) {
tgl_state.callback.secret_chat_established (E);
}
} else if (E->state == sc_deleted) {
if (tgl_state.callback.secret_chat_deleted) {
tgl_state.callback.secret_chat_deleted (E);
}
}*/
if
(
E
->
state
==
sc_ok
)
{
tgl_do_send_encr_chat_layer
(
E
);
}
...
...
@@ -536,21 +324,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
tgl_state
.
callback
.
type_in_secret_chat_notification
((
void
*
)
P
);
}
}
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
if (P) {
printf (" User ");
tgl_peer_id_t user_id = TGL_MK_USER (P->encr_chat.user_id);
print_user_name (user_id, tgl_peer_get (user_id));
printf (" typing in secret chat ");
print_encr_chat_name (id, P);
printf ("\n");
} else {
printf (" Some user is typing in unknown secret chat\n");
}
pop_color ();
print_end ();*/
}
break
;
case
CODE_update_encrypted_messages_read
:
...
...
@@ -570,16 +343,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
M
=
M
->
next
;
}
}
/*if (log_level >= 1) {
print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" Encrypted chat ");
print_encr_chat_name_full (id, tgl_peer_get (id));
printf (": %d messages marked read \n", x);
pop_color ();
print_end ();
}*/
}
break
;
case
CODE_update_chat_participant_add
:
...
...
@@ -593,19 +356,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
if
(
C
&&
(
C
->
flags
&
FLAG_CREATED
))
{
bl_do_chat_add_user
(
&
C
->
chat
,
version
,
tgl_get_peer_id
(
user_id
),
tgl_get_peer_id
(
inviter_id
),
time
(
0
));
}
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" Chat ");
print_chat_name (chat_id, tgl_peer_get (chat_id));
printf (": user ");
print_user_name (user_id, tgl_peer_get (user_id));
printf (" added by user ");
print_user_name (inviter_id, tgl_peer_get (inviter_id));
printf ("\n");
pop_color ();
print_end ();*/
}
break
;
case
CODE_update_chat_participant_delete
:
...
...
@@ -618,17 +368,6 @@ void tglu_work_update (struct connection *c, long long msg_id) {
if
(
C
&&
(
C
->
flags
&
FLAG_CREATED
))
{
bl_do_chat_del_user
(
&
C
->
chat
,
version
,
tgl_get_peer_id
(
user_id
));
}
/*print_start ();
push_color (COLOR_YELLOW);
print_date (time (0));
printf (" Chat ");
print_chat_name (chat_id, tgl_peer_get (chat_id));
printf (": user ");
print_user_name (user_id, tgl_peer_get (user_id));
printf (" deleted\n");
pop_color ();
print_end ();*/
}
break
;
case
CODE_update_dc_options
:
...
...
@@ -740,12 +479,6 @@ void tglu_work_update_short_message (struct connection *c, long long msg_id) {
assert
(
fetch_int
()
==
(
int
)
CODE_update_short_message
);
struct
tgl_message
*
M
=
tglf_fetch_alloc_message_short
();
assert
(
M
);
/*unread_messages ++;
print_message (M);
update_prompt ();
if (M->date > last_date) {
last_date = M->date;
}*/
assert
(
save_end
==
in_ptr
);
}
...
...
@@ -762,12 +495,6 @@ void tglu_work_update_short_chat_message (struct connection *c, long long msg_id
assert
(
fetch_int
()
==
CODE_update_short_chat_message
);
struct
tgl_message
*
M
=
tglf_fetch_alloc_message_short_chat
();
assert
(
M
);
/*unread_messages ++;
print_message (M);
update_prompt ();
if (M->date > last_date) {
last_date = M->date;
}*/
assert
(
save_end
==
in_ptr
);
bl_do_msg_seq_update
(
M
->
id
);
...
...
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