IRCClient: IRCClientSession Class Reference

# IRCClientSession Class Reference

Represents a connected IRC Session. More...

`#import <IRCClientSession.h>`

Inheritance diagram for IRCClientSession:

List of all members.

## Public Member Functions
(int) | - connect
(void) | - disconnect
(bool) | - isConnected
(void) | - run
(int) | - sendRawWithFormat:
(int) | - quit:
(int) | - join:key:
(int) | - list:
(int) | - userMode:
(int) | - nick:
(int) | - whois:
(int) | - message:to:
(int) | - action:to:
(int) | - notice:to:
(int) | - ctcpRequest:target:
(int) | - ctcpReply:target:
## Properties
id | delegate
irc_session_t * | session
NSString * | version
NSString * | server
NSString * | port
NSString * | password
NSString * | nickname
NSString * | username
NSString * | realname
NSMutableDictionary * | channels
NSStringEncoding | encoding

## Detailed Description

Represents a connected IRC Session.

IRCClientSession represents a single connection to an IRC server. On initialising the object, and setting the delegate, server, port, password, nickname, username and realname properties, you call the connect: and run: methods to connect to the IRC server and start a new thread.

This thread then sends messages back to the main runloop to the IRC server delegate, or to the IRCClientChannel delegate as required.

## Member Function Documentation

- (int) action: |  | (NSString *) | action
to: |  | (NSString *) | target |

send a CTCP ACTION to another IRC client

Parameters:

  | action | the action message to send
  | target | the nickname of the irc client to send the message to.

- (int) connect |  |  |  |

Connect to the IRC server.

Note that this performs the initial DNS lookup and the TCP connection, so if there are any problems you will be notified via the return code of the message.

Look at the libircclient documentation for the different return codes.

- (int) ctcpReply: |  | (NSString *) | reply
target: |  | (NSString *) | target |

send a CTCP reply to another IRC client

Parameters:

  | reply | the CTCP reply string to send
  | target | the nickname of the IRC client to send the reply to.

- (int) ctcpRequest: |  | (NSString *) | request
target: |  | (NSString *) | target |

send a CTCP request to another IRC client

Parameters:

  | request | the CTCP request string to send
  | target | the nickname of the IRC client to send the request to.

- (void) disconnect |  |  |  |

Disconnect from the IRC server.

This always works, as it simply shuts down the socket. If you want to disconnect in a friendly way, you should use the quit: message.

- (bool) isConnected |  |  |  |

returns YES if the server is currently connected successfully, and NO if it is not.

- (int) join: |  | (NSString *) | channel
key: |  | (NSString *) | key |

Joins a channel with a given name and key

Parameters:

  | channel | the channel to join
  | key | they key for the channel (may be nil)

- (int) list: |  | (NSString *) | channel |  |

lists channels on the IRC server.

Parameters:

  | channel | a channel name or string to pass to the LIST command. Implementation specific.

- (int) message: |  | (NSString *) | message
to: |  | (NSString *) | target |

send a PRIVMSG to another IRC client

Parameters:

  | message | message to send
  | target | the other IRC client to send the message to.

- (int) nick: |  | (NSString *) | newnick |  |

sets the IRC client nickname. On success, an onNick event will be sent to the delegate

Parameters:

  | newnick | new nickname to set.

- (int) notice: |  | (NSString *) | notice
to: |  | (NSString *) | target |

send a NOTICE to another IRC client

Parameters:

  | notice | the message text to send
  | target | the nickname of the irc client to send the notice to.

- (int) quit: |  | (NSString *) | reason |  |

quits the IRC server with the given reason. On success, an onQuit event will be sent to the IRCClientSessionDelegate with the nickname of the IRC client.

The format is a standard NSString format string, followed by optional arguments.

- (void) run |  |  |  |

Starts a new thread and starts the libircclient runloop, processing events and firing messages back to the main runloop as required. Calling this again will do nothing other than raise a warning in your logs.

- (int) sendRawWithFormat: |  | (NSString *) | format
, |  |  | ... |

Sends a raw message to the IRC server. Please consult rfc1459 for the format of IRC commands.

- (int) userMode: |  | (NSString *) | mode |  |

sets the user mode for the IRC client

Parameters:

  | mode | string to set

- (int) whois: |  | (NSString *) | nick |  |

sends a WHOIS request to the IRC server

Parameters:

  | nick | nickname of the irc client to whois.

## Property Documentation

- (NSMutableDictionary *) channels`[read, assign]`

An NSMutableDictionary of channels that the client is currently connected to.

You should not modify this.

- (id) delegate`[read, write, assign]`

delegate to send events to.

- (NSStringEncoding) encoding`[read, write, assign]`

The default text encoding for messages on this server.

This affects messages received via PRIVMSG and NOTICE, and TOPIC in a channel. You may change this at any time.

- (NSString *) nickname`[read, write, copy]`

Nickname of the connected client. Note that setting this after connection will not result in the client renaming on IRC. You need to send a nick: message instead.

- (NSString *) password`[read, write, copy]`

Server password to provide on connect (may be left empty or nil)

- (NSString *) port`[read, write, copy]`

IRC port to connect to

- (NSString *) realname`[read, write, copy]`

Realname of the connected client.

Setting this after connection does nothing.

- (NSString *) server`[read, write, copy]`

IRC server to connect to

- (irc_session_t *) session`[read, write, assign]`

The underlying libircclient handle

- (NSString *) username`[read, write, copy]`

Username of the connected client. Also known as the ident.

Setting this after connection does nothing.

- (NSString *) version`[read, write, copy]`

The version string for the client to send back on CTCP VERSION requests

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

- IRCClientSession.h
- IRCClientSession.m