|
|||
|
|||
|
Inheritance diagram for Redirect:


Public Member Functions | |
| Redirect (InspIRCd *Instance) | |
| ModePair | ModeSet (userrec *source, userrec *dest, chanrec *channel, const std::string ¶meter) |
| When a remote server needs to bounce a set of modes, it will call this method for every mode in the mode string to determine if the mode is set or not. | |
| bool | CheckTimeStamp (time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec *channel) |
| If your mode needs special action during a server sync to determine which side wins when comparing timestamps, override this function and use it to return true or false. | |
| ModeAction | OnModeChange (userrec *source, userrec *dest, chanrec *channel, std::string ¶meter, bool adding) |
| Called when a mode change for your mode occurs. | |
Definition at line 23 of file m_redirect.cpp.
|
|
Definition at line 26 of file m_redirect.cpp. 00026 : ModeHandler(Instance, 'L', 1, 0, false, MODETYPE_CHANNEL, false) { }
|
|
||||||||||||||||||||||||
|
If your mode needs special action during a server sync to determine which side wins when comparing timestamps, override this function and use it to return true or false. The default implementation just returns true if theirs < ours. This will only be called for non-listmodes with parameters, when adding the mode and where theirs == ours (therefore the default implementation will always return false).
Reimplemented from ModeHandler. Definition at line 36 of file m_redirect.cpp. 00037 { 00038 /* When TS is equal, the alphabetically later one wins */ 00039 return (their_param < our_param); 00040 }
|
|
||||||||||||||||||||
|
When a remote server needs to bounce a set of modes, it will call this method for every mode in the mode string to determine if the mode is set or not.
Reimplemented from ModeHandler. Definition at line 28 of file m_redirect.cpp. References chanrec::GetModeParameter(), and chanrec::IsModeSet(). 00029 { 00030 if (channel->IsModeSet('L')) 00031 return std::make_pair(true, channel->GetModeParameter('L')); 00032 else 00033 return std::make_pair(false, parameter); 00034 }
|
|
||||||||||||||||||||||||
|
Called when a mode change for your mode occurs.
Reimplemented from ModeHandler. Definition at line 42 of file m_redirect.cpp. References InspIRCd::chanlist, InspIRCd::FindChan(), IS_LOCAL, InspIRCd::IsChannel(), chanrec::IsModeSet(), MODEACTION_ALLOW, MODEACTION_DENY, chanrec::name, userrec::nick, ModeHandler::ServerInstance, chanrec::SetMode(), chanrec::SetModeParam(), and userrec::WriteServ(). 00043 { 00044 if (adding) 00045 { 00046 chanrec* c = NULL; 00047 00048 if (!ServerInstance->IsChannel(parameter.c_str())) 00049 { 00050 source->WriteServ("403 %s %s :Invalid channel name",source->nick, parameter.c_str()); 00051 parameter.clear(); 00052 return MODEACTION_DENY; 00053 } 00054 00055 c = ServerInstance->FindChan(parameter); 00056 if (c) 00057 { 00058 /* Fix by brain: Dont let a channel be linked to *itself* either */ 00059 if (IS_LOCAL(source)) 00060 { 00061 if ((c == channel) || (c->IsModeSet('L'))) 00062 { 00063 source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Channel already has +L). Pack of wild dogs has been unleashed.",source->nick,parameter.c_str()); 00064 parameter.clear(); 00065 return MODEACTION_DENY; 00066 } 00067 else 00068 { 00069 for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); i++) 00070 { 00071 if ((i->second != channel) && (i->second->IsModeSet('L')) && (irc::string(i->second->GetModeParameter('L').c_str()) == irc::string(channel->name))) 00072 { 00073 source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick,parameter.c_str(),i->second->name); 00074 return MODEACTION_DENY; 00075 } 00076 } 00077 } 00078 } 00079 } 00080 00081 channel->SetMode('L', true); 00082 channel->SetModeParam('L', parameter.c_str(), true); 00083 return MODEACTION_ALLOW; 00084 } 00085 else 00086 { 00087 if (channel->IsModeSet('L')) 00088 { 00089 channel->SetMode('L', false); 00090 return MODEACTION_ALLOW; 00091 } 00092 } 00093 00094 return MODEACTION_DENY; 00095 00096 }
|