From 57bb7593059242652c57aae4391b45416dc7fa70 Mon Sep 17 00:00:00 2001 From: Naram Qashat Date: Mon, 26 Jul 2010 23:32:03 -0400 Subject: Trying to make things a little more const-safe, a work in progress but this is a bit better. --- include/channels.h | 11 ++++++----- include/config.h | 12 ++++++------ include/extern.h | 2 +- include/modes.h | 18 +++++++++--------- include/modules.h | 15 ++++++--------- include/operserv.h | 8 ++++---- include/regchannel.h | 14 +++++++------- include/servers.h | 4 ++-- include/services.h | 4 ++-- include/sockets.h | 38 +++++++++++++++++++------------------- include/timers.h | 8 ++++---- include/users.h | 11 ++++++----- 12 files changed, 72 insertions(+), 73 deletions(-) (limited to 'include') 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 /** 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 /** 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 * @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 * @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 -- cgit