Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

modules.h

Go to the documentation of this file.
00001 /*
00002 
00003 
00004 
00005 */
00006 
00007 
00008 #ifndef __PLUGIN_H
00009 #define __PLUGIN_H
00010 
00011 #define DEBUG 10
00012 #define VERBOSE 20
00013 #define DEFAULT 30
00014 #define SPARSE 40
00015 #define NONE 50
00016 
00017 #include "dynamic.h"
00018 #include "base.h"
00019 #include <string>
00020 #include <deque>
00021 
00024 typedef deque<string> file_cache;
00025 
00026 
00027 // This #define allows us to call a method in all
00028 // loaded modules in a readable simple way, e.g.:
00029 // 'FOREACH_MOD OnConnect(user);'
00030 
00031 #define FOREACH_MOD for (int i = 0; i <= MODCOUNT; i++) modules[i]->
00032 
00033 // class Version holds the version information of a Module, returned
00034 // by Module::GetVersion (thanks RD)
00035 
00040 class Version : public classbase
00041 {
00042  public:
00043          const int Major, Minor, Revision, Build;
00044          Version(int major, int minor, int revision, int build);
00045 };
00046 
00047 
00053 class Admin : public classbase
00054 {
00055  public:
00056          const string Name, Email, Nick;
00057          Admin(string name,string email,string nick);
00058 };
00059 
00065 class Module : public classbase
00066 {
00067  public:
00071         Module();
00075         virtual ~Module();
00080         virtual Version GetVersion();
00084         virtual void OnUserConnect(userrec* user);
00088         virtual void OnUserQuit(userrec* user);
00093         virtual void OnUserJoin(userrec* user, chanrec* channel);
00098         virtual void OnUserPart(userrec* user, chanrec* channel);
00099 
00100 
00101         virtual void Module::OnPacketTransmit(char *p);
00102         virtual void Module::OnPacketReceive(char *p);
00103         virtual void OnRehash();
00104         virtual void Module::OnServerRaw(string &raw, bool inbound);
00105 
00106 };
00107 
00108 
00114 class Server : public classbase
00115 {
00116  public:
00120         Server();
00124         virtual ~Server();
00125 
00129         virtual void SendOpers(string s);
00134         virtual void Log(int level, string s);
00139         virtual void Send(int Socket, string s);
00144         virtual void SendServ(int Socket, string s);
00149         virtual void SendFrom(int Socket, userrec* User, string s);
00154         virtual void SendTo(userrec* Source, userrec* Dest, string s);
00161         virtual void SendChannel(userrec* User, chanrec* Channel, string s,bool IncludeSender);
00166         virtual bool CommonChannels(userrec* u1, userrec* u2);
00174         virtual void SendCommon(userrec* User, string text,bool IncludeSender);
00179         virtual void SendWallops(userrec* User, string text);
00180 
00184         virtual bool IsNick(string nick);
00188         virtual userrec* FindNick(string nick);
00192         virtual chanrec* FindChannel(string channel);
00197         virtual string ChanMode(userrec* User, chanrec* Chan);
00200         virtual string GetServerName();
00203         virtual string GetNetworkName();
00209         virtual Admin GetAdmin();
00210          
00211 };
00212 
00219 class ConfigReader : public classbase
00220 {
00221   protected:
00224         string fname;
00225   public:
00230         ConfigReader();                 // default constructor reads ircd.conf
00234         ConfigReader(string filename);  // read a module-specific config
00238         ~ConfigReader();
00243         string ReadValue(string tag, string name, int index);
00250         int Enumerate(string tag);
00254         bool Verify();
00255 };
00256 
00257 
00258 
00264 class FileReader : public classbase
00265 {
00266  file_cache fc;
00267  public:
00272          FileReader();
00278          FileReader(string filename);
00282          ~FileReader();
00288          void LoadFile(string filename);
00293          string GetLine(int x);
00299          int FileSize();
00300 };
00301 
00302 
00309 class ModuleFactory : public classbase
00310 {
00311  public:
00312         ModuleFactory() { }
00313         virtual ~ModuleFactory() { }
00318         virtual Module * CreateModule() = 0;
00319 };
00320 
00321 
00322 typedef DLLFactory<ModuleFactory> ircd_module;
00323 
00324 #endif

Generated on Sun Mar 30 13:27:58 2003 for InspIRCd by doxygen1.3-rc3