summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNaram Qashat <cyberbotx@cyberbotx.com>2010-07-26 23:32:03 -0400
committerNaram Qashat <cyberbotx@cyberbotx.com>2010-07-26 23:32:03 -0400
commit57bb7593059242652c57aae4391b45416dc7fa70 (patch)
tree80b1b21308a0ce7e55bc5b8e278ed6cc95c07e8c /include
parent6e6b6b46aabfb3e558f66bd0fdc528e93505cf76 (diff)
Trying to make things a little more const-safe, a work in progress but this is a bit better.
Diffstat (limited to 'include')
-rw-r--r--include/channels.h11
-rw-r--r--include/config.h12
-rw-r--r--include/extern.h2
-rw-r--r--include/modes.h18
-rw-r--r--include/modules.h15
-rw-r--r--include/operserv.h8
-rw-r--r--include/regchannel.h14
-rw-r--r--include/servers.h4
-rw-r--r--include/services.h4
-rw-r--r--include/sockets.h38
-rw-r--r--include/timers.h8
-rw-r--r--include/users.h11
12 files changed, 72 insertions, 73 deletions
diff --git a/include/channels.h b/include/channels.h
index 8bf98e4b9..f2785ff01 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -129,7 +129,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags, CMODE_E
* @param cms The status mode, or NULL to represent no status
* @return true or false
*/
- bool HasUserStatus(User *u, ChannelModeStatus *cms);
+ bool HasUserStatus(User *u, ChannelModeStatus *cms) const;
/** Check if a user has a status on a channel
* Use the overloaded function for ChannelModeStatus* to check for no status
@@ -137,7 +137,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags, CMODE_E
* @param Name The Mode name, eg CMODE_OP, CMODE_VOICE
* @return true or false
*/
- bool HasUserStatus(User *u, ChannelModeName Name);
+ bool HasUserStatus(User *u, ChannelModeName Name) const;
/** See if the channel has any modes at all
* @return true or false
@@ -148,7 +148,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags, CMODE_E
* @param Name The mode name
* @return true or false
*/
- bool HasMode(ChannelModeName Name);
+ bool HasMode(ChannelModeName Name) const;
/** Set a mode internally on a channel, this is not sent out to the IRCd
* @param cm The mode
@@ -240,12 +240,13 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags, CMODE_E
* @param Target a string to put the param into
* @return true on success
*/
- const bool GetParam(ChannelModeName Name, Anope::string &Target);
+ bool GetParam(ChannelModeName Name, Anope::string &Target) const;
/** Check if a mode is set and has a param
* @param Name The mode
*/
- const bool HasParam(ChannelModeName Name);
+ bool HasParam(ChannelModeName Name) const;
+
/** Set a string of modes on the channel
* @param bi The client setting the modes
* @param EnforceMLock Should mlock be enforced on this mode change
diff --git a/include/config.h b/include/config.h
index ef7445041..54e3d095f 100644
--- a/include/config.h
+++ b/include/config.h
@@ -86,7 +86,7 @@ class ValueItem
/** Change value to an int */
void Set(int);
/** Get value as an int */
- int GetInteger();
+ int GetInteger() const;
/** Get value as a string */
const char *GetString() const;
/** Get value as an std::string */
@@ -96,7 +96,7 @@ class ValueItem
/** Get value as a ci::string */
inline const Anope::string &GetValue() const { return v; }
/** Get value as a bool */
- bool GetBool();
+ bool GetBool() const;
};
/** The base class of the container 'ValueContainer'
@@ -458,9 +458,9 @@ class ServerConfig
/** Returns the numbers of vars inside the index'th 'tag in the config file
*/
int ConfVarEnum(ConfigDataHash &, const Anope::string &, int);
- void ValidateHostname(const Anope::string &, const Anope::string &, const Anope::string &);
- void ValidateIP(const Anope::string &p, const Anope::string &, const Anope::string &, bool);
- void ValidateNoSpaces(const Anope::string &, const Anope::string &, const Anope::string &);
+ void ValidateHostname(const Anope::string &, const Anope::string &, const Anope::string &) const;
+ void ValidateIP(const Anope::string &p, const Anope::string &, const Anope::string &, bool) const;
+ void ValidateNoSpaces(const Anope::string &, const Anope::string &, const Anope::string &) const;
/** Below here is a list of variables which contain the config files values
*/
@@ -965,7 +965,7 @@ class CoreExport ConfigReader
* used with the index value of ConfigReader::ReadValue to loop through all copies of a
* multiple instance tag.
*/
- int Enumerate(const Anope::string &);
+ int Enumerate(const Anope::string &) const;
/** Returns true if a config file is valid.
* This method is partially implemented and will only return false if the config
* file does not exist or could not be opened.
diff --git a/include/extern.h b/include/extern.h
index e323102a2..f36be8640 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -341,7 +341,7 @@ E void process(const Anope::string &buf);
E void send_cmd(const Anope::string &source, const char *fmt, ...) FORMAT(printf, 2, 3);
-E void notice_server(const Anope::string &source, Server * s, const char *fmt, ...) FORMAT(printf, 3, 4);
+E void notice_server(const Anope::string &source, const Server *s, const char *fmt, ...) FORMAT(printf, 3, 4);
E void notice_lang(const Anope::string &source, User *dest, int message, ...); // MARK_DEPRECATED;
E void notice_help(const Anope::string &source, User *dest, int message, ...); // MARK_DEPRECATED;
diff --git a/include/modes.h b/include/modes.h
index ce5372117..7a4ff7f70 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -133,7 +133,7 @@ class CoreExport UserModeParam : public UserMode
* @param value The param
* @return true or false
*/
- virtual bool IsValid(const Anope::string &value) { return true; }
+ virtual bool IsValid(const Anope::string &value) const { return true; }
};
/** This class is a channel mode, all channel modes use this/inherit from this
@@ -159,7 +159,7 @@ class CoreExport ChannelMode : public Mode
* NOTE: User CAN be NULL, this is for checking if it can be locked with defcon
* @param u The user, or NULL
*/
- virtual bool CanSet(User *u) { return true; }
+ virtual bool CanSet(User *u) const { return true; }
};
@@ -183,7 +183,7 @@ class CoreExport ChannelModeList : public ChannelMode
* @param mask The mask
* @return true for yes, false for no
*/
- virtual bool IsValid(const Anope::string &mask) { return true; }
+ virtual bool IsValid(const Anope::string &mask) const { return true; }
/** Add the mask to the channel, this should be overridden
* @param chan The channel
@@ -223,7 +223,7 @@ class CoreExport ChannelModeParam : public ChannelMode
* @param value The param
* @return true for yes, false for no
*/
- virtual bool IsValid(const Anope::string &value) { return true; }
+ virtual bool IsValid(const Anope::string &value) const { return true; }
};
/** This is a mode that is a channel status, eg +v/h/o/a/q.
@@ -291,7 +291,7 @@ class CoreExport ChannelModeKey : public ChannelModeParam
public:
ChannelModeKey(char modeChar) : ChannelModeParam(CMODE_KEY, "CMODE_KEY", modeChar) { }
- bool IsValid(const Anope::string &value);
+ bool IsValid(const Anope::string &value) const;
};
/** Channel mode +f (flood)
@@ -301,7 +301,7 @@ class ChannelModeFlood : public ChannelModeParam
public:
ChannelModeFlood(char modeChar, bool minusNoArg = false) : ChannelModeParam(CMODE_FLOOD, "CMODE_FLOOD", modeChar, minusNoArg) { }
- bool IsValid(const Anope::string &value);
+ bool IsValid(const Anope::string &value) const;
};
/** This class is used for channel mode +A (Admin only)
@@ -313,7 +313,7 @@ class CoreExport ChannelModeAdmin : public ChannelMode
ChannelModeAdmin(char modeChar) : ChannelMode(CMODE_ADMINONLY, "CMODE_ADMINONLY", modeChar) { }
/* Opers only */
- bool CanSet(User *u);
+ bool CanSet(User *u) const;
};
/** This class is used for channel mode +O (Opers only)
@@ -325,7 +325,7 @@ class CoreExport ChannelModeOper : public ChannelMode
ChannelModeOper(char modeChar) : ChannelMode(CMODE_OPERONLY, "CMODE_OPERONLY", modeChar) { }
/* Opers only */
- bool CanSet(User *u);
+ bool CanSet(User *u) const;
};
/** This class is used for channel mode +r (registered channel)
@@ -337,7 +337,7 @@ class CoreExport ChannelModeRegistered : public ChannelMode
ChannelModeRegistered(char modeChar) : ChannelMode(CMODE_REGISTERED, "CMODE_REGISTERED", modeChar) { }
/* No one mlocks +r */
- bool CanSet(User *u);
+ bool CanSet(User *u) const;
};
enum StackerType
diff --git a/include/modules.h b/include/modules.h
index 643edf88c..f4b1ad60b 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -27,7 +27,6 @@
# define dlsym(file, symbol) (HMODULE)GetProcAddress(file, symbol)
# define dlclose(file) FreeLibrary(file) ? 0 : 1
# define ano_modclearerr() SetLastError(0)
-# define MODULE_EXT ".so"
#else
typedef void * ano_module_t;
@@ -37,7 +36,6 @@
* to be cleared, POSIX-wise. -GD
*/
# define ano_modclearerr() dlerror()
-# define MODULE_EXT ".so"
#endif
/** Possible return types from events.
@@ -131,7 +129,6 @@ struct Message;
extern CoreExport Module *FindModule(const Anope::string &name);
int protocol_module_init();
-extern CoreExport Message *createMessage(const char *name, int (*func)(const char *source, int ac, const char **av));
extern CoreExport bool moduleMinVersion(int major, int minor, int patch, int build);
enum ModuleReturn
@@ -188,17 +185,17 @@ class Version
/** Get the major version of Anope this was built against
* @return The major version
*/
- const unsigned GetMajor();
+ unsigned GetMajor() const;
/** Get the minor version of Anope this was built against
* @return The minor version
*/
- const unsigned GetMinor();
+ unsigned GetMinor() const;
/** Get the build version this was built against
* @return The build version
*/
- const unsigned GetBuild();
+ unsigned GetBuild() const;
};
/* Forward declaration of CallBack class for the Module class */
@@ -275,7 +272,7 @@ class CoreExport Module
/** Retrieves whether or not a given module is permanent.
* @return true if the module is permanent, false else.
*/
- bool GetPermanent();
+ bool GetPermanent() const;
/** Set the modules version info.
* @param version the version of the module
@@ -291,7 +288,7 @@ class CoreExport Module
* compiled against
* @return The version
*/
- Version GetVersion();
+ Version GetVersion() const;
/**
* Allow a module to add a set of language strings to anope
@@ -322,7 +319,7 @@ class CoreExport Module
* @param number The message number
* @param ... The argument list
**/
- void NoticeLang(const Anope::string &source, User *u, int number, ...);
+ void NoticeLang(const Anope::string &source, const User *u, int number, ...) const;
/**
* Add a module provided command to the given service.
diff --git a/include/operserv.h b/include/operserv.h
index b5025b007..e3c25b0f6 100644
--- a/include/operserv.h
+++ b/include/operserv.h
@@ -34,7 +34,7 @@ extern CoreExport void operserv(User *u, const Anope::string &message);
extern CoreExport void os_init();
extern CoreExport void oper_global(const Anope::string &nick, const char *fmt, ...);
-extern CoreExport void server_global(Server *s, const Anope::string &message);
+extern CoreExport void server_global(const Server *s, const Anope::string &message);
enum XLineType
{
@@ -101,7 +101,7 @@ class CoreExport XLineManager
/** Get the number of XLines in this XLineManager
* @return The number of XLines
*/
- const size_t GetCount() const;
+ size_t GetCount() const;
/** Get the XLine vector
* @return The vector
@@ -123,7 +123,7 @@ class CoreExport XLineManager
* @param index The index
* @return The XLine, or NULL if the index is out of bounds
*/
- XLine *GetEntry(unsigned index) const;
+ XLine *GetEntry(unsigned index);
/** Clear the XLine vector
*/
@@ -159,7 +159,7 @@ class CoreExport XLineManager
* @param mask The mask
* @return The XLine the user matches, or NULL
*/
- XLine *HasEntry(const Anope::string &mask) const;
+ XLine *HasEntry(const Anope::string &mask);
/** Check a user against all of the xlines in this XLineManager
* @param u The user
diff --git a/include/regchannel.h b/include/regchannel.h
index 00a99e96d..68eb08aa1 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -148,7 +148,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** Get the size of the accss vector for this channel
* @return The access vector size
*/
- const unsigned GetAccessCount() const;
+ unsigned GetAccessCount() const;
/** Erase an entry from the channel access list
*
@@ -191,7 +191,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** Get the size of the akick vector for this channel
* @return The akick vector size
*/
- const unsigned GetAkickCount() const;
+ unsigned GetAkickCount() const;
/** Erase an entry from the channel akick list
* @param index The index of the akick
@@ -218,7 +218,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
/** Get how many badwords are on this channel
* @return The number of badwords in the vector
*/
- const unsigned GetBadWordCount() const;
+ unsigned GetBadWordCount() const;
/** Remove a badword
* @param index The index of the badword
@@ -239,7 +239,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
* @param status True to check mlock on, false for mlock off
* @return true on success, false on fail
*/
- const bool HasMLock(ChannelModeName Name, bool status);
+ bool HasMLock(ChannelModeName Name, bool status) const;
/** Set a mlock
* @param Name The mode
@@ -263,19 +263,19 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
* @param status true for mlock on, false for mlock off
* @return The number of mlocked modes
*/
- const size_t GetMLockCount(bool status) const;
+ size_t GetMLockCount(bool status) const;
/** Get a param from the channel
* @param Name The mode
* @param Target a string to put the param into
* @return true on success
*/
- const bool GetParam(ChannelModeName Name, Anope::string &Target);
+ bool GetParam(ChannelModeName Name, Anope::string &Target) const;
/** Check if a mode is set and has a param
* @param Name The mode
*/
- const bool HasParam(ChannelModeName Name);
+ bool HasParam(ChannelModeName Name) const;
/** Clear all the params from the channel
*/
diff --git a/include/servers.h b/include/servers.h
index 5c7d114f8..09de78547 100644
--- a/include/servers.h
+++ b/include/servers.h
@@ -120,7 +120,7 @@ class CoreExport Server : public Flags<ServerFlag>
/** Get the number of hops this server is from services
* @return Number of hops
*/
- unsigned int GetHops() const;
+ unsigned GetHops() const;
/** Set the server description
* @param desc The new description
@@ -145,7 +145,7 @@ class CoreExport Server : public Flags<ServerFlag>
/** Get the uplink server for this server, if this is our uplink will be Me
* @return The servers uplink
*/
- Server *GetUplink() const;
+ Server *GetUplink();
/** Adds a link to this server
* @param s The linking server
diff --git a/include/services.h b/include/services.h
index a23f78bff..16f365a09 100644
--- a/include/services.h
+++ b/include/services.h
@@ -940,8 +940,8 @@ class CoreExport IRCDProto
virtual void SendNotice(BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendAction(BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendPrivmsg(BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
- virtual void SendGlobalNotice(BotInfo *bi, Server *dest, const Anope::string &msg);
- virtual void SendGlobalPrivmsg(BotInfo *bi, Server *desc, const Anope::string &msg);
+ virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg);
+ virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg);
/** XXX: This is a hack for NickServ enforcers. It is deprecated.
* If I catch any developer using this in new code, I will RIP YOUR BALLS OFF.
diff --git a/include/sockets.h b/include/sockets.h
index c1d102edc..78ed5f4af 100644
--- a/include/sockets.h
+++ b/include/sockets.h
@@ -1,4 +1,4 @@
-/*
+/*
*
* (C) 2003-2010 Anope Team
* Contact us at team@anope.org
@@ -55,13 +55,13 @@ class CoreExport Socket : public Flags<SocketFlag, 1>
* @param sz How much to read
* @return Number of bytes recieved
*/
- virtual const int RecvInternal(char *buf, size_t sz) const;
+ virtual int RecvInternal(char *buf, size_t sz) const;
/** Really write something to the socket
* @param buf What to write
* @return Number of bytes written
*/
- virtual const int SendInternal(const Anope::string &buf) const;
+ virtual int SendInternal(const Anope::string &buf) const;
protected:
/* Socket FD */
@@ -86,7 +86,7 @@ class CoreExport Socket : public Flags<SocketFlag, 1>
* @param nIPv6 true if using ipv6
*/
Socket(int nsock, bool nIPv6);
-
+
/** Default destructor
*/
virtual ~Socket();
@@ -161,22 +161,22 @@ class CoreExport ClientSocket : public Socket
public:
- /** Constructor
- * @param nTargetHost The target host to connect to
- * @param nPort The target port to connect to
- * @param nBindHost The host to bind to for connecting
- * @param nIPv6 true to use IPv6
- */
- ClientSocket(const Anope::string &nTargetHost, int nPort, const Anope::string &nBindHost, bool nIPv6);
+ /** Constructor
+ * @param nTargetHost The target host to connect to
+ * @param nPort The target port to connect to
+ * @param nBindHost The host to bind to for connecting
+ * @param nIPv6 true to use IPv6
+ */
+ ClientSocket(const Anope::string &nTargetHost, int nPort, const Anope::string &nBindHost, bool nIPv6);
- /** Default destructor
- */
- virtual ~ClientSocket();
+ /** Default destructor
+ */
+ virtual ~ClientSocket();
/** Called with a line recieved from the socket
- * @param buf The line
- * @return true to continue reading, false to drop the socket
- */
+ * @param buf The line
+ * @return true to continue reading, false to drop the socket
+ */
virtual bool Read(const Anope::string &buf);
};
@@ -217,8 +217,8 @@ class CoreExport ListenSocket : public Socket
/** Get the port this socket is bound to
* @return The port
- */
- const int GetPort() const;
+ */
+ int GetPort() const;
};
#endif // SOCKET_H
diff --git a/include/timers.h b/include/timers.h
index 9573ee524..79443d753 100644
--- a/include/timers.h
+++ b/include/timers.h
@@ -56,22 +56,22 @@ class CoreExport Timer : public Extensible
/** Retrieve the triggering time
* @return The trigger time
*/
- const time_t GetTimer();
+ time_t GetTimer() const;
/** Returns true if the timer is set to repeat
* @return Returns true if the timer is set to repeat
*/
- const bool GetRepeat();
+ bool GetRepeat() const;
/** Returns the interval between ticks
* @return The interval
*/
- const long GetSecs();
+ long GetSecs() const;
/** Returns the time this timer was created
* @return The time this timer was created
*/
- const time_t GetSetTime();
+ time_t GetSetTime() const;
/** Called when the timer ticks
* This should be overridden with something useful
diff --git a/include/users.h b/include/users.h
index 6db093c32..c80daa193 100644
--- a/include/users.h
+++ b/include/users.h
@@ -92,7 +92,7 @@ class CoreExport User : public Extensible
/** Get the displayed vhost of a user record.
* @return The displayed vhost of the user, where ircd-supported, or the user's real host.
*/
- const Anope::string GetDisplayedHost() const;
+ const Anope::string &GetDisplayedHost() const;
/** Update the cloaked host of a user
* @param host The cloaked host
@@ -134,7 +134,7 @@ class CoreExport User : public Extensible
/** Get the full mask ( nick!ident@realhost ) of a user
*/
- const Anope::string GetMask();
+ Anope::string GetMask() const;
/** Updates the realname of the user record.
*/
@@ -146,8 +146,8 @@ class CoreExport User : public Extensible
* @param fmt Format of the Message
* @param ... any number of parameters
*/
- virtual void SendMessage(const Anope::string &source, const char *fmt, ...);
- virtual void SendMessage(const Anope::string &source, const Anope::string &msg);
+ virtual void SendMessage(const Anope::string &source, const char *fmt, ...) const;
+ virtual void SendMessage(const Anope::string &source, const Anope::string &msg) const;
/** Collide a nick
* See the comment in users.cpp
@@ -179,6 +179,7 @@ class CoreExport User : public Extensible
* @reurn The account or NULL
*/
virtual NickCore *Account();
+ virtual const NickCore *Account() const;
/** Check if the user is identified for their nick
* @param CheckNick True to check if the user is identified to the nickname they are on too
@@ -264,7 +265,7 @@ class CoreExport User : public Extensible
* @param c The channel
* @return The channel container, or NULL
*/
- ChannelContainer *FindChannel(Channel *c);
+ ChannelContainer *FindChannel(const Channel *c);
/** Check if the user is protected from kicks and negative mode changes
* @return true or false