|
|||
|
|||
|


Public Member Functions | |
| ModuleBlockColour (InspIRCd *Me) | |
| void | Implements (char *List) |
| The Implements function specifies which methods a module should receive events for. | |
| virtual int | OnUserPreMessage (userrec *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list) |
| Called whenever a user is about to PRIVMSG A user or a channel, before any processing is done. | |
| virtual int | OnUserPreNotice (userrec *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list) |
| Called whenever a user is about to NOTICE A user or a channel, before any processing is done. | |
| virtual | ~ModuleBlockColour () |
| virtual Version | GetVersion () |
| Returns the version number of a Module. | |
Private Attributes | |
| bool | AllowChanOps |
| BlockColor * | bc |
Definition at line 51 of file m_blockcolor.cpp.
|
|
Definition at line 57 of file m_blockcolor.cpp. References InspIRCd::AddMode(), bc, and Module::ServerInstance. 00057 : Module(Me) 00058 { 00059 bc = new BlockColor(ServerInstance); 00060 if (!ServerInstance->AddMode(bc, 'c')) 00061 throw ModuleException("Could not add new modes!"); 00062 }
|
|
|
Definition at line 106 of file m_blockcolor.cpp. References bc, DELETE(), ModeParser::DelMode(), InspIRCd::Modes, and Module::ServerInstance.
|
|
|
Returns the version number of a Module. The method should return a Version object with its version information assigned via Version::Version Reimplemented from Module. Definition at line 112 of file m_blockcolor.cpp. References API_VERSION, VF_COMMON, and VF_VENDOR. 00113 { 00114 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION); 00115 }
|
|
|
The Implements function specifies which methods a module should receive events for. The char* parameter passed to this function contains a set of true or false values (1 or 0) which indicate wether each function is implemented. You must use the Iimplementation enum (documented elsewhere on this page) to mark functions as active. For example, to receive events for OnUserJoin(): Implements[I_OnUserJoin] = 1;
Reimplemented from Module. Definition at line 64 of file m_blockcolor.cpp. References I_OnUserPreMessage, and I_OnUserPreNotice. 00065 { 00066 List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1; 00067 }
|
|
||||||||||||||||||||||||||||
|
Called whenever a user is about to PRIVMSG A user or a channel, before any processing is done. Returning any nonzero value from this function stops the process immediately, causing no output to be sent to the user by the core. If you do this you must produce your own numerics, notices etc. This is useful for modules which may want to filter or redirect messages. target_type can be one of TYPE_USER or TYPE_CHANNEL. If the target_type value is a user, you must cast dest to a userrec* otherwise you must cast it to a chanrec*, this is the details of where the message is destined to be sent.
Reimplemented from Module. Definition at line 70 of file m_blockcolor.cpp. References CHANOPS_EXEMPT, chanrec::GetStatus(), IS_LOCAL, chanrec::IsModeSet(), chanrec::name, userrec::nick, Module::ServerInstance, STATUS_OP, TYPE_CHANNEL, and userrec::WriteServ(). Referenced by OnUserPreNotice(). 00071 { 00072 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user))) 00073 { 00074 chanrec* c = (chanrec*)dest; 00075 00076 if(c->IsModeSet('c')) 00077 { 00078 if (!CHANOPS_EXEMPT(ServerInstance, 'c') || CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) != STATUS_OP) 00079 { 00080 for (std::string::iterator i = text.begin(); i != text.end(); i++) 00081 { 00082 switch (*i) 00083 { 00084 case 2: 00085 case 3: 00086 case 15: 00087 case 21: 00088 case 22: 00089 case 31: 00090 user->WriteServ("404 %s %s :Can't send colours to channel (+c set)",user->nick, c->name); 00091 return 1; 00092 break; 00093 } 00094 } 00095 } 00096 } 00097 } 00098 return 0; 00099 }
|
|
||||||||||||||||||||||||||||
|
Called whenever a user is about to NOTICE A user or a channel, before any processing is done. Returning any nonzero value from this function stops the process immediately, causing no output to be sent to the user by the core. If you do this you must produce your own numerics, notices etc. This is useful for modules which may want to filter or redirect messages. target_type can be one of TYPE_USER or TYPE_CHANNEL. If the target_type value is a user, you must cast dest to a userrec* otherwise you must cast it to a chanrec*, this is the details of where the message is destined to be sent. You may alter the message text as you wish before relinquishing control to the next module in the chain, and if no other modules block the text this altered form of the text will be sent out to the user and possibly to other servers.
Reimplemented from Module. Definition at line 101 of file m_blockcolor.cpp. References OnUserPreMessage(). |