Channel Class Reference

Channel management class. More...

#include <channel.h>

List of all members.

Public Member Functions

 Channel (string)
 Constructor.
 ~Channel ()
 Destructor.
string getName ()
 return the channel name
bool addUser (string, string, string, string)
 Add a user to the chan.
bool delUserByNick (string)
 Del a user from the chan.
bool delUserByHost (string)
 Del a user from the chan.
string * getInfosByNick (string)
 Return infos about a user.
string getNickByHost (string)
 Return the nick associated to a given host.
string getStatusByNick (string)
 Return the status associated to a given nick.
string getStatusByHost (string)
 Return the status associated to a given host.
string getHostByNick (string)
 Return the host associated to a given nick.
string getIdentByNick (string)
 Return the ident associated to a nick.
string getIdentByHost (string)
 Return the ident associated to a host.
bool setNickByNick (string, string)
 Change a nick.
bool setNickByHost (string, string)
 Change the nick associated to a host.
bool updateStatusByNick (string, char, char)
 Update the status associated to a nick.
bool checkNickAccess (string, char)
 Check if a nick owns a given access.
void truncateUsersList ()
 Erase all users from the channel.
vector< string * > getUsers ()
 Gives users vector.
time_t getLastWhoUpdate ()
 Get last update.
void notifyWho ()
 Notify a WHO update.
string getTopic ()
 get topic
void setTopic (string)
 set topic
string * getLastPartInfos ()
 get informations about the last user who left channel
bool isOnChannel (string)
 Tell if a nick is on the channel.

Private Member Functions

vector< string * >::iterator getIterator (string, unsigned int)
 Return a nick iterator in a vector.

Private Attributes

vector< string * > users
 Contain all the chan users.
string name
 Channel name.
time_t lastWhoUpdate
 Keep last WHO update.
string topic
 stores channel's topic
string lastPart [4]
 Stores informations about the last user who left channel.


Detailed Description

Channel management class.

This class stores and manage all informations about a channel

Definition at line 44 of file channel.h.


Constructor & Destructor Documentation

Channel::Channel ( string  name  ) 

Constructor.

Class constructor Initialize private attributes

Parameters:
name Channel name

Definition at line 36 of file channel.cpp.

References lastPart, lastWhoUpdate, topic, and users.

Channel::~Channel (  ) 

Destructor.

Destructor Clear private attributes

Definition at line 51 of file channel.cpp.

References truncateUsersList().


Member Function Documentation

bool Channel::addUser ( string  nick,
string  host,
string  ident,
string  status 
)

Add a user to the chan.

Add a user to the channel It's then possible to follow status

Parameters:
nick User nick
host User host
ident User ident
status User status
Returns:
true if operation ok, else false (already added ?)

Definition at line 74 of file channel.cpp.

References getHostByNick(), and users.

bool Channel::checkNickAccess ( string  nick,
char  access 
)

Check if a nick owns a given access.

Check if a given nick owns a given access

Parameters:
nick The nick witch you want to check access
access Access to test (o,v,etc ...)
Returns:
true if the nick owns the access, else false

Definition at line 347 of file channel.cpp.

References getIterator(), and users.

bool Channel::delUserByHost ( string  host  ) 

Del a user from the chan.

Del a user from the chan according to a given host

Parameters:
host host's user to delete
Postcondition:
lastPart has been updated
Returns:
true if the user ahs been deleted, else false

Definition at line 140 of file channel.cpp.

References getIterator(), lastPart, and users.

bool Channel::delUserByNick ( string  nick  ) 

Del a user from the chan.

Del a user from the chan according to a given nick

Parameters:
nick Nick to delete
Postcondition:
lastPart has been updated
Returns:
true if the user ahs been deleted, else false

Definition at line 118 of file channel.cpp.

References getIterator(), lastPart, and users.

string Channel::getHostByNick ( string  nick  ) 

Return the host associated to a given nick.

Give the host corresponding to a given nick

Parameters:
nick nick from witch you want to get the host
Returns:
Host corresponding to the given nick (empty string if no match found)

Definition at line 224 of file channel.cpp.

References getIterator(), and users.

Referenced by addUser().

string Channel::getIdentByHost ( string  host  ) 

Return the ident associated to a host.

Give the host corresponding to a given host

Parameters:
host host from witch you want to get the ident
Returns:
Ident corresponding to the given host (empty string if no match found)

Definition at line 254 of file channel.cpp.

References getIterator(), and users.

string Channel::getIdentByNick ( string  nick  ) 

Return the ident associated to a nick.

Give the ident corresponding to a given nick

Parameters:
nick nick from witch you want to get the ident
Returns:
Ident corresponding to the given nick (empty string if no match found)

Definition at line 239 of file channel.cpp.

References getIterator(), and users.

string * Channel::getInfosByNick ( string  nick  ) 

Return infos about a user.

Return informations about a nick, in this order : tab[0]=nick; tab[1]=host; tab[2]=ident; tab[3]=status;

Parameters:
nick User nick
Returns:
array with informations

Definition at line 178 of file channel.cpp.

References getIterator(), and users.

Referenced by isOnChannel().

vector< string * >::iterator Channel::getIterator ( string  comparator,
unsigned int  index 
) [private]

Return a nick iterator in a vector.

Return a vector iterator according to arguments

Parameters:
comparator String to compair with the vector
index User's infos index
Returns:
Iterator usable for a vector

Definition at line 96 of file channel.cpp.

References users.

Referenced by checkNickAccess(), delUserByHost(), delUserByNick(), getHostByNick(), getIdentByHost(), getIdentByNick(), getInfosByNick(), getNickByHost(), getStatusByHost(), getStatusByNick(), setNickByHost(), setNickByNick(), and updateStatusByNick().

string * Channel::getLastPartInfos (  ) 

get informations about the last user who left channel

Returns informations about the last user who left the channel

Returns:
Informations about the last user who left the channel

Definition at line 434 of file channel.cpp.

References lastPart.

time_t Channel::getLastWhoUpdate (  ) 

Get last update.

Get last WHO update timestamp

Returns:
last update timestamp

Definition at line 399 of file channel.cpp.

References lastWhoUpdate.

string Channel::getName (  ) 

return the channel name

Get channel name

Returns:
Channel name

Definition at line 60 of file channel.cpp.

References name.

string Channel::getNickByHost ( string  host  ) 

Return the nick associated to a given host.

Give the nick corresponding to a given host

Parameters:
host host from witch you want to get the nick
Returns:
Nick corresponding to the given host (empty string if no match found)

Definition at line 160 of file channel.cpp.

References getIterator(), and users.

string Channel::getStatusByHost ( string  host  ) 

Return the status associated to a given host.

Give the status corresponding to a given host

Parameters:
host host from witch you want to get the status
Returns:
Status corresponding to the given host (empty string if no match found)

Definition at line 209 of file channel.cpp.

References getIterator(), and users.

string Channel::getStatusByNick ( string  nick  ) 

Return the status associated to a given nick.

Give the status corresponding to a given nick

Parameters:
nick Nick from witch you want to get the status
Returns:
Status corresponding to the given nick (empty string if no match found)

Definition at line 194 of file channel.cpp.

References getIterator(), and users.

string Channel::getTopic (  ) 

get topic

get topic

Returns:
topic

Definition at line 416 of file channel.cpp.

References topic.

vector< string * > Channel::getUsers (  ) 

Gives users vector.

Return users vector informations Users a stored in a string tab like that : tab[0]=nick; tab[1]=host; tab[2]=ident; tab[3]=status;

Returns:
users vector informations

Definition at line 390 of file channel.cpp.

References users.

bool Channel::isOnChannel ( string  nick  ) 

Tell if a nick is on the channel.

Tell if a nick is on the channel

Parameters:
nick Nick to check
Returns:
True if the nick is on the channel, else false

Definition at line 444 of file channel.cpp.

References getInfosByNick().

void Channel::notifyWho (  ) 

Notify a WHO update.

Notify that a a WHO command has been sent for this channel

Definition at line 407 of file channel.cpp.

References lastWhoUpdate.

bool Channel::setNickByHost ( string  host,
string  newnick 
)

Change the nick associated to a host.

Change a user nick to an other one This one is found by the host

Parameters:
host User host for witch you want to change the nick
newnick New nick (instead of old one)
Returns:
True if the nick has been changed, else false (not found)

Definition at line 289 of file channel.cpp.

References getIterator(), and users.

bool Channel::setNickByNick ( string  old,
string  newnick 
)

Change a nick.

Change a user nick to an other one This one is found by the nick

Parameters:
old Nick to change
newnick New nick (instead of old one)
Returns:
True if the nick has been changed, else false (not found)

Definition at line 271 of file channel.cpp.

References getIterator(), and users.

void Channel::setTopic ( string  topic  ) 

set topic

set topic

Parameters:
topic channel topic

Definition at line 425 of file channel.cpp.

void Channel::truncateUsersList (  ) 

Erase all users from the channel.

Clear users list

Definition at line 371 of file channel.cpp.

References users.

Referenced by ~Channel().

bool Channel::updateStatusByNick ( string  nick,
char  sign,
char  mode 
)

Update the status associated to a nick.

Change a user status to an other one This one is found by the nick

Parameters:
nick User nick for witch you want to change the status
sign + or - (+ for grant level, - for remove level)
mode user mode (v,o etc ...)
Returns:
True if the nick has been changed, else false (not found)

Definition at line 308 of file channel.cpp.

References getIterator(), and users.


Member Data Documentation

string Channel::lastPart[4] [private]

Stores informations about the last user who left channel.

Definition at line 109 of file channel.h.

Referenced by Channel(), delUserByHost(), delUserByNick(), and getLastPartInfos().

time_t Channel::lastWhoUpdate [private]

Keep last WHO update.

Definition at line 105 of file channel.h.

Referenced by Channel(), getLastWhoUpdate(), and notifyWho().

string Channel::name [private]

Channel name.

Definition at line 103 of file channel.h.

Referenced by getName().

string Channel::topic [private]

stores channel's topic

Definition at line 107 of file channel.h.

Referenced by Channel(), and getTopic().

vector<string*> Channel::users [private]


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

Generated on Sun Aug 16 15:28:36 2009 for trustyRC by  doxygen 1.5.8