Add support for calculating caps hashes

This commit is contained in:
Florian Zeitz 2013-03-23 18:50:11 +01:00
parent 6ddb1571ca
commit beeb3e617e
2 changed files with 27 additions and 0 deletions

View file

@ -21,6 +21,7 @@
*/
#import "XMPPDiscoEntity.h"
#import "XMPPDiscoIdentity.h"
#import "XMPPIQ.h"
#import "namespaces.h"
@ -67,6 +68,25 @@
forKey: [node node]];
}
- (OFString*)capsHash
{
OFMutableString *caps = [OFMutableString string];
OFEnumerator *enumerator;
XMPPDiscoIdentity *identity;
OFString *feature;
enumerator = [_identities objectEnumerator];
while ((identity = [enumerator nextObject]) != nil)
[caps appendFormat: @"%@/%@//%@<", [identity category],
[identity type], [identity name]];
enumerator = [_features objectEnumerator];
while ((feature = [enumerator nextObject]) != nil)
[caps appendFormat: @"%@<", feature];
return [caps SHA1Hash];
}
- (BOOL)connection: (XMPPConnection*)connection
didReceiveIQ: (XMPPIQ*)IQ
{