- Update
This commit is contained in:
1 parent
d281d765ea
commit
5b074a5176
1261 files changed
+199158
-7303
No files matched your search
@@ -0,0 +1,23 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XMPPMessage.h"
|
||||
|
||||
|
||||
@interface XMPPMessage (XEP_0085)
|
||||
|
||||
- (NSString *)chatState;
|
||||
|
||||
- (BOOL)hasChatState;
|
||||
|
||||
- (BOOL)hasActiveChatState;
|
||||
- (BOOL)hasComposingChatState;
|
||||
- (BOOL)hasPausedChatState;
|
||||
- (BOOL)hasInactiveChatState;
|
||||
- (BOOL)hasGoneChatState;
|
||||
|
||||
- (void)addActiveChatState;
|
||||
- (void)addComposingChatState;
|
||||
- (void)addPausedChatState;
|
||||
- (void)addInactiveChatState;
|
||||
- (void)addGoneChatState;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,69 @@
|
||||
#import "XMPPMessage+XEP_0085.h"
|
||||
#import "NSXMLElement+XMPP.h"
|
||||
|
||||
|
||||
static NSString *const xmlns_chatstates = @"http://jabber.org/protocol/chatstates";
|
||||
|
||||
@implementation XMPPMessage (XEP_0085)
|
||||
|
||||
- (NSString *)chatState{
|
||||
return [[[self elementsForXmlns:xmlns_chatstates] lastObject] name];
|
||||
}
|
||||
|
||||
- (BOOL)hasChatState
|
||||
{
|
||||
return ([[self elementsForXmlns:xmlns_chatstates] count] > 0);
|
||||
}
|
||||
|
||||
- (BOOL)hasActiveChatState
|
||||
{
|
||||
return ([self elementForName:@"active" xmlns:xmlns_chatstates] != nil);
|
||||
}
|
||||
|
||||
- (BOOL)hasComposingChatState
|
||||
{
|
||||
return ([self elementForName:@"composing" xmlns:xmlns_chatstates] != nil);
|
||||
}
|
||||
|
||||
- (BOOL)hasPausedChatState
|
||||
{
|
||||
return ([self elementForName:@"paused" xmlns:xmlns_chatstates] != nil);
|
||||
}
|
||||
|
||||
- (BOOL)hasInactiveChatState
|
||||
{
|
||||
return ([self elementForName:@"inactive" xmlns:xmlns_chatstates] != nil);
|
||||
}
|
||||
|
||||
- (BOOL)hasGoneChatState
|
||||
{
|
||||
return ([self elementForName:@"gone" xmlns:xmlns_chatstates] != nil);
|
||||
}
|
||||
|
||||
|
||||
- (void)addActiveChatState
|
||||
{
|
||||
[self addChild:[NSXMLElement elementWithName:@"active" xmlns:xmlns_chatstates]];
|
||||
}
|
||||
|
||||
- (void)addComposingChatState
|
||||
{
|
||||
[self addChild:[NSXMLElement elementWithName:@"composing" xmlns:xmlns_chatstates]];
|
||||
}
|
||||
|
||||
- (void)addPausedChatState
|
||||
{
|
||||
[self addChild:[NSXMLElement elementWithName:@"paused" xmlns:xmlns_chatstates]];
|
||||
}
|
||||
|
||||
- (void)addInactiveChatState
|
||||
{
|
||||
[self addChild:[NSXMLElement elementWithName:@"inactive" xmlns:xmlns_chatstates]];
|
||||
}
|
||||
|
||||
- (void)addGoneChatState
|
||||
{
|
||||
[self addChild:[NSXMLElement elementWithName:@"gone" xmlns:xmlns_chatstates]];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user