ObjIRC  Check-in [7b1c2b91a4]

Overview
Comment:Handle nickname changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7b1c2b91a430c3744d650d3305e867008bc8173de9ed6fdc208b4d7b1f736da9
User & Date: js on 2011-09-09 21:24:18
Other Links: manifest | tags
Context
2011-09-10
13:11
Add support for parsing NOTICE. check-in: e7642f3cbb user: js tags: trunk
2011-09-09
21:24
Handle nickname changes. check-in: 7b1c2b91a4 user: js tags: trunk
21:24
Update Xcode project. check-in: 6558930da1 user: js tags: trunk
Changes

Modified src/IRCConnection.h from [6e7b90df78] to [03be13c7ea].

40
41
42
43
44
45
46



47
48
49
50
51
52
53
	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







>
>
>







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
	didSeeUser: (IRCUser*)user
       joinChannel: (IRCChannel*)channel;
- (void)connection: (IRCConnection*)connection
	didSeeUser: (IRCUser*)user
      leaveChannel: (IRCChannel*)channel
	withReason: (OFString*)reason;
- (void)connection: (IRCConnection*)connection
        didSeeUser: (IRCUser*)user
  changeNicknameTo: (OFString*)nickname;
- (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 [d49c16f293] to [1929310778].

267
268
269
270
271
272
273




















274
275
276
277
278
279
280
			    @selector(connection:didSeeUserQuit:withReason:)])
				[delegate connection: self
				      didSeeUserQuit: user
					  withReason: reason];

			continue;
		}





















		/* PRIVMSG */
		if ([action isEqual: @"PRIVMSG"] && split.count >= 4) {
			OFString *from = [split objectAtIndex: 0];
			OFString *to = [split objectAtIndex: 2];
			IRCUser *user;
			OFString *msg;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
			    @selector(connection:didSeeUserQuit:withReason:)])
				[delegate connection: self
				      didSeeUserQuit: user
					  withReason: reason];

			continue;
		}

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

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

			user = [IRCUser IRCUserWithString: who];

			if ([delegate respondsToSelector:
			    @selector(connection:didSeeUser:changeNicknameTo:)])
				[delegate connection: self
					  didSeeUser: user
				    changeNicknameTo: newNickname];
		}

		/* PRIVMSG */
		if ([action isEqual: @"PRIVMSG"] && split.count >= 4) {
			OFString *from = [split objectAtIndex: 0];
			OFString *to = [split objectAtIndex: 2];
			IRCUser *user;
			OFString *msg;

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

82
83
84
85
86
87
88







89
90
91
92
93
94
95

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







>
>
>
>
>
>
>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

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