forked from robbiehanson/XMPPFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNSXMLElement+XEP_0059.m
47 lines (38 loc) · 967 Bytes
/
NSXMLElement+XEP_0059.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#import "NSXMLElement+XEP_0059.h"
#import "NSXMLElement+XMPP.h"
#import "XMPPResultSet.h"
#if ! __has_feature(objc_arc)
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
#define XMLNS_XMPP_RESULT_SET @"http://jabber.org/protocol/rsm"
#define NAME_XMPP_RESULT_SET @"set"
@implementation NSXMLElement (XEP_0059)
- (BOOL)isResultSet
{
if([[self name] isEqualToString:NAME_XMPP_RESULT_SET] && [[self xmlns] isEqualToString:XMLNS_XMPP_RESULT_SET])
{
return YES;
}
else
{
return NO;
}
}
- (BOOL)hasResultSet
{
if([self resultSet])
{
return YES;
}
else
{
return NO;
}
}
- (XMPPResultSet *)resultSet
{
NSXMLElement *resultSetElement = [self elementForName:NAME_XMPP_RESULT_SET xmlns:XMLNS_XMPP_RESULT_SET];
XMPPResultSet *resultSet = [XMPPResultSet resultSetFromElement:resultSetElement];
return resultSet;
}
@end