ObjIRC  Check-in [6f062f7189]

Overview
Comment:Add support for parsing KICK.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6f062f71896107c8ddd1d66fd649f6e7d15e0b6704072eb28bc9ba00582bd4e8
User & Date: js on 2011-09-10 13:40:49
Other Links: manifest | tags
Context
2011-09-10
19:59
Add support for sending notices. check-in: 84aa37ee2e user: js tags: trunk
13:40
Add support for parsing KICK. check-in: 6f062f7189 user: js tags: trunk
13:11
Add support for parsing NOTICE. check-in: e7642f3cbb user: js tags: trunk
Changes

Modified src/IRCConnection.h from [1a418d58d3] to [42875301de].

43
44
45
46
47
48
49





50
51
52
53
54
55
56
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61







+
+
+
+
+







	didSeeUser: (IRCUser*)user
      leaveChannel: (IRCChannel*)channel
	withReason: (OFString*)reason;
- (void)connection: (IRCConnection*)connection
        didSeeUser: (IRCUser*)user
  changeNicknameTo: (OFString*)nickname;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
	  kickUser: (OFString*)kickedUser
       fromChannel: (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

Modified src/IRCConnection.m from [20dac0f662] to [ca6d7e7dd4].

240
241
242
243
244
245
246

































247
248
249
250
251
252
253
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286







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







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

			continue;
		}

		/* KICK */
		if ([action isEqual: @"KICK"] && split.count >= 4) {
			OFString *who = [split objectAtIndex: 0];
			OFString *where = [split objectAtIndex: 2];
			OFString *whom = [split objectAtIndex: 3];
			IRCUser *user;
			IRCChannel *channel;
			OFString *reason = nil;
			size_t pos = who.length + 1 +
			    [[split 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 (split.count > 4)
				reason = [line substringWithRange:
				    of_range(pos + 2, line.length - pos - 2)];

			if ([delegate respondsToSelector:
			    @selector(connection:didSeeUser:kickUser:
			    fromChannel:withReason:)])
				[delegate connection: self
					  didSeeUser: user
					    kickUser: whom
					 fromChannel: channel
					  withReason: reason];

			continue;
		}

		/* QUIT */
		if ([action isEqual: @"QUIT"] && split.count >= 2) {
			OFString *who = [split objectAtIndex: 0];
			IRCUser *user;

Modified tests/test.m from [d2000015d6] to [3b6f19e207].

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
96
97







+
+
+
+
+
+
+
+
+







- (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);
}