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

ModuleServicesAccount Class Reference

Inheritance diagram for ModuleServicesAccount:

Inheritance graph
[legend]
Collaboration diagram for ModuleServicesAccount:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleServicesAccount (InspIRCd *Me)
virtual void On005Numeric (std::string &t)
 Called when a 005 numeric is about to be output.
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 void OnSyncUserMetaData (User *user, Module *proto, void *opaque, const std::string &extname, bool displayable)
virtual void OnUserQuit (User *user, const std::string &message, const std::string &oper_message)
 Called when a user quits.
virtual void OnCleanup (int target_type, void *item)
 Called before your module is unloaded to clean up Extensibles.
virtual void OnDecodeMetaData (int target_type, void *target, const std::string &extname, const std::string &extdata)
 Allows module data, sent via ProtoSendMetaData, to be decoded again by a receiving module.
virtual ~ModuleServicesAccount ()
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

AChannel_Rm1
AChannel_Mm2
AUser_Rm3
Channel_rm4
User_rm5

Detailed Description

Definition at line 100 of file m_services_account.cpp.


Constructor & Destructor Documentation

ModuleServicesAccount::ModuleServicesAccount InspIRCd Me  )  [inline]
 

Definition at line 108 of file m_services_account.cpp.

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

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

Definition at line 358 of file m_services_account.cpp.

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


Member Function Documentation

virtual Version ModuleServicesAccount::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 372 of file m_services_account.cpp.

References API_VERSION, VF_COMMON, and VF_VENDOR.

virtual void ModuleServicesAccount::On005Numeric std::string t  )  [inline, virtual]
 

Called when a 005 numeric is about to be output.

The module should modify the 005 numeric if needed to indicate its features.

Parameters:
output The 005 string to be modified if neccessary.

Reimplemented from Module.

Definition at line 125 of file m_services_account.cpp.

References InspIRCd::AddExtBanChar(), and Module::ServerInstance.

virtual void ModuleServicesAccount::OnCleanup int  target_type,
void *  item
[inline, virtual]
 

Called before your module is unloaded to clean up Extensibles.

This method is called once for every user and channel on the network, so that when your module unloads it may clear up any remaining data in the form of Extensibles added using Extensible::Extend(). If the target_type variable is TYPE_USER, then void* item refers to a User*, otherwise it refers to a Channel*.

Parameters:
target_type The type of item being cleaned
item A pointer to the item's class

Reimplemented from Module.

Definition at line 294 of file m_services_account.cpp.

References Extensible::GetExt(), Extensible::Shrink(), and TYPE_USER.

virtual void ModuleServicesAccount::OnDecodeMetaData int  target_type,
void *  target,
const std::string extname,
const std::string extdata
[inline, virtual]
 

Allows module data, sent via ProtoSendMetaData, to be decoded again by a receiving module.

Please see src/modules/m_swhois.cpp for a working example of how to use this method call.

Parameters:
target_type The type of item to decode data for, TYPE_USER or TYPE_CHANNEL
target The Channel* or User* that data should be added to
extname The extension name which is being sent
extdata The extension data, encoded at the other end by an identical module through OnSyncChannelMetaData or OnSyncUserMetaData

Reimplemented from Module.

Definition at line 316 of file m_services_account.cpp.

References AccountData::account, Extensible::Extend(), Extensible::GetExt(), User::GetFullHost(), IS_LOCAL, User::nick, Event::Send(), Module::ServerInstance, Extensible::Shrink(), trim(), TYPE_USER, AccountData::user, and User::WriteNumeric().

virtual void ModuleServicesAccount::OnSyncUserMetaData User user,
Module proto,
void *  opaque,
const std::string extname,
bool  displayable
[inline, virtual]
 

Reimplemented from Module.

Definition at line 261 of file m_services_account.cpp.

References Extensible::GetExt(), Module::ProtoSendMetaData(), trim(), and TYPE_USER.

virtual void ModuleServicesAccount::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 149 of file m_services_account.cpp.

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

virtual int ModuleServicesAccount::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 216 of file m_services_account.cpp.

References ERR_BANNEDFROMCHAN, Extensible::GetExt(), IS_LOCAL, Channel::IsExtBanned(), Channel::IsModeSet(), Channel::name, User::nick, User::server, Module::ServerInstance, InspIRCd::ULine(), and User::WriteNumeric().

virtual int ModuleServicesAccount::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 161 of file m_services_account.cpp.

References Extensible::GetExt(), IS_LOCAL, Channel::IsExtBanned(), 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 ModuleServicesAccount::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 211 of file m_services_account.cpp.

References OnUserPreMessage().

virtual void ModuleServicesAccount::OnUserQuit User user,
const std::string message,
const std::string oper_message
[inline, virtual]
 

Called when a user quits.

The details of the exiting user are available to you in the parameter User *user This event is only called when the user is fully registered when they quit. To catch raw disconnections, use the OnUserDisconnect method.

Parameters:
user The user who is quitting
message The user's quit message (as seen by non-opers)
oper_message The user's quit message (as seen by opers)

Reimplemented from Module.

Definition at line 282 of file m_services_account.cpp.

References Extensible::GetExt(), and Extensible::Shrink().

virtual void ModuleServicesAccount::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 132 of file m_services_account.cpp.

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


Member Data Documentation

AChannel_R* ModuleServicesAccount::m1 [private]
 

Definition at line 102 of file m_services_account.cpp.

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

AChannel_M* ModuleServicesAccount::m2 [private]
 

Definition at line 103 of file m_services_account.cpp.

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

AUser_R* ModuleServicesAccount::m3 [private]
 

Definition at line 104 of file m_services_account.cpp.

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

Channel_r* ModuleServicesAccount::m4 [private]
 

Definition at line 105 of file m_services_account.cpp.

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

User_r* ModuleServicesAccount::m5 [private]
 

Definition at line 106 of file m_services_account.cpp.

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


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