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 $Log$
00003 Revision 1.3  2003/01/26 23:52:48  brain
00003 Modified documentation for base classes
00003 
00004 Revision 1.1.1.1  2003/01/23 19:45:58  brain
00005 InspIRCd second source tree
00006 
00007 Revision 1.12  2003/01/22 20:59:10  brain
00008 Added FileReader class documentation
00009 
00010 Revision 1.11  2003/01/22 20:49:16  brain
00011 Added FileReader file-caching class
00012 Changed m_randquote to use FileReader class
00013 
00014 Revision 1.10  2003/01/22 00:57:27  brain
00015 Changes to documentation
00016 
00017 Revision 1.9  2003/01/22 00:44:26  brain
00018 Added documentation comments
00019 
00020 Revision 1.8  2003/01/21 20:31:24  brain
00021 Modified to add documentation
00022 Added ConfigReader class for modules
00023 
00024 Revision 1.7  2003/01/15 22:47:44  brain
00025 Changed user and channel structs to classes (finally)
00026 
00027 Revision 1.6  2003/01/13 22:30:50  brain
00028 Added Admin class (holds /admin info for modules)
00029 Added methods to Server class
00030 
00031 
00032 */
00033 
00034 
00035 #ifndef __PLUGIN_H
00036 #define __PLUGIN_H
00037 
00038 #include "dynamic.h"
00039 #include "base.h"
00040 #include <string>
00041 #include <deque>
00042 
00045 typedef deque<string> file_cache;
00046 
00047 
00048 // This #define allows us to call a method in all
00049 // loaded modules in a readable simple way, e.g.:
00050 // 'FOREACH_MOD OnConnect(user);'
00051 
00052 #define FOREACH_MOD for (int i = 0; i <= MODCOUNT; i++) modules[i]->
00053 
00054 // class Version holds the version information of a Module, returned
00055 // by Module::GetVersion (thanks RD)
00056 
00061 class Version : public classbase
00062 {
00063  public:
00064          const int Major, Minor, Revision, Build;
00065          Version(int major, int minor, int revision, int build);
00066 };
00067 
00068 
00074 class Admin : public classbase
00075 {
00076  public:
00077          const string Name, Email, Nick;
00078          Admin(string name,string email,string nick);
00079 };
00080 
00086 class Module : public classbase
00087 {
00088  public:
00092         Module();
00096         virtual ~Module();
00101         virtual Version GetVersion();
00105         virtual void OnUserConnect(userrec* user);
00109         virtual void OnUserQuit(userrec* user);
00114         virtual void OnUserJoin(userrec* user, chanrec* channel);
00119         virtual void OnUserPart(userrec* user, chanrec* channel);
00120 };
00121 
00122 
00128 class Server : public classbase
00129 {
00130  public:
00134         Server();
00138         virtual ~Server();
00139 
00143         virtual void SendOpers(string s);
00148         virtual void Debug(string s);
00153         virtual void Send(int Socket, string s);
00158         virtual void SendServ(int Socket, string s);
00163         virtual void SendFrom(int Socket, userrec* User, string s);
00168         virtual void SendTo(userrec* Source, userrec* Dest, string s);
00175         virtual void SendChannel(userrec* User, chanrec* Channel, string s,bool IncludeSender);
00180         virtual bool CommonChannels(userrec* u1, userrec* u2);
00188         virtual void SendCommon(userrec* User, string text,bool IncludeSender);
00193         virtual void SendWallops(userrec* User, string text);
00194 
00198         virtual bool IsNick(string nick);
00202         virtual userrec* FindNick(string nick);
00206         virtual chanrec* FindChannel(string channel);
00211         virtual string ChanMode(userrec* User, chanrec* Chan);
00214         virtual string GetServerName();
00217         virtual string GetNetworkName();
00223         virtual Admin GetAdmin();
00224          
00225 };
00226 
00233 class ConfigReader : public classbase
00234 {
00235   protected:
00238         string fname;
00239   public:
00244         ConfigReader();                 // default constructor reads ircd.conf
00248         ConfigReader(string filename);  // read a module-specific config
00252         ~ConfigReader();
00257         string ReadValue(string tag, string name, int index);
00264         int Enumerate(string tag);
00268         bool Verify();
00269 };
00270 
00271 
00272 
00278 class FileReader : public classbase
00279 {
00280  file_cache fc;
00281  public:
00286          FileReader();
00292          FileReader(string filename);
00296          ~FileReader();
00302          void LoadFile(string filename);
00307          string GetLine(int x);
00313          int FileSize();
00314 };
00315 
00316 
00323 class ModuleFactory : public classbase
00324 {
00325  public:
00326         ModuleFactory() { }
00327         virtual ~ModuleFactory() { }
00332         virtual Module * CreateModule() = 0;
00333 };
00334 
00335 #endif

Generated on Sun Jan 26 23:45:47 2003 for InspIRCd by doxygen1.3-rc2