summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/account.h23
-rw-r--r--src/Makefile3
-rw-r--r--src/account.cpp34
3 files changed, 49 insertions, 11 deletions
diff --git a/include/account.h b/include/account.h
index ed0bcc877..f88a5b644 100644
--- a/include/account.h
+++ b/include/account.h
@@ -54,16 +54,7 @@ class NickAlias
class NickCore : public Extensible
{
public:
- NickCore()
- {
- next = prev = NULL;
- display = email = greet = url = NULL;
- ot = NULL;
- pass[0] = '\0';
- icq = flags = 0;
- language = accesscount = channelcount = 0;
- lastmail = 0;
- }
+ NickCore();
NickCore *next, *prev;
@@ -85,5 +76,17 @@ class NickCore : public Extensible
/* Unsaved data */
time_t lastmail; /* Last time this nick record got a mail */
SList aliases; /* List of aliases */
+
+ /** Check whether this opertype has access to run the given command string.
+ * @param cmdstr The string to check, e.g. botserv/set/private.
+ * @return True if this opertype may run the specified command, false otherwise.
+ */
+ bool HasCommand(const std::string &cmdstr);
+
+ /** Check whether this opertype has access to the given special permission.
+ * @param privstr The priv to check for, e.g. users/auspex.
+ * @return True if this opertype has the specified priv, false otherwise.
+ */
+ bool HasPriv(const std::string &privstr);
};
diff --git a/src/Makefile b/src/Makefile
index 92d24cb10..709f2ec77 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,4 @@
-OBJS = actions.o base64.o bots.o botserv.o channels.o chanserv.o commands.o compat.o \
+OBJS = account.cpp actions.o base64.o bots.o botserv.o channels.o chanserv.o commands.o compat.o \
config.o datafiles.o encrypt.o events.o hashcomp.o helpserv.o hostserv.o init.o ircd.o language.o log.o mail.o main.o \
memory.o memoserv.o messages.o misc.o modules.o news.o nickserv.o operserv.o \
process.o protocol.o send.o servers.o sessions.o slist.o sockutil.o opertype.o timeout.o users.o module.o modulemanager.o configreader.o \
@@ -33,6 +33,7 @@ services: $(OBJS) mod_version
@$(MAKEBIN) $(CC) $(CFLAGS) $(OBJS) $(ANOPELIBS) $(MLIBS) -o $@ $(LDFLAGS)
$(OBJS): Makefile
+account.o: account.cpp $(INCLUDES)
actions.o: actions.c $(INCLUDES)
base64.o: base64.c $(INCLUDES)
bots.o: bots.cpp $(INCLUDES)
diff --git a/src/account.cpp b/src/account.cpp
new file mode 100644
index 000000000..b33646bbe
--- /dev/null
+++ b/src/account.cpp
@@ -0,0 +1,34 @@
+#include "services.h"
+
+NickCore::NickCore()
+{
+ next = prev = NULL;
+ display = email = greet = url = NULL;
+ ot = NULL;
+ pass[0] = '\0';
+ icq = flags = 0;
+ language = accesscount = channelcount = 0;
+ lastmail = 0;
+}
+
+bool NickCore::HasCommand(const std::string &cmdstr)
+{
+ if (!this->ot)
+ {
+ // No opertype.
+ return false;
+ }
+
+ return this->ot->HasCommand(cmdstr);
+}
+
+bool NickCore::HasPriv(const std::string &privstr)
+{
+ if (!this->ot)
+ {
+ // No opertype.
+ return false;
+ }
+
+ return this->ot->HasPriv(privstr);
+}