#include "channels.h"
#include "socket.h"
#include "mode.h"
-
#include "socketengine.h"
#include "command_parse.h"
+#include "snomasks.h"
/** Returned by some functions to indicate failure,
* and the exit code of the program if it terminates.
* another write event is scheduled to write
* the rest of the data when possible.
*/
- virtual void HandleEvent(EventType et);
+ virtual void HandleEvent(EventType et, int errornum = 0);
/** Write one or more preformatted log lines.
* If the data cannot be written immediately,
* this class will insert itself into the
/** Holds a string describing the last module error to occur
*/
char MODERR[MAXBUF];
-
- /** This is an internal flag used by the mainloop
- */
- bool expire_run;
-
- /** List of server names we've seen.
- */
- servernamelist servernames;
/** Remove a ModuleFactory pointer
* @param j Index number of the ModuleFactory to remove
void Start();
/** Set up the signal handlers
- * @param SEGVHandler create a handler for segfaults (deprecated)
*/
- void SetSignals(bool SEGVHandler);
+ void SetSignals();
/** Daemonize the ircd and close standard input/output streams
* @return True if the program daemonized succesfully
*/
FileLogger* Logger;
+ /** Time offset in seconds
+ * This offset is added to all calls to Time(). Use SetTimeDelta() to update
+ */
+ int time_delta;
+
public:
+ /** List of server names we've seen.
+ */
+ servernamelist servernames;
+
/** Time this ircd was booted
*/
time_t startup_time;
*/
ServerConfig* Config;
- /** Module sockets list, holds the active set of InspSocket classes
+ /** Snomask manager - handles routing of snomask messages
+ * to opers.
*/
- std::vector<InspSocket*> module_sockets;
+ SnomaskManager* SNO;
/** Client list, a hash_map containing all clients, local and remote
*/
*/
FactoryList factory;
+ /** The time we next call our ping timeout and reg timeout checks
+ */
+ time_t next_call;
+
/** Get the current time
* Because this only calls time() once every time around the mainloop,
* it is much faster than calling time() directly.
+ * @param delta True to use the delta as an offset, false otherwise
* @return The current time as an epoch value (time_t)
*/
- time_t Time();
+ time_t Time(bool delta = false);
+
+ /** Set the time offset in seconds
+ * This offset is added to Time() to offset the system time by the specified
+ * number of seconds.
+ * @param delta The number of seconds to offset
+ * @return The old time delta
+ */
+ int SetTimeDelta(int delta);
/** Process a user whos socket has been flagged as active
* @param cu The user to process
/** Bind all ports specified in the configuration file.
* @param bail True if the function should bail back to the shell on failure
+ * @param found_ports The actual number of ports found in the config, as opposed to the number actually bound
* @return The number of ports actually bound without error
*/
- int BindPorts(bool bail);
+ int BindPorts(bool bail, int &found_ports);
/** Returns true if this server has the given port bound to the given address
* @param port The port number
*/
bool IsValidMask(const std::string &mask);
- /** Add an InspSocket class to the active set
- * @param sock A socket to add to the active set
- */
- void AddSocket(InspSocket* sock);
-
- /** Remove an InspSocket class from the active set at next time around the loop
- * @param sock A socket to remove from the active set
- */
- void RemoveSocket(InspSocket* sock);
-
- /** Delete a socket immediately without waiting for the next iteration of the mainloop
- * @param sock A socket to delete from the active set
- */
- void DelSocket(InspSocket* sock);
-
/** Rehash the local server
*/
void RehashServer();
*/
void Log(int level, const std::string &text);
+ void SendWhoisLine(userrec* user, userrec* dest, int numeric, const std::string &text);
+
+ void SendWhoisLine(userrec* user, userrec* dest, int numeric, const char* format, ...);
+
/** Begin execution of the server.
* NOTE: this function NEVER returns. Internally,
* after performing some initialisation routines,