Moved some stuff from irc to core. Added command_bind_proto() function to

bind protocol-specific commands. Added #define command_bind_irc() for easier
access. CMD_IRC_SERVER(server) check should be done at the beginning of each
command requiring IRC server as active server, it handles it correctly the
cases when it is not. Did some other cleanups as well.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1955 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-11-02 01:05:14 +00:00 committed by cras
commit f354fe54c7
70 changed files with 381 additions and 438 deletions

View file

@ -21,7 +21,6 @@ libirc_core_a_SOURCES = \
irc-masks.c \
irc-nicklist.c \
irc-queries.c \
irc-rawlog.c \
irc-servers.c \
irc-servers-reconnect.c \
irc-servers-setup.c \

View file

@ -20,14 +20,15 @@
#include "module.h"
#include "signals.h"
#include "commands.h"
#include "misc.h"
#include "settings.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-masks.h"
#include "irc-commands.h"
#include "modes.h"
#include "mode-lists.h"
#include "irc.h"
#include "nicklist.h"
#define BAN_TYPE_NORMAL (IRC_MASK_USER | IRC_MASK_DOMAIN)
@ -253,6 +254,8 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server, void *item)
int ban_type;
void *free_arg;
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 1 |
PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
"ban", &optlist, &ban))
@ -285,12 +288,14 @@ static void cmd_unban(const char *data, IRC_SERVER_REC *server, void *item)
GHashTable *optlist;
char *ban;
void *free_arg;
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 1 |
PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
"unban", &optlist, &ban))
return;
ban = NULL;
if (g_hash_table_lookup(optlist, "first") != NULL)
ban = g_strdup(BAN_FIRST);
@ -326,8 +331,8 @@ void bans_init(void)
default_ban_type_str = NULL;
settings_add_str("misc", "ban_type", "normal");
command_bind("ban", NULL, (SIGNAL_FUNC) cmd_ban);
command_bind("unban", NULL, (SIGNAL_FUNC) cmd_unban);
command_bind_irc("ban", NULL, (SIGNAL_FUNC) cmd_ban);
command_bind_irc("unban", NULL, (SIGNAL_FUNC) cmd_unban);
command_set_options("ban", "normal user host domain +custom");
command_set_options("unban", "first last");

View file

@ -1,8 +1,6 @@
#ifndef __BANS_H
#define __BANS_H
#include "irc-channels.h"
void bans_init(void);
void bans_deinit(void);

View file

@ -23,7 +23,7 @@
#include "misc.h"
#include "channels-setup.h"
#include "irc.h"
#include "irc-servers.h"
#include "irc-channels.h"
static void event_cannot_join(IRC_SERVER_REC *server, const char *data)

View file

@ -23,8 +23,9 @@
#include "signals.h"
#include "misc.h"
#include "irc.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-commands.h"
#include "channel-rejoin.h"
#define REJOIN_TIMEOUT (1000*60*5) /* try to rejoin every 5 minutes */
@ -241,8 +242,7 @@ static int sig_rejoin(void)
static void cmd_rmrejoins(const char *data, IRC_SERVER_REC *server)
{
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
while (server->rejoin_channels != NULL)
rejoin_destroy(server, server->rejoin_channels->data);
@ -253,7 +253,7 @@ void channel_rejoin_init(void)
rejoin_tag = g_timeout_add(REJOIN_TIMEOUT,
(GSourceFunc) sig_rejoin, NULL);
command_bind("rmrejoins", NULL, (SIGNAL_FUNC) cmd_rmrejoins);
command_bind_irc("rmrejoins", NULL, (SIGNAL_FUNC) cmd_rmrejoins);
signal_add_first("event 407", (SIGNAL_FUNC) event_duplicate_channel);
signal_add_first("event 437", (SIGNAL_FUNC) event_target_unavailable);
signal_add_first("channel joined", (SIGNAL_FUNC) sig_remove_rejoin);

View file

@ -43,12 +43,11 @@ loop:
#include "signals.h"
#include "settings.h"
#include "channels.h"
#include "irc.h"
#include "modes.h"
#include "mode-lists.h"
#include "nicklist.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "servers-redirect.h"
enum {

View file

@ -25,7 +25,6 @@
#include "special-vars.h"
#include "settings.h"
#include "irc.h"
#include "irc-servers.h"
#include "server-idle.h"
#include "ignore.h"

View file

@ -24,10 +24,10 @@
#include "levels.h"
#include "channels-setup.h"
#include "irc.h"
#include "bans.h"
#include "modes.h"
#include "mode-lists.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-nicklist.h"
#include "channel-rejoin.h"

View file

@ -3,7 +3,6 @@
#include "chat-protocols.h"
#include "channels.h"
#include "irc-servers.h"
/* Returns IRC_CHANNEL_REC if it's IRC channel, NULL if it isn't. */
#define IRC_CHANNEL(channel) \
@ -13,7 +12,7 @@
(IRC_CHANNEL(channel) ? TRUE : FALSE)
#define STRUCT_SERVER_REC IRC_SERVER_REC
typedef struct {
struct _IRC_CHANNEL_REC {
#include "channel-rec.h"
GSList *banlist; /* list of bans */
@ -23,7 +22,7 @@ typedef struct {
time_t massjoin_start; /* Massjoin start time */
int massjoins; /* Number of nicks waiting for massjoin signal.. */
int last_massjoins; /* Massjoins when last checked in timeout function */
} IRC_CHANNEL_REC;
};
void irc_channels_init(void);
void irc_channels_deinit(void);

View file

@ -14,7 +14,7 @@
#define IS_IRCNET(ircnet) IS_IRC_CHATNET(ircnet)
#define IRCNET(ircnet) IRC_CHATNET(ircnet)
typedef struct {
struct _IRC_CHATNET_REC {
#include "chatnet-rec.h"
int max_cmds_at_once;
int cmd_queue_speed;
@ -23,7 +23,7 @@ typedef struct {
/* max. number of kicks/msgs/mode/whois per command */
int max_kicks, max_msgs, max_modes, max_whois;
} IRC_CHATNET_REC;
};
void ircnet_create(IRC_CHATNET_REC *rec);

View file

@ -19,7 +19,6 @@
*/
#include "module.h"
#include "commands.h"
#include "misc.h"
#include "special-vars.h"
#include "settings.h"
@ -31,7 +30,7 @@
#include "nicklist.h"
#include "bans.h"
#include "irc.h"
#include "irc-commands.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-queries.h"
@ -65,9 +64,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 (!IS_IRC_SERVER(server) || !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))
return;
@ -85,9 +82,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 (!IS_IRC_SERVER(server) || !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))
return;
@ -109,9 +104,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server)
char *target, *ctcpcmd, *ctcpdata;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !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))
return;
@ -130,9 +123,7 @@ static void cmd_part(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item
char *channame, *msg;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !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, item, &channame, &msg))
return;
@ -155,9 +146,7 @@ static void cmd_kick(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item
char *channame, *nicks, *reason;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
item, &channame, &nicks, &reason))
@ -179,9 +168,7 @@ static void cmd_topic(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *ite
char *channame, *topic;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !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_OPTIONS | PARAM_FLAG_GETREST,
@ -201,9 +188,7 @@ static void cmd_invite(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *it
char *nick, *channame;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2, &nick, &channame))
return;
@ -228,9 +213,7 @@ static void cmd_list(const char *data, IRC_SERVER_REC *server,
char *str;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
PARAM_FLAG_GETREST, "list", &optlist, &str))
@ -255,9 +238,7 @@ static void cmd_who(const char *data, IRC_SERVER_REC *server,
char *channel, *rest;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &channel, &rest))
return;
@ -288,9 +269,7 @@ static void cmd_names(const char *data, IRC_SERVER_REC *server,
char *channel;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
PARAM_FLAG_GETREST, "names", &optlist, &channel))
@ -321,8 +300,7 @@ static void cmd_nick(const char *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 (!cmd_get_params(data, &free_arg, 1, &nick))
return;
@ -392,9 +370,7 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
void *free_arg;
int free_nick;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS,
"whois", &optlist, &qserver, &query))
@ -480,9 +456,7 @@ static void cmd_whowas(const char *data, IRC_SERVER_REC *server)
void *free_arg;
int free_nick;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2, &nicks, &count))
return;
@ -506,9 +480,7 @@ static void cmd_ping(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item
GTimeVal tv;
char *str;
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' || strcmp(data, "*") == 0) {
if (!IS_IRC_ITEM(item))
@ -545,9 +517,7 @@ static void cmd_away(const char *data, IRC_SERVER_REC *server)
char *reason;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
PARAM_FLAG_GETREST, "away", &optlist, &reason)) return;
@ -560,23 +530,10 @@ static void cmd_away(const char *data, IRC_SERVER_REC *server)
cmd_params_free(free_arg);
}
/* SYNTAX: DEOP <nicks> */
static void cmd_deop(const char *data, IRC_SERVER_REC *server)
{
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (*data == '\0')
irc_send_cmdv(server, "MODE %s -o", server->nick);
}
/* SYNTAX: SCONNECT <new server> [[<port>] <existing server>] */
static void cmd_sconnect(const char *data, IRC_SERVER_REC *server)
{
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') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
irc_send_cmdv(server, "CONNECT %s", data);
@ -585,9 +542,7 @@ static void cmd_sconnect(const char *data, IRC_SERVER_REC *server)
/* SYNTAX: QUOTE <data> */
static void cmd_quote(const char *data, IRC_SERVER_REC *server)
{
g_return_if_fail(data != NULL);
if (server == NULL || !IS_IRC_SERVER(server))
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
irc_send_cmd(server, data);
}
@ -595,9 +550,7 @@ static void cmd_quote(const char *data, IRC_SERVER_REC *server)
/* SYNTAX: RAWQUOTE <data> */
static void cmd_rawquote(const char *data, IRC_SERVER_REC *server)
{
g_return_if_fail(data != NULL);
if (server == NULL || !IS_IRC_SERVER(server))
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
irc_send_cmd_full(server, data, FALSE, FALSE, TRUE);
}
@ -615,9 +568,7 @@ static void cmd_wait(const char *data, IRC_SERVER_REC *server)
void *free_arg;
int n;
g_return_if_fail(data != NULL);
if (!IS_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
PARAM_FLAG_UNKNOWN_OPTIONS | PARAM_FLAG_GETREST,
@ -652,9 +603,7 @@ static void cmd_wall(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item
IRC_CHANNEL_REC *chanrec;
GSList *tmp, *nicks;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !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, item, &channame, &msg))
@ -694,9 +643,7 @@ static void cmd_kickban(const char *data, IRC_SERVER_REC *server,
char **nicklist, *spacenicks;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
item, &channel, &nicks, &reason))
@ -784,7 +731,8 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
void *free_arg;
int timeleft;
g_return_if_fail(data != NULL);
CMD_IRC_SERVER(server);
if (!IS_IRC_CHANNEL(channel))
cmd_return_error(CMDERR_NOT_JOINED);
if (!channel->wholist)
@ -850,9 +798,7 @@ static void cmd_server_purge(const char *data, IRC_SERVER_REC *server)
char *target;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 1, &target))
return;
@ -897,9 +843,7 @@ static void cmd_oper(const char *data, IRC_SERVER_REC *server)
char *nick, *password;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
/* asking for password is handled by fe-common */
if (!cmd_get_params(data, &free_arg, 2, &nick, &password))
@ -913,9 +857,7 @@ static void cmd_oper(const char *data, IRC_SERVER_REC *server)
/* SYNTAX: UNSILENCE <nick!user@host> */
static void cmd_unsilence(const char *data, IRC_SERVER_REC *server)
{
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')
cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
@ -925,9 +867,7 @@ static void cmd_unsilence(const char *data, IRC_SERVER_REC *server)
static void command_self(const char *data, IRC_SERVER_REC *server)
{
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
CMD_IRC_SERVER(server);
irc_send_cmdv(server, *data == '\0' ? "%s" : "%s %s", current_command, data);
}
@ -947,9 +887,7 @@ static void command_2self(const char *data, IRC_SERVER_REC *server)
char *target, *text;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !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))
return;
@ -1011,85 +949,84 @@ void irc_commands_init(void)
knockout_tag = g_timeout_add(KNOCKOUT_TIMECHECK, (GSourceFunc) knockout_timeout, NULL);
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("part", NULL, (SIGNAL_FUNC) cmd_part);
command_bind("kick", NULL, (SIGNAL_FUNC) cmd_kick);
command_bind("topic", NULL, (SIGNAL_FUNC) cmd_topic);
command_bind("invite", NULL, (SIGNAL_FUNC) cmd_invite);
command_bind("list", NULL, (SIGNAL_FUNC) cmd_list);
command_bind("who", NULL, (SIGNAL_FUNC) cmd_who);
command_bind("names", NULL, (SIGNAL_FUNC) cmd_names);
command_bind("nick", NULL, (SIGNAL_FUNC) cmd_nick);
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("part", NULL, (SIGNAL_FUNC) cmd_part);
command_bind_irc("kick", NULL, (SIGNAL_FUNC) cmd_kick);
command_bind_irc("topic", NULL, (SIGNAL_FUNC) cmd_topic);
command_bind_irc("invite", NULL, (SIGNAL_FUNC) cmd_invite);
command_bind_irc("list", NULL, (SIGNAL_FUNC) cmd_list);
command_bind_irc("who", NULL, (SIGNAL_FUNC) cmd_who);
command_bind_irc("names", NULL, (SIGNAL_FUNC) cmd_names);
command_bind_irc("nick", NULL, (SIGNAL_FUNC) cmd_nick);
/* SYNTAX: NOTE <command> [&<password>] [+|-<flags>] [<arguments>] */
command_bind("note", NULL, (SIGNAL_FUNC) command_self);
command_bind("whois", NULL, (SIGNAL_FUNC) cmd_whois);
command_bind("whowas", NULL, (SIGNAL_FUNC) cmd_whowas);
command_bind("ping", NULL, (SIGNAL_FUNC) cmd_ping);
command_bind_irc("note", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("whois", NULL, (SIGNAL_FUNC) cmd_whois);
command_bind_irc("whowas", NULL, (SIGNAL_FUNC) cmd_whowas);
command_bind_irc("ping", NULL, (SIGNAL_FUNC) cmd_ping);
/* SYNTAX: KILL <nick> <reason> */
command_bind("kill", NULL, (SIGNAL_FUNC) command_2self);
command_bind("away", NULL, (SIGNAL_FUNC) cmd_away);
command_bind_irc("kill", NULL, (SIGNAL_FUNC) command_2self);
command_bind_irc("away", NULL, (SIGNAL_FUNC) cmd_away);
/* SYNTAX: ISON <nicks> */
command_bind("ison", NULL, (SIGNAL_FUNC) command_1self);
command_bind_irc("ison", NULL, (SIGNAL_FUNC) command_1self);
/* SYNTAX: ADMIN [<server>|<nickname>] */
command_bind("admin", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("admin", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: INFO [<server>] */
command_bind("info", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("info", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: LINKS [[<server>] <mask>] */
command_bind("links", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("links", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: LUSERS [<server mask> [<remote server>]] */
command_bind("lusers", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("lusers", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: MAP */
command_bind("map", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("map", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: MOTD [<server>|<nick>] */
command_bind("motd", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("motd", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: REHASH */
command_bind("rehash", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("rehash", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: STATS <type> [<server>] */
command_bind("stats", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("stats", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: TIME [<server>|<nick>] */
command_bind("time", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("time", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: TRACE [<server>|<nick>] */
command_bind("trace", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("trace", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: VERSION [<server>|<nick>] */
command_bind("version", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("version", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: SERVLIST [<server mask>] */
command_bind("servlist", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("servlist", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: SILENCE [[+|-]<nick!user@host>]
SILENCE [<nick>] */
command_bind("silence", NULL, (SIGNAL_FUNC) command_self);
command_bind("unsilence", NULL, (SIGNAL_FUNC) cmd_unsilence);
command_bind("sconnect", NULL, (SIGNAL_FUNC) cmd_sconnect);
command_bind_irc("silence", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("unsilence", NULL, (SIGNAL_FUNC) cmd_unsilence);
command_bind_irc("sconnect", NULL, (SIGNAL_FUNC) cmd_sconnect);
/* SYNTAX: SQUERY <service> [<commands>] */
command_bind("squery", NULL, (SIGNAL_FUNC) command_2self);
command_bind("deop", NULL, (SIGNAL_FUNC) cmd_deop);
command_bind_irc("squery", NULL, (SIGNAL_FUNC) command_2self);
/* SYNTAX: DIE */
command_bind("die", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("die", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: HASH */
command_bind("hash", NULL, (SIGNAL_FUNC) command_self);
command_bind("oper", NULL, (SIGNAL_FUNC) cmd_oper);
command_bind_irc("hash", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("oper", NULL, (SIGNAL_FUNC) cmd_oper);
/* SYNTAX: RESTART */
command_bind("restart", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("restart", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: RPING <server> */
command_bind("rping", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("rping", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: SQUIT <server>|<mask> <reason> */
command_bind("squit", NULL, (SIGNAL_FUNC) command_2self);
command_bind_irc("squit", NULL, (SIGNAL_FUNC) command_2self);
/* SYNTAX: UPING <server> */
command_bind("uping", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("uping", NULL, (SIGNAL_FUNC) command_self);
/* SYNTAX: USERHOST <nicks> */
command_bind("userhost", NULL, (SIGNAL_FUNC) command_self);
command_bind("quote", NULL, (SIGNAL_FUNC) cmd_quote);
command_bind("rawquote", NULL, (SIGNAL_FUNC) cmd_rawquote);
command_bind("wall", NULL, (SIGNAL_FUNC) cmd_wall);
command_bind("wait", NULL, (SIGNAL_FUNC) cmd_wait);
command_bind_irc("userhost", NULL, (SIGNAL_FUNC) command_self);
command_bind_irc("quote", NULL, (SIGNAL_FUNC) cmd_quote);
command_bind_irc("rawquote", NULL, (SIGNAL_FUNC) cmd_rawquote);
command_bind_irc("wall", NULL, (SIGNAL_FUNC) cmd_wall);
command_bind_irc("wait", NULL, (SIGNAL_FUNC) cmd_wait);
/* SYNTAX: WALLOPS <message> */
command_bind("wallops", NULL, (SIGNAL_FUNC) command_1self);
command_bind_irc("wallops", NULL, (SIGNAL_FUNC) command_1self);
/* SYNTAX: WALLCHOPS <channel> <message> */
command_bind("wallchops", NULL, (SIGNAL_FUNC) command_2self);
command_bind("kickban", NULL, (SIGNAL_FUNC) cmd_kickban);
command_bind("knockout", NULL, (SIGNAL_FUNC) cmd_knockout);
command_bind("server purge", NULL, (SIGNAL_FUNC) cmd_server_purge);
command_bind_irc("wallchops", NULL, (SIGNAL_FUNC) command_2self);
command_bind_irc("kickban", NULL, (SIGNAL_FUNC) cmd_kickban);
command_bind_irc("knockout", NULL, (SIGNAL_FUNC) cmd_knockout);
command_bind_irc("server purge", NULL, (SIGNAL_FUNC) cmd_server_purge);
signal_add("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
@ -1144,7 +1081,6 @@ void irc_commands_deinit(void)
command_unbind("unsilence", (SIGNAL_FUNC) cmd_unsilence);
command_unbind("sconnect", (SIGNAL_FUNC) cmd_sconnect);
command_unbind("squery", (SIGNAL_FUNC) command_2self);
command_unbind("deop", (SIGNAL_FUNC) cmd_deop);
command_unbind("die", (SIGNAL_FUNC) command_self);
command_unbind("hash", (SIGNAL_FUNC) command_self);
command_unbind("oper", (SIGNAL_FUNC) cmd_oper);

View file

@ -0,0 +1,26 @@
#ifndef __IRC_COMMANDS_H
#define __IRC_COMMANDS_H
#include "commands.h"
#define command_bind_irc(cmd, section, signal) \
command_bind_proto(cmd, IRC_PROTOCOL, section, signal)
#define command_bind_irc_first(cmd, section, signal) \
command_bind_proto_first(cmd, IRC_PROTOCOL, section, signal)
#define command_bind_irc_last(cmd, section, signal) \
command_bind_proto_last(cmd, IRC_PROTOCOL, section, signal)
/* Simply returns if server isn't for IRC protocol. Prints ERR_NOT_CONNECTED
error if there's no server or server isn't connected yet */
#define CMD_IRC_SERVER(server) \
G_STMT_START { \
if (server != NULL && !IS_IRC_SERVER(server)) \
return; \
if (server == NULL || !(server)->connected) \
cmd_return_error(CMDERR_NOT_CONNECTED); \
} G_STMT_END
void irc_commands_init(void);
void irc_commands_deinit(void);
#endif

View file

@ -30,15 +30,9 @@
#include "channels-setup.h"
#include "ctcp.h"
#include "irc.h"
#include "irc-commands.h"
#include "netsplit.h"
void irc_commands_init(void);
void irc_commands_deinit(void);
void irc_rawlog_init(void);
void irc_rawlog_deinit(void);
void irc_expandos_init(void);
void irc_expandos_deinit(void);
@ -116,7 +110,6 @@ void irc_core_init(void)
irc_irc_init();
lag_init();
netsplit_init();
irc_rawlog_init();
irc_expandos_init();
module_register("core", "irc");
@ -127,7 +120,6 @@ void irc_core_deinit(void)
signal_emit("chat protocol deinit", 1, chat_protocol_find("IRC"));
irc_expandos_deinit();
irc_rawlog_deinit();
netsplit_deinit();
lag_deinit();
irc_commands_deinit();

View file

@ -23,7 +23,6 @@
#include "expandos.h"
#include "settings.h"
#include "irc.h"
#include "irc-servers.h"
#include "channels.h"
#include "nicklist.h"

View file

@ -21,7 +21,6 @@
#include "module.h"
#include "network.h"
#include "irc.h"
#include "irc-masks.h"
static char *get_domain_mask(char *host)

View file

@ -22,7 +22,7 @@
#include "signals.h"
#include "misc.h"
#include "irc.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-masks.h"
#include "irc-nicklist.h"

View file

@ -2,7 +2,6 @@
#define __IRC_NICKLIST_H
#include "nicklist.h"
#include "irc-channels.h"
/* Add new nick to list */
NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick,

View file

@ -22,7 +22,7 @@
#include "signals.h"
#include "misc.h"
#include "irc.h"
#include "irc-servers.h"
#include "irc-queries.h"
QUERY_REC *irc_query_create(const char *server_tag,

View file

@ -3,7 +3,6 @@
#include "chat-protocols.h"
#include "queries.h"
#include "irc-servers.h"
/* Returns IRC_QUERY_REC if it's IRC query, NULL if it isn't. */
#define IRC_QUERY(query) \

View file

@ -1,79 +0,0 @@
/*
irc-rawlog.c : irssi
Copyright (C) 1999-2000 Timo Sirainen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "module.h"
#include "rawlog.h"
#include "signals.h"
#include "misc.h"
#include "commands.h"
#include "servers.h"
#include "settings.h"
static void cmd_rawlog(const char *data, SERVER_REC *server, void *item)
{
command_runsub("rawlog", data, server, item);
}
/* SYNTAX: RAWLOG SAVE <file> */
static void cmd_rawlog_save(const char *data, SERVER_REC *server)
{
g_return_if_fail(data != NULL);
if (server == NULL || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED);
if (*data == '\0') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
rawlog_save(server->rawlog, data);
}
/* SYNTAX: RAWLOG OPEN <file> */
static void cmd_rawlog_open(const char *data, SERVER_REC *server)
{
g_return_if_fail(data != NULL);
if (server == NULL || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED);
if (*data == '\0') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
rawlog_open(server->rawlog, data);
}
/* SYNTAX: RAWLOG CLOSE */
static void cmd_rawlog_close(const char *data, SERVER_REC *server)
{
g_return_if_fail(data != NULL);
if (server == NULL || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED);
rawlog_close(server->rawlog);
}
void irc_rawlog_init(void)
{
command_bind("rawlog", NULL, (SIGNAL_FUNC) cmd_rawlog);
command_bind("rawlog save", NULL, (SIGNAL_FUNC) cmd_rawlog_save);
command_bind("rawlog open", NULL, (SIGNAL_FUNC) cmd_rawlog_open);
command_bind("rawlog close", NULL, (SIGNAL_FUNC) cmd_rawlog_close);
}
void irc_rawlog_deinit(void)
{
command_unbind("rawlog", (SIGNAL_FUNC) cmd_rawlog);
command_unbind("rawlog save", (SIGNAL_FUNC) cmd_rawlog_save);
command_unbind("rawlog open", (SIGNAL_FUNC) cmd_rawlog_open);
command_unbind("rawlog close", (SIGNAL_FUNC) cmd_rawlog_close);
}

View file

@ -23,7 +23,6 @@
#include "network.h"
#include "signals.h"
#include "irc.h"
#include "modes.h"
#include "irc-servers.h"

View file

@ -30,7 +30,6 @@
#include "channels.h"
#include "queries.h"
#include "irc.h"
#include "irc-servers-setup.h"
#include "irc-servers.h"
#include "channel-rejoin.h"

View file

@ -20,7 +20,7 @@
/* all strings should be either NULL or dynamically allocated */
/* address and nick are mandatory, rest are optional */
typedef struct {
struct _IRC_SERVER_CONNECT_REC {
#include "server-connect-rec.h"
char *usermode;
@ -31,10 +31,10 @@ typedef struct {
int max_query_chans;
int max_kicks, max_msgs, max_modes, max_whois;
} IRC_SERVER_CONNECT_REC;
};
#define STRUCT_SERVER_CONNECT_REC IRC_SERVER_CONNECT_REC
typedef struct {
struct _IRC_SERVER_REC {
#include "server-rec.h"
char *real_address; /* address the irc server gives */
@ -87,7 +87,7 @@ typedef struct {
channels go here if they're "temporarily unavailable"
because of netsplits */
void *chanqueries;
} IRC_SERVER_REC;
};
IRC_SERVER_REC *irc_server_connect(IRC_SERVER_CONNECT_REC *conn);

View file

@ -26,7 +26,6 @@
#include "rawlog.h"
#include "misc.h"
#include "irc.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "servers-redirect.h"

View file

@ -1,7 +1,10 @@
#ifndef __IRC_H
#define __IRC_H
#include "irc-servers.h"
typedef struct _IRC_CHATNET_REC IRC_CHATNET_REC;
typedef struct _IRC_SERVER_CONNECT_REC IRC_SERVER_CONNECT_REC;
typedef struct _IRC_SERVER_REC IRC_SERVER_REC;
typedef struct _IRC_CHANNEL_REC IRC_CHANNEL_REC;
/* From ircd 2.9.5:
none I line with ident
@ -26,6 +29,7 @@
(a) == '+') /* modeless */
#define IS_IRC_ITEM(rec) (IS_IRC_CHANNEL(rec) || IS_IRC_QUERY(rec))
#define IRC_PROTOCOL (chat_protocol_lookup("IRC"))
extern char *current_server_event; /* current server event being processed */

View file

@ -23,7 +23,6 @@
#include "misc.h"
#include "settings.h"
#include "irc.h"
#include "irc-servers.h"
typedef struct {

View file

@ -22,7 +22,6 @@
#include "signals.h"
#include "settings.h"
#include "irc.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-nicklist.h"

View file

@ -22,7 +22,8 @@
#include "misc.h"
#include "signals.h"
#include "irc.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "mode-lists.h"
static void ban_free(GSList **list, BAN_REC *rec)

View file

@ -1,8 +1,6 @@
#ifndef __MODE_LISTS_H
#define __MODE_LISTS_H
#include "irc-channels.h"
typedef struct {
char *ban;
char *setby;

View file

@ -20,10 +20,11 @@
#include "module.h"
#include "signals.h"
#include "commands.h"
#include "settings.h"
#include "irc.h"
#include "irc-commands.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "modes.h"
#include "mode-lists.h"
#include "nicklist.h"
@ -590,8 +591,7 @@ static void cmd_op(const char *data, IRC_SERVER_REC *server,
{
char *nicks;
if (!IS_IRC_CHANNEL(channel))
return;
CMD_IRC_SERVER(server);
nicks = get_nicks(channel, data, 0, -1);
if (nicks != NULL && *nicks != '\0')
@ -605,8 +605,7 @@ static void cmd_deop(const char *data, IRC_SERVER_REC *server,
{
char *nicks;
if (!IS_IRC_CHANNEL(channel))
return;
CMD_IRC_SERVER(server);
nicks = get_nicks(channel, data, 1, -1);
if (nicks != NULL && *nicks != '\0')
@ -620,8 +619,7 @@ static void cmd_voice(const char *data, IRC_SERVER_REC *server,
{
char *nicks;
if (!IS_IRC_CHANNEL(channel))
return;
CMD_IRC_SERVER(server);
nicks = get_nicks(channel, data, 0, 0);
if (nicks != NULL && *nicks != '\0')
@ -635,8 +633,7 @@ static void cmd_devoice(const char *data, IRC_SERVER_REC *server,
{
char *nicks;
if (!IS_IRC_CHANNEL(channel))
return;
CMD_IRC_SERVER(server);
nicks = get_nicks(channel, data, -1, 1);
if (nicks != NULL && *nicks != '\0')
@ -651,9 +648,7 @@ static void cmd_mode(const char *data, IRC_SERVER_REC *server,
char *target, *mode;
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 (*data == '+' || *data == '-') {
target = "*";
@ -692,11 +687,11 @@ void modes_init(void)
signal_add("event 381", (SIGNAL_FUNC) event_oper);
signal_add("event mode", (SIGNAL_FUNC) event_mode);
command_bind("op", NULL, (SIGNAL_FUNC) cmd_op);
command_bind("deop", NULL, (SIGNAL_FUNC) cmd_deop);
command_bind("voice", NULL, (SIGNAL_FUNC) cmd_voice);
command_bind("devoice", NULL, (SIGNAL_FUNC) cmd_devoice);
command_bind("mode", NULL, (SIGNAL_FUNC) cmd_mode);
command_bind_irc("op", NULL, (SIGNAL_FUNC) cmd_op);
command_bind_irc("deop", NULL, (SIGNAL_FUNC) cmd_deop);
command_bind_irc("voice", NULL, (SIGNAL_FUNC) cmd_voice);
command_bind_irc("devoice", NULL, (SIGNAL_FUNC) cmd_devoice);
command_bind_irc("mode", NULL, (SIGNAL_FUNC) cmd_mode);
}
void modes_deinit(void)

View file

@ -1,9 +1,6 @@
#ifndef __MODES_H
#define __MODES_H
#include "irc-servers.h"
#include "irc-channels.h"
/* modes that have argument always */
#define HAS_MODE_ARG_ALWAYS(mode) \
((mode) == 'b' || (mode) == 'e' || (mode) == 'I' || (mode) == 'k' || \

View file

@ -1,5 +1,4 @@
#include "common.h"
#include "irc.h"
#define MODULE_NAME "irc/core"
#define IRC_PROTOCOL (chat_protocol_lookup("IRC"))

View file

@ -24,7 +24,6 @@
#include "irc-servers.h"
#include "server-idle.h"
#include "servers-redirect.h"
#include "irc.h"
typedef struct {
char *event;

View file

@ -1,8 +1,6 @@
#ifndef __SERVER_IDLE_H
#define __SERVER_IDLE_H
#include "irc-servers.h"
/* Add new idle command to queue */
int server_idle_add(IRC_SERVER_REC *server, const char *cmd, const char *arg, int last, ...);

View file

@ -22,6 +22,7 @@
#include "signals.h"
#include "masks.h"
#include "settings.h"
#include "servers.h"
#include "dcc-get.h"

View file

@ -28,10 +28,10 @@
#include "misc.h"
#include "settings.h"
#include "masks.h"
#include "irc.h"
#include "servers-setup.h"
#include "irc-servers.h"
#include "irc-queries.h"
#include "servers-setup.h"
#include "masks.h"
#include "dcc-chat.h"
@ -199,7 +199,7 @@ static void cmd_msg(const char *data)
signal_stop();
}
static void cmd_me(const char *data, IRC_SERVER_REC *server, QUERY_REC *item)
static void cmd_me(const char *data, SERVER_REC *server, QUERY_REC *item)
{
CHAT_DCC_REC *dcc;
char *str;
@ -216,7 +216,7 @@ static void cmd_me(const char *data, IRC_SERVER_REC *server, QUERY_REC *item)
signal_stop();
}
static void cmd_action(const char *data, IRC_SERVER_REC *server)
static void cmd_action(const char *data, SERVER_REC *server)
{
CHAT_DCC_REC *dcc;
char *target, *text, *str;
@ -246,15 +246,13 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server)
signal_stop();
}
static void cmd_ctcp(const char *data, IRC_SERVER_REC *server)
static void cmd_ctcp(const char *data, SERVER_REC *server)
{
CHAT_DCC_REC *dcc;
char *target, *ctcpcmd, *ctcpdata, *str;
void *free_arg;
g_return_if_fail(data != NULL);
if (server == NULL || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
&target, &ctcpcmd, &ctcpdata))
@ -425,7 +423,7 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server)
}
/* start listening */
if (server == NULL || !server->connected)
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_param_error(CMDERR_NOT_CONNECTED);
handle = dcc_listen(net_sendbuffer_handle(server->handle),
@ -449,7 +447,7 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server)
}
/* SYNTAX: MIRCDCC ON|OFF */
static void cmd_mircdcc(const char *data, IRC_SERVER_REC *server,
static void cmd_mircdcc(const char *data, SERVER_REC *server,
QUERY_REC *item)
{
CHAT_DCC_REC *dcc;
@ -465,7 +463,7 @@ static void cmd_mircdcc(const char *data, IRC_SERVER_REC *server,
/* DCC CLOSE CHAT <nick> - check only from chat_ids in open DCC chats,
the default handler will check from DCC chat requests */
static void cmd_dcc_close(char *data, IRC_SERVER_REC *server)
static void cmd_dcc_close(char *data, SERVER_REC *server)
{
GSList *tmp, *next;
char *nick;
@ -488,8 +486,8 @@ static void cmd_dcc_close(char *data, IRC_SERVER_REC *server)
if (IS_DCC_CHAT(dcc) && dcc->id != NULL &&
g_strcasecmp(dcc->id, nick) == 0) {
found = TRUE;
if (!dcc_is_connected(dcc))
dcc_reject(DCC(dcc), server);
if (!dcc_is_connected(dcc) && IS_IRC_SERVER(server))
dcc_reject(DCC(dcc), IRC_SERVER(server));
else {
/* don't send DCC REJECT after DCC chat
is already open */
@ -503,7 +501,7 @@ static void cmd_dcc_close(char *data, IRC_SERVER_REC *server)
cmd_params_free(free_arg);
}
static void cmd_whois(const char *data, IRC_SERVER_REC *server,
static void cmd_whois(const char *data, SERVER_REC *server,
WI_ITEM_REC *item)
{
CHAT_DCC_REC *dcc;

View file

@ -25,7 +25,9 @@
#include "misc.h"
#include "settings.h"
#include "irc-servers.h"
#include "servers-setup.h"
#include "dcc-get.h"
static int dcc_file_create_mode;

View file

@ -26,6 +26,8 @@
#include "misc.h"
#include "settings.h"
#include "irc-servers.h"
#include "dcc-send.h"
#include "dcc-chat.h"
@ -189,6 +191,9 @@ static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server,
g_strcasecmp(target, chat->nick) != 0))
chat = NULL;
if (!IS_IRC_SERVER(server))
server = NULL;
if ((server == NULL || !server->connected) && chat == NULL)
cmd_param_error(CMDERR_NOT_CONNECTED);

View file

@ -26,7 +26,7 @@
#include "misc.h"
#include "settings.h"
#include "irc.h"
#include "irc-servers.h"
#include "dcc-chat.h"
#include "dcc-get.h"

View file

@ -3,7 +3,6 @@
#include "modules.h"
#include "network.h"
#include "irc-servers.h"
#define DCC(dcc) ((DCC_REC *) (dcc))

View file

@ -1,3 +1,4 @@
#include "common.h"
#include "irc.h"
#define MODULE_NAME "irc/dcc"

View file

@ -1,4 +1,5 @@
#include "common.h"
#include "irc.h"
typedef struct {
/* Flood protection */

View file

@ -1,4 +1,5 @@
#include "common.h"
#include "irc.h"
#define MODULE_NAME "irc/notifylist"