summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-13 20:30:47 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-13 20:30:47 +0000
commit91df762e93212958db487d8517addba1a63a4ddd (patch)
tree62ef9a5e926a0ba1dac698c742faf5908da400fb /src/commands
parent6d57bbe05c31c79eaad02fe81cfb9c1ed6b79c58 (diff)
Membership* changes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11697 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/cmd_invite.cpp6
-rw-r--r--src/commands/cmd_nick.cpp36
-rw-r--r--src/commands/cmd_notice.cpp15
-rw-r--r--src/commands/cmd_privmsg.cpp15
-rw-r--r--src/commands/cmd_who.cpp21
5 files changed, 16 insertions, 77 deletions
diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp
index 73b7068e5..79aee9da5 100644
--- a/src/commands/cmd_invite.cpp
+++ b/src/commands/cmd_invite.cpp
@@ -91,9 +91,11 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
{
if (IS_LOCAL(user))
{
- if (c->GetStatus(user) < STATUS_HOP)
+ int rank = c->GetPrefixValue(user);
+ if (rank < HALFOP_VALUE)
{
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", user->nick.c_str(), c->name.c_str(), c->GetStatus(u) == STATUS_HOP ? "" : "half-");
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator",
+ user->nick.c_str(), c->name.c_str(), rank >= HALFOP_VALUE ? "" : "half-");
return CMD_FAILURE;
}
}
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp
index 6a181bda0..52c6a2254 100644
--- a/src/commands/cmd_nick.cpp
+++ b/src/commands/cmd_nick.cpp
@@ -13,26 +13,6 @@
#include "inspircd.h"
#include "xline.h"
-/* +------------------------------------+
- * | Inspire Internet Relay Chat Daemon |
- * +------------------------------------+
- *
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- * the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_NICK_H__
-#define __CMD_NICK_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
/** Handle /NICK. These command handlers can be reloaded by the core,
* and handle basic RFC1459 commands. Commands within modules work
@@ -54,9 +34,6 @@ class CommandNick : public Command
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
};
-#endif
-
-
/** Handle nick changes from users.
* NOTE: If you are used to ircds based on ircd2.8, and are looking
* for the client introduction code in here, youre in the wrong place.
@@ -145,8 +122,8 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
{
for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
{
- Channel *chan = i->first;
- if (chan->GetStatus(user) < STATUS_VOICE && chan->IsBanned(user))
+ Channel *chan = *i;
+ if (chan->GetPrefixValue(user) < VOICE_VALUE && chan->IsBanned(user))
{
user->WriteNumeric(404, "%s %s :Cannot send to channel (you're banned)", user->nick.c_str(), chan->name.c_str());
return CMD_FAILURE;
@@ -208,15 +185,6 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
user->nick.assign(parameters[0], 0, IS_LOCAL(user) ? ServerInstance->Config->Limits.NickMax : MAXBUF);
user->InvalidateCache();
- /* Update display nicks */
- for (UCListIter v = user->chans.begin(); v != user->chans.end(); v++)
- {
- CUList* ulist = v->first->GetUsers();
- CUList::iterator i = ulist->find(user);
- if (i != ulist->end())
- i->second = user->nick;
- }
-
if (user->registered < REG_NICKUSER)
{
user->registered = (user->registered | REG_NICK);
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index c94dbc87a..2028f8c56 100644
--- a/src/commands/cmd_notice.cpp
+++ b/src/commands/cmd_notice.cpp
@@ -12,15 +12,6 @@
*/
#include "inspircd.h"
-
-#ifndef __CMD_NOTICE_H__
-#define __CMD_NOTICE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
/** Handle /NOTICE. These command handlers can be reloaded by the core,
* and handle basic RFC1459 commands. Commands within modules work
* the same way, however, they can be fully unloaded, where these
@@ -41,8 +32,6 @@ class CommandNotice : public Command
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
};
-#endif
-
CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, User *user)
{
@@ -88,7 +77,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
{
chan = ServerInstance->FindChan(target);
- exempt_list[user] = user->nick;
+ exempt_list.insert(user);
if (chan)
{
@@ -99,7 +88,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name.c_str());
return CMD_FAILURE;
}
- if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE))
+ if ((chan->IsModeSet('m')) && (chan->GetPrefixValue(user) < VOICE_VALUE))
{
user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name.c_str());
return CMD_FAILURE;
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index 5861bd086..e05366fa0 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -13,14 +13,6 @@
#include "inspircd.h"
-#ifndef __CMD_PRIVMSG_H__
-#define __CMD_PRIVMSG_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
/** Handle /PRIVMSG. These command handlers can be reloaded by the core,
* and handle basic RFC1459 commands. Commands within modules work
* the same way, however, they can be fully unloaded, where these
@@ -41,9 +33,6 @@ class CommandPrivmsg : public Command
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
};
-#endif
-
-
CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, User *user)
{
User *dest;
@@ -89,11 +78,11 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
{
chan = ServerInstance->FindChan(target);
- except_list[user] = user->nick;
+ except_list.insert(user);
if (chan)
{
- if (IS_LOCAL(user) && chan->GetStatus(user) < STATUS_VOICE)
+ if (IS_LOCAL(user) && chan->GetPrefixValue(user) < VOICE_VALUE)
{
if (chan->IsModeSet('n') && !chan->HasUser(user))
{
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp
index 329c0a2d5..ff39c4552 100644
--- a/src/commands/cmd_who.cpp
+++ b/src/commands/cmd_who.cpp
@@ -13,14 +13,6 @@
#include "inspircd.h"
-#ifndef __CMD_WHO_H__
-#define __CMD_WHO_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
/** Handle /WHO. These command handlers can be reloaded by the core,
* and handle basic RFC1459 commands. Commands within modules work
* the same way, however, they can be fully unloaded, where these
@@ -57,18 +49,17 @@ class CommandWho : public Command
bool whomatch(User* cuser, User* user, const char* matchtext);
};
-#endif
-
static const std::string star = "*";
static const std::string& get_first_visible_channel(User *u)
{
UCListIter i = u->chans.begin();
- if (i != u->chans.end())
+ while (i != u->chans.end())
{
- if (!i->first->IsModeSet('s'))
- return i->first->name;
+ Channel* c = *i++;
+ if (!c->IsModeSet('s'))
+ return c->name;
}
return star;
@@ -334,9 +325,9 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
bool inside = ch->HasUser(user);
/* who on a channel. */
- CUList *cu = ch->GetUsers();
+ const UserMembList *cu = ch->GetUsers();
- for (CUList::iterator i = cu->begin(); i != cu->end(); i++)
+ for (UserMembCIter i = cu->begin(); i != cu->end(); i++)
{
/* None of this applies if we WHO ourselves */
if (user != i->first)