summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2014-01-15 23:12:35 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2014-01-15 23:12:35 +0000
commit6050eda92352c426897d0f4ffefff1e14d82a131 (patch)
tree805c366d597006c8397a09f60a395fab60547d60 /modules/core
parentb7561a82c59655512bc85214ae434eb245d5d936 (diff)
- Clean up all files in modules/ (fixed indentation, removed whitespaces/tabs)
- Fixed copyright years - Made module handlers int type for later use git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2821 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/m_die.c29
-rw-r--r--modules/core/m_error.c31
-rw-r--r--modules/core/m_join.c31
-rw-r--r--modules/core/m_kick.c49
-rw-r--r--modules/core/m_kill.c54
-rw-r--r--modules/core/m_message.c42
-rw-r--r--modules/core/m_mode.c83
-rw-r--r--modules/core/m_nick.c79
-rw-r--r--modules/core/m_part.c27
-rw-r--r--modules/core/m_quit.c26
-rw-r--r--modules/core/m_server.c132
-rw-r--r--modules/core/m_sjoin.c165
-rw-r--r--modules/core/m_squit.c44
13 files changed, 435 insertions, 357 deletions
diff --git a/modules/core/m_die.c b/modules/core/m_die.c
index b47c92c..463ccb0 100644
--- a/modules/core/m_die.c
+++ b/modules/core/m_die.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_die.c: Kills off this server.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_die.c
+ * \brief Includes required functions for processing the DIE command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -37,7 +39,7 @@
/*
* mo_die - DIE command handler
*/
-static void
+static int
mo_die(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -47,31 +49,33 @@ mo_die(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "die");
- return;
+ return 0;
}
if (parc < 2 || EmptyString(parv[1]))
{
sendto_one(source_p, ":%s NOTICE %s :Need server name /die %s",
me.name, source_p->name, me.name);
- return;
+ return 0;
}
if (irccmp(parv[1], me.name))
{
sendto_one(source_p, ":%s NOTICE %s :Mismatch on /die %s",
me.name, source_p->name, me.name);
- return;
+ return 0;
}
snprintf(buf, sizeof(buf), "received DIE command from %s",
get_oper_name(source_p));
server_die(buf, 0);
+ return 0;
}
-static struct Message die_msgtab = {
+static struct Message die_msgtab =
+{
"DIE", 0, 0, 1, MAXPARA, MFLG_SLOW, 0,
- {m_unregistered, m_not_oper, m_ignore, m_ignore, mo_die, m_ignore}
+ { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_die, m_ignore }
};
static void
@@ -86,7 +90,8 @@ module_exit(void)
mod_del_cmd(&die_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_error.c b/modules/core/m_error.c
index a4ffffb..5801337 100644
--- a/modules/core/m_error.c
+++ b/modules/core/m_error.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_error.c: Handles error messages from the other end.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_error.c
+ * \brief Includes required functions for processing the ERROR command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -39,8 +41,8 @@
* parv[0] = sender prefix
* parv[*] = parameters
*/
-static void
-mr_error(struct Client *client_p, struct Client *source_p,
+static int
+mr_error(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
const char *para = (parc > 1 && !EmptyString(parv[1])) ? parv[1] : "<>";
@@ -48,7 +50,7 @@ mr_error(struct Client *client_p, struct Client *source_p,
assert(source_p == client_p);
if (!IsHandshake(source_p) && !IsConnecting(source_p))
- return;
+ return 0;
ilog(LOG_TYPE_IRCD, "Received ERROR message from %s: %s",
source_p->name, para);
@@ -71,9 +73,11 @@ mr_error(struct Client *client_p, struct Client *source_p,
"ERROR :from %s via %s -- %s",
source_p->name, get_client_name(client_p, MASK_IP), para);
}
+
+ return 0;
}
-static void
+static int
ms_error(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -91,10 +95,12 @@ ms_error(struct Client *client_p, struct Client *source_p,
"ERROR :from %s via %s -- %s",
source_p->name,
get_client_name(client_p, MASK_IP), para);
+ return 0;
}
-static struct Message error_msgtab = {
- "ERROR", 0, 0, 1, MAXPARA, MFLG_SLOW, 0,
+static struct Message error_msgtab =
+{
+ "ERROR", 0, 0, 1, MAXPARA, MFLG_SLOW, 0,
{ mr_error, m_ignore, ms_error, m_ignore, m_ignore, m_ignore }
};
@@ -110,7 +116,8 @@ module_exit(void)
mod_del_cmd(&error_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_join.c b/modules/core/m_join.c
index aa8cdc8..e982888 100644
--- a/modules/core/m_join.c
+++ b/modules/core/m_join.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_join.c: Joins a channel.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_join.c
+ * \brief Includes required functions for processing the JOIN command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -88,7 +90,7 @@ last0(struct Client *client_p, struct Client *source_p, char *chanlist)
* parv[1] = channel
* parv[2] = channel password (key)
*/
-static void
+static int
m_join(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -105,7 +107,7 @@ m_join(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "JOIN");
- return;
+ return 0;
}
assert(client_p == source_p);
@@ -276,6 +278,8 @@ m_join(struct Client *client_p, struct Client *source_p,
source_p->localClient->last_join_time = CurrentTime;
}
+
+ return 0;
}
/* ms_join()
@@ -286,12 +290,12 @@ m_join(struct Client *client_p, struct Client *source_p,
* parv[3] = modes (Deprecated)
* output - none
* side effects - handles remote JOIN's sent by servers. In TSora
- * remote clients are joined using SJOIN, hence a
+ * remote clients are joined using SJOIN, hence a
* JOIN sent by a server on behalf of a client is an error.
* here, the initial code is in to take an extra parameter
* and use it for the TimeStamp on a new channel.
*/
-static void
+static int
ms_join(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -307,18 +311,18 @@ ms_join(struct Client *client_p, struct Client *source_p,
if (parc == 2 && !irccmp(parv[1], "0"))
{
do_join_0(client_p, source_p);
- return;
+ return 0;
}
if (parc < 4)
- return;
+ return 0;
if (!check_channel_name(parv[2], 0))
{
sendto_realops_flags(UMODE_DEBUG, L_ALL, SEND_NOTICE,
"*** Too long or invalid channel name from %s: %s",
client_p->name, parv[2]);
- return;
+ return 0;
}
mbuf = modebuf;
@@ -407,7 +411,7 @@ ms_join(struct Client *client_p, struct Client *source_p,
me.name, chptr->chname, chptr->chname,
(unsigned long)oldts, (unsigned long)newts);
}
-
+
if (*modebuf != '\0')
{
servername = (ConfigServerHide.hide_servers || IsHidden(source_p)) ?
@@ -439,6 +443,7 @@ ms_join(struct Client *client_p, struct Client *source_p,
":%s SJOIN %lu %s + :%s",
source_p->servptr->name, (unsigned long)chptr->channelts,
chptr->chname, source_p->name);
+ return 0;
}
/* do_join_0()
diff --git a/modules/core/m_kick.c b/modules/core/m_kick.c
index 26dccfa..c4cec5e 100644
--- a/modules/core/m_kick.c
+++ b/modules/core/m_kick.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_kick.c: Kicks a user from a channel.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_kick.c
+ * \brief Includes required functions for processing the KICK command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -44,7 +46,7 @@
* parv[2] = client to kick
* parv[3] = kick comment
*/
-static void
+static int
m_kick(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -74,7 +76,7 @@ m_kick(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
from, to, "KICK");
- return;
+ return 0;
}
if (MyClient(source_p) && !IsFloodDone(source_p))
@@ -88,13 +90,13 @@ m_kick(struct Client *client_p, struct Client *source_p,
if ((p = strchr(name,',')) != NULL)
*p = '\0';
if (*name == '\0')
- return;
+ return 0;
if ((chptr = hash_find_channel(name)) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
from, to, name);
- return;
+ return 0;
}
if (!IsServer(source_p) && !HasFlag(source_p, FLAGS_SERVICE))
@@ -105,7 +107,7 @@ m_kick(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NOTONCHANNEL),
me.name, source_p->name, name);
- return;
+ return 0;
}
}
@@ -117,15 +119,15 @@ m_kick(struct Client *client_p, struct Client *source_p,
/* user on _my_ server, with no chanops.. so go away */
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, name);
- return;
+ return 0;
}
if (chptr->channelts == 0)
{
- /* If its a TS 0 channel, do it the old way */
+ /* If its a TS 0 channel, do it the old way */
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
from, to, name);
- return;
+ return 0;
}
/* Its a user doing a kick, but is not showing as chanop locally
@@ -133,12 +135,12 @@ m_kick(struct Client *client_p, struct Client *source_p,
* There are two cases we can get to this point then...
*
* 1) connect burst is happening, and for some reason a legit
- * op has sent a KICK, but the SJOIN hasn't happened yet or
+ * op has sent a KICK, but the SJOIN hasn't happened yet or
* been seen. (who knows.. due to lag...)
*
* 2) The channel is desynced. That can STILL happen with TS
- *
- * Now, the old code roger wrote, would allow the KICK to
+ *
+ * Now, the old code roger wrote, would allow the KICK to
* go through. Thats quite legit, but lets weird things like
* KICKS by users who appear not to be chanopped happen,
* or even neater, they appear not to be on the channel.
@@ -156,10 +158,10 @@ m_kick(struct Client *client_p, struct Client *source_p,
*p = '\0';
if (*user == '\0')
- return;
+ return 0;
if ((who = find_chasing(source_p, user, &chasing)) == NULL)
- return;
+ return 0;
if ((ms_target = find_channel_link(who, chptr)) != NULL)
{
@@ -172,7 +174,7 @@ m_kick(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, name);
- return;
+ return 0;
}
}
#endif
@@ -204,11 +206,13 @@ m_kick(struct Client *client_p, struct Client *source_p,
else
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
from, to, user, name);
+ return 0;
}
-static struct Message kick_msgtab = {
+static struct Message kick_msgtab =
+{
"KICK", 0, 0, 3, MAXPARA, MFLG_SLOW, 0,
- {m_unregistered, m_kick, m_kick, m_ignore, m_kick, m_ignore}
+ { m_unregistered, m_kick, m_kick, m_ignore, m_kick, m_ignore }
};
static void
@@ -223,7 +227,8 @@ module_exit(void)
mod_del_cmd(&kick_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_kill.c b/modules/core/m_kill.c
index 49d8dcb..18673d0 100644
--- a/modules/core/m_kill.c
+++ b/modules/core/m_kill.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_kill.c: Kills a user.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,14 +17,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_kill.c
+ * \brief Includes required functions for processing the KILL command.
+ * \version $Id$
*/
#include "stdinc.h"
#include "list.h"
#include "client.h"
-#include "hash.h" /* for find_client() */
+#include "hash.h"
#include "ircd.h"
#include "numeric.h"
#include "log.h"
@@ -72,7 +74,7 @@ relay_kill(struct Client *one, struct Client *source_p,
* parv[1] = kill victim
* parv[2] = kill path
*/
-static void
+static int
mo_kill(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -89,7 +91,7 @@ mo_kill(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "KILL");
- return;
+ return 0;
}
if (!EmptyString(reason))
@@ -107,13 +109,13 @@ mo_kill(struct Client *client_p, struct Client *source_p,
* rewrite the KILL for this new nickname--this keeps
* servers in synch when nick change and kill collide
*/
- if ((target_p = whowas_get_history(user,
+ if ((target_p = whowas_get_history(user,
(time_t)ConfigFileEntry.kill_chase_time_limit))
== NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK),
me.name, source_p->name, user);
- return;
+ return 0;
}
sendto_one(source_p, ":%s NOTICE %s :KILL changed from %s to %s",
@@ -124,25 +126,25 @@ mo_kill(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kill:remote");
- return;
+ return 0;
}
if (MyConnect(target_p) && !HasOFlag(source_p, OPER_FLAG_KILL))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kill");
- return;
+ return 0;
}
if (IsServer(target_p) || IsMe(target_p))
{
sendto_one(source_p, form_str(ERR_CANTKILLSERVER),
me.name, source_p->name);
- return;
+ return 0;
}
if (MyConnect(target_p))
- sendto_one(target_p, ":%s!%s@%s KILL %s :%s",
+ sendto_one(target_p, ":%s!%s@%s KILL %s :%s",
source_p->name, source_p->username, source_p->host,
target_p->name, reason);
@@ -151,7 +153,7 @@ mo_kill(struct Client *client_p, struct Client *source_p,
* that have been around for ever, for no reason..
*/
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "Received KILL message for %s!%s@%s[%s/%s]. From %s Path: %s (%s)",
+ "Received KILL message for %s!%s@%s[%s/%s]. From %s Path: %s (%s)",
target_p->name, target_p->username, target_p->host,
target_p->servptr->name,
target_p->servptr->id[0] ? target_p->servptr->id : "<>",
@@ -179,6 +181,7 @@ mo_kill(struct Client *client_p, struct Client *source_p,
snprintf(buf, sizeof(buf), "Killed (%s (%s))", source_p->name, reason);
exit_client(target_p, source_p, buf);
+ return 0;
}
/* ms_kill()
@@ -186,7 +189,7 @@ mo_kill(struct Client *client_p, struct Client *source_p,
* parv[1] = kill victim
* parv[2] = kill path and reason
*/
-static void
+static int
ms_kill(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -200,7 +203,7 @@ ms_kill(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "KILL");
- return;
+ return 0;
}
user = parv[1];
@@ -227,19 +230,19 @@ ms_kill(struct Client *client_p, struct Client *source_p,
if ((target_p = find_person(client_p, user)) == NULL)
{
/*
- * If the user has recently changed nick, but only if its
+ * If the user has recently changed nick, but only if its
* not an uid, automatically rewrite the KILL for this new nickname.
* --this keeps servers in synch when nick change and kill collide
*/
if (IsDigit(*user)) /* Somehow an uid was not found in the hash ! */
- return;
+ return 0;
if ((target_p = whowas_get_history(user,
(time_t)ConfigFileEntry.kill_chase_time_limit))
== NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK),
me.name, source_p->name, user);
- return;
+ return 0;
}
sendto_one(source_p,":%s NOTICE %s :KILL changed from %s to %s",
@@ -250,7 +253,7 @@ ms_kill(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_CANTKILLSERVER),
me.name, source_p->name);
- return;
+ return 0;
}
if (MyConnect(target_p))
@@ -308,12 +311,14 @@ ms_kill(struct Client *client_p, struct Client *source_p,
snprintf(buf, sizeof(buf), "Killed (%s %s)", source_p->name, reason);
exit_client(target_p, source_p, buf);
+ return 0;
}
-static struct Message kill_msgtab = {
+static struct Message kill_msgtab =
+{
"KILL", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
- {m_unregistered, m_not_oper, ms_kill, m_ignore, mo_kill, m_ignore}
+ { m_unregistered, m_not_oper, ms_kill, m_ignore, mo_kill, m_ignore }
};
static void
@@ -328,7 +333,8 @@ module_exit(void)
mod_del_cmd(&kill_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_message.c b/modules/core/m_message.c
index 59a77c8..0fa48db 100644
--- a/modules/core/m_message.c
+++ b/modules/core/m_message.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_message.c: Sends a (PRIVMSG|NOTICE) message to a user or channel.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_message.c
+ * \brief Includes required functions for processing the PRIVMSG/NOTICE command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -140,7 +142,7 @@ find_userhost(char *user, char *host, int *count)
*
* inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC
* say NOTICE must not auto reply
- * - pointer to source Client
+ * - pointer to source Client
* - pointer to target Client
* output - 1 if target is under flood attack
* side effects - check for flood attack on target target_p
@@ -201,7 +203,7 @@ flood_attack_client(int p_or_n, struct Client *source_p,
*
* inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC
* says NOTICE must not auto reply
- * - pointer to source Client
+ * - pointer to source Client
* - pointer to target channel
* output - 1 if target is under flood attack
* side effects - check for flood attack on target chptr
@@ -308,7 +310,7 @@ msg_channel(int p_or_n, const char *command, struct Client *client_p,
/* msg_channel_flags()
*
- * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC
+ * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC
* say NOTICE must not auto reply
* - pointer to command, "PRIVMSG" or "NOTICE"
* - pointer to client_p
@@ -354,7 +356,7 @@ msg_channel_flags(int p_or_n, const char *command, struct Client *client_p,
/* msg_client()
*
- * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC
+ * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC
* say NOTICE must not auto reply
* - pointer to command, "PRIVMSG" or "NOTICE"
* - pointer to source_p source (struct Client *)
@@ -442,7 +444,7 @@ msg_client(int p_or_n, const char *command, struct Client *source_p,
/*
* If the client is remote, we dont perform a special check for
* flooding.. as we wouldnt block their message anyway.. this means
- * we dont give warnings.. we then check if theyre opered
+ * we dont give warnings.. we then check if theyre opered
* (to avoid flood warnings), lastly if theyre our client
* and flooding -- fl
*/
@@ -582,7 +584,7 @@ handle_special(int p_or_n, const char *command, struct Client *client_p,
++nick;
else if (MyClient(source_p) && HasUMode(source_p, UMODE_OPER))
{
- sendto_one(source_p,
+ sendto_one(source_p,
":%s NOTICE %s :The command %s %s is no longer supported, please use $%s",
me.name, source_p->name, command, nick, nick);
return;
@@ -606,7 +608,7 @@ handle_special(int p_or_n, const char *command, struct Client *client_p,
ID_or_name(source_p, client_p), nick);
return;
}
-
+
sendto_match_butone(IsServer(client_p) ? client_p : NULL, source_p,
nick + 1, (*nick == '#') ? MATCH_HOST : MATCH_SERVER,
"%s $%s :%s", command, nick, text);
@@ -706,7 +708,7 @@ build_target_list(int p_or_n, const char *command, struct Client *client_p,
continue;
}
-
+
/* @#channel or +#channel message ? */
type = 0;
with_prefix = nick;
@@ -763,7 +765,7 @@ build_target_list(int p_or_n, const char *command, struct Client *client_p,
ID_or_name(&me, client_p),
ID_or_name(source_p, client_p), nick,
ConfigFileEntry.max_targets);
- return 1;
+ return 1;
}
targets[ntargets].ptr = chptr;
@@ -858,7 +860,7 @@ m_message(int p_or_n, const char *command, struct Client *client_p,
}
}
-static void
+static int
m_privmsg(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -867,28 +869,30 @@ m_privmsg(struct Client *client_p, struct Client *source_p,
* for a notice.. (for example remote kline replies) --fl_
*/
if (!IsClient(source_p))
- return;
+ return 0;
m_message(PRIVMSG, "PRIVMSG", client_p, source_p, parc, parv);
+ return 0;
}
-static void
+static int
m_notice(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
m_message(NOTICE, "NOTICE", client_p, source_p, parc, parv);
+ return 0;
}
static struct Message privmsg_msgtab =
{
"PRIVMSG", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
- {m_unregistered, m_privmsg, m_privmsg, m_ignore, m_privmsg, m_ignore}
+ { m_unregistered, m_privmsg, m_privmsg, m_ignore, m_privmsg, m_ignore }
};
static struct Message notice_msgtab =
{
"NOTICE", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
- {m_unregistered, m_notice, m_notice, m_ignore, m_notice, m_ignore}
+ { m_unregistered, m_notice, m_notice, m_ignore, m_notice, m_ignore }
};
static void
diff --git a/modules/core/m_mode.c b/modules/core/m_mode.c
index 304925a..dc4f001 100644
--- a/modules/core/m_mode.c
+++ b/modules/core/m_mode.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_mode.c: Sets a user or channel mode.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_mode.c
+ * \brief Includes required functions for processing the MODE/TMODE/BMASK command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -45,7 +47,7 @@
* parv[0] - sender
* parv[1] - channel
*/
-static void
+static int
m_mode(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -58,7 +60,7 @@ m_mode(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "MODE");
- return;
+ return 0;
}
/* Now, try to find the channel in question */
@@ -66,16 +68,16 @@ m_mode(struct Client *client_p, struct Client *source_p,
{
/* if here, it has to be a non-channel name */
set_user_mode(client_p, source_p, parc, parv);
- return;
+ return 0;
}
if ((chptr = hash_find_channel(parv[1])) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
- ID_or_name(&me, source_p->from),
- ID_or_name(source_p, source_p->from),
- parv[1]);
- return;
+ ID_or_name(&me, source_p->from),
+ ID_or_name(source_p, source_p->from),
+ parv[1]);
+ return 0;
}
/* Now known the channel exists */
@@ -86,7 +88,7 @@ m_mode(struct Client *client_p, struct Client *source_p,
me.name, source_p->name, chptr->chname, modebuf, parabuf);
sendto_one(source_p, form_str(RPL_CREATIONTIME),
me.name, source_p->name, chptr->chname, chptr->channelts);
- return;
+ return 0;
}
/*
@@ -112,6 +114,8 @@ m_mode(struct Client *client_p, struct Client *source_p,
chptr->chname);
}
}
+
+ return 0;
}
/*
@@ -122,7 +126,7 @@ m_mode(struct Client *client_p, struct Client *source_p,
* parv[2] = channel name
* parv[3] = modestring
*/
-static void
+static int
ms_tmode(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
struct Channel *chptr = NULL;
@@ -132,11 +136,11 @@ ms_tmode(struct Client *client_p, struct Client *source_p, int parc, char *parv[
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
ID_or_name(&me, client_p), ID_or_name(source_p, client_p), parv[2]);
- return;
+ return 0;
}
if (atol(parv[1]) > chptr->channelts)
- return;
+ return 0;
if (IsServer(source_p) || HasFlag(source_p, FLAGS_SERVICE))
set_channel_mode(client_p, source_p, chptr, NULL, parc - 3, parv + 3, chptr->chname);
@@ -146,10 +150,12 @@ ms_tmode(struct Client *client_p, struct Client *source_p, int parc, char *parv[
/* XXX are we sure we just want to bail here? */
if (has_member_flags(member, CHFL_DEOPPED))
- return;
+ return 0;
set_channel_mode(client_p, source_p, chptr, member, parc - 3, parv + 3, chptr->chname);
}
+
+ return 0;
}
/*
@@ -165,12 +171,12 @@ ms_tmode(struct Client *client_p, struct Client *source_p, int parc, char *parv[
* sends plain modes to the others. nothing is sent
* to the server the issuing server is connected through
*/
-static void
+static int
ms_bmask(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
- static char modebuf[IRCD_BUFSIZE];
- static char parabuf[IRCD_BUFSIZE];
- static char banbuf[IRCD_BUFSIZE];
+ char modebuf[IRCD_BUFSIZE];
+ char parabuf[IRCD_BUFSIZE];
+ char banbuf[IRCD_BUFSIZE];
struct Channel *chptr;
char *s, *t, *mbuf, *pbuf;
long mode_type;
@@ -179,11 +185,11 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, char *parv[
int needcap = NOCAPS;
if ((chptr = hash_find_channel(parv[2])) == NULL)
- return;
+ return 0;
/* TS is higher, drop it. */
if (atol(parv[1]) > chptr->channelts)
- return;
+ return 0;
switch (*parv[3])
{
@@ -203,7 +209,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, char *parv[
/* maybe we should just blindly propagate this? */
default:
- return;
+ return 0;
}
parabuf[0] = '\0';
@@ -217,12 +223,13 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, char *parv[
mbuf = modebuf + mlen;
pbuf = parabuf;
- do {
- if ((t = strchr(s, ' ')) != NULL)
+ do
+ {
+ if ((t = strchr(s, ' ')))
*t++ = '\0';
tlen = strlen(s);
- /* I dont even want to begin parsing this.. */
+ /* I don't even want to begin parsing this.. */
if (tlen > MODEBUFLEN)
break;
@@ -262,25 +269,28 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, char *parv[
}
/* assumption here is that since the server sent BMASK, they are TS6, so they have an ID */
- sendto_server(client_p, CAP_TS6|needcap, NOCAPS,
- ":%s BMASK %lu %s %s :%s",
+ sendto_server(client_p, CAP_TS6|needcap, NOCAPS, ":%s BMASK %lu %s %s :%s",
source_p->id, (unsigned long)chptr->channelts, chptr->chname,
parv[3], parv[4]);
+ return 0;
}
-static struct Message mode_msgtab = {
+static struct Message mode_msgtab =
+{
"MODE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
- {m_unregistered, m_mode, m_mode, m_ignore, m_mode, m_ignore}
+ { m_unregistered, m_mode, m_mode, m_ignore, m_mode, m_ignore }
};
-static struct Message tmode_msgtab = {
+static struct Message tmode_msgtab =
+{
"TMODE", 0, 0, 4, MAXPARA, MFLG_SLOW, 0,
- {m_ignore, m_ignore, ms_tmode, m_ignore, m_ignore, m_ignore}
+ { m_ignore, m_ignore, ms_tmode, m_ignore, m_ignore, m_ignore }
};
-static struct Message bmask_msgtab = {
+static struct Message bmask_msgtab =
+{
"BMASK", 0, 0, 5, MAXPARA, MFLG_SLOW, 0,
- {m_ignore, m_ignore, ms_bmask, m_ignore, m_ignore, m_ignore}
+ { m_ignore, m_ignore, ms_bmask, m_ignore, m_ignore, m_ignore }
};
static void
@@ -299,7 +309,8 @@ module_exit(void)
mod_del_cmd(&bmask_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c
index fd09626..0b25d53 100644
--- a/modules/core/m_nick.c
+++ b/modules/core/m_nick.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_nick.c: Sets a users nick.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_nick.c
+ * \brief Includes required functions for processing the NICK command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -181,7 +183,7 @@ set_initial_nick(struct Client *source_p, const char *nick)
* inputs - pointer to server
* - pointer to client
* - nick
- * output -
+ * output -
* side effects - changes nick of a LOCAL user
*/
static void
@@ -392,12 +394,12 @@ uid_from_server(struct Client *client_p, struct Client *source_p, int parc,
}
static void
-perform_nick_collides(struct Client *source_p, struct Client *client_p,
- struct Client *target_p, int parc, char *parv[],
+perform_nick_collides(struct Client *source_p, struct Client *client_p,
+ struct Client *target_p, int parc, char *parv[],
time_t newts, const char *svsid, char *nick, char *gecos, char *uid)
{
int sameuser = 0;
-
+
/* Server introducing new nick */
if (IsServer(source_p))
{
@@ -408,7 +410,7 @@ perform_nick_collides(struct Client *source_p, struct Client *client_p,
"Nick collision on %s(%s <- %s)(both killed)",
target_p->name, target_p->from->name,
client_p->name);
-
+
/* if we have a UID, issue a kill for it */
if (uid)
sendto_one(client_p, ":%s KILL %s :%s (Nick collision (new))",
@@ -429,7 +431,7 @@ perform_nick_collides(struct Client *source_p, struct Client *client_p,
{
sameuser = !irccmp(target_p->username, parv[5]) &&
!irccmp(target_p->host, parv[6]);
-
+
/*
* If the users are the same (loaded a client on a different server)
* and the new users ts is older, or the users are different and the
@@ -485,7 +487,7 @@ perform_nick_collides(struct Client *source_p, struct Client *client_p,
"Nick change collision from %s to %s(%s <- %s)(both killed)",
source_p->name, target_p->name, target_p->from->name,
client_p->name);
-
+
sendto_one(target_p, form_str(ERR_NICKCOLLISION), me.name,
target_p->name, target_p->name);
@@ -580,7 +582,7 @@ perform_nick_collides(struct Client *source_p, struct Client *client_p,
* - parv[0] = sender prefix
* - parv[1] = nickname
*/
-static void
+static int
mr_nick(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -592,7 +594,7 @@ mr_nick(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name,
source_p->name[0] ? source_p->name : "*");
- return;
+ return 0;
}
/* Copy the nick and terminate it */
@@ -604,7 +606,7 @@ mr_nick(struct Client *client_p, struct Client *source_p,
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name,
source_p->name[0] ? source_p->name : "*", parv[1],
"Erroneous Nickname");
- return;
+ return 0;
}
/* Check if the nick is resv'd */
@@ -616,7 +618,7 @@ mr_nick(struct Client *client_p, struct Client *source_p,
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE,
"Forbidding reserved nick %s from user %s",
nick, get_client_name(client_p, HIDE_IP));
- return;
+ return 0;
}
if ((target_p = hash_find_client(nick)) == NULL)
@@ -625,6 +627,7 @@ mr_nick(struct Client *client_p, struct Client *source_p,
strlcpy(source_p->name, nick, sizeof(source_p->name));
else
sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, "*", nick);
+ return 0;
}
/*! \brief NICK command handler (called by already registered,
@@ -641,7 +644,7 @@ mr_nick(struct Client *client_p, struct Client *source_p,
* - parv[0] = sender prefix
* - parv[1] = nickname
*/
-static void
+static int
m_nick(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -655,7 +658,7 @@ m_nick(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN),
me.name, source_p->name);
- return;
+ return 0;
}
/* mark end of grace period, to prevent nickflooding */
@@ -670,7 +673,7 @@ m_nick(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name,
source_p->name, nick, "Erroneous Nickname");
- return;
+ return 0;
}
if (!IsExemptResv(source_p) &&
@@ -683,7 +686,7 @@ m_nick(struct Client *client_p, struct Client *source_p,
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE,
"Forbidding reserved nick %s from user %s",
nick, get_client_name(client_p, HIDE_IP));
- return;
+ return 0;
}
if ((target_p = hash_find_client(nick)) == NULL)
@@ -711,6 +714,7 @@ m_nick(struct Client *client_p, struct Client *source_p,
else
sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name,
source_p->name, nick);
+ return 0;
}
/*! \brief NICK command handler (called by servers and remotely
@@ -753,7 +757,7 @@ m_nick(struct Client *client_p, struct Client *source_p,
* - parv[8] = services id (timestamp)
* - parv[9] = ircname
*/
-static void
+static int
ms_nick(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -762,7 +766,7 @@ ms_nick(struct Client *client_p, struct Client *source_p,
const char *svsid = "0";
if (parc < 3 || EmptyString(parv[parc - 1]))
- return;
+ return 0;
if (parc >= 9)
{
@@ -775,13 +779,13 @@ ms_nick(struct Client *client_p, struct Client *source_p,
parv[7], source_p->name, parv[1]);
sendto_one(client_p, ":%s KILL %s :%s (Server doesn't exist!)",
me.name, parv[1], me.name);
- return;
+ return 0;
}
if (check_clean_nick(client_p, source_p, parv[1], server_p) ||
check_clean_user(client_p, parv[1], parv[5], server_p) ||
check_clean_host(client_p, parv[1], parv[6], server_p))
- return;
+ return 0;
if (IsServer(source_p))
newts = atol(parv[3]);
@@ -792,11 +796,11 @@ ms_nick(struct Client *client_p, struct Client *source_p,
{
if (IsServer(source_p))
/* Servers can't change nicks.. */
- return;
+ return 0;
if (check_clean_nick(client_p, source_p, parv[1],
source_p->servptr))
- return;
+ return 0;
newts = atol(parv[2]);
}
@@ -818,6 +822,7 @@ ms_nick(struct Client *client_p, struct Client *source_p,
else
perform_nick_collides(source_p, client_p, target_p, parc, parv,
newts, svsid, parv[1], parv[parc-1], NULL);
+ return 0;
}
/*! \brief UID command handler (called by servers)
@@ -856,7 +861,7 @@ ms_nick(struct Client *client_p, struct Client *source_p,
* - parv[ 9] = services id (timestamp)
* - parv[10] = ircname (gecos)
*/
-static void
+static int
ms_uid(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -865,12 +870,12 @@ ms_uid(struct Client *client_p, struct Client *source_p,
const char *svsid = "0";
if (parc < 10 || EmptyString(parv[parc-1]))
- return;
+ return 0;
if (check_clean_nick(client_p, source_p, parv[1], source_p) ||
check_clean_user(client_p, parv[1], parv[5], source_p) ||
check_clean_host(client_p, parv[1], parv[6], source_p))
- return;
+ return 0;
newts = atol(parv[3]);
svsid = parc == 11 ? parv[9] : "0";
@@ -892,7 +897,7 @@ ms_uid(struct Client *client_p, struct Client *source_p,
++ServerStats.is_kill;
AddFlag(target_p, FLAGS_KILLED);
exit_client(target_p, &me, "ID Collision");
- return;
+ return 0;
}
if ((target_p = hash_find_client(parv[1])) == NULL)
@@ -905,16 +910,19 @@ ms_uid(struct Client *client_p, struct Client *source_p,
else
perform_nick_collides(source_p, client_p, target_p, parc, parv, newts, svsid, parv[1],
parv[parc-1], parv[8]);
+ return 0;
}
-static struct Message nick_msgtab = {
+static struct Message nick_msgtab =
+{
"NICK", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
- {mr_nick, m_nick, ms_nick, m_ignore, m_nick, m_ignore}
+ { mr_nick, m_nick, ms_nick, m_ignore, m_nick, m_ignore }
};
-static struct Message uid_msgtab = {
+static struct Message uid_msgtab =
+{
"UID", 0, 0, 10, MAXPARA, MFLG_SLOW, 0,
- {m_ignore, m_ignore, ms_uid, m_ignore, m_ignore, m_ignore}
+ { m_ignore, m_ignore, ms_uid, m_ignore, m_ignore, m_ignore }
};
static void
@@ -931,7 +939,8 @@ module_exit(void)
mod_del_cmd(&nick_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_part.c b/modules/core/m_part.c
index c6c7a69..f995f55 100644
--- a/modules/core/m_part.c
+++ b/modules/core/m_part.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_part.c: Parts a user from a channel.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_part.c
+ * \brief Includes required functions for processing the PART command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -45,7 +47,7 @@
* - pointer to source client to remove
* - char pointer of name of channel to remove from
* output - none
- * side effects - remove ONE client given the channel name
+ * side effects - remove ONE client given the channel name
*/
static void
part_one_client(struct Client *source_p, const char *name, const char *reason)
@@ -109,7 +111,7 @@ part_one_client(struct Client *source_p, const char *name, const char *reason)
** parv[1] = channel
** parv[2] = reason
*/
-static void
+static int
m_part(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -117,13 +119,13 @@ m_part(struct Client *client_p, struct Client *source_p,
char reason[KICKLEN + 1] = { '\0' };
if (IsServer(source_p))
- return;
+ return 0;
if (EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "PART");
- return;
+ return 0;
}
if (parc > 2 && !EmptyString(parv[2]))
@@ -136,9 +138,11 @@ m_part(struct Client *client_p, struct Client *source_p,
for (name = strtoken(&p, parv[1], ","); name;
name = strtoken(&p, NULL, ","))
part_one_client(source_p, name, reason);
+ return 0;
}
-static struct Message part_msgtab = {
+static struct Message part_msgtab =
+{
"PART", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
{ m_unregistered, m_part, m_part, m_ignore, m_part, m_ignore }
};
@@ -155,7 +159,8 @@ module_exit(void)
mod_del_cmd(&part_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_quit.c b/modules/core/m_quit.c
index d103729..ce2501d 100644
--- a/modules/core/m_quit.c
+++ b/modules/core/m_quit.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_quit.c: Makes a user quit from IRC.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_quit.c
+ * \brief Includes required functions for processing the QUIT command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -38,7 +40,7 @@
** parv[0] = sender prefix
** parv[1] = comment
*/
-static void
+static int
m_quit(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -50,6 +52,7 @@ m_quit(struct Client *client_p, struct Client *source_p,
strlcpy(reason + 6, parv[1], sizeof(reason) - 6);
exit_client(source_p, source_p, reason);
+ return 0;
}
/*
@@ -57,7 +60,7 @@ m_quit(struct Client *client_p, struct Client *source_p,
** parv[0] = sender prefix
** parv[1] = comment
*/
-static void
+static int
ms_quit(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -69,11 +72,13 @@ ms_quit(struct Client *client_p, struct Client *source_p,
strlcpy(reason, client_p->name, sizeof(reason));
exit_client(source_p, source_p, reason);
+ return 0;
}
-static struct Message quit_msgtab = {
+static struct Message quit_msgtab =
+{
"QUIT", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
- {m_quit, m_quit, ms_quit, m_ignore, m_quit, m_ignore}
+ { m_quit, m_quit, ms_quit, m_ignore, m_quit, m_ignore }
};
static void
@@ -88,7 +93,8 @@ module_exit(void)
mod_del_cmd(&quit_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_server.c b/modules/core/m_server.c
index 37fb02f..c58cc74 100644
--- a/modules/core/m_server.c
+++ b/modules/core/m_server.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_server.c: Introduces a server.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,23 +17,26 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_server.c
+ * \brief Includes required functions for processing the SERVER/SID command.
+ * \version $Id$
*/
#include "stdinc.h"
#include "list.h"
-#include "client.h" /* client struct */
+#include "client.h"
#include "event.h"
-#include "hash.h" /* add_to_client_hash_table */
-#include "irc_string.h"
-#include "ircd.h" /* me */
-#include "numeric.h" /* ERR_xxx */
-#include "conf.h" /* struct MaskItem */
-#include "log.h" /* log level defines */
-#include "s_serv.h" /* server_estab, check_server */
+#include "hash.h"
+#include "irc_string.h"
+#include "ircd.h"
+#include "numeric.h"
+#include "conf.h"
+#include "log.h"
+#include "s_serv.h"
#include "s_user.h"
-#include "send.h" /* sendto_one */
+#include "send.h"
#include "parse.h"
#include "modules.h"
@@ -69,7 +71,7 @@ set_server_gecos(struct Client *client_p, const char *info)
* parv[2] = serverinfo/hopcount
* parv[3] = serverinfo
*/
-static void
+static int
mr_server(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -81,7 +83,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
{
sendto_one(client_p, "ERROR :No servername");
exit_client(client_p, client_p, "Wrong number of args");
- return;
+ return 0;
}
name = parv[1];
@@ -99,7 +101,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
"Unauthorized server connection attempt from %s: Non-TS server "
"for server %s", get_client_name(client_p, MASK_IP), name);
exit_client(client_p, client_p, "Non-TS server");
- return;
+ return 0;
}
if (!valid_servname(name))
@@ -111,7 +113,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
"Unauthorized server connection attempt from %s: Bogus server name "
"for server %s", get_client_name(client_p, MASK_IP), name);
exit_client(client_p, client_p, "Bogus server name");
- return;
+ return 0;
}
/* Now we just have to call check_server and everything should
@@ -132,7 +134,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
}
exit_client(client_p, client_p, "Invalid servername.");
- return;
+ return 0;
/* NOT REACHED */
break;
@@ -146,7 +148,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
"for server %s", get_client_name(client_p, MASK_IP), name);
exit_client(client_p, client_p, "Invalid password.");
- return;
+ return 0;
/* NOT REACHED */
break;
@@ -160,7 +162,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
"for server %s", get_client_name(client_p, MASK_IP), name);
exit_client(client_p, client_p, "Invalid host.");
- return;
+ return 0;
case -4:
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
"Unauthorized server connection attempt from %s: Invalid certificate fingerprint "
@@ -171,7 +173,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
"for server %s", get_client_name(client_p, MASK_IP), name);
exit_client(client_p, client_p, "Invalid certificate fingerprint.");
- return;
+ return 0;
/* NOT REACHED */
break;
}
@@ -190,16 +192,16 @@ mr_server(struct Client *client_p, struct Client *source_p,
* connect - A1kmm.
*/
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
- "Attempt to re-introduce server %s SID %s from %s",
- name, client_p->id,
- get_client_name(client_p, HIDE_IP));
+ "Attempt to re-introduce server %s SID %s from %s",
+ name, client_p->id,
+ get_client_name(client_p, HIDE_IP));
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
- "Attempt to re-introduce server %s SID %s from %s",
+ "Attempt to re-introduce server %s SID %s from %s",
name, client_p->id,
- get_client_name(client_p, MASK_IP));
+ get_client_name(client_p, MASK_IP));
sendto_one(client_p, "ERROR :Server ID already exists.");
exit_client(client_p, client_p, "Server ID Exists");
- return;
+ return 0;
}
/* XXX If somehow there is a connect in progress and
@@ -217,6 +219,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
set_server_gecos(client_p, parv[3]);
client_p->hopcount = hop;
server_estab(client_p);
+ return 0;
}
/* ms_server()
@@ -225,7 +228,7 @@ mr_server(struct Client *client_p, struct Client *source_p,
* parv[2] = serverinfo/hopcount
* parv[3] = serverinfo
*/
-static void
+static int
ms_server(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -239,12 +242,12 @@ ms_server(struct Client *client_p, struct Client *source_p,
/* Just to be sure -A1kmm. */
if (!IsServer(source_p))
- return;
+ return 0;
if (EmptyString(parv[3]))
{
sendto_one(client_p, "ERROR :No servername");
- return;
+ return 0;
}
name = parv[1];
@@ -260,7 +263,7 @@ ms_server(struct Client *client_p, struct Client *source_p,
get_client_name(client_p, MASK_IP), name);
sendto_one(client_p, "ERROR :Bogus server name introduced");
exit_client(client_p, &me, "Bogus server name intoduced");
- return;
+ return 0;
}
if ((target_p = hash_find_server(name)))
@@ -280,17 +283,17 @@ ms_server(struct Client *client_p, struct Client *source_p,
* that already exists, then sends you a client burst, you squit the
* server, but you keep getting the burst of clients on a server that
* doesnt exist, although ircd can handle it, its not a realistic
- * solution.. --fl_
+ * solution.. --fl_
*/
sendto_one(client_p, "ERROR :Server %s already exists", name);
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
- "Link %s cancelled, server %s already exists",
+ "Link %s cancelled, server %s already exists",
get_client_name(client_p, SHOW_IP), name);
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
- "Link %s cancelled, server %s already exists",
+ "Link %s cancelled, server %s already exists",
client_p->name, name);
exit_client(client_p, &me, "Server Exists");
- return;
+ return 0;
}
/* XXX If somehow there is a connect in progress and
@@ -329,7 +332,7 @@ ms_server(struct Client *client_p, struct Client *source_p,
* name = "irc.bighub.net";
* hub_mask="*";
* ...
- *
+ *
* That would allow "irc.bighub.net" to introduce anything it wanted..
*
* However
@@ -354,7 +357,7 @@ ms_server(struct Client *client_p, struct Client *source_p,
"Non-Hub link %s introduced %s.",
get_client_name(client_p, MASK_IP), name);
exit_client(source_p, &me, "No matching hub_mask.");
- return;
+ return 0;
}
/* Check for the new server being leafed behind this HUB */
@@ -362,10 +365,10 @@ ms_server(struct Client *client_p, struct Client *source_p,
{
/* OOOPs nope can't HUB this leaf */
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
- "Link %s introduced leafed server %s.",
+ "Link %s introduced leafed server %s.",
get_client_name(client_p, HIDE_IP), name);
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
- "Link %s introduced leafed server %s.",
+ "Link %s introduced leafed server %s.",
get_client_name(client_p, MASK_IP), name);
/* If it is new, we are probably misconfigured, so split the
* non-hub server introducing this. Otherwise, split the new
@@ -375,7 +378,7 @@ ms_server(struct Client *client_p, struct Client *source_p,
* larger networks, dont bother. --fl_
*/
exit_client(client_p, &me, "Leafed Server.");
- return;
+ return 0;
}
target_p = make_client(client_p);
@@ -404,6 +407,7 @@ ms_server(struct Client *client_p, struct Client *source_p,
sendto_realops_flags(UMODE_EXTERNAL, L_ALL, SEND_NOTICE,
"Server %s being introduced by %s",
target_p->name, source_p->name);
+ return 0;
}
/* ms_sid()
@@ -413,7 +417,7 @@ ms_server(struct Client *client_p, struct Client *source_p,
* parv[3] = sid of new server
* parv[4] = serverinfo
*/
-static void
+static int
ms_sid(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -426,12 +430,12 @@ ms_sid(struct Client *client_p, struct Client *source_p,
/* Just to be sure -A1kmm. */
if (!IsServer(source_p))
- return;
+ return 0;
if (EmptyString(parv[4]))
{
sendto_one(client_p, "ERROR :No servername");
- return;
+ return 0;
}
hop = atoi(parv[2]);
@@ -446,7 +450,7 @@ ms_sid(struct Client *client_p, struct Client *source_p,
get_client_name(client_p, MASK_IP), parv[1]);
sendto_one(client_p, "ERROR :Bogus server name introduced");
exit_client(client_p, &me, "Bogus server name intoduced");
- return;
+ return 0;
}
if (!valid_sid(parv[3]))
@@ -459,7 +463,7 @@ ms_sid(struct Client *client_p, struct Client *source_p,
get_client_name(client_p, MASK_IP), parv[3]);
sendto_one(client_p, "ERROR :Bogus server ID introduced");
exit_client(client_p, &me, "Bogus server ID intoduced");
- return;
+ return 0;
}
/* collision on SID? */
@@ -467,13 +471,13 @@ ms_sid(struct Client *client_p, struct Client *source_p,
{
sendto_one(client_p, "ERROR :SID %s already exists", parv[3]);
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
- "Link %s cancelled, SID %s already exists",
+ "Link %s cancelled, SID %s already exists",
get_client_name(client_p, SHOW_IP), parv[3]);
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
- "Link %s cancelled, SID %s already exists",
+ "Link %s cancelled, SID %s already exists",
client_p->name, parv[3]);
exit_client(client_p, &me, "SID Exists");
- return;
+ return 0;
}
/* collision on name? */
@@ -481,13 +485,13 @@ ms_sid(struct Client *client_p, struct Client *source_p,
{
sendto_one(client_p, "ERROR :Server %s already exists", parv[1]);
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
- "Link %s cancelled, server %s already exists",
+ "Link %s cancelled, server %s already exists",
get_client_name(client_p, SHOW_IP), parv[1]);
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
- "Link %s cancelled, server %s already exists",
+ "Link %s cancelled, server %s already exists",
client_p->name, parv[1]);
exit_client(client_p, &me, "Server Exists");
- return;
+ return 0;
}
/* XXX If somehow there is a connect in progress and
@@ -527,7 +531,7 @@ ms_sid(struct Client *client_p, struct Client *source_p,
* name = "irc.bighub.net";
* hub_mask="*";
* ...
- *
+ *
* That would allow "irc.bighub.net" to introduce anything it wanted..
*
* However
@@ -552,7 +556,7 @@ ms_sid(struct Client *client_p, struct Client *source_p,
"Non-Hub link %s introduced %s.",
get_client_name(client_p, MASK_IP), parv[1]);
exit_client(source_p, &me, "No matching hub_mask.");
- return;
+ return 0;
}
/* Check for the new server being leafed behind this HUB */
@@ -560,13 +564,13 @@ ms_sid(struct Client *client_p, struct Client *source_p,
{
/* OOOPs nope can't HUB this leaf */
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
- "Link %s introduced leafed server %s.",
+ "Link %s introduced leafed server %s.",
get_client_name(client_p, SHOW_IP), parv[1]);
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
- "Link %s introduced leafed server %s.",
+ "Link %s introduced leafed server %s.",
get_client_name(client_p, MASK_IP), parv[1]);
exit_client(client_p, &me, "Leafed Server.");
- return;
+ return 0;
}
target_p = make_client(client_p);
@@ -600,16 +604,19 @@ ms_sid(struct Client *client_p, struct Client *source_p,
sendto_realops_flags(UMODE_EXTERNAL, L_ALL, SEND_NOTICE,
"Server %s being introduced by %s",
target_p->name, source_p->name);
+ return 0;
}
-static struct Message server_msgtab = {
+static struct Message server_msgtab =
+{
"SERVER", 0, 0, 4, MAXPARA, MFLG_SLOW, 0,
- {mr_server, m_registered, ms_server, m_ignore, m_registered, m_ignore}
+ { mr_server, m_registered, ms_server, m_ignore, m_registered, m_ignore }
};
-static struct Message sid_msgtab = {
+static struct Message sid_msgtab =
+{
"SID", 0, 0, 5, MAXPARA, MFLG_SLOW, 0,
- {m_ignore, m_ignore, ms_sid, m_ignore, m_ignore, m_ignore}
+ { m_ignore, m_ignore, ms_sid, m_ignore, m_ignore, m_ignore }
};
static void
@@ -626,7 +633,8 @@ module_exit(void)
mod_del_cmd(&server_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_sjoin.c b/modules/core/m_sjoin.c
index 204bb29..7213b2d 100644
--- a/modules/core/m_sjoin.c
+++ b/modules/core/m_sjoin.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_sjoin.c: Joins a user to a channel.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_sjoin.c
+ * \brief Includes required functions for processing the SJOIN command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -64,7 +66,7 @@ static void remove_ban_list(struct Channel *, struct Client *, dlink_list *, cha
* incoming modes or undo the existing ones or merge them, and JOIN
* all the specified users while sending JOIN/MODEs to local clients
*/
-static void
+static int
ms_sjoin(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -86,27 +88,27 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
int len_uid = 0;
int isnew = 0;
int buflen = 0;
- int slen;
+ int slen;
unsigned int fl;
char *s;
- char *sptr;
+ char *sptr;
char nick_buf[IRCD_BUFSIZE]; /* buffer for modes and prefix */
char uid_buf[IRCD_BUFSIZE]; /* buffer for modes/prefixes for CAP_TS6 servers */
char *nick_ptr, *uid_ptr; /* pointers used for making the two mode/prefix buffers */
char *p; /* pointer used making sjbuf */
dlink_node *m;
const char *servername = (ConfigServerHide.hide_servers || IsHidden(source_p)) ?
- me.name : source_p->name;
+ me.name : source_p->name;
if (IsClient(source_p) || parc < 5)
- return;
+ return 0;
if (!check_channel_name(parv[2], 0))
{
sendto_realops_flags(UMODE_DEBUG, L_ALL, SEND_NOTICE,
"*** Too long or invalid channel name from %s: %s",
client_p->name, parv[2]);
- return;
+ return 0;
}
modebuf[0] = '\0';
@@ -160,14 +162,14 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
args++;
if (parc < 5 + args)
- return;
+ return 0;
break;
case 'l':
mode.limit = atoi(parv[4 + args]);
args++;
if (parc < 5 + args)
- return;
+ return 0;
break;
}
}
@@ -187,9 +189,9 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
if (newts < 800000000)
{
sendto_realops_flags(UMODE_DEBUG, L_ALL, SEND_NOTICE,
- "*** Bogus TS %lu on %s ignored from %s",
- (unsigned long)newts, chptr->chname,
- client_p->name);
+ "*** Bogus TS %lu on %s ignored from %s",
+ (unsigned long)newts, chptr->chname,
+ client_p->name);
newts = (oldts == 0) ? 0 : 800000000;
}
@@ -199,11 +201,11 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
if (!newts && !isnew && oldts)
{
sendto_channel_local(ALL_MEMBERS, 0, chptr,
- ":%s NOTICE %s :*** Notice -- TS for %s changed from %lu to 0",
- me.name, chptr->chname, chptr->chname, (unsigned long)oldts);
+ ":%s NOTICE %s :*** Notice -- TS for %s changed from %lu to 0",
+ me.name, chptr->chname, chptr->chname, (unsigned long)oldts);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "Server %s changing TS on %s from %lu to 0",
- source_p->name, chptr->chname, (unsigned long)oldts);
+ "Server %s changing TS on %s from %lu to 0",
+ source_p->name, chptr->chname, (unsigned long)oldts);
}
}
@@ -252,9 +254,9 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
}
sendto_channel_local(ALL_MEMBERS, 0, chptr,
- ":%s NOTICE %s :*** Notice -- TS for %s changed from %lu to %lu",
- me.name, chptr->chname, chptr->chname,
- (unsigned long)oldts, (unsigned long)newts);
+ ":%s NOTICE %s :*** Notice -- TS for %s changed from %lu to %lu",
+ me.name, chptr->chname, chptr->chname,
+ (unsigned long)oldts, (unsigned long)newts);
}
if (*modebuf != '\0')
@@ -262,7 +264,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
/* This _SHOULD_ be to ALL_MEMBERS
* It contains only +imnpstlk, etc */
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s %s",
- servername, chptr->chname, modebuf, parabuf);
+ servername, chptr->chname, modebuf, parabuf);
}
if (parv[3][0] != '0' && keep_new_modes)
@@ -291,9 +293,9 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
if (buflen >= (IRCD_BUFSIZE - IRCD_MAX(NICKLEN, IDLEN) - 2 - 3 - 1))
{
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
- "Long SJOIN from server: %s(via %s) (ignored)",
- source_p->name, client_p->name);
- return;
+ "Long SJOIN from server: %s(via %s) (ignored)",
+ source_p->name, client_p->name);
+ return 0;
}
mbuf = modebuf;
@@ -323,22 +325,22 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
switch (*s)
{
case '@':
- fl |= CHFL_CHANOP;
- s++;
- break;
+ fl |= CHFL_CHANOP;
+ s++;
+ break;
#ifdef HALFOPS
case '%':
- fl |= CHFL_HALFOP;
- s++;
- break;
+ fl |= CHFL_HALFOP;
+ s++;
+ break;
#endif
case '+':
fl |= CHFL_VOICE;
s++;
- break;
+ break;
default:
- valid_mode = 0;
- break;
+ valid_mode = 0;
+ break;
}
} while (valid_mode);
@@ -370,7 +372,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
*np++ = '@';
*up++ = '@';
len_nick++;
- len_uid++;
+ len_uid++;
}
#ifdef HALFOPS
if (fl & CHFL_HALFOP)
@@ -378,7 +380,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
*np++ = '%';
*up++ = '%';
len_nick++;
- len_uid++;
+ len_uid++;
}
#endif
if (fl & CHFL_VOICE)
@@ -386,7 +388,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
*np++ = '+';
*up++ = '+';
len_nick++;
- len_uid++;
+ len_uid++;
}
}
else
@@ -401,7 +403,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
if ((nick_ptr - nick_buf + len_nick) > (IRCD_BUFSIZE - 2))
{
sendto_server(client_p, 0, CAP_TS6, "%s", nick_buf);
-
+
buflen = snprintf(nick_buf, sizeof(nick_buf), ":%s SJOIN %lu %s %s %s:",
source_p->name, (unsigned long)tstosend,
chptr->chname, modebuf, parabuf);
@@ -409,11 +411,11 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
}
nick_ptr += sprintf(nick_ptr, "%s%s ", nick_prefix, target_p->name);
-
+
if ((uid_ptr - uid_buf + len_uid) > (IRCD_BUFSIZE - 2))
{
sendto_server(client_p, CAP_TS6, 0, "%s", uid_buf);
-
+
buflen = snprintf(uid_buf, sizeof(uid_buf), ":%s SJOIN %lu %s %s %s:",
ID(source_p), (unsigned long)tstosend,
chptr->chname, modebuf, parabuf);
@@ -421,7 +423,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
}
uid_ptr += sprintf(uid_ptr, "%s%s ", uid_prefix, ID(target_p));
-
+
if (!IsMember(target_p, chptr))
{
add_user_to_channel(chptr, target_p, fl, !have_many_nicks);
@@ -442,21 +444,22 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
if (pargs >= MAXMODEPARAMS)
{
- /*
- * Ok, the code is now going to "walk" through
- * sendbuf, filling in para strings. So, I will use sptr
- * to point into the sendbuf.
- * Notice, that ircsprintf() returns the number of chars
- * successfully inserted into string.
- * - Dianora
- */
-
- sptr = sendbuf;
+ /*
+ * Ok, the code is now going to "walk" through
+ * sendbuf, filling in para strings. So, I will use sptr
+ * to point into the sendbuf.
+ * Notice, that ircsprintf() returns the number of chars
+ * successfully inserted into string.
+ * - Dianora
+ */
+
+ sptr = sendbuf;
*mbuf = '\0';
+
for(lcount = 0; lcount < MAXMODEPARAMS; lcount++)
{
- slen = sprintf(sptr, " %s", para[lcount]); /* see? */
- sptr += slen; /* ready for next */
+ slen = sprintf(sptr, " %s", para[lcount]); /* see? */
+ sptr += slen; /* ready for next */
}
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s",
servername, chptr->chname, modebuf, sendbuf);
@@ -500,12 +503,12 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
if (pargs >= MAXMODEPARAMS)
{
- sptr = sendbuf;
+ sptr = sendbuf;
*mbuf = '\0';
for (lcount = 0; lcount < MAXMODEPARAMS; lcount++)
{
slen = sprintf(sptr, " %s", para[lcount]);
- sptr += slen;
+ sptr += slen;
}
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s",
servername, chptr->chname, modebuf, sendbuf);
@@ -567,11 +570,11 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
if ((dlink_list_length(&chptr->members) == 0) && isnew)
{
destroy_channel(chptr);
- return;
+ return 0;
}
if (parv[4 + args][0] == '\0')
- return;
+ return 0;
/* relay the SJOIN to other servers */
DLINK_FOREACH(m, serv_list.head)
@@ -601,7 +604,9 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
remove_ban_list(chptr, client_p, &chptr->invexlist,
'I', CAP_IE);
clear_ban_cache(chptr);
- }
+ }
+
+ return 0;
}
/* set_final_mode
@@ -736,16 +741,14 @@ remove_a_mode(struct Channel *chptr, struct Client *source_p,
for(i = 0; i < MAXMODEPARAMS; i++)
{
l = sprintf(sp, " %s", lpara[i]);
- sp += l;
+ sp += l;
}
*mbuf = '\0';
- sendto_channel_local(ALL_MEMBERS, 0, chptr,
- ":%s MODE %s %s%s",
- (IsHidden(source_p) ||
- ConfigServerHide.hide_servers) ?
- me.name : source_p->name,
- chptr->chname, lmodebuf, sendbuf);
+ sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s",
+ (IsHidden(source_p) || ConfigServerHide.hide_servers) ?
+ me.name : source_p->name,
+ chptr->chname, lmodebuf, sendbuf);
mbuf = lmodebuf;
*mbuf++ = '-';
count = 0;
@@ -762,11 +765,10 @@ remove_a_mode(struct Channel *chptr, struct Client *source_p,
l = sprintf(sp, " %s", lpara[i]);
sp += l;
}
- sendto_channel_local(ALL_MEMBERS, 0, chptr,
- ":%s MODE %s %s%s",
- (IsHidden(source_p) || ConfigServerHide.hide_servers) ?
- me.name : source_p->name,
- chptr->chname, lmodebuf, sendbuf);
+ sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s",
+ (IsHidden(source_p) || ConfigServerHide.hide_servers) ?
+ me.name : source_p->name,
+ chptr->chname, lmodebuf, sendbuf);
}
}
@@ -787,11 +789,10 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
dlink_node *ptr = NULL;
dlink_node *next_ptr = NULL;
char *pbuf = NULL;
- int count = 0;
+ int count = 0;
int cur_len, mlen, plen;
pbuf = lparabuf;
-
cur_len = mlen = sprintf(lmodebuf, ":%s MODE %s -",
source_p->name, chptr->chname);
mbuf = lmodebuf + mlen;
@@ -808,14 +809,13 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
*mbuf = *(pbuf - 1) = '\0';
sendto_channel_local(ALL_MEMBERS, 0, chptr, "%s %s",
lmodebuf, lparabuf);
- sendto_server(source_p, cap, CAP_TS6,
- "%s %s", lmodebuf, lparabuf);
+ sendto_server(source_p, cap, CAP_TS6, "%s %s", lmodebuf, lparabuf);
cur_len = mlen;
mbuf = lmodebuf + mlen;
pbuf = lparabuf;
count = 0;
- }
+ }
*mbuf++ = c;
cur_len += plen;
@@ -828,13 +828,13 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
*mbuf = *(pbuf - 1) = '\0';
sendto_channel_local(ALL_MEMBERS, 0, chptr, "%s %s", lmodebuf, lparabuf);
- sendto_server(source_p, cap, CAP_TS6,
- "%s %s", lmodebuf, lparabuf);
+ sendto_server(source_p, cap, CAP_TS6, "%s %s", lmodebuf, lparabuf);
}
-static struct Message sjoin_msgtab = {
+static struct Message sjoin_msgtab =
+{
"SJOIN", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
- {m_unregistered, m_ignore, ms_sjoin, m_ignore, m_ignore, m_ignore}
+ { m_unregistered, m_ignore, ms_sjoin, m_ignore, m_ignore, m_ignore }
};
static void
@@ -849,7 +849,8 @@ module_exit(void)
mod_del_cmd(&sjoin_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",
diff --git a/modules/core/m_squit.c b/modules/core/m_squit.c
index 966a831..c12409f 100644
--- a/modules/core/m_squit.c
+++ b/modules/core/m_squit.c
@@ -1,8 +1,7 @@
/*
- * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
- * m_squit.c: Makes a server quit.
+ * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
*
- * Copyright (C) 2002 by the past and present ircd coders, and others.
+ * Copyright (c) 1997-2014 ircd-hybrid development team
*
* 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
@@ -18,8 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
- * $Id$
+ */
+
+/*! \file m_squit.c
+ * \brief Includes required functions for processing the SQUIT command.
+ * \version $Id$
*/
#include "stdinc.h"
@@ -42,7 +44,7 @@
* parv[1] = server name
* parv[2] = comment
*/
-static void
+static int
mo_squit(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -57,7 +59,7 @@ mo_squit(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
me.name, source_p->name, "SQUIT");
- return;
+ return 0;
}
server = parv[1];
@@ -83,21 +85,21 @@ mo_squit(struct Client *client_p, struct Client *source_p,
{
sendto_one(source_p, form_str(ERR_NOSUCHSERVER),
me.name, source_p->name, server);
- return;
+ return 0;
}
if (!MyConnect(target_p) && !HasOFlag(source_p, OPER_FLAG_SQUIT_REMOTE))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "squit:remote");
- return;
+ return 0;
}
if (MyConnect(target_p) && !HasOFlag(source_p, OPER_FLAG_SQUIT))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "squit");
- return;
+ return 0;
}
comment = (parc > 2 && parv[2]) ? parv[2] : def_reason;
@@ -115,6 +117,7 @@ mo_squit(struct Client *client_p, struct Client *source_p,
}
exit_client(target_p, source_p, comment);
+ return 0;
}
/** NOTE: I removed wildcard lookups here, because a wildcarded
@@ -126,7 +129,7 @@ mo_squit(struct Client *client_p, struct Client *source_p,
* parv[1] = server name
* parv[2] = comment
*/
-static void
+static int
ms_squit(struct Client *client_p, struct Client *source_p,
int parc, char *parv[])
{
@@ -134,13 +137,13 @@ ms_squit(struct Client *client_p, struct Client *source_p,
const char *comment = NULL;
if (parc < 2 || EmptyString(parv[parc - 1]))
- return;
+ return 0;
if ((target_p = hash_find_server(parv[1])) == NULL)
- return;
+ return 0;
if (!IsServer(target_p) && !IsMe(target_p))
- return;
+ return 0;
if (IsMe(target_p))
target_p = client_p;
@@ -159,14 +162,16 @@ ms_squit(struct Client *client_p, struct Client *source_p,
me.name, target_p->name, source_p->name, comment);
ilog(LOG_TYPE_IRCD, "SQUIT From %s : %s (%s)", source_p->name,
target_p->name, comment);
- }
+ }
- exit_client(target_p, source_p, comment);
+ exit_client(target_p, source_p, comment);
+ return 0;
}
-static struct Message squit_msgtab = {
+static struct Message squit_msgtab =
+{
"SQUIT", 0, 0, 1, MAXPARA, MFLG_SLOW, 0,
- {m_unregistered, m_not_oper, ms_squit, m_ignore, mo_squit, m_ignore}
+ { m_unregistered, m_not_oper, ms_squit, m_ignore, mo_squit, m_ignore }
};
static void
@@ -181,7 +186,8 @@ module_exit(void)
mod_del_cmd(&squit_msgtab);
}
-struct module module_entry = {
+struct module module_entry =
+{
.node = { NULL, NULL, NULL },
.name = NULL,
.version = "$Revision$",