mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added /inpblock command
This commit is contained in:
parent
79d4cbe967
commit
13f73a30e7
@ -617,6 +617,17 @@ static struct cmd_t command_defs[] =
|
||||
"Configure time precision for the main window.",
|
||||
NULL } } },
|
||||
|
||||
{ "/inpblock",
|
||||
cmd_inpblock, parse_args, 1, 1, &cons_inpblock_setting,
|
||||
{ "/inpblock millis", "Input blocking delay.",
|
||||
{ "/inpblock millis",
|
||||
"----------------",
|
||||
"Time to wait in milliseconds before reading input from the terminal buffer, defaults to 20.",
|
||||
"Valid values are 1-1000.",
|
||||
"A higher value will result in less CPU usage, but a noticable delay for response to input.",
|
||||
"A lower value will result in higher CPU usage, but faster response to input.",
|
||||
NULL } } },
|
||||
|
||||
{ "/notify",
|
||||
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
|
||||
{ "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
|
||||
|
@ -3395,6 +3395,19 @@ cmd_notify(gchar **args, struct cmd_help_t help)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_inpblock(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
char *value = args[0];
|
||||
int intval;
|
||||
if (_strtoi(value, &intval, 1, 1000) == 0) {
|
||||
cons_show("Input blocking set to %d milliseconds.", intval);
|
||||
prefs_set_inpblock(intval);
|
||||
ui_input_nonblocking();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_log(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
|
@ -136,6 +136,7 @@ gboolean cmd_presence(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_wrap(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_time(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_resource(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_inpblock(gchar **args, struct cmd_help_t help);
|
||||
|
||||
gboolean cmd_form_field(char *tag, gchar **args);
|
||||
|
||||
|
@ -61,6 +61,8 @@
|
||||
#define PREF_GROUP_ALIAS "alias"
|
||||
#define PREF_GROUP_OTR "otr"
|
||||
|
||||
#define INPBLOCK_DEFAULT 20
|
||||
|
||||
static gchar *prefs_loc;
|
||||
static GKeyFile *prefs;
|
||||
gint log_maxsize = 0;
|
||||
@ -261,6 +263,22 @@ prefs_set_max_log_size(gint value)
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
gint prefs_get_inpblock(void)
|
||||
{
|
||||
int val = g_key_file_get_integer(prefs, PREF_GROUP_UI, "inpblock", NULL);
|
||||
if (val == 0) {
|
||||
return INPBLOCK_DEFAULT;
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
void prefs_set_inpblock(gint value)
|
||||
{
|
||||
g_key_file_set_integer(prefs, PREF_GROUP_UI, "inpblock", value);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
gint
|
||||
prefs_get_priority(void)
|
||||
{
|
||||
|
@ -123,6 +123,8 @@ void prefs_set_reconnect(gint value);
|
||||
gint prefs_get_reconnect(void);
|
||||
void prefs_set_autoping(gint value);
|
||||
gint prefs_get_autoping(void);
|
||||
gint prefs_get_inpblock(void);
|
||||
void prefs_set_inpblock(gint value);
|
||||
|
||||
void prefs_set_occupants_size(gint value);
|
||||
gint prefs_get_occupants_size(void);
|
||||
|
@ -999,6 +999,7 @@ _cons_show_ui_prefs(void)
|
||||
cons_privileges_setting();
|
||||
cons_titlebar_setting();
|
||||
cons_presence_setting();
|
||||
cons_inpblock_setting();
|
||||
|
||||
cons_alert();
|
||||
}
|
||||
@ -1159,6 +1160,12 @@ _cons_show_chat_prefs(void)
|
||||
cons_alert();
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_inpblock_setting(void)
|
||||
{
|
||||
cons_show("Input block (/inpblock) : %d milliseconds", prefs_get_inpblock());
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_log_setting(void)
|
||||
{
|
||||
@ -1677,6 +1684,7 @@ console_init_module(void)
|
||||
cons_reconnect_setting = _cons_reconnect_setting;
|
||||
cons_autoping_setting = _cons_autoping_setting;
|
||||
cons_priority_setting = _cons_priority_setting;
|
||||
cons_inpblock_setting = _cons_inpblock_setting;
|
||||
cons_show_connection_prefs = _cons_show_connection_prefs;
|
||||
cons_show_themes = _cons_show_themes;
|
||||
cons_prefs = _cons_prefs;
|
||||
|
@ -112,7 +112,7 @@ inp_win_resize(void)
|
||||
void
|
||||
inp_non_block(void)
|
||||
{
|
||||
wtimeout(inp_win, 20);
|
||||
wtimeout(inp_win, prefs_get_inpblock());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -322,6 +322,7 @@ void (*cons_reconnect_setting)(void);
|
||||
void (*cons_autoping_setting)(void);
|
||||
void (*cons_priority_setting)(void);
|
||||
void (*cons_autoconnect_setting)(void);
|
||||
void (*cons_inpblock_setting)(void);
|
||||
void (*cons_show_contact_online)(PContact contact, Resource *resource, GDateTime *last_activity);
|
||||
void (*cons_show_contact_offline)(PContact contact, char *resource, char *status);
|
||||
void (*cons_theme_colours)(void);
|
||||
|
Loading…
Reference in New Issue
Block a user