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
80d35a2d
Commit
80d35a2d
authored
Sep 11, 2014
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for set_ttl query
parent
83be082c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
interface.c
interface.c
+13
-0
queries.c
queries.c
+19
-0
tgl.h
tgl.h
+1
-0
No files found.
interface.c
View file @
80d35a2d
...
...
@@ -401,6 +401,7 @@ struct command commands[] = {
{
"chat_set_photo"
,
{
ca_chat
,
ca_file_name_end
}},
{
"set_profile_photo"
,
{
ca_file_name_end
}},
{
"accept_secret_chat"
,
{
ca_secret_chat
,
ca_none
}},
{
"set_ttl"
,
{
ca_secret_chat
,
ca_number
,
ca_none
}},
{
"export_card"
,
{
ca_none
}},
{
"import_card"
,
{
ca_string
,
ca_none
}},
{
"send_contact"
,
{
ca_peer
,
ca_string
,
ca_string
,
ca_string
}},
...
...
@@ -1724,6 +1725,18 @@ void interpreter (char *line UU) {
tgl_peer_t
*
E
=
tgl_peer_get
(
id
);
assert
(
E
);
tgl_do_accept_encr_chat_request
(
&
E
->
encr_chat
,
0
,
0
);
}
else
if
(
IS_WORD
(
"set_ttl"
))
{
GET_PEER_ENCR_CHAT
;
tgl_peer_t
*
E
=
tgl_peer_get
(
id
);
assert
(
E
);
long
long
num
=
next_token_int
();
if
(
num
==
NOT_FOUND
)
{
printf
(
"Bad msg id
\n
"
);
RET
;
}
if
(
E
->
encr_chat
.
state
==
sc_ok
)
{
tgl_do_set_encr_chat_ttl
(
&
E
->
encr_chat
,
num
,
0
,
0
);
}
}
else
if
(
IS_WORD
(
"safe_quit"
))
{
safe_quit
=
1
;
}
...
...
queries.c
View file @
80d35a2d
...
...
@@ -805,6 +805,21 @@ void tgl_do_send_encr_chat_layer (struct tgl_secret_chat *E) {
//print_message (M);
}
void
tgl_do_set_encr_chat_ttl
(
struct
tgl_secret_chat
*
E
,
int
ttl
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_message
*
M
),
void
*
callback_extra
)
{
long
long
t
;
tglt_secure_random
(
&
t
,
8
);
int
action
[
2
];
action
[
0
]
=
CODE_decrypted_message_action_set_message_t_t_l
;
action
[
1
]
=
ttl
;
bl_do_send_message_action_encr
(
t
,
tgl_state
.
our_id
,
tgl_get_peer_type
(
E
->
id
),
tgl_get_peer_id
(
E
->
id
),
time
(
0
),
2
,
action
);
struct
tgl_message
*
M
=
tgl_message_get
(
t
);
assert
(
M
);
assert
(
M
->
action
.
type
==
tgl_message_action_set_message_ttl
);
tgl_do_send_msg
(
M
,
callback
,
callback_extra
);
//print_message (M);
}
/* {{{ Seng msg (plain text) */
static
int
msg_send_encr_on_answer
(
struct
query
*
q
UU
)
{
assert
(
fetch_int
()
==
CODE_messages_sent_encrypted_message
);
...
...
@@ -947,6 +962,10 @@ void tgl_do_send_encr_msg_action (struct tgl_message *M, void (*callback)(void *
out_int
(
CODE_decrypted_message_action_notify_layer
);
out_int
(
M
->
action
.
layer
);
break
;
case
tgl_message_action_set_message_ttl
:
out_int
(
CODE_decrypted_message_action_set_message_t_t_l
);
out_int
(
M
->
action
.
ttl
);
break
;
default:
assert
(
0
);
}
...
...
tgl.h
View file @
80d35a2d
...
...
@@ -284,6 +284,7 @@ void tgl_do_import_card (int size, int *card, void (*callback)(void *callback_ex
void
tgl_do_send_contact
(
tgl_peer_id_t
id
,
const
char
*
phone
,
int
phone_len
,
const
char
*
first_name
,
int
first_name_len
,
const
char
*
last_name
,
int
last_name_len
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_message
*
M
),
void
*
callback_extra
);
void
tgl_do_forward_media
(
tgl_peer_id_t
id
,
int
n
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_message
*
M
),
void
*
callback_extra
);
void
tgl_do_del_contact
(
tgl_peer_id_t
id
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
),
void
*
callback_extra
);
void
tgl_do_set_encr_chat_ttl
(
struct
tgl_secret_chat
*
E
,
int
ttl
,
void
(
*
callback
)(
void
*
callback_extra
,
int
success
,
struct
tgl_message
*
M
),
void
*
callback_extra
);
void
tgl_do_visualize_key
(
tgl_peer_id_t
id
,
unsigned
char
buf
[
16
]);
...
...
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