summaryrefslogtreecommitdiff
path: root/src/fe-common/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r--src/fe-common/irc/Makefile.am1
-rw-r--r--src/fe-common/irc/dcc/module.h1
-rw-r--r--src/fe-common/irc/fe-ctcp.c1
-rw-r--r--src/fe-common/irc/fe-events-numeric.c5
-rw-r--r--src/fe-common/irc/fe-events.c7
-rw-r--r--src/fe-common/irc/fe-irc-channels.c15
-rw-r--r--src/fe-common/irc/fe-irc-commands.c89
-rw-r--r--src/fe-common/irc/fe-irc-messages.c2
-rw-r--r--src/fe-common/irc/fe-irc-queries.c2
-rw-r--r--src/fe-common/irc/fe-ircnet.c2
-rw-r--r--src/fe-common/irc/fe-modes.c1
-rw-r--r--src/fe-common/irc/fe-netjoin.c1
-rw-r--r--src/fe-common/irc/fe-netsplit.c8
-rw-r--r--src/fe-common/irc/module-formats.c2
-rw-r--r--src/fe-common/irc/module-formats.h2
-rw-r--r--src/fe-common/irc/module.h1
-rw-r--r--src/fe-common/irc/notifylist/module.h1
17 files changed, 39 insertions, 102 deletions
diff --git a/src/fe-common/irc/Makefile.am b/src/fe-common/irc/Makefile.am
index c3e5ce04..08d56540 100644
--- a/src/fe-common/irc/Makefile.am
+++ b/src/fe-common/irc/Makefile.am
@@ -29,6 +29,5 @@ libfe_common_irc_a_SOURCES = \
module-formats.c
noinst_HEADERS = \
- fe-common-irc.h \
module.h \
module-formats.h
diff --git a/src/fe-common/irc/dcc/module.h b/src/fe-common/irc/dcc/module.h
index 966a37cb..58e65b25 100644
--- a/src/fe-common/irc/dcc/module.h
+++ b/src/fe-common/irc/dcc/module.h
@@ -1,3 +1,4 @@
#include "common.h"
+#include "irc.h"
#define MODULE_NAME "fe-common/irc/dcc"
diff --git a/src/fe-common/irc/fe-ctcp.c b/src/fe-common/irc/fe-ctcp.c
index 0af453b6..f8f9c554 100644
--- a/src/fe-common/irc/fe-ctcp.c
+++ b/src/fe-common/irc/fe-ctcp.c
@@ -23,7 +23,6 @@
#include "misc.h"
#include "settings.h"
-#include "irc.h"
#include "levels.h"
#include "servers.h"
#include "channels.h"
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index a39ff18d..8f0c5da8 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -23,10 +23,9 @@
#include "signals.h"
#include "misc.h"
#include "settings.h"
-
-#include "irc.h"
#include "levels.h"
-#include "servers.h"
+
+#include "irc-servers.h"
#include "irc-channels.h"
#include "nicklist.h"
diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c
index ccf5b0bc..97b505fb 100644
--- a/src/fe-common/irc/fe-events.c
+++ b/src/fe-common/irc/fe-events.c
@@ -24,7 +24,6 @@
#include "misc.h"
#include "settings.h"
-#include "irc.h"
#include "levels.h"
#include "servers.h"
#include "servers-redirect.h"
@@ -32,12 +31,14 @@
#include "queries.h"
#include "ignore.h"
-#include "fe-queries.h"
+#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-nicklist.h"
#include "irc-masks.h"
-#include "fe-windows.h"
+
#include "printtext.h"
+#include "fe-queries.h"
+#include "fe-windows.h"
#include "completion.h"
diff --git a/src/fe-common/irc/fe-irc-channels.c b/src/fe-common/irc/fe-irc-channels.c
index ef9a79b8..853fe587 100644
--- a/src/fe-common/irc/fe-irc-channels.c
+++ b/src/fe-common/irc/fe-irc-channels.c
@@ -21,16 +21,13 @@
#include "module.h"
#include "module-formats.h"
#include "signals.h"
-#include "commands.h"
#include "levels.h"
-#include "servers.h"
-#include "irc.h"
#include "channel-rejoin.h"
#include "printtext.h"
-static void sig_channel_rejoin(IRC_SERVER_REC *server, REJOIN_REC *rec)
+static void sig_channel_rejoin(SERVER_REC *server, REJOIN_REC *rec)
{
g_return_if_fail(rec != NULL);
@@ -38,22 +35,12 @@ static void sig_channel_rejoin(IRC_SERVER_REC *server, REJOIN_REC *rec)
IRCTXT_CHANNEL_REJOIN, rec->channel);
}
-static void cmd_channel(const char *data, SERVER_REC *server)
-{
- if (ischannel(*data)) {
- signal_emit("command join", 2, data, server);
- signal_stop();
- }
-}
-
void fe_irc_channels_init(void)
{
signal_add("channel rejoin new", (SIGNAL_FUNC) sig_channel_rejoin);
- command_bind("channel", NULL, (SIGNAL_FUNC) cmd_channel);
}
void fe_irc_channels_deinit(void)
{
signal_remove("channel rejoin new", (SIGNAL_FUNC) sig_channel_rejoin);
- command_unbind("channel", (SIGNAL_FUNC) cmd_channel);
}
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c
index f69e0500..dd100e39 100644
--- a/src/fe-common/irc/fe-irc-commands.c
+++ b/src/fe-common/irc/fe-irc-commands.c
@@ -21,16 +21,16 @@
#include "module.h"
#include "module-formats.h"
#include "signals.h"
-#include "commands.h"
#include "misc.h"
#include "special-vars.h"
#include "settings.h"
#include "levels.h"
-#include "irc.h"
#include "servers.h"
#include "mode-lists.h"
#include "nicklist.h"
+#include "irc-commands.h"
+#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-queries.h"
@@ -56,8 +56,7 @@ static char *skip_target(char *target)
/* SYNTAX: ME <message> */
static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
- g_return_if_fail(data != NULL);
-
+ CMD_IRC_SERVER(server);
if (!IS_IRC_ITEM(item))
return;
@@ -76,9 +75,7 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server)
char *target, *text;
void *free_arg;
- g_return_if_fail(data != NULL);
- if (server == NULL || !server->connected)
- cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &text))
@@ -98,9 +95,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server)
char *target, *msg;
void *free_arg;
- g_return_if_fail(data != NULL);
- if (server == NULL || !server->connected)
- cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &msg))
@@ -118,9 +113,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server)
char *target, *ctcpcmd, *ctcpdata;
void *free_arg;
- g_return_if_fail(data != NULL);
- if (server == NULL || !server->connected)
- cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
&target, &ctcpcmd, &ctcpdata))
@@ -148,9 +141,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server)
char *target, *text;
void *free_arg;
- g_return_if_fail(data != NULL);
- if (server == NULL || !server->connected)
- cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &text))
@@ -170,9 +161,7 @@ static void cmd_wall(const char *data, IRC_SERVER_REC *server,
char *channame, *msg;
void *free_arg;
- g_return_if_fail(data != NULL);
- if (server == NULL || !server->connected || !IS_IRC_SERVER(server))
- cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN |
PARAM_FLAG_GETREST, item, &channame, &msg))
@@ -249,9 +238,7 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server,
char *channel, *nicks;
void *free_arg;
- g_return_if_fail(data != NULL);
- if (server == NULL || !server->connected)
- cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2 |
PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
@@ -290,8 +277,7 @@ static void cmd_invitelist(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC
IRC_CHANNEL_REC *channel, *cur_channel;
GSList *tmp;
- g_return_if_fail(data != NULL);
- if (server == NULL || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
cur_channel = IRC_CHANNEL(item);
if (cur_channel == NULL) cmd_return_error(CMDERR_NOT_JOINED);
@@ -317,28 +303,6 @@ static void cmd_invitelist(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC
}
}
-static void cmd_join(const char *data, IRC_SERVER_REC *server)
-{
- if ((*data == '\0' || g_strncasecmp(data, "-invite", 7) == 0) &&
- server != NULL && server->last_invite == NULL) {
- printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NOT_INVITED);
- signal_stop();
- }
-}
-
-static void cmd_nick(const char *data, IRC_SERVER_REC *server)
-{
- g_return_if_fail(data != NULL);
-
- if (*data != '\0') return;
- if (server == NULL || !server->connected)
- cmd_return_error(CMDERR_NOT_CONNECTED);
-
- /* display current nick */
- printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_YOUR_NICK, server->nick);
- signal_stop();
-}
-
/* SYNTAX: VER [<target>] */
static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
@@ -346,8 +310,7 @@ static void cmd_ver(gchar *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
g_return_if_fail(data != NULL);
- if (!IS_IRC_SERVER(server) || !server->connected)
- cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
if (*data == '\0' && !IS_IRC_ITEM(item))
cmd_return_error(CMDERR_NOT_JOINED);
@@ -465,21 +428,19 @@ static void cmd_sethost(const char *data, IRC_SERVER_REC *server)
void fe_irc_commands_init(void)
{
- command_bind_last("me", NULL, (SIGNAL_FUNC) cmd_me);
- command_bind_last("action", NULL, (SIGNAL_FUNC) cmd_action);
- command_bind("notice", NULL, (SIGNAL_FUNC) cmd_notice);
- command_bind("ctcp", NULL, (SIGNAL_FUNC) cmd_ctcp);
- command_bind("nctcp", NULL, (SIGNAL_FUNC) cmd_nctcp);
- command_bind("wall", NULL, (SIGNAL_FUNC) cmd_wall);
- command_bind("ban", NULL, (SIGNAL_FUNC) cmd_ban);
- command_bind("invitelist", NULL, (SIGNAL_FUNC) cmd_invitelist);
- command_bind("join", NULL, (SIGNAL_FUNC) cmd_join);
- command_bind("nick", NULL, (SIGNAL_FUNC) cmd_nick);
- command_bind("ver", NULL, (SIGNAL_FUNC) cmd_ver);
- command_bind("topic", NULL, (SIGNAL_FUNC) cmd_topic);
- command_bind("ts", NULL, (SIGNAL_FUNC) cmd_ts);
- command_bind("oper", NULL, (SIGNAL_FUNC) cmd_oper);
- command_bind("sethost", NULL, (SIGNAL_FUNC) cmd_sethost);
+ command_bind_irc_last("me", NULL, (SIGNAL_FUNC) cmd_me);
+ command_bind_irc_last("action", NULL, (SIGNAL_FUNC) cmd_action);
+ command_bind_irc("notice", NULL, (SIGNAL_FUNC) cmd_notice);
+ command_bind_irc("ctcp", NULL, (SIGNAL_FUNC) cmd_ctcp);
+ command_bind_irc("nctcp", NULL, (SIGNAL_FUNC) cmd_nctcp);
+ command_bind_irc("wall", NULL, (SIGNAL_FUNC) cmd_wall);
+ command_bind_irc("ban", NULL, (SIGNAL_FUNC) cmd_ban);
+ command_bind_irc("invitelist", NULL, (SIGNAL_FUNC) cmd_invitelist);
+ command_bind_irc("ver", NULL, (SIGNAL_FUNC) cmd_ver);
+ command_bind_irc("topic", NULL, (SIGNAL_FUNC) cmd_topic);
+ command_bind_irc("ts", NULL, (SIGNAL_FUNC) cmd_ts);
+ command_bind_irc("oper", NULL, (SIGNAL_FUNC) cmd_oper);
+ command_bind_irc("sethost", NULL, (SIGNAL_FUNC) cmd_sethost);
}
void fe_irc_commands_deinit(void)
@@ -492,8 +453,6 @@ void fe_irc_commands_deinit(void)
command_unbind("wall", (SIGNAL_FUNC) cmd_wall);
command_unbind("ban", (SIGNAL_FUNC) cmd_ban);
command_unbind("invitelist", (SIGNAL_FUNC) cmd_invitelist);
- command_unbind("join", (SIGNAL_FUNC) cmd_join);
- command_unbind("nick", (SIGNAL_FUNC) cmd_nick);
command_unbind("ver", (SIGNAL_FUNC) cmd_ver);
command_unbind("topic", (SIGNAL_FUNC) cmd_topic);
command_unbind("ts", (SIGNAL_FUNC) cmd_ts);
diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c
index 8bd49bcb..4ee37ec7 100644
--- a/src/fe-common/irc/fe-irc-messages.c
+++ b/src/fe-common/irc/fe-irc-messages.c
@@ -25,7 +25,7 @@
#include "ignore.h"
#include "settings.h"
-#include "irc.h"
+#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-queries.h"
diff --git a/src/fe-common/irc/fe-irc-queries.c b/src/fe-common/irc/fe-irc-queries.c
index 58cc9a48..d2e4a5c5 100644
--- a/src/fe-common/irc/fe-irc-queries.c
+++ b/src/fe-common/irc/fe-irc-queries.c
@@ -24,8 +24,6 @@
#include "queries.h"
#include "nicklist.h"
-#include "irc.h"
-
static QUERY_REC *query_find_address(SERVER_REC *server, const char *address)
{
GSList *tmp;
diff --git a/src/fe-common/irc/fe-ircnet.c b/src/fe-common/irc/fe-ircnet.c
index 54a1b6da..3f84e98e 100644
--- a/src/fe-common/irc/fe-ircnet.c
+++ b/src/fe-common/irc/fe-ircnet.c
@@ -165,7 +165,7 @@ static void cmd_ircnet_remove(const char *data)
}
}
-static void cmd_ircnet(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
+static void cmd_ircnet(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
{
if (*data == '\0')
cmd_ircnet_list();
diff --git a/src/fe-common/irc/fe-modes.c b/src/fe-common/irc/fe-modes.c
index fbebe3a3..722db2e0 100644
--- a/src/fe-common/irc/fe-modes.c
+++ b/src/fe-common/irc/fe-modes.c
@@ -25,7 +25,6 @@
#include "misc.h"
#include "settings.h"
-#include "irc.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "modes.h"
diff --git a/src/fe-common/irc/fe-netjoin.c b/src/fe-common/irc/fe-netjoin.c
index f0e8d93c..ef10c72a 100644
--- a/src/fe-common/irc/fe-netjoin.c
+++ b/src/fe-common/irc/fe-netjoin.c
@@ -25,7 +25,6 @@
#include "misc.h"
#include "settings.h"
-#include "irc.h"
#include "irc-servers.h"
#include "modes.h"
#include "ignore.h"
diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c
index 11c586ee..300d3e43 100644
--- a/src/fe-common/irc/fe-netsplit.c
+++ b/src/fe-common/irc/fe-netsplit.c
@@ -21,12 +21,11 @@
#include "module.h"
#include "module-formats.h"
#include "signals.h"
-#include "commands.h"
#include "levels.h"
#include "settings.h"
-#include "irc.h"
#include "irc-servers.h"
+#include "irc-commands.h"
#include "ignore.h"
#include "netsplit.h"
@@ -322,8 +321,7 @@ static void cmd_netsplit(const char *data, IRC_SERVER_REC *server)
{
GSList *list;
- if (!IS_IRC_SERVER(server) || !server->connected)
- cmd_return_error(CMDERR_NOT_CONNECTED);
+ CMD_IRC_SERVER(server);
if (server->split_servers == NULL) {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
@@ -360,7 +358,7 @@ void fe_netsplit_init(void)
read_settings();
signal_add("netsplit new", (SIGNAL_FUNC) sig_netsplit_servers);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
- command_bind("netsplit", NULL, (SIGNAL_FUNC) cmd_netsplit);
+ command_bind_irc("netsplit", NULL, (SIGNAL_FUNC) cmd_netsplit);
}
void fe_netsplit_deinit(void)
diff --git a/src/fe-common/irc/module-formats.c b/src/fe-common/irc/module-formats.c
index d3f39b72..d96838da 100644
--- a/src/fe-common/irc/module-formats.c
+++ b/src/fe-common/irc/module-formats.c
@@ -58,7 +58,6 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "joinerror_duplicate", "Channel {channel $0} already exists - cannot create it", 1, { 0 } },
{ "channel_rejoin", "Channel {channel $0} is temporarily unavailable, this is normally because of netsplits. Irssi will now automatically try to rejoin back to this channel until the join is successful. Use /RMREJOINS command if you wish to abort this.", 1, { 0 } },
{ "inviting", "Inviting {nick $0} to {channel $1}", 2, { 0, 0 } },
- { "not_invited", "You have not been invited to a channel!", 0 },
{ "channel_created", "Channel {channelhilight $0} created $1", 2, { 0, 0 } },
{ "url", "Home page for {channelhilight $0}: $1", 2, { 0, 0 } },
{ "topic", "Topic for {channelhilight $0}: $1", 2, { 0, 0 } },
@@ -87,7 +86,6 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "unaway", "You are no longer marked as being away", 0 },
{ "nick_away", "{nick $0} is away: $1", 2, { 0, 0 } },
{ "no_such_nick", "{nick $0}: No such nick/channel", 1, { 0 } },
- { "your_nick", "Your nickname is {nick $0}", 1, { 0 } },
{ "nick_in_use", "Nick {nick $0} is already in use", 1, { 0 } },
{ "nick_unavailable", "Nick {nick $0} is temporarily unavailable", 1, { 0 } },
{ "your_nick_owned", "Your nick is owned by {nick $3} {comment $1@$2}", 4, { 0, 0, 0, 0 } },
diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h
index 4cdba2d3..508efb51 100644
--- a/src/fe-common/irc/module-formats.h
+++ b/src/fe-common/irc/module-formats.h
@@ -35,7 +35,6 @@ enum {
IRCTXT_JOINERROR_DUPLICATE,
IRCTXT_CHANNEL_REJOIN,
IRCTXT_INVITING,
- IRCTXT_NOT_INVITED,
IRCTXT_CHANNEL_CREATED,
IRCTXT_CHANNEL_URL,
IRCTXT_TOPIC,
@@ -63,7 +62,6 @@ enum {
IRCTXT_UNAWAY,
IRCTXT_NICK_AWAY,
IRCTXT_NO_SUCH_NICK,
- IRCTXT_YOUR_NICK,
IRCTXT_NICK_IN_USE,
IRCTXT_NICK_UNAVAILABLE,
IRCTXT_YOUR_NICK_OWNED,
diff --git a/src/fe-common/irc/module.h b/src/fe-common/irc/module.h
index e1cc2773..9583b81b 100644
--- a/src/fe-common/irc/module.h
+++ b/src/fe-common/irc/module.h
@@ -1,3 +1,4 @@
#include "common.h"
+#include "irc.h"
#define MODULE_NAME "fe-common/irc"
diff --git a/src/fe-common/irc/notifylist/module.h b/src/fe-common/irc/notifylist/module.h
index 00aa01e3..3c74a998 100644
--- a/src/fe-common/irc/notifylist/module.h
+++ b/src/fe-common/irc/notifylist/module.h
@@ -1,3 +1,4 @@
#include "common.h"
+#include "irc.h"
#define MODULE_NAME "fe-common/irc/notifylist"