Update documentation
This commit is contained in:
parent
554522c5ce
commit
702f7e9ab7
@ -22,14 +22,18 @@
|
|||||||
* IRCClientSession *session = [[IRCClientSession alloc] init];
|
* IRCClientSession *session = [[IRCClientSession alloc] init];
|
||||||
* MyIRCClientSessionDelegate *controller = [[MyIRCClientSessionDelegate alloc] init];
|
* MyIRCClientSessionDelegate *controller = [[MyIRCClientSessionDelegate alloc] init];
|
||||||
*
|
*
|
||||||
* [session setDelegate:controller];
|
* session.delegate = controller;
|
||||||
* [controller setSession:session];
|
* controller.session = session;
|
||||||
*
|
*
|
||||||
* [session setServer:@"irc.dal.net"];
|
* NSData *server = [NSData dataWithBytes:@"chat.freenode.net".UTF8String length:strlen(@"chat.freenode.net".UTF8String.length) + 1];
|
||||||
* [session setPort:@"6667"];
|
* NSUinteger port = 6665;
|
||||||
* [session setNickname:@"test"];
|
* NSData *nickname = [NSData dataWithBytes:@"test".UTF8String length:strlen(@"test".UTF8String) + 1];
|
||||||
* [session setUsername:@"test"];
|
* NSData *username = [NSData dataWithBytes:@"test".UTF8String length:strlen(@"test".UTF8String) + 1];
|
||||||
* [session setRealname:@"test"];
|
* NSData *realname = [NSData dataWithBytes:@"test".UTF8String length:strlen(@"test".UTF8String) + 1];
|
||||||
|
*
|
||||||
|
* [session setServer:server];
|
||||||
|
* [session setPort:port];
|
||||||
|
* [session setNickname:nickname username:username realname:realname];
|
||||||
* [session connect];
|
* [session connect];
|
||||||
*
|
*
|
||||||
* [session run]; //starts the thread
|
* [session run]; //starts the thread
|
||||||
@ -37,8 +41,11 @@
|
|||||||
*
|
*
|
||||||
* \section author Author, copyright, support.
|
* \section author Author, copyright, support.
|
||||||
*
|
*
|
||||||
* If you have any questions, bug reports, suggestions regarding libircclient
|
* If you have questions, bug reports, or suggestions regarding IRCClient,
|
||||||
* or the IRCClient framework, please visit http://libircclient.sourceforge.net
|
* find Obormot on the Freenode IRC network.
|
||||||
|
*
|
||||||
|
* If you have any questions, bug reports, suggestions regarding libircclient,
|
||||||
|
* please visit http://libircclient.sourceforge.net
|
||||||
*
|
*
|
||||||
* <PRE>
|
* <PRE>
|
||||||
* libircclient Copyright (C) 2004-2009 Georgy Yunaev gyunaev@ulduzsoft.com
|
* libircclient Copyright (C) 2004-2009 Georgy Yunaev gyunaev@ulduzsoft.com
|
||||||
@ -64,12 +71,13 @@
|
|||||||
* @brief Represents a connected IRC Session.
|
* @brief Represents a connected IRC Session.
|
||||||
*
|
*
|
||||||
* IRCClientSession represents a single connection to an IRC server. On initialising
|
* IRCClientSession represents a single connection to an IRC server. On initialising
|
||||||
* the object, and setting the delegate, server, port, password, nickname, username and realname
|
* the object, and setting the delegate, server, port, and password (if required)
|
||||||
* properties, you call the connect: and run: methods to connect to the IRC server
|
* properties, and setting the nickname, username and realname using the
|
||||||
* and start a new thread.
|
* setNickname:username:realname: method, 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,
|
* This thread then sends messages to the IRC server delegate,
|
||||||
* or to the IRCClientChannel delegate as required.
|
* or to the IRCClientChannel delegate, as required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
@ -90,7 +98,10 @@
|
|||||||
*/
|
*/
|
||||||
@property (assign) NSUInteger sessionID;
|
@property (assign) NSUInteger sessionID;
|
||||||
|
|
||||||
/** The version string for the client to send back on CTCP VERSION requests */
|
/** The version string for the client to send back on CTCP VERSION requests.
|
||||||
|
There is usually no reason to set this, as IRCClient correctly sets its
|
||||||
|
own version string automatically, but this can be any string you like.
|
||||||
|
*/
|
||||||
@property (copy) NSData *version;
|
@property (copy) NSData *version;
|
||||||
|
|
||||||
/** IRC server to connect to */
|
/** IRC server to connect to */
|
||||||
@ -116,8 +127,10 @@
|
|||||||
|
|
||||||
/** The suggested text encoding for messages on this server.
|
/** The suggested text encoding for messages on this server.
|
||||||
|
|
||||||
This concerns messages received via PRIVMSG and NOTICE, and TOPIC in a channel.
|
This is almost entirely irrelevant (except for CTCP TIME replies), as
|
||||||
It also affects what encoding reasons given for QUIT messages are assumed to be in.
|
all messages and other strings are taken and returned as C strings
|
||||||
|
encapsulated in NSData objects. This property is for your convenience.
|
||||||
|
|
||||||
You may change this at any time.
|
You may change this at any time.
|
||||||
*/
|
*/
|
||||||
@property (assign) NSStringEncoding encoding;
|
@property (assign) NSStringEncoding encoding;
|
||||||
@ -271,8 +284,22 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/*************************************/
|
||||||
|
#pragma mark - Useful helper functions
|
||||||
|
/*************************************/
|
||||||
|
|
||||||
|
/** Returns the nick part of a nick!user@host string.
|
||||||
|
*/
|
||||||
NSData* getNickFromNickUserHost(NSData *nuh);
|
NSData* getNickFromNickUserHost(NSData *nuh);
|
||||||
|
|
||||||
|
/** Returns the user part of a nick!user@host string.
|
||||||
|
Returns nil if the user component can't be found (i.e. if the passed string
|
||||||
|
is not, in fact, in nick!user@host format).
|
||||||
|
*/
|
||||||
NSData* getUserFromNickUserHost(NSData *nuh);
|
NSData* getUserFromNickUserHost(NSData *nuh);
|
||||||
|
|
||||||
|
/** Returns the host part of a nick!user@host string.
|
||||||
|
Returns nil if the host component can't be found (i.e. if the passed string
|
||||||
|
is not, in fact, in nick!user@host format).
|
||||||
|
*/
|
||||||
NSData* getHostFromNickUserHost(NSData *nuh);
|
NSData* getHostFromNickUserHost(NSData *nuh);
|
||||||
|
|||||||
@ -156,7 +156,7 @@ static NSDictionary* ircNumericCodeList;
|
|||||||
unsigned int high, low;
|
unsigned int high, low;
|
||||||
irc_get_version (&high, &low);
|
irc_get_version (&high, &low);
|
||||||
|
|
||||||
NSString* versionString = [NSString stringWithFormat:@"IRCClient Framework v%s (Said Achmiz) - libirc v%d.%d (George Yunaev)", IRCCLIENTVERSION, high, low];
|
NSString* versionString = [NSString stringWithFormat:@"IRCClient Framework v%s (Said Achmiz) - libirc v%d.%d (Georgy Yunaev)", IRCCLIENTVERSION, high, low];
|
||||||
_version = [NSData dataWithBytes:versionString.UTF8String length:versionString.length];
|
_version = [NSData dataWithBytes:versionString.UTF8String length:versionString.length];
|
||||||
|
|
||||||
_channels = [[NSMutableDictionary alloc] init];
|
_channels = [[NSMutableDictionary alloc] init];
|
||||||
@ -543,7 +543,7 @@ NSData* getNickFromNickUserHost(NSData *nuh)
|
|||||||
[nuh getBytes:nick_user_host_buf];
|
[nuh getBytes:nick_user_host_buf];
|
||||||
|
|
||||||
char *nick_buf;
|
char *nick_buf;
|
||||||
nick_buf = strtok(nick_user_host_buf, "!@");
|
nick_buf = strtok(nick_user_host_buf, "!");
|
||||||
|
|
||||||
NSData* nick = (nick_buf != NULL) ? [NSData dataWithBytes:nick_buf length:strlen(nick_buf) + 1] : nil;
|
NSData* nick = (nick_buf != NULL) ? [NSData dataWithBytes:nick_buf length:strlen(nick_buf) + 1] : nil;
|
||||||
|
|
||||||
@ -558,8 +558,8 @@ NSData* getUserFromNickUserHost(NSData *nuh)
|
|||||||
[nuh getBytes:nick_user_host_buf];
|
[nuh getBytes:nick_user_host_buf];
|
||||||
|
|
||||||
char *nick_buf, *user_buf;
|
char *nick_buf, *user_buf;
|
||||||
nick_buf = strtok(nick_user_host_buf, "!@");
|
nick_buf = strtok(nick_user_host_buf, "!");
|
||||||
user_buf = strtok(NULL, "!@");
|
user_buf = strtok(NULL, "@");
|
||||||
|
|
||||||
NSData* user = (user_buf != NULL) ? [NSData dataWithBytes:user_buf length:strlen(user_buf) + 1] : nil;
|
NSData* user = (user_buf != NULL) ? [NSData dataWithBytes:user_buf length:strlen(user_buf) + 1] : nil;
|
||||||
|
|
||||||
@ -574,9 +574,9 @@ NSData* getHostFromNickUserHost(NSData *nuh)
|
|||||||
[nuh getBytes:nick_user_host_buf];
|
[nuh getBytes:nick_user_host_buf];
|
||||||
|
|
||||||
char *nick_buf, *user_buf, *host_buf;
|
char *nick_buf, *user_buf, *host_buf;
|
||||||
nick_buf = strtok(nick_user_host_buf, "!@");
|
nick_buf = strtok(nick_user_host_buf, "!");
|
||||||
user_buf = strtok(NULL, "!@");
|
user_buf = strtok(NULL, "@");
|
||||||
host_buf = strtok(NULL, "!@");
|
host_buf = strtok(NULL, "");
|
||||||
|
|
||||||
NSData* host = (host_buf != NULL) ? [NSData dataWithBytes:host_buf length:strlen(host_buf) + 1] : nil;
|
NSData* host = (host_buf != NULL) ? [NSData dataWithBytes:host_buf length:strlen(host_buf) + 1] : nil;
|
||||||
|
|
||||||
|
|||||||
16
README
16
README
@ -2,7 +2,7 @@ This is a modified version of the IRCClient framework by Nathan Ollerenshaw. I
|
|||||||
|
|
||||||
- Said Achmiz
|
- Said Achmiz
|
||||||
|
|
||||||
—
|
---
|
||||||
|
|
||||||
ADDING IRCCLIENT TO YOUR APPLICATION
|
ADDING IRCCLIENT TO YOUR APPLICATION
|
||||||
(using Xcode)
|
(using Xcode)
|
||||||
@ -32,7 +32,7 @@ ADDING IRCCLIENT TO YOUR APPLICATION
|
|||||||
|
|
||||||
6. Import IRCClient’s API into your code using “#import <IRCClient/IRCClient.h>”
|
6. Import IRCClient’s API into your code using “#import <IRCClient/IRCClient.h>”
|
||||||
|
|
||||||
—
|
---
|
||||||
|
|
||||||
See the following header files for documentation:
|
See the following header files for documentation:
|
||||||
|
|
||||||
@ -40,3 +40,15 @@ IRCClientSession.h
|
|||||||
IRCClientSessionDelegate.h
|
IRCClientSessionDelegate.h
|
||||||
IRCClientChannel.h
|
IRCClientChannel.h
|
||||||
IRCClientChannelDelegate.h
|
IRCClientChannelDelegate.h
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
NOTE on strings:
|
||||||
|
|
||||||
|
IRCClient stores and passes all strings (messages, nicks, channel names, mode strings, channel topics, etc.) as NSData objects, which contain null-terminated C strings. Values passed to framework methods (such as the IRC commands) should also be in this format[1]. This means that IRCClient is encoding-agnostic[2]; it is up to you to pass it properly encoded C-string representations of your text strings, and it is also up to you to select an appropriate encoding for display or other handling of received strings, as necessary. The 'encoding' property of IRCClientSession and IRCClientChannel may be useful in this regard (i.e. for the convenience associating a server's or channel's preferred encoding with the relevant server or channel object), although note that this property is almost entirely epiphenomenal[3].
|
||||||
|
|
||||||
|
[1] Although note that if you pass unterminated strings instead, IRCClient will add the null termination for you - but there is a slight performance penalty for this, so be sure to null-terminate the contents of your NSData objects, for optimal performance.
|
||||||
|
|
||||||
|
[2] Of course, IRCClient does not support UTF-16 nor any other non-8-bit encoding (since the byte representations of such encodings may contain nulls, and therefore cannot be used as C strings), but the IRC protocol does not support such encodings either.
|
||||||
|
|
||||||
|
[3] The 'encoding' property of IRCClientSession does have one effect: it controls the encoding used by replies to CTCP TIME requests.
|
||||||
Loading…
Reference in New Issue
Block a user