mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
add new PUBNOTICES level
separating private notices and channel notices
This commit is contained in:
parent
ae5a9283ee
commit
7360944900
@ -20,9 +20,10 @@
|
|||||||
MODES A channel mode is modified.
|
MODES A channel mode is modified.
|
||||||
MSGS Private messages.
|
MSGS Private messages.
|
||||||
NICKS A nickname changes to another nickname.
|
NICKS A nickname changes to another nickname.
|
||||||
NOTICES Notices sent from a nickname.
|
NOTICES Private notices.
|
||||||
PARTS A nickname leaves a channel.
|
PARTS A nickname leaves a channel.
|
||||||
PUBLIC Public messages in a channel.
|
PUBLIC Public messages in a channel.
|
||||||
|
PUBNOTICES Public notices in a channel.
|
||||||
QUITS A nickname disconnects from IRC.
|
QUITS A nickname disconnects from IRC.
|
||||||
SNOTES Notices sent from a server.
|
SNOTES Notices sent from a server.
|
||||||
TOPICS A channel topic is modified.
|
TOPICS A channel topic is modified.
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
|
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
|
||||||
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
|
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
|
||||||
|
|
||||||
#define IRSSI_ABI_VERSION 46
|
#define IRSSI_ABI_VERSION 47
|
||||||
|
|
||||||
#define DEFAULT_SERVER_ADD_PORT 6667
|
#define DEFAULT_SERVER_ADD_PORT 6667
|
||||||
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
||||||
|
@ -23,10 +23,12 @@
|
|||||||
|
|
||||||
/* the order of these levels must match the bits in levels.h */
|
/* the order of these levels must match the bits in levels.h */
|
||||||
static const char *levels[] = {
|
static const char *levels[] = {
|
||||||
|
/* clang-format off */
|
||||||
"CRAP",
|
"CRAP",
|
||||||
"MSGS",
|
"MSGS",
|
||||||
"PUBLICS",
|
"PUBLICS",
|
||||||
"NOTICES",
|
"NOTICES",
|
||||||
|
"PUBNOTICES",
|
||||||
"SNOTES",
|
"SNOTES",
|
||||||
"CTCPS",
|
"CTCPS",
|
||||||
"ACTIONS",
|
"ACTIONS",
|
||||||
@ -46,6 +48,7 @@ static const char *levels[] = {
|
|||||||
"CLIENTERRORS",
|
"CLIENTERRORS",
|
||||||
"HILIGHTS",
|
"HILIGHTS",
|
||||||
NULL
|
NULL
|
||||||
|
/* clang-format on */
|
||||||
};
|
};
|
||||||
|
|
||||||
int level_get(const char *level)
|
int level_get(const char *level)
|
||||||
|
@ -13,26 +13,27 @@ enum {
|
|||||||
MSGLEVEL_MSGS = 0x0000002,
|
MSGLEVEL_MSGS = 0x0000002,
|
||||||
MSGLEVEL_PUBLIC = 0x0000004,
|
MSGLEVEL_PUBLIC = 0x0000004,
|
||||||
MSGLEVEL_NOTICES = 0x0000008,
|
MSGLEVEL_NOTICES = 0x0000008,
|
||||||
MSGLEVEL_SNOTES = 0x0000010,
|
MSGLEVEL_PUBNOTICES = 0x0000010,
|
||||||
MSGLEVEL_CTCPS = 0x0000020,
|
MSGLEVEL_SNOTES = 0x0000020,
|
||||||
MSGLEVEL_ACTIONS = 0x0000040,
|
MSGLEVEL_CTCPS = 0x0000040,
|
||||||
MSGLEVEL_JOINS = 0x0000080,
|
MSGLEVEL_ACTIONS = 0x0000080,
|
||||||
MSGLEVEL_PARTS = 0x0000100,
|
MSGLEVEL_JOINS = 0x0000100,
|
||||||
MSGLEVEL_QUITS = 0x0000200,
|
MSGLEVEL_PARTS = 0x0000200,
|
||||||
MSGLEVEL_KICKS = 0x0000400,
|
MSGLEVEL_QUITS = 0x0000400,
|
||||||
MSGLEVEL_MODES = 0x0000800,
|
MSGLEVEL_KICKS = 0x0000800,
|
||||||
MSGLEVEL_TOPICS = 0x0001000,
|
MSGLEVEL_MODES = 0x0001000,
|
||||||
MSGLEVEL_WALLOPS = 0x0002000,
|
MSGLEVEL_TOPICS = 0x0002000,
|
||||||
MSGLEVEL_INVITES = 0x0004000,
|
MSGLEVEL_WALLOPS = 0x0004000,
|
||||||
MSGLEVEL_NICKS = 0x0008000,
|
MSGLEVEL_INVITES = 0x0008000,
|
||||||
MSGLEVEL_DCC = 0x0010000,
|
MSGLEVEL_NICKS = 0x0010000,
|
||||||
MSGLEVEL_DCCMSGS = 0x0020000,
|
MSGLEVEL_DCC = 0x0020000,
|
||||||
MSGLEVEL_CLIENTNOTICE = 0x0040000,
|
MSGLEVEL_DCCMSGS = 0x0040000,
|
||||||
MSGLEVEL_CLIENTCRAP = 0x0080000,
|
MSGLEVEL_CLIENTNOTICE = 0x0080000,
|
||||||
MSGLEVEL_CLIENTERROR = 0x0100000,
|
MSGLEVEL_CLIENTCRAP = 0x0100000,
|
||||||
MSGLEVEL_HILIGHT = 0x0200000,
|
MSGLEVEL_CLIENTERROR = 0x0200000,
|
||||||
|
MSGLEVEL_HILIGHT = 0x0400000,
|
||||||
|
|
||||||
MSGLEVEL_ALL = 0x03fffff,
|
MSGLEVEL_ALL = 0x07fffff,
|
||||||
|
|
||||||
MSGLEVEL_NOHILIGHT = 0x1000000, /* Don't highlight this message */
|
MSGLEVEL_NOHILIGHT = 0x1000000, /* Don't highlight this message */
|
||||||
MSGLEVEL_NO_ACT = 0x2000000, /* Don't trigger channel activity */
|
MSGLEVEL_NO_ACT = 0x2000000, /* Don't trigger channel activity */
|
||||||
|
@ -355,7 +355,7 @@ static void read_settings(void)
|
|||||||
|
|
||||||
void fe_queries_init(void)
|
void fe_queries_init(void)
|
||||||
{
|
{
|
||||||
settings_add_level("lookandfeel", "autocreate_query_level", "MSGS DCCMSGS");
|
settings_add_level("lookandfeel", "autocreate_query_level", "MSGS DCCMSGS NOTICES");
|
||||||
settings_add_bool("lookandfeel", "autocreate_own_query", TRUE);
|
settings_add_bool("lookandfeel", "autocreate_own_query", TRUE);
|
||||||
settings_add_time("lookandfeel", "autoclose_query", "0");
|
settings_add_time("lookandfeel", "autoclose_query", "0");
|
||||||
|
|
||||||
|
@ -921,10 +921,10 @@ char *format_add_lineend(const char *text, const char *linestart)
|
|||||||
#define LINE_START_IRSSI_LEVEL \
|
#define LINE_START_IRSSI_LEVEL \
|
||||||
(MSGLEVEL_CLIENTERROR | MSGLEVEL_CLIENTNOTICE)
|
(MSGLEVEL_CLIENTERROR | MSGLEVEL_CLIENTNOTICE)
|
||||||
|
|
||||||
#define NOT_LINE_START_LEVEL \
|
#define NOT_LINE_START_LEVEL \
|
||||||
(MSGLEVEL_NEVER | MSGLEVEL_LASTLOG | MSGLEVEL_CLIENTCRAP | \
|
(MSGLEVEL_NEVER | MSGLEVEL_LASTLOG | MSGLEVEL_CLIENTCRAP | MSGLEVEL_MSGS | \
|
||||||
MSGLEVEL_MSGS | MSGLEVEL_PUBLIC | MSGLEVEL_DCC | MSGLEVEL_DCCMSGS | \
|
MSGLEVEL_PUBLIC | MSGLEVEL_DCC | MSGLEVEL_DCCMSGS | MSGLEVEL_ACTIONS | MSGLEVEL_NOTICES | \
|
||||||
MSGLEVEL_ACTIONS | MSGLEVEL_NOTICES | MSGLEVEL_SNOTES | MSGLEVEL_CTCPS)
|
MSGLEVEL_PUBNOTICES | MSGLEVEL_SNOTES | MSGLEVEL_CTCPS)
|
||||||
|
|
||||||
/* return the "-!- " text at the start of the line */
|
/* return the "-!- " text at the start of the line */
|
||||||
char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest)
|
char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest)
|
||||||
|
@ -143,7 +143,7 @@ void window_activity_init(void)
|
|||||||
{
|
{
|
||||||
settings_add_str("lookandfeel", "activity_hide_targets", "");
|
settings_add_str("lookandfeel", "activity_hide_targets", "");
|
||||||
settings_add_level("lookandfeel", "activity_hide_level", "");
|
settings_add_level("lookandfeel", "activity_hide_level", "");
|
||||||
settings_add_level("lookandfeel", "activity_msg_level", "PUBLIC");
|
settings_add_level("lookandfeel", "activity_msg_level", "PUBLIC NOTICES");
|
||||||
settings_add_level("lookandfeel", "activity_hilight_level", "MSGS DCCMSGS");
|
settings_add_level("lookandfeel", "activity_hilight_level", "MSGS DCCMSGS");
|
||||||
signal_window_hilight_check = signal_get_uniq_id("window hilight check");
|
signal_window_hilight_check = signal_get_uniq_id("window hilight check");
|
||||||
|
|
||||||
|
@ -269,13 +269,22 @@ static char *notice_channel_context(SERVER_REC *server, const char *msg)
|
|||||||
|
|
||||||
static void sig_message_own_notice(IRC_SERVER_REC *server, const char *msg, const char *target)
|
static void sig_message_own_notice(IRC_SERVER_REC *server, const char *msg, const char *target)
|
||||||
{
|
{
|
||||||
char *channel;
|
gboolean is_public;
|
||||||
|
const char *cleantarget;
|
||||||
|
char *context_channel;
|
||||||
|
|
||||||
|
cleantarget = fe_channel_skip_prefix(server, target);
|
||||||
|
is_public = server_ischannel(SERVER(server), cleantarget);
|
||||||
/* check if this is a cnotice */
|
/* check if this is a cnotice */
|
||||||
channel = notice_channel_context((SERVER_REC *) server, msg);
|
context_channel = is_public ? NULL : notice_channel_context((SERVER_REC *) server, msg);
|
||||||
printformat(server, channel != NULL ? channel : fe_channel_skip_prefix(server, target),
|
|
||||||
MSGLEVEL_NOTICES | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, IRCTXT_OWN_NOTICE,
|
printformat(
|
||||||
target, msg);
|
server, context_channel != NULL ? context_channel : cleantarget,
|
||||||
g_free(channel);
|
(is_public || context_channel != NULL ? MSGLEVEL_PUBNOTICES : MSGLEVEL_NOTICES) |
|
||||||
|
MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
|
||||||
|
IRCTXT_OWN_NOTICE, target, msg);
|
||||||
|
|
||||||
|
g_free(context_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
|
static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
|
||||||
@ -283,7 +292,9 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
|
|||||||
const char *target)
|
const char *target)
|
||||||
{
|
{
|
||||||
const char *oldtarget;
|
const char *oldtarget;
|
||||||
int level = MSGLEVEL_NOTICES;
|
char *context_channel;
|
||||||
|
int level;
|
||||||
|
gboolean is_public;
|
||||||
|
|
||||||
oldtarget = target;
|
oldtarget = target;
|
||||||
target = fe_channel_skip_prefix(IRC_SERVER(server), target);
|
target = fe_channel_skip_prefix(IRC_SERVER(server), target);
|
||||||
@ -299,29 +310,32 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ignore_check_plus(server, nick, address,
|
is_public = server_ischannel(SERVER(server), target);
|
||||||
server_ischannel(SERVER(server), target) ? target : NULL,
|
/* check if this is a cnotice */
|
||||||
msg, &level, TRUE))
|
context_channel = is_public ? NULL : notice_channel_context(server, msg);
|
||||||
|
level = (is_public || context_channel != NULL) ? MSGLEVEL_PUBNOTICES : MSGLEVEL_NOTICES;
|
||||||
|
|
||||||
|
if (ignore_check_plus(server, nick, address, is_public ? target : context_channel, msg,
|
||||||
|
&level, TRUE)) {
|
||||||
|
g_free(context_channel);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (server_ischannel(SERVER(server), target)) {
|
if (is_public) {
|
||||||
/* notice in some channel */
|
/* notice in some channel */
|
||||||
printformat(server, target, level,
|
char *nickmode;
|
||||||
IRCTXT_NOTICE_PUBLIC, nick, oldtarget, msg);
|
nickmode = channel_get_nickmode(channel_find(server, target), nick);
|
||||||
|
printformat(server, target, level, IRCTXT_NOTICE_PUBLIC, nick, oldtarget, msg,
|
||||||
|
nickmode);
|
||||||
} else {
|
} else {
|
||||||
char *channel;
|
if (context_channel == NULL) {
|
||||||
/* check if this is a cnotice */
|
|
||||||
channel = notice_channel_context(server, msg);
|
|
||||||
|
|
||||||
if (channel == NULL) {
|
|
||||||
/* private notice */
|
/* private notice */
|
||||||
privmsg_get_query(SERVER(server), nick, FALSE, MSGLEVEL_NOTICES);
|
privmsg_get_query(SERVER(server), nick, FALSE, MSGLEVEL_NOTICES);
|
||||||
}
|
}
|
||||||
printformat(server, channel == NULL ? nick : channel, level, IRCTXT_NOTICE_PRIVATE,
|
printformat(server, context_channel == NULL ? nick : context_channel, level,
|
||||||
nick, address, msg);
|
IRCTXT_NOTICE_PRIVATE, nick, address, msg);
|
||||||
|
|
||||||
g_free(channel);
|
|
||||||
}
|
}
|
||||||
|
g_free(context_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_message_own_ctcp(IRC_SERVER_REC *server, const char *cmd,
|
static void sig_message_own_ctcp(IRC_SERVER_REC *server, const char *cmd,
|
||||||
|
@ -137,8 +137,8 @@ FORMAT_REC fecommon_irc_formats[] = {
|
|||||||
{ NULL, "Received messages", 0 },
|
{ NULL, "Received messages", 0 },
|
||||||
|
|
||||||
{ "notice_server", "{servernotice $0}$1", 2, { 0, 0 } },
|
{ "notice_server", "{servernotice $0}$1", 2, { 0, 0 } },
|
||||||
{ "notice_public", "{notice $0{pubnotice_channel $1}}$2", 3, { 0, 0, 0 } },
|
{ "notice_public", "{pubnotice $3 $0}$2", 4, { 0, 0, 0, 0 } },
|
||||||
{ "notice_private", "{notice $0{pvtnotice_host $1}}$2", 3, { 0, 0, 0 } },
|
{ "notice_private", "{notice $0}$2", 3, { 0, 0, 0 } },
|
||||||
{ "action_private", "{pvtaction $0}$2", 3, { 0, 0, 0 } },
|
{ "action_private", "{pvtaction $0}$2", 3, { 0, 0, 0 } },
|
||||||
{ "action_private_query", "{pvtaction_query $0}$2", 3, { 0, 0, 0 } },
|
{ "action_private_query", "{pvtaction_query $0}$2", 3, { 0, 0, 0 } },
|
||||||
{ "action_public", "{pubaction $0}$1", 2, { 0, 0 } },
|
{ "action_public", "{pubaction $0}$1", 2, { 0, 0 } },
|
||||||
|
@ -27,7 +27,11 @@ executable('irssi',
|
|||||||
'textbuffer-view.c',
|
'textbuffer-view.c',
|
||||||
'textbuffer.c',
|
'textbuffer.c',
|
||||||
)
|
)
|
||||||
+ [ irssi_version_h ],
|
+ [
|
||||||
|
irssi_version_h,
|
||||||
|
default_config_h,
|
||||||
|
default_theme_h,
|
||||||
|
],
|
||||||
include_directories : rootinc,
|
include_directories : rootinc,
|
||||||
implicit_include_directories : false,
|
implicit_include_directories : false,
|
||||||
export_dynamic : true,
|
export_dynamic : true,
|
||||||
|
@ -322,6 +322,13 @@ CODE:
|
|||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
|
|
||||||
|
int
|
||||||
|
MSGLEVEL_PUBNOTICES()
|
||||||
|
CODE:
|
||||||
|
RETVAL = MSGLEVEL_PUBNOTICES;
|
||||||
|
OUTPUT:
|
||||||
|
RETVAL
|
||||||
|
|
||||||
int
|
int
|
||||||
MSGLEVEL_SNOTES()
|
MSGLEVEL_SNOTES()
|
||||||
CODE:
|
CODE:
|
||||||
|
@ -202,6 +202,7 @@ abstracts = {
|
|||||||
# notices
|
# notices
|
||||||
ownnotice = "[%r$0%K(%R$1-%K)]%n ";
|
ownnotice = "[%r$0%K(%R$1-%K)]%n ";
|
||||||
notice = "%K-%M$*%K-%n ";
|
notice = "%K-%M$*%K-%n ";
|
||||||
|
pubnotice = "%K-%M$0$1-%K-%n %|";
|
||||||
pubnotice_channel = "%K:%m$*";
|
pubnotice_channel = "%K:%m$*";
|
||||||
pvtnotice_host = "%K(%m$*%K)";
|
pvtnotice_host = "%K(%m$*%K)";
|
||||||
servernotice = "%g!$*%n ";
|
servernotice = "%g!$*%n ";
|
||||||
|
Loading…
Reference in New Issue
Block a user