summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-06-04 19:50:16 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-06-04 19:50:16 +0000
commit3609f6f2438f0064968e39739b9f119b0c718605 (patch)
tree4601b5fdf1fa1111c502bae0046bef41bdf739ef /src
parentf079263035a71e3f97cc7f3c5ebe96ffdba51483 (diff)
downloadirssi-3609f6f2438f0064968e39739b9f119b0c718605.zip
Added support for bahamut @+#channel notices. Removed notice_public_ops
format, notice_public is just fine if the channel just contains @ or @+ at the beginning. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1538 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-irc-commands.c31
-rw-r--r--src/fe-common/irc/fe-irc-messages.c39
-rw-r--r--src/fe-common/irc/module-formats.c1
-rw-r--r--src/fe-common/irc/module-formats.h1
-rw-r--r--src/irc/core/irc-servers.c8
-rw-r--r--src/irc/core/irc.h4
6 files changed, 51 insertions, 33 deletions
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c
index a2e4829c..7593593d 100644
--- a/src/fe-common/irc/fe-irc-commands.c
+++ b/src/fe-common/irc/fe-irc-commands.c
@@ -40,6 +40,19 @@
#include "printtext.h"
#include "keyboard.h"
+static char *skip_target(char *target)
+{
+ if (*target == '@') {
+ /* @#channel, @+#channel - Hybrid6 / Bahamut features */
+ if (target[1] == '+' && ischannel(target[2]))
+ target += 2;
+ else if (ischannel(target[1]))
+ target++;
+ }
+
+ return target;
+}
+
/* SYNTAX: ME <message> */
static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
@@ -75,6 +88,7 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server)
signal_emit("message irc own_action", 3, server, text, target);
+ target = skip_target(target);
irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", target, text);
cmd_params_free(free_arg);
}
@@ -94,11 +108,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server)
if (*target == '\0' || *msg == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
- if (*target == '@' && ischannel(target[1])) {
- /* Hybrid 6 feature, send notice to all ops in channel */
- target++;
- }
-
+ target = skip_target(target);
signal_emit("message irc own_notice", 3, server, msg, target);
cmd_params_free(free_arg);
}
@@ -124,10 +134,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server)
return;
}
- if (*target == '@' && ischannel(target[1])) {
- /* Hybrid 6 feature, send ctcp to all ops in channel */
- target++;
- }
+ target = skip_target(target);
g_strup(ctcpcmd);
signal_emit("message irc own_ctcp", 4,
@@ -151,11 +158,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server)
if (*target == '\0' || *text == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
- if (*target == '@' && ischannel(target[1])) {
- /* Hybrid 6 feature, send notice to all ops in channel */
- target++;
- }
-
+ target = skip_target(target);
signal_emit("message irc own_notice", 3, server, text, target);
cmd_params_free(free_arg);
}
diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c
index 911ea62b..5aab2e08 100644
--- a/src/fe-common/irc/fe-irc-messages.c
+++ b/src/fe-common/irc/fe-irc-messages.c
@@ -37,22 +37,38 @@
#include "fe-queries.h"
#include "window-items.h"
+static const char *skip_target(const char *target)
+{
+ if (target != NULL && *target == '@') {
+ /* @#channel, @+#channel - Hybrid6 / Bahamut features */
+ if (target[1] == '+' && ischannel(target[2]))
+ target += 2;
+ else if (ischannel(target[1]))
+ target++;
+ }
+
+ return target;
+}
+
static void sig_message_own_public(SERVER_REC *server, const char *msg,
const char *target, const char *origtarget)
{
+ const char *oldtarget;
char *nickmode;
- if (IS_IRC_SERVER(server) && target != NULL &&
- *target == '@' && ischannel(target[1])) {
- /* Hybrid 6 feature, send msg to all ops in channel */
- nickmode = channel_get_nickmode(channel_find(server, target+1),
+ oldtarget = target;
+ target = skip_target(target);
+ if (IS_IRC_SERVER(server) && target != oldtarget) {
+ /* Hybrid 6 / Bahamut feature, send msg to all
+ ops / ops+voices in channel */
+ nickmode = channel_get_nickmode(channel_find(server, target),
server->nick);
- printformat_module("fe-common/core", server, target+1,
+ printformat_module("fe-common/core", server, target,
MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT |
MSGLEVEL_NO_ACT,
TXT_OWN_MSG_CHANNEL,
- server->nick, target, msg, nickmode);
+ server->nick, oldtarget, msg, nickmode);
signal_stop();
}
}
@@ -172,8 +188,8 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
const char *nick, const char *address,
const char *target)
{
- int op_notice;
-
+ const char *oldtarget;
+
if (address == NULL) {
/* notice from server */
if (!ignore_check(server, nick, "",
@@ -184,8 +200,8 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
return;
}
- op_notice = *target == '@' && ischannel(target[1]);
- if (op_notice) target++;
+ oldtarget = target;
+ target = skip_target(target);
if (ignore_check(server, nick, address,
ischannel(*target) ? target : NULL,
@@ -195,8 +211,7 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg,
if (ischannel(*target)) {
/* notice in some channel */
printformat(server, target, MSGLEVEL_NOTICES,
- op_notice ? IRCTXT_NOTICE_PUBLIC_OPS :
- IRCTXT_NOTICE_PUBLIC, nick, target, msg);
+ IRCTXT_NOTICE_PUBLIC, nick, oldtarget, msg);
} else {
/* private notice */
privmsg_get_query(SERVER(server), nick, FALSE,
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index cae4bd85..054c50bd 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -127,7 +127,6 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "notice_server", "{servernotice $0}$1", 2, { 0, 0 } },
{ "notice_public", "{notice $0{pubnotice_channel $1}}$2", 3, { 0, 0, 0 } },
- { "notice_public_ops", "{notice $0{pubnotice_channel @$1}}$2", 3, { 0, 0, 0 } },
{ "notice_private", "{notice $0{pvtnotice_host $1}}$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 } },
diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h
index e8ee34ca..08bc1550 100644
--- a/src/fe-common/irc/module-formats.h
+++ b/src/fe-common/irc/module-formats.h
@@ -100,7 +100,6 @@ enum {
IRCTXT_NOTICE_SERVER,
IRCTXT_NOTICE_PUBLIC,
- IRCTXT_NOTICE_PUBLIC_OPS,
IRCTXT_NOTICE_PRIVATE,
IRCTXT_ACTION_PRIVATE,
IRCTXT_ACTION_PRIVATE_QUERY,
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index 966ddf5e..a2d281ed 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -71,7 +71,13 @@ static int isnickflag_func(char flag)
static int ischannel_func(const char *data)
{
- return ischannel_target(data);
+ if (*data == '@') {
+ /* @#channel, @+#channel */
+ data++;
+ if (*data == '+' && ischannel(data[1]))
+ return 1;
+ }
+ return ischannel(*data);
}
static void send_message(SERVER_REC *server, const char *target,
diff --git a/src/irc/core/irc.h b/src/irc/core/irc.h
index 17a18635..46051d9e 100644
--- a/src/irc/core/irc.h
+++ b/src/irc/core/irc.h
@@ -25,10 +25,6 @@
(a) == '!' || /* secure */ \
(a) == '+') /* modeless */
-#define ischannel_target(a) \
- (ischannel((a)[0]) || \
- ((a)[0] == '@' && ischannel((a)[1]))) /* hybrid6 @#channel */
-
#define IS_IRC_ITEM(rec) (IS_IRC_CHANNEL(rec) || IS_IRC_QUERY(rec))
extern char *current_server_event; /* current server event being processed */