@@ -26,14 +26,15 @@ #import #import #import +#import + #import "IRCUser.h" @implementation IRCUser -@synthesize username, nickname, hostname; + IRCUserWithString: (OFString*)string { return [[[self alloc] initWithString: string] autorelease]; } @@ -46,23 +47,23 @@ @try { char *tmp; if ((tmp2 = strdup([string UTF8String])) == NULL) @throw [OFOutOfMemoryException - exceptionWithClass: isa + exceptionWithClass: [self class] requestedSize: [string UTF8StringLength]]; if ((tmp = strchr(tmp2, '@')) == NULL) @throw [OFInvalidFormatException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; *tmp = '\0'; hostname = [[OFString alloc] initWithUTF8String: tmp + 1]; if ((tmp = strchr(tmp2, '!')) == NULL) @throw [OFInvalidFormatException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; *tmp = '\0'; username = [[OFString alloc] initWithUTF8String: tmp + 1]; nickname = [[OFString alloc] initWithUTF8String: tmp2]; @@ -83,10 +84,25 @@ [username release]; [hostname release]; [super dealloc]; } + +- (OFString*)username +{ + OF_GETTER(username, YES) +} + +- (OFString*)nickname +{ + OF_GETTER(nickname, YES) +} + +- (OFString*)hostname +{ + OF_GETTER(hostname, YES) +} - copy { return [self retain]; }