libircpp
Version: 0.0.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
irc::session Class Reference

#include <irc/session.hpp>

Detailed Description

IRC session class.

Public Member Functions

 session (std::shared_ptr< connection > connection_, std::string nick, std::string user_name_, std::string fullname_)
 Constructor. More...
 
const std::string & get_nick () const
 Returns the user nick name. More...
 
userget_self ()
 Returns a reference to our current user details. More...
 
const userget_self () const
 Returns a const reference to our current user details. More...
 
const_user_iterator begin_users () const
 Returns a const iterator to the beginning of the user list. More...
 
const_user_iterator end_users () const
 Returns a const iterator to the end of the user list. More...
 
const_channel_iterator channel_begin () const
 Returns a const iterator to the beginning of the channel list. More...
 
const_channel_iterator channel_end () const
 Returns a const iterator to the end of the channel list. More...
 
void async_join (const std::string &channel_name)
 Joins the specified channel. More...
 
void async_part (const channel &chan)
 Leaves the specified channel. More...
 
void async_privmsg (const std::string &target, const std::string &msg)
 Sends a message to the specified target. More...
 
void async_change_nick (const std::string &target)
 Changes our current nickname. More...
 
void stop ()
 Closes the connection. More...
 
template<typename F >
bsig::connection connect_on_motd (F &&f)
 Connect to the on_motd signal. More...
 
template<typename F >
bsig::connection connect_on_join_channel (F &&f)
 Connect to the on_join_channel signal. More...
 
template<typename F >
bsig::connection connect_on_notice (F &&f)
 Connect to the on_notice signal. More...
 
template<typename F >
bsig::connection connect_on_user_notice (F &&f)
 Connect to the on_user_notice signal. More...
 
template<typename F >
bsig::connection connect_on_new_user (F &&f)
 Connect to the on_new_user signal. More...
 

Constructor & Destructor Documentation

irc::session::session ( std::shared_ptr< connection connection_,
std::string  nick,
std::string  user_name_,
std::string  fullname_ 
)

Constructor.

Parameters
connection_An enstablished IRC connection.
nickA nickname.
user_name_An user name.
fullname_A real, full user name.

Member Function Documentation

void irc::session::async_change_nick ( const std::string &  target)

Changes our current nickname.

Parameters
targetThe new nick name.
void irc::session::async_join ( const std::string &  channel_name)

Joins the specified channel.

Parameters
channel_nameThe channel to join.
void irc::session::async_part ( const channel chan)

Leaves the specified channel.

Parameters
chanThe channel to leave.
void irc::session::async_privmsg ( const std::string &  target,
const std::string &  msg 
)

Sends a message to the specified target.

Parameters
targetThe target where to send the message, a channel or a nickname.
msgThe message to send.
const_user_iterator irc::session::begin_users ( ) const

Returns a const iterator to the beginning of the user list.

Returns
A const iterator to the beginning of the user list.
const_channel_iterator irc::session::channel_begin ( ) const

Returns a const iterator to the beginning of the channel list.

Returns
A const iterator to the beginning of the channel list.
const_channel_iterator irc::session::channel_end ( ) const

Returns a const iterator to the end of the channel list.

Returns
A const iterator to the end of the channel list.
template<typename F >
bsig::connection irc::session::connect_on_join_channel ( F &&  f)

Connect to the on_join_channel signal.

This signal is triggered when an user joins an IRC channel.

Parameters
fA callback function with the following signature:
void f(irc::channel& chan)
Returns
The connection object to disconnect from the signal.
template<typename F >
bsig::connection irc::session::connect_on_motd ( F &&  f)

Connect to the on_motd signal.

This signal is triggered when receiving the Message Of The Day from the IRC server.

Parameters
fA callback function with the following signature:
void f(std::string msg)
Returns
The connection object to disconnect from the signal.
template<typename F >
bsig::connection irc::session::connect_on_new_user ( F &&  f)

Connect to the on_new_user signal.

Todo:
what is this for?
Parameters
fA callback function with the following signature:
void f(user& u)
Returns
The connection object to disconnect from the signal.
template<typename F >
bsig::connection irc::session::connect_on_notice ( F &&  f)

Connect to the on_notice signal.

This signal is triggered when an irc::command::notice was sent.

Parameters
fA callback function with the following signature:
void f(std::string msg)
Returns
The connection object to disconnect from the signal.
template<typename F >
bsig::connection irc::session::connect_on_user_notice ( F &&  f)

Connect to the on_user_notice signal.

This signal is triggered when an irc::command::notice was sent to an user.

Parameters
fA callback function with the following signature:
void f(user& u, const std::string& msg)
Returns
The connection object to disconnect from the signal.
const_user_iterator irc::session::end_users ( ) const

Returns a const iterator to the end of the user list.

Returns
A const iterator to the end of the user list.
const std::string& irc::session::get_nick ( ) const

Returns the user nick name.

Returns
The user nick name.
user& irc::session::get_self ( )

Returns a reference to our current user details.

Returns
A reference to our current user details.
const user& irc::session::get_self ( ) const

Returns a const reference to our current user details.

Returns
A const reference to our current user details.
See Also
get_self()
void irc::session::stop ( )

Closes the connection.