ObjIRC  Check-in [4e9e1552b6]

Overview
Comment:Add support for handling QUIT.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4e9e1552b600a04f8d4d11ce63a30b6ab1a289091dcf5bc410a0d8add4b543c1
User & Date: js on 2011-09-09 16:46:05
Other Links: manifest | tags
Context
2011-09-09
16:50
Rename splitted to split. check-in: 5e1d907b6c user: js tags: trunk
16:46
Add support for handling QUIT. check-in: 4e9e1552b6 user: js tags: trunk
16:29
Update tests. check-in: 7dcca7532e user: js tags: trunk
Changes

Modified src/IRCConnection.h from [26bbbf5e84] to [7255dcdba9].

38
39
40
41
42
43
44



45
46
47
48
49
50
51
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54







+
+
+







- (void)connectionWasEstablished: (IRCConnection*)connection;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
       joinChannel: (IRCChannel*)channel;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
      leaveChannel: (IRCChannel*)channel
	withReason: (OFString*)reason;
- (void)connection: (IRCConnection*)connection
    didSeeUserQuit: (IRCUser*)user
	withReason: (OFString*)reason;
-  (void)connection: (IRCConnection*)connection
  didReceiveMessage: (OFString*)msg
	   fromUser: (IRCUser*)user
	  inChannel: (IRCChannel*)channel;
-	  (void)connection: (IRCConnection*)connection
  didReceivePrivateMessage: (OFString*)msg

Modified src/IRCConnection.m from [0c31043ae7] to [c0d4a5d2c9].

226
227
228
229
230
231
232



























233
234
235
236
237
238
239
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







			    @selector(connection:didSeeUser:leaveChannel:
			    withReason:)])
				[delegate connection: self
					  didSeeUser: user
					leaveChannel: channel
					  withReason: reason];

			continue;
		}

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

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

			user = [IRCUser IRCUserWithString: who];

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

			if ([delegate respondsToSelector:
			    @selector(connection:didSeeUserQuit:withReason:)])
				[delegate connection: self
				      didSeeUserQuit: user
					  withReason: reason];

			continue;
		}

		/* PRIVMSG */
		if (splitted.count >= 4 &&
		    [[splitted objectAtIndex: 1] isEqual: @"PRIVMSG"]) {
			OFString *from = [splitted objectAtIndex: 0];

Modified tests/test.m from [ef589643ba] to [8868e42d42].

75
76
77
78
79
80
81







82
83
84
85
86
87
88
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95







+
+
+
+
+
+
+







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

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

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