]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/inspircd.h
Remove the Kiwi links from the readme.
[user/henk/code/inspircd.git] / include / inspircd.h
index a563edc7f89cbded8dcb00a53204b977d395b6bf..a55d52c0b0e5dff8a0b2e250e0e9b4ef72d3a13c 100644 (file)
@@ -1,13 +1,19 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2019 Matt Schatz <genius3000@g3k.solutions>
+ *   Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
+ *   Copyright (C) 2013 Daniel Vassdal <shutter@canternet.org>
+ *   Copyright (C) 2012-2016, 2018 Attila Molnar <attilamolnar@hush.com>
+ *   Copyright (C) 2012-2014, 2017-2019 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
+ *   Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
+ *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ *   Copyright (C) 2007-2009 Dennis Friis <peavey@inspircd.org>
  *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
- *   Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com>
- *   Copyright (C) 2003-2008 Craig Edwards <craigedwards@brainbox.cc>
- *   Copyright (C) 2006-2007 Oliver Lupton <oliverlupton@gmail.com>
- *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- *   Copyright (C) 2003 randomdan <???@???>
+ *   Copyright (C) 2007 Oliver Lupton <om@inspircd.org>
+ *   Copyright (C) 2005-2008, 2010 Craig Edwards <brain@inspircd.org>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
 
 #pragma once
 
+// If the system has a pre-C11 stdint header this must be defined in
+// order to use the numeric limit macros.
+#define __STDC_LIMIT_MACROS
+
 #include <cfloat>
 #include <climits>
 #include <cmath>
@@ -70,6 +80,7 @@ struct fakederef
 #include "dynref.h"
 #include "consolecolors.h"
 #include "cull_list.h"
+#include "serialize.h"
 #include "extensible.h"
 #include "fileutils.h"
 #include "ctables.h"
@@ -176,15 +187,6 @@ class serverstats
 class CoreExport InspIRCd
 {
  private:
-       /** Set up the signal handlers
-        */
-       void SetSignals();
-
-       /** Daemonize the ircd and close standard input/output streams
-        * @return True if the program daemonized succesfully
-        */
-       bool DaemonSeed();
-
        /** The current time, updated in the mainloop
         */
        struct timespec TIME;
@@ -196,11 +198,6 @@ class CoreExport InspIRCd
 
        ClientProtocol::RFCEvents rfcevents;
 
-       /** Check we aren't running as root, and exit if we are
-        * with exit code EXIT_STATUS_ROOT.
-        */
-       void CheckRoot();
-
  public:
 
        UIDGenerator UIDGen;
@@ -215,7 +212,7 @@ class CoreExport InspIRCd
         * Reason for it:
         * kludge alert!
         * SendMode expects a User* to send the numeric replies
-        * back to, so we create it a fake user that isnt in the user
+        * back to, so we create it a fake user that isn't in the user
         * hash and set its descriptor to FD_MAGIC_NUMBER so the data
         * falls into the abyss :p
         */
@@ -284,7 +281,7 @@ class CoreExport InspIRCd
         */
        TimerManager Timers;
 
-       /** X-Line manager. Handles G/K/Q/E line setting, removal and matching
+       /** X-line manager. Handles G/K/Q/E-line setting, removal and matching
         */
        XLineManager* XLines;
 
@@ -300,7 +297,7 @@ class CoreExport InspIRCd
         */
        std::vector<ListenSocket*> ports;
 
-       /** Set to the current signal recieved
+       /** Set to the current signal received
         */
        static sig_atomic_t s_signal;
 
@@ -357,7 +354,7 @@ class CoreExport InspIRCd
        /** Bind all ports specified in the configuration file.
         * @return The number of ports bound without error
         */
-       int BindPorts(FailedPortList &failed_ports);
+       size_t BindPorts(FailedPortList &failed_ports);
 
        /** Find a user in the nick hash.
         * If the user cant be found in the nick hash check the uuid hash
@@ -403,12 +400,12 @@ class CoreExport InspIRCd
        static bool IsSID(const std::string& sid);
 
        /** Handles incoming signals after being set
-        * @param signal the signal recieved
+        * @param signal the signal received
         */
        void SignalHandler(int signal);
 
-       /** Sets the signal recieved
-        * @param signal the signal recieved
+       /** Sets the signal received
+        * @param signal the signal received
         */
        static void SetSignal(int signal);
 
@@ -502,12 +499,26 @@ class CoreExport InspIRCd
         */
        static unsigned long Duration(const std::string& str);
 
+       /** Calculate a duration in seconds from a string in the form 1y2w3d4h6m5s
+        * @param str A string containing a time in the form 1y2w3d4h6m5s
+        * (one year, two weeks, three days, four hours, six minutes and five seconds)
+        * @param duration The location to place the parsed duration valur
+        * @return Whether the duration was a valid format or not
+        */
+       static bool Duration(const std::string& str, unsigned long& duration);
+
        /** Determines whether a string contains a valid duration.
         * @param str A string containing a time in the form 1y2w3d4h6m5s
         * @return True if the string is a valid duration; otherwise, false.
         */
        static bool IsValidDuration(const std::string& str);
 
+       /** Return a duration in seconds as a human-readable string.
+        * @param duration The duration in seconds to convert to a human-readable string.
+        * @return A string representing the given duration.
+        */
+       static std::string DurationString(time_t duration);
+
        /** Attempt to compare a password to a string from the config file.
         * This will be passed to handling modules which will compare the data
         * against possible hashed equivalents in the input string.