1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

Merge tag '1.4.0-an' into HEAD

This commit is contained in:
Ailin Nemui 2022-05-31 10:20:57 +02:00
commit a558430a0a
35 changed files with 559 additions and 154 deletions

21
NEWS
View File

@ -1,4 +1,23 @@
v1.3.2 2022-xx-xx The Irssi team <staff@irssi.org>
v1.4.0 2022-xx-xx The Irssi team <staff@irssi.org>
* Format the output of /QUOTE HELP (#1371, an#82). By Val
Lorentz. Add /SHELP as default alias (an#83)
+ GLib log message filter: /SET glib_log_domains (an#50,
an#59). By Andrej Kacian
+ An option to clear the cutbuffer:
/SET empty_kill_clears_cutbuffer (an#58). By Mikael
Magnusson
+ Scriptable pastebin (an#60)
+ Configurable actlist separator: /SET actlist_separator
(#1364, an#61)
- Fix window left/right not skipping visible windows
(an#57). By Mikael Magnusson
- Fix wrong printf-format on OpenBSD (an#66, an#68). Reported
by Aaron Bieber
- Fix erroneous output produced by autoload_modules (an#72)
- Fix scroll_page_count setting with `.' (#1365, an#76)
- Fix memory leak in /IGNORE (#1373, an#84). Found by Jookia
- Misc fixes (an#45, an#67, an#70, #1368, an#77)
- CHANTYPES take precedence over (missing) STATUSMSG in /join
(#1358, an#54)
- Fix crash in Perl's $view->set_bookmark (freebsd#254237,

View File

@ -11,7 +11,7 @@ built in, and there are third party
[Quassel](https://github.com/phhusson/quassel-irssi) protocol modules
available.
![irssi](https://user-images.githubusercontent.com/5665186/32180643-cf127f60-bd92-11e7-8aa2-882313ce1d8e.png)
![irssi](https://user-images.githubusercontent.com/5665186/154820868-50c35841-04f4-4f4c-8df9-dd5aa4bbcde8.png)
## [Download information](https://irssi.org/download/)

View File

@ -1,4 +1,4 @@
AC_INIT(irssi, 1.3.2)
AC_INIT(irssi, 1.4.0)
AC_CONFIG_SRCDIR([src])
AC_CONFIG_AUX_DIR(build-aux)
AC_PREREQ(2.50)

View File

@ -14,6 +14,8 @@
-network: Ignores only on a specific network.
-channels: Ignores only on specific channels.
-time: The timeout to automatically remove the ignore.
Accepts units specified in days, hours, minutes, seconds,
milliseconds, or no unit for seconds.
The mask, channels and levels to ignore; if no argument is provided, the
list of ignores will be displayed.
@ -44,6 +46,8 @@
/IGNORE #irssi NO_ACT JOINS PARTS QUITS
/IGNORE mike NO_ACT -MSGS
/IGNORE mike HIDDEN PUBLIC JOINS PARTS QUITS
/IGNORE -time 5days christmas PUBLICS
/IGNORE -time 300 mike PUBLICS
%9See also:%9 ACCEPT, SILENCE, UNIGNORE

View File

@ -351,6 +351,7 @@ Text FE
gui-readline.c:
"gui key pressed", int key
"paste event", char *paste, char *arg
gui-printtext.c:
"beep"

View File

@ -147,6 +147,7 @@ aliases = {
SAY = "MSG *";
SB = "SCROLLBACK";
SBAR = "STATUSBAR";
SHELP = "QUOTE HELP";
SIGNOFF = "QUIT";
SV = "MSG * Irssi $J ($V) - https://irssi.org";
T = "TOPIC";

View File

@ -1,5 +1,5 @@
project('irssi', 'c',
version : '1.3.2',
version : '1.4.0',
meson_version : '>=0.49',
default_options : ['warning_level=1'])

View File

@ -6,7 +6,7 @@
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
#define IRSSI_ABI_VERSION 41
#define IRSSI_ABI_VERSION 46
#define DEFAULT_SERVER_ADD_PORT 6667
#define DEFAULT_SERVER_ADD_TLS_PORT 6697

View File

@ -490,6 +490,11 @@ static void read_ignores(void)
nickmatch_rebuild(nickmatch);
}
static void free_cache_matches(GSList *matches)
{
g_slist_free(matches);
}
static void ignore_nick_cache(GHashTable *list, CHANNEL_REC *channel,
NICK_REC *nick)
{
@ -520,7 +525,7 @@ static void ignore_nick_cache(GHashTable *list, CHANNEL_REC *channel,
void ignore_init(void)
{
ignores = NULL;
nickmatch = nickmatch_init(ignore_nick_cache);
nickmatch = nickmatch_init(ignore_nick_cache, (GDestroyNotify) free_cache_matches);
time_tag = g_timeout_add(1000, (GSourceFunc) unignore_timeout, NULL);
read_ignores();

View File

@ -28,12 +28,13 @@
static GSList *lists;
NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func)
NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func, GDestroyNotify value_destroy_func)
{
NICKMATCH_REC *rec;
rec = g_new0(NICKMATCH_REC, 1);
rec->func = func;
rec->value_destroy_func = value_destroy_func;
lists = g_slist_append(lists, rec);
return rec;
@ -43,8 +44,9 @@ void nickmatch_deinit(NICKMATCH_REC *rec)
{
lists = g_slist_remove(lists, rec);
g_hash_table_destroy(rec->nicks);
g_free(rec);
if (rec->nicks != NULL)
g_hash_table_destroy(rec->nicks);
g_free(rec);
}
static void nickmatch_check_channel(CHANNEL_REC *channel, NICKMATCH_REC *rec)
@ -65,8 +67,8 @@ void nickmatch_rebuild(NICKMATCH_REC *rec)
if (rec->nicks != NULL)
g_hash_table_destroy(rec->nicks);
rec->nicks = g_hash_table_new((GHashFunc) g_direct_hash,
(GCompareFunc) g_direct_equal);
rec->nicks = g_hash_table_new_full((GHashFunc) g_direct_hash, (GCompareFunc) g_direct_equal,
NULL, (GDestroyNotify) rec->value_destroy_func);
g_slist_foreach(channels, (GFunc) nickmatch_check_channel, rec);
}

View File

@ -7,9 +7,10 @@ typedef void (*NICKMATCH_REBUILD_FUNC) (GHashTable *list,
typedef struct {
GHashTable *nicks;
NICKMATCH_REBUILD_FUNC func;
GDestroyNotify value_destroy_func;
} NICKMATCH_REC;
NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func);
NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func, GDestroyNotify value_destroy_func);
void nickmatch_deinit(NICKMATCH_REC *rec);
/* Calls rebuild function for all nicks in all channels.

View File

@ -928,6 +928,7 @@ void settings_deinit(void)
g_hash_table_foreach(settings, (GHFunc) settings_hash_free, NULL);
g_hash_table_destroy(settings);
settings = NULL;
if (mainconfig != NULL) config_close(mainconfig);
}

View File

@ -57,6 +57,7 @@ static int autocon_port;
static int no_autoconnect;
static char *cmdline_nick;
static char *cmdline_hostname;
GLogFunc logger_old;
void fe_core_log_init(void);
void fe_core_log_deinit(void);
@ -165,6 +166,7 @@ void fe_common_core_init(void)
settings_add_bool("lookandfeel", "use_msgs_window", FALSE);
g_get_charset(&str);
settings_add_str("lookandfeel", "term_charset", str);
settings_add_str("lookandfeel", "glib_log_domains", "all");
themes_init();
theme_register(fecommon_core_formats);
@ -252,11 +254,58 @@ void fe_common_core_deinit(void)
signal_remove("server destroyed", (SIGNAL_FUNC) sig_destroyed);
signal_remove("channel created", (SIGNAL_FUNC) sig_channel_created);
signal_remove("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
g_log_set_default_handler(logger_old, NULL);
}
void i_log_func(const char *log_domain, GLogLevelFlags log_level, const char *message)
static gboolean glib_domain_wanted(const char *domain)
{
const char *reason;
const char *domains;
char *c, *cur;
int len = 0;
int print_it = 0; /* -1 for exclude, 0 for undecided, 1 for include */
int incl;
/* Go through each item in glib_log_domains setting to determine whether
* or not we want to print message from this domain */
domains = settings_get_str("glib_log_domains");
c = cur = (char *) domains;
do {
/* Advance through the string until we hit a space or the end */
while (*cur != '\0' && *cur != ' ') {
cur++;
len++;
}
/* Handle '-' prefix */
incl = 1;
if (*c == '-') {
incl = -1;
c++;
len--;
}
/* If we got a valid item, process it */
if (len > 0 && (!strncmp(domain, c, len) || !strncasecmp("all", c, len) ||
!strncmp("*", c, len)))
print_it = incl;
/* Go past any spaces towards the next item */
while (*cur == ' ')
cur++;
/* Move on beyond the item we just handled */
c = cur;
len = 0;
} while (*c != '\0' && print_it != -1);
return (print_it == 1);
}
static void i_log_func(const char *log_domain, GLogLevelFlags log_level, const char *message)
{
const char *reason, *domain;
switch (log_level) {
case G_LOG_LEVEL_WARNING:
@ -265,16 +314,33 @@ void i_log_func(const char *log_domain, GLogLevelFlags log_level, const char *me
case G_LOG_LEVEL_CRITICAL:
reason = "critical";
break;
case G_LOG_LEVEL_DEBUG:
reason = "debug";
break;
case G_LOG_LEVEL_MESSAGE:
reason = "message";
break;
case G_LOG_LEVEL_INFO:
reason = "info";
break;
default:
reason = "error";
break;
}
/* If log_domain parameter is NULL, GLib means to tell us that this is
* meant to be some nebulous "default" log domain name. */
domain = (log_domain ? log_domain : "default");
/* Only print the message if we decided to */
if (!glib_domain_wanted(domain))
return;
if (windows == NULL)
fprintf(stderr, "GLib %s: %s\n", reason, message);
fprintf(stderr, "GLib (%s) %s: %s\n", domain, reason, message);
else {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_GLIB_ERROR, reason, message);
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_GLIB_ERROR, domain, reason,
message);
}
}
@ -458,7 +524,7 @@ void fe_common_core_finish_init(void)
signal_add_first("setup changed", (SIGNAL_FUNC) sig_setup_changed);
/* _after_ windows are created.. */
g_log_set_default_handler((GLogFunc) i_log_func, NULL);
logger_old = g_log_set_default_handler((GLogFunc) i_log_func, NULL);
if (setup_changed)
signal_emit("setup changed", 0);

View File

@ -115,9 +115,9 @@ static void cmd_ignore_show(void)
}
/* SYNTAX: IGNORE [-regexp | -full] [-pattern <pattern>] [-except] [-replies]
[-network <network>] [-channels <channel>] [-time <secs>] <mask> [<levels>]
[-network <network>] [-channels <channel>] [-time <time>] <mask> [<levels>]
IGNORE [-regexp | -full] [-pattern <pattern>] [-except] [-replies]
[-network <network>] [-time <secs>] <channels> [<levels>] */
[-network <network>] [-time <time>] <channels> [<levels>] */
/* NOTE: -network replaces the old -ircnet flag. */
static void cmd_ignore(const char *data)
{

View File

@ -164,7 +164,7 @@ static void module_prefixes_free(char **list)
g_free(list);
}
/* SYNTAX: LOAD <module> [<submodule>] */
/* SYNTAX: LOAD [-silent] <module> [<submodule>] */
static void cmd_load(const char *data)
{
char *rootmodule, *submodule;
@ -181,9 +181,11 @@ static void cmd_load(const char *data)
silent = g_hash_table_lookup(optlist, "silent") != NULL;
if (*rootmodule == '\0')
cmd_load_list();
else {
if (*rootmodule == '\0') {
if (!silent) {
cmd_load_list();
}
} else {
if (silent) {
signal_add_first("module error", (SIGNAL_FUNC) signal_stop);
signal_add_first("module loaded", (SIGNAL_FUNC) signal_stop);

View File

@ -793,7 +793,7 @@ void hilight_text_init(void)
read_settings();
nickmatch = nickmatch_init(hilight_nick_cache);
nickmatch = nickmatch_init(hilight_nick_cache, NULL);
read_hilight_config();
signal_add_first("print text", (SIGNAL_FUNC) sig_print_text);

View File

@ -288,7 +288,7 @@ FORMAT_REC fecommon_core_formats[] = {
{ "config_saved", "Saved configuration to file $0", 1, { 0 } },
{ "config_reloaded", "Reloaded configuration", 1, { 0 } },
{ "config_modified", "Configuration file was modified since irssi was last started - do you want to overwrite the possible changes?", 1, { 0 } },
{ "glib_error", "{error $0} $1", 2, { 0, 0 } },
{ "glib_error", "{error ($0) $1} $2", 3, { 0, 0, 0 } },
{ "overwrite_config", "Overwrite config (y/N)?", 0 },
{ "set_title", "[{hilight $0}]", 1, { 0 } },
{ "set_item", "$[-!32]0 %_$1", 2, { 0, 0 } },

View File

@ -128,7 +128,10 @@ static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data,
g_return_if_fail(data != NULL);
if (sscanf(data, "%ld %ld", &tv, &tv2) < 1) {
if (sscanf(data,
"%" G_GINT64_FORMAT " "
"%" G_GINT64_FORMAT,
&tv, &tv2) < 1) {
char *tmp = g_strconcat("PING ", data, NULL);
ctcp_default_reply(server, tmp, nick, addr, target);
g_free(tmp);

View File

@ -554,6 +554,51 @@ static void event_489(IRC_SERVER_REC *server, const char *data, const char *nick
g_free(params);
}
static void event_help(IRC_SERVER_REC *server, int formatnum, const char *data)
{
/* Common handling for umerics 704 (RPL_HELPSTART), 705 (RPL_HELPTXT),
* and 706 (RPL_ENDOFHELP); sent as a reply to HELP or HELPOP command.
*/
char *params, *topic, *help_text;
g_return_if_fail(data != NULL);
params = event_get_params(data, 3, NULL, &topic, &help_text);
g_return_if_fail(help_text != NULL);
if (help_text[0] == '\0') {
/* Empty lines can be used by servers for styling; and we need to replace
* them with something non-empty or they would be dropped when displayed.
*/
help_text = " ";
}
printformat(server, NULL, MSGLEVEL_CRAP, formatnum, topic, help_text);
g_free(params);
}
static void event_helpstart(IRC_SERVER_REC *server, const char *data, const char *nick)
{
/* Numeric 704 (RPL_HELPSTART) sent as a reply to HELP or HELPOP command.
*/
event_help(server, IRCTXT_SERVER_HELP_START, data);
}
static void event_helptxt(IRC_SERVER_REC *server, const char *data, const char *nick)
{
/* Numeric 705 (RPL_HELPTXT), sent as a reply to HELP or HELPOP command.
*/
event_help(server, IRCTXT_SERVER_HELP_TXT, data);
}
static void event_endofhelp(IRC_SERVER_REC *server, const char *data, const char *nick)
{
/* Numeric 706 (RPL_ENDOFHELP), sent as a reply to HELP or HELPOP command.
*/
event_help(server, IRCTXT_SERVER_END_OF_HELP, data);
}
static void event_target_too_fast(IRC_SERVER_REC *server, const char *data,
const char *nick)
{
@ -713,6 +758,9 @@ void fe_events_numeric_init(void)
signal_add("event 372", (SIGNAL_FUNC) event_motd);
signal_add("event 422", (SIGNAL_FUNC) event_motd);
signal_add("event 439", (SIGNAL_FUNC) event_target_too_fast);
signal_add("event 704", (SIGNAL_FUNC) event_helpstart);
signal_add("event 705", (SIGNAL_FUNC) event_helptxt);
signal_add("event 706", (SIGNAL_FUNC) event_endofhelp);
signal_add("event 707", (SIGNAL_FUNC) event_target_too_fast);
signal_add("default event numeric", (SIGNAL_FUNC) event_numeric);
@ -808,6 +856,9 @@ void fe_events_numeric_deinit(void)
signal_remove("event 372", (SIGNAL_FUNC) event_motd);
signal_remove("event 422", (SIGNAL_FUNC) event_motd);
signal_remove("event 439", (SIGNAL_FUNC) event_target_too_fast);
signal_remove("event 704", (SIGNAL_FUNC) event_helpstart);
signal_remove("event 705", (SIGNAL_FUNC) event_helptxt);
signal_remove("event 706", (SIGNAL_FUNC) event_endofhelp);
signal_remove("event 707", (SIGNAL_FUNC) event_target_too_fast);
signal_remove("default event numeric", (SIGNAL_FUNC) event_numeric);

View File

@ -89,6 +89,9 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } },
{ "no_such_channel", "{channel $0}: No such channel", 1, { 0 } },
{ "channel_synced", "Join to {channel $0} was synced in {hilight $1} secs", 2, { 0, 2 } },
{ "server_help_start", "$1", 2, { 0, 0 } },
{ "server_help_txt", "$1", 2, { 0, 0 } },
{ "server_end_of_help", "$1", 2, { 0, 0 } },
/* ---- */
{ NULL, "Nick", 0 },

View File

@ -66,6 +66,9 @@ enum {
IRCTXT_INVITELIST_LONG,
IRCTXT_NO_SUCH_CHANNEL,
IRCTXT_CHANNEL_SYNCED,
IRCTXT_SERVER_HELP_START,
IRCTXT_SERVER_HELP_TXT,
IRCTXT_SERVER_END_OF_HELP,
IRCTXT_FILL_4,
@ -89,7 +92,7 @@ enum {
IRCTXT_WHOIS_OPER,
IRCTXT_WHOIS_MODES,
IRCTXT_WHOIS_REALHOST,
IRCTXT_WHOIS_USERMODE,
IRCTXT_WHOIS_USERMODE,
IRCTXT_WHOIS_CHANNELS,
IRCTXT_WHOIS_AWAY,
IRCTXT_WHOIS_SPECIAL,
@ -143,7 +146,7 @@ enum {
IRCTXT_SILENCED,
IRCTXT_UNSILENCED,
IRCTXT_SILENCE_LINE,
IRCTXT_ASK_OPER_PASS,
IRCTXT_ASK_OPER_PASS,
IRCTXT_ACCEPT_LIST
};
/* clang-format on */

View File

@ -20,6 +20,7 @@
#include "module.h"
#include <irssi/src/core/misc.h>
#include <irssi/src/core/settings.h>
#include <irssi/src/core/utf8.h>
#include <irssi/src/fe-common/core/formats.h>
@ -772,11 +773,13 @@ static GUI_ENTRY_CUTBUFFER_REC *get_cutbuffer_rec(GUI_ENTRY_REC *entry, CUTBUFFE
void gui_entry_erase(GUI_ENTRY_REC *entry, int size, CUTBUFFER_UPDATE_OP update_cutbuffer)
{
gboolean clear_enabled;
size_t i, w = 0;
g_return_if_fail(entry != NULL);
clear_enabled = settings_get_bool("empty_kill_clears_cutbuffer");
if (size == 0 || entry->pos < size)
if (entry->pos < size || (size == 0 && !clear_enabled))
return;
if (update_cutbuffer != CUTBUFFER_UPDATE_NOOP) {
@ -792,48 +795,53 @@ void gui_entry_erase(GUI_ENTRY_REC *entry, int size, CUTBUFFER_UPDATE_OP update_
tmpcutbuffer = tmp->cutbuffer;
entry->append_next_kill = TRUE;
switch (update_cutbuffer) {
case CUTBUFFER_UPDATE_APPEND:
tmp->cutbuffer = g_new(unichar, cutbuffer_new_size+1);
memcpy(tmp->cutbuffer, tmpcutbuffer,
tmp->cutbuffer_len * sizeof(unichar));
memcpy(tmp->cutbuffer + tmp->cutbuffer_len,
entry->text + entry->pos - size, size * sizeof(unichar));
case CUTBUFFER_UPDATE_APPEND:
tmp->cutbuffer = g_new(unichar, cutbuffer_new_size + 1);
memcpy(tmp->cutbuffer, tmpcutbuffer, tmp->cutbuffer_len * sizeof(unichar));
memcpy(tmp->cutbuffer + tmp->cutbuffer_len, entry->text + entry->pos - size,
size * sizeof(unichar));
tmp->cutbuffer_len = cutbuffer_new_size;
tmp->cutbuffer[cutbuffer_new_size] = '\0';
g_free(tmpcutbuffer);
break;
tmp->cutbuffer_len = cutbuffer_new_size;
tmp->cutbuffer[cutbuffer_new_size] = '\0';
g_free(tmpcutbuffer);
break;
case CUTBUFFER_UPDATE_PREPEND:
tmp->cutbuffer = g_new(unichar, cutbuffer_new_size+1);
memcpy(tmp->cutbuffer, entry->text + entry->pos - size,
size * sizeof(unichar));
memcpy(tmp->cutbuffer + size, tmpcutbuffer,
tmp->cutbuffer_len * sizeof(unichar));
case CUTBUFFER_UPDATE_PREPEND:
tmp->cutbuffer = g_new(unichar, cutbuffer_new_size + 1);
memcpy(tmp->cutbuffer, entry->text + entry->pos - size,
size * sizeof(unichar));
memcpy(tmp->cutbuffer + size, tmpcutbuffer,
tmp->cutbuffer_len * sizeof(unichar));
tmp->cutbuffer_len = cutbuffer_new_size;
tmp->cutbuffer[cutbuffer_new_size] = '\0';
g_free(tmpcutbuffer);
break;
tmp->cutbuffer_len = cutbuffer_new_size;
tmp->cutbuffer[cutbuffer_new_size] = '\0';
g_free(tmpcutbuffer);
break;
case CUTBUFFER_UPDATE_REPLACE:
/* put erased text to cutbuffer */
if (tmp->cutbuffer_len < size) {
g_free(tmp->cutbuffer);
tmp->cutbuffer = g_new(unichar, size+1);
}
case CUTBUFFER_UPDATE_REPLACE:
/* put erased text to cutbuffer */
if (tmp->cutbuffer_len < size || tmp->cutbuffer == NULL) {
g_free(tmp->cutbuffer);
tmp->cutbuffer = g_new(unichar, size + 1);
}
tmp->cutbuffer_len = size;
tmp->cutbuffer[size] = '\0';
memcpy(tmp->cutbuffer, entry->text + entry->pos - size, size * sizeof(unichar));
break;
tmp->cutbuffer_len = size;
tmp->cutbuffer[size] = '\0';
memcpy(tmp->cutbuffer, entry->text + entry->pos - size,
size * sizeof(unichar));
break;
case CUTBUFFER_UPDATE_NOOP:
/* cannot happen, handled in "if" */
break;
case CUTBUFFER_UPDATE_NOOP:
/* cannot happen, handled in "if" */
break;
}
}
if (size == 0) {
/* we just wanted to clear the cutbuffer */
return;
}
if (entry->utf8)
while (entry->pos > size + w && i_wcwidth(entry->text[entry->pos - size - w]) == 0)
w++;
@ -1498,6 +1506,7 @@ void gui_entry_set_text_and_extents(GUI_ENTRY_REC *entry, GSList *list)
void gui_entry_init(void)
{
settings_add_bool("lookandfeel", "empty_kill_clears_cutbuffer", FALSE);
}
void gui_entry_deinit(void)

View File

@ -69,6 +69,7 @@ static GArray *paste_buffer_rest;
static char *paste_old_prompt;
static int paste_prompt, paste_line_count;
static int paste_join_multiline;
static int paste_ignore_first_nl;
static int paste_timeout_id;
static int paste_use_bracketed_mode;
static int paste_bracketed_mode;
@ -81,6 +82,25 @@ static int previous_yank_preceded;
static const unichar bp_start[] = { 0x1b, '[', '2', '0', '0', '~' };
static const unichar bp_end[] = { 0x1b, '[', '2', '0', '1', '~' };
#define BRACKETED_PASTE_TIMEOUT (5 * 1000) // ms
#if GLIB_CHECK_VERSION(2, 62, 0)
/* nothing */
#else
/* compatibility code for old GLib */
GArray *g_array_copy(GArray *array)
{
GArray *out;
guint elt_size;
elt_size = g_array_get_element_size(array);
out = g_array_sized_new(FALSE, FALSE, elt_size, array->len);
memcpy(out->data, array->data, array->len * elt_size);
return out;
}
#endif
static void sig_input(void);
void input_listen_init(int handle)
@ -143,7 +163,7 @@ static int get_scroll_count(void)
else if (count < 1)
count = 1.0/count;
if (*str == '/') {
if (*str == '/' || *str == '.') {
count = (active_mainwin->height-active_mainwin->statusbar_lines)/count;
}
return (int)count;
@ -330,7 +350,7 @@ static void paste_send(void)
g_string_free(str, TRUE);
}
static void paste_flush(int send)
static void paste_flush(void (*send)(void))
{
if (paste_prompt) {
gui_entry_set_text(active_entry, paste_entry);
@ -338,8 +358,8 @@ static void paste_flush(int send)
g_free_and_null(paste_entry);
}
if (send)
paste_send();
if (send != NULL)
send();
g_array_set_size(paste_buffer, 0);
/* re-add anything that may have been after the bracketed paste end */
@ -358,6 +378,128 @@ static void paste_flush(int send)
gui_entry_redraw(active_entry);
}
static void paste_print_line(const char *str)
{
printformat_window(active_win, MSGLEVEL_CLIENTCRAP, TXT_PASTE_CONTENT, str);
}
static void paste_print(void)
{
GArray *garr;
unichar *arr;
GString *str;
char out[10];
unsigned int i;
gboolean free_garr;
if (paste_join_multiline) {
garr = g_array_copy(paste_buffer);
paste_buffer_join_lines(garr);
free_garr = TRUE;
} else {
garr = paste_buffer;
free_garr = FALSE;
}
arr = &g_array_index(garr, unichar, 0);
str = g_string_new(NULL);
for (i = 0; i < garr->len; i++) {
if (isnewline(arr[i])) {
paste_print_line(str->str);
g_string_truncate(str, 0);
} else if (active_entry->utf8) {
out[g_unichar_to_utf8(arr[i], out)] = '\0';
g_string_append(str, out);
} else if (term_type == TERM_TYPE_BIG5) {
if (arr[i] > 0xff)
g_string_append_c(str, (arr[i] >> 8) & 0xff);
g_string_append_c(str, arr[i] & 0xff);
} else {
g_string_append_c(str, arr[i]);
}
}
if (str->len)
paste_print_line(str->str);
g_string_free(str, TRUE);
if (free_garr)
g_array_free(garr, TRUE);
}
static void paste_event(const char *arg)
{
GArray *garr;
unichar *arr;
GString *str;
char out[10];
unsigned int i;
gboolean free_garr;
if (paste_join_multiline) {
garr = g_array_copy(paste_buffer);
paste_buffer_join_lines(garr);
free_garr = TRUE;
} else {
garr = paste_buffer;
free_garr = FALSE;
}
arr = &g_array_index(garr, unichar, 0);
str = g_string_new(NULL);
for (i = 0; i < garr->len; i++) {
if (isnewline(arr[i])) {
g_string_append_c(str, '\n');
} else if (active_entry->utf8) {
out[g_unichar_to_utf8(arr[i], out)] = '\0';
g_string_append(str, out);
} else if (term_type == TERM_TYPE_BIG5) {
if (arr[i] > 0xff)
g_string_append_c(str, (arr[i] >> 8) & 0xff);
g_string_append_c(str, arr[i] & 0xff);
} else {
g_string_append_c(str, arr[i]);
}
}
if (signal_emit("paste event", 2, str->str, arg)) {
paste_flush(NULL);
}
g_string_free(str, TRUE);
if (free_garr)
g_array_free(garr, TRUE);
}
static void paste_insert_edit(void)
{
unichar *arr;
unsigned int i;
if (paste_join_multiline)
paste_buffer_join_lines(paste_buffer);
arr = &g_array_index(paste_buffer, unichar, 0);
for (i = 0; i < paste_buffer->len; i++) {
if (isnewline(arr[i])) {
gui_entry_insert_char(active_entry, '\\');
gui_entry_insert_char(active_entry, 'n');
} else if (arr[i] == 9) {
gui_entry_insert_char(active_entry, '\\');
gui_entry_insert_char(active_entry, 't');
} else if (arr[i] == 27) {
gui_entry_insert_char(active_entry, '\\');
gui_entry_insert_char(active_entry, 'e');
} else if (arr[i] == '\\') {
gui_entry_insert_char(active_entry, '\\');
gui_entry_insert_char(active_entry, '\\');
} else {
gui_entry_insert_char(active_entry, arr[i]);
}
}
}
static void insert_paste_prompt(void)
{
char *str;
@ -729,6 +871,17 @@ static gboolean paste_timeout(gpointer data)
int split_lines;
paste_was_bracketed_mode = paste_bracketed_mode;
if (paste_ignore_first_nl && paste_line_count == 1) {
unichar last_char;
last_char = g_array_index(paste_buffer, unichar, paste_buffer->len - 1);
if (isnewline(last_char)) {
g_array_set_size(paste_buffer, paste_buffer->len - 1);
paste_line_count--;
}
}
/* number of lines after splitting extra-long messages */
split_lines = paste_buffer->len / LINE_SPLIT_LIMIT;
@ -747,7 +900,7 @@ static gboolean paste_timeout(gpointer data)
active_win->active != NULL)
insert_paste_prompt();
else
paste_flush(TRUE);
paste_flush(paste_send);
paste_timeout_id = -1;
return FALSE;
}
@ -777,12 +930,14 @@ static void paste_bracketed_end(int i, gboolean rest)
}
/* decide what to do with the buffer */
if (paste_timeout_id != -1)
g_source_remove(paste_timeout_id);
paste_timeout(NULL);
paste_bracketed_mode = FALSE;
}
static void paste_bracketed_middle()
static void paste_bracketed_middle(void)
{
int i;
int marklen = G_N_ELEMENTS(bp_end);
@ -830,8 +985,10 @@ static void sig_input(void)
term_gets(buffer, &line_count);
key = g_array_index(buffer, unichar, 0);
/* Either Ctrl-k or Ctrl-c is pressed */
if (key == 11 || key == 3)
paste_flush(key == 11);
if (key < 32 && key != 13 /* CR */ && key != 10 /* LF */ && key != 27 /* Esc */) {
key_pressed(keyboard, "paste");
signal_emit("gui key pressed", 1, GINT_TO_POINTER(key));
}
g_array_free(buffer, TRUE);
} else {
term_gets(paste_buffer, &paste_line_count);
@ -869,7 +1026,47 @@ static void sig_input(void)
static void key_paste_start(void)
{
paste_bracketed_mode = TRUE;
if (paste_use_bracketed_mode) {
paste_bracketed_mode = TRUE;
if (paste_timeout_id != -1)
g_source_remove(paste_timeout_id);
paste_timeout_id = g_timeout_add(BRACKETED_PASTE_TIMEOUT, paste_timeout, NULL);
}
}
static void key_paste_cancel(void)
{
if (paste_prompt) {
paste_flush(NULL);
}
}
static void key_paste_print(void)
{
if (paste_prompt) {
paste_print();
}
}
static void key_paste_send(void)
{
if (paste_prompt) {
paste_flush(paste_send);
}
}
static void key_paste_edit(void)
{
if (paste_prompt) {
paste_flush(paste_insert_edit);
}
}
static void key_paste_event(const char *arg)
{
if (paste_prompt) {
paste_event(arg);
}
}
time_t get_idle_time(void)
@ -1131,11 +1328,14 @@ static void setup_changed(void)
paste_verify_line_count = settings_get_int("paste_verify_line_count");
paste_join_multiline = settings_get_bool("paste_join_multiline");
paste_ignore_first_nl = settings_get_bool("paste_ignore_first_nl");
paste_use_bracketed_mode = settings_get_bool("paste_use_bracketed_mode");
term_set_appkey_mode(settings_get_bool("term_appkey_mode"));
/* Enable the bracketed paste mode on demand */
term_set_bracketed_paste_mode(paste_use_bracketed_mode);
if (!paste_use_bracketed_mode)
paste_bracketed_mode = FALSE;
}
void gui_readline_init(void)
@ -1164,7 +1364,8 @@ void gui_readline_init(void)
keycodes. this must be larger to allow them to work. */
settings_add_int("misc", "paste_verify_line_count", 5);
settings_add_bool("misc", "paste_join_multiline", TRUE);
setup_changed();
settings_add_bool("misc", "paste_ignore_first_nl", FALSE);
setup_changed();
keyboard = keyboard_create(NULL);
key_configure_freeze();
@ -1235,7 +1436,13 @@ void gui_readline_init(void)
key_bind("key", NULL, "meta-O-M", "return", (SIGNAL_FUNC) key_combo);
key_bind("paste_start", "Bracketed paste start", "meta2-200~", "paste_start", (SIGNAL_FUNC) key_paste_start);
/* clang-format off */
key_bind("paste_start", "Bracketed paste start", "^[[200~", "paste_start", (SIGNAL_FUNC) key_paste_start);
key_bind("paste_cancel", "Cancel paste", "paste-^C", NULL, (SIGNAL_FUNC) key_paste_cancel);
key_bind("paste_print", "Print paste to screen", "paste-^P", NULL, (SIGNAL_FUNC) key_paste_print);
key_bind("paste_send", "Send paste to target", "paste-^K", NULL, (SIGNAL_FUNC) key_paste_send);
key_bind("paste_edit", "Insert paste to input line", "paste-^E", NULL, (SIGNAL_FUNC) key_paste_edit);
key_bind("paste_event", "Send paste to event", "paste-^U", NULL, (SIGNAL_FUNC) key_paste_event);
/* cursor movement */
key_bind("backward_character", "Move the cursor a character backward", "left", NULL, (SIGNAL_FUNC) key_backward_character);
@ -1307,8 +1514,9 @@ void gui_readline_init(void)
/* inserting special input characters to line.. */
key_bind("escape_char", "Insert the next character exactly as-is to input line", NULL, NULL, (SIGNAL_FUNC) key_escape);
key_bind("insert_text", "Append text to line", NULL, NULL, (SIGNAL_FUNC) key_insert_text);
/* clang-format on */
/* autoreplaces */
/* autoreplaces */
key_bind("multi", NULL, "return", "check_replaces;send_line", NULL);
key_bind("multi", NULL, "space", "check_replaces;insert_text ", NULL);
@ -1338,6 +1546,11 @@ void gui_readline_deinit(void)
key_configure_freeze();
key_unbind("paste_start", (SIGNAL_FUNC) key_paste_start);
key_unbind("paste_cancel", (SIGNAL_FUNC) key_paste_cancel);
key_unbind("paste_print", (SIGNAL_FUNC) key_paste_print);
key_unbind("paste_send", (SIGNAL_FUNC) key_paste_send);
key_unbind("paste_edit", (SIGNAL_FUNC) key_paste_edit);
key_unbind("paste_event", (SIGNAL_FUNC) key_paste_event);
key_unbind("backward_character", (SIGNAL_FUNC) key_backward_character);
key_unbind("forward_character", (SIGNAL_FUNC) key_forward_character);

View File

@ -1642,9 +1642,9 @@ static int window_refnum_left(int refnum, int wrap)
break;
window = window_find_refnum(refnum);
} while (!WINDOW_STICKY_MATCH(window, find_sticky));
} while (!WINDOW_STICKY_MATCH(window, find_sticky) || is_window_visible(window));
return refnum;
return refnum;
}
static int window_refnum_right(int refnum, int wrap)
@ -1664,9 +1664,9 @@ static int window_refnum_right(int refnum, int wrap)
break;
window = window_find_refnum(refnum);
} while (!WINDOW_STICKY_MATCH(window, find_sticky));
} while (!WINDOW_STICKY_MATCH(window, find_sticky) || is_window_visible(window));
return refnum;
return refnum;
}
/* SYNTAX: WINDOW LEFT [-directional] */

View File

@ -41,7 +41,6 @@ executable('irssi',
libfe_irc_notifylist_a,
],
install : true,
install_rpath : get_option('prefix') / get_option('libdir'),
dependencies : dep
+ textui_dep
)

View File

@ -21,8 +21,8 @@
#include "module.h"
#include <irssi/src/fe-common/core/formats.h>
FORMAT_REC gui_text_formats[] =
{
FORMAT_REC gui_text_formats[] = {
/* clang-format off */
{ MODULE_NAME, "Text user interface", 0 },
/* ---- */
@ -77,8 +77,9 @@ FORMAT_REC gui_text_formats[] =
/* ---- */
{ NULL, "Pasting", 0 },
{ "paste_warning", "Pasting $0 lines to $1. Press Ctrl-K if you wish to do this or Ctrl-C to cancel.", 2, { 1, 0 } },
{ "paste_warning", "Pasting $0 lines to $1. Press Ctrl-K if you wish to do this or Ctrl-C to cancel. Ctrl-P to print the paste content, Ctrl-E to insert the paste in the input line, Ctrl-U to pass the paste to a signal handler.", 2, { 1, 0 } },
{ "paste_prompt", "Hit Ctrl-K to paste, Ctrl-C to abort?", 0 },
{ "paste_content", "%_>%_ $0", 1, { 0 } },
/* ---- */
{ NULL, "Welcome", 0 },
@ -102,4 +103,5 @@ FORMAT_REC gui_text_formats[] =
{ "welcome_init_settings", "The following settings were initialized", 0 },
{ NULL, NULL, 0 }
/* clang-format on */
};

View File

@ -5,8 +5,8 @@ enum {
TXT_FILL_1,
TXT_LASTLOG_TOO_LONG,
TXT_LASTLOG_COUNT,
TXT_LASTLOG_TOO_LONG,
TXT_LASTLOG_COUNT,
TXT_LASTLOG_START,
TXT_LASTLOG_END,
TXT_LASTLOG_SEPARATOR,
@ -14,18 +14,18 @@ enum {
TXT_FILL_2,
TXT_REFNUM_NOT_FOUND,
TXT_WINDOW_TOO_SMALL,
TXT_CANT_HIDE_LAST,
TXT_REFNUM_NOT_FOUND,
TXT_WINDOW_TOO_SMALL,
TXT_CANT_HIDE_LAST,
TXT_CANT_HIDE_STICKY_WINDOWS,
TXT_CANT_SHOW_STICKY_WINDOWS,
TXT_WINDOW_NOT_STICKY,
TXT_WINDOW_SET_STICKY,
TXT_CANT_SHOW_STICKY_WINDOWS,
TXT_WINDOW_NOT_STICKY,
TXT_WINDOW_SET_STICKY,
TXT_WINDOW_UNSET_STICKY,
TXT_WINDOW_INFO_STICKY,
TXT_WINDOW_INFO_SCROLL,
TXT_WINDOW_SCROLL,
TXT_WINDOW_SCROLL_UNKNOWN,
TXT_WINDOW_INFO_SCROLL,
TXT_WINDOW_SCROLL,
TXT_WINDOW_SCROLL_UNKNOWN,
TXT_WINDOW_HIDELEVEL,
TXT_FILL_3,
@ -53,6 +53,7 @@ enum {
TXT_PASTE_WARNING,
TXT_PASTE_PROMPT,
TXT_PASTE_CONTENT,
TXT_FILL_5, /* Welcome */

View File

@ -33,6 +33,7 @@
static GList *activity_list;
static guint8 actlist_sort;
static char *actlist_separator;
static GSList *more_visible; /* list of MAIN_WINDOW_RECs which have --more-- */
static GHashTable *input_entries;
static int last_lag, last_lag_unknown, lag_timeout_tag;
@ -96,7 +97,8 @@ static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight)
/* comma separator */
if (str->len > 0) {
value = theme_format_expand(theme, "{sb_act_sep ,}");
g_string_printf(format, "{sb_act_sep %s}", actlist_separator);
value = theme_format_expand(theme, format->str);
g_string_append(str, value);
g_free(value);
}
@ -451,10 +453,18 @@ static void item_input(SBAR_ITEM_REC *item, int get_size_only)
static void read_settings(void)
{
const char *sep;
if (active_entry != NULL)
gui_entry_set_utf8(active_entry, term_type == TERM_TYPE_UTF8);
actlist_sort = settings_get_choice("actlist_sort");
sep = settings_get_str("actlist_separator");
if (g_strcmp0(actlist_separator, sep) != 0) {
g_free(actlist_separator);
actlist_separator = g_strdup(sep);
statusbar_items_redraw("act");
}
}
void statusbar_items_init(void)
@ -462,6 +472,7 @@ void statusbar_items_init(void)
settings_add_time("misc", "lag_min_show", "1sec");
settings_add_choice("lookandfeel", "actlist_sort", 0, "refnum;recent;level;level,recent");
settings_add_bool("lookandfeel", "actlist_names", FALSE);
settings_add_str("lookandfeel", "actlist_separator", ",");
settings_add_bool("lookandfeel", "actlist_prefer_window_name", FALSE);
statusbar_item_register("window", NULL, item_window_active);

View File

@ -544,7 +544,10 @@ static void cmd_ping(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item
tv = g_get_real_time();
str = g_strdup_printf("%s PING %ld %ld", data, tv / G_TIME_SPAN_SECOND, tv % G_TIME_SPAN_SECOND);
str = g_strdup_printf("%s PING "
"%" G_GINT64_FORMAT " "
"%" G_GINT64_FORMAT,
data, tv / G_TIME_SPAN_SECOND, tv % G_TIME_SPAN_SECOND);
signal_emit("command ctcp", 3, str, server, item);
g_free(str);
}

View File

@ -712,37 +712,12 @@ void irc_server_send_data(IRC_SERVER_REC *server, const char *data, int len)
}
}
static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
void irc_server_send_and_redirect(IRC_SERVER_REC *server, GString *str, REDIRECT_REC *redirect)
{
REDIRECT_REC *redirect;
GSList *link;
GString *str;
long usecs;
char *cmd;
int crlf;
if (!IS_IRC_SERVER(server))
return 0;
if (server->cmdcount == 0 && server->cmdqueue == NULL)
return 0;
if (now < server->wait_cmd)
return 1;
usecs = (now - server->last_cmd) / G_TIME_SPAN_MILLISECOND;
if (usecs < server->cmd_queue_speed)
return 1;
server->cmdcount--;
if (server->cmdqueue == NULL) return 1;
/* get command */
cmd = server->cmdqueue->data;
redirect = server->cmdqueue->next->data;
/* send command */
str = g_string_new(cmd);
g_return_if_fail(server != NULL);
g_return_if_fail(str != NULL);
if (str->len > 2 && str->str[str->len - 2] == '\r')
crlf = 2;
@ -769,6 +744,40 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
rawlog_output(server->rawlog, str->str);
server_redirect_command(server, str->str, redirect);
}
}
static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
{
REDIRECT_REC *redirect;
GSList *link;
GString *str;
long usecs;
char *cmd;
if (!IS_IRC_SERVER(server))
return 0;
if (server->cmdcount == 0 && server->cmdqueue == NULL)
return 0;
if (now < server->wait_cmd)
return 1;
usecs = (now - server->last_cmd) / G_TIME_SPAN_MILLISECOND;
if (usecs < server->cmd_queue_speed)
return 1;
server->cmdcount--;
if (server->cmdqueue == NULL)
return 1;
/* get command */
cmd = server->cmdqueue->data;
redirect = server->cmdqueue->next->data;
/* send command */
str = g_string_new(cmd);
irc_server_send_and_redirect(server, str, redirect);
g_string_free(str, TRUE);
/* remove from queue */

View File

@ -176,6 +176,7 @@ char **irc_server_split_action(IRC_SERVER_REC *server, const char *target,
const char *data);
void irc_server_send_away(IRC_SERVER_REC *server, const char *reason);
void irc_server_send_data(IRC_SERVER_REC *server, const char *data, int len);
void irc_server_send_and_redirect(IRC_SERVER_REC *server, GString *str, REDIRECT_REC *redirect);
void irc_server_init_isupport(IRC_SERVER_REC *server);
void irc_servers_start_cmd_timeout(void);

View File

@ -119,33 +119,7 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_whe
}
if (irc_send_when == IRC_SEND_NOW) {
int crlf;
if (str->len > 2 && str->str[str->len - 2] == '\r')
crlf = 2;
else if (str->len > 1 && str->str[str->len - 1] == '\n')
crlf = 1;
else
crlf = 0;
if (crlf)
g_string_truncate(str, str->len - crlf);
signal_emit("server outgoing modify", 3, server, str, crlf);
if (str->len) {
if (crlf == 2)
g_string_append(str, "\r\n");
else if (crlf == 1)
g_string_append(str, "\n");
irc_server_send_data(server, str->str, str->len);
/* add to rawlog without [CR+]LF */
if (crlf)
g_string_truncate(str, str->len - crlf);
rawlog_output(server->rawlog, str->str);
server_redirect_command(server, str->str, server->redirect_next);
}
irc_server_send_and_redirect(server, str, server->redirect_next);
g_string_free(str, TRUE);
} else if (irc_send_when == IRC_SEND_NEXT) {
/* add to queue */

View File

@ -23,6 +23,7 @@
#include <irssi/src/otr/otr-formats.h>
FORMAT_REC fe_otr_formats[] = {
/* clang-format off */
{ MODULE_NAME, "Core", 0 },
/* Status bar format. */
@ -73,7 +74,7 @@ FORMAT_REC fe_otr_formats[] = {
{ "otr_keys_unavailable", "{error No OTR keys available}", 0},
{ "otr_msg_encryption_ended", "{hilight $0} has closed the connection to you", 1, { 0 }},
{ "otr_msg_encryption_error", "{error An error occured when encrypting your message}", 0},
{ "otr_msg_encryption_error", "{error An error occurred when encrypting your message}", 0},
{ "otr_msg_encryption_required", "Encryptioned is required", 0},
{ "otr_msg_error", "Error in private conversation: {error $0}", 1, { 0 }},
{ "otr_msg_general_error", "General Error: {error $0}", 1, { 0 }},
@ -101,8 +102,9 @@ FORMAT_REC fe_otr_formats[] = {
{ "otr_smp_failure", "Authentication with {hilight $0} failed", 1, { 0 }},
{ "otr_smp_in_progress", "{hilight $0} replied to your auth request", 1, { 0 }},
{ "otr_smp_secret_question", "{hilight $0} wants to authenticate. Use /otr auth <secret> to complete", 1, { 0 }},
{ "otr_smp_success", "Authentication with {hilight $0} succesful", 1, { 0 }},
{ "otr_smp_success", "Authentication with {hilight $0} successful", 1, { 0 }},
/* Last element. */
{ NULL, NULL, 0 }
/* clang-format on */
};

View File

@ -104,6 +104,10 @@ int
settings_get_size(key)
char *key
int
settings_get_choice(key)
char *key
void
settings_set_str(key, value)
char *key
@ -134,6 +138,11 @@ settings_set_size(key, value)
char *key
char *value
int
settings_set_choice(key, value)
char *key
char *value
void
settings_add_str(section, key, def)
char *section
@ -188,6 +197,16 @@ CODE:
perl_settings_add(key);
settings_add_size_module(MODULE_NAME"/scripts", section, key, def);
void
settings_add_choice(section, key, def, choices)
char *section
char *key
int def
char *choices
CODE:
perl_settings_add(key);
settings_add_choice_module(MODULE_NAME "/scripts", section, key, def, choices);
void
settings_remove(key)
char *key

View File

@ -14,7 +14,7 @@ if test -z "$VERSION_DATE"; then
;;
esac
VERSION_TIME=`echo "$DATE" | cut -f 1 -d ' ' | tr -d v | tr .- ' '`
VERSION_TIME=`printf %d%d%02d $VERSION_TIME 2>/dev/null`
VERSION_TIME=`printf %d%d%02d $VERSION_TIME 2>/dev/null | cut -c 1-4`
fi
echo "#define IRSSI_VERSION_DATE $VERSION_DATE"