ObjIRC  Check-in [620b9b2a30]

Overview
Comment:Remove the IRCChannels class.

It was only overcomplicating things with no gain at all. Instead,
strings are used to describe channels now and the storage of users in a
channel is inside IRCConnection now.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 620b9b2a3087ddf679bb44eaa5e7e1a688c4cb99ffdc450e1073ab31e693c556
User & Date: js on 2012-11-24 11:56:58
Other Links: manifest | tags
Context
2012-11-28
21:30
Make sure no newlines from parameters are sent. check-in: 2cc7844016 user: js tags: trunk
2012-11-24
11:56
Remove the IRCChannels class. check-in: 620b9b2a30 user: js tags: trunk
10:02
API improvements. check-in: 50a9cc56c6 user: js tags: trunk
Changes

Modified ObjIRC.xcodeproj/project.pbxproj from [85c59ee61f] to [3730054d99].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
		4BBE6ECC1338258D007EE595 /* IRCChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBE6EC81338258D007EE595 /* IRCChannel.h */; };
		4BBE6ECD1338258D007EE595 /* IRCChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE6EC91338258D007EE595 /* IRCChannel.m */; };
		4BBE6ECE1338258D007EE595 /* IRCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBE6ECA1338258D007EE595 /* IRCConnection.h */; };
		4BBE6ECF1338258D007EE595 /* IRCConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE6ECB1338258D007EE595 /* IRCConnection.m */; };
		4BBE6EE313382DAE007EE595 /* IRCUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBE6EE113382DAE007EE595 /* IRCUser.h */; };
		4BBE6EE413382DAE007EE595 /* IRCUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE6EE213382DAE007EE595 /* IRCUser.m */; };
		4BBE6EFA133836A8007EE595 /* ObjIRC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BBE6EB013382479007EE595 /* ObjIRC.framework */; };
		4BBE6EFD133836CC007EE595 /* test.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE6EFB133836C2007EE595 /* test.m */; };
		4BBE6EFF133839F1007EE595 /* ObjFW.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BBE6EFE133839F1007EE595 /* ObjFW.framework */; };









<
<







1
2
3
4
5
6
7
8
9


10
11
12
13
14
15
16
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */


		4BBE6ECE1338258D007EE595 /* IRCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBE6ECA1338258D007EE595 /* IRCConnection.h */; };
		4BBE6ECF1338258D007EE595 /* IRCConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE6ECB1338258D007EE595 /* IRCConnection.m */; };
		4BBE6EE313382DAE007EE595 /* IRCUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBE6EE113382DAE007EE595 /* IRCUser.h */; };
		4BBE6EE413382DAE007EE595 /* IRCUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE6EE213382DAE007EE595 /* IRCUser.m */; };
		4BBE6EFA133836A8007EE595 /* ObjIRC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BBE6EB013382479007EE595 /* ObjIRC.framework */; };
		4BBE6EFD133836CC007EE595 /* test.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE6EFB133836C2007EE595 /* test.m */; };
		4BBE6EFF133839F1007EE595 /* ObjFW.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BBE6EFE133839F1007EE595 /* ObjFW.framework */; };
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
			runOnlyForDeploymentPostprocessing = 1;
		};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
		4BBE6EB013382479007EE595 /* ObjIRC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ObjIRC.framework; sourceTree = BUILT_PRODUCTS_DIR; };
		4BBE6EC713382541007EE595 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
		4BBE6EC81338258D007EE595 /* IRCChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRCChannel.h; path = src/IRCChannel.h; sourceTree = SOURCE_ROOT; };
		4BBE6EC91338258D007EE595 /* IRCChannel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IRCChannel.m; path = src/IRCChannel.m; sourceTree = SOURCE_ROOT; };
		4BBE6ECA1338258D007EE595 /* IRCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRCConnection.h; path = src/IRCConnection.h; sourceTree = SOURCE_ROOT; };
		4BBE6ECB1338258D007EE595 /* IRCConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IRCConnection.m; path = src/IRCConnection.m; sourceTree = SOURCE_ROOT; };
		4BBE6EE113382DAE007EE595 /* IRCUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRCUser.h; path = src/IRCUser.h; sourceTree = SOURCE_ROOT; };
		4BBE6EE213382DAE007EE595 /* IRCUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IRCUser.m; path = src/IRCUser.m; sourceTree = SOURCE_ROOT; };
		4BBE6EE913383659007EE595 /* Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Tests; sourceTree = BUILT_PRODUCTS_DIR; };
		4BBE6EFB133836C2007EE595 /* test.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = test.m; path = tests/test.m; sourceTree = SOURCE_ROOT; };
		4BBE6EFE133839F1007EE595 /* ObjFW.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjFW.framework; path = Library/Frameworks/ObjFW.framework; sourceTree = SDKROOT; };







<
<







38
39
40
41
42
43
44


45
46
47
48
49
50
51
			runOnlyForDeploymentPostprocessing = 1;
		};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
		4BBE6EB013382479007EE595 /* ObjIRC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ObjIRC.framework; sourceTree = BUILT_PRODUCTS_DIR; };
		4BBE6EC713382541007EE595 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };


		4BBE6ECA1338258D007EE595 /* IRCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRCConnection.h; path = src/IRCConnection.h; sourceTree = SOURCE_ROOT; };
		4BBE6ECB1338258D007EE595 /* IRCConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IRCConnection.m; path = src/IRCConnection.m; sourceTree = SOURCE_ROOT; };
		4BBE6EE113382DAE007EE595 /* IRCUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRCUser.h; path = src/IRCUser.h; sourceTree = SOURCE_ROOT; };
		4BBE6EE213382DAE007EE595 /* IRCUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IRCUser.m; path = src/IRCUser.m; sourceTree = SOURCE_ROOT; };
		4BBE6EE913383659007EE595 /* Tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Tests; sourceTree = BUILT_PRODUCTS_DIR; };
		4BBE6EFB133836C2007EE595 /* test.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = test.m; path = tests/test.m; sourceTree = SOURCE_ROOT; };
		4BBE6EFE133839F1007EE595 /* ObjFW.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjFW.framework; path = Library/Frameworks/ObjFW.framework; sourceTree = SDKROOT; };
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
			sourceTree = "<group>";
		};
		4BBE6EB913382479007EE595 /* ObjIRC */ = {
			isa = PBXGroup;
			children = (
				4BBE6F0213383A19007EE595 /* Frameworks */,
				4BBE6EBA1338247A007EE595 /* Supporting Files */,
				4BBE6EC81338258D007EE595 /* IRCChannel.h */,
				4BBE6EC91338258D007EE595 /* IRCChannel.m */,
				4BBE6ECA1338258D007EE595 /* IRCConnection.h */,
				4BBE6ECB1338258D007EE595 /* IRCConnection.m */,
				4BBE6EE113382DAE007EE595 /* IRCUser.h */,
				4BBE6EE213382DAE007EE595 /* IRCUser.m */,
			);
			path = ObjIRC;
			sourceTree = "<group>";







<
<







101
102
103
104
105
106
107


108
109
110
111
112
113
114
			sourceTree = "<group>";
		};
		4BBE6EB913382479007EE595 /* ObjIRC */ = {
			isa = PBXGroup;
			children = (
				4BBE6F0213383A19007EE595 /* Frameworks */,
				4BBE6EBA1338247A007EE595 /* Supporting Files */,


				4BBE6ECA1338258D007EE595 /* IRCConnection.h */,
				4BBE6ECB1338258D007EE595 /* IRCConnection.m */,
				4BBE6EE113382DAE007EE595 /* IRCUser.h */,
				4BBE6EE213382DAE007EE595 /* IRCUser.m */,
			);
			path = ObjIRC;
			sourceTree = "<group>";
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
		4BBE6EAD13382479007EE595 /* Headers */ = {
			isa = PBXHeadersBuildPhase;
			buildActionMask = 2147483647;
			files = (
				4BBE6ECC1338258D007EE595 /* IRCChannel.h in Headers */,
				4BBE6ECE1338258D007EE595 /* IRCConnection.h in Headers */,
				4BBE6EE313382DAE007EE595 /* IRCUser.h in Headers */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXHeadersBuildPhase section */








<







141
142
143
144
145
146
147

148
149
150
151
152
153
154
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
		4BBE6EAD13382479007EE595 /* Headers */ = {
			isa = PBXHeadersBuildPhase;
			buildActionMask = 2147483647;
			files = (

				4BBE6ECE1338258D007EE595 /* IRCConnection.h in Headers */,
				4BBE6EE313382DAE007EE595 /* IRCUser.h in Headers */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXHeadersBuildPhase section */

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
		4BBE6EAB13382479007EE595 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				4BBE6ECD1338258D007EE595 /* IRCChannel.m in Sources */,
				4BBE6ECF1338258D007EE595 /* IRCConnection.m in Sources */,
				4BBE6EE413382DAE007EE595 /* IRCUser.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		4BBE6EE513383659007EE595 /* Sources */ = {
			isa = PBXSourcesBuildPhase;







<







223
224
225
226
227
228
229

230
231
232
233
234
235
236
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
		4BBE6EAB13382479007EE595 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (

				4BBE6ECF1338258D007EE595 /* IRCConnection.m in Sources */,
				4BBE6EE413382DAE007EE595 /* IRCUser.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		4BBE6EE513383659007EE595 /* Sources */ = {
			isa = PBXSourcesBuildPhase;

Deleted src/IRCChannel.h version [7174780e91].

Deleted src/IRCChannel.m version [76bba49af6].

Modified src/IRCConnection.h from [51a0fb5754] to [6d0137034c].

16
17
18
19
20
21
22
23
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
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
80
81
82
83
84
85
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import <ObjFW/OFObject.h>

@class OFString;
@class OFMutableDictionary;
@class OFTCPSocket;
@class IRCConnection;
@class IRCUser;
@class IRCChannel;

#ifndef IRC_CONNECTION_M
@protocol IRCConnectionDelegate <OFObject>
#else
@protocol IRCConnectionDelegate
#endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional
#endif
- (void)connection: (IRCConnection*)connection
    didReceiveLine: (OFString*)line;
- (void)connection: (IRCConnection*)connection
       didSendLine: (OFString*)line;
- (void)connectionWasEstablished: (IRCConnection*)connection;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
       joinChannel: (IRCChannel*)channel;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
      leaveChannel: (IRCChannel*)channel
	    reason: (OFString*)reason;
- (void)connection: (IRCConnection*)connection
        didSeeUser: (IRCUser*)user
  changeNicknameTo: (OFString*)nickname;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
	  kickUser: (OFString*)kickedUser
	   channel: (IRCChannel*)channel
	    reason: (OFString*)reason;
- (void)connection: (IRCConnection*)connection
    didSeeUserQuit: (IRCUser*)user
	    reason: (OFString*)reason;
-  (void)connection: (IRCConnection*)connection
  didReceiveMessage: (OFString*)msg

	       user: (IRCUser*)user
	    channel: (IRCChannel*)channel;
-	  (void)connection: (IRCConnection*)connection
  didReceivePrivateMessage: (OFString*)msg
		      user: (IRCUser*)user;
- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	      user: (IRCUser*)user;
- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice

	      user: (IRCUser*)user
	   channel: (IRCChannel*)channel;
-	   (void)connection: (IRCConnection*)connection
  didReceiveNamesForChannel: (IRCChannel*)channel;
- (void)connectionWasClosed: (IRCConnection*)connection;
@end

@interface IRCConnection: OFObject
{
	OFTCPSocket *sock;
	OFString *server;







|

<
<
<


<
















|


|







|






>
|
<








>
|
<

|







16
17
18
19
20
21
22
23
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
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
80
81
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import <ObjFW/ObjFW.h>




@class IRCConnection;
@class IRCUser;


#ifndef IRC_CONNECTION_M
@protocol IRCConnectionDelegate <OFObject>
#else
@protocol IRCConnectionDelegate
#endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional
#endif
- (void)connection: (IRCConnection*)connection
    didReceiveLine: (OFString*)line;
- (void)connection: (IRCConnection*)connection
       didSendLine: (OFString*)line;
- (void)connectionWasEstablished: (IRCConnection*)connection;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
       joinChannel: (OFString*)channel;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
      leaveChannel: (OFString*)channel
	    reason: (OFString*)reason;
- (void)connection: (IRCConnection*)connection
        didSeeUser: (IRCUser*)user
  changeNicknameTo: (OFString*)nickname;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
	  kickUser: (OFString*)kickedUser
	   channel: (OFString*)channel
	    reason: (OFString*)reason;
- (void)connection: (IRCConnection*)connection
    didSeeUserQuit: (IRCUser*)user
	    reason: (OFString*)reason;
-  (void)connection: (IRCConnection*)connection
  didReceiveMessage: (OFString*)msg
	    channel: (OFString*)channel
	       user: (IRCUser*)user;

-	  (void)connection: (IRCConnection*)connection
  didReceivePrivateMessage: (OFString*)msg
		      user: (IRCUser*)user;
- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	      user: (IRCUser*)user;
- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	   channel: (OFString*)channel
	      user: (IRCUser*)user;

-	   (void)connection: (IRCConnection*)connection
  didReceiveNamesForChannel: (OFString*)channel;
- (void)connectionWasClosed: (IRCConnection*)connection;
@end

@interface IRCConnection: OFObject
{
	OFTCPSocket *sock;
	OFString *server;
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

136
137
138
139
- (OFTCPSocket*)socket;
- (void)sendLine: (OFString*)line;
- (void)sendLineWithFormat: (OFConstantString*)line, ...;
- (void)connect;
- (void)disconnect;
- (void)disconnectWithReason: (OFString*)reason;
- (void)joinChannel: (OFString*)channelName;
- (void)leaveChannel: (IRCChannel*)channel;
- (void)leaveChannel: (IRCChannel*)channel
	      reason: (OFString*)reason;
- (void)sendMessage: (OFString*)msg
	    channel: (IRCChannel*)channel;
- (void)sendMessage: (OFString*)msg
	       user: (OFString*)user;
- (void)sendNotice: (OFString*)notice
	      user: (OFString*)user;
- (void)sendNotice: (OFString*)notice
	   channel: (IRCChannel*)channel;
- (void)kickUser: (OFString*)user
	 channel: (IRCChannel*)channel
	  reason: (OFString*)reason;
- (void)changeNicknameTo: (OFString*)nickname;
- (void)processLine: (OFString*)line;
- (void)handleConnection;

@end

@interface OFObject (IRCConnectionDelegate) <IRCConnectionDelegate>
@end







|
|


<
<
|

|
<
<

|




>




108
109
110
111
112
113
114
115
116
117
118


119
120
121


122
123
124
125
126
127
128
129
130
131
132
- (OFTCPSocket*)socket;
- (void)sendLine: (OFString*)line;
- (void)sendLineWithFormat: (OFConstantString*)line, ...;
- (void)connect;
- (void)disconnect;
- (void)disconnectWithReason: (OFString*)reason;
- (void)joinChannel: (OFString*)channelName;
- (void)leaveChannel: (OFString*)channel;
- (void)leaveChannel: (OFString*)channel
	      reason: (OFString*)reason;
- (void)sendMessage: (OFString*)msg


		 to: (OFString*)to;
- (void)sendNotice: (OFString*)notice
		to: (OFString*)to;


- (void)kickUser: (OFString*)user
	 channel: (OFString*)channel
	  reason: (OFString*)reason;
- (void)changeNicknameTo: (OFString*)nickname;
- (void)processLine: (OFString*)line;
- (void)handleConnection;
- (OFSet*)usersInChannel: (OFString*)channel;
@end

@interface OFObject (IRCConnectionDelegate) <IRCConnectionDelegate>
@end

Modified src/IRCConnection.m from [5544578885] to [002f1423f2].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

#import <ObjFW/OFInvalidEncodingException.h>

#import <ObjFW/macros.h>

#import "IRCConnection.h"
#import "IRCUser.h"
#import "IRCChannel.h"

@implementation IRCConnection
- init
{
	self = [super init];

	@try {







<







32
33
34
35
36
37
38

39
40
41
42
43
44
45

#import <ObjFW/OFInvalidEncodingException.h>

#import <ObjFW/macros.h>

#import "IRCConnection.h"
#import "IRCUser.h"


@implementation IRCConnection
- init
{
	self = [super init];

	@try {
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
{
	if (reason == nil)
		[self sendLine: @"QUIT"];
	else
		[self sendLineWithFormat: @"QUIT :%@", reason];
}

- (void)joinChannel: (OFString*)channelName
{
	[self sendLineWithFormat: @"JOIN %@", channelName];
}

- (void)leaveChannel: (IRCChannel*)channel
{
	[self leaveChannel: channel
		    reason: nil];
}

- (void)leaveChannel: (IRCChannel*)channel
	      reason: (OFString*)reason
{
	if (reason == nil)
		[self sendLineWithFormat: @"PART %@", [channel name]];
	else
		[self sendLineWithFormat: @"PART %@ :%@",
					  [channel name], reason];

	[channels removeObjectForKey: [channel name]];
}

- (void)sendLine: (OFString*)line
{
	[delegate connection: self
		 didSendLine: line];








|

|


|





|



|

|
<

|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165

166
167
168
169
170
171
172
173
174
{
	if (reason == nil)
		[self sendLine: @"QUIT"];
	else
		[self sendLineWithFormat: @"QUIT :%@", reason];
}

- (void)joinChannel: (OFString*)channel
{
	[self sendLineWithFormat: @"JOIN %@", channel];
}

- (void)leaveChannel: (OFString*)channel
{
	[self leaveChannel: channel
		    reason: nil];
}

- (void)leaveChannel: (OFString*)channel
	      reason: (OFString*)reason
{
	if (reason == nil)
		[self sendLineWithFormat: @"PART %@", channel];
	else
		[self sendLineWithFormat: @"PART %@ :%@", channel, reason];


	[channels removeObjectForKey: channel];
}

- (void)sendLine: (OFString*)line
{
	[delegate connection: self
		 didSendLine: line];

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

	[self sendLine: line];

	[pool release];
}

- (void)sendMessage: (OFString*)msg
	    channel: (IRCChannel*)channel
{
	[self sendLineWithFormat: @"PRIVMSG %@ :%@", [channel name], msg];
}

- (void)sendMessage: (OFString*)msg
	       user: (OFString*)user
{
	[self sendLineWithFormat: @"PRIVMSG %@ :%@", user, msg];
}

- (void)sendNotice: (OFString*)notice
	      user: (OFString*)user
{
	[self sendLineWithFormat: @"NOTICE %@ :%@", user, notice];
}

- (void)sendNotice: (OFString*)notice
	   channel: (IRCChannel*)channel
{
	[self sendLineWithFormat: @"NOTICE %@ :%@", [channel name], notice];
}

- (void)kickUser: (OFString*)user
	 channel: (IRCChannel*)channel
	  reason: (OFString*)reason
{
	[self sendLineWithFormat: @"KICK %@ %@ :%@",
				  [channel name], user, reason];
}

- (void)changeNicknameTo: (OFString*)nickname_
{
	[self sendLineWithFormat: @"NICK %@", nickname_];
}








<
<
<
<
<
<
|

|



|

|


<
<
<
<
<
<

|


|
<







188
189
190
191
192
193
194






195
196
197
198
199
200
201
202
203
204
205






206
207
208
209
210

211
212
213
214
215
216
217

	[self sendLine: line];

	[pool release];
}

- (void)sendMessage: (OFString*)msg






		 to: (OFString*)to
{
	[self sendLineWithFormat: @"PRIVMSG %@ :%@", to, msg];
}

- (void)sendNotice: (OFString*)notice
		to: (OFString*)to
{
	[self sendLineWithFormat: @"NOTICE %@ :%@", to, notice];
}







- (void)kickUser: (OFString*)user
	 channel: (OFString*)channel
	  reason: (OFString*)reason
{
	[self sendLineWithFormat: @"KICK %@ %@ :%@", channel, user, reason];

}

- (void)changeNicknameTo: (OFString*)nickname_
{
	[self sendLineWithFormat: @"NICK %@", nickname_];
}

260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289

290
291
292
293
294
295
296
297
298

299
300
301
302
303
304
305
	}

	/* JOIN */
	if ([action isEqual: @"JOIN"] && [components count] == 3) {
		OFString *who = [components objectAtIndex: 0];
		OFString *where = [components objectAtIndex: 2];
		IRCUser *user;
		IRCChannel *channel;

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		user = [IRCUser IRCUserWithString: who];

		if ([who hasPrefix: [nickname stringByAppendingString: @"!"]]) {
			channel = [IRCChannel channelWithName: where];
			[channels setObject: channel
				     forKey: where];
		} else
			channel = [channels objectForKey: where];

		[channel IRC_addUser: [user nickname]];

		[delegate connection: self
			  didSeeUser: user
			 joinChannel: channel];

		return;
	}

	/* NAMES reply */
	if ([action isEqual: @"353"] && [components count] >= 6) {

		IRCChannel *channel;
		OFArray *users;
		size_t pos;
		OFEnumerator *enumerator;
		OFString *user;

		channel = [channels
		    objectForKey: [components objectAtIndex: 4]];
		if (channel == nil) {

			/* We did not request that */
			return;
		}

		pos = [[components objectAtIndex: 0] length] +
		    [[components objectAtIndex: 1] length] +
		    [[components objectAtIndex: 2] length] +







|





|





|



|






>
|





<
|
|
>







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281

282
283
284
285
286
287
288
289
290
291
	}

	/* JOIN */
	if ([action isEqual: @"JOIN"] && [components count] == 3) {
		OFString *who = [components objectAtIndex: 0];
		OFString *where = [components objectAtIndex: 2];
		IRCUser *user;
		OFMutableSet *channel;

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		user = [IRCUser IRCUserWithString: who];

		if ([who hasPrefix: [nickname stringByAppendingString: @"!"]]) {
			channel = [OFMutableSet set];
			[channels setObject: channel
				     forKey: where];
		} else
			channel = [channels objectForKey: where];

		[channel addObject: [user nickname]];

		[delegate connection: self
			  didSeeUser: user
			 joinChannel: where];

		return;
	}

	/* NAMES reply */
	if ([action isEqual: @"353"] && [components count] >= 6) {
		OFString *where;
		OFMutableSet *channel;
		OFArray *users;
		size_t pos;
		OFEnumerator *enumerator;
		OFString *user;


		where = [components objectAtIndex: 4];

		if ((channel = [channels objectForKey: where]) == nil) {
			/* We did not request that */
			return;
		}

		pos = [[components objectAtIndex: 0] length] +
		    [[components objectAtIndex: 1] length] +
		    [[components objectAtIndex: 2] length] +
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
		enumerator = [users objectEnumerator];
		while ((user = [enumerator nextObject]) != nil) {
			if ([user hasPrefix: @"@"] || [user hasPrefix: @"+"] ||
			    [user hasPrefix: @"%"] || [user hasPrefix: @"*"])
				user = [user substringWithRange:
				    of_range(1, [user length] - 1)];

			[channel IRC_addUser: user];
		}

		[delegate	   connection: self
		    didReceiveNamesForChannel: channel];

		return;
	}

	/* PART */
	if ([action isEqual: @"PART"] && [components count] >= 3) {
		OFString *who = [components objectAtIndex: 0];
		OFString *where = [components objectAtIndex: 2];
		IRCUser *user;
		IRCChannel *channel;
		OFString *reason = nil;
		size_t pos = [who length] + 1 +
		    [[components objectAtIndex: 1] length] + 1 + [where length];

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		user = [IRCUser IRCUserWithString: who];
		channel = [channels objectForKey: where];

		if ([components count] > 3)
			reason = [line substringWithRange:
			    of_range(pos + 2, [line length] - pos - 2)];

		[channel IRC_removeUser: [user nickname]];

		[delegate connection: self
			  didSeeUser: user
			leaveChannel: channel
			      reason: reason];

		return;
	}

	/* KICK */
	if ([action isEqual: @"KICK"] && [components count] >= 4) {
		OFString *who = [components objectAtIndex: 0];
		OFString *where = [components objectAtIndex: 2];
		OFString *whom = [components objectAtIndex: 3];
		IRCUser *user;
		IRCChannel *channel;
		OFString *reason = nil;
		size_t pos = [who length] + 1 +
		    [[components objectAtIndex: 1] length] + 1 +
		    [where length] + 1 + [whom length];

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		user = [IRCUser IRCUserWithString: who];
		channel = [channels objectForKey: where];

		if ([components count] > 4)
			reason = [line substringWithRange:
			    of_range(pos + 2, [line length] - pos - 2)];

		[channel IRC_removeUser: [user nickname]];

		[delegate connection: self
			  didSeeUser: user
			    kickUser: whom
			     channel: channel
			      reason: reason];

		return;
	}

	/* QUIT */
	if ([action isEqual: @"QUIT"] && [components count] >= 2) {
		OFString *who = [components objectAtIndex: 0];
		IRCUser *user;
		OFString *reason = nil;
		size_t pos = [who length] + 1 +
		    [[components objectAtIndex: 1] length];
		OFEnumerator *enumerator;
		IRCChannel *channel;

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		user = [IRCUser IRCUserWithString: who];

		if ([components count] > 2)
			reason = [line substringWithRange:
			    of_range(pos + 2, [line length] - pos - 2)];

		enumerator = [channels keyEnumerator];
		while ((channel = [enumerator nextObject]) != nil)
			[channel IRC_removeUser: [user nickname]];

		[delegate connection: self
		      didSeeUserQuit: user
			      reason: reason];

		return;
	}

	/* NICK */
	if ([action isEqual: @"NICK"] && [components count] == 3) {
		OFString *who = [components objectAtIndex: 0];
		OFString *newNickname = [components objectAtIndex: 2];
		IRCUser *user;
		OFEnumerator *enumerator;
		IRCChannel *channel;

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		newNickname = [newNickname substringWithRange:
		    of_range(1, [newNickname length] - 1)];

		user = [IRCUser IRCUserWithString: who];

		if ([[user nickname] isEqual: nickname]) {
			[nickname release];
			nickname = [[user nickname] copy];
		}

		enumerator = [channels keyEnumerator];
		while ((channel = [enumerator nextObject]) != nil) {
			if ([[channel users] containsObject: [user nickname]]) {
				[channel IRC_removeUser: [user nickname]];
				[channel IRC_addUser: newNickname];
			}
		}

		[delegate connection: self
			  didSeeUser: user
		    changeNicknameTo: newNickname];








|



|









|












|



|











|













|




|













|








|

|














|














|
|
|







299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
		enumerator = [users objectEnumerator];
		while ((user = [enumerator nextObject]) != nil) {
			if ([user hasPrefix: @"@"] || [user hasPrefix: @"+"] ||
			    [user hasPrefix: @"%"] || [user hasPrefix: @"*"])
				user = [user substringWithRange:
				    of_range(1, [user length] - 1)];

			[channel addObject: user];
		}

		[delegate	   connection: self
		    didReceiveNamesForChannel: where];

		return;
	}

	/* PART */
	if ([action isEqual: @"PART"] && [components count] >= 3) {
		OFString *who = [components objectAtIndex: 0];
		OFString *where = [components objectAtIndex: 2];
		IRCUser *user;
		OFMutableSet *channel;
		OFString *reason = nil;
		size_t pos = [who length] + 1 +
		    [[components objectAtIndex: 1] length] + 1 + [where length];

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		user = [IRCUser IRCUserWithString: who];
		channel = [channels objectForKey: where];

		if ([components count] > 3)
			reason = [line substringWithRange:
			    of_range(pos + 2, [line length] - pos - 2)];

		[channel removeObject: [user nickname]];

		[delegate connection: self
			  didSeeUser: user
			leaveChannel: where
			      reason: reason];

		return;
	}

	/* KICK */
	if ([action isEqual: @"KICK"] && [components count] >= 4) {
		OFString *who = [components objectAtIndex: 0];
		OFString *where = [components objectAtIndex: 2];
		OFString *whom = [components objectAtIndex: 3];
		IRCUser *user;
		OFMutableSet *channel;
		OFString *reason = nil;
		size_t pos = [who length] + 1 +
		    [[components objectAtIndex: 1] length] + 1 +
		    [where length] + 1 + [whom length];

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		user = [IRCUser IRCUserWithString: who];
		channel = [channels objectForKey: where];

		if ([components count] > 4)
			reason = [line substringWithRange:
			    of_range(pos + 2, [line length] - pos - 2)];

		[channel removeObject: [user nickname]];

		[delegate connection: self
			  didSeeUser: user
			    kickUser: whom
			     channel: where
			      reason: reason];

		return;
	}

	/* QUIT */
	if ([action isEqual: @"QUIT"] && [components count] >= 2) {
		OFString *who = [components objectAtIndex: 0];
		IRCUser *user;
		OFString *reason = nil;
		size_t pos = [who length] + 1 +
		    [[components objectAtIndex: 1] length];
		OFEnumerator *enumerator;
		OFMutableSet *channel;

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		user = [IRCUser IRCUserWithString: who];

		if ([components count] > 2)
			reason = [line substringWithRange:
			    of_range(pos + 2, [line length] - pos - 2)];

		enumerator = [channels objectEnumerator];
		while ((channel = [enumerator nextObject]) != nil)
			[channel removeObject: [user nickname]];

		[delegate connection: self
		      didSeeUserQuit: user
			      reason: reason];

		return;
	}

	/* NICK */
	if ([action isEqual: @"NICK"] && [components count] == 3) {
		OFString *who = [components objectAtIndex: 0];
		OFString *newNickname = [components objectAtIndex: 2];
		IRCUser *user;
		OFEnumerator *enumerator;
		OFMutableSet *channel;

		who = [who substringWithRange: of_range(1, [who length] - 1)];
		newNickname = [newNickname substringWithRange:
		    of_range(1, [newNickname length] - 1)];

		user = [IRCUser IRCUserWithString: who];

		if ([[user nickname] isEqual: nickname]) {
			[nickname release];
			nickname = [[user nickname] copy];
		}

		enumerator = [channels keyEnumerator];
		while ((channel = [enumerator nextObject]) != nil) {
			if ([channel containsObject: [user nickname]]) {
				[channel removeObject: [user nickname]];
				[channel addObject: newNickname];
			}
		}

		[delegate connection: self
			  didSeeUser: user
		    changeNicknameTo: newNickname];

458
459
460
461
462
463
464
465
466
467
468
469
470
471

472
473
474
475
476
477
478
479
480
481

		from = [from substringWithRange:
		    of_range(1, [from length] - 1)];
		msg = [line substringWithRange:
		    of_range(pos + 2, [line length] - pos - 2)];
		user = [IRCUser IRCUserWithString: from];

		if (![to isEqual: nickname]) {
			IRCChannel *channel;

			channel = [channels objectForKey: to];

			[delegate connection: self
			   didReceiveMessage: msg

					user: user
				     channel: channel];
		} else
			[delegate	  connection: self
			    didReceivePrivateMessage: msg
						user: user];

		return;
	}








|
<
<
<
<


>
|
<
|







444
445
446
447
448
449
450
451




452
453
454
455

456
457
458
459
460
461
462
463

		from = [from substringWithRange:
		    of_range(1, [from length] - 1)];
		msg = [line substringWithRange:
		    of_range(pos + 2, [line length] - pos - 2)];
		user = [IRCUser IRCUserWithString: from];

		if (![to isEqual: nickname])




			[delegate connection: self
			   didReceiveMessage: msg
				     channel: to
					user: user];

		else
			[delegate	  connection: self
			    didReceivePrivateMessage: msg
						user: user];

		return;
	}

496
497
498
499
500
501
502
503
504
505
506
507
508
509

510
511
512
513
514
515
516
517
518
519
		if (![from containsString: @"!"] || [to isEqual: @"*"]) {
			/* System message - ignore for now */
			return;
		}

		user = [IRCUser IRCUserWithString: from];

		if (![to isEqual: nickname]) {
			IRCChannel *channel;

			channel = [channels objectForKey: to];

			[delegate connection: self
			    didReceiveNotice: notice

					user: user
				     channel: channel];
		} else
			[delegate connection: self
			    didReceiveNotice: notice
					user: user];

		return;
	}
}







|
<
<
<
<


>
|
<
|







478
479
480
481
482
483
484
485




486
487
488
489

490
491
492
493
494
495
496
497
		if (![from containsString: @"!"] || [to isEqual: @"*"]) {
			/* System message - ignore for now */
			return;
		}

		user = [IRCUser IRCUserWithString: from];

		if (![to isEqual: nickname])




			[delegate connection: self
			    didReceiveNotice: notice
				     channel: to
					user: user];

		else
			[delegate connection: self
			    didReceiveNotice: notice
					user: user];

		return;
	}
}
563
564
565
566
567
568
569





570
571
572
573
574
575
576

- (void)handleConnection
{
	[sock asyncReadLineWithTarget: self
			     selector: @selector(connection:didReceiveLine:
					   exception:)];
}






- (void)dealloc
{
	[sock release];
	[server release];
	[nickname release];
	[username release];







>
>
>
>
>







541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559

- (void)handleConnection
{
	[sock asyncReadLineWithTarget: self
			     selector: @selector(connection:didReceiveLine:
					   exception:)];
}

- (OFSet*)usersInChannel: (OFString*)channel
{
	return [[[channels objectForKey: channel] copy] autorelease];
}

- (void)dealloc
{
	[sock release];
	[server release];
	[nickname release];
	[username release];
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633

634
635
636
637
638
639
640
641
642
643
644
645
646

647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666

- (void)connectionWasEstablished: (IRCConnection*)connection
{
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
       joinChannel: (IRCChannel*)channel
{
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
      leaveChannel: (IRCChannel*)channel
	    reason: (OFString*)reason
{
}

- (void)connection: (IRCConnection*)connection
        didSeeUser: (IRCUser*)user
  changeNicknameTo: (OFString*)nickname
{
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
	  kickUser: (OFString*)kickedUser
	   channel: (IRCChannel*)channel
	    reason: (OFString*)reason
{
}

- (void)connection: (IRCConnection*)connection
    didSeeUserQuit: (IRCUser*)user
	    reason: (OFString*)reason
{
}

-  (void)connection: (IRCConnection*)connection
  didReceiveMessage: (OFString*)msg

	   fromUser: (IRCUser*)user
	    channel: (IRCChannel*)channel
{
}

-	  (void)connection: (IRCConnection*)connection
  didReceivePrivateMessage: (OFString*)msg
		      user: (IRCUser*)user
{
}

- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice

	      user: (IRCUser*)user
{
}

- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	      user: (IRCUser*)user
	   channel: (IRCChannel*)channel
{
}

-	   (void)connection: (IRCConnection*)connection
  didReceiveNamesForChannel: (IRCChannel*)channel
{
}

- (void)connectionWasClosed: (IRCConnection*)connection
{
}
@end







|





|













|












>
|
<











>







<




|







577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618

619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637

638
639
640
641
642
643
644
645
646
647
648
649

- (void)connectionWasEstablished: (IRCConnection*)connection
{
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
       joinChannel: (OFString*)channel
{
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
      leaveChannel: (OFString*)channel
	    reason: (OFString*)reason
{
}

- (void)connection: (IRCConnection*)connection
        didSeeUser: (IRCUser*)user
  changeNicknameTo: (OFString*)nickname
{
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
	  kickUser: (OFString*)kickedUser
	   channel: (OFString*)channel
	    reason: (OFString*)reason
{
}

- (void)connection: (IRCConnection*)connection
    didSeeUserQuit: (IRCUser*)user
	    reason: (OFString*)reason
{
}

-  (void)connection: (IRCConnection*)connection
  didReceiveMessage: (OFString*)msg
	    channel: (OFString*)channel
	       user: (IRCUser*)user

{
}

-	  (void)connection: (IRCConnection*)connection
  didReceivePrivateMessage: (OFString*)msg
		      user: (IRCUser*)user
{
}

- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	   channel: (OFString*)channel
	      user: (IRCUser*)user
{
}

- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	      user: (IRCUser*)user

{
}

-	   (void)connection: (IRCConnection*)connection
  didReceiveNamesForChannel: (OFString*)channel
{
}

- (void)connectionWasClosed: (IRCConnection*)connection
{
}
@end

Modified src/ObjIRC.h from [420f307273] to [e4e9a73d8b].

17
18
19
20
21
22
23
24
25
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "IRCConnection.h"
#import "IRCChannel.h"
#import "IRCUser.h"







<

17
18
19
20
21
22
23

24
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "IRCConnection.h"

#import "IRCUser.h"

Modified tests/test.m from [3268827b82] to [4612327517].

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#import <ObjFW/OFString.h>
#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







<







22
23
24
25
26
27
28

29
30
31
32
33
34
35

#import <ObjFW/OFString.h>
#import <ObjFW/OFApplication.h>
#import <ObjFW/OFFile.h>

#import "IRCConnection.h"
#import "IRCUser.h"


@interface TestApp: OFObject
@end

OF_APPLICATION_DELEGATE(TestApp)

@implementation TestApp
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139

140
141
- (void)connectionWasEstablished: (IRCConnection*)connection
{
	[connection joinChannel: @"#objfw"];
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
       joinChannel: (IRCChannel*)channel
{
	of_log(@"%@ joined %@.", user, channel);
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
      leaveChannel: (IRCChannel*)channel
	withReason: (OFString*)reason
{
	of_log(@"%@ left %@ (%@).", user, channel, reason);
}

-    (void)connection: (IRCConnection*)connection
	   didSeeUser: (IRCUser*)user
	     kickUser: (OFString*)kickedUser
	  fromChannel: (IRCChannel*)channel
	   withReason: (OFString*)reason
{
	of_log(@"%@ kicked %@ from %@: %@", user, kickedUser, channel, reason);
}

- (void)connection: (IRCConnection*)connection
    didSeeUserQuit: (IRCUser*)user
	withReason: (OFString*)reason
{
	of_log(@"%@ quit (%@).", user, reason);
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
  changeNicknameTo: (OFString *)nickname
{
	of_log(@"%@ changed nick to %@.", user, nickname);
}

-  (void)connection: (IRCConnection*)connection
  didReceiveMessage: (OFString*)msg

	   fromUser: (IRCUser*)user
	  inChannel: (IRCChannel*)channel
{
	of_log(@"[%@] %@: %@", channel, user, msg);
}

-	  (void)connection: (IRCConnection*)connection
  didReceivePrivateMessage: (OFString*)msg
		  fromUser: (IRCUser*)user
{
	of_log(@"(%@): %@", user, msg);
}

- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice

	  fromUser: (IRCUser*)user
{
	of_log(@"NOTICE: (%@): %@", user, notice);
}

- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	  fromUser: (IRCUser*)user
	 inChannel: (IRCChannel*)channel
{
	of_log(@"NOTICE: [%@] %@: %@", channel, user, notice);
}

-	   (void)connection: (IRCConnection*)connection
  didReceiveNamesForChannel: (IRCChannel*)channel
{
	of_log(@"Users in %@: %@", channel, [channel users]);

}
@end







|






|
|







|
|






|













>
|
<

|




|






>
|

|




|
<

|



|

|
>


62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

131
132
133
134
135
136
137
138
139
140
141
- (void)connectionWasEstablished: (IRCConnection*)connection
{
	[connection joinChannel: @"#objfw"];
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
       joinChannel: (OFString*)channel
{
	of_log(@"%@ joined %@.", user, channel);
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
      leaveChannel: (OFString*)channel
	    reason: (OFString*)reason
{
	of_log(@"%@ left %@ (%@).", user, channel, reason);
}

-    (void)connection: (IRCConnection*)connection
	   didSeeUser: (IRCUser*)user
	     kickUser: (OFString*)kickedUser
	      channel: (OFString*)channel
	       reason: (OFString*)reason
{
	of_log(@"%@ kicked %@ from %@: %@", user, kickedUser, channel, reason);
}

- (void)connection: (IRCConnection*)connection
    didSeeUserQuit: (IRCUser*)user
	    reason: (OFString*)reason
{
	of_log(@"%@ quit (%@).", user, reason);
}

- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
  changeNicknameTo: (OFString *)nickname
{
	of_log(@"%@ changed nick to %@.", user, nickname);
}

-  (void)connection: (IRCConnection*)connection
  didReceiveMessage: (OFString*)msg
	    channel: (OFString*)channel
	       user: (IRCUser*)user

{
	of_log(@"[%@] %@: %@", channel, [user nickname], msg);
}

-	  (void)connection: (IRCConnection*)connection
  didReceivePrivateMessage: (OFString*)msg
		      user: (IRCUser*)user
{
	of_log(@"(%@): %@", user, msg);
}

- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	   channel: (OFString*)channel
	      user: (IRCUser*)user
{
	of_log(@"NOTICE: [%@] %@: %@", channel, [user nickname], notice);
}

- (void)connection: (IRCConnection*)connection
  didReceiveNotice: (OFString*)notice
	      user: (IRCUser*)user

{
	of_log(@"NOTICE: (%@): %@", user, notice);
}

-	   (void)connection: (IRCConnection*)connection
  didReceiveNamesForChannel: (OFString*)channel
{
	of_log(@"Users in %@: %@", channel,
	    [connection usersInChannel: channel]);
}
@end