|
|
|
|
@@ -110,6 +110,8 @@ static char* _software_autocomplete(ProfWin* window, const char* const input, gb
|
|
|
|
|
static char* _url_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
|
|
|
|
static char* _executable_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
|
|
|
|
static char* _lastactivity_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
|
|
|
|
static char* _disco_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
|
|
|
|
static char* _roster_jid_autocomplete(const char* const input, const char* const prefix, gboolean previous);
|
|
|
|
|
static char* _intype_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
|
|
|
|
static char* _mood_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
|
|
|
|
static char* _strophe_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
|
|
|
|
@@ -122,6 +124,7 @@ static char* _ai_autocomplete(ProfWin* window, const char* const input, gboolean
|
|
|
|
|
static char* _script_autocomplete_func(const char* const prefix, gboolean previous, void* context);
|
|
|
|
|
|
|
|
|
|
static char* _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previous);
|
|
|
|
|
static gboolean _is_connected(void);
|
|
|
|
|
|
|
|
|
|
static Autocomplete commands_ac;
|
|
|
|
|
static Autocomplete who_room_ac;
|
|
|
|
|
@@ -1426,6 +1429,7 @@ cmd_ac_init(void)
|
|
|
|
|
g_hash_table_insert(ac_funcs, "/color", _color_autocomplete);
|
|
|
|
|
g_hash_table_insert(ac_funcs, "/connect", _connect_autocomplete);
|
|
|
|
|
g_hash_table_insert(ac_funcs, "/console", _console_autocomplete);
|
|
|
|
|
g_hash_table_insert(ac_funcs, "/disco", _disco_autocomplete);
|
|
|
|
|
g_hash_table_insert(ac_funcs, "/correct", _correct_autocomplete);
|
|
|
|
|
g_hash_table_insert(ac_funcs, "/correction", _correction_autocomplete);
|
|
|
|
|
g_hash_table_insert(ac_funcs, "/executable", _executable_autocomplete);
|
|
|
|
|
@@ -1862,10 +1866,12 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gchar* history_jid_subcmds[] = { "/history verify", "/history export", "/history import" };
|
|
|
|
|
for (size_t i = 0; i < ARRAY_SIZE(history_jid_subcmds); i++) {
|
|
|
|
|
result = autocomplete_param_with_func(input, history_jid_subcmds[i], roster_barejid_autocomplete, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
if (conn_status == JABBER_CONNECTED) {
|
|
|
|
|
for (size_t i = 0; i < ARRAY_SIZE(history_jid_subcmds); i++) {
|
|
|
|
|
result = autocomplete_param_with_func(input, history_jid_subcmds[i], roster_barejid_autocomplete, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1941,7 +1947,6 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
|
|
|
|
|
Autocomplete completer;
|
|
|
|
|
} ac_cmds[] = {
|
|
|
|
|
{ "/prefs", prefs_ac },
|
|
|
|
|
{ "/disco", disco_ac },
|
|
|
|
|
{ "/room", room_ac },
|
|
|
|
|
{ "/mainwin", winpos_ac },
|
|
|
|
|
{ "/inputwin", winpos_ac },
|
|
|
|
|
@@ -1991,6 +1996,31 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
_is_connected(void)
|
|
|
|
|
{
|
|
|
|
|
return connection_get_status() == JABBER_CONNECTED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char*
|
|
|
|
|
_roster_jid_autocomplete(const char* const input, const char* const prefix, gboolean previous)
|
|
|
|
|
{
|
|
|
|
|
if (!_is_connected()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
char* result = NULL;
|
|
|
|
|
result = autocomplete_param_with_func(input, prefix, roster_contact_autocomplete, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = autocomplete_param_with_func(input, prefix, roster_barejid_autocomplete, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = autocomplete_param_with_func(input, prefix, roster_fulljid_autocomplete, previous, NULL);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char*
|
|
|
|
|
_caps_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
|
|
|
|
{
|
|
|
|
|
@@ -2006,20 +2036,29 @@ _caps_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
|
|
|
|
if (nick_ac) {
|
|
|
|
|
result = autocomplete_param_with_ac(input, "/caps", nick_ac, TRUE, previous);
|
|
|
|
|
}
|
|
|
|
|
} else if (connection_get_status() == JABBER_CONNECTED) {
|
|
|
|
|
result = autocomplete_param_with_func(input, "/caps", roster_contact_autocomplete, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = autocomplete_param_with_func(input, "/caps", roster_barejid_autocomplete, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = autocomplete_param_with_func(input, "/caps", roster_fulljid_autocomplete, previous, NULL);
|
|
|
|
|
} else {
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/caps", previous);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char*
|
|
|
|
|
_disco_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
|
|
|
|
{
|
|
|
|
|
char* result = NULL;
|
|
|
|
|
result = autocomplete_param_with_ac(input, "/disco", disco_ac, TRUE, previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/disco info", previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/disco items", previous);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char*
|
|
|
|
|
_sub_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
|
|
|
|
{
|
|
|
|
|
@@ -3698,7 +3737,7 @@ _win_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* unquoted = strip_arg_quotes(input);
|
|
|
|
|
result = autocomplete_param_with_func(unquoted, "/win", roster_contact_autocomplete, previous, NULL);
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/win", previous);
|
|
|
|
|
free(unquoted);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@@ -4032,18 +4071,14 @@ _invite_autocomplete(ProfWin* window, const char* const input, gboolean previous
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jabber_conn_status_t conn_status = connection_get_status();
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/invite send", previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conn_status == JABBER_CONNECTED) {
|
|
|
|
|
result = autocomplete_param_with_func(input, "/invite send", roster_contact_autocomplete, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = autocomplete_param_with_func(input, "/invite decline", muc_invites_find, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = autocomplete_param_with_func(input, "/invite decline", muc_invites_find, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
@@ -4059,43 +4094,38 @@ _status_autocomplete(ProfWin* window, const char* const input, gboolean previous
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jabber_conn_status_t conn_status = connection_get_status();
|
|
|
|
|
// complete with: online, away etc.
|
|
|
|
|
result = autocomplete_param_with_ac(input, "/status set", account_status_ac, TRUE, previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conn_status == JABBER_CONNECTED) {
|
|
|
|
|
// Remove quote character before and after names when doing autocomplete
|
|
|
|
|
char* unquoted = strip_arg_quotes(input);
|
|
|
|
|
|
|
|
|
|
// complete with: online, away etc.
|
|
|
|
|
result = autocomplete_param_with_ac(input, "/status set", account_status_ac, TRUE, previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove quote character before and after names when doing autocomplete
|
|
|
|
|
char* unquoted = strip_arg_quotes(input);
|
|
|
|
|
|
|
|
|
|
// MUC completion with nicknames
|
|
|
|
|
if (window->type == WIN_MUC) {
|
|
|
|
|
ProfMucWin* mucwin = (ProfMucWin*)window;
|
|
|
|
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
|
|
|
|
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
|
|
|
|
|
if (nick_ac) {
|
|
|
|
|
result = autocomplete_param_with_ac(unquoted, "/status get", nick_ac, TRUE, previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
free(unquoted);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// roster completion
|
|
|
|
|
} else {
|
|
|
|
|
result = autocomplete_param_with_func(unquoted, "/status get", roster_contact_autocomplete, previous, NULL);
|
|
|
|
|
// MUC completion with nicknames
|
|
|
|
|
if (window->type == WIN_MUC) {
|
|
|
|
|
ProfMucWin* mucwin = (ProfMucWin*)window;
|
|
|
|
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
|
|
|
|
Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid);
|
|
|
|
|
if (nick_ac) {
|
|
|
|
|
result = autocomplete_param_with_ac(unquoted, "/status get", nick_ac, TRUE, previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
free(unquoted);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(unquoted);
|
|
|
|
|
// roster completion
|
|
|
|
|
} else {
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/status get", previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
free(unquoted);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(unquoted);
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -4202,14 +4232,12 @@ _software_autocomplete(ProfWin* window, const char* const input, gboolean previo
|
|
|
|
|
{
|
|
|
|
|
char* result = NULL;
|
|
|
|
|
|
|
|
|
|
if (window->type == WIN_CHAT) {
|
|
|
|
|
if (window->type == WIN_CHAT && _is_connected()) {
|
|
|
|
|
ProfChatWin* chatwin = (ProfChatWin*)window;
|
|
|
|
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
|
|
|
|
|
|
|
|
|
GString* search_str = g_string_new("/software ");
|
|
|
|
|
g_string_append(search_str, chatwin->barejid);
|
|
|
|
|
result = autocomplete_param_with_func(search_str->str, "/software", roster_fulljid_autocomplete, previous, NULL);
|
|
|
|
|
g_string_free(search_str, TRUE);
|
|
|
|
|
auto_gchar gchar* search_str = g_strdup_printf("/software %s", chatwin->barejid);
|
|
|
|
|
result = autocomplete_param_with_func(search_str, "/software", roster_fulljid_autocomplete, previous, NULL);
|
|
|
|
|
} else if (window->type == WIN_MUC) {
|
|
|
|
|
ProfMucWin* mucwin = (ProfMucWin*)window;
|
|
|
|
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
|
|
|
|
@@ -4223,10 +4251,7 @@ _software_autocomplete(ProfWin* window, const char* const input, gboolean previo
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = autocomplete_param_with_func(input, "/software", roster_fulljid_autocomplete, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/software", previous);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
@@ -4325,16 +4350,11 @@ _lastactivity_autocomplete(ProfWin* window, const char* const input, gboolean pr
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jabber_conn_status_t conn_status = connection_get_status();
|
|
|
|
|
|
|
|
|
|
if (conn_status == JABBER_CONNECTED) {
|
|
|
|
|
|
|
|
|
|
result = autocomplete_param_with_func(input, "/lastactivity set", prefs_autocomplete_boolean_choice, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = autocomplete_param_with_func(input, "/lastactivity get", roster_barejid_autocomplete, previous, NULL);
|
|
|
|
|
result = autocomplete_param_with_func(input, "/lastactivity set", prefs_autocomplete_boolean_choice, previous, NULL);
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/lastactivity get", previous);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@@ -4514,19 +4534,19 @@ _vcard_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
|
|
|
|
} else {
|
|
|
|
|
char* unquoted = strip_arg_quotes(input);
|
|
|
|
|
|
|
|
|
|
result = autocomplete_param_with_func(unquoted, "/vcard get", roster_contact_autocomplete, previous, NULL);
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/vcard get", previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
free(unquoted);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = autocomplete_param_with_func(unquoted, "/vcard photo open", roster_contact_autocomplete, previous, NULL);
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/vcard photo open", previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
free(unquoted);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = autocomplete_param_with_func(unquoted, "/vcard photo save", roster_contact_autocomplete, previous, NULL);
|
|
|
|
|
result = _roster_jid_autocomplete(input, "/vcard photo save", previous);
|
|
|
|
|
if (result) {
|
|
|
|
|
free(unquoted);
|
|
|
|
|
return result;
|
|
|
|
|
|