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 "NGImap4ServerGlobalID.h"
25 @implementation NGImap4ServerGlobalID
27 + (id)imap4ServerGlobalIDForHostname:(NSString *)_host port:(int)_port
28 login:(NSString *)_login
30 NGImap4ServerGlobalID *gid;
32 gid = [[self alloc] initWithHostname:_host port:_port login:_login];
33 return [gid autorelease];
36 - (id)initWithHostname:(NSString *)_host port:(int)_p login:(NSString *)_l {
37 if ((self = [super init])) {
38 self->hostName = [_host copy];
39 self->login = [_l copy];
45 return [self initWithHostname:nil port:0 login:nil];
49 [self->hostName release];
50 [self->login release];
56 - (NSString *)hostName {
57 return self->hostName;
69 return [self->login hash];
72 - (BOOL)isEqualToImap4ServerGlobalID:(NGImap4ServerGlobalID *)_other {
78 if (self->login != _other->login) {
79 if (![self->login isEqualToString:_other->login])
82 if (self->hostName != _other->hostName) {
83 if (![self->hostName isEqualToString:_other->hostName])
86 if (self->port != _other->port)
92 - (BOOL)isEqual:(id)_otherObject {
93 if (_otherObject == self)
95 if (![_otherObject isKindOfClass:[self class]])
98 return [self isEqualToImap4ServerGlobalID:_otherObject];
103 - (id)copyWithZone:(NSZone *)_zone {
104 return [self retain];
107 /* support for some older code expecting only EO global IDs */
109 - (NSString *)entityName {
110 return @"NGImap4Client";
113 @end /* NGImap4ServerGlobalID */