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
283b8672
Commit
283b8672
authored
Oct 01, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed send queries by id
parent
33e973ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
28 deletions
+36
-28
binlog.c
binlog.c
+3
-3
interface.c
interface.c
+33
-25
No files found.
binlog.c
View file @
283b8672
...
...
@@ -1773,7 +1773,7 @@ void bl_do_encr_chat_init (int id, int user_id, unsigned char random[], unsigned
void
bl_do_set_pts
(
int
pts
)
{
if
(
tgl_state
.
locks
&
TGL_LOCK_DIFF
)
{
return
;
}
if
(
pts
=
=
tgl_state
.
pts
)
{
return
;
}
if
(
pts
<
=
tgl_state
.
pts
)
{
return
;
}
int
*
ev
=
alloc_log_event
(
8
);
ev
[
0
]
=
CODE_binlog_set_pts
;
ev
[
1
]
=
pts
;
...
...
@@ -1782,7 +1782,7 @@ void bl_do_set_pts (int pts) {
void
bl_do_set_qts
(
int
qts
)
{
if
(
tgl_state
.
locks
&
TGL_LOCK_DIFF
)
{
return
;
}
if
(
qts
=
=
tgl_state
.
qts
)
{
return
;
}
if
(
qts
<
=
tgl_state
.
qts
)
{
return
;
}
int
*
ev
=
alloc_log_event
(
8
);
ev
[
0
]
=
CODE_binlog_set_qts
;
ev
[
1
]
=
qts
;
...
...
@@ -1791,7 +1791,7 @@ void bl_do_set_qts (int qts) {
void
bl_do_set_date
(
int
date
)
{
if
(
tgl_state
.
locks
&
TGL_LOCK_DIFF
)
{
return
;
}
if
(
date
=
=
tgl_state
.
date
)
{
return
;
}
if
(
date
<
=
tgl_state
.
date
)
{
return
;
}
int
*
ev
=
alloc_log_event
(
8
);
ev
[
0
]
=
CODE_binlog_set_date
;
ev
[
1
]
=
date
;
...
...
interface.c
View file @
283b8672
...
...
@@ -300,17 +300,17 @@ tgl_peer_id_t cur_token_user (void) {
char
c
=
cur_token
[
cur_token_len
];
cur_token
[
cur_token_len
]
=
0
;
if
(
l
>=
6
&&
!
memcmp
(
s
,
"user#"
,
5
))
{
s
+=
5
;
l
-=
5
;
if
(
l
>=
8
&&
!
memcmp
(
s
,
"user#id"
,
7
))
{
s
+=
7
;
l
-=
7
;
int
r
=
atoi
(
s
);
cur_token
[
cur_token_len
]
=
c
;
if
(
r
>=
0
)
{
return
tgl_set_peer_id
(
TGL_PEER_USER
,
r
);
}
else
{
return
TGL_PEER_NOT_FOUND
;
}
}
if
(
l
>=
8
&&
!
memcmp
(
s
,
"user#id"
,
7
))
{
s
+=
7
;
l
-=
7
;
if
(
l
>=
6
&&
!
memcmp
(
s
,
"user#"
,
5
))
{
s
+=
5
;
l
-=
5
;
int
r
=
atoi
(
s
);
cur_token
[
cur_token_len
]
=
c
;
if
(
r
>=
0
)
{
return
tgl_set_peer_id
(
TGL_PEER_USER
,
r
);
}
...
...
@@ -335,18 +335,17 @@ tgl_peer_id_t cur_token_chat (void) {
char
c
=
cur_token
[
cur_token_len
];
cur_token
[
cur_token_len
]
=
0
;
if
(
l
>=
6
&&
!
memcmp
(
s
,
"chat#"
,
5
))
{
s
+=
5
;
l
-=
5
;
if
(
l
>=
8
&&
!
memcmp
(
s
,
"chat#id"
,
7
))
{
s
+=
7
;
l
-=
7
;
int
r
=
atoi
(
s
);
cur_token
[
cur_token_len
]
=
c
;
if
(
r
>=
0
)
{
return
tgl_set_peer_id
(
TGL_PEER_CHAT
,
r
);
}
else
{
return
TGL_PEER_NOT_FOUND
;
}
}
if
(
l
>=
8
&&
!
memcmp
(
s
,
"chat#id"
,
7
))
{
s
+=
7
;
l
-=
7
;
if
(
l
>=
6
&&
!
memcmp
(
s
,
"chat#"
,
5
))
{
s
+=
5
;
l
-=
5
;
int
r
=
atoi
(
s
);
cur_token
[
cur_token_len
]
=
c
;
if
(
r
>=
0
)
{
return
tgl_set_peer_id
(
TGL_PEER_CHAT
,
r
);
}
...
...
@@ -386,33 +385,33 @@ tgl_peer_id_t cur_token_peer (void) {
char
c
=
cur_token
[
cur_token_len
];
cur_token
[
cur_token_len
]
=
0
;
if
(
l
>=
6
&&
!
memcmp
(
s
,
"user#"
,
5
))
{
s
+=
5
;
l
-=
5
;
if
(
l
>=
8
&&
!
memcmp
(
s
,
"user#id"
,
7
))
{
s
+=
7
;
l
-=
7
;
int
r
=
atoi
(
s
);
cur_token
[
cur_token_len
]
=
c
;
if
(
r
>=
0
)
{
return
tgl_set_peer_id
(
TGL_PEER_USER
,
r
);
}
else
{
return
TGL_PEER_NOT_FOUND
;
}
}
if
(
l
>=
6
&&
!
memcmp
(
s
,
"chat#"
,
5
))
{
s
+=
5
;
l
-=
5
;
if
(
l
>=
8
&&
!
memcmp
(
s
,
"chat#id"
,
7
))
{
s
+=
7
;
l
-=
7
;
int
r
=
atoi
(
s
);
cur_token
[
cur_token_len
]
=
c
;
if
(
r
>=
0
)
{
return
tgl_set_peer_id
(
TGL_PEER_CHAT
,
r
);
}
else
{
return
TGL_PEER_NOT_FOUND
;
}
}
if
(
l
>=
8
&&
!
memcmp
(
s
,
"user#id"
,
7
))
{
s
+=
7
;
l
-=
7
;
if
(
l
>=
6
&&
!
memcmp
(
s
,
"user#"
,
5
))
{
s
+=
5
;
l
-=
5
;
int
r
=
atoi
(
s
);
cur_token
[
cur_token_len
]
=
c
;
if
(
r
>=
0
)
{
return
tgl_set_peer_id
(
TGL_PEER_USER
,
r
);
}
else
{
return
TGL_PEER_NOT_FOUND
;
}
}
if
(
l
>=
8
&&
!
memcmp
(
s
,
"chat#id"
,
7
))
{
s
+=
7
;
l
-=
7
;
if
(
l
>=
6
&&
!
memcmp
(
s
,
"chat#"
,
5
))
{
s
+=
5
;
l
-=
5
;
int
r
=
atoi
(
s
);
cur_token
[
cur_token_len
]
=
c
;
if
(
r
>=
0
)
{
return
tgl_set_peer_id
(
TGL_PEER_CHAT
,
r
);
}
...
...
@@ -432,6 +431,15 @@ tgl_peer_id_t cur_token_peer (void) {
static
tgl_peer_t
*
mk_peer
(
tgl_peer_id_t
id
)
{
if
(
tgl_get_peer_type
(
id
)
==
NOT_FOUND
)
{
return
0
;
}
tgl_peer_t
*
P
=
tgl_peer_get
(
id
);
if
(
!
P
)
{
if
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_USER
)
{
tgl_insert_empty_user
(
tgl_get_peer_id
(
id
));
}
if
(
tgl_get_peer_type
(
id
)
==
TGL_PEER_CHAT
)
{
tgl_insert_empty_chat
(
tgl_get_peer_id
(
id
));
}
P
=
tgl_peer_get
(
id
);
}
return
P
;
}
...
...
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