ObjIRC  Check-in [117cdc960f]

Overview
Comment:Add support for changing the nickname.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 117cdc960f27ad17952e6c2c618b7714d82216717aa623b81a7bb24a6f5ab658
User & Date: js on 2011-09-10 23:21:04
Other Links: manifest | tags
Context
2011-09-12
23:17
Adjust to recent ObjFW changes. check-in: 88eea97f3d user: js tags: trunk
2011-09-10
23:21
Add support for changing the nickname. check-in: 117cdc960f user: js tags: trunk
23:11
Add support for kicking a user. check-in: 4e0ae8ca4e user: js tags: trunk
Changes

Modified src/IRCConnection.h from [d5cac9a794] to [23abeda3ff].

101
102
103
104
105
106
107

108
109
- (void)sendNotice: (OFString*)notice
	    toUser: (IRCUser*)user;
- (void)sendNotice: (OFString*)notice
	 toChannel: (IRCChannel*)channel;
- (void)kickUser: (IRCUser*)user
     fromChannel: (IRCChannel*)channel
      withReason: (OFString*)reason;

- (void)handleConnection;
@end







>


101
102
103
104
105
106
107
108
109
110
- (void)sendNotice: (OFString*)notice
	    toUser: (IRCUser*)user;
- (void)sendNotice: (OFString*)notice
	 toChannel: (IRCChannel*)channel;
- (void)kickUser: (IRCUser*)user
     fromChannel: (IRCChannel*)channel
      withReason: (OFString*)reason;
- (void)changeNicknameTo: (OFString*)nickname;
- (void)handleConnection;
@end

Modified src/IRCConnection.m from [87ba19a3df] to [e9e2fb6122].

153
154
155
156
157
158
159





160
161
162
163
164
165
166
- (void)kickUser: (IRCUser*)user
     fromChannel: (IRCChannel*)channel
      withReason: (OFString*)reason
{
	[self sendLineWithFormat: @"KICK %@ %@ :%@",
				  channel.name, user.nickname, reason];
}






- (void)handleConnection
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *line;
	OFArray *split;








>
>
>
>
>







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
- (void)kickUser: (IRCUser*)user
     fromChannel: (IRCChannel*)channel
      withReason: (OFString*)reason
{
	[self sendLineWithFormat: @"KICK %@ %@ :%@",
				  channel.name, user.nickname, reason];
}

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

- (void)handleConnection
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *line;
	OFArray *split;

333
334
335
336
337
338
339





340
341
342
343
344
345
346

			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];
		}







>
>
>
>
>







338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

			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];
			}

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