ircpp::channel Class Reference

The channel class represents one channel on IRC. More...

#include <channel.h>

Inheritance diagram for ircpp::channel:

ircpp::entity

List of all members.

Public Member Functions

bool is_user () const
 Determine if this entity is a user object.
bool is_channel () const
 Determine if this entity is a channel object.
bool cmd_part (const std::string &partmsg="") const
 Part from this channel.
bool cmd_topic (const std::string &newtopic) const
 Change the channel topic.
bool cmd_kick (const std::string &nick, const std::string &reason="") const
 Kick a user from the channel.
bool cmd_invite (const std::string &nick) const
 Invite a user to the channel.
bool cmd_names () const
 Send a NAMES request for the channel.
const std::string & topic () const
 Returns the channel topic.
void * ptr () const
 Returns the user-defined pointer.
void ptr (void *p) const
 Sets the user-defined pointer.
const userfind_user (const std::string &nick) const
 Finds a user in the channel user list.
const irclist< user >
::iterator 
userlist_begin () const
 Returns an iterator the beginning of the channel user list.
const irclist< user >
::iterator 
userlist_end () const
 Returns an iterator the end of the channel user list.
const std::string & nick () const
 Returns the nick (name) of the entity.
const std::string & name () const
 Returns the name of the entity.
const sessionparent () const
 Returns the parent session.
const userto_user () const
 Convert an entity object to a user object.
const channelto_channel () const
 Convert an entity object to a channel object.
bool is_temporary () const
 Determine whether the entity is temporary or not.
bool cmd_privmsg (const std::string &text) const
 Send a message to the entity.
bool cmd_notice (const std::string &text) const
 Send a notice to the entity.
bool cmd_mode (const std::string &modestring) const
 Send a mode command to the entity.
bool cmd_ctcp (const std::string &command, const std::string &text="") const
 Send a CTCP message to the entity.
bool cmd_action (const std::string &text) const
 Send a CTCP ACTION message to the entity.

Public Attributes

boost::signal1< void,
const message & > 
sig_join_msg
 Emitted when a user joins the channel.
boost::signal1< void,
const message & > 
sig_part_msg
 Emitted when a user parts the channel.
boost::signal1< void,
const message & > 
sig_quit_msg
 Emitted when a user in the channel quits.
boost::signal1< void,
const message & > 
sig_mode_msg
 Emitted when a mode is changed on the channel.
boost::signal1< void,
const message & > 
sig_singlemode_msg
 Emitted for each individual mode changed on the channel.
boost::signal1< void,
const message & > 
sig_topic_msg
 Emitted when the channel topic is changed.
boost::signal1< void,
const message & > 
sig_kick_msg
 Emitted when a user is kicked from the channel.
boost::signal1< void,
const message & > 
sig_invite_msg
 Emitted when a user is invited to the channel.
boost::signal1< void,
const message & > 
sig_numeric
 Emitted when a numeric message related to the channel is received.
boost::signal1< void,
entity & > 
sig_deletable
 Emitted when an entity may be safely deleted.
boost::signal1< void,
entity & > 
sig_deleting
 Emitted when an entity is about to be deleted.
boost::signal1< void,
const message & > 
sig_privmsg_msg
 Emitted when the entity receives a PRIVMSG.
boost::signal1< void,
const message & > 
sig_notice_msg
 Emitted when the entity receives a NOTICE.
boost::signal1< void,
const message & > 
sig_ctcp_msg
 Emitted when the entity receives a CTCP message.


Detailed Description

The channel class represents one channel on IRC.

Member Function Documentation

bool ircpp::channel::is_user (  )  const [virtual]

Determine if this entity is a user object.

An entity may represent either a user or a channel. If it represents a user, this function will return true. You may then use to_user() to return a correctly-typed reference to a user object

Returns:
true if the entity is a user, false otherwise

Implements ircpp::entity.

bool ircpp::channel::is_channel (  )  const [virtual]

Determine if this entity is a channel object.

An entity may represent either a user or a channel. If it represents a channel, this function will return true. You may then use to_channel() to return a correctly-typed reference to a channel object

Returns:
true if the entity is a channel, false otherwise

Implements ircpp::entity.

bool ircpp::channel::cmd_part ( const std::string &  partmsg = ""  )  const

Part from this channel.

Sends a PART command to leave the channel.

Parameters:
(optional) A part message to be shown when leaving the channel. If omitted defaults to blank.
Returns:
true if the command was sent successfully, false if not connected or if the output buffer is full

bool ircpp::channel::cmd_topic ( const std::string &  newtopic  )  const

Change the channel topic.

Sends a TOPIC command to change the channel topic.

Parameters:
newtopic The new channel topic.
Returns:
true if the command was sent successfully, false if not connected or if the output buffer is full

bool ircpp::channel::cmd_kick ( const std::string &  nick,
const std::string &  reason = "" 
) const

Kick a user from the channel.

Sends a KICK command to kick a user from the channel.

Parameters:
nick The nick to be kicked
reason (optional) A reason explaining the kick. If omitted defaults to blank.
Returns:
true if the command was sent successfully, false if not connected or if the output buffer is full

bool ircpp::channel::cmd_invite ( const std::string &  nick  )  const

Invite a user to the channel.

Sends an INVITE command to invite a user to the channel.

Parameters:
nick The nick of the user to be invited.
Returns:
true if the command was sent successfully, false if not connected or if the output buffer is full

bool ircpp::channel::cmd_names (  )  const

Send a NAMES request for the channel.

Sends an INVITE command to invite a user to the channel.

Parameters:
nick The nick of the user to be invited.
Returns:
true if the command was sent successfully, false if not connected or if the output buffer is full

const string & ircpp::channel::topic (  )  const

Returns the channel topic.

Returns:
The currently set channel topic.

void * ircpp::channel::ptr (  )  const

Returns the user-defined pointer.

If the user-defined pointer has not yet been set, it will be NULL

Returns:
The user-defined pointer previously set

void ircpp::channel::ptr ( void *  p  )  const

Sets the user-defined pointer.

To help keep track of channels, you can save a user-defined pointer inside the channel object.

The user-defined pointer is of type void *, and you can set it to anything you like

Parameters:
p The user-defined pointer to set

const user & ircpp::channel::find_user ( const std::string &  nick  )  const

Finds a user in the channel user list.

If the internal lists are enabled, libircpp will keep track of all users In the channel. This function finds a user object from the channel user list. See the manual section on lists for more information (http://libircpp.sf.net/manual/lists.html).

If the user cannot be found, a reference to the null user will be returned. You can test for this with if(!u), where u is the returned reference.

Parameters:
nick The nick of the user to find
Returns:
A reference to a user object on success, or a reference to the null user if not found.

const irclist< user >::iterator ircpp::channel::userlist_begin (  )  const

Returns an iterator the beginning of the channel user list.

If the internal lists are enabled, libircpp will keep track of all users in the channel. This function returns an iterator to the start of the channel user list. See the manual section on lists for more information (http://libircpp.sf.net/manual/lists.html).

Returns:
An iterator the beginning of the channel user list

const irclist< user >::iterator ircpp::channel::userlist_end (  )  const

Returns an iterator the end of the channel user list.

If the internal lists are enabled, libircpp will keep track of all users in the channel. This function returns an iterator to the end of the channel user list. See the manual section on lists for more information (http://libircpp.sf.net/manual/lists.html).

Returns:
An iterator the end of the channel user list

const string & ircpp::entity::nick (  )  const [inherited]

Returns the nick (name) of the entity.

This function is identical to name() but is included because an entity may represent either a user or a channel.

Returns:
The nick, or name, of the entity

const string & ircpp::entity::name (  )  const [inherited]

Returns the name of the entity.

This function is identical to nick() but is included because an entity may represent either a user or a channel.

Returns:
The nick, or name, of the entity

const session & ircpp::entity::parent (  )  const [inherited]

Returns the parent session.

Every user and channel has an associated IRC session to which it belongs. This function returns it.

Returns:
A reference to the session to which the entity belongs

const user & ircpp::entity::to_user (  )  const [inherited]

Convert an entity object to a user object.

An entity object may be either a user or a channel. If it is a user, this function can be used to convert an entity reference to a user reference.

This function is included for convenience. It has the same effect as dynamic_cast<const user&>, but will not throw an exception if the entity is not a user. Instead it will return the null user object.

You can use is_user() to determine whether the entity is actually a user or not before using this function.

Returns:
A reference to the entity object typecast as a user object, or a reference to the null user object if the entity is not a user.

const channel & ircpp::entity::to_channel (  )  const [inherited]

Convert an entity object to a channel object.

An entity object may be either a user or a channel. If it is a channel, this function can be used to convert an entity reference to a channel reference.

This function is included for convenience. It has the same effect as dynamic_cast<const channel&>, but will not throw an exception if the entity is not a channel. Instead it will return the null channel object.

You can use is_channel() to determine whether the entity is actually a channel or not before using this function.

Returns:
A reference to the entity object typecast as a channel object, or a reference to the null channel object if the entity is not a channel.

bool ircpp::entity::is_temporary (  )  const [inherited]

Determine whether the entity is temporary or not.

Entities may be temporary (destroyed after the message they are attached to has been processed) or permanent (stored in a list and accessible until they are deleted). This function determines whether an entity is temporary or permanent.

Returns:
true if the entity is temporary, false otherwise

bool ircpp::entity::cmd_privmsg ( const std::string &  text  )  const [inherited]

Send a message to the entity.

Use this function to send a message (PRIVMSG) to the entity.

Parameters:
text The text of the message
Returns:
true if the command was sent successfully, false if not connected to irc or if the output buffer is full

bool ircpp::entity::cmd_notice ( const std::string &  text  )  const [inherited]

Send a notice to the entity.

Use this function to send a notice to the entity.

Parameters:
text The text of the notice
Returns:
true if the command was sent successfully, false if not connected to irc or if the output buffer is full

bool ircpp::entity::cmd_mode ( const std::string &  modestring  )  const [inherited]

Send a mode command to the entity.

Use this function to send a MODE command to the entity.

Parameters:
modestring A string containing the modes to be set or unset
Returns:
true if the command was sent successfully, false if not connected to irc or if the output buffer is full

bool ircpp::entity::cmd_ctcp ( const std::string &  command,
const std::string &  text = "" 
) const [inherited]

Send a CTCP message to the entity.

Use this function to send a CTCP message to the entity.

Parameters:
command The CTCP command to send (e.g. "ACTION")
params The parameters of the command
Returns:
true if the command was sent successfully, false if not connected to irc or if the output buffer is full

bool ircpp::entity::cmd_action ( const std::string &  text  )  const [inherited]

Send a CTCP ACTION message to the entity.

Use this function to send a CTCP ACTION message (commonly referred to as /me) to the entity.

Parameters:
text The text of the CTCP action
Returns:
true if the command was sent successfully, false if not connected to irc or if the output buffer is full


Member Data Documentation

boost::signal1<void, const message &> ircpp::channel::sig_join_msg [mutable]

Emitted when a user joins the channel.

Parameters:
message The received join message

boost::signal1<void, const message &> ircpp::channel::sig_part_msg [mutable]

Emitted when a user parts the channel.

Parameters:
message The received part message

boost::signal1<void, const message &> ircpp::channel::sig_quit_msg [mutable]

Emitted when a user in the channel quits.

Parameters:
message The received quit message

boost::signal1<void, const message &> ircpp::channel::sig_mode_msg [mutable]

Emitted when a mode is changed on the channel.

Parameters:
message The received mode message

boost::signal1<void, const message &> ircpp::channel::sig_singlemode_msg [mutable]

Emitted for each individual mode changed on the channel.

Because each MODE message may contain more than one mode change, it is useful to split them up into individual mode changes.

Each time a MODE message arrives, libircpp first emits sig_mode_msg, then splits the MODE message up into individual mode changes, and for each one emits sig_singlemode_msg, which contains an artificial MODE message corresponding to that single mode.

Note that MODE messages emitted by this signal are not real messages which have arrived from the IRC server, but are generated artificially.

Parameters:
message The generated single MODE message.

boost::signal1<void, const message &> ircpp::channel::sig_topic_msg [mutable]

Emitted when the channel topic is changed.

Parameters:
message The received topic-change message

boost::signal1<void, const message &> ircpp::channel::sig_kick_msg [mutable]

Emitted when a user is kicked from the channel.

Parameters:
message The received kick message

boost::signal1<void, const message &> ircpp::channel::sig_invite_msg [mutable]

Emitted when a user is invited to the channel.

Parameters:
message The received invite message

boost::signal1<void, const message &> ircpp::channel::sig_numeric [mutable]

Emitted when a numeric message related to the channel is received.

Some channel-related messages arrive as numeric replies. Examples include the NAMES reply.

Parameters:
message The received numeric message

boost::signal1<void, entity&> ircpp::entity::sig_deletable [mutable, inherited]

Emitted when an entity may be safely deleted.

When the session has its lists set to manual mode, it is your responsibility to delete user and channel objects when finished with them. This signal indicates that libircpp has finshed with this entity , and you may safely delete it when you no longer need it. For more information, see the manual section on lists Note that this signal is specific to one entity. If you wish to be notified when any user/channel becomes deletable, you should use session::user_deletable and session::channel_deletable

Parameters:
entity A reference to the entity which may now be deleted

boost::signal1<void, entity&> ircpp::entity::sig_deleting [mutable, inherited]

Emitted when an entity is about to be deleted.

When an entity is about to be deleted, it emits this signal. When you receive this signal, you should remove all pointers and references to the entity object, as it is no longer valid after this signal.

boost::signal1<void, const message&> ircpp::entity::sig_privmsg_msg [mutable, inherited]

Emitted when the entity receives a PRIVMSG.

Parameters:
message The received message

boost::signal1<void, const message&> ircpp::entity::sig_notice_msg [mutable, inherited]

Emitted when the entity receives a NOTICE.

Parameters:
message The received notice

boost::signal1<void, const message&> ircpp::entity::sig_ctcp_msg [mutable, inherited]

Emitted when the entity receives a CTCP message.

Parameters:
message The received message


The documentation for this class was generated from the following files:
Generated on Sat Oct 13 23:35:41 2007 for libircpp by  doxygen 1.5.3