commit - b86e33ef4945e21078b2c1f37a5d276e615450ee
commit + 904c8a4375cb9deed64007b06c6a7ba42313d93d
blob - 06b88bae1db7404693df44b298a897b8c31c55cc
blob + 6b8d74530c7c07c71c532e2379387c97bf1596a3
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* 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
/* Check that the channel name is valid */
if (! Channel_IsValidName(Name)) {
- IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
+ IRC_WriteErrClient(Client, ERR_NOSUCHCHANNEL_MSG,
Client_ID(Client), Name);
return false;
}
/* Check that specified channel exists */
chan = Channel_Search(Name);
if (!chan) {
- IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
+ IRC_WriteErrClient(Client, ERR_NOSUCHCHANNEL_MSG,
Client_ID(Client), Name);
return false;
}
/* Check that the client is in the channel */
if (!Get_Cl2Chan(chan, Client)) {
- IRC_WriteStrClient(Client, ERR_NOTONCHANNEL_MSG,
+ IRC_WriteErrClient(Client, ERR_NOTONCHANNEL_MSG,
Client_ID(Client), Name);
return false;
}
/* Check that channel exists */
chan = Channel_Search( Name );
- if( ! chan )
- {
- IRC_WriteStrClient( Origin, ERR_NOSUCHCHANNEL_MSG, Client_ID( Origin ), Name );
+ if (!chan) {
+ IRC_WriteErrClient(Origin, ERR_NOSUCHCHANNEL_MSG,
+ Client_ID(Origin), Name);
return;
}
Client_Type(Origin) != CLIENT_SERVICE) {
/* Check that user is on the specified channel */
if (!Channel_IsMemberOf(chan, Origin)) {
- IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG,
- Client_ID(Origin), Name);
+ IRC_WriteErrClient(Origin, ERR_NOTONCHANNEL_MSG,
+ Client_ID(Origin), Name);
return;
}
}
/* Check that the client to be kicked is on the specified channel */
if (!Channel_IsMemberOf(chan, Target)) {
- IRC_WriteStrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
+ IRC_WriteErrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
Client_ID(Origin), Client_ID(Target), Name );
return;
}
|| Client_HasMode(Target, 'q')
|| Client_Type(Target) == CLIENT_SERVICE)
&& !Client_HasMode(Origin, 'o')) {
- IRC_WriteStrClient(Origin, ERR_KICKDENY_MSG,
+ IRC_WriteErrClient(Origin, ERR_KICKDENY_MSG,
Client_ID(Origin), Name,
Client_ID(Target));
return;
can_kick = true;
if(!can_kick) {
- IRC_WriteStrClient(Origin, ERR_CHANOPPRIVTOOLOW_MSG,
- Client_ID(Origin), Name);
+ IRC_WriteErrClient(Origin, ERR_CHANOPPRIVTOOLOW_MSG,
+ Client_ID(Origin), Name);
return;
}
}
if (! SendErrors)
return CONNECTED; /* no error, see RFC 2812 */
if (Channel_HasMode(Chan, 'M'))
- return IRC_WriteStrClient(From, ERR_NEEDREGGEDNICK_MSG,
+ return IRC_WriteErrClient(From, ERR_NEEDREGGEDNICK_MSG,
Client_ID(From), Channel_Name(Chan));
else
- return IRC_WriteStrClient(From, ERR_CANNOTSENDTOCHAN_MSG,
+ return IRC_WriteErrClient(From, ERR_CANNOTSENDTOCHAN_MSG,
Client_ID(From), Channel_Name(Chan));
}
blob - a6ada37d7635376c1bdb7296125dfdca55775b0f
blob + cf0720b9942e81631a84fc0900fb259903b8ac99
--- src/ngircd/client.c
+++ src/ngircd/client.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* 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
if (!Client_IsValidNick(Nick)) {
if (strlen(Nick ) >= Conf_MaxNickLength)
- IRC_WriteStrClient(Client, ERR_NICKNAMETOOLONG_MSG,
+ IRC_WriteErrClient(Client, ERR_NICKNAMETOOLONG_MSG,
Client_ID(Client), Nick,
Conf_MaxNickLength - 1);
else
- IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
+ IRC_WriteErrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
Client_ID(Client), Nick);
return false;
}
&& Client_Type(Client) != CLIENT_SERVICE) {
/* Make sure that this isn't a restricted/forbidden nickname */
if (Conf_NickIsBlocked(Nick)) {
- IRC_WriteStrClient(Client, ERR_FORBIDDENNICKNAME_MSG,
+ IRC_WriteErrClient(Client, ERR_FORBIDDENNICKNAME_MSG,
Client_ID(Client), Nick);
return false;
}
/* Nickname already registered? */
if (Client_Search(Nick)) {
- IRC_WriteStrClient(Client, ERR_NICKNAMEINUSE_MSG,
+ IRC_WriteErrClient(Client, ERR_NICKNAMEINUSE_MSG,
Client_ID(Client), Nick);
return false;
}
/* ID too long? */
if (strlen(ID) > CLIENT_ID_LEN) {
- IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID(Client), ID);
+ IRC_WriteErrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
+ Client_ID(Client), ID);
return false;
}
blob - 74c732271203ac0a49db6b9dde05b30dd1551dfc
blob + 7fcba73fea9bbd14b3f8ec596b98a12c3276a291
--- src/ngircd/irc-cap.c
+++ src/ngircd/irc-cap.c
return Handle_CAP_ACK(Client, Req->argv[1]);
}
- return IRC_WriteStrClient(Client, ERR_INVALIDCAP_MSG,
+ return IRC_WriteErrClient(Client, ERR_INVALIDCAP_MSG,
Client_ID(Client), Req->argv[0]);
}
blob - 6f20b03fb9297e006f897017d429f10a9328f880
blob + 17ecbf9308c9c17b455b81f1b6d9ea5e55c0c96e
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2013 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* 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
if (is_banned && !is_invited && !is_exception) {
/* Client is banned from channel (and not on invite list) */
- IRC_WriteStrClient(Client, ERR_BANNEDFROMCHAN_MSG,
+ IRC_WriteErrClient(Client, ERR_BANNEDFROMCHAN_MSG,
Client_ID(Client), channame);
return false;
}
if (Channel_HasMode(chan, 'i') && !is_invited) {
/* Channel is "invite-only" and client is not on invite list */
- IRC_WriteStrClient(Client, ERR_INVITEONLYCHAN_MSG,
+ IRC_WriteErrClient(Client, ERR_INVITEONLYCHAN_MSG,
Client_ID(Client), channame);
return false;
}
if (!Channel_CheckKey(chan, Client, key ? key : "")) {
/* Channel is protected by a channel key and the client
* didn't specify the correct one */
- IRC_WriteStrClient(Client, ERR_BADCHANNELKEY_MSG,
+ IRC_WriteErrClient(Client, ERR_BADCHANNELKEY_MSG,
Client_ID(Client), channame);
return false;
}
if (Channel_HasMode(chan, 'l') &&
(Channel_MaxUsers(chan) <= Channel_MemberCount(chan))) {
/* There are more clints joined to this channel than allowed */
- IRC_WriteStrClient(Client, ERR_CHANNELISFULL_MSG,
+ IRC_WriteErrClient(Client, ERR_CHANNELISFULL_MSG,
Client_ID(Client), channame);
return false;
}
if (Channel_HasMode(chan, 'z') && !Conn_UsesSSL(Client_Conn(Client))) {
/* Only "secure" clients are allowed, but clients doesn't
* use SSL encryption */
- IRC_WriteStrClient(Client, ERR_SECURECHANNEL_MSG,
+ IRC_WriteErrClient(Client, ERR_SECURECHANNEL_MSG,
Client_ID(Client), channame);
return false;
}
if (Channel_HasMode(chan, 'O') && !Client_OperByMe(Client)) {
/* Only IRC operators are allowed! */
- IRC_WriteStrClient(Client, ERR_OPONLYCHANNEL_MSG,
+ IRC_WriteErrClient(Client, ERR_OPONLYCHANNEL_MSG,
Client_ID(Client), channame);
return false;
}
if (Channel_HasMode(chan, 'R') && !Client_HasMode(Client, 'R')) {
/* Only registered users are allowed! */
- IRC_WriteStrClient(Client, ERR_REGONLYCHANNEL_MSG,
+ IRC_WriteErrClient(Client, ERR_REGONLYCHANNEL_MSG,
Client_ID(Client), channame);
return false;
}
/* Make sure that "channame" is not the empty string ("JOIN :") */
if (! channame)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
while (channame) {
chan = Channel_Search(channame);
if (!chan && !strchr(Conf_AllowedChannelTypes, channame[0])) {
/* channel must be created, but forbidden by config */
- IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
+ IRC_WriteErrClient(Client, ERR_NOSUCHCHANNEL_MSG,
Client_ID(Client), channame);
goto join_next;
}
/* Test if the user has reached the channel limit */
if ((Conf_MaxJoins > 0) &&
(Channel_CountForUser(Client) >= Conf_MaxJoins)) {
- if (!IRC_WriteStrClient(Client,
+ if (!IRC_WriteErrClient(Client,
ERR_TOOMANYCHANNELS_MSG,
Client_ID(Client), channame))
return DISCONNECTED;
/* Make sure that "chan" is not the empty string ("PART :") */
if (! chan)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
while (chan) {
chan = Channel_Search(Req->argv[0]);
if (!chan)
- return IRC_WriteStrClient(from, ERR_NOSUCHCHANNEL_MSG,
+ return IRC_WriteErrClient(from, ERR_NOSUCHCHANNEL_MSG,
Client_ID(from), Req->argv[0]);
/* Only remote servers and channel members are allowed to change the
topic_power = Client_HasMode(from, 'o');
if (!Channel_IsMemberOf(chan, from)
&& !(Conf_OperCanMode && topic_power))
- return IRC_WriteStrClient(from, ERR_NOTONCHANNEL_MSG,
+ return IRC_WriteErrClient(from, ERR_NOTONCHANNEL_MSG,
Client_ID(from), Req->argv[0]);
} else
topic_power = true;
!Channel_UserHasMode(chan, from, 'o') &&
!Channel_UserHasMode(chan, from, 'a') &&
!Channel_UserHasMode(chan, from, 'q'))
- return IRC_WriteStrClient(from, ERR_CHANOPRIVSNEEDED_MSG,
+ return IRC_WriteErrClient(from, ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(from),
Channel_Name(chan));
}
/* Forward to other server? */
target = Client_Search(Req->argv[1]);
if (! target || Client_Type(target) != CLIENT_SERVER)
- return IRC_WriteStrClient(from, ERR_NOSUCHSERVER_MSG,
+ return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG,
Client_ID(Client),
Req->argv[1]);
/* Bad number of parameters? */
if (Req->argc < 2 || Req->argc == 4 || Req->argc > 5)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
/* Compatibility kludge */
blob - b1d3a697ca0b55c0e3f9bc858fe5b0c3c534d8a1
blob + 0bbe310a6b29183dd1f803915f9b17de88039ebe
--- src/ngircd/irc-encoding.c
+++ src/ngircd/irc-encoding.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* 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
assert (Req != NULL);
if (Req->argc != 1)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
strlcpy(encoding, Req->argv[0], sizeof(encoding));
ngt_UpperStr(encoding);
if (!Conn_SetEncoding(Client_Conn(Client), encoding))
- return IRC_WriteStrClient(Client, ERR_IP_CHARCONV_MSG,
+ return IRC_WriteErrClient(Client, ERR_IP_CHARCONV_MSG,
Client_ID(Client), encoding);
return IRC_WriteStrClient(Client, RPL_IP_CHARCONV_MSG,
blob - f87714fc90187927db3caf3d4e7e7024aa7642fd
blob + 47a3797974a0d8c9f511c86b32055aa30b4f60fb
--- src/ngircd/irc-info.c
+++ src/ngircd/irc-info.c
case 'k': /* Server-local bans ("K-Lines") */
case 'K':
if (!Client_HasMode(from, 'o'))
- return IRC_WriteStrClient(from, ERR_NOPRIVILEGES_MSG,
+ return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
Client_ID(from));
if (query == 'g' || query == 'G')
list = Class_GetList(CLASS_GLINE);
{
assert(Client != NULL);
- IRC_SetPenalty(Client, 1);
-
- return IRC_WriteStrClient(Client, ERR_SUMMONDISABLED_MSG,
+ return IRC_WriteErrClient(Client, ERR_SUMMONDISABLED_MSG,
Client_ID(Client));
} /* IRC_SUMMON */
{
assert(Client != NULL);
- IRC_SetPenalty(Client, 1);
-
- return IRC_WriteStrClient(Client, ERR_USERSDISABLED_MSG,
+ return IRC_WriteErrClient(Client, ERR_USERSDISABLED_MSG,
Client_ID(Client));
} /* IRC_USERS */
only_ops = true;
#ifdef STRICT_RFC
else
- return IRC_WriteStrClient(Client,
+ return IRC_WriteErrClient(Client,
ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client),
Req->command);
/* Bad number of parameters? */
if (Req->argc < 1 || Req->argc > 2)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
if (!IRC_WHOIS_SendReply(Client, from, c))
return DISCONNECTED;
} else {
- if (!IRC_WriteStrClient(Client,
+ if (!IRC_WriteErrClient(Client,
ERR_NOSUCHNICK_MSG,
Client_ID(Client),
query))
}
if (got_wildcard) {
/* we already handled one wildcard query */
- if (!IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ if (!IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), query))
return DISCONNECTED;
continue;
}
if (match_count == 0)
- IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client),
Req->argv[Req->argc - 1]);
}
/* Wrong number of parameters? */
if (Req->argc < 1)
- return IRC_WriteStrClient(Client, ERR_NONICKNAMEGIVEN_MSG,
+ return IRC_WriteErrClient(Client, ERR_NONICKNAMEGIVEN_MSG,
Client_ID(Client));
_IRC_ARGC_LE_OR_RETURN_(Client, Req, 3)
break;
} while (i != last);
- if (nc == 0 && !IRC_WriteStrClient(prefix, ERR_WASNOSUCHNICK_MSG,
+ if (nc == 0 && !IRC_WriteErrClient(prefix, ERR_WASNOSUCHNICK_MSG,
Client_ID(prefix), nick))
return DISCONNECTED;
}
len_tot = array_bytes(&Conf_Motd);
if (len_tot == 0 && !Conn_UsesSSL(Client_Conn(Client)))
- return IRC_WriteStrClient(Client, ERR_NOMOTD_MSG, Client_ID(Client));
+ return IRC_WriteErrClient(Client, ERR_NOMOTD_MSG, Client_ID(Client));
if (!IRC_WriteStrClient(Client, RPL_MOTDSTART_MSG, Client_ID(Client),
Client_ID(Client_ThisServer())))
blob - 1915a6d75a6d8f6b0edb622a8ac4ef282818e145
blob + 26dae6b73b2826ca82a47d2263f4f7b6607fe7d6
--- src/ngircd/irc-login.c
+++ src/ngircd/irc-login.c
/* Return an error if this is not a local client */
if (Client_Conn(Client) <= NONE)
- return IRC_WriteStrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
+ return IRC_WriteErrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
Client_ID(Client), Req->command);
if (Client_Type(Client) == CLIENT_UNKNOWN && Req->argc == 1) {
} else if (Client_Type(Client) == CLIENT_UNKNOWN ||
Client_Type(Client) == CLIENT_UNKNOWNSERVER) {
/* Unregistered connection, but wrong number of arguments: */
- IRC_SetPenalty(Client, 2);
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
} else {
/* Registered connection, PASS command is not allowed! */
- IRC_SetPenalty(Client, 2);
- return IRC_WriteStrClient(Client, ERR_ALREADYREGISTRED_MSG,
+ return IRC_WriteErrClient(Client, ERR_ALREADYREGISTRED_MSG,
Client_ID(Client));
}
if (Client_Type(Client) == CLIENT_SERVER) {
target = Client_Search(Req->prefix);
if (!target)
- return IRC_WriteStrClient( Client,
- ERR_NOSUCHNICK_MSG,
- Client_ID( Client ),
- Req->argv[0] );
+ return IRC_WriteErrClient(Client,
+ ERR_NOSUCHNICK_MSG,
+ Client_ID(Client),
+ Req->argv[0]);
} else {
/* Is this a restricted client? */
- if (Client_HasMode(Client, 'r')) {
- IRC_SetPenalty(Client, 2);
- return IRC_WriteStrClient( Client,
- ERR_RESTRICTED_MSG,
- Client_ID( Client ));
- }
+ if (Client_HasMode(Client, 'r'))
+ return IRC_WriteErrClient(Client,
+ ERR_RESTRICTED_MSG,
+ Client_ID(Client));
target = Client;
}
/* Bad number of parameters? */
if (Req->argc != 2 && Req->argc != 7)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
if (Req->argc >= 7) {
return CONNECTED;
}
else
- return IRC_WriteStrClient(Client, ERR_ALREADYREGISTRED_MSG,
+ return IRC_WriteErrClient(Client, ERR_ALREADYREGISTRED_MSG,
Client_ID(Client));
} /* IRC_NICK */
/* Search the target */
target = Client_Search(Req->argv[0]);
if (!target || Client_Type(target) != CLIENT_USER) {
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->argv[0]);
}
c = Client_Search(Req->prefix);
if (!c)
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client),
Req->prefix);
return CONNECTED;
} else if (Client_Type(Client) == CLIENT_USER) {
/* Already registered connection */
- IRC_SetPenalty(Client, 2);
- return IRC_WriteStrClient(Client, ERR_ALREADYREGISTRED_MSG,
+ return IRC_WriteErrClient(Client, ERR_ALREADYREGISTRED_MSG,
Client_ID(Client));
} else {
/* Unexpected/invalid connection state? */
- IRC_SetPenalty(Client, 2);
- return IRC_WriteStrClient(Client, ERR_NOTREGISTERED_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOTREGISTERED_MSG,
Client_ID(Client));
}
} /* IRC_USER */
assert(Req != NULL);
if (Client_Type(Client) != CLIENT_GOTPASS &&
- Client_Type(Client) != CLIENT_SERVER) {
- IRC_SetPenalty(Client, 2);
- return IRC_WriteStrClient(Client, ERR_ALREADYREGISTRED_MSG,
+ Client_Type(Client) != CLIENT_SERVER)
+ return IRC_WriteErrClient(Client, ERR_ALREADYREGISTRED_MSG,
Client_ID(Client));
- }
_IRC_ARGC_EQ_OR_RETURN_(Client, Req, 6)
if (Client_Type(Client) != CLIENT_SERVER)
- return IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
+ return IRC_WriteErrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
Client_ID(Client), Req->argv[0]);
nick = Req->argv[0];
_IRC_ARGC_EQ_OR_RETURN_(Client, Req, 4)
if (!Conf_WebircPwd[0] || strcmp(Req->argv[0], Conf_WebircPwd) != 0)
- return IRC_WriteStrClient(Client, ERR_PASSWDMISMATCH_MSG,
+ return IRC_WriteErrClient(Client, ERR_PASSWDMISMATCH_MSG,
Client_ID(Client));
LogDebug("Connection %d: got valid WEBIRC command: user=%s, host=%s, ip=%s",
assert(Req != NULL);
if (Req->argc < 1)
- return IRC_WriteStrClient(Client, ERR_NOORIGIN_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOORIGIN_MSG,
Client_ID(Client));
#ifdef STRICT_RFC
/* Don't ignore additional arguments when in "strict" mode */
target = Client_Search(Req->argv[1]);
if (!target || Client_Type(target) != CLIENT_SERVER)
- return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG,
Client_ID(Client), Req->argv[1]);
if (target != Client_ThisServer()) {
else
from = Client;
if (!from)
- return IRC_WriteStrClient(Client,
+ return IRC_WriteErrClient(Client,
ERR_NOSUCHSERVER_MSG,
Client_ID(Client), Req->prefix);
} else
from = Client_ThisServer();
if (!from)
- return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG,
Client_ID(Client), Req->prefix);
Log(LOG_DEBUG, "Connection %d: got PING, sending PONG ...",
/* Wrong number of arguments? */
if (Req->argc < 1) {
if (Client_Type(Client) == CLIENT_USER)
- return IRC_WriteStrClient(Client, ERR_NOORIGIN_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOORIGIN_MSG,
Client_ID(Client));
else
return CONNECTED;
if (Req->argc == 2 && Client_Type(Client) == CLIENT_SERVER) {
target = Client_Search(Req->argv[0]);
if (!target)
- return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG,
Client_ID(Client), Req->argv[0]);
from = Client_Search(Req->prefix);
if (target != Client_ThisServer() && target != from) {
/* Ok, we have to forward the message. */
if (!from)
- return IRC_WriteStrClient(Client,
+ return IRC_WriteErrClient(Client,
ERR_NOSUCHSERVER_MSG,
Client_ID(Client), Req->prefix);
blob - 3c8a4a85623bc9c6ccaf53180e49a2170a38fa0f
blob + 14ffe351ed6a98984a6eac0f0c8e9fc39c13e818
--- src/ngircd/irc-metadata.c
+++ src/ngircd/irc-metadata.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* 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
assert(Req != NULL);
if (Req->argc != 3)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
prefix = Client_Search(Req->prefix);
if (!prefix)
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->prefix);
target = Client_Search(Req->argv[0]);
if (!target)
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->argv[0]);
LogDebug("Got \"METADATA\" command from \"%s\" for client \"%s\": \"%s=%s\".",
blob - 0df848f3943ee1a18c685f403898e353784014b2
blob + 88d2294bad203efe377820bc8f9aaee822056544
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
return Channel_Mode(Client, Req, origin, chan);
/* No target found! */
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->argv[0]);
} /* IRC_MODE */
if (Client_Type(Client) == CLIENT_USER) {
/* Users are only allowed to manipulate their own modes! */
if (Target != Client)
- return IRC_WriteStrClient(Client,
+ return IRC_WriteErrClient(Client,
ERR_USERSDONTMATCH_MSG,
Client_ID(Client));
}
set = false;
strcpy(the_modes, "-");
} else
- return IRC_WriteStrClient(Origin, ERR_UMODEUNKNOWNFLAG_MSG,
+ return IRC_WriteErrClient(Origin, ERR_UMODEUNKNOWNFLAG_MSG,
Client_ID(Origin));
x[1] = '\0';
x[0] = 'a';
Client_SetAway(Origin, DEFAULT_AWAY_MSG);
} else
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
break;
case 'B': /* Bot */
if (Client_HasMode(Client, 'r'))
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_RESTRICTED_MSG,
Client_ID(Origin));
else
|| Client_OperByMe(Origin))
x[0] = 'c';
else
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
break;
Client_SetOperByMe(Target, false);
x[0] = 'o';
} else
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
break;
|| Client_OperByMe(Origin))
x[0] = 'q';
else
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
break;
if (set || Client_Type(Client) == CLIENT_SERVER)
x[0] = 'r';
else
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_RESTRICTED_MSG,
Client_ID(Origin));
break;
if (Client_Type(Client) == CLIENT_SERVER)
x[0] = 'R';
else
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_NICKREGISTER_MSG,
Client_ID(Origin));
break;
case 'x': /* Cloak hostname */
if (Client_HasMode(Client, 'r'))
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_RESTRICTED_MSG,
Client_ID(Origin));
else if (!set || Conf_CloakHostModeX[0]
x[0] = 'x';
send_RPL_HOSTHIDDEN_MSG = true;
} else
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
break;
"Unknown mode \"%c%c\" from \"%s\"!?",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin));
- ok = IRC_WriteStrClient(Origin,
+ ok = IRC_WriteErrClient(Origin,
ERR_UMODEUNKNOWNFLAG2_MSG,
Client_ID(Origin),
set ? '+' : '-',
is_halfop = is_op = is_admin = is_owner = is_machine = is_oper = false;
if (Channel_IsModeless(Channel))
- return IRC_WriteStrClient(Client, ERR_NOCHANMODES_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOCHANMODES_MSG,
Client_ID(Client), Channel_Name(Channel));
/* Mode request: let's answer it :-) */
/* Check if client is member of channel or an oper or an server/service */
if(!Channel_IsMemberOf(Channel, Client) && !is_oper && !is_machine)
- return IRC_WriteStrClient(Origin, ERR_NOTONCHANNEL_MSG,
+ return IRC_WriteErrClient(Origin, ERR_NOTONCHANNEL_MSG,
Client_ID(Origin),
Channel_Name(Channel));
case 'z': /* Secure connections only */
if(!is_oper && !is_machine && !is_owner &&
!is_admin && !is_op) {
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin), Channel_Name(Channel));
goto chan_exit;
is_admin || is_op || is_halfop)
x[0] = *mode_ptr;
else
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin), Channel_Name(Channel));
break;
is_admin || is_op || is_halfop)
x[0] = *mode_ptr;
else
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
sizeof(argadd));
x[0] = *mode_ptr;
} else {
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
#ifdef STRICT_RFC
/* Only send error message in "strict" mode,
* this is how ircd2.11 and others behave ... */
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command);
#endif
is_admin || is_op || is_halfop)
x[0] = *mode_ptr;
else
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
x[0] = *mode_ptr;
}
} else {
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
#ifdef STRICT_RFC
/* Only send error message in "strict" mode,
* this is how ircd2.11 and others behave ... */
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command);
#endif
if(is_oper || is_machine)
x[0] = 'O';
else
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
} else if(is_oper || is_machine || is_owner ||
is_admin || is_op)
x[0] = 'O';
else
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
if(is_oper || is_machine)
x[0] = 'P';
else
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
} else if(is_oper || is_machine || is_owner ||
is_admin || is_op)
x[0] = 'P';
else
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
case 'q': /* Owner */
case 'a': /* Channel admin */
if(!is_oper && !is_machine && !is_owner && !is_admin) {
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPPRIVTOOLOW_MSG,
Client_ID(Origin),
Channel_Name(Channel));
case 'o': /* Channel operator */
if(!is_oper && !is_machine && !is_owner &&
!is_admin && !is_op) {
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
case 'h': /* Half Op */
if(!is_oper && !is_machine && !is_owner &&
!is_admin && !is_op) {
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
if (client)
x[0] = *mode_ptr;
else
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_NOSUCHNICK_MSG,
Client_ID(Origin),
Req->argv[arg_arg]);
} else {
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
* mode, because most other servers don't do
* it as well and some clients send "wired"
* MODE commands like "MODE #chan -ooo nick". */
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command);
#endif
Client, Channel,
Req->argv[arg_arg]);
} else {
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
"Unknown mode \"%c%c\" from \"%s\" on %s!?",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin), Channel_Name(Channel));
- connected = IRC_WriteStrClient(Origin,
+ connected = IRC_WriteErrClient(Origin,
ERR_UNKNOWNMODE_MSG,
Client_ID(Origin), *mode_ptr,
Channel_Name(Channel));
/* Validate target client */
if (client && (!Channel_IsMemberOf(Channel, client))) {
- if (!IRC_WriteStrClient
- (Origin, ERR_USERNOTINCHANNEL_MSG,
- Client_ID(Origin), Client_ID(client),
- Channel_Name(Channel)))
+ if (!IRC_WriteErrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
+ Client_ID(Origin),
+ Client_ID(client),
+ Channel_Name(Channel)))
break;
-
continue;
}
return CONNECTED;
if (Client_Type(Client) == CLIENT_USER &&
current_count >= MAX_HNDL_CHANNEL_LISTS)
- return IRC_WriteStrClient(Client, ERR_LISTFULL_MSG,
+ return IRC_WriteErrClient(Client, ERR_LISTFULL_MSG,
Client_ID(Client),
Channel_Name(Channel), mask,
MAX_HNDL_CHANNEL_LISTS);
blob - 0d471512f6e024581e530344c108751bdbe96332
blob + 4cd4236eefd55cfe64a3cd7a72ce615eeee996c0
--- src/ngircd/irc-op.c
+++ src/ngircd/irc-op.c
CLIENT *target = Client_Search(nick);
if (!target)
- return IRC_WriteStrClient(from, ERR_NOSUCHNICK_MSG, Client_ID(from), nick);
+ return IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG,
+ Client_ID(from), nick);
Channel_Kick(peer, target, from, channel, reason);
return true;
nickCount--;
}
} else {
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
}
return true;
/* Search user */
target = Client_Search(Req->argv[0]);
if (!target || (Client_Type(target) != CLIENT_USER))
- return IRC_WriteStrClient(from, ERR_NOSUCHNICK_MSG,
- Client_ID(Client), Req->argv[0]);
+ return IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG,
+ Client_ID(Client), Req->argv[0]);
chan = Channel_Search(Req->argv[1]);
if (chan) {
/* Channel exists. Is the user a valid member of the channel? */
if (!Channel_IsMemberOf(chan, from))
- return IRC_WriteStrClient(from, ERR_NOTONCHANNEL_MSG, Client_ID(Client), Req->argv[1]);
+ return IRC_WriteErrClient(from, ERR_NOTONCHANNEL_MSG,
+ Client_ID(Client),
+ Req->argv[1]);
/* Is the channel "invite-disallow"? */
if (Channel_HasMode(chan, 'V'))
- return IRC_WriteStrClient(from, ERR_NOINVITE_MSG,
- Client_ID(from), Channel_Name(chan));
+ return IRC_WriteErrClient(from, ERR_NOINVITE_MSG,
+ Client_ID(from),
+ Channel_Name(chan));
/* Is the channel "invite-only"? */
if (Channel_HasMode(chan, 'i')) {
!Channel_UserHasMode(chan, from, 'a') &&
!Channel_UserHasMode(chan, from, 'o') &&
!Channel_UserHasMode(chan, from, 'h'))
- return IRC_WriteStrClient(from, ERR_CHANOPRIVSNEEDED_MSG,
- Client_ID(from), Channel_Name(chan));
+ return IRC_WriteErrClient(from,
+ ERR_CHANOPRIVSNEEDED_MSG,
+ Client_ID(from),
+ Channel_Name(chan));
remember = true;
}
/* Is the target user already member of the channel? */
if (Channel_IsMemberOf(chan, target))
- return IRC_WriteStrClient(from, ERR_USERONCHANNEL_MSG,
- Client_ID(from), Req->argv[0], Req->argv[1]);
+ return IRC_WriteErrClient(from, ERR_USERONCHANNEL_MSG,
+ Client_ID(from),
+ Req->argv[0], Req->argv[1]);
/* If the target user is banned on that channel: remember invite */
if (Lists_Check(Channel_GetListBans(chan), target))
blob - 80b9f9a4d1ff9ab1d346a22a497d5f2647ee1357
blob + 9907371eb82657c5ba05e3f693c0c4deb27eadc4
--- src/ngircd/irc-oper.c
+++ src/ngircd/irc-oper.c
{
Log(LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s",
Client_Mask(Client), errtoken, errmsg);
- IRC_SetPenalty(Client, 3);
- return IRC_WriteStrClient(Client, ERR_PASSWDMISMATCH_MSG,
+ return IRC_WriteErrClient(Client, ERR_PASSWDMISMATCH_MSG,
Client_ID(Client));
} /* Bad_OperPass */
/* Bad number of parameters? */
if (Req->argc != 0)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
Log(LOG_NOTICE|LOG_snotice, "Got RESTART command from \"%s\" ...",
/* Bad number of parameters? */
if (Req->argc != 1 && Req->argc != 2 && Req->argc != 3 &&
Req->argc != 5 && Req->argc != 6)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
/* Invalid port number? */
if ((Req->argc > 1) && atoi(Req->argv[1]) < 1)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
from = Client;
if (Client_Type(Client) == CLIENT_SERVER && Req->prefix)
from = Client_Search(Req->prefix);
if (! from)
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
- Client_ID(Client), Req->prefix);
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
+ Client_ID(Client), Req->prefix);
target = (Req->argc == 3) ? Client_Search(Req->argv[2])
: Client_Search(Req->argv[5]);
if (! target || Client_Type(target) != CLIENT_SERVER)
- return IRC_WriteStrClient(from, ERR_NOSUCHSERVER_MSG,
- Client_ID(from), Req->argv[0]);
+ return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG,
+ Client_ID(from), Req->argv[0]);
}
if (target != Client_ThisServer()) {
switch (Req->argc) {
case 1:
if (!Conf_EnablePassiveServer(Req->argv[0]))
- return IRC_WriteStrClient(from, ERR_NOSUCHSERVER_MSG,
+ return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG,
Client_ID(from),
Req->argv[0]);
break;
/* Connect configured server */
if (!Conf_EnableServer
(Req->argv[0], (UINT16) atoi(Req->argv[1])))
- return IRC_WriteStrClient(from, ERR_NOSUCHSERVER_MSG,
+ return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG,
Client_ID(from),
Req->argv[0]);
break;
if (!Conf_AddServer
(Req->argv[0], (UINT16) atoi(Req->argv[1]), Req->argv[2],
Req->argv[3], Req->argv[4]))
- return IRC_WriteStrClient(from, ERR_NOSUCHSERVER_MSG,
+ return IRC_WriteErrClient(from, ERR_NOSUCHSERVER_MSG,
Client_ID(from),
Req->argv[0]);
}
/* Bad number of parameters? */
if (Req->argc != 1)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
IRC_SendWallops(Client_ThisServer(), Client_ThisServer(),
/* Disconnect configured server */
if (!Conf_DisableServer(Req->argv[0]))
- return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG,
Client_ID(Client), Req->argv[0]);
/* Are we still connected or were we killed, too? */
switch (Client_Type(Client)) {
case CLIENT_USER:
if (!Client_OperByMe(Client))
- return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
Client_ID(Client));
from = Client;
break;
}
if (!from)
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->prefix);
IRC_SendWallops(Client, from, "%s", Req->argv[0]);
/* Bad number of parameters? */
if (Req->argc != 1 && Req->argc != 3)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
switch(Req->command[0]) {
blob - 7770be856cb0840aee2464633d1bd60344fb5e16
blob + 72acf79cdf593b0e3f132a789dcfccf3691359a2
--- src/ngircd/irc-server.c
+++ src/ngircd/irc-server.c
/* Return an error if this is not a local client */
if (Client_Conn(Client) <= NONE)
- return IRC_WriteStrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
+ return IRC_WriteErrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
Client_ID(Client), Req->command);
if (Client_Type(Client) == CLIENT_GOTPASS ||
Client_Conn(Client));
if (Req->argc != 2 && Req->argc != 3)
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client),
Req->command);
{
/* New server is being introduced to the network */
- if( Req->argc != 4 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+ if (Req->argc != 4)
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ Client_ID(Client), Req->command);
/* check for existing server with same ID */
if( ! Client_CheckID( Client, Req->argv[0] )) return DISCONNECTED;
return CONNECTED;
} else
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
} /* IRC_SERVER */
} else
from = Client;
if (!from)
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->prefix);
if (Client_Type(Client) == CLIENT_USER)
blob - 93753564770f3dbdeb32f768d01c0c991959f237
blob + 526e2fb694bdf948ccf957f6fafb9a8ca5571d25
--- src/ngircd/irc-write.c
+++ src/ngircd/irc-write.c
static void Send_Marked_Connections PARAMS((CLIENT *Prefix, const char *Buffer));
/**
+ * Send an error message to a client and enforce a penalty time.
+ *
+ * @param Client The target client.
+ * @param Format Format string.
+ * @return CONNECTED or DISCONNECTED.
+ */
+#ifdef PROTOTYPES
+GLOBAL bool
+IRC_WriteErrClient( CLIENT *Client, const char *Format, ... )
+#else
+GLOBAL bool
+IRC_WriteErrClient( Client, Format, va_alist )
+CLIENT *Client;
+const char *Format;
+va_dcl
+#endif
+{
+ char buffer[1000];
+ va_list ap;
+
+ assert(Client != NULL);
+ assert(Format != NULL);
+
+#ifdef PROTOTYPES
+ va_start(ap, Format);
+#else
+ va_start(ap);
+#endif
+ vsnprintf(buffer, 1000, Format, ap);
+ va_end(ap);
+
+ IRC_SetPenalty(Client, 2);
+ return IRC_WriteStrClientPrefix(Client, Client_ThisServer(),
+ "%s", buffer);
+}
+
+/**
* Send a message to a client.
*
* @param Client The target client.
blob - ddfe2f0e1d5e172a543269051e91decd38873257
blob + 20a6cacbeae12738a7fa69c6f6f078de12e41142
--- src/ngircd/irc-write.h
+++ src/ngircd/irc-write.h
* Sending IRC commands over the network (header)
*/
+GLOBAL bool IRC_WriteErrClient PARAMS((CLIENT *Client, const char *Format, ...));
+
GLOBAL bool IRC_WriteStrClient PARAMS((CLIENT *Client, const char *Format, ...));
GLOBAL bool IRC_WriteStrClientPrefix PARAMS((CLIENT *Client, CLIENT *Prefix,
const char *Format, ...));
blob - e4f483070c1ae494040820f3ea2fe2b9fb0883fb
blob + d1e1d41ac9b9e0cf824b72357002e54f787360e6
--- src/ngircd/irc.c
+++ src/ngircd/irc.c
assert (Req != NULL);
if (Client_Type(Client) != CLIENT_SERVER && !Client_OperByMe(Client))
- return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
Client_ID(Client));
_IRC_ARGC_EQ_OR_RETURN_(Client, Req, 2)
msg = ERR_CANTKILLSERVER_MSG;
else
msg = ERR_NOPRIVILEGES_MSG;
- return IRC_WriteStrClient(Client, msg,
+ return IRC_WriteErrClient(Client, msg,
Client_ID(Client));
}
/* Bad number of arguments? */
if (Req->argc > 1)
- return IRC_WriteStrClient(Client, ERR_NORECIPIENT_MSG,
+ return IRC_WriteErrClient(Client, ERR_NORECIPIENT_MSG,
Client_ID(Client), Req->command);
_IRC_GET_SENDER_OR_RETURN_(from, Req, Client)
if (Req->argc == 0) {
if (!SendErrors)
return CONNECTED;
- return IRC_WriteStrClient(Client, ERR_NORECIPIENT_MSG,
+ return IRC_WriteErrClient(Client, ERR_NORECIPIENT_MSG,
Client_ID(Client), Req->command);
}
if (Req->argc == 1) {
if (!SendErrors)
return CONNECTED;
- return IRC_WriteStrClient(Client, ERR_NOTEXTTOSEND_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOTEXTTOSEND_MSG,
Client_ID(Client));
}
if (Req->argc > 2) {
if (!SendErrors)
return CONNECTED;
- return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+ return IRC_WriteErrClient(Client, ERR_NEEDMOREPARAMS_MSG,
Client_ID(Client), Req->command);
}
else
from = Client;
if (!from)
- return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
Client_ID(Client), Req->prefix);
#ifdef ICONV
#else
if (Client_Type(cl) != ForceType) {
#endif
- if (SendErrors && !IRC_WriteStrClient(
+ if (SendErrors && !IRC_WriteErrClient(
from, ERR_NOSUCHNICK_MSG,Client_ID(from),
currentTarget))
return DISCONNECTED;
!Client_HasMode(from, 'o') &&
!(Client_Type(from) == CLIENT_SERVER) &&
!(Client_Type(from) == CLIENT_SERVICE)) {
- if (SendErrors && !IRC_WriteStrClient(from,
+ if (SendErrors && !IRC_WriteErrClient(from,
ERR_NONONREG_MSG,
Client_ID(from), Client_ID(cl)))
return DISCONNECTED;
cl2chan = Channel_NextChannelOf(cl, cl2chan);
}
if (!cl2chan) {
- if (SendErrors && !IRC_WriteStrClient(
+ if (SendErrors && !IRC_WriteErrClient(
from, ERR_NOTONSAMECHANNEL_MSG,
Client_ID(from), Client_ID(cl)))
return DISCONNECTED;
} else {
if (!SendErrors)
return CONNECTED;
- if (!IRC_WriteStrClient(from, ERR_NOSUCHNICK_MSG,
+ if (!IRC_WriteErrClient(from, ERR_NOSUCHNICK_MSG,
Client_ID(from), currentTarget))
return DISCONNECTED;
}
if (!Client_HasMode(from, 'o')) {
if (!SendErrors)
return true;
- return IRC_WriteStrClient(from, ERR_NOPRIVILEGES_MSG,
+ return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
Client_ID(from));
}
{
if (!SendErrors)
return true;
- return IRC_WriteStrClient(from, ERR_WILDTOPLEVEL, targetMask);
+ return IRC_WriteErrClient(from, ERR_WILDTOPLEVEL, targetMask);
}
/* #: hostmask, see RFC 2812, sec. 3.3.1 */
blob - 588513dd43dd87271d64f3b6111d25b68300ddbb
blob + 2d36cd559196c3e7639367370bf6960896f6e451
--- src/ngircd/op.c
+++ src/ngircd/op.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* 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
if (from) {
Log(LOG_NOTICE, "No privileges: client \"%s\" (%s), command \"%s\"",
Req->prefix, Client_Mask(Client), Req->command);
- return IRC_WriteStrClient(from, ERR_NOPRIVILEGES_MSG,
+ return IRC_WriteErrClient(from, ERR_NOPRIVILEGES_MSG,
Client_ID(from));
} else {
Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"",
Client_Mask(Client), Req->command);
- return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG,
+ return IRC_WriteErrClient(Client, ERR_NOPRIVILEGES_MSG,
Client_ID(Client));
}
} /* Op_NoPrivileges */
blob - c92da4d2aa76b21d96bbc3dd9e2bd767c91b4190
blob + e5eaa6ee3ff9ad6771f13668664fe1c3b5b6ead8
--- src/ngircd/parse.c
+++ src/ngircd/parse.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* 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
if (!(client_type & cmd->type)) {
if (client_type == CLIENT_USER
&& cmd->type & CLIENT_SERVER)
- return IRC_WriteStrClient(client,
+ return IRC_WriteErrClient(client,
ERR_NOTREGISTEREDSERVER_MSG,
Client_ID(client));
else
- return IRC_WriteStrClient(client,
+ return IRC_WriteErrClient(client,
ERR_NOTREGISTERED_MSG,
Client_ID(client));
}
Req->argc == 1 ? "parameter" : "parameters",
Req->prefix ? "" : " no" );
- if (Client_Type(client) != CLIENT_SERVER) {
- result = IRC_WriteStrClient(client, ERR_UNKNOWNCOMMAND_MSG,
+ if (Client_Type(client) != CLIENT_SERVER)
+ result = IRC_WriteErrClient(client, ERR_UNKNOWNCOMMAND_MSG,
Client_ID(client), Req->command);
- Conn_SetPenalty(Idx, 1);
- }
+
return result;
} /* Handle_Request */