Commit b1b4cd8b authored by Vysheng's avatar Vysheng

interface: added auto-completion for modifiers (only [offline] for now)

parent ef8de029
......@@ -43,7 +43,7 @@
#include "mtproto-common.h"
#define ALLOW_MULT 1
//#define ALLOW_MULT 1
char *default_prompt = "> ";
int unread_messages;
......@@ -247,6 +247,11 @@ void update_prompt (void) {
print_end ();
}
char *modifiers[] = {
"[offline]",
0
};
char *commands[] = {
"help",
"msg",
......@@ -339,6 +344,8 @@ int commands_flags[] = {
07,
};
int get_complete_mode (void) {
line_ptr = rl_line_buffer;
int l = 0;
......@@ -348,6 +355,9 @@ int get_complete_mode (void) {
r = next_token (&l);
if (!r) { return 0; }
}
if (*r == '[' && !r[l]) {
return 6;
}
if (!*line_ptr) { return 0; }
char **command = commands;
......@@ -485,6 +495,10 @@ char *command_generator (const char *text, int state) {
index = complete_encr_chat_list (index, text, len, &R);
if (c) { rl_line_buffer[rl_point] = c; }
return R;
case 6:
index = complete_string_list (modifiers, index, text, len, &R);
if (c) { rl_line_buffer[rl_point] = c; }
return R;
default:
if (c) { rl_line_buffer[rl_point] = c; }
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment