Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Server Class Reference

Allows server output and query functions This class contains methods which allow a module to query the state of the irc server, and produce output to users and other servers. More...

#include <modules.h>

Inheritance diagram for Server:

Inheritance graph
[legend]
Collaboration diagram for Server:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Server ()
 Default constructor.

virtual ~Server ()
 Default destructor.

virtual void SendOpers (string s)
 Sends text to all opers.

virtual void Log (int level, string s)
 Writes a log string.

virtual void Send (int Socket, string s)
 Sends a line of text down a TCP/IP socket.

virtual void SendServ (int Socket, string s)
 Sends text from the server to a socket.

virtual void SendFrom (int Socket, userrec *User, string s)
 Sends text from a user to a socket.

virtual void SendTo (userrec *Source, userrec *Dest, string s)
 Sends text from a user to another user.

virtual void SendChannel (userrec *User, chanrec *Channel, string s, bool IncludeSender)
 Sends text from a user to a channel (mulicast).

virtual bool CommonChannels (userrec *u1, userrec *u2)
 Returns true if two users share a common channel.

virtual void SendCommon (userrec *User, string text, bool IncludeSender)
 Sends text from a user to one or more channels (mulicast).

virtual void SendWallops (userrec *User, string text)
 Sends a WALLOPS message.

virtual bool IsNick (string nick)
 Returns true if a nick is valid.

virtual userrecFindNick (string nick)
 Attempts to look up a nick and return a pointer to it.

virtual chanrecFindChannel (string channel)
 Attempts to look up a channel and return a pointer to it.

virtual string ChanMode (userrec *User, chanrec *Chan)
 Attempts to look up a user's privilages on a channel.

virtual string GetServerName ()
 Returns the server name of the server where the module is loaded.

virtual string GetNetworkName ()
 Returns the network name, global to all linked servers.

virtual Admin GetAdmin ()
 Returns the information of the server as returned by the /ADMIN command.


Detailed Description

Allows server output and query functions This class contains methods which allow a module to query the state of the irc server, and produce output to users and other servers.

All modules should instantiate at least one copy of this class, and use its member functions to perform their tasks.

Definition at line 147 of file modules.h.


Constructor & Destructor Documentation

Server::Server  
 

Default constructor.

Creates a Server object.

Definition at line 43 of file modules.cpp.

00044 {
00045 }

Server::~Server   [virtual]
 

Default destructor.

Destroys a Server object.

Definition at line 47 of file modules.cpp.

00048 {
00049 }


Member Function Documentation

string Server::ChanMode userrec   User,
chanrec   Chan
[virtual]
 

Attempts to look up a user's privilages on a channel.

This function will return a string containing either @, , +, or an empty string, representing the user's privilages upon the channel you specify.

Definition at line 130 of file modules.cpp.

00131 {
00132         string mode = cmode(User,Chan);
00133         return mode;
00134 }

bool Server::CommonChannels userrec   u1,
userrec   u2
[virtual]
 

Returns true if two users share a common channel.

This method is used internally by the NICK and QUIT commands, and the Server::SendCommon method.

Definition at line 93 of file modules.cpp.

00094 {
00095         return (common_channels(u1,u2) != 0);
00096 }

chanrec * Server::FindChannel string    channel [virtual]
 

Attempts to look up a channel and return a pointer to it.

This function will return NULL if the channel does not exist.

Definition at line 125 of file modules.cpp.

00126 {
00127         return FindChan(channel.c_str());
00128 }

userrec * Server::FindNick string    nick [virtual]
 

Attempts to look up a nick and return a pointer to it.

This function will return NULL if the nick does not exist.

Definition at line 120 of file modules.cpp.

00121 {
00122         return Find(nick);
00123 }

Admin Server::GetAdmin   [virtual]
 

Returns the information of the server as returned by the /ADMIN command.

See the Admin class for further information of the return value. The members Admin::Nick, Admin::Email and Admin::Name contain the information for the server where the module is loaded.

Definition at line 146 of file modules.cpp.

00147 {
00148         return Admin(getadminname(),getadminemail(),getadminnick());
00149 }

string Server::GetNetworkName   [virtual]
 

Returns the network name, global to all linked servers.

Definition at line 141 of file modules.cpp.

00142 {
00143         return getnetworkname();
00144 }

string Server::GetServerName   [virtual]
 

Returns the server name of the server where the module is loaded.

Definition at line 136 of file modules.cpp.

00137 {
00138         return getservername();
00139 }

bool Server::IsNick string    nick [virtual]
 

Returns true if a nick is valid.

Nicks for unregistered connections will return false.

Definition at line 115 of file modules.cpp.

00116 {
00117         return (isnick(nick.c_str()) != 0);
00118 }

void Server::Log int    level,
string    s
[virtual]
 

Writes a log string.

This method writes a line of text to the log. If the level given is lower than the level given in the configuration, this command has no effect.

Definition at line 56 of file modules.cpp.

00057 {
00058         log(level,"%s",s.c_str());
00059 }

void Server::Send int    Socket,
string    s
[virtual]
 

Sends a line of text down a TCP/IP socket.

This method writes a line of text to an established socket, cutting it to 510 characters plus a carriage return and linefeed if required.

Definition at line 61 of file modules.cpp.

00062 {
00063         Write(Socket,"%s",s.c_str());
00064 }

void Server::SendChannel userrec   User,
chanrec   Channel,
string    s,
bool    IncludeSender
[virtual]
 

Sends text from a user to a channel (mulicast).

This method writes a line of text to a channel, with the given user's nick/ident /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the IncludeSender flag is set, then the text is also sent back to the user from which it originated, as seen in MODE (see RFC 1459).

Definition at line 81 of file modules.cpp.

00082 {
00083         if (IncludeSender)
00084         {
00085                 WriteChannel(Channel,User,"%s",s.c_str());
00086         }
00087         else
00088         {
00089                 ChanExceptSender(Channel,User,"%s",s.c_str());
00090         }
00091 }

void Server::SendCommon userrec   User,
string    text,
bool    IncludeSender
[virtual]
 

Sends text from a user to one or more channels (mulicast).

This method writes a line of text to all users which share a common channel with a given user, with the user's nick/ident/host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the IncludeSender flag is set, then the text is also sent back to the user from which it originated, as seen in NICK (see RFC 1459). Otherwise, it is only sent to the other recipients, as seen in QUIT.

Definition at line 98 of file modules.cpp.

00099 {
00100         if (IncludeSender)
00101         {
00102                 WriteCommon(User,"%s",text.c_str());
00103         }
00104         else
00105         {
00106                 WriteCommonExcept(User,"%s",text.c_str());
00107         }
00108 }

void Server::SendFrom int    Socket,
userrec   User,
string    s
[virtual]
 

Sends text from a user to a socket.

This method writes a line of text to an established socket, with the given user's nick/ident /host combination prepended, as used in PRIVSG etc commands (see RFC 1459)

Definition at line 71 of file modules.cpp.

00072 {
00073         WriteFrom(Socket,User,"%s",s.c_str());
00074 }

void Server::SendOpers string    s [virtual]
 

Sends text to all opers.

This method sends a server notice to all opers with the usermode +s.

Definition at line 51 of file modules.cpp.

00052 {
00053         WriteOpers("%s",s.c_str());
00054 }

void Server::SendServ int    Socket,
string    s
[virtual]
 

Sends text from the server to a socket.

This method writes a line of text to an established socket, with the servername prepended as used by numerics (see RFC 1459)

Definition at line 66 of file modules.cpp.

00067 {
00068         WriteServ(Socket,"%s",s.c_str());
00069 }

void Server::SendTo userrec   Source,
userrec   Dest,
string    s
[virtual]
 

Sends text from a user to another user.

This method writes a line of text to a user, with a user's nick/ident /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459)

Definition at line 76 of file modules.cpp.

00077 {
00078         WriteTo(Source,Dest,"%s",s.c_str());
00079 }

void Server::SendWallops userrec   User,
string    text
[virtual]
 

Sends a WALLOPS message.

This method writes a WALLOPS message to all users with the +w flag, originating from the specified user.

Definition at line 110 of file modules.cpp.

00111 {
00112         WriteWallOps(User,"%s",text.c_str());
00113 }


The documentation for this class was generated from the following files:
Generated on Sun Mar 30 19:36:22 2003 for InspIRCd by doxygen1.3-rc3