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
db8a7a77
Commit
db8a7a77
authored
Oct 22, 2013
by
vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some fixes
parent
b1d88355
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
7 deletions
+16
-7
interface.c
interface.c
+1
-1
interface.h
interface.h
+1
-0
queries.c
queries.c
+12
-5
queries.h
queries.h
+1
-1
structures.h
structures.h
+1
-0
No files found.
interface.c
View file @
db8a7a77
...
...
@@ -223,7 +223,7 @@ void interpreter (char *line UU) {
}
while
(
*
q
&&
(
*
q
==
' '
||
*
q
==
'\t'
))
{
q
++
;
}
if
(
*
q
&&
index
<
user_num
+
chat_num
)
{
do_send_message
(
Peers
[
index
],
q
);
do_send_message
(
Peers
[
index
],
q
,
strlen
(
q
)
);
}
}
else
if
(
!
memcmp
(
line
,
"send_photo"
,
10
))
{
char
*
q
=
line
+
10
;
...
...
interface.h
View file @
db8a7a77
...
...
@@ -21,6 +21,7 @@ void logprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2)))
void
hexdump
(
int
*
in_ptr
,
int
*
in_end
);
struct
message
;
union
user_chat
;
void
print_message
(
struct
message
*
M
);
void
print_chat_name
(
int
id
,
union
user_chat
*
C
);
void
print_user_name
(
int
id
,
union
user_chat
*
U
);
...
...
queries.c
View file @
db8a7a77
...
...
@@ -107,6 +107,8 @@ void query_error (long long id) {
queries_tree
=
tree_delete_query
(
queries_tree
,
q
);
if
(
q
->
methods
&&
q
->
methods
->
on_error
)
{
q
->
methods
->
on_error
(
q
,
error_code
,
error_len
,
error
);
}
else
{
logprintf
(
"error for query #%lld: #%d :%.*s
\n
"
,
id
,
error_code
,
error_len
,
error
);
}
free
(
q
->
data
);
free
(
q
);
...
...
@@ -451,7 +453,7 @@ struct query_methods msg_send_methods = {
int
out_message_num
;
int
our_id
;
void
do_send_message
(
union
user_chat
*
U
,
const
char
*
msg
)
{
void
do_send_message
(
union
user_chat
*
U
,
const
char
*
msg
,
int
len
)
{
if
(
!
out_message_num
)
{
out_message_num
=
-
lrand48
();
}
...
...
@@ -475,12 +477,15 @@ void do_send_message (union user_chat *U, const char *msg) {
out_int
(
U
->
id
);
}
}
M
->
message
=
strdup
(
msg
);
M
->
message
=
malloc
(
len
+
1
);
memcpy
(
M
->
message
,
msg
,
len
);
M
->
message
[
len
]
=
0
;
M
->
message_len
=
len
;
M
->
out
=
1
;
M
->
media
.
type
=
CODE_message_media_empty
;
M
->
id
=
out_message_num
;
M
->
date
=
time
(
0
);
out_
string
(
msg
);
out_
cstring
(
msg
,
len
);
out_long
((
--
out_message_num
)
-
(
1ll
<<
32
));
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
msg_send_methods
,
M
);
print_message
(
M
);
...
...
@@ -495,12 +500,14 @@ void do_send_text (union user_chat *U, char *file_name) {
}
static
char
buf
[(
1
<<
20
)
+
1
];
int
x
=
read
(
fd
,
buf
,
(
1
<<
20
)
+
1
);
assert
(
x
>=
0
);
if
(
x
==
(
1
<<
20
)
+
1
)
{
rprintf
(
"Too big file '%s'
\n
"
,
file_name
);
free
(
file_name
);
close
(
fd
);
}
else
{
do_send_message
(
U
,
buf
);
buf
[
x
]
=
0
;
do_send_message
(
U
,
buf
,
x
);
free
(
file_name
);
close
(
fd
);
}
...
...
@@ -738,7 +745,7 @@ void do_send_photo (int type, int to_id, char *file_name) {
f
->
size
=
size
;
f
->
offset
=
0
;
f
->
part_num
=
0
;
f
->
part_size
=
(
size
/
1000
+
0x3ff
)
&
~
0x3ff
;
f
->
part_size
=
(
(
size
+
999
)
/
1000
+
0x3ff
)
&
~
0x3ff
;
f
->
id
=
lrand48
()
*
(
1ll
<<
32
)
+
lrand48
();
f
->
to_id
=
to_id
;
f
->
media_type
=
type
;
...
...
queries.h
View file @
db8a7a77
...
...
@@ -47,7 +47,7 @@ double get_double_time (void);
void
do_update_contact_list
(
void
);
union
user_chat
;
void
do_send_message
(
union
user_chat
*
U
,
const
char
*
msg
);
void
do_send_message
(
union
user_chat
*
U
,
const
char
*
msg
,
int
len
);
void
do_send_text
(
union
user_chat
*
U
,
char
*
file
);
void
do_get_history
(
union
user_chat
*
U
,
int
limit
);
void
do_get_dialog_list
(
void
);
...
...
structures.h
View file @
db8a7a77
...
...
@@ -136,6 +136,7 @@ struct message {
struct
message_action
action
;
struct
{
char
*
message
;
int
message_len
;
struct
message_media
media
;
};
};
...
...
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