ObjXMPP  Diff

Differences From Artifact [25d212cac9]:

To Artifact [3cb3be1d40]:


1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2011, 2012, 2013, 2019, Jonathan Schleifer <js@heap.zone>
 * Copyright (c) 2011, 2012, 2013, Florian Zeitz <florob@babelmonkeys.de>
 *
 * https://heap.zone/objxmpp/
 *
 * 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.

|







1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2011, 2012, 2013, 2019, 2021, Jonathan Schleifer <js@nil.im>
 * Copyright (c) 2011, 2012, 2013, Florian Zeitz <florob@babelmonkeys.de>
 *
 * https://heap.zone/objxmpp/
 *
 * 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.
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

		nodesep = [string rangeOfString: @"@"].location;
		resourcesep = [string rangeOfString: @"/"].location;

		if (nodesep == SIZE_MAX)
			self.node = nil;
		else
			self.node =
			    [string substringWithRange: of_range(0, nodesep)];

		if (resourcesep == SIZE_MAX) {
			self.resource = nil;
			resourcesep = string.length;
		} else {
			of_range_t range = of_range(resourcesep + 1,
			    string.length - resourcesep - 1);
			self.resource = [string substringWithRange: range];
		}

		self.domain = [string substringWithRange:
		    of_range(nodesep + 1, resourcesep - nodesep - 1)];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}







|
|





|





|







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

		nodesep = [string rangeOfString: @"@"].location;
		resourcesep = [string rangeOfString: @"/"].location;

		if (nodesep == SIZE_MAX)
			self.node = nil;
		else
			self.node = [string substringWithRange:
			    OFRangeMake(0, nodesep)];

		if (resourcesep == SIZE_MAX) {
			self.resource = nil;
			resourcesep = string.length;
		} else {
			OFRange range = OFRangeMake(resourcesep + 1,
			    string.length - resourcesep - 1);
			self.resource = [string substringWithRange: range];
		}

		self.domain = [string substringWithRange:
		    OFRangeMake(nodesep + 1, resourcesep - nodesep - 1)];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
	    [_domain isEqual: JID->_domain] && (_resource == JID->_resource ||
	    [_resource isEqual: JID->_resource]))
		return true;

	return false;
}

- (uint32_t)hash
{
	uint32_t hash;

	OF_HASH_INIT(hash);

	OF_HASH_ADD_HASH(hash, _node.hash);
	OF_HASH_ADD_HASH(hash, _domain.hash);
	OF_HASH_ADD_HASH(hash, _resource.hash);

	OF_HASH_FINALIZE(hash);

	return hash;
}
@end







|

|

|

|
|
|

|




231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
	    [_domain isEqual: JID->_domain] && (_resource == JID->_resource ||
	    [_resource isEqual: JID->_resource]))
		return true;

	return false;
}

- (unsigned long)hash
{
	unsigned long hash;

	OFHashInit(&hash);

	OFHashAddHash(&hash, _node.hash);
	OFHashAddHash(&hash, _domain.hash);
	OFHashAddHash(&hash, _resource.hash);

	OFHashFinalize(&hash);

	return hash;
}
@end