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:
00068 
00072         Module();
00073 
00077         virtual ~Module();
00078 
00083         virtual Version GetVersion();
00084 
00088         virtual void OnUserConnect(userrec* user);
00089 
00093         virtual void OnUserQuit(userrec* user);
00094 
00099         virtual void OnUserJoin(userrec* user, chanrec* channel);
00100 
00105         virtual void OnUserPart(userrec* user, chanrec* channel);
00106 
00113         virtual void Module::OnPacketTransmit(char *p);
00114 
00122         virtual void Module::OnPacketReceive(char *p);
00123 
00129         virtual void OnRehash();
00130 
00137         virtual void Module::OnServerRaw(string &raw, bool inbound);
00138 
00139 };
00140 
00141 
00147 class Server : public classbase
00148 {
00149  public:
00153         Server();
00157         virtual ~Server();
00158 
00162         virtual void SendOpers(string s);
00167         virtual void Log(int level, string s);
00172         virtual void Send(int Socket, string s);
00177         virtual void SendServ(int Socket, string s);
00182         virtual void SendFrom(int Socket, userrec* User, string s);
00187         virtual void SendTo(userrec* Source, userrec* Dest, string s);
00194         virtual void SendChannel(userrec* User, chanrec* Channel, string s,bool IncludeSender);
00199         virtual bool CommonChannels(userrec* u1, userrec* u2);
00207         virtual void SendCommon(userrec* User, string text,bool IncludeSender);
00212         virtual void SendWallops(userrec* User, string text);
00213 
00217         virtual bool IsNick(string nick);
00221         virtual userrec* FindNick(string nick);
00225         virtual chanrec* FindChannel(string channel);
00230         virtual string ChanMode(userrec* User, chanrec* Chan);
00233         virtual string GetServerName();
00236         virtual string GetNetworkName();
00242         virtual Admin GetAdmin();
00243          
00244 };
00245 
00252 class ConfigReader : public classbase
00253 {
00254   protected:
00257         string fname;
00258   public:
00263         ConfigReader();                 // default constructor reads ircd.conf
00267         ConfigReader(string filename);  // read a module-specific config
00271         ~ConfigReader();
00276         string ReadValue(string tag, string name, int index);
00283         int Enumerate(string tag);
00287         bool Verify();
00288 };
00289 
00290 
00291 
00297 class FileReader : public classbase
00298 {
00299  file_cache fc;
00300  public:
00305          FileReader();
00311          FileReader(string filename);
00315          ~FileReader();
00321          void LoadFile(string filename);
00326          string GetLine(int x);
00332          int FileSize();
00333 };
00334 
00335 
00342 class ModuleFactory : public classbase
00343 {
00344  public:
00345         ModuleFactory() { }
00346         virtual ~ModuleFactory() { }
00351         virtual Module * CreateModule() = 0;
00352 };
00353 
00354 
00355 typedef DLLFactory<ModuleFactory> ircd_module;
00356 
00357 #endif

Generated on Sun Mar 30 19:34:54 2003 for InspIRCd by doxygen1.3-rc3