Add support for calculating caps hashes
This commit is contained in:
parent
6ddb1571ca
commit
beeb3e617e
2 changed files with 27 additions and 0 deletions
|
@ -74,5 +74,12 @@
|
||||||
*/
|
*/
|
||||||
- (void)addDiscoNode: (XMPPDiscoNode*)node;
|
- (void)addDiscoNode: (XMPPDiscoNode*)node;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Calculates the Entity Capabilities Hash of the entity
|
||||||
|
*
|
||||||
|
* \return A OFString containing the capabilities hash
|
||||||
|
*/
|
||||||
|
- (OFString*)capsHash;
|
||||||
|
|
||||||
- (OFDictionary*)discoNodes;
|
- (OFDictionary*)discoNodes;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "XMPPDiscoEntity.h"
|
#import "XMPPDiscoEntity.h"
|
||||||
|
#import "XMPPDiscoIdentity.h"
|
||||||
#import "XMPPIQ.h"
|
#import "XMPPIQ.h"
|
||||||
#import "namespaces.h"
|
#import "namespaces.h"
|
||||||
|
|
||||||
|
@ -67,6 +68,25 @@
|
||||||
forKey: [node node]];
|
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
|
- (BOOL)connection: (XMPPConnection*)connection
|
||||||
didReceiveIQ: (XMPPIQ*)IQ
|
didReceiveIQ: (XMPPIQ*)IQ
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue