]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Tidy up source files:
authorPeter Powell <petpow@saberuk.com>
Tue, 2 Apr 2013 19:12:15 +0000 (20:12 +0100)
committerPeter Powell <petpow@saberuk.com>
Fri, 12 Apr 2013 16:03:05 +0000 (17:03 +0100)
- Use #pragma once instead of include guards.
- Move header files in src/modules to include/modules.
- Fixed various spacing issues.

111 files changed:
configure
include/bancache.h
include/base.h
include/caller.h
include/channels.h
include/command_parse.h
include/commands/cmd_whowas.h
include/configparser.h
include/configreader.h
include/consolecolors.h
include/ctables.h
include/cull_list.h
include/dns.h
include/dynamic.h
include/exitcodes.h
include/extensible.h
include/filelogger.h
include/hashcomp.h
include/inspircd.h
include/inspsocket.h
include/inspstring.h
include/listmode.h
include/logger.h
include/membership.h
include/mode.h
include/modules.h
include/modules/account.h [new file with mode: 0644]
include/modules/cap.h [new file with mode: 0644]
include/modules/hash.h [new file with mode: 0644]
include/modules/httpd.h [new file with mode: 0644]
include/modules/regex.h [new file with mode: 0644]
include/modules/sasl.h [new file with mode: 0644]
include/modules/spanningtree.h [new file with mode: 0644]
include/modules/sql.h [new file with mode: 0644]
include/modules/ssl.h [new file with mode: 0644]
include/numerics.h
include/protocol.h
include/snomasks.h
include/socket.h
include/socketengine.h
include/testsuite.h
include/threadengine.h
include/threadengines/threadengine_pthread.h
include/threadengines/threadengine_win32.h
include/timer.h
include/typedefs.h
include/uid.h
include/usermanager.h
include/users.h
include/xline.h
src/modules/account.h [deleted file]
src/modules/extra/m_mysql.cpp
src/modules/extra/m_pgsql.cpp
src/modules/extra/m_regex_pcre.cpp
src/modules/extra/m_regex_posix.cpp
src/modules/extra/m_regex_stdlib.cpp
src/modules/extra/m_regex_tre.cpp
src/modules/extra/m_sqlite3.cpp
src/modules/extra/m_ssl_gnutls.cpp
src/modules/extra/m_ssl_openssl.cpp
src/modules/hash.h [deleted file]
src/modules/httpd.h [deleted file]
src/modules/m_banexception.cpp
src/modules/m_cap.cpp
src/modules/m_cap.h [deleted file]
src/modules/m_cloaking.cpp
src/modules/m_filter.cpp
src/modules/m_httpd.cpp
src/modules/m_httpd_acl.cpp
src/modules/m_httpd_config.cpp
src/modules/m_httpd_stats.cpp
src/modules/m_inviteexception.cpp
src/modules/m_ircv3.cpp
src/modules/m_md5.cpp
src/modules/m_namesx.cpp
src/modules/m_password_hash.cpp
src/modules/m_regex.h [deleted file]
src/modules/m_regex_glob.cpp
src/modules/m_regonlycreate.cpp
src/modules/m_ripemd160.cpp
src/modules/m_rline.cpp
src/modules/m_sasl.cpp
src/modules/m_services_account.cpp
src/modules/m_sha256.cpp
src/modules/m_spanningtree/cachetimer.h
src/modules/m_spanningtree/commands.h
src/modules/m_spanningtree/hmac.cpp
src/modules/m_spanningtree/link.h
src/modules/m_spanningtree/main.h
src/modules/m_spanningtree/operquit.cpp
src/modules/m_spanningtree/protocolinterface.h
src/modules/m_spanningtree/resolvers.h
src/modules/m_spanningtree/treeserver.cpp
src/modules/m_spanningtree/treeserver.h
src/modules/m_spanningtree/treesocket.h
src/modules/m_spanningtree/treesocket1.cpp
src/modules/m_spanningtree/utils.h
src/modules/m_sqlauth.cpp
src/modules/m_sqloper.cpp
src/modules/m_sslinfo.cpp
src/modules/m_sslmodes.cpp
src/modules/m_uhnames.cpp
src/modules/sasl.h [deleted file]
src/modules/spanningtree.h [deleted file]
src/modules/sql.h [deleted file]
src/modules/ssl.h [deleted file]
win/config.h.cmake
win/inspircd_memory_functions.cpp
win/inspircd_win32wrapper.cpp
win/inspircd_win32wrapper.h
win/win32service.h

index 3e5b517c6d2aff9c85ecf87daca83620d63f5f05..1dc6b3ef199a811b127d195d051e799e88975036 100755 (executable)
--- a/configure
+++ b/configure
@@ -876,8 +876,7 @@ sub writefiles {
                open(FILEHANDLE, ">include/config.h.tmp");
                print FILEHANDLE <<EOF;
 /* Auto generated by configure, do not modify! */
-#ifndef __CONFIGURATION_AUTO__
-#define __CONFIGURATION_AUTO__
+#pragma once
 
 #define BRANCH "$branch"
 #define VERSION "$version"
@@ -946,7 +945,7 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
                                $config{SOCKETENGINE} = "socketengine_select";
                        }
                }
-               print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n\n#endif\n";
+               print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n";
                close(FILEHANDLE);
                
                my $file = 'include/config.h';
index 9cff918028af09ecd346b88309b8b31bf6bfabba..450f711c4e2bcb00695d478ad2db41ed446f4d34 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef BANCACHE_H
-#define BANCACHE_H
+#pragma once
 
 /** Stores a cached ban entry.
  * Each ban has one of these hashed in a hash_map to make for faster removal
@@ -84,5 +83,3 @@ class CoreExport BanCacheManager
        }
        ~BanCacheManager();
 };
-
-#endif
index 5308ed655af9d0e167efa4da5f0b84912bc86bb7..117ffab762c2317d09154138353652553caf8b5a 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef BASE_H
-#define BASE_H
+#pragma once
 
 #include <map>
 #include <deque>
@@ -255,5 +254,3 @@ class CoreExport ServiceProvider : public classbase
        virtual ~ServiceProvider();
 };
 
-
-#endif
index 563577ac283b0640462f066dabbb2d0426692490..f69ff67969a170c68eafaebfa4098dfa25b9102e 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 
-#ifndef CALLER_H
-#define CALLER_H
+#pragma once
 
 /* Pending some sort of C++11 support */
 #if 0
@@ -355,5 +354,3 @@ template <typename ReturnType, typename Param1, typename Param2, typename Param3
        class CoreExport NAME : public HandlerBase8<RETURN, V1, V2, V3, V4, V5, V6, V7, V8> { public: NAME() { } virtual ~NAME() { } virtual RETURN Call(V1, V2, V3, V4, V5, V6, V7, V8); }
 
 #endif
-
-#endif
index 43302552eb54d96ff85176019154d3555184afa0..3c60fcd6abe880208b6d68e2887d6154970e06c2 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef CHANNELS_H
-#define CHANNELS_H
+#pragma once
 
 #include "membership.h"
 #include "mode.h"
@@ -354,5 +353,3 @@ class CoreExport Channel : public Extensible, public InviteBase
         */
        ModResult GetExtBanStatus(User *u, char type);
 };
-
-#endif
index f6ff588e1a82139742fd29997a99b8254e99a871..e865018e4a4af15787dbf14e2519016844ba0a82 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef COMMAND_PARSE_H
-#define COMMAND_PARSE_H
+#pragma once
 
 /** A list of dll/so files containing the command handlers for the core
  */
@@ -175,5 +174,3 @@ const int duration_multi[] =
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
 };
-
-#endif
index 590c111724fe455fea823fcb3fb5a0324f863be2..7e1eeefc9384771f759524a8fdc804be6ea7af22 100644 (file)
@@ -19,8 +19,8 @@
  */
 
 
-#ifndef CMD_WHOWAS_H
-#define CMD_WHOWAS_H
+#pragma once
+
 #include "modules.h"
 
 /* Forward ref for typedefs */
@@ -114,5 +114,3 @@ class WhoWasGroup
         */
        ~WhoWasGroup();
 };
-
-#endif
index 9b2cd4527db963c8481922344b96054e8051cea7..8292fdda5c6207182cd4129bdf6b27bcc41d4f2a 100644 (file)
@@ -17,6 +17,8 @@
  */
 
 
+#pragma once
+
 struct fpos
 {
        std::string filename;
@@ -76,5 +78,3 @@ struct FileWrapper
                }
        }
 };
-
-
index b137ee544f46f8952cc5bc7b1bb94b9a285a4b4f..a2dfd2a34777b5841c1f3705500a89ce310483a8 100644 (file)
@@ -21,8 +21,7 @@
  */
 
 
-#ifndef INSPIRCD_CONFIGREADER
-#define INSPIRCD_CONFIGREADER
+#pragma once
 
 #include <sstream>
 #include <string>
@@ -569,5 +568,3 @@ class CoreExport ConfigReaderThread : public Thread
        void Finish();
        bool IsDone() { return done; }
 };
-
-#endif
index f7ca1335ed244f16514d457d4fa035971fab2996..9b7e0670afae1c68df0659e83ca870e50ca76272 100644 (file)
@@ -14,8 +14,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef CONSOLECOLORS_H
-#define CONSOLECOLORS_H
+
+#pragma once
 
 #include <ostream>
 
@@ -96,5 +96,3 @@ inline std::ostream& con_reset(std::ostream &s)
 }
 
 #endif
-
-#endif
index f9cd08cb3ae9dc8b209770bb05d1de4d6d7c468c..2ccca0f7bf5b7b0479c89e6a995d9e152d4ecdb0 100644 (file)
@@ -21,8 +21,7 @@
  */
 
 
-#ifndef CTABLES_H
-#define CTABLES_H
+#pragma once
 
 /** Used to indicate command success codes
  */
@@ -252,5 +251,3 @@ class CoreExport SplitCommand : public Command
        translation.push_back(x5);translation.push_back(x6);translation.push_back(x7);
 #define TRANSLATE8(x1,x2,x3,x4,x5,x6,x7,x8)  translation.push_back(x1);translation.push_back(x2);translation.push_back(x3);translation.push_back(x4);\
        translation.push_back(x5);translation.push_back(x6);translation.push_back(x7);translation.push_back(x8);
-
-#endif
index 75b08b7a373d686e0c51993908a6d0525e44417e..ac64dced284341805081c6e78c0b33927a1af9d3 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef CULL_LIST_H
-#define CULL_LIST_H
+#pragma once
 
 /**
  * The CullList class is used to delete objects at the end of the main loop to
@@ -58,6 +57,3 @@ class CoreExport ActionList
        void Run();
 
 };
-
-#endif
-
index 3c8e55d08a1ea3d6f6c73007ce44a1f1a3f270b2..d03af89189570c2d93adca19ffa81bd016bfea76 100644 (file)
@@ -18,7 +18,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 /*
 dns.h - dns library very very loosely based on
 firedns, Copyright (C) 2002 Ian Gulliver
@@ -37,8 +36,8 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
-#ifndef DNS_H
-#define DNS_H
+
+#pragma once
 
 #include "socket.h"
 #include "hashcomp.h"
@@ -438,6 +437,3 @@ class CoreExport DNS : public EventHandler
         */
        int PruneCache();
 };
-
-#endif
-
index 5e66ddbb0493938a440eb42afcabf1f3c0447833..d42cf61bf965855dbbb8231e374543f1b5b04ada 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef DLL_H
-#define DLL_H
+#pragma once
 
 /** The DLLManager class is able to load a module file by filename,
  * and locate its init_module symbol.
@@ -65,6 +64,3 @@ class CoreExport DLLManager : public classbase
        /** Get detailed version information from the module file */
        std::string GetVersion();
 };
-
-#endif
-
index d4890c94d5bcf24ae877d949525c28725651b7ad..888431969e871e6e3cb794234895bfd63d9fcf2f 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 
-#ifndef EXITCODE_H
-#define EXITCODE_H
+#pragma once
 
 /** Valid exit codes to be used with InspIRCd::Exit()
  */
@@ -52,6 +51,3 @@ enum ExitStatus
  * human-readable strings to be shown on shutdown.
  */
 extern const char * ExitCodes[];
-
-#endif
-
index bcc4992bb4867cf1fcad7923ecb8a4750a23b9a3..e062f66a5131aab399d72a6fb219e4370fdb7524 100644 (file)
@@ -17,8 +17,7 @@
  */
 
 
-#ifndef EXTENSIBLE_H
-#define EXTENSIBLE_H
+#pragma once
 
 #include <stdint.h>
 
@@ -190,5 +189,3 @@ class CoreExport StringExtItem : public ExtensionItem
        void unset(Extensible* container);
        void free(void* item);
 };
-
-#endif
index 739e4d94b1517839f662209a1120af029c384b00..091dc9a03a76554e495f702e1ee2ae74fc31ef5d 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef FILELOGGER_H
-#define FILELOGGER_H
+#pragma once
 
 #include "logger.h"
 
@@ -51,6 +50,3 @@ class CoreExport FileLogStream : public LogStream
 
        virtual void OnLog(int loglevel, const std::string &type, const std::string &msg);
 };
-
-#endif
-
index 2932f2a4862c069dab5a243ffbbc0bf7ea8ce368..e4b3cfe79e1de86279bfd866b6b98480535746b1 100644 (file)
@@ -22,8 +22,7 @@
  */
 
 
-#ifndef HASHCOMP_H
-#define HASHCOMP_H
+#pragma once
 
 #include <cstring>
 #include <string>
@@ -600,5 +599,3 @@ namespace std
                
        }
 }
-
-#endif
index f61d48529d959f2a1da96331863c283aec4cbe2f..0ec2c74659f3a25621f865ecef5bc8af64a5418a 100644 (file)
@@ -23,8 +23,7 @@
  */
 
 
-#ifndef INSPIRCD_H
-#define INSPIRCD_H
+#pragma once
 
 #define _FILE_OFFSET_BITS 64
 #ifndef _LARGEFILE_SOURCE
@@ -877,6 +876,3 @@ class CommandModule : public Module
                return Version(cmd.name, VF_VENDOR|VF_CORE);
        }
 };
-
-#endif
-
index c62c5a25099375193622b4331963256ef2e819ea..75c6dc511a2b1050703d5dc17b0af932600ddc47 100644 (file)
@@ -21,8 +21,7 @@
  */
 
 
-#ifndef INSPSOCKET_H
-#define INSPSOCKET_H
+#pragma once
 
 #include "timer.h"
 
@@ -234,4 +233,3 @@ class CoreExport BufferedSocket : public StreamSocket
 inline Module* StreamSocket::GetIOHook() { return IOHook; }
 inline void StreamSocket::AddIOHook(Module* m) { IOHook = m; }
 inline void StreamSocket::DelIOHook() { IOHook = NULL; }
-#endif
index 494ce92b156a250acc671b98093047f744519235..7a433427a5a8efdba001044509b497ca8e7b09cc 100644 (file)
  */
 
 
-#ifndef INSPSTRING_H
-#define INSPSTRING_H
+#pragma once
 
 // This (config) is needed as inspstring doesn't pull in the central header
 #include "config.h"
 #include <cstring>
-//#include <cstddef>
 
 #ifndef HAS_STRLCPY
 /** strlcpy() implementation for systems that don't have it (linux) */
@@ -52,6 +50,3 @@ CoreExport std::string BinToHex(const std::string& data);
 CoreExport std::string BinToBase64(const std::string& data, const char* table = NULL, char pad = 0);
 /** Base64 decode */
 CoreExport std::string Base64ToBin(const std::string& data, const char* table = NULL);
-
-#endif
-
index b070b90f94f2e9466fc0e5b84120c1d2bd9cbf46..1c6f70d6f483c5b02eeb4016c78f551846d69d40 100644 (file)
@@ -16,6 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #pragma once
 
 /** The base class for list modes, should be inherited.
index eee964e15140ccef6c75111c550252014a7641d2..7b4c45f1c3e3379e9ca2bf594ee40b2e5ef3573f 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef LOGGER_H
-#define LOGGER_H
+#pragma once
 
 /** Simple wrapper providing periodic flushing to a disk-backed file.
  */
@@ -211,5 +210,3 @@ class CoreExport LogManager
         */
        void Log(const std::string &type, int loglevel, const char *fmt, ...) CUSTOM_PRINTF(4, 5);
 };
-
-#endif
index 436a9371c5c30ef60505d3be81026d9b4aec016a..44f58841793791e4ed55c116a240b9e7d5d0fc90 100644 (file)
@@ -17,8 +17,7 @@
  */
 
 
-#ifndef MEMBERSHIP_H
-#define MEMBERSHIP_H
+#pragma once
 
 class CoreExport Membership : public Extensible
 {
@@ -59,5 +58,3 @@ class Invitation : public classbase
        static void Create(Channel* c, LocalUser* u, time_t timeout);
        static Invitation* Find(Channel* c, LocalUser* u, bool check_expired = true);
 };
-
-#endif
index de8d4c5f86ad83e71e39b37beab2f4766dac58ee..57f1b0669c6d8a74ee1f3457c06606cc694e1413 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef MODE_H
-#define MODE_H
+#pragma once
 
 #include "ctables.h"
 
@@ -563,5 +562,3 @@ class CoreExport ModeParser
         */
        std::string BuildPrefixes(bool lettersAndModes = true);
 };
-
-#endif
index 9ba238da5ee6f8a17445553d6ca9b6a3f0c1c764..783edd9b171d60ae9a2df2a3dfadd5e14ebec9d9 100644 (file)
@@ -23,8 +23,7 @@
  */
 
 
-#ifndef MODULES_H
-#define MODULES_H
+#pragma once
 
 #include "dynamic.h"
 #include "base.h"
@@ -1645,5 +1644,3 @@ struct AllModuleList {
 #define COMMAND_INIT(c) MODULE_INIT(CommandModule<c>)
 
 #endif
-
-#endif
diff --git a/include/modules/account.h b/include/modules/account.h
new file mode 100644 (file)
index 0000000..c00b044
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
+ *
+ * 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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+#include <map>
+#include <string>
+
+class AccountEvent : public Event
+{
+ public:
+       User* const user;
+       const std::string account;
+       AccountEvent(Module* me, User* u, const std::string& name)
+               : Event(me, "account_login"), user(u), account(name)
+       {
+       }
+};
+
+typedef StringExtItem AccountExtItem;
+
+inline AccountExtItem* GetAccountExtItem()
+{
+       return static_cast<AccountExtItem*>(ServerInstance->Extensions.GetItem("accountname"));
+}
diff --git a/include/modules/cap.h b/include/modules/cap.h
new file mode 100644 (file)
index 0000000..2ed8df4
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
+ *
+ * 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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+class CapEvent : public Event
+{
+ public:
+       enum CapEventType
+       {
+               CAPEVENT_REQ,
+               CAPEVENT_LS,
+               CAPEVENT_LIST,
+               CAPEVENT_CLEAR
+       };
+
+       CapEventType type;
+       std::vector<std::string> wanted;
+       std::vector<std::string> ack;
+       User* user;
+       CapEvent(Module* sender, User* u, CapEventType capevtype) : Event(sender, "cap_request"), type(capevtype), user(u) {}
+};
+
+class GenericCap
+{
+ public:
+       LocalIntExt ext;
+       const std::string cap;
+       GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + Cap, parent), cap(Cap)
+       {
+               ServerInstance->Modules->AddService(ext);
+       }
+
+       void HandleEvent(Event& ev)
+       {
+               if (ev.id != "cap_request")
+                       return;
+
+               CapEvent *data = static_cast<CapEvent*>(&ev);
+               if (data->type == CapEvent::CAPEVENT_REQ)
+               {
+                       for (std::vector<std::string>::iterator it = data->wanted.begin(); it != data->wanted.end(); ++it)
+                       {
+                               if (it->empty())
+                                       continue;
+                               bool enablecap = ((*it)[0] != '-');
+                               if (((enablecap) && (*it == cap)) || (*it == "-" + cap))
+                               {
+                                       // we can handle this, so ACK it, and remove it from the wanted list
+                                       data->ack.push_back(*it);
+                                       data->wanted.erase(it);
+                                       ext.set(data->user, enablecap ? 1 : 0);
+                                       break;
+                               }
+                       }
+               }
+               else if (data->type == CapEvent::CAPEVENT_LS)
+               {
+                       data->wanted.push_back(cap);
+               }
+               else if (data->type == CapEvent::CAPEVENT_LIST)
+               {
+                       if (ext.get(data->user))
+                               data->wanted.push_back(cap);
+               }
+               else if (data->type == CapEvent::CAPEVENT_CLEAR)
+               {
+                       data->ack.push_back("-" + cap);
+                       ext.set(data->user, 0);
+               }
+       }
+};
+
diff --git a/include/modules/hash.h b/include/modules/hash.h
new file mode 100644 (file)
index 0000000..da04c45
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2010 Daniel De Graaf <danieldg@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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+#include "modules.h"
+
+class HashProvider : public DataProvider
+{
+ public:
+       const unsigned int out_size;
+       const unsigned int block_size;
+       HashProvider(Module* mod, const std::string& Name, int osiz, int bsiz)
+               : DataProvider(mod, Name), out_size(osiz), block_size(bsiz) {}
+       virtual std::string sum(const std::string& data) = 0;
+       inline std::string hexsum(const std::string& data)
+       {
+               return BinToHex(sum(data));
+       }
+
+       inline std::string b64sum(const std::string& data)
+       {
+               return BinToBase64(sum(data), NULL, 0);
+       }
+
+       /** HMAC algorithm, RFC 2104 */
+       std::string hmac(const std::string& key, const std::string& msg)
+       {
+               std::string hmac1, hmac2;
+               std::string kbuf = key.length() > block_size ? sum(key) : key;
+               kbuf.resize(block_size);
+
+               for (size_t n = 0; n < block_size; n++)
+               {
+                       hmac1.push_back(static_cast<char>(kbuf[n] ^ 0x5C));
+                       hmac2.push_back(static_cast<char>(kbuf[n] ^ 0x36));
+               }
+               hmac2.append(msg);
+               hmac1.append(sum(hmac2));
+               return sum(hmac1);
+       }
+};
diff --git a/include/modules/httpd.h b/include/modules/httpd.h
new file mode 100644 (file)
index 0000000..d1746e8
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com>
+ *   Copyright (C) 2007 John Brooks <john.brooks@dereferenced.net>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
+ *
+ * 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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+#include "base.h"
+
+#include <string>
+#include <sstream>
+#include <map>
+
+/** A modifyable list of HTTP header fields
+ */
+class HTTPHeaders
+{
+ protected:
+       std::map<std::string,std::string> headers;
+ public:
+
+       /** Set the value of a header
+        * Sets the value of the named header. If the header is already present, it will be replaced
+        */
+       void SetHeader(const std::string &name, const std::string &data)
+       {
+               headers[name] = data;
+       }
+
+       /** Set the value of a header, only if it doesn't exist already
+        * Sets the value of the named header. If the header is already present, it will NOT be updated
+        */
+       void CreateHeader(const std::string &name, const std::string &data)
+       {
+               if (!IsSet(name))
+                       SetHeader(name, data);
+       }
+
+       /** Remove the named header
+        */
+       void RemoveHeader(const std::string &name)
+       {
+               headers.erase(name);
+       }
+
+       /** Remove all headers
+        */
+       void Clear()
+       {
+               headers.clear();
+       }
+
+       /** Get the value of a header
+        * @return The value of the header, or an empty string
+        */
+       std::string GetHeader(const std::string &name)
+       {
+               std::map<std::string,std::string>::iterator it = headers.find(name);
+               if (it == headers.end())
+                       return std::string();
+
+               return it->second;
+       }
+
+       /** Check if the given header is specified
+        * @return true if the header is specified
+        */
+       bool IsSet(const std::string &name)
+       {
+               std::map<std::string,std::string>::iterator it = headers.find(name);
+               return (it != headers.end());
+       }
+
+       /** Get all headers, formatted by the HTTP protocol
+        * @return Returns all headers, formatted according to the HTTP protocol. There is no request terminator at the end
+        */
+       std::string GetFormattedHeaders()
+       {
+               std::string re;
+
+               for (std::map<std::string,std::string>::iterator i = headers.begin(); i != headers.end(); i++)
+                       re += i->first + ": " + i->second + "\r\n";
+
+               return re;
+       }
+};
+
+class HttpServerSocket;
+
+/** This class represents a HTTP request.
+ */
+class HTTPRequest : public Event
+{
+ protected:
+       std::string type;
+       std::string document;
+       std::string ipaddr;
+       std::string postdata;
+
+ public:
+
+       HTTPHeaders *headers;
+       int errorcode;
+
+       /** A socket pointer, which you must return in your HTTPDocument class
+        * if you reply to this request.
+        */
+       HttpServerSocket* sock;
+
+       /** Initialize HTTPRequest.
+        * This constructor is called by m_httpd.so to initialize the class.
+        * @param request_type The request type, e.g. GET, POST, HEAD
+        * @param uri The URI, e.g. /page
+        * @param hdr The headers sent with the request
+        * @param opaque An opaque pointer used internally by m_httpd, which you must pass back to the module in your reply.
+        * @param ip The IP address making the web request.
+        * @param pdata The post data (content after headers) received with the request, up to Content-Length in size
+        */
+       HTTPRequest(Module* me, const std::string &eventid, const std::string &request_type, const std::string &uri,
+               HTTPHeaders* hdr, HttpServerSocket* socket, const std::string &ip, const std::string &pdata)
+               : Event(me, eventid), type(request_type), document(uri), ipaddr(ip), postdata(pdata), headers(hdr), sock(socket)
+       {
+       }
+
+       /** Get the post data (request content).
+        * All post data will be returned, including carriage returns and linefeeds.
+        * @return The postdata
+        */
+       std::string& GetPostData()
+       {
+               return postdata;
+       }
+
+       /** Get the request type.
+        * Any request type can be intercepted, even ones which are invalid in the HTTP/1.1 spec.
+        * @return The request type, e.g. GET, POST, HEAD
+        */
+       std::string& GetType()
+       {
+               return type;
+       }
+
+       /** Get URI.
+        * The URI string (URL minus hostname and scheme) will be provided by this function.
+        * @return The URI being requested
+        */
+       std::string& GetURI()
+       {
+               return document;
+       }
+
+       /** Get IP address of requester.
+        * The requesting system's ip address will be returned.
+        * @return The IP address as a string
+        */
+       std::string& GetIP()
+       {
+               return ipaddr;
+       }
+};
+
+/** You must return a HTTPDocument to the httpd module by using the Request class.
+ * When you initialize this class you may initialize it with all components required to
+ * form a valid HTTP response, including document data, headers, and a response code.
+ */
+class HTTPDocumentResponse : public Request
+{
+ public:
+       std::stringstream* document;
+       int responsecode;
+       HTTPHeaders headers;
+       HTTPRequest& src;
+
+       /** Initialize a HTTPRequest ready for sending to m_httpd.so.
+        * @param opaque The socket pointer you obtained from the HTTPRequest at an earlier time
+        * @param doc A stringstream containing the document body
+        * @param response A valid HTTP/1.0 or HTTP/1.1 response code. The response text will be determined for you
+        * based upon the response code.
+        * @param extra Any extra headers to include with the defaults, seperated by carriage return and linefeed.
+        */
+       HTTPDocumentResponse(Module* me, HTTPRequest& req, std::stringstream* doc, int response)
+               : Request(me, req.source, "HTTP-DOC"), document(doc), responsecode(response), src(req)
+       {
+       }
+};
diff --git a/include/modules/regex.h b/include/modules/regex.h
new file mode 100644 (file)
index 0000000..875f942
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2008 Thomas Stagner <aquanight@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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+#include "inspircd.h"
+
+class Regex : public classbase
+{
+protected:
+       std::string regex_string; // The raw uncompiled regex string.
+
+       // Constructor may as well be protected, as this class is abstract.
+       Regex(const std::string& rx) : regex_string(rx)
+       {
+       }
+
+public:
+
+       virtual ~Regex()
+       {
+       }
+
+       virtual bool Matches(const std::string& text) = 0;
+
+       const std::string& GetRegexString() const
+       {
+               return regex_string;
+       }
+};
+
+class RegexFactory : public DataProvider
+{
+ public:
+       RegexFactory(Module* Creator, const std::string& Name) : DataProvider(Creator, Name) {}
+
+       virtual Regex* Create(const std::string& expr) = 0;
+};
diff --git a/include/modules/sasl.h b/include/modules/sasl.h
new file mode 100644 (file)
index 0000000..321711a
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2010 Daniel De Graaf <danieldg@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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+class SASLFallback : public Event
+{
+ public:
+       const parameterlist& params;
+       SASLFallback(Module* me, const parameterlist& p)
+               : Event(me, "sasl_fallback"), params(p)
+       {
+               Send();
+       }
+};
diff --git a/include/modules/spanningtree.h b/include/modules/spanningtree.h
new file mode 100644 (file)
index 0000000..99f4f9f
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+struct AddServerEvent : public Event
+{
+       const std::string servername;
+       AddServerEvent(Module* me, const std::string& name)
+               : Event(me, "new_server"), servername(name)
+       {
+               Send();
+       }
+};
+
+struct DelServerEvent : public Event
+{
+       const std::string servername;
+       DelServerEvent(Module* me, const std::string& name)
+               : Event(me, "lost_server"), servername(name)
+       {
+               Send();
+       }
+};
diff --git a/include/modules/sql.h b/include/modules/sql.h
new file mode 100644 (file)
index 0000000..a671cc9
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2010 Daniel De Graaf <danieldg@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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+/** Defines the error types which SQLerror may be set to
+ */
+enum SQLerrorNum { SQL_NO_ERROR, SQL_BAD_DBID, SQL_BAD_CONN, SQL_QSEND_FAIL, SQL_QREPLY_FAIL };
+
+/** A list of format parameters for an SQLquery object.
+ */
+typedef std::vector<std::string> ParamL;
+
+typedef std::map<std::string, std::string> ParamM;
+
+class SQLEntry
+{
+ public:
+       std::string value;
+       bool nul;
+       SQLEntry() : nul(true) {}
+       SQLEntry(const std::string& v) : value(v), nul(false) {}
+       inline operator std::string&() { return value; }
+};
+
+typedef std::vector<SQLEntry> SQLEntries;
+
+/**
+ * Result of an SQL query. Only valid inside OnResult
+ */
+class SQLResult : public classbase
+{
+ public:
+       /**
+        * Return the number of rows in the result.
+        *
+        * Note that if you have perfomed an INSERT or UPDATE query or other
+        * query which will not return rows, this will return the number of
+        * affected rows. In this case you SHOULD NEVER access any of the result
+        * set rows, as there aren't any!
+        * @returns Number of rows in the result set.
+        */
+       virtual int Rows() = 0;
+
+       /**
+        * Return a single row (result of the query). The internal row counter
+        * is incremented by one.
+        *
+        * @param result Storage for the result data.
+        * @returns true if there was a row, false if no row exists (end of
+        * iteration)
+        */
+       virtual bool GetRow(SQLEntries& result) = 0;
+
+       /** Returns column names for the items in this row
+        */
+       virtual void GetCols(std::vector<std::string>& result) = 0;
+};
+
+/** SQLerror holds the error state of a request.
+ * The error string varies from database software to database software
+ * and should be used to display informational error messages to users.
+ */
+class SQLerror
+{
+ public:
+       /** The error id
+        */
+       SQLerrorNum id;
+
+       /** The error string
+        */
+       std::string str;
+
+       /** Initialize an SQLerror
+        * @param i The error ID to set
+        * @param s The (optional) error string to set
+        */
+       SQLerror(SQLerrorNum i, const std::string &s = "")
+       : id(i), str(s)
+       {
+       }
+
+       /** Return the error string for an error
+        */
+       const char* Str()
+       {
+               if(str.length())
+                       return str.c_str();
+
+               switch(id)
+               {
+                       case SQL_BAD_DBID:
+                               return "Invalid database ID";
+                       case SQL_BAD_CONN:
+                               return "Invalid connection";
+                       case SQL_QSEND_FAIL:
+                               return "Sending query failed";
+                       case SQL_QREPLY_FAIL:
+                               return "Getting query result failed";
+                       default:
+                               return "Unknown error";
+               }
+       }
+};
+
+/**
+ * Object representing an SQL query. This should be allocated on the heap and
+ * passed to an SQLProvider, which will free it when the query is complete or
+ * when the querying module is unloaded.
+ *
+ * You should store whatever information is needed to have the callbacks work in
+ * this object (UID of user, channel name, etc).
+ */
+class SQLQuery : public classbase
+{
+ public:
+       ModuleRef creator;
+
+       SQLQuery(Module* Creator) : creator(Creator) {}
+       virtual ~SQLQuery() {}
+
+       virtual void OnResult(SQLResult& result) = 0;
+       /**
+        * Called when the query fails
+        */
+       virtual void OnError(SQLerror& error) { }
+};
+
+/**
+ * Provider object for SQL servers
+ */
+class SQLProvider : public DataProvider
+{
+ public:
+       SQLProvider(Module* Creator, const std::string& Name) : DataProvider(Creator, Name) {}
+       /** Submit an asynchronous SQL request
+        * @param callback The result reporting point
+        * @param query The hardcoded query string. If you have parameters to substitute, see below.
+        */
+       virtual void submit(SQLQuery* callback, const std::string& query) = 0;
+
+       /** Submit an asynchronous SQL request
+        * @param callback The result reporting point
+        * @param format The simple parameterized query string ('?' parameters)
+        * @param p Parameters to fill in for the '?' entries
+        */
+       virtual void submit(SQLQuery* callback, const std::string& format, const ParamL& p) = 0;
+
+       /** Submit an asynchronous SQL request.
+        * @param callback The result reporting point
+        * @param format The parameterized query string ('$name' parameters)
+        * @param p Parameters to fill in for the '$name' entries
+        */
+       virtual void submit(SQLQuery* callback, const std::string& format, const ParamM& p) = 0;
+
+       /** Convenience function to prepare a map from a User* */
+       void PopulateUserInfo(User* user, ParamM& userinfo)
+       {
+               userinfo["nick"] = user->nick;
+               userinfo["host"] = user->host;
+               userinfo["ip"] = user->GetIPString();
+               userinfo["gecos"] = user->fullname;
+               userinfo["ident"] = user->ident;
+               userinfo["server"] = user->server;
+               userinfo["uuid"] = user->uuid;
+       }
+};
diff --git a/include/modules/ssl.h b/include/modules/ssl.h
new file mode 100644 (file)
index 0000000..a79dcc9
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
+ *
+ * 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
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+#include <map>
+#include <string>
+
+/** ssl_cert is a class which abstracts SSL certificate
+ * and key information.
+ *
+ * Because gnutls and openssl represent key information in
+ * wildly different ways, this class allows it to be accessed
+ * in a unified manner. These classes are attached to ssl-
+ * connected local users using SSLCertExt
+ */
+class ssl_cert : public refcountbase
+{
+ public:
+       std::string dn;
+       std::string issuer;
+       std::string error;
+       std::string fingerprint;
+       bool trusted, invalid, unknownsigner, revoked;
+
+       ssl_cert() : trusted(false), invalid(true), unknownsigner(true), revoked(false) {}
+
+       /** Get certificate distinguished name
+        * @return Certificate DN
+        */
+       const std::string& GetDN()
+       {
+               return dn;
+       }
+
+       /** Get Certificate issuer
+        * @return Certificate issuer
+        */
+       const std::string& GetIssuer()
+       {
+               return issuer;
+       }
+
+       /** Get error string if an error has occured
+        * @return The error associated with this users certificate,
+        * or an empty string if there is no error.
+        */
+       const std::string& GetError()
+       {
+               return error;
+       }
+
+       /** Get key fingerprint.
+        * @return The key fingerprint as a hex string.
+        */
+       const std::string& GetFingerprint()
+       {
+               return fingerprint;
+       }
+
+       /** Get trust status
+        * @return True if this is a trusted certificate
+        * (the certificate chain validates)
+        */
+       bool IsTrusted()
+       {
+               return trusted;
+       }
+
+       /** Get validity status
+        * @return True if the certificate itself is
+        * correctly formed.
+        */
+       bool IsInvalid()
+       {
+               return invalid;
+       }
+
+       /** Get signer status
+        * @return True if the certificate appears to be
+        * self-signed.
+        */
+       bool IsUnknownSigner()
+       {
+               return unknownsigner;
+       }
+
+       /** Get revokation status.
+        * @return True if the certificate is revoked.
+        * Note that this only works properly for GnuTLS
+        * right now.
+        */
+       bool IsRevoked()
+       {
+               return revoked;
+       }
+
+       bool IsCAVerified()
+       {
+               return trusted && !invalid && !revoked && !unknownsigner && error.empty();
+       }
+
+       std::string GetMetaLine()
+       {
+               std::stringstream value;
+               bool hasError = !error.empty();
+               value << (IsInvalid() ? "v" : "V") << (IsTrusted() ? "T" : "t") << (IsRevoked() ? "R" : "r")
+                       << (IsUnknownSigner() ? "s" : "S") << (hasError ? "E" : "e") << " ";
+               if (hasError)
+                       value << GetError();
+               else
+                       value << GetFingerprint() << " " << GetDN() << " " << GetIssuer();
+               return value.str();
+       }
+};
+
+/** Get certificate from a socket (only useful with an SSL module) */
+struct SocketCertificateRequest : public Request
+{
+       StreamSocket* const sock;
+       ssl_cert* cert;
+
+       SocketCertificateRequest(StreamSocket* ss, Module* Me)
+               : Request(Me, ss->GetIOHook(), "GET_SSL_CERT"), sock(ss), cert(NULL)
+       {
+               Send();
+       }
+
+       std::string GetFingerprint()
+       {
+               if (cert)
+                       return cert->GetFingerprint();
+               return "";
+       }
+};
+
+/** Get certificate from a user (requires m_sslinfo) */
+struct UserCertificateRequest : public Request
+{
+       User* const user;
+       ssl_cert* cert;
+
+       UserCertificateRequest(User* u, Module* Me, Module* info = ServerInstance->Modules->Find("m_sslinfo.so"))
+               : Request(Me, info, "GET_USER_CERT"), user(u), cert(NULL)
+       {
+               Send();
+       }
+
+       std::string GetFingerprint()
+       {
+               if (cert)
+                       return cert->GetFingerprint();
+               return "";
+       }
+};
index 4fce4cb6de53b746c9ef6a8e6798fdca00aa8a1b..997a71d3ae2bac678c7b64b779ff46732c45d68d 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef NUMERICS_H
-#define NUMERICS_H
+#pragma once
 
 /*
  * This file is aimed providing a string that is easier to use than using the numeric
@@ -157,5 +156,3 @@ enum Numerics
        ERR_CANTLOADMODULE                              =       974, // insp-specific
        RPL_LOADEDMODULE                                =       975 // insp-specific
 };
-
-#endif
index aabb5b022c7d444be244b08ffe40313f1a866c1e..4488fcea43cd80be6923f3a9133d32dc42a9b8a1 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef PROTOCOL_H
-#define PROTOCOL_H
+#pragma once
 
 #include "hashcomp.h"
 
@@ -135,6 +134,3 @@ class ProtocolInterface
         */
        virtual void GetServerList(ProtoServerList &sl) { }
 };
-
-#endif
-
index 85ad26f71392a7e068f35a43b7e3564cc17770cd..c5d594eebadc18575dc055901e3e60d91d473ff0 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef SNOMASKS_H
-#define SNOMASKS_H
+#pragma once
 
 class Snomask
 {
@@ -106,5 +105,3 @@ class CoreExport SnomaskManager
         */
        void FlushSnotices();
 };
-
-#endif
index 5f67051246d3dbe2017f5cab375632c58b69e016..f6934b771a0820dfcd2273a76bb337c1bb8b71d4 100644 (file)
@@ -22,8 +22,7 @@
  */
 
 
-#ifndef INSPIRCD_SOCKET_H
-#define INSPIRCD_SOCKET_H
+#pragma once
 
 #ifndef _WIN32
 
@@ -165,6 +164,3 @@ class CoreExport ListenSocket : public EventHandler
         */
        void AcceptInternal();
 };
-
-#endif
-
index 58af73589fd0fd121b06a3f341f6f18e2a894580..fd199c324832dd7c9f3693c13ce76498d2121026 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef SOCKETENGINE_H
-#define SOCKETENGINE_H
+#pragma once
 
 #include <vector>
 #include <string>
@@ -492,6 +491,3 @@ public:
 };
 
 SocketEngine* CreateSocketEngine();
-
-#endif
-
index f91e508c930597c0fa12bb4f2e59322370599d00..43064b0630cdfc9f0da271af846b7e054d915679 100644 (file)
@@ -16,8 +16,7 @@
  */
 
 
-#ifndef TESTSUITE_H
-#define TESTSUITE_H
+#pragma once
 
 class TestSuite
 {
@@ -32,5 +31,3 @@ class TestSuite
        bool DoSpaceSepStreamTests();
        bool DoGenerateUIDTests();
 };
-
-#endif
index e0ed9ec405b006b428c54afce1d32c3bc396267e..39f150566bc17ed52dff736fa2e416147958d1f8 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef THREADENGINE_H
-#define THREADENGINE_H
+#pragma once
 
 #include <vector>
 #include <string>
@@ -172,6 +171,3 @@ class CoreExport SocketThread : public Thread
         */
        virtual void OnNotify() = 0;
 };
-
-#endif
-
index 5168ed238cb53dbb5f4862af37efa151448bece9..253e8d2237ad38c641fea684c37c14ab17acef35 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef THREADENGINE_PTHREAD_H
-#define THREADENGINE_PTHREAD_H
+#pragma once
 
 #include <pthread.h>
 #include "typedefs.h"
@@ -153,6 +152,3 @@ class ThreadSignalData
  public:
        ThreadSignalSocket* sock;
 };
-
-
-#endif
index 2fdcac5650ccb400bdb214886889fd35d7eee739..59848bd44e3004b2c84f4c6d1aab067e5a8a7d82 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef THREADENGINE_WIN32_H
-#define THREADENGINE_WIN32_H
+#pragma once
 
 #include "config.h"
 #include "base.h"
@@ -152,6 +151,3 @@ class ThreadSignalData
                connFD = -1;
        }
 };
-
-#endif
-
index 9bb7128b85ac7f6283ec51a0e6986fc7464a6a1d..0dda6876e01cb3225b09bbb9aaa41c6a5736000d 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 
-#ifndef INSPIRCD_TIMER_H
-#define INSPIRCD_TIMER_H
+#pragma once
 
 /** Timer class for one-second resolution timers
  * Timer provides a facility which allows module
@@ -149,6 +148,3 @@ class CoreExport TimerManager
         */
        static bool TimerComparison( Timer *one,  Timer*two);
 };
-
-#endif
-
index e737906671b1197346d32abb8e7804178bc68f61..be7d4f796116320d7c1807b1bcdf2d51a0327cf0 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 
-#ifndef TYPEDEFS_H
-#define TYPEDEFS_H
+#pragma once
 
 class BanCacheManager;
 class BanItem;
@@ -154,7 +153,3 @@ typedef XLineContainer::iterator ContainerIter;
 /** An interator in an XLineLookup
  */
 typedef XLineLookup::iterator LookupIter;
-
-
-#endif
-
index 17061bdee972a72f296459bfad966e93f735ccd2..3783e7ada5ccc4891d7fb68020a1aac8d68b9c0d 100644 (file)
@@ -16,6 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#pragma once
 
 /**
  * This is the maximum length of a UUID (unique user identifier).
@@ -24,4 +25,3 @@
  */
 #define UUID_LENGTH 10
 
-
index 812d8e2f2b77b47b37e133d38b77d5c6f2687dd3..560db17f2c72b64125a0f92dfe253a5ed564960d 100644 (file)
@@ -17,8 +17,7 @@
  */
 
 
-#ifndef USERMANAGER_H
-#define USERMANAGER_H
+#pragma once
 
 #include <list>
 
@@ -168,5 +167,3 @@ class CoreExport UserManager
         */
        void ServerPrivmsgAll(const char* text, ...) CUSTOM_PRINTF(2, 3);
 };
-
-#endif
index c5c936c131efe8e725309cfbccfb1ae4cc8c5c08..34bcc9c73e77eed89eb065ede95d318885530e7b 100644 (file)
@@ -22,8 +22,7 @@
  */
 
 
-#ifndef USERS_H
-#define USERS_H
+#pragma once
 
 #include "socket.h"
 #include "inspsocket.h"
@@ -953,5 +952,3 @@ class CoreExport UserResolver : public Resolver
         */
        void OnError(ResolverError e, const std::string &errormessage);
 };
-
-#endif
index 4094e05df2c0a83cd9ef631d3fc5b8a32794277d..119e29dc12930e7429804f11e81f61e6bdd48822 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef XLINE_H
-#define XLINE_H
+#pragma once
 
 /** XLine is the base class for ban lines such as G lines and K lines.
  * Modules may derive from this, and their xlines will automatically be
@@ -527,4 +526,3 @@ class CoreExport XLineManager
        void InvokeStats(const std::string &type, int numeric, User* user, string_list &results);
 };
 
-#endif
diff --git a/src/modules/account.h b/src/modules/account.h
deleted file mode 100644 (file)
index ba671ba..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
- *
- * 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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef ACCOUNT_H
-#define ACCOUNT_H
-
-#include <map>
-#include <string>
-
-class AccountEvent : public Event
-{
- public:
-       User* const user;
-       const std::string account;
-       AccountEvent(Module* me, User* u, const std::string& name)
-               : Event(me, "account_login"), user(u), account(name)
-       {
-       }
-};
-
-typedef StringExtItem AccountExtItem;
-
-inline AccountExtItem* GetAccountExtItem()
-{
-       return static_cast<AccountExtItem*>(ServerInstance->Extensions.GetItem("accountname"));
-}
-
-#endif
index b71c3543e21ff67f4d52494edb44e2221a7453e0..2a7e2f8787d2547ed66472ed14954ad53b27707d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "inspircd.h"
 #include <mysql.h>
-#include "sql.h"
+#include "modules/sql.h"
 
 #ifdef _WIN32
 # pragma comment(lib, "mysqlclient.lib")
index ea94834f39f61857fa2574532d843adc0efd0369..6d2e0c88aec64d89814ef8713d15e8b34d103000 100644 (file)
@@ -26,7 +26,7 @@
 #include <cstdlib>
 #include <sstream>
 #include <libpq-fe.h>
-#include "sql.h"
+#include "modules/sql.h"
 
 /* $ModDesc: PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API */
 /* $CompileFlags: -Iexec("pg_config --includedir") eval("my $s = `pg_config --version`;$s =~ /^.*?(\d+)\.(\d+)\.(\d+).*?$/;my $v = hex(sprintf("0x%02x%02x%02x", $1, $2, $3));print "-DPGSQL_HAS_ESCAPECONN" if(($v >= 0x080104) || ($v >= 0x07030F && $v < 0x070400) || ($v >= 0x07040D && $v < 0x080000) || ($v >= 0x080008 && $v < 0x080100));") */
index e9d9aba8a24b9a4838be97b1f6a08943af8d108a..b2dd53515654a7ce7541706c305513dab09c9260 100644 (file)
 
 #include "inspircd.h"
 #include <pcre.h>
-#include "m_regex.h"
+#include "modules/regex.h"
 
 /* $ModDesc: Regex Provider Module for PCRE */
-/* $ModDep: m_regex.h */
+/* $ModDep: modules/regex.h */
 /* $CompileFlags: exec("pcre-config --cflags") */
 /* $LinkerFlags: exec("pcre-config --libs") rpath("pcre-config --libs") -lpcre */
 
index 513f54cfc6972a97a368a16084608035936a6a5c..2c1295fd85ffd715505383eed6c9b9366aaa2f31 100644 (file)
 
 
 #include "inspircd.h"
-#include "m_regex.h"
+#include "modules/regex.h"
 #include <sys/types.h>
 #include <regex.h>
 
 /* $ModDesc: Regex Provider Module for POSIX Regular Expressions */
-/* $ModDep: m_regex.h */
+/* $ModDep: modules/regex.h */
 
 class POSIXRegexException : public ModuleException
 {
index 64d479cbc1795e82f6d4f10d31e8e2fa2390e4c4..3c15f5568886e0d05688fe23938c773427331ccc 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 #include "inspircd.h"
-#include "m_regex.h"
+#include "modules/regex.h"
 #include <regex>
 
 /* $ModDesc: Regex Provider Module for std::regex Regular Expressions */
@@ -25,7 +25,7 @@
  *  Specify the Regular Expression engine to use here. Valid settings are
  *  bre, ere, awk, grep, egrep, ecmascript (default if not specified)*/
 /* $CompileFlags: -std=c++11 */
-/* $ModDep: m_regex.h */
+/* $ModDep: modules/regex.h */
 
 class StdRegexException : public ModuleException
 {
index b5bd7d0121026eb4e384accc481a3efb98b54840..c352d5fdf98bbb862f68520c0847e5396c54a309 100644 (file)
 
 
 #include "inspircd.h"
-#include "m_regex.h"
+#include "modules/regex.h"
 #include <sys/types.h>
 #include <tre/regex.h>
 
 /* $ModDesc: Regex Provider Module for TRE Regular Expressions */
 /* $CompileFlags: pkgconfincludes("tre","tre/regex.h","") */
 /* $LinkerFlags: pkgconflibs("tre","/libtre.so","-ltre") rpath("pkg-config --libs tre") */
-/* $ModDep: m_regex.h */
+/* $ModDep: modules/regex.h */
 
 class TRERegexException : public ModuleException
 {
index 40f44557ab329cbed1eed9b52168de2f3e31d51a..5cffa364029da8ffb24d6016a76c578197318a06 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "inspircd.h"
 #include <sqlite3.h>
-#include "sql.h"
+#include "modules/sql.h"
 
 #ifdef _WIN32
 # pragma comment(lib, "sqlite3.lib")
index 31beb258f6b8f0c1d260fa055fcebf4a5795d4fe..1caacaa0fbcc57af3f5ee3ebc95efa5379b6d8e3 100644 (file)
@@ -25,8 +25,8 @@
 #include <gcrypt.h>
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
-#include "ssl.h"
-#include "m_cap.h"
+#include "modules/ssl.h"
+#include "modules/cap.h"
 
 #ifdef _WIN32
 # pragma comment(lib, "libgnutls.lib")
index 427439eb33e9927429d0070b2d5569f23a759a11..5a0e56db2ce7f668f96774093d7be6d15177876e 100644 (file)
@@ -33,7 +33,7 @@
 #include "inspircd.h"
 #include <openssl/ssl.h>
 #include <openssl/err.h>
-#include "ssl.h"
+#include "modules/ssl.h"
 
 #ifdef _WIN32
 # pragma comment(lib, "libcrypto.lib")
diff --git a/src/modules/hash.h b/src/modules/hash.h
deleted file mode 100644 (file)
index dd7f082..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2010 Daniel De Graaf <danieldg@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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef HASH_H
-#define HASH_H
-
-#include "modules.h"
-
-class HashProvider : public DataProvider
-{
- public:
-       const unsigned int out_size;
-       const unsigned int block_size;
-       HashProvider(Module* mod, const std::string& Name, int osiz, int bsiz)
-               : DataProvider(mod, Name), out_size(osiz), block_size(bsiz) {}
-       virtual std::string sum(const std::string& data) = 0;
-       inline std::string hexsum(const std::string& data)
-       {
-               return BinToHex(sum(data));
-       }
-
-       inline std::string b64sum(const std::string& data)
-       {
-               return BinToBase64(sum(data), NULL, 0);
-       }
-
-       /** HMAC algorithm, RFC 2104 */
-       std::string hmac(const std::string& key, const std::string& msg)
-       {
-               std::string hmac1, hmac2;
-               std::string kbuf = key.length() > block_size ? sum(key) : key;
-               kbuf.resize(block_size);
-
-               for (size_t n = 0; n < block_size; n++)
-               {
-                       hmac1.push_back(static_cast<char>(kbuf[n] ^ 0x5C));
-                       hmac2.push_back(static_cast<char>(kbuf[n] ^ 0x36));
-               }
-               hmac2.append(msg);
-               hmac1.append(sum(hmac2));
-               return sum(hmac1);
-       }
-};
-
-#endif
diff --git a/src/modules/httpd.h b/src/modules/httpd.h
deleted file mode 100644 (file)
index 57c60b3..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
- *   Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com>
- *   Copyright (C) 2007 John Brooks <john.brooks@dereferenced.net>
- *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- *   Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
- *
- * 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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "base.h"
-
-#ifndef HTTPD_H
-#define HTTPD_H
-
-#include <string>
-#include <sstream>
-#include <map>
-
-/** A modifyable list of HTTP header fields
- */
-class HTTPHeaders
-{
- protected:
-       std::map<std::string,std::string> headers;
- public:
-
-       /** Set the value of a header
-        * Sets the value of the named header. If the header is already present, it will be replaced
-        */
-       void SetHeader(const std::string &name, const std::string &data)
-       {
-               headers[name] = data;
-       }
-
-       /** Set the value of a header, only if it doesn't exist already
-        * Sets the value of the named header. If the header is already present, it will NOT be updated
-        */
-       void CreateHeader(const std::string &name, const std::string &data)
-       {
-               if (!IsSet(name))
-                       SetHeader(name, data);
-       }
-
-       /** Remove the named header
-        */
-       void RemoveHeader(const std::string &name)
-       {
-               headers.erase(name);
-       }
-
-       /** Remove all headers
-        */
-       void Clear()
-       {
-               headers.clear();
-       }
-
-       /** Get the value of a header
-        * @return The value of the header, or an empty string
-        */
-       std::string GetHeader(const std::string &name)
-       {
-               std::map<std::string,std::string>::iterator it = headers.find(name);
-               if (it == headers.end())
-                       return std::string();
-
-               return it->second;
-       }
-
-       /** Check if the given header is specified
-        * @return true if the header is specified
-        */
-       bool IsSet(const std::string &name)
-       {
-               std::map<std::string,std::string>::iterator it = headers.find(name);
-               return (it != headers.end());
-       }
-
-       /** Get all headers, formatted by the HTTP protocol
-        * @return Returns all headers, formatted according to the HTTP protocol. There is no request terminator at the end
-        */
-       std::string GetFormattedHeaders()
-       {
-               std::string re;
-
-               for (std::map<std::string,std::string>::iterator i = headers.begin(); i != headers.end(); i++)
-                       re += i->first + ": " + i->second + "\r\n";
-
-               return re;
-       }
-};
-
-class HttpServerSocket;
-
-/** This class represents a HTTP request.
- */
-class HTTPRequest : public Event
-{
- protected:
-       std::string type;
-       std::string document;
-       std::string ipaddr;
-       std::string postdata;
-
- public:
-
-       HTTPHeaders *headers;
-       int errorcode;
-
-       /** A socket pointer, which you must return in your HTTPDocument class
-        * if you reply to this request.
-        */
-       HttpServerSocket* sock;
-
-       /** Initialize HTTPRequest.
-        * This constructor is called by m_httpd.so to initialize the class.
-        * @param request_type The request type, e.g. GET, POST, HEAD
-        * @param uri The URI, e.g. /page
-        * @param hdr The headers sent with the request
-        * @param opaque An opaque pointer used internally by m_httpd, which you must pass back to the module in your reply.
-        * @param ip The IP address making the web request.
-        * @param pdata The post data (content after headers) received with the request, up to Content-Length in size
-        */
-       HTTPRequest(Module* me, const std::string &eventid, const std::string &request_type, const std::string &uri,
-               HTTPHeaders* hdr, HttpServerSocket* socket, const std::string &ip, const std::string &pdata)
-               : Event(me, eventid), type(request_type), document(uri), ipaddr(ip), postdata(pdata), headers(hdr), sock(socket)
-       {
-       }
-
-       /** Get the post data (request content).
-        * All post data will be returned, including carriage returns and linefeeds.
-        * @return The postdata
-        */
-       std::string& GetPostData()
-       {
-               return postdata;
-       }
-
-       /** Get the request type.
-        * Any request type can be intercepted, even ones which are invalid in the HTTP/1.1 spec.
-        * @return The request type, e.g. GET, POST, HEAD
-        */
-       std::string& GetType()
-       {
-               return type;
-       }
-
-       /** Get URI.
-        * The URI string (URL minus hostname and scheme) will be provided by this function.
-        * @return The URI being requested
-        */
-       std::string& GetURI()
-       {
-               return document;
-       }
-
-       /** Get IP address of requester.
-        * The requesting system's ip address will be returned.
-        * @return The IP address as a string
-        */
-       std::string& GetIP()
-       {
-               return ipaddr;
-       }
-};
-
-/** You must return a HTTPDocument to the httpd module by using the Request class.
- * When you initialize this class you may initialize it with all components required to
- * form a valid HTTP response, including document data, headers, and a response code.
- */
-class HTTPDocumentResponse : public Request
-{
- public:
-       std::stringstream* document;
-       int responsecode;
-       HTTPHeaders headers;
-       HTTPRequest& src;
-
-       /** Initialize a HTTPRequest ready for sending to m_httpd.so.
-        * @param opaque The socket pointer you obtained from the HTTPRequest at an earlier time
-        * @param doc A stringstream containing the document body
-        * @param response A valid HTTP/1.0 or HTTP/1.1 response code. The response text will be determined for you
-        * based upon the response code.
-        * @param extra Any extra headers to include with the defaults, seperated by carriage return and linefeed.
-        */
-       HTTPDocumentResponse(Module* me, HTTPRequest& req, std::stringstream* doc, int response)
-               : Request(me, req.source, "HTTP-DOC"), document(doc), responsecode(response), src(req)
-       {
-       }
-};
-
-#endif
index cf4144935998decc0e47c49c71df5bfca662a802..63f0085eda4de188720dba0c16cd907d362f659a 100644 (file)
@@ -25,7 +25,6 @@
 #include "listmode.h"
 
 /* $ModDesc: Provides support for the +e channel mode */
-/* $ModDep: ../../include/listmode.h */
 
 /* Written by Om<om@inspircd.org>, April 2005. */
 /* Rewritten to use the listmode utility by Om, December 2005 */
index 59b92eb2743eb94a18c7916d2f41ea7d6382ad3f..ee9c96936c23122ac1cac055f945b92a3d51d58e 100644 (file)
@@ -19,7 +19,7 @@
 
 
 #include "inspircd.h"
-#include "m_cap.h"
+#include "modules/cap.h"
 
 /* $ModDesc: Provides the CAP negotiation mechanism seen in ratbox-derived ircds */
 
diff --git a/src/modules/m_cap.h b/src/modules/m_cap.h
deleted file mode 100644 (file)
index 409671f..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
- *   Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
- *
- * 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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef M_CAP_H
-#define M_CAP_H
-
-class CapEvent : public Event
-{
- public:
-       enum CapEventType
-       {
-               CAPEVENT_REQ,
-               CAPEVENT_LS,
-               CAPEVENT_LIST,
-               CAPEVENT_CLEAR
-       };
-
-       CapEventType type;
-       std::vector<std::string> wanted;
-       std::vector<std::string> ack;
-       User* user;
-       CapEvent(Module* sender, User* u, CapEventType capevtype) : Event(sender, "cap_request"), type(capevtype), user(u) {}
-};
-
-class GenericCap
-{
- public:
-       LocalIntExt ext;
-       const std::string cap;
-       GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + Cap, parent), cap(Cap)
-       {
-               ServerInstance->Modules->AddService(ext);
-       }
-
-       void HandleEvent(Event& ev)
-       {
-               if (ev.id != "cap_request")
-                       return;
-
-               CapEvent *data = static_cast<CapEvent*>(&ev);
-               if (data->type == CapEvent::CAPEVENT_REQ)
-               {
-                       for (std::vector<std::string>::iterator it = data->wanted.begin(); it != data->wanted.end(); ++it)
-                       {
-                               if (it->empty())
-                                       continue;
-                               bool enablecap = ((*it)[0] != '-');
-                               if (((enablecap) && (*it == cap)) || (*it == "-" + cap))
-                               {
-                                       // we can handle this, so ACK it, and remove it from the wanted list
-                                       data->ack.push_back(*it);
-                                       data->wanted.erase(it);
-                                       ext.set(data->user, enablecap ? 1 : 0);
-                                       break;
-                               }
-                       }
-               }
-               else if (data->type == CapEvent::CAPEVENT_LS)
-               {
-                       data->wanted.push_back(cap);
-               }
-               else if (data->type == CapEvent::CAPEVENT_LIST)
-               {
-                       if (ext.get(data->user))
-                               data->wanted.push_back(cap);
-               }
-               else if (data->type == CapEvent::CAPEVENT_CLEAR)
-               {
-                       data->ack.push_back("-" + cap);
-                       ext.set(data->user, 0);
-               }
-       }
-};
-
-#endif
index 5bec93f034cdc1bee2832fa0e7b48184e131db0a..9eb9a8da90421541e053db2b5977f29736af35cf 100644 (file)
@@ -24,7 +24,7 @@
 
 
 #include "inspircd.h"
-#include "hash.h"
+#include "modules/hash.h"
 
 /* $ModDesc: Provides masking of user hostnames */
 
index 7e7ded30619f6bc981cd6557abdaa5ebeb6b0e37..027222b3a20593bc8ac425ff17194c34bacc797a 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "inspircd.h"
 #include "xline.h"
-#include "m_regex.h"
+#include "modules/regex.h"
 
 /* $ModDesc: Text (spam) filtering */
 
index 46f0d6907fbdae1aaae3ef84b1c6eafa18a271f3..d768a94368e5687548ea77ce8601138c38eb9162 100644 (file)
 
 
 #include "inspircd.h"
-#include "httpd.h"
+#include "modules/httpd.h"
 
 /* $ModDesc: Provides HTTP serving facilities to modules */
-/* $ModDep: httpd.h */
+/* $ModDep: modules/httpd.h */
 
 class ModuleHttpServer;
 
index 70c36a1545f593261cc2ecd2411a1af6071c7097..aaf03802c6584f3e17083937d7823076922f6a92 100644 (file)
@@ -19,7 +19,7 @@
 
 
 #include "inspircd.h"
-#include "httpd.h"
+#include "modules/httpd.h"
 #include "protocol.h"
 
 /* $ModDesc: Provides access control lists (passwording of resources, ip restrictions etc) to m_httpd.so dependent modules */
index 88594e2fe288ae19cb6c38b2d43c64c5f170d850..cfdaa4290c3bd0e525290c097db4a243b07e20dd 100644 (file)
@@ -19,7 +19,7 @@
 
 
 #include "inspircd.h"
-#include "httpd.h"
+#include "modules/httpd.h"
 #include "protocol.h"
 
 /* $ModDesc: Allows for the server configuration to be viewed over HTTP via m_httpd.so */
index 2eb9f7cb75b87719b0ea22347fb380fdeb6a807a..7d7ebcf3d662d46332d87b06342524cecd38c998 100644 (file)
@@ -22,7 +22,7 @@
 
 
 #include "inspircd.h"
-#include "httpd.h"
+#include "modules/httpd.h"
 #include "xline.h"
 #include "protocol.h"
 
index 2d83828321bd8d84aa932ecd4679aed3ff5520e9..69498a94294142b7ce16b03978e564aae84bbc47 100644 (file)
@@ -25,7 +25,6 @@
 #include "listmode.h"
 
 /* $ModDesc: Provides support for the +I channel mode */
-/* $ModDep: ../../include/listmode.h */
 
 /*
  * Written by Om <om@inspircd.org>, April 2005.
index cc2e6c3222a41f3db0a10015f2bd695c6d062c58..0e28d59f2e6b8bead8c7ef97ad0dbce8d05cbab8 100644 (file)
@@ -19,8 +19,8 @@
 /* $ModDesc: Provides support for extended-join, away-notify and account-notify CAP capabilities */
 
 #include "inspircd.h"
-#include "account.h"
-#include "m_cap.h"
+#include "modules/account.h"
+#include "modules/cap.h"
 
 class ModuleIRCv3 : public Module
 {
index c42507ea19080bc96243d98b852bace28c1df340..feba027f67a0213dbe173ced5b1d6b26972ed0af 100644 (file)
@@ -27,7 +27,7 @@
 #ifdef HAS_STDINT
 #include <stdint.h>
 #endif
-#include "hash.h"
+#include "modules/hash.h"
 
 /* The four core functions - F1 is optimized somewhat */
 #define F1(x, y, z) (z ^ (x & (y ^ z)))
index 4ba8613d88c2fd517d24572b503139bdb3a2401c..48d8cc8710b47529d18e304d14b56da06e0dc450 100644 (file)
@@ -21,7 +21,7 @@
 
 
 #include "inspircd.h"
-#include "m_cap.h"
+#include "modules/cap.h"
 
 /* $ModDesc: Provides the NAMESX (CAP multi-prefix) capability. */
 
index 98462780b09a7fda288759b029d0a9bd327ca845..e913f4925232d0bb188dbbbc4741c1c3e92c2a26 100644 (file)
@@ -21,7 +21,7 @@
 /* $ModDesc: Allows for hashed oper passwords */
 
 #include "inspircd.h"
-#include "hash.h"
+#include "modules/hash.h"
 
 /* Handle /MKPASSWD
  */
diff --git a/src/modules/m_regex.h b/src/modules/m_regex.h
deleted file mode 100644 (file)
index 0233f93..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
- *   Copyright (C) 2008 Thomas Stagner <aquanight@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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef M_REGEX_H
-#define M_REGEX_H
-
-#include "inspircd.h"
-
-class Regex : public classbase
-{
-protected:
-       std::string regex_string; // The raw uncompiled regex string.
-
-       // Constructor may as well be protected, as this class is abstract.
-       Regex(const std::string& rx) : regex_string(rx)
-       {
-       }
-
-public:
-
-       virtual ~Regex()
-       {
-       }
-
-       virtual bool Matches(const std::string& text) = 0;
-
-       const std::string& GetRegexString() const
-       {
-               return regex_string;
-       }
-};
-
-class RegexFactory : public DataProvider
-{
- public:
-       RegexFactory(Module* Creator, const std::string& Name) : DataProvider(Creator, Name) {}
-
-       virtual Regex* Create(const std::string& expr) = 0;
-};
-
-#endif
index a3088cabd6227c6187e317c2a25409e659a7bc5f..f53ac2b9ce4337d9d3491bfbd4a765e9cdd14d00 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 
-#include "m_regex.h"
+#include "modules/regex.h"
 #include "inspircd.h"
 
 /* $ModDesc: Regex module using plain wildcard matching. */
index 9d4cd5f60dd41d5d67e6ab28110f469cd4164baf..98250d2a732f543f4e90f9a4910d9f4abf7445a5 100644 (file)
@@ -21,7 +21,7 @@
 
 
 #include "inspircd.h"
-#include "account.h"
+#include "modules/account.h"
 
 /* $ModDesc: Prevents users whose nicks are not registered from creating new channels */
 
index e487d6e3055dcd8f26cc7e19e23d14b79c868282..3e7d00049170879f95179b255b54c8b91bbe52a0 100644 (file)
@@ -64,7 +64,7 @@
 #ifdef HAS_STDINT
 #include <stdint.h>
 #endif
-#include "hash.h"
+#include "modules/hash.h"
 
 #define RMDsize 160
 
index 2e94df0422cd437c5a6f197a9888bc2cd7bb8fd3..c4439cbfba8b38b9f00b23b8666534a06c3c3e2b 100644 (file)
@@ -23,7 +23,7 @@
 /* $ModDesc: RLINE: Regexp user banning. */
 
 #include "inspircd.h"
-#include "m_regex.h"
+#include "modules/regex.h"
 #include "xline.h"
 
 static bool ZlineOnMatch = false;
index ff007f7998536b8b7b0b4fd619efef3c271564f1..e949e3fd4c15c587ae61552b426f3c2d6df59b15 100644 (file)
 
 
 #include "inspircd.h"
-#include "m_cap.h"
-#include "account.h"
-#include "sasl.h"
-#include "ssl.h"
+#include "modules/cap.h"
+#include "modules/account.h"
+#include "modules/sasl.h"
+#include "modules/ssl.h"
 
 /* $ModDesc: Provides support for IRC Authentication Layer (aka: atheme SASL) via AUTHENTICATE. */
 
index fbf099924dbfeccc543641e949b433e005a3f15c..bdd47b4bc8f0764b0563bb3c300ad7283142eee4 100644 (file)
@@ -25,7 +25,7 @@
 /* $ModDesc: Provides support for ircu-style services accounts, including chmode +R, etc. */
 
 #include "inspircd.h"
-#include "account.h"
+#include "modules/account.h"
 
 /** Channel mode +r - mark a channel as identified
  */
index 360b18ddd4a616b324429c44008033d89119c6b5..2c53e7170e605ee143613fc2ed89fa98e6dfd6c9 100644 (file)
@@ -62,7 +62,7 @@
 #ifdef HAS_STDINT
 #include <stdint.h>
 #endif
-#include "hash.h"
+#include "modules/hash.h"
 
 #ifndef HAS_STDINT
 typedef unsigned int uint32_t;
index bad1b7419e5649250484007463c0d2954df4a64d..da99111700e47ea5f0931e524e51a96b5560c4f4 100644 (file)
@@ -17,8 +17,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_CACHETIMER_H
-#define M_SPANNINGTREE_CACHETIMER_H
+#pragma once
 
 #include "timer.h"
 
@@ -37,5 +36,3 @@ class CacheRefreshTimer : public Timer
        CacheRefreshTimer(SpanningTreeUtilities* Util);
        virtual void Tick(time_t TIME);
 };
-
-#endif
index 3b5b499c11d8cf8d3f3c83e2a6c9060f88720e22..93455c8c4c0dcdcc0d2bb6101837355d3aad2832 100644 (file)
@@ -17,8 +17,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_COMMANDS_H
-#define M_SPANNINGTREE_COMMANDS_H
+#pragma once
 
 #include "main.h"
 
@@ -151,5 +150,3 @@ class SpanningTreeCommands
        CommandFName fname;
        SpanningTreeCommands(ModuleSpanningTree* module);
 };
-
-#endif
index 8dc18cbbd985137a1142f85b65c26d32c229e9d4..ec39fb7467ab7d479e6191b0ad79fc42b9ad8308 100644 (file)
@@ -21,8 +21,8 @@
 #include "inspircd.h"
 #include "socket.h"
 #include "xline.h"
-#include "../hash.h"
-#include "../ssl.h"
+#include "modules/hash.h"
+#include "modules/ssl.h"
 #include "socketengine.h"
 
 #include "main.h"
index 797f108d86588ca3efe3f0495e66c3eb0073481e..b318c9bf2d65b2ab3ad564db5bdb00cfa45eb316 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_LINK_H
-#define M_SPANNINGTREE_LINK_H
+#pragma once
 
 class Link : public refcountbase
 {
@@ -51,5 +50,3 @@ class Autoconnect : public refcountbase
        int position;
        Autoconnect(ConfigTag* Tag) : tag(Tag) {}
 };
-
-#endif
index 1a16d72bbae5a02a64518388951ec334844549b4..fc59a3c7d398965a248da9b0a40e79eef63fb5be 100644 (file)
@@ -21,8 +21,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_MAIN_H
-#define M_SPANNINGTREE_MAIN_H
+#pragma once
 
 #include "inspircd.h"
 #include <stdarg.h>
@@ -178,5 +177,3 @@ class ModuleSpanningTree : public Module
        Version GetVersion();
        void Prioritize();
 };
-
-#endif
index af2e04ebc8c0bf4bc9409e2045ad5201e863a931..235f747818be99e35298d87a72e39ba2e5421543 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "inspircd.h"
 #include "xline.h"
-
 #include "treesocket.h"
 #include "treeserver.h"
 #include "utils.h"
index 297366893d3f86c191d547dafa0a39533586da32..2757db8da8541e3b8a244acd024c3e2dbe427243 100644 (file)
@@ -17,8 +17,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_PROTOCOLINTERFACE_H
-#define M_SPANNINGTREE_PROTOCOLINTERFACE_H
+#pragma once
 
 class SpanningTreeUtilities;
 class ModuleSpanningTree;
@@ -43,6 +42,3 @@ class SpanningTreeProtocolInterface : public ProtocolInterface
        virtual void SendUserNotice(User* target, const std::string &text);
        virtual void GetServerList(ProtoServerList &sl);
 };
-
-#endif
-
index 65b9e72495db121e2a5359e8c51c1110404a612c..a092e156b3ac4f5effb264d288513175fe97b0fa 100644 (file)
@@ -18,8 +18,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_RESOLVERS_H
-#define M_SPANNINGTREE_RESOLVERS_H
+#pragma once
 
 #include "socket.h"
 #include "inspircd.h"
@@ -63,5 +62,3 @@ class ServernameResolver : public Resolver
        void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached);
        void OnError(ResolverError e, const std::string &errormessage);
 };
-
-#endif
index 6213483ee9a324c35764e23c30b93c2aa702e326..42cd37fb9ec8ef0b6171f38fbef59767523088f5 100644 (file)
@@ -24,7 +24,7 @@
 #include "socket.h"
 #include "xline.h"
 #include "main.h"
-#include "../spanningtree.h"
+#include "modules/spanningtree.h"
 
 #include "utils.h"
 #include "treeserver.h"
index 60b6d1defc9d7e1dc8e10c45fe1d2a35a61f4466..f5d81bc735946d9268ac6b4eaea0c71fd687a445 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_TREESERVER_H
-#define M_SPANNINGTREE_TREESERVER_H
+#pragma once
 
 #include "treesocket.h"
 
@@ -210,5 +209,3 @@ class TreeServer : public classbase
         */
        ~TreeServer();
 };
-
-#endif
index 85d256c616a7439d2432685e390ec279d87e4ad4..2d975a4bfb41f7a4281b1155ac1c3b941b1051e8 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_TREESOCKET_H
-#define M_SPANNINGTREE_TREESOCKET_H
+#pragma once
 
 #include "socket.h"
 #include "inspircd.h"
@@ -318,6 +317,3 @@ class TreeSocket : public BufferedSocket
         */
        bool Introduced();
 };
-
-#endif
-
index 26171ee7297e818572bc1c902ef2064edb8addcb..6a528ed8d8f1e69250eda5a75a204687810852f9 100644 (file)
@@ -26,7 +26,7 @@
 #include "socketengine.h"
 
 #include "main.h"
-#include "../spanningtree.h"
+#include "modules/spanningtree.h"
 #include "utils.h"
 #include "treeserver.h"
 #include "link.h"
index 0d44cd24fb543ca3f116998475af5689c572d97b..fed90c253311b6511bcd0ac0d421d4a84ffaec91 100644 (file)
@@ -20,8 +20,7 @@
  */
 
 
-#ifndef M_SPANNINGTREE_UTILS_H
-#define M_SPANNINGTREE_UTILS_H
+#pragma once
 
 #include "inspircd.h"
 
@@ -179,5 +178,3 @@ class SpanningTreeUtilities : public classbase
         */
        void RefreshIPCache();
 };
-
-#endif
index 8647e3e9ed71f5da989a109e68983b3f44ec22b5..e92eea3a5c02ef434ef22eb895c6955c61a2c64d 100644 (file)
@@ -18,8 +18,8 @@
 
 
 #include "inspircd.h"
-#include "sql.h"
-#include "hash.h"
+#include "modules/sql.h"
+#include "modules/hash.h"
 
 /* $ModDesc: Allow/Deny connections based upon an arbitrary SQL table */
 
index 881b8d6d2f8f92ca0a13e7883c70da7a11b8c951..b5b020d9d6807a79a9e081d8446768a262141566 100644 (file)
@@ -18,8 +18,8 @@
 
 
 #include "inspircd.h"
-#include "sql.h"
-#include "hash.h"
+#include "modules/sql.h"
+#include "modules/hash.h"
 
 /* $ModDesc: Allows storage of oper credentials in an SQL table */
 
index a04a643a0762dc37f144f7e31c334b5e02d9cc66..b51c30b768ab0df72fdae9b89ebe275361de33f2 100644 (file)
@@ -18,7 +18,7 @@
 
 
 #include "inspircd.h"
-#include "ssl.h"
+#include "modules/ssl.h"
 
 /* $ModDesc: Provides SSL metadata, including /WHOIS information and /SSLINFO command */
 
index fbd77c249131cfdfb18c24a40a931c6195d06a69..d862a07060ec278bdc2e21771373a846c1439f4a 100644 (file)
@@ -22,7 +22,7 @@
 
 
 #include "inspircd.h"
-#include "ssl.h"
+#include "modules/ssl.h"
 
 /* $ModDesc: Provides channel mode +z to allow for Secure/SSL only channels */
 
index 1b0c91c9427e0cb881b76978e509a8941c24fde2..a0ff796aee2a6c4b66f03c3872f3cda5d738d5c2 100644 (file)
@@ -20,7 +20,7 @@
 
 
 #include "inspircd.h"
-#include "m_cap.h"
+#include "modules/cap.h"
 
 /* $ModDesc: Provides the UHNAMES facility. */
 
diff --git a/src/modules/sasl.h b/src/modules/sasl.h
deleted file mode 100644 (file)
index f673511..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2010 Daniel De Graaf <danieldg@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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef SASL_H
-#define SASL_H
-
-class SASLFallback : public Event
-{
- public:
-       const parameterlist& params;
-       SASLFallback(Module* me, const parameterlist& p)
-               : Event(me, "sasl_fallback"), params(p)
-       {
-               Send();
-       }
-};
-
-#endif
diff --git a/src/modules/spanningtree.h b/src/modules/spanningtree.h
deleted file mode 100644 (file)
index 212f35f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2009 Daniel De Graaf <danieldg@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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef SPANNINGTREE_H
-#define SPANNINGTREE_H
-
-struct AddServerEvent : public Event
-{
-       const std::string servername;
-       AddServerEvent(Module* me, const std::string& name)
-               : Event(me, "new_server"), servername(name)
-       {
-               Send();
-       }
-};
-
-struct DelServerEvent : public Event
-{
-       const std::string servername;
-       DelServerEvent(Module* me, const std::string& name)
-               : Event(me, "lost_server"), servername(name)
-       {
-               Send();
-       }
-};
-
-#endif
diff --git a/src/modules/sql.h b/src/modules/sql.h
deleted file mode 100644 (file)
index 436cd1d..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2010 Daniel De Graaf <danieldg@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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef INSPIRCD_SQLAPI_3
-#define INSPIRCD_SQLAPI_3
-
-/** Defines the error types which SQLerror may be set to
- */
-enum SQLerrorNum { SQL_NO_ERROR, SQL_BAD_DBID, SQL_BAD_CONN, SQL_QSEND_FAIL, SQL_QREPLY_FAIL };
-
-/** A list of format parameters for an SQLquery object.
- */
-typedef std::vector<std::string> ParamL;
-
-typedef std::map<std::string, std::string> ParamM;
-
-class SQLEntry
-{
- public:
-       std::string value;
-       bool nul;
-       SQLEntry() : nul(true) {}
-       SQLEntry(const std::string& v) : value(v), nul(false) {}
-       inline operator std::string&() { return value; }
-};
-
-typedef std::vector<SQLEntry> SQLEntries;
-
-/**
- * Result of an SQL query. Only valid inside OnResult
- */
-class SQLResult : public classbase
-{
- public:
-       /**
-        * Return the number of rows in the result.
-        *
-        * Note that if you have perfomed an INSERT or UPDATE query or other
-        * query which will not return rows, this will return the number of
-        * affected rows. In this case you SHOULD NEVER access any of the result
-        * set rows, as there aren't any!
-        * @returns Number of rows in the result set.
-        */
-       virtual int Rows() = 0;
-
-       /**
-        * Return a single row (result of the query). The internal row counter
-        * is incremented by one.
-        *
-        * @param result Storage for the result data.
-        * @returns true if there was a row, false if no row exists (end of
-        * iteration)
-        */
-       virtual bool GetRow(SQLEntries& result) = 0;
-
-       /** Returns column names for the items in this row
-        */
-       virtual void GetCols(std::vector<std::string>& result) = 0;
-};
-
-/** SQLerror holds the error state of a request.
- * The error string varies from database software to database software
- * and should be used to display informational error messages to users.
- */
-class SQLerror
-{
- public:
-       /** The error id
-        */
-       SQLerrorNum id;
-
-       /** The error string
-        */
-       std::string str;
-
-       /** Initialize an SQLerror
-        * @param i The error ID to set
-        * @param s The (optional) error string to set
-        */
-       SQLerror(SQLerrorNum i, const std::string &s = "")
-       : id(i), str(s)
-       {
-       }
-
-       /** Return the error string for an error
-        */
-       const char* Str()
-       {
-               if(str.length())
-                       return str.c_str();
-
-               switch(id)
-               {
-                       case SQL_BAD_DBID:
-                               return "Invalid database ID";
-                       case SQL_BAD_CONN:
-                               return "Invalid connection";
-                       case SQL_QSEND_FAIL:
-                               return "Sending query failed";
-                       case SQL_QREPLY_FAIL:
-                               return "Getting query result failed";
-                       default:
-                               return "Unknown error";
-               }
-       }
-};
-
-/**
- * Object representing an SQL query. This should be allocated on the heap and
- * passed to an SQLProvider, which will free it when the query is complete or
- * when the querying module is unloaded.
- *
- * You should store whatever information is needed to have the callbacks work in
- * this object (UID of user, channel name, etc).
- */
-class SQLQuery : public classbase
-{
- public:
-       ModuleRef creator;
-
-       SQLQuery(Module* Creator) : creator(Creator) {}
-       virtual ~SQLQuery() {}
-
-       virtual void OnResult(SQLResult& result) = 0;
-       /**
-        * Called when the query fails
-        */
-       virtual void OnError(SQLerror& error) { }
-};
-
-/**
- * Provider object for SQL servers
- */
-class SQLProvider : public DataProvider
-{
- public:
-       SQLProvider(Module* Creator, const std::string& Name) : DataProvider(Creator, Name) {}
-       /** Submit an asynchronous SQL request
-        * @param callback The result reporting point
-        * @param query The hardcoded query string. If you have parameters to substitute, see below.
-        */
-       virtual void submit(SQLQuery* callback, const std::string& query) = 0;
-
-       /** Submit an asynchronous SQL request
-        * @param callback The result reporting point
-        * @param format The simple parameterized query string ('?' parameters)
-        * @param p Parameters to fill in for the '?' entries
-        */
-       virtual void submit(SQLQuery* callback, const std::string& format, const ParamL& p) = 0;
-
-       /** Submit an asynchronous SQL request.
-        * @param callback The result reporting point
-        * @param format The parameterized query string ('$name' parameters)
-        * @param p Parameters to fill in for the '$name' entries
-        */
-       virtual void submit(SQLQuery* callback, const std::string& format, const ParamM& p) = 0;
-
-       /** Convenience function to prepare a map from a User* */
-       void PopulateUserInfo(User* user, ParamM& userinfo)
-       {
-               userinfo["nick"] = user->nick;
-               userinfo["host"] = user->host;
-               userinfo["ip"] = user->GetIPString();
-               userinfo["gecos"] = user->fullname;
-               userinfo["ident"] = user->ident;
-               userinfo["server"] = user->server;
-               userinfo["uuid"] = user->uuid;
-       }
-};
-
-#endif
diff --git a/src/modules/ssl.h b/src/modules/ssl.h
deleted file mode 100644 (file)
index 9deafb8..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
- *   Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
- *
- * 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
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef SSL_H
-#define SSL_H
-
-#include <map>
-#include <string>
-
-/** ssl_cert is a class which abstracts SSL certificate
- * and key information.
- *
- * Because gnutls and openssl represent key information in
- * wildly different ways, this class allows it to be accessed
- * in a unified manner. These classes are attached to ssl-
- * connected local users using SSLCertExt
- */
-class ssl_cert : public refcountbase
-{
- public:
-       std::string dn;
-       std::string issuer;
-       std::string error;
-       std::string fingerprint;
-       bool trusted, invalid, unknownsigner, revoked;
-
-       ssl_cert() : trusted(false), invalid(true), unknownsigner(true), revoked(false) {}
-
-       /** Get certificate distinguished name
-        * @return Certificate DN
-        */
-       const std::string& GetDN()
-       {
-               return dn;
-       }
-
-       /** Get Certificate issuer
-        * @return Certificate issuer
-        */
-       const std::string& GetIssuer()
-       {
-               return issuer;
-       }
-
-       /** Get error string if an error has occured
-        * @return The error associated with this users certificate,
-        * or an empty string if there is no error.
-        */
-       const std::string& GetError()
-       {
-               return error;
-       }
-
-       /** Get key fingerprint.
-        * @return The key fingerprint as a hex string.
-        */
-       const std::string& GetFingerprint()
-       {
-               return fingerprint;
-       }
-
-       /** Get trust status
-        * @return True if this is a trusted certificate
-        * (the certificate chain validates)
-        */
-       bool IsTrusted()
-       {
-               return trusted;
-       }
-
-       /** Get validity status
-        * @return True if the certificate itself is
-        * correctly formed.
-        */
-       bool IsInvalid()
-       {
-               return invalid;
-       }
-
-       /** Get signer status
-        * @return True if the certificate appears to be
-        * self-signed.
-        */
-       bool IsUnknownSigner()
-       {
-               return unknownsigner;
-       }
-
-       /** Get revokation status.
-        * @return True if the certificate is revoked.
-        * Note that this only works properly for GnuTLS
-        * right now.
-        */
-       bool IsRevoked()
-       {
-               return revoked;
-       }
-
-       bool IsCAVerified()
-       {
-               return trusted && !invalid && !revoked && !unknownsigner && error.empty();
-       }
-
-       std::string GetMetaLine()
-       {
-               std::stringstream value;
-               bool hasError = !error.empty();
-               value << (IsInvalid() ? "v" : "V") << (IsTrusted() ? "T" : "t") << (IsRevoked() ? "R" : "r")
-                       << (IsUnknownSigner() ? "s" : "S") << (hasError ? "E" : "e") << " ";
-               if (hasError)
-                       value << GetError();
-               else
-                       value << GetFingerprint() << " " << GetDN() << " " << GetIssuer();
-               return value.str();
-       }
-};
-
-/** Get certificate from a socket (only useful with an SSL module) */
-struct SocketCertificateRequest : public Request
-{
-       StreamSocket* const sock;
-       ssl_cert* cert;
-
-       SocketCertificateRequest(StreamSocket* ss, Module* Me)
-               : Request(Me, ss->GetIOHook(), "GET_SSL_CERT"), sock(ss), cert(NULL)
-       {
-               Send();
-       }
-
-       std::string GetFingerprint()
-       {
-               if (cert)
-                       return cert->GetFingerprint();
-               return "";
-       }
-};
-
-/** Get certificate from a user (requires m_sslinfo) */
-struct UserCertificateRequest : public Request
-{
-       User* const user;
-       ssl_cert* cert;
-
-       UserCertificateRequest(User* u, Module* Me, Module* info = ServerInstance->Modules->Find("m_sslinfo.so"))
-               : Request(Me, info, "GET_USER_CERT"), user(u), cert(NULL)
-       {
-               Send();
-       }
-
-       std::string GetFingerprint()
-       {
-               if (cert)
-                       return cert->GetFingerprint();
-               return "";
-       }
-};
-
-#endif
index 47cdb9f650e6318a3d7ba819d6a1391c89f623cc..05c3ce2f99f98277ff42fc19f4ee9bea2e08eafb 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef INSPIRCD_CONFIG_H\r
-#define INSPIRCD_CONFIG_H\r
+#pragma once\r
 \r
 #define BRANCH "@MAJOR_VERSION@.@MINOR_VERSION@"\r
 #define VERSION "@FULL_VERSION@"\r
@@ -14,5 +13,3 @@
 \r
 #include "inspircd_win32wrapper.h"\r
 #include "threadengines/threadengine_win32.h"\r
-\r
-#endif
\ No newline at end of file
index 3987083172f5c2ae8c4c729f4498c95e6ed90d3b..2093bf3a8ed09d3c72e69903ac61ed8cf6aa503d 100644 (file)
@@ -16,6 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #include <windows.h>
 #include <exception>
 #include <new>
index ebc49852934409eb55d04c2e4303effa0c6fa201..7a07868f90907fe3f545901731163445e72d9dd1 100644 (file)
@@ -22,6 +22,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #include "inspircd_win32wrapper.h"
 #include "inspircd.h"
 #include "configreader.h"
@@ -203,7 +204,7 @@ DWORD CWin32Exception::GetErrorCode()
 }
 
 #include "../src/modules/m_spanningtree/link.h"
-#include "../src/modules/ssl.h"
+#include "modules/ssl.h"
 template class reference<Link>;
 template class reference<Autoconnect>;
 template class reference<ssl_cert>;
index 75404ef8b29e170fb10230c61ae9621bbd19a97e..9b18715cda57a92ab3a622fa41e89e5473f7dcf6 100644 (file)
  */
 
 
+#pragma once
+
 /* Windows Port
    Wrapper Functions/Definitions
    By Burlex */
-
-#ifndef INSPIRCD_WIN32WRAPPER_H
-#define INSPIRCD_WIN32WRAPPER_H
-
 /*
  * Starting with PSAPI version 2 for Windows 7 and Windows Server 2008 R2, this function is defined as K32GetProcessMemoryInfo in Psapi.h and exported
  * in Kernel32.lib and Kernel32.dll. However, you should always call this function as GetProcessMemoryInfo. To ensure correct resolution of symbols
@@ -200,6 +198,3 @@ private:
        char szErrorString[500];
        DWORD dwErrorCode;
 };
-
-#endif
-
index e4500be131e897448996d6de3f5e492310f537aa..d8177eabcec3e1c8a19809a7bc4a2ed8412d9fb4 100644 (file)
@@ -15,7 +15,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #pragma once
+
 #ifdef _WIN32
 
 /* Hook for win32service.cpp to exit properly with the service specific error code */