#include "defines.h"
#include "conn.h"
-#include "client.h"
#include "channel.h"
#include "irc-write.h"
#include "lists.h"
#include "log.h"
#include "parse.h"
#include "messages.h"
-#include "resolve.h"
#include "conf.h"
#include "exp.h"
#include "irc-mode.h"
-static bool Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ));
-static bool Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel ));
+static bool Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin,
+ CLIENT *Target ));
+static bool Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin,
+ CHANNEL *Channel ));
-static bool Add_Ban_Invite PARAMS((int what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Pattern));
-static bool Del_Ban_Invite PARAMS((int what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Pattern));
+static bool Add_Ban_Invite PARAMS((int what, CLIENT *Prefix, CLIENT *Client,
+ CHANNEL *Channel, const char *Pattern));
+static bool Del_Ban_Invite PARAMS((int what, CLIENT *Prefix, CLIENT *Client,
+ CHANNEL *Channel, const char *Pattern));
-static bool Send_ListChange PARAMS(( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Mask ));
+static bool Send_ListChange PARAMS((const char *Mode, CLIENT *Prefix,
+ CLIENT *Client, CHANNEL *Channel, const char *Mask));
GLOBAL bool
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
break;
+
case 'o': /* IRC operator (only unsettable!) */
if(( ! set ) || ( Client_Type( Client ) == CLIENT_SERVER ))
{
else ok = IRC_WriteStrClient( Origin, ERR_RESTRICTED_MSG, Client_ID( Origin ));
break;
+ case 'x': /* Cloak hostname */
+ if (Client_HasMode(Client, 'r'))
+ IRC_WriteStrClient(Origin,
+ ERR_RESTRICTED_MSG,
+ Client_ID(Origin));
+ else
+ x[0] = 'x';
+ break;
+
default:
Log( LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\"!?", set ? '+' : '-', *mode_ptr, Client_ID( Origin ));
if( Client_Type( Client ) != CLIENT_SERVER ) ok = IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Origin ), set ? '+' : '-', *mode_ptr );
{
char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2],
argadd[CLIENT_PASS_LEN], *mode_ptr;
- bool connected, set, modeok = true, skiponce, use_servermode = false, retval;
+ bool connected, set, skiponce, retval, onchannel;
+ bool modeok = true, use_servermode = false;
int mode_arg, arg_arg;
CLIENT *client;
long l;
/* Is the user allowed to change modes? */
if (Client_Type(Client) == CLIENT_USER) {
/* Is the originating user on that channel? */
- if (!Channel_IsMemberOf(Channel, Origin))
- return IRC_WriteStrClient(Origin, ERR_NOTONCHANNEL_MSG,
- Client_ID(Origin), Channel_Name(Channel));
+ onchannel = Channel_IsMemberOf(Channel, Origin);
modeok = false;
/* channel operator? */
- if (strchr(Channel_UserModes(Channel, Origin), 'o'))
+ if (onchannel &&
+ strchr(Channel_UserModes(Channel, Origin), 'o')) {
modeok = true;
- else if (Conf_OperCanMode) {
+ } else if (Conf_OperCanMode) {
/* IRC-Operators can use MODE as well */
if (Client_OperByMe(Origin)) {
modeok = true;
use_servermode = true; /* Change Origin to Server */
}
}
+
+ if (!onchannel && !modeok)
+ return IRC_WriteStrClient(Origin, ERR_NOTONCHANNEL_MSG,
+ Client_ID(Origin), Channel_Name(Channel));
}
mode_arg = 1;
static bool
-Send_ListChange( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, const char *Mask )
+Send_ListChange(const char *Mode, CLIENT *Prefix, CLIENT *Client,
+ CHANNEL *Channel, const char *Mask)
{
bool ok;