summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/base.h2
-rw-r--r--include/builtinmodes.h6
-rw-r--r--include/commands/cmd_whowas.h1
-rw-r--r--include/extensible.h2
-rw-r--r--include/inspsocket.h4
-rw-r--r--include/logger.h8
-rw-r--r--include/mode.h4
-rw-r--r--include/modules.h2
-rw-r--r--include/modules/dns.h2
-rw-r--r--include/numerics.h3
-rw-r--r--include/socketengine.h16
-rw-r--r--include/users.h50
12 files changed, 62 insertions, 38 deletions
diff --git a/include/base.h b/include/base.h
index c378afc1c..d8781f796 100644
--- a/include/base.h
+++ b/include/base.h
@@ -202,7 +202,7 @@ class CoreExport CoreException : public std::exception
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
- virtual ~CoreException() throw() {};
+ virtual ~CoreException() throw() {}
/** Returns the reason for the exception.
* @return Human readable description of the error
*/
diff --git a/include/builtinmodes.h b/include/builtinmodes.h
index 62ccaf62d..bfb46823f 100644
--- a/include/builtinmodes.h
+++ b/include/builtinmodes.h
@@ -97,14 +97,14 @@ class ModeUserServerNoticeMask : public ModeHandler
public:
ModeUserServerNoticeMask();
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
- void OnParameterMissing(User* user, User* dest, Channel* channel);
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding) CXX11_OVERRIDE;
+ void OnParameterMissing(User* user, User* dest, Channel* channel) CXX11_OVERRIDE;
/** Create a displayable mode string of the snomasks set on a given user
* @param user The user whose notice masks to format
* @return The notice mask character sequence
*/
- std::string GetUserParameter(User* user);
+ std::string GetUserParameter(const User* user) const CXX11_OVERRIDE;
};
/** User mode +o
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h
index aaea31864..070858cc5 100644
--- a/include/commands/cmd_whowas.h
+++ b/include/commands/cmd_whowas.h
@@ -200,7 +200,6 @@ class CommandWhowas : public Command
CommandWhowas(Module* parent);
/** Handle command.
* @param parameters The parameters to the comamnd
- * @param pcnt The number of parameters passed to teh command
* @param user The user issuing the command
* @return A value from CmdResult to indicate command success or failure.
*/
diff --git a/include/extensible.h b/include/extensible.h
index 07756fb59..1da45cee6 100644
--- a/include/extensible.h
+++ b/include/extensible.h
@@ -111,7 +111,7 @@ class CoreExport Extensible : public classbase
inline const ExtensibleStore& GetExtList() const { return extensions; }
Extensible();
- virtual CullResult cull();
+ virtual CullResult cull() CXX11_OVERRIDE;
virtual ~Extensible();
void doUnhookExtensions(const std::vector<reference<ExtensionItem> >& toRemove);
diff --git a/include/inspsocket.h b/include/inspsocket.h
index 751374fdf..95f29ff11 100644
--- a/include/inspsocket.h
+++ b/include/inspsocket.h
@@ -312,7 +312,7 @@ class CoreExport StreamSocket : public EventHandler
*/
virtual void Close();
/** This ensures that close is called prior to destructor */
- virtual CullResult cull();
+ virtual CullResult cull() CXX11_OVERRIDE;
/** Get the IOHook of a module attached to this socket
* @param mod Module whose IOHook to return
@@ -372,7 +372,7 @@ class CoreExport BufferedSocket : public StreamSocket
/** When there is data waiting to be read on a socket, the OnDataReady()
* method is called.
*/
- virtual void OnDataReady() = 0;
+ virtual void OnDataReady() CXX11_OVERRIDE = 0;
/**
* When an outbound connection fails, and the attempt times out, you
diff --git a/include/logger.h b/include/logger.h
index c56859a62..5d4a80d9f 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -41,14 +41,18 @@ class CoreExport FileWriter
*/
FILE* log;
+ /** The number of write operations after which we should flush.
+ */
+ unsigned int flush;
+
/** Number of write operations that have occured
*/
- int writeops;
+ unsigned int writeops;
public:
/** The constructor takes an already opened logfile.
*/
- FileWriter(FILE* logfile);
+ FileWriter(FILE* logfile, unsigned int flushcount);
/** Write one or more preformatted log lines.
* If the data cannot be written immediately,
diff --git a/include/mode.h b/include/mode.h
index 35af68685..2e9ed22f3 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -166,7 +166,7 @@ class CoreExport ModeHandler : public ServiceProvider
* @param mclass The object type of this mode handler, one of ModeHandler::Class
*/
ModeHandler(Module* me, const std::string& name, char modeletter, ParamSpec params, ModeType type, Class mclass = MC_OTHER);
- virtual CullResult cull();
+ virtual CullResult cull() CXX11_OVERRIDE;
virtual ~ModeHandler();
/** Register this object in the ModeParser
@@ -241,7 +241,7 @@ class CoreExport ModeHandler : public ServiceProvider
/** For user modes, return the current parameter, if any
*/
- virtual std::string GetUserParameter(User* useor);
+ virtual std::string GetUserParameter(const User* user) const;
/**
* Called when a channel mode change access check for your mode occurs.
diff --git a/include/modules.h b/include/modules.h
index 5deed943a..d9d05a396 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -276,7 +276,7 @@ class CoreExport Module : public classbase, public usecountbase
/** Clean up prior to destruction
* If you override, you must call this AFTER your module's cleanup
*/
- virtual CullResult cull();
+ virtual CullResult cull() CXX11_OVERRIDE;
/** Default destructor.
* destroys a module class
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 5f2836761..61abd7144 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -33,6 +33,8 @@ namespace DNS
QUERY_CNAME = 5,
/* Reverse DNS lookup */
QUERY_PTR = 12,
+ /* TXT */
+ QUERY_TXT = 16,
/* IPv6 AAAA lookup */
QUERY_AAAA = 28
};
diff --git a/include/numerics.h b/include/numerics.h
index 606e23819..0d5537278 100644
--- a/include/numerics.h
+++ b/include/numerics.h
@@ -195,6 +195,9 @@ enum
ERR_CHANOPEN = 713,
ERR_KNOCKONCHAN = 714,
+ RPL_OTHERUMODEIS = 803, // insp-specific
+ RPL_OTHERSNOMASKIS = 804, // insp-specific
+
ERR_WORDFILTERED = 936, // insp-specific, would be nice if we could get rid of this..
ERR_CANTUNLOADMODULE = 972, // insp-specific
RPL_UNLOADEDMODULE = 973, // insp-specific
diff --git a/include/socketengine.h b/include/socketengine.h
index c0026bfc6..b00643952 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -244,11 +244,19 @@ class CoreExport SocketEngine
*/
Statistics() : lastempty(0), TotalEvents(0), ReadEvents(0), WriteEvents(0), ErrorEvents(0) { }
- /** Increase the counters for bytes sent/received in this second.
- * @param len_in Bytes received, 0 if updating number of bytes written.
- * @param len_out Bytes sent, 0 if updating number of bytes read.
+ /** Update counters for network data received.
+ * This should be called after every read-type syscall.
+ * @param len_in Number of bytes received, or -1 for error, as typically
+ * returned by a read-style syscall.
*/
- void Update(size_t len_in, size_t len_out);
+ void UpdateReadCounters(int len_in);
+
+ /** Update counters for network data sent.
+ * This should be called after every write-type syscall.
+ * @param len_out Number of bytes sent, or -1 for error, as typically
+ * returned by a read-style syscall.
+ */
+ void UpdateWriteCounters(int len_out);
/** Get data transfer statistics.
* @param kbitspersec_in Filled with incoming traffic in this second in kbit/s.
diff --git a/include/users.h b/include/users.h
index fc31a8297..4c8df549d 100644
--- a/include/users.h
+++ b/include/users.h
@@ -418,19 +418,21 @@ class CoreExport User : public Extensible
*/
bool IsNoticeMaskSet(unsigned char sm);
- /** Create a displayable mode string for this users umodes
- * @param showparameters The mode string
+ /** Get the mode letters of modes set on the user as a string.
+ * @param includeparams True to get the parameters of the modes as well. Defaults to false.
+ * @return Mode letters of modes set on the user and optionally the parameters of those modes, if any.
+ * The returned string always begins with a '+' character. If the user has no modes set, "+" is returned.
*/
- const char* FormatModes(bool showparameters = false);
+ std::string GetModeLetters(bool includeparams = false) const;
/** Returns true if a specific mode is set
* @param m The user mode
* @return True if the mode is set
*/
- bool IsModeSet(unsigned char m);
- bool IsModeSet(ModeHandler* mh);
- bool IsModeSet(ModeHandler& mh) { return IsModeSet(&mh); }
- bool IsModeSet(UserModeReference& moderef);
+ bool IsModeSet(unsigned char m) const;
+ bool IsModeSet(const ModeHandler* mh) const;
+ bool IsModeSet(const ModeHandler& mh) const { return IsModeSet(&mh); }
+ bool IsModeSet(UserModeReference& moderef) const;
/** Set a specific usermode to on or off
* @param m The user mode
@@ -715,7 +717,7 @@ class CoreExport User : public Extensible
/** Default destructor
*/
virtual ~User();
- virtual CullResult cull();
+ virtual CullResult cull() CXX11_OVERRIDE;
};
class CoreExport UserIOHandler : public StreamSocket
@@ -740,7 +742,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
{
public:
LocalUser(int fd, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server);
- CullResult cull();
+ CullResult cull() CXX11_OVERRIDE;
UserIOHandler eh;
@@ -834,12 +836,12 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
*/
void SetClass(const std::string &explicit_name = "");
- bool SetClientIP(const char* sip, bool recheck_eline = true);
+ bool SetClientIP(const char* sip, bool recheck_eline = true) CXX11_OVERRIDE;
- void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true);
+ void SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline = true) CXX11_OVERRIDE;
- void Write(const std::string& text);
- void Write(const char*, ...) CUSTOM_PRINTF(2, 3);
+ void Write(const std::string& text) CXX11_OVERRIDE;
+ void Write(const char*, ...) CXX11_OVERRIDE CUSTOM_PRINTF(2, 3);
/** Send a NOTICE message from the local server to the user.
* The message will be sent even if the user is connected to a remote server.
@@ -853,7 +855,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
* @param command A command (should be all CAPS)
* @return True if this user can execute the command
*/
- bool HasPermission(const std::string &command);
+ bool HasPermission(const std::string &command) CXX11_OVERRIDE;
/** Returns true if a user has a given permission.
* This is used to check whether or not users may perform certain actions which admins may not wish to give to
@@ -863,7 +865,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
* @param noisy If set to true, the user is notified that they do not have the specified permission where applicable. If false, no notification is sent.
* @return True if this user has the permission in question.
*/
- bool HasPrivPermission(const std::string &privstr, bool noisy = false);
+ bool HasPrivPermission(const std::string &privstr, bool noisy = false) CXX11_OVERRIDE;
/** Returns true or false if a user can set a privileged user or channel mode.
* This is done by looking up their oper type from User::oper, then referencing
@@ -871,7 +873,13 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
* @param mh Mode to check
* @return True if the user can set or unset this mode.
*/
- bool HasModePermission(const ModeHandler* mh) const;
+ bool HasModePermission(const ModeHandler* mh) const CXX11_OVERRIDE;
+
+ /** Change nick to uuid, unset REG_NICK and send a nickname overruled numeric.
+ * This is called when another user (either local or remote) needs the nick of this user and this user
+ * isn't registered.
+ */
+ void OverruleNick();
};
class RemoteUser : public User
@@ -896,9 +904,9 @@ class CoreExport FakeUser : public User
nick = sname;
}
- virtual CullResult cull();
- virtual const std::string& GetFullHost();
- virtual const std::string& GetFullRealHost();
+ virtual CullResult cull() CXX11_OVERRIDE;
+ virtual const std::string& GetFullHost() CXX11_OVERRIDE;
+ virtual const std::string& GetFullRealHost() CXX11_OVERRIDE;
};
/* Faster than dynamic_cast */
@@ -918,12 +926,12 @@ inline FakeUser* IS_SERVER(User* u)
return u->usertype == USERTYPE_SERVER ? static_cast<FakeUser*>(u) : NULL;
}
-inline bool User::IsModeSet(ModeHandler* mh)
+inline bool User::IsModeSet(const ModeHandler* mh) const
{
return (modes[mh->GetId()]);
}
-inline bool User::IsModeSet(UserModeReference& moderef)
+inline bool User::IsModeSet(UserModeReference& moderef) const
{
if (!moderef)
return false;