Home | All Classes | Grouped Classes | Index | Search

Class CL_IRCConnection

IRC Connection class. More...

Derived from: none
Derived by: none
Group: Network (Internet Relay Chat)

#include <ClanLib/network.h>

Construction:

CL_IRCConnection

Constructs a CL_IRCConnection and connects a server.

Attributes:

get_nick

Returns our current nick name.

get_username

Returns the username passed to send_user.

get_hostname

Returns hostname passed to send_user.

get_servername

Returns server name passed to send_user.

get_realname

Returns the real name passed to send_user.

Operations:

operator =

send_command

Send command to IRC server.

send_pass

Send password.

send_nick

Send nick.

send_user

Send user login/identify command.

send_oper

Send operator login command

send_quit

Send quit command.

send_join

Send join channel command.

send_part

Send part channel command.

send_mode

Send set mode command.

send_topic

Set/Get topic on channel.

send_names

List nicks on channel(s).

send_list

Send list of channels.

send_invite

Send channel join invitation.

send_kick

Send kick command

send_version

Send version command.

send_stats

Send statistics command.

send_links

Send links command.

send_time

Send time command.

send_connect

Send connect command.

send_trace

Send trace command.

send_admin

Send admin command.

send_info

Send info command.

send_privmsg

Send channel message or private message.

send_privmsg_ctcp

Send Client To Client Protocol (CTCP) message.

send_notice

Send notice message.

send_notice_ctcp

Send Client To Client Protocol (CTCP) notice.

send_who

Send who command.

send_whois

Send whois command.

send_whowas

Send whowas command.

send_kill

Send kill command.

send_ping

Send ping command

send_pong

Send pong command

extract_nick

Extracts nick part of a fully qualified IRC prefix.

extract_user

Extracts user part of a fully qualified IRC prefix.

extract_address

Extracts address part of a fully qualified IRC prefix.

Signals:

sig_socket_error

sig_socket_error(error_message)

sig_command_received

sig_command_received(prefix, command, params)

sig_unknown_command_received

sig_unknown_command_received(prefix, command, params)

sig_numeric_reply

sig_numeric_reply(prefix, code, params)

sig_name_reply

sig_name_reply(self, channel, users)

sig_nick

sig_nick(old_nick, new_nick)

sig_join

sig_join(nick, channel)

sig_part

sig_part(nick, channel, reason)

sig_mode

sig_mode(prefix, receiver, mode, params)

sig_topic

sig_topic(prefix, channel, topic)

sig_invite

sig_invite(prefix, nick, channel)

sig_kick

sig_kick(prefix, chan, user, comment)

sig_privmsg

sig_privmsg(prefix, receiver, text)

sig_notice

sig_notice(prefix, receiver, text)

sig_privmsg_ctcp

sig_privmsg_ctcp(prefix, receiver, command, data)

sig_notice_ctcp

sig_notice_ctcp(prefix, receiver, command, data)

sig_ping

sig_ping(daemon1, daemon2)

Detailed description:

!group=Network/Internet Relay Chat! !header=network.h!

The CL_IRCConnection class represents a socket connection to an IRC server. Upon construction it will connect to the server+port given and then parse each line written by the IRC server. Each time CL_System::keep_alive() is called, the CL_IRCConnection will emit the signals for those commands received.

Most IRC networks will expect the connecting IRC client to first send a "nick" command and then a "user" command, as part of the logon process. CL_IRCConnection will not do this, so the general logon procedure looks somewhat like this:

  CL_IRCConnection connection("irc.freenode.net", "6667");
  connection.send_nick("MyNick");
  connection.send_user("username", "our.hostname", "irc.freenode.net", "User Name");
  

IRC servers will occationally send a "ping" line, which have to be replied with a "pong" command. If this isn't done within some server specific timeout, the IRC network will disconnect the client. CL_IRCConnection will also not do this automatically, so its important you at least hook up the ping slot, to a function looking like this:

  void on_ping(const std::string &daemon1, const std::string &daemon2)
  { connection.send_pong(daemon1, daemon2); }
  


Questions or comments, write to the
ClanLib mailing list.