From 2db0df5813e46fe5e077e014003acbd10698b913 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 20 Apr 2005 15:48:27 +0000 Subject: Added module message passing architecture git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1136 e03df62e-2008-0410-955e-edbf42e46eb7 --- docs/module-doc/modules_8h-source.html | 556 ++++++++++++++++++--------------- 1 file changed, 302 insertions(+), 254 deletions(-) (limited to 'docs/module-doc/modules_8h-source.html') diff --git a/docs/module-doc/modules_8h-source.html b/docs/module-doc/modules_8h-source.html index 2eeba8d6d..e76cb5143 100644 --- a/docs/module-doc/modules_8h-source.html +++ b/docs/module-doc/modules_8h-source.html @@ -121,264 +121,312 @@ 00127 Admin(std::string name, std::string email, std::string nick); 00128 }; 00129 -00135 class Module : public classbase -00136 { -00137 public: -00138 -00142 Module(); -00143 -00147 virtual ~Module(); -00148 -00153 virtual Version GetVersion(); -00154 -00158 virtual void OnUserConnect(userrec* user); -00159 -00163 virtual void OnUserQuit(userrec* user); -00164 -00169 virtual void OnUserJoin(userrec* user, chanrec* channel); -00170 -00175 virtual void OnUserPart(userrec* user, chanrec* channel); -00176 -00182 virtual void OnPacketTransmit(std::string &data, std::string serv); -00183 -00190 virtual void OnPacketReceive(std::string &data, std::string serv); -00191 -00197 virtual void OnRehash(); -00198 -00207 virtual void OnServerRaw(std::string &raw, bool inbound, userrec* user); -00208 -00218 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params); -00219 -00233 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname); -00234 -00240 virtual int OnUserPreKick(userrec* source, userrec* user, chanrec* chan, std::string reason); +00130 +00131 // Forward-delacare module for ModuleMessage etc +00132 class Module; +00133 +00138 class ModuleMessage : public classbase +00139 { +00140 public: +00143 virtual char* Send() = 0; +00144 }; +00145 +00151 class Request : public ModuleMessage +00152 { +00153 protected: +00156 char* data; +00160 Module* source; +00163 Module* dest; +00164 public: +00167 Request(char* anydata, Module* src, Module* dst); +00170 char* GetData(); +00173 Module* GetSource(); +00176 Module* GetDest(); +00182 char* Send(); +00183 }; +00184 +00185 +00191 class Event : public ModuleMessage +00192 { +00193 protected: +00196 char* data; +00200 Module* source; +00205 std::string id; +00206 public: +00209 Event(char* anydata, Module* src, std::string eventid); +00212 char* GetData(); +00215 Module* GetSource(); +00219 std::string GetEventID(); +00224 char* Send(); +00225 }; +00226 +00227 +00233 class Module : public classbase +00234 { +00235 public: +00236 +00240 Module(); 00241 -00246 virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, std::string reason); -00247 -00252 virtual void OnOper(userrec* user); -00253 -00262 virtual void OnInfo(userrec* user); -00263 -00268 virtual void OnWhois(userrec* source, userrec* dest); -00269 -00275 virtual int OnUserPreInvite(userrec* source,userrec* dest,chanrec* channel); -00276 -00285 virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text); -00286 -00298 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text); -00299 -00307 virtual int OnUserPreNick(userrec* user, std::string newnick); -00308 -00316 virtual void OnUserPostNick(userrec* user, std::string oldnick); -00317 -00339 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type); -00340 -00346 virtual string_list OnUserSync(userrec* user); -00347 -00353 virtual string_list OnChannelSync(chanrec* chan); +00245 virtual ~Module(); +00246 +00251 virtual Version GetVersion(); +00252 +00256 virtual void OnUserConnect(userrec* user); +00257 +00263 virtual void OnUserQuit(userrec* user); +00264 +00270 virtual void OnUserDisconnect(userrec* user); +00271 +00276 virtual void OnUserJoin(userrec* user, chanrec* channel); +00277 +00282 virtual void OnUserPart(userrec* user, chanrec* channel); +00283 +00289 virtual void OnPacketTransmit(std::string &data, std::string serv); +00290 +00297 virtual void OnPacketReceive(std::string &data, std::string serv); +00298 +00304 virtual void OnRehash(); +00305 +00314 virtual void OnServerRaw(std::string &raw, bool inbound, userrec* user); +00315 +00325 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params); +00326 +00340 virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname); +00341 +00347 virtual int OnUserPreKick(userrec* source, userrec* user, chanrec* chan, std::string reason); +00348 +00353 virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, std::string reason); 00354 -00358 virtual void On005Numeric(std::string &output); -00359 -00369 virtual int OnKill(userrec* source, userrec* dest, std::string reason); -00370 -00381 virtual void OnLoadModule(Module* mod,std::string name); -00382 -00388 virtual void OnBackgroundTimer(time_t curtime); -00389 -00397 virtual void OnSendList(userrec* user, chanrec* channel, char mode); -00398 -00409 virtual int OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user); -00410 -00419 virtual bool OnCheckReady(userrec* user); -00420 -00428 virtual void OnUserRegister(userrec* user); -00429 -00435 virtual int OnRawMode(userrec* user, chanrec* chan, char mode, std::string param, bool adding, int pcnt); -00436 -00442 virtual int OnCheckInvite(userrec* user, chanrec* chan); -00443 -00450 virtual int OnCheckKey(userrec* user, chanrec* chan, std::string keygiven); -00451 -00457 virtual int OnCheckLimit(userrec* user, chanrec* chan); -00458 -00464 virtual int OnCheckBan(userrec* user, chanrec* chan); -00465 -00469 virtual void OnStats(char symbol); -00470 -00474 virtual int OnChangeLocalUserHost(userrec* user, std::string newhost); -00475 -00479 virtual int OnChangeLocalUserGECOS(userrec* user, std::string newhost); -00480 -00484 virtual int OnLocalTopicChange(userrec* user, chanrec* chan, std::string topic); -00485 -00496 virtual int OnMeshToken(char token,string_list params,serverrec* source,serverrec* reply, std::string tcp_host,std::string ipaddr,int port); -00497 }; -00498 -00499 -00505 class Server : public classbase -00506 { -00507 public: -00511 Server(); -00515 virtual ~Server(); -00516 -00520 virtual void SendOpers(std::string s); -00525 virtual void Log(int level, std::string s); -00530 virtual void Send(int Socket, std::string s); -00535 virtual void SendServ(int Socket, std::string s); -00540 virtual void SendFrom(int Socket, userrec* User, std::string s); -00555 virtual void SendTo(userrec* Source, userrec* Dest, std::string s); -00562 virtual void SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender); -00567 virtual bool CommonChannels(userrec* u1, userrec* u2); -00575 virtual void SendCommon(userrec* User, std::string text,bool IncludeSender); -00580 virtual void SendWallops(userrec* User, std::string text); -00581 -00585 virtual bool IsNick(std::string nick); -00589 virtual int CountUsers(chanrec* c); -00593 virtual userrec* FindNick(std::string nick); -00597 virtual chanrec* FindChannel(std::string channel); -00602 virtual std::string ChanMode(userrec* User, chanrec* Chan); -00606 virtual bool IsOnChannel(userrec* User, chanrec* Chan); -00609 virtual std::string GetServerName(); -00612 virtual std::string GetNetworkName(); -00618 virtual Admin GetAdmin(); -00637 virtual bool AddExtendedMode(char modechar, int type, bool requires_oper, int params_when_on, int params_when_off); +00359 virtual void OnOper(userrec* user); +00360 +00369 virtual void OnInfo(userrec* user); +00370 +00375 virtual void OnWhois(userrec* source, userrec* dest); +00376 +00382 virtual int OnUserPreInvite(userrec* source,userrec* dest,chanrec* channel); +00383 +00392 virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text); +00393 +00405 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text); +00406 +00414 virtual int OnUserPreNick(userrec* user, std::string newnick); +00415 +00423 virtual void OnUserPostNick(userrec* user, std::string oldnick); +00424 +00446 virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type); +00447 +00453 virtual string_list OnUserSync(userrec* user); +00454 +00460 virtual string_list OnChannelSync(chanrec* chan); +00461 +00465 virtual void On005Numeric(std::string &output); +00466 +00476 virtual int OnKill(userrec* source, userrec* dest, std::string reason); +00477 +00488 virtual void OnLoadModule(Module* mod,std::string name); +00489 +00495 virtual void OnBackgroundTimer(time_t curtime); +00496 +00504 virtual void OnSendList(userrec* user, chanrec* channel, char mode); +00505 +00516 virtual int OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user); +00517 +00526 virtual bool OnCheckReady(userrec* user); +00527 +00535 virtual void OnUserRegister(userrec* user); +00536 +00542 virtual int OnRawMode(userrec* user, chanrec* chan, char mode, std::string param, bool adding, int pcnt); +00543 +00549 virtual int OnCheckInvite(userrec* user, chanrec* chan); +00550 +00557 virtual int OnCheckKey(userrec* user, chanrec* chan, std::string keygiven); +00558 +00564 virtual int OnCheckLimit(userrec* user, chanrec* chan); +00565 +00571 virtual int OnCheckBan(userrec* user, chanrec* chan); +00572 +00576 virtual void OnStats(char symbol); +00577 +00581 virtual int OnChangeLocalUserHost(userrec* user, std::string newhost); +00582 +00586 virtual int OnChangeLocalUserGECOS(userrec* user, std::string newhost); +00587 +00591 virtual int OnLocalTopicChange(userrec* user, chanrec* chan, std::string topic); +00592 +00603 virtual int OnMeshToken(char token,string_list params,serverrec* source,serverrec* reply, std::string tcp_host,std::string ipaddr,int port); +00604 +00610 virtual void OnEvent(Event* event); +00611 +00618 virtual char* OnRequest(Request* request); +00619 }; +00620 +00621 +00627 class Server : public classbase +00628 { +00629 public: +00633 Server(); +00637 virtual ~Server(); 00638 -00660 virtual bool AddExtendedListMode(char modechar); -00661 -00679 virtual void AddCommand(char* cmd, handlerfunc f, char flags, int minparams, char* source); -00680 -00702 virtual void SendMode(char **parameters, int pcnt, userrec *user); -00703 -00716 virtual void SendToModeMask(std::string modes, int flags, std::string text); -00717 -00723 virtual chanrec* JoinUserToChannel(userrec* user, std::string cname, std::string key); -00724 -00730 virtual chanrec* PartUserFromChannel(userrec* user, std::string cname, std::string reason); -00731 -00737 virtual void ChangeUserNick(userrec* user, std::string nickname); -00738 -00749 virtual void QuitUser(userrec* user, std::string reason); -00750 -00755 virtual bool MatchText(std::string sliteral, std::string spattern); -00756 -00768 virtual void CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user); -00769 -00775 virtual void ChangeHost(userrec* user, std::string host); -00776 -00782 virtual void ChangeGECOS(userrec* user, std::string gecos); -00783 -00792 virtual bool IsUlined(std::string server); -00793 -00797 virtual chanuserlist GetUsers(chanrec* chan); -00798 -00805 virtual bool UserToPseudo(userrec* user,std::string message); -00806 -00813 virtual bool PseudoToUser(userrec* alive,userrec* zombie,std::string message); -00814 -00822 virtual void AddGLine(long duration, std::string source, std::string reason, std::string hostmask); -00823 -00831 virtual void AddQLine(long duration, std::string source, std::string reason, std::string nickname); -00832 -00840 virtual void AddZLine(long duration, std::string source, std::string reason, std::string ipaddr); -00841 -00849 virtual void AddKLine(long duration, std::string source, std::string reason, std::string hostmask); -00850 -00858 virtual void AddELine(long duration, std::string source, std::string reason, std::string hostmask); -00859 -00862 virtual bool DelGLine(std::string hostmask); -00863 -00866 virtual bool DelQLine(std::string nickname); -00867 -00870 virtual bool DelZLine(std::string ipaddr); -00871 -00874 virtual bool DelKLine(std::string hostmask); -00875 -00878 virtual bool DelELine(std::string hostmask); -00879 -00885 virtual long CalcDuration(std::string duration); -00886 -00889 virtual bool IsValidMask(std::string mask); -00890 -00895 virtual void MeshSendAll(std::string text); -00896 -00903 virtual void MeshSendCommon(userrec* user, std::string text); -00904 -00907 virtual void MeshSendAllAlive(std::string text); -00908 -00912 virtual void MeshSendUnicast(std::string destination, std::string text); -00913 -00918 virtual void MeshSendAllExcept(std::string target, std::string text); -00919 -00923 virtual bool MeshCheckChan(chanrec *c,std::string servername); -00924 -00928 virtual bool MeshCheckCommon(userrec* u,std::string servername); -00929 }; -00930 -00931 -00932 #define CONF_NOT_A_NUMBER 0x000010 -00933 #define CONF_NOT_UNSIGNED 0x000080 -00934 #define CONF_VALUE_NOT_FOUND 0x000100 -00935 #define CONF_FILE_NOT_FOUND 0x000200 -00936 -00937 -00944 class ConfigReader : public classbase -00945 { -00946 protected: -00952 std::stringstream *cache; -00953 std::stringstream *errorlog; -00956 bool readerror; -00957 long error; -00958 -00959 public: -00964 ConfigReader(); // default constructor reads ircd.conf -00968 ConfigReader(std::string filename); // read a module-specific config -00972 ~ConfigReader(); -00977 std::string ReadValue(std::string tag, std::string name, int index); -00983 bool ReadFlag(std::string tag, std::string name, int index); -00992 long ReadInteger(std::string tag, std::string name, int index, bool needs_unsigned); -00997 long GetError(); -01004 int Enumerate(std::string tag); -01009 bool Verify(); -01016 void DumpErrors(bool bail,userrec* user); -01017 -01023 int EnumerateValues(std::string tag, int index); -01024 }; -01025 +00642 virtual void SendOpers(std::string s); +00647 virtual void Log(int level, std::string s); +00652 virtual void Send(int Socket, std::string s); +00657 virtual void SendServ(int Socket, std::string s); +00662 virtual void SendFrom(int Socket, userrec* User, std::string s); +00677 virtual void SendTo(userrec* Source, userrec* Dest, std::string s); +00684 virtual void SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender); +00689 virtual bool CommonChannels(userrec* u1, userrec* u2); +00697 virtual void SendCommon(userrec* User, std::string text,bool IncludeSender); +00702 virtual void SendWallops(userrec* User, std::string text); +00703 +00707 virtual bool IsNick(std::string nick); +00711 virtual int CountUsers(chanrec* c); +00715 virtual userrec* FindNick(std::string nick); +00719 virtual chanrec* FindChannel(std::string channel); +00724 virtual std::string ChanMode(userrec* User, chanrec* Chan); +00728 virtual bool IsOnChannel(userrec* User, chanrec* Chan); +00731 virtual std::string GetServerName(); +00734 virtual std::string GetNetworkName(); +00740 virtual Admin GetAdmin(); +00759 virtual bool AddExtendedMode(char modechar, int type, bool requires_oper, int params_when_on, int params_when_off); +00760 +00782 virtual bool AddExtendedListMode(char modechar); +00783 +00801 virtual void AddCommand(char* cmd, handlerfunc f, char flags, int minparams, char* source); +00802 +00824 virtual void SendMode(char **parameters, int pcnt, userrec *user); +00825 +00838 virtual void SendToModeMask(std::string modes, int flags, std::string text); +00839 +00845 virtual chanrec* JoinUserToChannel(userrec* user, std::string cname, std::string key); +00846 +00852 virtual chanrec* PartUserFromChannel(userrec* user, std::string cname, std::string reason); +00853 +00859 virtual void ChangeUserNick(userrec* user, std::string nickname); +00860 +00871 virtual void QuitUser(userrec* user, std::string reason); +00872 +00877 virtual bool MatchText(std::string sliteral, std::string spattern); +00878 +00890 virtual void CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user); +00891 +00897 virtual void ChangeHost(userrec* user, std::string host); +00898 +00904 virtual void ChangeGECOS(userrec* user, std::string gecos); +00905 +00914 virtual bool IsUlined(std::string server); +00915 +00919 virtual chanuserlist GetUsers(chanrec* chan); +00920 +00927 virtual bool UserToPseudo(userrec* user,std::string message); +00928 +00935 virtual bool PseudoToUser(userrec* alive,userrec* zombie,std::string message); +00936 +00944 virtual void AddGLine(long duration, std::string source, std::string reason, std::string hostmask); +00945 +00953 virtual void AddQLine(long duration, std::string source, std::string reason, std::string nickname); +00954 +00962 virtual void AddZLine(long duration, std::string source, std::string reason, std::string ipaddr); +00963 +00971 virtual void AddKLine(long duration, std::string source, std::string reason, std::string hostmask); +00972 +00980 virtual void AddELine(long duration, std::string source, std::string reason, std::string hostmask); +00981 +00984 virtual bool DelGLine(std::string hostmask); +00985 +00988 virtual bool DelQLine(std::string nickname); +00989 +00992 virtual bool DelZLine(std::string ipaddr); +00993 +00996 virtual bool DelKLine(std::string hostmask); +00997 +01000 virtual bool DelELine(std::string hostmask); +01001 +01007 virtual long CalcDuration(std::string duration); +01008 +01011 virtual bool IsValidMask(std::string mask); +01012 +01017 virtual void MeshSendAll(std::string text); +01018 +01025 virtual void MeshSendCommon(userrec* user, std::string text); 01026 -01027 -01033 class FileReader : public classbase -01034 { -01035 file_cache fc; -01036 public: -01041 FileReader(); -01042 -01048 FileReader(std::string filename); -01049 -01053 ~FileReader(); -01054 -01060 void LoadFile(std::string filename); -01061 -01065 bool Exists(); -01066 -01071 std::string GetLine(int x); -01072 -01078 int FileSize(); -01079 }; -01080 -01081 -01088 class ModuleFactory : public classbase -01089 { -01090 public: -01091 ModuleFactory() { } -01092 virtual ~ModuleFactory() { } -01097 virtual Module * CreateModule() = 0; -01098 }; -01099 -01100 -01101 typedef DLLFactory<ModuleFactory> ircd_module; -01102 -01103 #endif -
Generated on Sat Apr 16 18:57:13 2005 for InspIRCd by +01029 virtual void MeshSendAllAlive(std::string text); +01030 +01034 virtual void MeshSendUnicast(std::string destination, std::string text); +01035 +01040 virtual void MeshSendAllExcept(std::string target, std::string text); +01041 +01045 virtual bool MeshCheckChan(chanrec *c,std::string servername); +01046 +01050 virtual bool MeshCheckCommon(userrec* u,std::string servername); +01051 +01056 virtual Module* FindModule(std::string name); +01057 }; +01058 +01059 +01060 #define CONF_NOT_A_NUMBER 0x000010 +01061 #define CONF_NOT_UNSIGNED 0x000080 +01062 #define CONF_VALUE_NOT_FOUND 0x000100 +01063 #define CONF_FILE_NOT_FOUND 0x000200 +01064 +01065 +01072 class ConfigReader : public classbase +01073 { +01074 protected: +01080 std::stringstream *cache; +01081 std::stringstream *errorlog; +01084 bool readerror; +01085 long error; +01086 +01087 public: +01092 ConfigReader(); // default constructor reads ircd.conf +01096 ConfigReader(std::string filename); // read a module-specific config +01100 ~ConfigReader(); +01105 std::string ReadValue(std::string tag, std::string name, int index); +01111 bool ReadFlag(std::string tag, std::string name, int index); +01120 long ReadInteger(std::string tag, std::string name, int index, bool needs_unsigned); +01125 long GetError(); +01132 int Enumerate(std::string tag); +01137 bool Verify(); +01144 void DumpErrors(bool bail,userrec* user); +01145 +01151 int EnumerateValues(std::string tag, int index); +01152 }; +01153 +01154 +01155 +01161 class FileReader : public classbase +01162 { +01163 file_cache fc; +01164 public: +01169 FileReader(); +01170 +01176 FileReader(std::string filename); +01177 +01181 ~FileReader(); +01182 +01188 void LoadFile(std::string filename); +01189 +01193 bool Exists(); +01194 +01199 std::string GetLine(int x); +01200 +01206 int FileSize(); +01207 }; +01208 +01209 +01216 class ModuleFactory : public classbase +01217 { +01218 public: +01219 ModuleFactory() { } +01220 virtual ~ModuleFactory() { } +01225 virtual Module * CreateModule() = 0; +01226 }; +01227 +01228 +01229 typedef DLLFactory<ModuleFactory> ircd_module; +01230 +01231 #endif +
Generated on Wed Apr 20 15:46:56 2005 for InspIRCd by doxygen 1.3.3
-- cgit v1.2.3