Added global_search query
This commit is contained in:
parent
9eadb3e9dc
commit
c509422ce5
19
interface.c
19
interface.c
@ -255,6 +255,7 @@ char *commands[] = {
|
|||||||
"visualize_key",
|
"visualize_key",
|
||||||
"create_secret_chat",
|
"create_secret_chat",
|
||||||
"suggested_contacts",
|
"suggested_contacts",
|
||||||
|
"global_search",
|
||||||
0 };
|
0 };
|
||||||
|
|
||||||
int commands_flags[] = {
|
int commands_flags[] = {
|
||||||
@ -285,6 +286,7 @@ int commands_flags[] = {
|
|||||||
075,
|
075,
|
||||||
071,
|
071,
|
||||||
07,
|
07,
|
||||||
|
07,
|
||||||
};
|
};
|
||||||
|
|
||||||
int get_complete_mode (void) {
|
int get_complete_mode (void) {
|
||||||
@ -745,6 +747,17 @@ void interpreter (char *line UU) {
|
|||||||
RET;
|
RET;
|
||||||
}
|
}
|
||||||
do_msg_search (id, from, to, limit, s);
|
do_msg_search (id, from, to, limit, s);
|
||||||
|
} else if (IS_WORD ("global_search")) {
|
||||||
|
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 (PEER_NOT_FOUND, from, to, limit, s);
|
||||||
} else if (IS_WORD ("mark_read")) {
|
} else if (IS_WORD ("mark_read")) {
|
||||||
GET_PEER;
|
GET_PEER;
|
||||||
do_mark_read (id);
|
do_mark_read (id);
|
||||||
@ -916,9 +929,11 @@ void print_user_name (peer_id_t id, peer_t *U) {
|
|||||||
if (U->flags & (FLAG_USER_SELF | FLAG_USER_CONTACT)) {
|
if (U->flags & (FLAG_USER_SELF | FLAG_USER_CONTACT)) {
|
||||||
push_color (COLOR_REDB);
|
push_color (COLOR_REDB);
|
||||||
}
|
}
|
||||||
if (!U->user.first_name) {
|
if ((U->flags & FLAG_DELETED) || (U->flags & FLAG_EMPTY)) {
|
||||||
|
printf ("deleted user#%d", get_peer_id (id));
|
||||||
|
} else if (!U->user.first_name || !strlen (U->user.first_name)) {
|
||||||
printf ("%s", U->user.last_name);
|
printf ("%s", U->user.last_name);
|
||||||
} else if (!U->user.last_name) {
|
} else if (!U->user.last_name || !strlen (U->user.last_name)) {
|
||||||
printf ("%s", U->user.first_name);
|
printf ("%s", U->user.first_name);
|
||||||
} else {
|
} else {
|
||||||
printf ("%s %s", U->user.first_name, U->user.last_name);
|
printf ("%s %s", U->user.first_name, U->user.last_name);
|
||||||
|
@ -1971,9 +1971,17 @@ struct query_methods msg_search_methods = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void do_msg_search (peer_id_t id, int from, int to, int limit, const char *s) {
|
void do_msg_search (peer_id_t id, int from, int to, int limit, const char *s) {
|
||||||
|
if (get_peer_type (id) == PEER_ENCR_CHAT) {
|
||||||
|
rprintf ("Can not search in secure chat\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
clear_packet ();
|
clear_packet ();
|
||||||
out_int (CODE_messages_search);
|
out_int (CODE_messages_search);
|
||||||
|
if (get_peer_type (id) == PEER_UNKNOWN) {
|
||||||
|
out_int (CODE_input_peer_empty);
|
||||||
|
} else {
|
||||||
out_peer_id (id);
|
out_peer_id (id);
|
||||||
|
}
|
||||||
out_string (s);
|
out_string (s);
|
||||||
out_int (CODE_input_messages_filter_empty);
|
out_int (CODE_input_messages_filter_empty);
|
||||||
out_int (from);
|
out_int (from);
|
||||||
|
Loading…
Reference in New Issue
Block a user