mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge branch 'master' of github.com:toddpratt/irssi
This commit is contained in:
commit
4f8974f66e
@ -22,5 +22,5 @@ install: true
|
|||||||
script:
|
script:
|
||||||
- ./autogen.sh --with-proxy --with-bot --with-perl=module --prefix=$HOME/irssi-build
|
- ./autogen.sh --with-proxy --with-bot --with-perl=module --prefix=$HOME/irssi-build
|
||||||
- cat config.log
|
- cat config.log
|
||||||
- make
|
- make CFLAGS="-Wall -Werror"
|
||||||
- make install
|
- make install
|
||||||
|
@ -59,7 +59,7 @@ static SETTINGS_REC *settings_get(const char *key, SettingType type)
|
|||||||
g_warning("settings_get(%s) : not found", key);
|
g_warning("settings_get(%s) : not found", key);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (type != -1 && rec->type != type) {
|
if (type != SETTING_TYPE_ANY && rec->type != type) {
|
||||||
g_warning("settings_get(%s) : invalid type", key);
|
g_warning("settings_get(%s) : invalid type", key);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ settings_get_str_type(const char *key, SettingType type)
|
|||||||
|
|
||||||
const char *settings_get_str(const char *key)
|
const char *settings_get_str(const char *key)
|
||||||
{
|
{
|
||||||
return settings_get_str_type(key, -1);
|
return settings_get_str_type(key, SETTING_TYPE_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
int settings_get_int(const char *key)
|
int settings_get_int(const char *key)
|
||||||
@ -163,6 +163,7 @@ char *settings_get_print(SETTINGS_REC *rec)
|
|||||||
case SETTING_TYPE_TIME:
|
case SETTING_TYPE_TIME:
|
||||||
case SETTING_TYPE_LEVEL:
|
case SETTING_TYPE_LEVEL:
|
||||||
case SETTING_TYPE_SIZE:
|
case SETTING_TYPE_SIZE:
|
||||||
|
case SETTING_TYPE_ANY:
|
||||||
value = g_strdup(settings_get_str(rec->key));
|
value = g_strdup(settings_get_str(rec->key));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -380,10 +381,10 @@ SettingType settings_get_type(const char *key)
|
|||||||
{
|
{
|
||||||
SETTINGS_REC *rec;
|
SETTINGS_REC *rec;
|
||||||
|
|
||||||
g_return_val_if_fail(key != NULL, -1);
|
g_return_val_if_fail(key != NULL, SETTING_TYPE_ANY);
|
||||||
|
|
||||||
rec = g_hash_table_lookup(settings, key);
|
rec = g_hash_table_lookup(settings, key);
|
||||||
return rec == NULL ? -1 : rec->type;
|
return rec == NULL ? SETTING_TYPE_ANY : rec->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the record of the setting */
|
/* Get the record of the setting */
|
||||||
|
@ -7,7 +7,8 @@ typedef enum {
|
|||||||
SETTING_TYPE_BOOLEAN,
|
SETTING_TYPE_BOOLEAN,
|
||||||
SETTING_TYPE_TIME,
|
SETTING_TYPE_TIME,
|
||||||
SETTING_TYPE_LEVEL,
|
SETTING_TYPE_LEVEL,
|
||||||
SETTING_TYPE_SIZE
|
SETTING_TYPE_SIZE,
|
||||||
|
SETTING_TYPE_ANY
|
||||||
} SettingType;
|
} SettingType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -362,8 +362,7 @@ static GList *completion_get_settings(const char *key, SettingType type)
|
|||||||
for (tmp = sets; tmp != NULL; tmp = tmp->next) {
|
for (tmp = sets; tmp != NULL; tmp = tmp->next) {
|
||||||
SETTINGS_REC *rec = tmp->data;
|
SETTINGS_REC *rec = tmp->data;
|
||||||
|
|
||||||
if ((type == -1 || rec->type == type) &&
|
if ((type == SETTING_TYPE_ANY || rec->type == type) && g_ascii_strncasecmp(rec->key, key, len) == 0)
|
||||||
g_ascii_strncasecmp(rec->key, key, len) == 0)
|
|
||||||
complist = g_list_insert_sorted(complist, g_strdup(rec->key), (GCompareFunc) g_istr_cmp);
|
complist = g_list_insert_sorted(complist, g_strdup(rec->key), (GCompareFunc) g_istr_cmp);
|
||||||
}
|
}
|
||||||
g_slist_free(sets);
|
g_slist_free(sets);
|
||||||
@ -682,7 +681,7 @@ static void sig_complete_set(GList **list, WINDOW_REC *window,
|
|||||||
|
|
||||||
if (*line == '\0' ||
|
if (*line == '\0' ||
|
||||||
!g_strcmp0("-clear", line) || !g_strcmp0("-default", line))
|
!g_strcmp0("-clear", line) || !g_strcmp0("-default", line))
|
||||||
*list = completion_get_settings(word, -1);
|
*list = completion_get_settings(word, SETTING_TYPE_ANY);
|
||||||
else if (*line != '\0' && *word == '\0') {
|
else if (*line != '\0' && *word == '\0') {
|
||||||
SETTINGS_REC *rec = settings_get_record(line);
|
SETTINGS_REC *rec = settings_get_record(line);
|
||||||
if (rec != NULL) {
|
if (rec != NULL) {
|
||||||
|
@ -126,7 +126,7 @@ static void cmd_set(char *data)
|
|||||||
/* change the setting */
|
/* change the setting */
|
||||||
switch (rec->type) {
|
switch (rec->type) {
|
||||||
case SETTING_TYPE_BOOLEAN:
|
case SETTING_TYPE_BOOLEAN:
|
||||||
if (clear)
|
if (clear)
|
||||||
settings_set_bool(key, FALSE);
|
settings_set_bool(key, FALSE);
|
||||||
else if (set_default)
|
else if (set_default)
|
||||||
settings_set_bool(key, rec->default_value.v_bool);
|
settings_set_bool(key, rec->default_value.v_bool);
|
||||||
@ -149,32 +149,30 @@ static void cmd_set(char *data)
|
|||||||
case SETTING_TYPE_TIME:
|
case SETTING_TYPE_TIME:
|
||||||
if (!settings_set_time(key, clear ? "0" :
|
if (!settings_set_time(key, clear ? "0" :
|
||||||
set_default ? rec->default_value.v_string : value))
|
set_default ? rec->default_value.v_string : value))
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
|
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_TIME);
|
||||||
TXT_INVALID_TIME);
|
|
||||||
break;
|
break;
|
||||||
case SETTING_TYPE_LEVEL:
|
case SETTING_TYPE_LEVEL:
|
||||||
if (!settings_set_level(key, clear ? "" :
|
if (!settings_set_level(key, clear ? "" :
|
||||||
set_default ? rec->default_value.v_string : value))
|
set_default ? rec->default_value.v_string : value))
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
|
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_LEVEL);
|
||||||
TXT_INVALID_LEVEL);
|
|
||||||
break;
|
break;
|
||||||
case SETTING_TYPE_SIZE:
|
case SETTING_TYPE_SIZE:
|
||||||
if (!settings_set_size(key, clear ? "0" :
|
if (!settings_set_size(key, clear ? "0" :
|
||||||
set_default ? rec->default_value.v_string : value))
|
set_default ? rec->default_value.v_string : value))
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
|
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_SIZE);
|
||||||
TXT_INVALID_SIZE);
|
break;
|
||||||
|
case SETTING_TYPE_ANY:
|
||||||
|
/* Unpossible! */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
signal_emit("setup changed", 0);
|
signal_emit("setup changed", 0);
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP,
|
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_SET_TITLE, rec->section);
|
||||||
TXT_SET_TITLE, rec->section);
|
|
||||||
set_print(rec);
|
set_print(rec);
|
||||||
} else
|
} else
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
|
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key);
|
||||||
TXT_SET_UNKNOWN, key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_params_free(free_arg);
|
cmd_params_free(free_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SYNTAX: TOGGLE <key> [on|off|toggle] */
|
/* SYNTAX: TOGGLE <key> [on|off|toggle] */
|
||||||
@ -187,20 +185,21 @@ static void cmd_toggle(const char *data)
|
|||||||
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &key, &value))
|
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &key, &value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (*key == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
if (*key == '\0')
|
||||||
|
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||||
|
|
||||||
type = settings_get_type(key);
|
type = settings_get_type(key);
|
||||||
if (type == -1)
|
if (type == SETTING_TYPE_ANY)
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key);
|
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key);
|
||||||
else if (type != SETTING_TYPE_BOOLEAN)
|
else if (type != SETTING_TYPE_BOOLEAN)
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_NOT_BOOLEAN, key);
|
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_NOT_BOOLEAN, key);
|
||||||
else {
|
else {
|
||||||
set_boolean(key, *value != '\0' ? value : "TOGGLE");
|
set_boolean(key, *value != '\0' ? value : "TOGGLE");
|
||||||
set_print(settings_get_record(key));
|
set_print(settings_get_record(key));
|
||||||
signal_emit("setup changed", 0);
|
signal_emit("setup changed", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_params_free(free_arg);
|
cmd_params_free(free_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_key_compare(CONFIG_NODE *node1, CONFIG_NODE *node2)
|
static int config_key_compare(CONFIG_NODE *node1, CONFIG_NODE *node2)
|
||||||
|
@ -35,21 +35,21 @@ static unichar i_toupper(unichar c)
|
|||||||
{
|
{
|
||||||
if (term_type == TERM_TYPE_UTF8)
|
if (term_type == TERM_TYPE_UTF8)
|
||||||
return g_unichar_toupper(c);
|
return g_unichar_toupper(c);
|
||||||
return (c >= 0 && c <= 255) ? toupper(c) : c;
|
return c <= 255 ? toupper(c) : c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unichar i_tolower(unichar c)
|
static unichar i_tolower(unichar c)
|
||||||
{
|
{
|
||||||
if (term_type == TERM_TYPE_UTF8)
|
if (term_type == TERM_TYPE_UTF8)
|
||||||
return g_unichar_tolower(c);
|
return g_unichar_tolower(c);
|
||||||
return (c >= 0 && c <= 255) ? tolower(c) : c;
|
return c <= 255 ? tolower(c) : c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int i_isalnum(unichar c)
|
static int i_isalnum(unichar c)
|
||||||
{
|
{
|
||||||
if (term_type == TERM_TYPE_UTF8)
|
if (term_type == TERM_TYPE_UTF8)
|
||||||
return (g_unichar_isalnum(c) || mk_wcwidth(c) == 0);
|
return (g_unichar_isalnum(c) || mk_wcwidth(c) == 0);
|
||||||
return (c >= 0 && c <= 255) ? isalnum(c) : 0;
|
return c <= 255 ? isalnum(c) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI_ENTRY_REC *active_entry;
|
GUI_ENTRY_REC *active_entry;
|
||||||
|
@ -1023,6 +1023,8 @@ void gui_readline_init(void)
|
|||||||
key_bind("key", NULL, "meta2-5F", "cend", (SIGNAL_FUNC) key_combo);
|
key_bind("key", NULL, "meta2-5F", "cend", (SIGNAL_FUNC) key_combo);
|
||||||
key_bind("key", NULL, "meta2-1;5F", "cend", (SIGNAL_FUNC) key_combo);
|
key_bind("key", NULL, "meta2-1;5F", "cend", (SIGNAL_FUNC) key_combo);
|
||||||
|
|
||||||
|
key_bind("key", NULL, "meta-O-M", "return", (SIGNAL_FUNC) key_combo);
|
||||||
|
|
||||||
/* cursor movement */
|
/* cursor movement */
|
||||||
key_bind("backward_character", "Move the cursor a character backward", "left", NULL, (SIGNAL_FUNC) key_backward_character);
|
key_bind("backward_character", "Move the cursor a character backward", "left", NULL, (SIGNAL_FUNC) key_backward_character);
|
||||||
key_bind("forward_character", "Move the cursor a character forward", "right", NULL, (SIGNAL_FUNC) key_forward_character);
|
key_bind("forward_character", "Move the cursor a character forward", "right", NULL, (SIGNAL_FUNC) key_forward_character);
|
||||||
|
Loading…
Reference in New Issue
Block a user