40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
-
+
+
+
+
+
+
+
+
|
[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
{
[of_stderr writeFormat: @"> %@\n", line];
}
- (void)connection: (IRCConnection*)connection
didSendLine: (OFString*)line
{
[of_stderr writeFormat: @"< %@\n", line];
}
- (void)connectionWasEstablished: (IRCConnection*)connection
{
[connection joinChannel: @"#objfw"];
}
- (void)connection: (IRCConnection *)connection
didFailToConnectWithException: (id)exception
{
[of_stderr writeFormat: @"Failed to connect: %@\n", exception];
[OFApplication terminateWithStatus: 1];
}
- (void)connection: (IRCConnection*)connection
didSeeUser: (IRCUser*)user
joinChannel: (OFString*)channel
{
of_log(@"%@ joined %@.", user, channel);
}
|