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
337be909
Commit
337be909
authored
Aug 12, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
many changes
parent
a05d1cfd
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
277 additions
and
1094 deletions
+277
-1094
Makefile.in
Makefile.in
+12
-3
auto.h
auto.h
+3
-0
binlog.c
binlog.c
+119
-252
binlog.h
binlog.h
+0
-1
binlog.tl
binlog.tl
+11
-10
constants.h
constants.h
+0
-383
lua-tg.c
lua-tg.c
+1
-1
mtproto-client.c
mtproto-client.c
+1
-1
mtproto-common.h
mtproto-common.h
+12
-1
queries.c
queries.c
+49
-24
structures.c
structures.c
+64
-418
tl-parser.c
tl-parser.c
+2
-0
tools.c
tools.c
+3
-0
No files found.
Makefile.in
View file @
337be909
...
...
@@ -36,7 +36,7 @@ CC=@CC@
.SUFFIXES
:
.c .h .o
all
:
${EXE_LIST} ${DIR_LIST}
create_dirs_and_headers
:
${DIR_LIST} ${AUTO}/auto.c ${AUTO}/auto-header.h
create_dirs_and_headers
:
${DIR_LIST} ${AUTO}/auto.c ${AUTO}/auto-header.h
${AUTO}/constants.h
create_dirs
:
${DIR_LIST}
${DIR_LIST}
:
...
...
@@ -59,8 +59,14 @@ ${EXE}/telegram-cli: ${TG_OBJECTS} ${COMMON_OBJECTS}
${EXE}/generate
:
${GENERATE_OBJECTS} ${COMMON_OBJECTS}
${
CC
}
${
GENERATE_OBJECTS
}
${
COMMON_OBJECTS
}
${
LINK_FLAGS
}
-o
$@
${AUTO}/scheme.tlo
:
${srcdir}/scheme.tl ${EXE}/tlc
${
EXE
}
/tlc
-e
$@
${
srcdir
}
/scheme.tl
${AUTO}/scheme.tlo
:
${AUTO}/scheme.tl ${EXE}/tlc
${
EXE
}
/tlc
-e
$@
${
AUTO
}
/scheme.tl
${AUTO}/scheme.tl
:
${srcdir}/scheme.tl ${srcdir}/binlog.tl
cat
$^
>
$@
${AUTO}/scheme2.tl
:
${AUTO}/scheme.tl ${EXE}/tlc
${
EXE
}
/tlc
-E
${
AUTO
}
/scheme.tl 2>
$@
||
(
cat
$@
&&
rm
$@
&&
false
)
${AUTO}/auto.c
:
${AUTO}/scheme.tlo ${EXE}/generate
${
EXE
}
/generate
${
AUTO
}
/scheme.tlo
>
$@
...
...
@@ -68,6 +74,9 @@ ${AUTO}/auto.c: ${AUTO}/scheme.tlo ${EXE}/generate
${AUTO}/auto-header.h
:
${AUTO}/scheme.tlo ${EXE}/generate
${
EXE
}
/generate
-H
${
AUTO
}
/scheme.tlo
>
$@
${AUTO}/constants.h
:
${AUTO}/scheme2.tl
awk
-f
${
srcdir
}
/gen_constants_h.awk <
$^
>
$@
clean
:
rm
-rf
${
DIR_LIST
}
config.log config.status
>
/dev/null
||
echo
"all clean"
auto.h
View file @
337be909
...
...
@@ -14,11 +14,14 @@ struct paramed_type {
#define NAME_ARRAY 0x89932ad9
#define TYPE_TO_PARAM(NAME) (&(struct paramed_type) {.type = &tl_type_## NAME, .params=0})
#define TYPE_TO_PARAM_1(NAME,PARAM1) (&(struct paramed_type) {.type = &tl_type_## NAME, .params=(struct paramed_type *[1]){PARAM1}})
#define ODDP(x) (((long)(x)) & 1)
#define EVENP(x) (!ODDP(x))
#define INT2PTR(x) (void *)(long)(((long)x) * 2 + 1)
#define PTR2INT(x) ((((long)x) - 1) / 2)
#define FETCH_COMBINATOR_FUNCTION(NAME)
#include "auto/auto-header.h"
#endif
binlog.c
View file @
337be909
...
...
@@ -76,6 +76,125 @@ void *alloc_log_event (int l UU) {
long
long
binlog_pos
;
int
fetch_comb_binlog_start
(
void
*
extra
)
{
return
0
;
}
int
fetch_comb_binlog_dc_option
(
void
*
extra
)
{
int
id
=
fetch_int
();
int
l1
=
prefetch_strlen
();
assert
(
l1
>=
0
);
char
*
name
=
fetch_str
(
l1
);
int
l2
=
prefetch_strlen
();
assert
(
l2
>=
0
);
char
*
ip
=
fetch_str
(
l2
);
int
port
=
fetch_int
();
if
(
verbosity
)
{
logprintf
(
"DC%d '%s' update: %s:%d
\n
"
,
id
,
name
,
ip
,
port
);
}
alloc_dc
(
id
,
tstrndup
(
ip
,
l2
),
port
);
return
0
;
}
int
fetch_comb_binlog_auth_key
(
void
*
extra
)
{
int
num
=
fetch_int
();
assert
(
num
>=
0
&&
num
<=
MAX_DC_ID
);
assert
(
DC_list
[
num
]);
DC_list
[
num
]
->
auth_key_id
=
fetch_long
();
fetch_ints
(
DC_list
[
num
]
->
auth_key
,
64
);
DC_list
[
num
]
->
flags
|=
1
;
return
0
;
}
int
fetch_comb_binlog_default_dc
(
void
*
extra
)
{
int
num
=
fetch_int
();
assert
(
num
>=
0
&&
num
<=
MAX_DC_ID
);
DC_working
=
DC_list
[
num
];
dc_working_num
=
num
;
return
0
;
}
int
fetch_comb_binlog_our_id
(
void
*
extra
)
{
our_id
=
fetch_int
();
#ifdef USE_LUA
lua_our_id
(
our_id
);
#endif
return
0
;
}
int
fetch_comb_binlog_dc_signed
(
void
*
extra
)
{
int
num
=
fetch_int
();
assert
(
num
>=
0
&&
num
<=
MAX_DC_ID
);
assert
(
DC_list
[
num
]);
DC_list
[
num
]
->
has_auth
=
1
;
return
0
;
}
int
fetch_comb_binlog_dc_salt
(
void
*
extra
)
{
int
num
=
fetch_int
();
assert
(
num
>=
0
&&
num
<=
MAX_DC_ID
);
assert
(
DC_list
[
num
]);
DC_list
[
num
]
->
server_salt
=
fetch_long
();
return
0
;
}
int
fetch_comb_binlog_new_user
(
void
*
extra
)
{
peer_id_t
id
=
MK_USER
(
fetch_int
());
peer_t
*
_U
=
user_chat_get
(
id
);
if
(
!
_U
)
{
_U
=
talloc0
(
sizeof
(
*
_U
));
_U
->
id
=
id
;
insert_user
(
_U
);
}
else
{
assert
(
!
(
_U
->
flags
&
FLAG_CREATED
));
}
struct
user
*
U
=
(
void
*
)
_U
;
U
->
flags
|=
FLAG_CREATED
;
if
(
get_peer_id
(
id
)
==
our_id
)
{
U
->
flags
|=
FLAG_USER_SELF
;
}
U
->
first_name
=
fetch_str_dup
();
U
->
last_name
=
fetch_str_dup
();
assert
(
!
U
->
print_name
);
U
->
print_name
=
create_print_name
(
U
->
id
,
U
->
first_name
,
U
->
last_name
,
0
,
0
);
peer_insert_name
((
void
*
)
U
);
U
->
access_hash
=
fetch_long
();
U
->
phone
=
fetch_str_dup
();
if
(
fetch_int
())
{
U
->
flags
|=
FLAG_USER_CONTACT
;
}
#ifdef USE_LUA
lua_user_update
(
U
);
#endif
return
0
;
}
int
fetch_comb_binlog_new_user
(
void
*
extra
)
{
peer_id_t
id
=
MK_USER
(
fetch_int
());
peer_t
*
U
=
user_chat_get
(
id
);
assert
(
U
);
U
->
flags
|=
FLAG_DELETED
;
#ifdef USE_LUA
lua_user_update
(
U
);
#endif
return
0
;
}
FETCH_COMBINATOR_FUNCTION
(
binlog_start
)
FETCH_COMBINATOR_FUNCTION
(
binlog_dc_option
)
FETCH_COMBINATOR_FUNCTION
(
binlog_auth_key
)
FETCH_COMBINATOR_FUNCTION
(
binlog_default_dc
)
FETCH_COMBINATOR_FUNCTION
(
binlog_our_id
)
FETCH_COMBINATOR_FUNCTION
(
binlog_dc_signed
)
FETCH_COMBINATOR_FUNCTION
(
binlog_dc_salt
)
FETCH_COMBINATOR_FUNCTION
(
binlog_new_user
)
FETCH_COMBINATOR_FUNCTION
(
binlog_user_delete
)
void
replay_log_event
(
void
)
{
int
*
start
=
rptr
;
in_replay_log
=
1
;
...
...
@@ -89,258 +208,6 @@ void replay_log_event (void) {
in_ptr
=
rptr
;
in_end
=
wptr
;
switch
(
op
)
{
case
LOG_START
:
rptr
++
;
break
;
case
CODE_binlog_dc_option
:
in_ptr
++
;
{
int
id
=
fetch_int
();
int
l1
=
prefetch_strlen
();
char
*
name
=
fetch_str
(
l1
);
int
l2
=
prefetch_strlen
();
char
*
ip
=
fetch_str
(
l2
);
int
port
=
fetch_int
();
if
(
verbosity
)
{
logprintf
(
"id = %d, name = %.*s ip = %.*s port = %d
\n
"
,
id
,
l1
,
name
,
l2
,
ip
,
port
);
}
alloc_dc
(
id
,
tstrndup
(
ip
,
l2
),
port
);
}
rptr
=
in_ptr
;
break
;
case
LOG_AUTH_KEY
:
rptr
++
;
{
int
num
=
*
(
rptr
++
);
assert
(
num
>=
0
&&
num
<=
MAX_DC_ID
);
assert
(
DC_list
[
num
]);
DC_list
[
num
]
->
auth_key_id
=
*
(
long
long
*
)
rptr
;
rptr
+=
2
;
memcpy
(
DC_list
[
num
]
->
auth_key
,
rptr
,
256
);
rptr
+=
64
;
DC_list
[
num
]
->
flags
|=
1
;
};
break
;
case
LOG_DEFAULT_DC
:
rptr
++
;
{
int
num
=
*
(
rptr
++
);
assert
(
num
>=
0
&&
num
<=
MAX_DC_ID
);
DC_working
=
DC_list
[
num
];
dc_working_num
=
num
;
}
break
;
case
LOG_OUR_ID
:
rptr
++
;
{
our_id
=
*
(
rptr
++
);
#ifdef USE_LUA
lua_our_id
(
our_id
);
#endif
}
break
;
case
LOG_DC_SIGNED
:
rptr
++
;
{
int
num
=
*
(
rptr
++
);
assert
(
num
>=
0
&&
num
<=
MAX_DC_ID
);
assert
(
DC_list
[
num
]);
DC_list
[
num
]
->
has_auth
=
1
;
}
break
;
case
LOG_DC_SALT
:
rptr
++
;
{
int
num
=
*
(
rptr
++
);
assert
(
num
>=
0
&&
num
<=
MAX_DC_ID
);
assert
(
DC_list
[
num
]);
DC_list
[
num
]
->
server_salt
=
*
(
long
long
*
)
rptr
;
rptr
+=
2
;
};
break
;
/* case CODE_user_empty:
case CODE_user_self:
case CODE_user_contact:
case CODE_user_request:
case CODE_user_foreign:
case CODE_user_deleted:
fetch_alloc_user ();
rptr = in_ptr;
break;*/
case
LOG_DH_CONFIG
:
get_dh_config_on_answer
(
0
);
rptr
=
in_ptr
;
break
;
case
LOG_ENCR_CHAT_KEY
:
rptr
++
;
{
peer_id_t
id
=
MK_ENCR_CHAT
(
*
(
rptr
++
));
struct
secret_chat
*
U
=
(
void
*
)
user_chat_get
(
id
);
assert
(
U
);
U
->
key_fingerprint
=
*
(
long
long
*
)
rptr
;
rptr
+=
2
;
memcpy
(
U
->
key
,
rptr
,
256
);
rptr
+=
64
;
};
break
;
case
LOG_ENCR_CHAT_SEND_ACCEPT
:
rptr
++
;
{
peer_id_t
id
=
MK_ENCR_CHAT
(
*
(
rptr
++
));
struct
secret_chat
*
U
=
(
void
*
)
user_chat_get
(
id
);
assert
(
U
);
U
->
key_fingerprint
=
*
(
long
long
*
)
rptr
;
rptr
+=
2
;
memcpy
(
U
->
key
,
rptr
,
256
);
rptr
+=
64
;
if
(
!
U
->
g_key
)
{
U
->
g_key
=
talloc
(
256
);
}
memcpy
(
U
->
g_key
,
rptr
,
256
);
rptr
+=
64
;
};
break
;
case
LOG_ENCR_CHAT_SEND_CREATE
:
rptr
++
;
{
peer_id_t
id
=
MK_ENCR_CHAT
(
*
(
rptr
++
));
struct
secret_chat
*
U
=
(
void
*
)
user_chat_get
(
id
);
assert
(
!
U
||
!
(
U
->
flags
&
FLAG_CREATED
));
if
(
!
U
)
{
U
=
talloc0
(
sizeof
(
peer_t
));
U
->
id
=
id
;
insert_encrypted_chat
((
void
*
)
U
);
}
U
->
flags
|=
FLAG_CREATED
;
U
->
user_id
=
*
(
rptr
++
);
memcpy
(
U
->
key
,
rptr
,
256
);
rptr
+=
64
;
if
(
!
U
->
print_name
)
{
peer_t
*
P
=
user_chat_get
(
MK_USER
(
U
->
user_id
));
if
(
P
)
{
U
->
print_name
=
create_print_name
(
U
->
id
,
"!"
,
P
->
user
.
first_name
,
P
->
user
.
last_name
,
0
);
}
else
{
static
char
buf
[
100
];
tsnprintf
(
buf
,
99
,
"user#%d"
,
U
->
user_id
);
U
->
print_name
=
create_print_name
(
U
->
id
,
"!"
,
buf
,
0
,
0
);
}
peer_insert_name
((
void
*
)
U
);
}
};
break
;
case
LOG_ENCR_CHAT_DELETED
:
rptr
++
;
{
peer_id_t
id
=
MK_ENCR_CHAT
(
*
(
rptr
++
));
struct
secret_chat
*
U
=
(
void
*
)
user_chat_get
(
id
);
if
(
!
U
)
{
U
=
talloc0
(
sizeof
(
peer_t
));
U
->
id
=
id
;
insert_encrypted_chat
((
void
*
)
U
);
}
U
->
flags
|=
FLAG_CREATED
;
U
->
state
=
sc_deleted
;
};
break
;
case
LOG_ENCR_CHAT_WAITING
:
rptr
++
;
{
peer_id_t
id
=
MK_ENCR_CHAT
(
*
(
rptr
++
));
struct
secret_chat
*
U
=
(
void
*
)
user_chat_get
(
id
);
assert
(
U
);
U
->
state
=
sc_waiting
;
U
->
date
=
*
(
rptr
++
);
U
->
admin_id
=
*
(
rptr
++
);
U
->
user_id
=
*
(
rptr
++
);
U
->
access_hash
=
*
(
long
long
*
)
rptr
;
rptr
+=
2
;
};
break
;
case
LOG_ENCR_CHAT_REQUESTED
:
rptr
++
;
{
peer_id_t
id
=
MK_ENCR_CHAT
(
*
(
rptr
++
));
struct
secret_chat
*
U
=
(
void
*
)
user_chat_get
(
id
);
if
(
!
U
)
{
U
=
talloc0
(
sizeof
(
peer_t
));
U
->
id
=
id
;
insert_encrypted_chat
((
void
*
)
U
);
}
U
->
flags
|=
FLAG_CREATED
;
U
->
state
=
sc_request
;
U
->
date
=
*
(
rptr
++
);
U
->
admin_id
=
*
(
rptr
++
);
U
->
user_id
=
*
(
rptr
++
);
U
->
access_hash
=
*
(
long
long
*
)
rptr
;
if
(
!
U
->
print_name
)
{
peer_t
*
P
=
user_chat_get
(
MK_USER
(
U
->
user_id
));
if
(
P
)
{
U
->
print_name
=
create_print_name
(
U
->
id
,
"!"
,
P
->
user
.
first_name
,
P
->
user
.
last_name
,
0
);
}
else
{
static
char
buf
[
100
];
tsnprintf
(
buf
,
99
,
"user#%d"
,
U
->
user_id
);
U
->
print_name
=
create_print_name
(
U
->
id
,
"!"
,
buf
,
0
,
0
);
}
peer_insert_name
((
void
*
)
U
);
}
rptr
+=
2
;
};
break
;
case
LOG_ENCR_CHAT_OK
:
rptr
++
;
{
peer_id_t
id
=
MK_ENCR_CHAT
(
*
(
rptr
++
));
struct
secret_chat
*
U
=
(
void
*
)
user_chat_get
(
id
);
assert
(
U
);
U
->
state
=
sc_ok
;
#ifdef USE_LUA
lua_secret_chat_created
(
U
);
#endif
}
break
;
case
CODE_binlog_new_user
:
in_ptr
++
;
{
peer_id_t
id
=
MK_USER
(
fetch_int
());
peer_t
*
_U
=
user_chat_get
(
id
);
if
(
!
_U
)
{
_U
=
talloc0
(
sizeof
(
*
_U
));
_U
->
id
=
id
;
insert_user
(
_U
);
}
else
{
assert
(
!
(
_U
->
flags
&
FLAG_CREATED
));
}
struct
user
*
U
=
(
void
*
)
_U
;
U
->
flags
|=
FLAG_CREATED
;
if
(
get_peer_id
(
id
)
==
our_id
)
{
U
->
flags
|=
FLAG_USER_SELF
;
}
U
->
first_name
=
fetch_str_dup
();
U
->
last_name
=
fetch_str_dup
();
assert
(
!
U
->
print_name
);
U
->
print_name
=
create_print_name
(
U
->
id
,
U
->
first_name
,
U
->
last_name
,
0
,
0
);
peer_insert_name
((
void
*
)
U
);
U
->
access_hash
=
fetch_long
();
U
->
phone
=
fetch_str_dup
();
if
(
fetch_int
())
{
U
->
flags
|=
FLAG_USER_CONTACT
;
}
#ifdef USE_LUA
lua_user_update
(
U
);
#endif
}
rptr
=
in_ptr
;
break
;
case
CODE_binlog_user_delete
:
rptr
++
;
{
peer_id_t
id
=
MK_USER
(
*
(
rptr
++
));
peer_t
*
U
=
user_chat_get
(
id
);
assert
(
U
);
U
->
flags
|=
FLAG_DELETED
;
}
break
;
case
CODE_binlog_set_user_access_token
:
rptr
++
;
{
...
...
binlog.h
View file @
337be909
...
...
@@ -36,7 +36,6 @@
#define LOG_ENCR_CHAT_REQUESTED 0x9011011a
#define LOG_ENCR_CHAT_OK 0x7612ce13
#define CODE_binlog_new_user 0xe04f30de
#define CODE_binlog_user_delete 0xf7a27c79
#define CODE_binlog_set_user_access_token 0x1349f615
#define CODE_binlog_set_user_phone 0x5d3afde2
...
...
binlog.tl
View file @
337be909
log.peer peer_type:int peer_id:int = log.Peer;
log.dc num:int hostname:string ip:string port:int = log.Event;
log.dcRenum old_num:int new_num:int = log.Event;
log.authKey dc:int key:bytes key_id:long = log.Event;
log.signIn dc:int id:int = log.Event;
log.user id:int flags:int access_hash:long first_name:string last_name:string real_first_name:string real_last_name:string phone:string photo:log.Photo photo_id:long photo_big:log.FileLocation photo_small:long.FileLocation = log.Event;
---types---
binlog.start = binlog.Update;
binlog.dcUpdate id:int name:string ip:string port:int = binlog.Update;
binlog.authKey dc:int key_id:long key:64*[int] = binlog.Update;
binlog.defaultDc dc:int = binlog.Update;
binlog.ourId id:int = binlog.Update;
binlog.dcSigned id:int = binlog.Update;
binlog.dcSalt id:int salt:long = binlog.Update;
binlog.newUser id:int first_name:string last_name:string hash:long phone:string is_contact:int = binlog.Update;
binlog.userDelete id:int = binlog.Update;
constants.h
deleted
100644 → 0
View file @
a05d1cfd
This diff is collapsed.
Click to expand it.
lua-tg.c
View file @
337be909
...
...
@@ -17,7 +17,7 @@ lua_State *luaState;
#include "structures.h"
#include "interface.h"
#include "constants.h"
#include "
auto/
constants.h"
#include "tools.h"
#include "queries.h"
#include "net.h"
...
...
mtproto-client.c
View file @
337be909
...
...
@@ -1409,7 +1409,7 @@ void work_update_short (struct connection *c, long long msg_id) {
void
work_updates
(
struct
connection
*
c
,
long
long
msg_id
)
{
int
*
save
=
in_ptr
;
assert
(
!
skip_type_any
(
&
(
struct
paramed_type
)
{.
type
=
&
tl_type_Updates
,
.
params
=
0
}
));
assert
(
!
skip_type_any
(
TYPE_TO_PARAM
(
Updates
)
));
int
*
save_end
=
in_ptr
;
in_ptr
=
save
;
assert
(
fetch_int
()
==
CODE_updates
);
...
...
mtproto-common.h
View file @
337be909
...
...
@@ -28,7 +28,7 @@
#include "interface.h"
#include "tools.h"
#include "constants.h"
#include "
auto/
constants.h"
/* DH key exchange protocol data structures */
#define CODE_req_pq 0x60469778
#define CODE_resPQ 0x05162463
...
...
@@ -323,6 +323,17 @@ static inline void fetch_ints (void *data, int count) {
memcpy
(
data
,
in_ptr
,
4
*
count
);
in_ptr
+=
count
;
}
static
inline
void
fetch256
(
void
*
buf
)
{
int
l
=
prefetch_strlen
();
assert
(
l
>=
0
);
char
*
s
=
fetch_str
(
l
);
if
(
l
<
256
)
{
memcpy
(
buf
+
256
-
l
,
s
,
l
);
}
else
{
memcpy
(
buf
,
s
+
(
l
-
256
),
256
);
}
}
int
get_random_bytes
(
unsigned
char
*
buf
,
int
n
);
...
...
queries.c
View file @
337be909
...
...
@@ -1324,15 +1324,18 @@ int send_encr_file_on_answer (struct query *q UU) {
}
struct
query_methods
send_file_part_methods
=
{
.
on_answer
=
send_file_part_on_answer
.
on_answer
=
send_file_part_on_answer
,
.
type
=
TYPE_TO_PARAM
(
Bool
)
};
struct
query_methods
send_file_methods
=
{
.
on_answer
=
send_file_on_answer
.
on_answer
=
send_file_on_answer
,
.
type
=
TYPE_TO_PARAM
(
messages_StatedMessage
)
};
struct
query_methods
send_encr_file_methods
=
{
.
on_answer
=
send_encr_file_on_answer
.
on_answer
=
send_encr_file_on_answer
,
.
type
=
TYPE_TO_PARAM
(
messages_SentEncryptedMessage
)
};
void
send_part
(
struct
send_file
*
f
)
{
...
...
@@ -1614,7 +1617,8 @@ int fwd_msg_on_answer (struct query *q UU) {
}
struct
query_methods
fwd_msg_methods
=
{
.
on_answer
=
fwd_msg_on_answer
.
on_answer
=
fwd_msg_on_answer
,
.
type
=
TYPE_TO_PARAM
(
messages_StatedMessage
)
};
void
do_forward_message
(
peer_id_t
id
,
int
n
)
{
...
...
@@ -1653,7 +1657,8 @@ int rename_chat_on_answer (struct query *q UU) {
}
struct
query_methods
rename_chat_methods
=
{
.
on_answer
=
rename_chat_on_answer
.
on_answer
=
rename_chat_on_answer
,
.
type
=
TYPE_TO_PARAM
(
messages_StatedMessage
)
};
void
do_rename_chat
(
peer_id_t
id
,
char
*
name
UU
)
{
...
...
@@ -1698,7 +1703,8 @@ int chat_info_on_answer (struct query *q UU) {
}
struct
query_methods
chat_info_methods
=
{
.
on_answer
=
chat_info_on_answer
.
on_answer
=
chat_info_on_answer
,
.
type
=
TYPE_TO_PARAM
(
messages_ChatFull
)
};
void
do_get_chat_info
(
peer_id_t
id
)
{
...
...
@@ -1748,7 +1754,8 @@ int user_info_on_answer (struct query *q UU) {
}
struct
query_methods
user_info_methods
=
{
.
on_answer
=
user_info_on_answer
.
on_answer
=
user_info_on_answer
,
.
type
=
TYPE_TO_PARAM
(
UserFull
)
};
void
do_get_user_info
(
peer_id_t
id
)
{
...
...
@@ -1789,7 +1796,8 @@ int user_list_info_silent_on_answer (struct query *q UU) {
}
struct
query_methods
user_list_info_silent_methods
=
{
.
on_answer
=
user_list_info_silent_on_answer
.
on_answer
=
user_list_info_silent_on_answer
,
.
type
=
TYPE_TO_PARAM_1
(
Vector
,
TYPE_TO_PARAM
(
User
))
};
void
do_get_user_list_info_silent
(
int
num
,
int
*
list
)
{
...
...
@@ -1891,7 +1899,8 @@ int download_on_answer (struct query *q) {
}
struct
query_methods
download_methods
=
{
.
on_answer
=
download_on_answer
.
on_answer
=
download_on_answer
,
.
type
=
TYPE_TO_PARAM
(
upload_File
)
};
void
load_next_part
(
struct
download
*
D
)
{
...
...
@@ -2092,7 +2101,8 @@ int export_auth_on_answer (struct query *q UU) {
struct
query_methods
export_auth_methods
=
{
.
on_answer
=
export_auth_on_answer
,
.
on_error
=
fail_on_error
.
on_error
=
fail_on_error
,
.
type
=
TYPE_TO_PARAM
(
auth_ExportedAuthorization
)
};
void
do_export_auth
(
int
num
)
{
...
...
@@ -2117,7 +2127,8 @@ int import_auth_on_answer (struct query *q UU) {
struct
query_methods
import_auth_methods
=
{
.
on_answer
=
import_auth_on_answer
,
.
on_error
=
fail_on_error
.
on_error
=
fail_on_error
,
.
type
=
TYPE_TO_PARAM
(
auth_Authorization
)
};
void
do_import_auth
(
int
num
)
{
...
...
@@ -2183,6 +2194,7 @@ int add_contact_on_answer (struct query *q UU) {
struct
query_methods
add_contact_methods
=
{
.
on_answer
=
add_contact_on_answer
,
.
type
=
TYPE_TO_PARAM
(
contacts_ImportedContacts
)
};
void
do_add_contact
(
const
char
*
phone
,
int
phone_len
,
const
char
*
first_name
,
int
first_name_len
,
const
char
*
last_name
,
int
last_name_len
,
int
force
)
{
...
...
@@ -2206,7 +2218,8 @@ int msg_search_on_answer (struct query *q UU) {
}
struct
query_methods
msg_search_methods
=
{
.
on_answer
=
msg_search_on_answer
.
on_answer
=
msg_search_on_answer
,
.
type
=
TYPE_TO_PARAM
(
messages_Messages
)
};
void
do_msg_search
(
peer_id_t
id
,
int
from
,
int
to
,
int
limit
,
const
char
*
s
)
{
...
...
@@ -2260,7 +2273,8 @@ int contacts_search_on_answer (struct query *q UU) {
}
struct
query_methods
contacts_search_methods
=
{
.
on_answer
=
contacts_search_on_answer
.
on_answer
=
contacts_search_on_answer
,
.
type
=
TYPE_TO_PARAM
(
contacts_Found
)
};
void
do_contacts_search
(
int
limit
,
const
char
*
s
)
{
...
...
@@ -2321,11 +2335,13 @@ int send_encr_request_on_answer (struct query *q UU) {
}
struct
query_methods
send_encr_accept_methods
=
{
.
on_answer
=
send_encr_accept_on_answer
.
on_answer
=
send_encr_accept_on_answer
,
.
type
=
TYPE_TO_PARAM
(
EncryptedChat
)
};
struct
query_methods
send_encr_request_methods
=
{
.
on_answer
=
send_encr_request_on_answer
.
on_answer
=
send_encr_request_on_answer
,
.
type
=
TYPE_TO_PARAM
(
EncryptedChat
)
};
int
encr_root
;
...
...
@@ -2544,7 +2560,8 @@ int get_dh_config_on_answer (struct query *q UU) {
}
struct
query_methods
get_dh_config_methods
=
{
.
on_answer
=
get_dh_config_on_answer
.
on_answer
=
get_dh_config_on_answer
,
.
type
=
TYPE_TO_PARAM
(
messages_DhConfig
)
};
void
do_accept_encr_chat_request
(
struct
secret_chat
*
E
)
{
...
...
@@ -2655,11 +2672,13 @@ int get_difference_on_answer (struct query *q UU) {
}
struct
query_methods
get_state_methods
=
{
.
on_answer
=
get_state_on_answer
.
on_answer
=
get_state_on_answer
,
.
type
=
TYPE_TO_PARAM
(
updates_State
)
};
struct
query_methods
get_difference_methods
=
{
.
on_answer
=
get_difference_on_answer
.
on_answer
=
get_difference_on_answer
,
.
type
=
TYPE_TO_PARAM
(
updates_Difference
)
};
void
do_get_difference
(
void
)
{
...
...
@@ -2746,7 +2765,8 @@ int get_suggested_on_answer (struct query *q UU) {
}
struct
query_methods
get_suggested_methods
=
{
.
on_answer
=
get_suggested_on_answer
.
on_answer
=
get_suggested_on_answer
,
.
type
=
TYPE_TO_PARAM
(
contacts_Suggested
)
};
void
do_get_suggested
(
void
)
{
...
...
@@ -2760,7 +2780,8 @@ void do_get_suggested (void) {
/* {{{ Add user to chat */
struct
query_methods
add_user_to_chat_methods
=
{
.
on_answer
=
fwd_msg_on_answer
.
on_answer
=
fwd_msg_on_answer
,
.
type
=
TYPE_TO_PARAM
(
MessageAction
)
};
void
do_add_user_to_chat
(
peer_id_t
chat_id
,
peer_id_t
id
,
int
limit
)
{
...
...
@@ -2818,7 +2839,8 @@ void do_create_secret_chat (peer_id_t id) {
/* {{{ Create group chat */
struct
query_methods
create_group_chat_methods
=
{
.
on_answer
=
fwd_msg_on_answer
.
on_answer
=
fwd_msg_on_answer
,
.
type
=
TYPE_TO_PARAM
(
MessageAction
)
};
void
do_create_group_chat
(
peer_id_t
id
,
char
*
chat_topic
)
{
...
...
@@ -2857,7 +2879,8 @@ int delete_msg_on_answer (struct query *q UU) {
}
struct
query_methods
delete_msg_methods
=
{
.
on_answer
=
delete_msg_on_answer
.
on_answer
=
delete_msg_on_answer
,
.
type
=
TYPE_TO_PARAM_1
(
Vector
,
TYPE_TO_PARAM
(
bare_Int
))
};
void
do_delete_msg
(
long
long
id
)
{
...
...
@@ -2881,7 +2904,8 @@ int restore_msg_on_answer (struct query *q UU) {
}
struct
query_methods
restore_msg_methods
=
{
.
on_answer
=
restore_msg_on_answer
.
on_answer
=
restore_msg_on_answer
,
.
type
=
TYPE_TO_PARAM_1
(
Vector
,
TYPE_TO_PARAM
(
bare_Int
))
};
void
do_restore_msg
(
long
long
id
)
{
...
...
@@ -2899,7 +2923,8 @@ int update_status_on_answer (struct query *q UU) {
}
struct
query_methods
update_status_methods
=
{
.
on_answer
=
update_status_on_answer
.
on_answer
=
update_status_on_answer
,
.
type
=
TYPE_TO_PARAM
(
Bool
)
};
void
do_update_status
(
int
online
UU
)
{
...
...
structures.c
View file @
337be909
This diff is collapsed.
Click to expand it.
tl-parser.c
View file @
337be909
...
...
@@ -1197,6 +1197,8 @@ struct tl_constructor *tl_add_function (struct tl_type *a, const char *_id, int
assert
(
magic
&&
magic
!=
(
unsigned
)
-
1
);
}
len
=
x
;
struct
tl_constructor
_t
=
{.
id
=
id
};
if
(
tree_lookup_tl_constructor
(
tl_function_tree
,
&
_t
))
{
TL_ERROR
(
"Duplicate function id `%s`
\n
"
,
id
);
...
...
tools.c
View file @
337be909
...
...
@@ -139,6 +139,9 @@ void *talloc (size_t size) {
*
(
int
*
)(
p
+
RES_AFTER
+
4
+
size
)
=
used_blocks
;
blocks
[
used_blocks
++
]
=
p
;
if
(
used_blocks
-
1
==
24867
)
{
assert
(
0
);
}
tcheck
();
return
p
+
8
;
#else
...
...
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