Index: ObjIRC.xcodeproj/project.pbxproj ================================================================== --- ObjIRC.xcodeproj/project.pbxproj +++ ObjIRC.xcodeproj/project.pbxproj @@ -5,12 +5,10 @@ }; 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 */; }; @@ -42,12 +40,10 @@ /* 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; }; @@ -107,12 +103,10 @@ 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 */, ); @@ -149,11 +143,10 @@ /* 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; }; @@ -232,11 +225,10 @@ /* 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; }; DELETED src/IRCChannel.h Index: src/IRCChannel.h ================================================================== --- src/IRCChannel.h +++ src/IRCChannel.h @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2010, 2011, Jonathan Schleifer - * - * https://webkeks.org/git/?p=objirc.git - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice is present in all copies. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * 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 -#import - -@class OFString; - -@interface IRCChannel: OFObject -{ - OFString *name; - OFMutableSet *users; -} - -#ifdef OF_HAVE_PROPERTIES -@property (readonly) OFString *name; -@property (readonly, copy) OFSet *users; -#endif - -+ channelWithName: (OFString*)name; -- initWithName: (OFString*)name; -- (OFString*)name; -- (OFSet*)users; -- (void)IRC_addUser: (OFString*)user; -- (void)IRC_removeUser: (OFString*)user; -@end DELETED src/IRCChannel.m Index: src/IRCChannel.m ================================================================== --- src/IRCChannel.m +++ src/IRCChannel.m @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2010, 2011, Jonathan Schleifer - * - * https://webkeks.org/git/?p=objirc.git - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice is present in all copies. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * 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 - -#import - -#import "IRCChannel.h" - -@implementation IRCChannel -+ channelWithName: (OFString*)name -{ - return [[[self alloc] initWithName: name] autorelease]; -} - -- initWithName: (OFString*)name_ -{ - self = [super init]; - - @try { - name = [name_ copy]; - users = [[OFMutableSet alloc] init]; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)dealloc -{ - [name release]; - [users release]; - - [super dealloc]; -} - -- (OFString*)name -{ - OF_GETTER(name, YES) -} - -- (OFSet*)users -{ - return [[users copy] autorelease]; -} - -- (OFString*)description -{ - return [[name copy] autorelease]; -} - -- (void)IRC_addUser: (OFString*)user -{ - [users addObject: user]; -} - -- (void)IRC_removeUser: (OFString*)user -{ - [users removeObject: user]; -} -@end Index: src/IRCConnection.h ================================================================== --- src/IRCConnection.h +++ src/IRCConnection.h @@ -18,18 +18,14 @@ * 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 +#import -@class OFString; -@class OFMutableDictionary; -@class OFTCPSocket; @class IRCConnection; @class IRCUser; -@class IRCChannel; #ifndef IRC_CONNECTION_M @protocol IRCConnectionDelegate #else @protocol IRCConnectionDelegate @@ -42,42 +38,42 @@ - (void)connection: (IRCConnection*)connection didSendLine: (OFString*)line; - (void)connectionWasEstablished: (IRCConnection*)connection; - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user - joinChannel: (IRCChannel*)channel; + joinChannel: (OFString*)channel; - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user - leaveChannel: (IRCChannel*)channel + 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: (IRCChannel*)channel + channel: (OFString*)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; + 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 - user: (IRCUser*)user - channel: (IRCChannel*)channel; + channel: (OFString*)channel + user: (IRCUser*)user; - (void)connection: (IRCConnection*)connection - didReceiveNamesForChannel: (IRCChannel*)channel; + didReceiveNamesForChannel: (OFString*)channel; - (void)connectionWasClosed: (IRCConnection*)connection; @end @interface IRCConnection: OFObject { @@ -114,26 +110,23 @@ - (void)sendLineWithFormat: (OFConstantString*)line, ...; - (void)connect; - (void)disconnect; - (void)disconnectWithReason: (OFString*)reason; - (void)joinChannel: (OFString*)channelName; -- (void)leaveChannel: (IRCChannel*)channel; -- (void)leaveChannel: (IRCChannel*)channel +- (void)leaveChannel: (OFString*)channel; +- (void)leaveChannel: (OFString*)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 + 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) @end Index: src/IRCConnection.m ================================================================== --- src/IRCConnection.m +++ src/IRCConnection.m @@ -34,11 +34,10 @@ #import #import "IRCConnection.h" #import "IRCUser.h" -#import "IRCChannel.h" @implementation IRCConnection - init { self = [super init]; @@ -144,31 +143,30 @@ [self sendLine: @"QUIT"]; else [self sendLineWithFormat: @"QUIT :%@", reason]; } -- (void)joinChannel: (OFString*)channelName +- (void)joinChannel: (OFString*)channel { - [self sendLineWithFormat: @"JOIN %@", channelName]; + [self sendLineWithFormat: @"JOIN %@", channel]; } -- (void)leaveChannel: (IRCChannel*)channel +- (void)leaveChannel: (OFString*)channel { [self leaveChannel: channel reason: nil]; } -- (void)leaveChannel: (IRCChannel*)channel +- (void)leaveChannel: (OFString*)channel reason: (OFString*)reason { if (reason == nil) - [self sendLineWithFormat: @"PART %@", [channel name]]; + [self sendLineWithFormat: @"PART %@", channel]; else - [self sendLineWithFormat: @"PART %@ :%@", - [channel name], reason]; + [self sendLineWithFormat: @"PART %@ :%@", channel, reason]; - [channels removeObjectForKey: [channel name]]; + [channels removeObjectForKey: channel]; } - (void)sendLine: (OFString*)line { [delegate connection: self @@ -192,39 +190,26 @@ [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]; + 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_]; @@ -262,42 +247,43 @@ /* JOIN */ if ([action isEqual: @"JOIN"] && [components count] == 3) { OFString *who = [components objectAtIndex: 0]; OFString *where = [components objectAtIndex: 2]; IRCUser *user; - IRCChannel *channel; + OFMutableSet *channel; who = [who substringWithRange: of_range(1, [who length] - 1)]; user = [IRCUser IRCUserWithString: who]; if ([who hasPrefix: [nickname stringByAppendingString: @"!"]]) { - channel = [IRCChannel channelWithName: where]; + channel = [OFMutableSet set]; [channels setObject: channel forKey: where]; } else channel = [channels objectForKey: where]; - [channel IRC_addUser: [user nickname]]; + [channel addObject: [user nickname]]; [delegate connection: self didSeeUser: user - joinChannel: channel]; + joinChannel: where]; return; } /* NAMES reply */ if ([action isEqual: @"353"] && [components count] >= 6) { - IRCChannel *channel; + OFString *where; + OFMutableSet *channel; OFArray *users; size_t pos; OFEnumerator *enumerator; OFString *user; - channel = [channels - objectForKey: [components objectAtIndex: 4]]; - if (channel == nil) { + where = [components objectAtIndex: 4]; + + if ((channel = [channels objectForKey: where]) == nil) { /* We did not request that */ return; } pos = [[components objectAtIndex: 0] length] + @@ -315,25 +301,25 @@ if ([user hasPrefix: @"@"] || [user hasPrefix: @"+"] || [user hasPrefix: @"%"] || [user hasPrefix: @"*"]) user = [user substringWithRange: of_range(1, [user length] - 1)]; - [channel IRC_addUser: user]; + [channel addObject: user]; } [delegate connection: self - didReceiveNamesForChannel: channel]; + didReceiveNamesForChannel: where]; return; } /* PART */ if ([action isEqual: @"PART"] && [components count] >= 3) { OFString *who = [components objectAtIndex: 0]; OFString *where = [components objectAtIndex: 2]; IRCUser *user; - IRCChannel *channel; + 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)]; @@ -342,15 +328,15 @@ if ([components count] > 3) reason = [line substringWithRange: of_range(pos + 2, [line length] - pos - 2)]; - [channel IRC_removeUser: [user nickname]]; + [channel removeObject: [user nickname]]; [delegate connection: self didSeeUser: user - leaveChannel: channel + leaveChannel: where reason: reason]; return; } @@ -358,11 +344,11 @@ 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; + OFMutableSet *channel; OFString *reason = nil; size_t pos = [who length] + 1 + [[components objectAtIndex: 1] length] + 1 + [where length] + 1 + [whom length]; @@ -372,16 +358,16 @@ if ([components count] > 4) reason = [line substringWithRange: of_range(pos + 2, [line length] - pos - 2)]; - [channel IRC_removeUser: [user nickname]]; + [channel removeObject: [user nickname]]; [delegate connection: self didSeeUser: user kickUser: whom - channel: channel + channel: where reason: reason]; return; } @@ -391,22 +377,22 @@ IRCUser *user; OFString *reason = nil; size_t pos = [who length] + 1 + [[components objectAtIndex: 1] length]; OFEnumerator *enumerator; - IRCChannel *channel; + 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 keyEnumerator]; + enumerator = [channels objectEnumerator]; while ((channel = [enumerator nextObject]) != nil) - [channel IRC_removeUser: [user nickname]]; + [channel removeObject: [user nickname]]; [delegate connection: self didSeeUserQuit: user reason: reason]; @@ -417,11 +403,11 @@ if ([action isEqual: @"NICK"] && [components count] == 3) { OFString *who = [components objectAtIndex: 0]; OFString *newNickname = [components objectAtIndex: 2]; IRCUser *user; OFEnumerator *enumerator; - IRCChannel *channel; + OFMutableSet *channel; who = [who substringWithRange: of_range(1, [who length] - 1)]; newNickname = [newNickname substringWithRange: of_range(1, [newNickname length] - 1)]; @@ -432,13 +418,13 @@ 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]; + if ([channel containsObject: [user nickname]]) { + [channel removeObject: [user nickname]]; + [channel addObject: newNickname]; } } [delegate connection: self didSeeUser: user @@ -460,20 +446,16 @@ 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]; - + if (![to isEqual: nickname]) [delegate connection: self didReceiveMessage: msg - user: user - channel: channel]; - } else + channel: to + user: user]; + else [delegate connection: self didReceivePrivateMessage: msg user: user]; return; @@ -498,20 +480,16 @@ return; } user = [IRCUser IRCUserWithString: from]; - if (![to isEqual: nickname]) { - IRCChannel *channel; - - channel = [channels objectForKey: to]; - + if (![to isEqual: nickname]) [delegate connection: self didReceiveNotice: notice - user: user - channel: channel]; - } else + channel: to + user: user]; + else [delegate connection: self didReceiveNotice: notice user: user]; return; @@ -565,10 +543,15 @@ { [sock asyncReadLineWithTarget: self selector: @selector(connection:didReceiveLine: exception:)]; } + +- (OFSet*)usersInChannel: (OFString*)channel +{ + return [[[channels objectForKey: channel] copy] autorelease]; +} - (void)dealloc { [sock release]; [server release]; @@ -596,17 +579,17 @@ { } - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user - joinChannel: (IRCChannel*)channel + joinChannel: (OFString*)channel { } - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user - leaveChannel: (IRCChannel*)channel + leaveChannel: (OFString*)channel reason: (OFString*)reason { } - (void)connection: (IRCConnection*)connection @@ -616,11 +599,11 @@ } - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user kickUser: (OFString*)kickedUser - channel: (IRCChannel*)channel + channel: (OFString*)channel reason: (OFString*)reason { } - (void)connection: (IRCConnection*)connection @@ -629,12 +612,12 @@ { } - (void)connection: (IRCConnection*)connection didReceiveMessage: (OFString*)msg - fromUser: (IRCUser*)user - channel: (IRCChannel*)channel + channel: (OFString*)channel + user: (IRCUser*)user { } - (void)connection: (IRCConnection*)connection didReceivePrivateMessage: (OFString*)msg @@ -642,25 +625,25 @@ { } - (void)connection: (IRCConnection*)connection didReceiveNotice: (OFString*)notice + channel: (OFString*)channel user: (IRCUser*)user { } - (void)connection: (IRCConnection*)connection didReceiveNotice: (OFString*)notice user: (IRCUser*)user - channel: (IRCChannel*)channel { } - (void)connection: (IRCConnection*)connection - didReceiveNamesForChannel: (IRCChannel*)channel + didReceiveNamesForChannel: (OFString*)channel { } - (void)connectionWasClosed: (IRCConnection*)connection { } @end Index: src/ObjIRC.h ================================================================== --- src/ObjIRC.h +++ src/ObjIRC.h @@ -19,7 +19,6 @@ * 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" Index: tests/test.m ================================================================== --- tests/test.m +++ tests/test.m @@ -24,11 +24,10 @@ #import #import #import "IRCConnection.h" #import "IRCUser.h" -#import "IRCChannel.h" @interface TestApp: OFObject @end OF_APPLICATION_DELEGATE(TestApp) @@ -65,35 +64,35 @@ [connection joinChannel: @"#objfw"]; } - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user - joinChannel: (IRCChannel*)channel + joinChannel: (OFString*)channel { of_log(@"%@ joined %@.", user, channel); } - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user - leaveChannel: (IRCChannel*)channel - withReason: (OFString*)reason + leaveChannel: (OFString*)channel + reason: (OFString*)reason { of_log(@"%@ left %@ (%@).", user, channel, reason); } - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user kickUser: (OFString*)kickedUser - fromChannel: (IRCChannel*)channel - withReason: (OFString*)reason + channel: (OFString*)channel + reason: (OFString*)reason { of_log(@"%@ kicked %@ from %@: %@", user, kickedUser, channel, reason); } - (void)connection: (IRCConnection*)connection didSeeUserQuit: (IRCUser*)user - withReason: (OFString*)reason + reason: (OFString*)reason { of_log(@"%@ quit (%@).", user, reason); } - (void)connection: (IRCConnection*)connection @@ -103,39 +102,40 @@ of_log(@"%@ changed nick to %@.", user, nickname); } - (void)connection: (IRCConnection*)connection didReceiveMessage: (OFString*)msg - fromUser: (IRCUser*)user - inChannel: (IRCChannel*)channel + channel: (OFString*)channel + user: (IRCUser*)user { - of_log(@"[%@] %@: %@", channel, user, msg); + of_log(@"[%@] %@: %@", channel, [user nickname], msg); } - (void)connection: (IRCConnection*)connection didReceivePrivateMessage: (OFString*)msg - fromUser: (IRCUser*)user + user: (IRCUser*)user { of_log(@"(%@): %@", user, msg); } - (void)connection: (IRCConnection*)connection didReceiveNotice: (OFString*)notice - fromUser: (IRCUser*)user + channel: (OFString*)channel + user: (IRCUser*)user { - of_log(@"NOTICE: (%@): %@", user, notice); + of_log(@"NOTICE: [%@] %@: %@", channel, [user nickname], notice); } - (void)connection: (IRCConnection*)connection didReceiveNotice: (OFString*)notice - fromUser: (IRCUser*)user - inChannel: (IRCChannel*)channel + user: (IRCUser*)user { - of_log(@"NOTICE: [%@] %@: %@", channel, user, notice); + of_log(@"NOTICE: (%@): %@", user, notice); } - (void)connection: (IRCConnection*)connection - didReceiveNamesForChannel: (IRCChannel*)channel + didReceiveNamesForChannel: (OFString*)channel { - of_log(@"Users in %@: %@", channel, [channel users]); + of_log(@"Users in %@: %@", channel, + [connection usersInChannel: channel]); } @end