The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ModuleServices Class Reference

Dreamnforge-like services support. More...

Inheritance diagram for ModuleServices:

Inheritance graph
[legend]
Collaboration diagram for ModuleServices:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleServices (InspIRCd *Me)
virtual void OnWhois (User *source, User *dest)
 Called whenever a /WHOIS is performed on a local user.
virtual void OnUserPostNick (User *user, const std::string &oldnick)
 Called after any nickchange, local or remote.
virtual int OnUserPreMessage (User *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 (User *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 int OnUserPreJoin (User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
 Called whenever a user is about to join a channel, before any processing is done.
virtual ~ModuleServices ()
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

Channel_rm1
Channel_Rm2
Channel_Mm3
User_rm4
User_Rm5

Detailed Description

Dreamnforge-like services support.

Definition at line 103 of file m_services.cpp.


Constructor & Destructor Documentation

ModuleServices::ModuleServices InspIRCd Me  )  [inline]
 

Definition at line 112 of file m_services.cpp.

References ModeParser::AddMode(), ModuleManager::Attach(), I_OnUserPostNick, I_OnUserPreJoin, I_OnUserPreMessage, I_OnUserPreNotice, I_OnWhois, kludgeme, m1, m2, m3, m4, m5, InspIRCd::Modes, InspIRCd::Modules, and Module::ServerInstance.

virtual ModuleServices::~ModuleServices  )  [inline, virtual]
 

Definition at line 223 of file m_services.cpp.

References ModeParser::DelMode(), kludgeme, m1, m2, m3, m4, m5, InspIRCd::Modes, and Module::ServerInstance.


Member Function Documentation

virtual Version ModuleServices::GetVersion  )  [inline, virtual]
 

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 238 of file m_services.cpp.

References API_VERSION, VF_COMMON, and VF_VENDOR.

virtual void ModuleServices::OnUserPostNick User user,
const std::string oldnick
[inline, virtual]
 

Called after any nickchange, local or remote.

This can be used to track users after nickchanges have been applied. Please note that although you can see remote nickchanges through this function, you should NOT make any changes to the User if the user is a remote user as this may cause a desnyc. check user->server before taking any action (including returning nonzero from the method). Because this method is called after the nickchange is taken place, no return values are possible to indicate forbidding of the nick change. Use OnUserPreNick for this.

Parameters:
user The user changing their nick
oldnick The old nickname of the user before the nickchange

Reimplemented from Module.

Definition at line 144 of file m_services.cpp.

References assign(), User::IsModeSet(), kludgeme, User::nick, InspIRCd::SendMode(), and Module::ServerInstance.

virtual int ModuleServices::OnUserPreJoin User user,
Channel chan,
const char *  cname,
std::string privs,
const std::string keygiven
[inline, virtual]
 

Called whenever a user is about to join a channel, before any processing is done.

Returning a value of 1 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 mimic +b, +k, +l etc. Returning -1 from this function forces the join to be allowed, bypassing restrictions such as banlists, invite, keys etc.

IMPORTANT NOTE!

If the user joins a NEW channel which does not exist yet, OnUserPreJoin will be called BEFORE the channel record is created. This will cause Channel* chan to be NULL. There is very little you can do in form of processing on the actual channel record at this point, however the channel NAME will still be passed in char* cname, so that you could for example implement a channel blacklist or whitelist, etc.

Parameters:
user The user joining the channel
chan If the channel is a new channel, this will be NULL, otherwise it will be a pointer to the channel being joined
cname The channel name being joined. For new channels this is valid where chan is not.
privs A string containing the users privilages when joining the channel. For new channels this will contain "@". You may alter this string to alter the user's modes on the channel.
keygiven The key given to join the channel, or an empty string if none was provided
Returns:
1 To prevent the join, 0 to allow it.

Reimplemented from Module.

Definition at line 201 of file m_services.cpp.

References User::IsModeSet(), Channel::IsModeSet(), Channel::name, User::nick, User::server, Module::ServerInstance, InspIRCd::ULine(), and User::WriteNumeric().

virtual int ModuleServices::OnUserPreMessage User user,
void *  dest,
int  target_type,
std::string text,
char  status,
CUList exempt_list
[inline, virtual]
 

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 User* otherwise you must cast it to a Channel*, this is the details of where the message is destined to be sent.

Parameters:
user The user sending the message
dest The target of the message (Channel* or User*)
target_type The type of target (TYPE_USER or TYPE_CHANNEL)
text Changeable text being sent by the user
status The status being used, e.g. PRIVMSG #chan has status== '@', 0 to send to everyone.
exempt_list A list of users not to send to. For channel messages, this will usually contain just the sender. It will be ignored for private messages.
Returns:
1 to deny the NOTICE, 0 to allow it

Reimplemented from Module.

Definition at line 158 of file m_services.cpp.

References IS_LOCAL, User::IsModeSet(), Channel::IsModeSet(), Channel::name, User::nick, User::server, Module::ServerInstance, TYPE_CHANNEL, TYPE_USER, InspIRCd::ULine(), and User::WriteNumeric().

Referenced by OnUserPreNotice().

virtual int ModuleServices::OnUserPreNotice User user,
void *  dest,
int  target_type,
std::string text,
char  status,
CUList exempt_list
[inline, virtual]
 

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 User* otherwise you must cast it to a Channel*, 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.

Parameters:
user The user sending the message
dest The target of the message (Channel* or User*)
target_type The type of target (TYPE_USER or TYPE_CHANNEL)
text Changeable text being sent by the user
status The status being used, e.g. PRIVMSG #chan has status== '@', 0 to send to everyone.
exempt_list A list of users not to send to. For channel notices, this will usually contain just the sender. It will be ignored for private notices.
Returns:
1 to deny the NOTICE, 0 to allow it

Reimplemented from Module.

Definition at line 196 of file m_services.cpp.

References OnUserPreMessage().

virtual void ModuleServices::OnWhois User source,
User dest
[inline, virtual]
 

Called whenever a /WHOIS is performed on a local user.

The source parameter contains the details of the user who issued the WHOIS command, and the dest parameter contains the information of the user they are whoising.

Parameters:
source The user issuing the WHOIS command
dest The user who is being WHOISed

Reimplemented from Module.

Definition at line 134 of file m_services.cpp.

References User::IsModeSet(), User::nick, InspIRCd::SendWhoisLine(), and Module::ServerInstance.


Member Data Documentation

Channel_r* ModuleServices::m1 [private]
 

Definition at line 106 of file m_services.cpp.

Referenced by ModuleServices(), and ~ModuleServices().

Channel_R* ModuleServices::m2 [private]
 

Definition at line 107 of file m_services.cpp.

Referenced by ModuleServices(), and ~ModuleServices().

Channel_M* ModuleServices::m3 [private]
 

Definition at line 108 of file m_services.cpp.

Referenced by ModuleServices(), and ~ModuleServices().

User_r* ModuleServices::m4 [private]
 

Definition at line 109 of file m_services.cpp.

Referenced by ModuleServices(), and ~ModuleServices().

User_R* ModuleServices::m5 [private]
 

Definition at line 110 of file m_services.cpp.

Referenced by ModuleServices(), and ~ModuleServices().


The documentation for this class was generated from the following file: