mirror of
https://github.com/irssi/irssi.git
synced 2026-08-09 11:50:10 +02:00
add new PUBNOTICES level
separating private notices and channel notices
This commit is contained in:
parent
ae5a9283ee
commit
7360944900
12 changed files with 83 additions and 52 deletions
|
|
@ -355,7 +355,7 @@ static void read_settings(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_time("lookandfeel", "autoclose_query", "0");
|
||||
|
||||
|
|
|
|||
|
|
@ -921,10 +921,10 @@ char *format_add_lineend(const char *text, const char *linestart)
|
|||
#define LINE_START_IRSSI_LEVEL \
|
||||
(MSGLEVEL_CLIENTERROR | MSGLEVEL_CLIENTNOTICE)
|
||||
|
||||
#define NOT_LINE_START_LEVEL \
|
||||
(MSGLEVEL_NEVER | MSGLEVEL_LASTLOG | MSGLEVEL_CLIENTCRAP | \
|
||||
MSGLEVEL_MSGS | MSGLEVEL_PUBLIC | MSGLEVEL_DCC | MSGLEVEL_DCCMSGS | \
|
||||
MSGLEVEL_ACTIONS | MSGLEVEL_NOTICES | MSGLEVEL_SNOTES | MSGLEVEL_CTCPS)
|
||||
#define NOT_LINE_START_LEVEL \
|
||||
(MSGLEVEL_NEVER | MSGLEVEL_LASTLOG | MSGLEVEL_CLIENTCRAP | MSGLEVEL_MSGS | \
|
||||
MSGLEVEL_PUBLIC | MSGLEVEL_DCC | MSGLEVEL_DCCMSGS | MSGLEVEL_ACTIONS | MSGLEVEL_NOTICES | \
|
||||
MSGLEVEL_PUBNOTICES | MSGLEVEL_SNOTES | MSGLEVEL_CTCPS)
|
||||
|
||||
/* return the "-!- " text at the start of the line */
|
||||
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_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");
|
||||
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)
|
||||
{
|
||||
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 */
|
||||
channel = 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,
|
||||
target, msg);
|
||||
g_free(channel);
|
||||
context_channel = is_public ? NULL : notice_channel_context((SERVER_REC *) server, msg);
|
||||
|
||||
printformat(
|
||||
server, context_channel != NULL ? context_channel : cleantarget,
|
||||
(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,
|
||||
|
|
@ -283,7 +292,9 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
|
|||
const char *target)
|
||||
{
|
||||
const char *oldtarget;
|
||||
int level = MSGLEVEL_NOTICES;
|
||||
char *context_channel;
|
||||
int level;
|
||||
gboolean is_public;
|
||||
|
||||
oldtarget = 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;
|
||||
}
|
||||
|
||||
if (ignore_check_plus(server, nick, address,
|
||||
server_ischannel(SERVER(server), target) ? target : NULL,
|
||||
msg, &level, TRUE))
|
||||
is_public = server_ischannel(SERVER(server), target);
|
||||
/* check if this is a cnotice */
|
||||
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;
|
||||
}
|
||||
|
||||
if (server_ischannel(SERVER(server), target)) {
|
||||
if (is_public) {
|
||||
/* notice in some channel */
|
||||
printformat(server, target, level,
|
||||
IRCTXT_NOTICE_PUBLIC, nick, oldtarget, msg);
|
||||
char *nickmode;
|
||||
nickmode = channel_get_nickmode(channel_find(server, target), nick);
|
||||
printformat(server, target, level, IRCTXT_NOTICE_PUBLIC, nick, oldtarget, msg,
|
||||
nickmode);
|
||||
} else {
|
||||
char *channel;
|
||||
/* check if this is a cnotice */
|
||||
channel = notice_channel_context(server, msg);
|
||||
|
||||
if (channel == NULL) {
|
||||
if (context_channel == NULL) {
|
||||
/* private notice */
|
||||
privmsg_get_query(SERVER(server), nick, FALSE, MSGLEVEL_NOTICES);
|
||||
}
|
||||
printformat(server, channel == NULL ? nick : channel, level, IRCTXT_NOTICE_PRIVATE,
|
||||
nick, address, msg);
|
||||
|
||||
g_free(channel);
|
||||
printformat(server, context_channel == NULL ? nick : context_channel, level,
|
||||
IRCTXT_NOTICE_PRIVATE, nick, address, msg);
|
||||
}
|
||||
g_free(context_channel);
|
||||
}
|
||||
|
||||
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 },
|
||||
|
||||
{ "notice_server", "{servernotice $0}$1", 2, { 0, 0 } },
|
||||
{ "notice_public", "{notice $0{pubnotice_channel $1}}$2", 3, { 0, 0, 0 } },
|
||||
{ "notice_private", "{notice $0{pvtnotice_host $1}}$2", 3, { 0, 0, 0 } },
|
||||
{ "notice_public", "{pubnotice $3 $0}$2", 4, { 0, 0, 0, 0 } },
|
||||
{ "notice_private", "{notice $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_public", "{pubaction $0}$1", 2, { 0, 0 } },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue