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
c713d80d
Commit
c713d80d
authored
Nov 07, 2013
by
vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some bugfixes. Add small thumb file to sent video
parent
143fda9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
44 deletions
+52
-44
interface.c
interface.c
+9
-37
mtproto-client.c
mtproto-client.c
+3
-1
queries.c
queries.c
+40
-6
No files found.
interface.c
View file @
c713d80d
...
...
@@ -63,10 +63,14 @@ char *next_token (int *l) {
}
int
neg
=
0
;
char
*
s
=
line_ptr
;
while
(
*
line_ptr
&&
(
*
line_ptr
!=
' '
||
neg
))
{
int
in_str
=
0
;
while
(
*
line_ptr
&&
(
*
line_ptr
!=
' '
||
neg
||
in_str
))
{
if
(
*
line_ptr
==
'\\'
)
{
neg
=
1
-
neg
;
}
else
{
if
(
*
line_ptr
==
'"'
&&
!
neg
)
{
in_str
=
!
in_str
;
}
neg
=
0
;
}
line_ptr
++
;
...
...
@@ -756,28 +760,12 @@ void interpreter (char *line UU) {
int
readline_active
;
void
rprintf
(
const
char
*
format
,
...)
{
int
saved_point
=
0
;
char
*
saved_line
=
0
;
if
(
readline_active
)
{
saved_point
=
rl_point
;
saved_line
=
rl_copy_text
(
0
,
rl_end
);
rl_save_prompt
();
rl_replace_line
(
""
,
0
);
rl_redisplay
();
}
print_start
();
va_list
ap
;
va_start
(
ap
,
format
);
vfprintf
(
stdout
,
format
,
ap
);
va_end
(
ap
);
if
(
readline_active
)
{
rl_restore_prompt
();
rl_replace_line
(
saved_line
,
0
);
rl_point
=
saved_point
;
rl_redisplay
();
free
(
saved_line
);
}
print_end
();
}
int
saved_point
;
...
...
@@ -833,30 +821,14 @@ void hexdump (int *in_ptr, int *in_end) {
}
void
logprintf
(
const
char
*
format
,
...)
{
int
saved_point
=
0
;
char
*
saved_line
=
0
;
if
(
readline_active
)
{
saved_point
=
rl_point
;
saved_line
=
rl_copy_text
(
0
,
rl_end
);
rl_save_prompt
();
rl_replace_line
(
""
,
0
);
rl_redisplay
();
}
print_start
();
printf
(
COLOR_GREY
" *** "
);
va_list
ap
;
va_start
(
ap
,
format
);
vfprintf
(
stdout
,
format
,
ap
);
va_end
(
ap
);
printf
(
COLOR_NORMAL
);
if
(
readline_active
)
{
rl_restore_prompt
();
rl_replace_line
(
saved_line
,
0
);
rl_point
=
saved_point
;
rl_redisplay
();
free
(
saved_line
);
}
print_end
();
}
int
color_stack_pos
;
...
...
mtproto-client.c
View file @
c713d80d
...
...
@@ -708,7 +708,9 @@ void work_update (struct connection *c UU, long long msg_id UU) {
int
id
=
fetch_int
();
// id
int
new
=
fetch_long
();
// random_id
struct
message
*
M
=
message_get
(
new
);
update_message_id
(
M
,
id
);
if
(
M
)
{
update_message_id
(
M
,
id
);
}
}
break
;
case
CODE_update_read_messages
:
...
...
queries.c
View file @
c713d80d
...
...
@@ -1094,8 +1094,9 @@ struct send_file {
int
part_num
;
int
part_size
;
long
long
id
;
long
long
thumb_id
;
peer_id_t
to_id
;
int
media_type
;
unsigned
media_type
;
char
*
file_name
;
int
encr
;
unsigned
char
*
iv
;
...
...
@@ -1225,12 +1226,14 @@ void send_part (struct send_file *f) {
}
else
{
assert
(
f
->
part_size
==
x
);
}
update_prompt
();
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
send_file_part_methods
,
f
);
}
else
{
cur_uploaded_bytes
-=
f
->
size
;
cur_uploading_bytes
-=
f
->
size
;
update_prompt
();
clear_packet
();
assert
(
f
->
media_type
==
CODE_input_media_uploaded_photo
||
f
->
media_type
==
CODE_input_media_uploaded_video
);
assert
(
f
->
media_type
==
CODE_input_media_uploaded_photo
||
f
->
media_type
==
CODE_input_media_uploaded_video
||
f
->
media_type
==
CODE_input_media_uploaded_thumb_video
);
if
(
!
f
->
encr
)
{
out_int
(
CODE_messages_send_media
);
out_peer_id
(
f
->
to_id
);
...
...
@@ -1245,8 +1248,17 @@ void send_part (struct send_file *f) {
char
*
s
=
f
->
file_name
+
strlen
(
f
->
file_name
);
while
(
s
>=
f
->
file_name
&&
*
s
!=
'/'
)
{
s
--
;}
out_string
(
s
+
1
);
out_string
(
""
);
if
(
f
->
media_type
==
CODE_input_media_uploaded_video
)
{
if
(
f
->
size
<
(
16
<<
20
))
{
out_string
(
""
);
}
if
(
f
->
media_type
==
CODE_input_media_uploaded_thumb_video
)
{
out_int
(
CODE_input_file
);
out_long
(
f
->
thumb_id
);
out_int
(
1
);
out_string
(
"thumb.jpg"
);
out_string
(
""
);
}
if
(
f
->
media_type
==
CODE_input_media_uploaded_video
||
f
->
media_type
==
CODE_input_media_uploaded_thumb_video
)
{
out_int
(
100
);
out_int
(
100
);
out_int
(
100
);
...
...
@@ -1296,7 +1308,9 @@ void send_part (struct send_file *f) {
}
out_long
(
f
->
id
);
out_int
(
f
->
part_num
);
out_string
(
""
);
if
(
f
->
size
<
(
16
<<
20
))
{
out_string
(
""
);
}
unsigned
char
md5
[
16
];
unsigned
char
str
[
64
];
...
...
@@ -1329,6 +1343,16 @@ void send_part (struct send_file *f) {
}
}
void
send_file_thumb
(
struct
send_file
*
f
)
{
clear_packet
();
f
->
thumb_id
=
lrand48
()
*
(
1ll
<<
32
)
+
lrand48
();
out_int
(
CODE_upload_save_file_part
);
out_long
(
f
->
thumb_id
);
out_int
(
0
);
out_cstring
((
void
*
)
thumb_file
,
thumb_file_size
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
send_file_part_methods
,
f
);
}
void
do_send_photo
(
int
type
,
peer_id_t
to_id
,
char
*
file_name
)
{
int
fd
=
open
(
file_name
,
O_RDONLY
);
if
(
fd
<
0
)
{
...
...
@@ -1379,7 +1403,12 @@ void do_send_photo (int type, peer_id_t to_id, char *file_name) {
rprintf
(
"Too big file. Maximal supported size is %d"
,
(
512
<<
10
)
*
1000
);
return
;
}
send_part
(
f
);
if
(
f
->
media_type
==
CODE_input_media_uploaded_video
&&
!
f
->
encr
)
{
f
->
media_type
=
CODE_input_media_uploaded_thumb_video
;
send_file_thumb
(
f
);
}
else
{
send_part
(
f
);
}
}
/* }}} */
...
...
@@ -1713,6 +1742,11 @@ void load_next_part (struct download *D) {
}
void
do_load_photo_size
(
struct
photo_size
*
P
,
int
next
)
{
if
(
!
P
->
loc
.
dc
)
{
rprintf
(
"Bad video thumb
\n
"
);
return
;
}
assert
(
P
);
assert
(
next
);
struct
download
*
D
=
malloc
(
sizeof
(
*
D
));
...
...
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