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
b70f868e
Commit
b70f868e
authored
Nov 01, 2013
by
Vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added search query. But it seems, that search does not use stemmer
parent
970cbcd3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
3 deletions
+41
-3
interface.c
interface.c
+14
-0
mtproto-common.h
mtproto-common.h
+1
-0
queries.c
queries.c
+25
-3
queries.h
queries.h
+1
-0
No files found.
interface.c
View file @
b70f868e
...
...
@@ -231,6 +231,7 @@ char *commands[] = {
"add_contact"
,
"rename_contact"
,
"show_license"
,
"search"
,
0
};
int
commands_flags
[]
=
{
...
...
@@ -256,6 +257,7 @@ int commands_flags[] = {
07
,
071
,
07
,
072
,
};
int
get_complete_mode
(
void
)
{
...
...
@@ -671,6 +673,18 @@ void interpreter (char *line UU) {
#include "LICENSE.h"
;
printf
(
"%s"
,
b
);
}
else
if
(
IS_WORD
(
"search"
))
{
GET_PEER
;
int
from
=
0
;
int
to
=
0
;
int
limit
=
40
;
int
t
;
char
*
s
=
next_token
(
&
t
);
if
(
!
s
)
{
printf
(
"Empty message
\n
"
);
RET
;
}
do_msg_search
(
id
,
from
,
to
,
limit
,
s
);
}
#undef IS_WORD
#undef RET
...
...
mtproto-common.h
View file @
b70f868e
...
...
@@ -261,6 +261,7 @@ static inline void out_bignum (BIGNUM *n) {
extern
int
*
in_ptr
,
*
in_end
;
void
fetch_pts
(
void
);
static
inline
int
prefetch_strlen
(
void
)
{
if
(
in_ptr
>=
in_end
)
{
return
-
1
;
...
...
queries.c
View file @
b70f868e
...
...
@@ -607,12 +607,12 @@ int msg_send_on_answer (struct query *q UU) {
assert
(
fetch_int
()
==
(
int
)
CODE_messages_sent_message
);
int
id
=
fetch_int
();
// id
int
date
=
fetch_int
();
// date
int
ptr
=
fetch_int
();
// ptr
fetch_pts
();
int
seq
=
fetch_int
();
// seq
struct
message
*
M
=
q
->
extra
;
M
->
id
=
id
;
message_insert
(
M
);
logprintf
(
"Sent: id = %d, date = %d,
ptr = %d, seq = %d
\n
"
,
id
,
date
,
ptr
,
seq
);
logprintf
(
"Sent: id = %d, date = %d,
seq = %d
\n
"
,
id
,
date
,
seq
);
return
0
;
}
...
...
@@ -725,7 +725,7 @@ int get_history_on_answer (struct query *q UU) {
for
(
i
=
0
;
i
<
n
;
i
++
)
{
fetch_alloc_user
();
}
if
(
sn
>
0
)
{
if
(
sn
>
0
&&
q
->
extra
)
{
do_messages_mark_read
(
*
(
peer_id_t
*
)
&
(
q
->
extra
),
ML
[
0
]
->
id
);
}
return
0
;
...
...
@@ -1447,3 +1447,25 @@ void do_add_contact (const char *phone, int phone_len, const char *first_name, i
out_int
(
force
?
CODE_bool_true
:
CODE_bool_false
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
add_contact_methods
,
0
);
}
int
msg_search_on_answer
(
struct
query
*
q
UU
)
{
return
get_history_on_answer
(
q
);
}
struct
query_methods
msg_search_methods
=
{
.
on_answer
=
msg_search_on_answer
};
void
do_msg_search
(
peer_id_t
id
,
int
from
,
int
to
,
int
limit
,
const
char
*
s
)
{
clear_packet
();
out_int
(
CODE_messages_search
);
out_peer_id
(
id
);
out_string
(
s
);
out_int
(
CODE_input_messages_filter_empty
);
out_int
(
from
);
out_int
(
to
);
out_int
(
0
);
// offset
out_int
(
0
);
// max_id
out_int
(
limit
);
send_query
(
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
msg_search_methods
,
0
);
}
queries.h
View file @
b70f868e
...
...
@@ -92,5 +92,6 @@ int do_send_code_result_auth (const char *code, const char *first_name, const ch
void
do_import_auth
(
int
num
);
void
do_export_auth
(
int
num
);
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
);
void
do_msg_search
(
peer_id_t
id
,
int
from
,
int
to
,
int
limit
,
const
char
*
s
);
#endif
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