2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "NGLdapGlobalID.h"
23 #include "NSString+DN.h"
24 #import <EOControl/EOControl.h>
27 @implementation NGLdapGlobalID
29 - (id)initWithHost:(NSString *)_host port:(int)_port dn:(NSString *)_dn {
30 self->host = [_host copy];
32 self->dn = [[[_dn dnComponents] componentsJoinedByString:@","] copy];
57 return [self->dn hash] + [self->host hash];
60 - (BOOL)isEqual:(id)_other {
63 if ([_other class] != [self class])
68 if ((ooid->dn == self->dn) &&
69 (ooid->host == self->host) &&
70 (ooid->port == self->port))
73 if (![ooid->dn isEqualToString:self->dn])
75 if (ooid->port != self->port)
77 if (![ooid->host isEqualToString:self->host])
85 - (NSString *)stringValue {
86 return [NSString stringWithFormat:@"%@:%i/%@",
87 self->host, self->port, self->dn];
90 - (NSString *)description {
94 s = [[NSMutableString alloc] init];
95 [s appendFormat:@"<0x%08X[%@]: ", self, NSStringFromClass([self class])];
96 [s appendFormat:@" host=%@", self->host];
97 [s appendFormat:@" port=%i", self->port];
98 [s appendFormat:@" dn=%@", self->dn];
99 [s appendString:@">"];
103 return [d autorelease];
106 @end /* NGLdapGlobalID */