24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#import <ObjFW/OFApplication.h>
#import <ObjFW/OFFile.h>
#import "IRCConnection.h"
#import "IRCUser.h"
#import "IRCChannel.h"
@interface TestApp: OFObject <OFApplicationDelegate, IRCConnectionDelegate>
@end
OF_APPLICATION_DELEGATE(TestApp)
@implementation TestApp
- (void)applicationDidFinishLaunching
{
IRCConnection *connection = [[IRCConnection alloc] init];
connection.server = @"irc.freenode.net";
connection.nickname = @"ObjIRC";
connection.username = @"ObjIRC";
connection.realname = @"ObjIRC";
connection.delegate = self;
[connection connect];
[connection handleConnection];
}
- (void)connection: (IRCConnection*)connection
didReceiveLine: (OFString*)line
|
|
|
|
|
|
|
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#import <ObjFW/OFApplication.h>
#import <ObjFW/OFFile.h>
#import "IRCConnection.h"
#import "IRCUser.h"
#import "IRCChannel.h"
@interface TestApp: OFObject
@end
OF_APPLICATION_DELEGATE(TestApp)
@implementation TestApp
- (void)applicationDidFinishLaunching
{
IRCConnection *connection = [[IRCConnection alloc] init];
[connection setServer: @"irc.freenode.net"];
[connection setNickname: @"ObjIRC"];
[connection setUsername: @"ObjIRC"];
[connection setRealname: @"ObjIRC"];
[connection setDelegate: self];
[connection connect];
[connection handleConnection];
}
- (void)connection: (IRCConnection*)connection
didReceiveLine: (OFString*)line
|
132
133
134
135
136
137
138
139
140
141
|
{
of_log(@"NOTICE: [%@] %@: %@", channel, user, notice);
}
- (void)connection: (IRCConnection*)connection
didReceiveNamesForChannel: (IRCChannel*)channel
{
of_log(@"Users in %@: %@", channel, channel.users);
}
@end
|
|
|
132
133
134
135
136
137
138
139
140
141
|
{
of_log(@"NOTICE: [%@] %@: %@", channel, user, notice);
}
- (void)connection: (IRCConnection*)connection
didReceiveNamesForChannel: (IRCChannel*)channel
{
of_log(@"Users in %@: %@", channel, [channel users]);
}
@end
|