Permalink
Browse files

Improving xmppParser and improving parallelization. Adding some advan…

…ced options to xmppStream.
  • Loading branch information...
robbiehanson committed Jul 13, 2012
1 parent 9e3171e commit b793e603c3f36be71d297f34623a622e51e2399d
Showing with 778 additions and 472 deletions.
  1. +6 −0 Core/XMPPInternal.h
  2. +7 −14 Core/XMPPParser.h
  3. +198 −139 Core/XMPPParser.m
  4. +25 −0 Core/XMPPStream.h
  5. +541 −318 Core/XMPPStream.m
  6. +1 −1 Xcode/iPhoneXMPP/main.m
View
@@ -53,4 +53,10 @@ extern NSString *const XMPPStreamDidChangeMyJIDNotification;
**/
- (void)sendAuthElement:(NSXMLElement *)element;
+/**
+ * This method allows you to inject an element into the stream as if it was received on the socket.
+ * This is an advanced technique, but makes for some interesting possibilities.
+**/
+- (void)injectElement:(NSXMLElement *)element;
+
@end
View
@@ -1,29 +1,20 @@
#import <Foundation/Foundation.h>
-#import <libxml2/libxml/parser.h>
#if TARGET_OS_IPHONE
#import "DDXML.h"
#endif
@interface XMPPParser : NSObject
-{
- id delegate;
-
- BOOL hasReportedRoot;
- unsigned depth;
-
- xmlParserCtxt *parserCtxt;
-}
-- (id)initWithDelegate:(id)delegate;
+- (id)initWithDelegate:(id)delegate delegateQueue:(dispatch_queue_t)dq;
+- (id)initWithDelegate:(id)delegate delegateQueue:(dispatch_queue_t)dq parserQueue:(dispatch_queue_t)pq;
-- (id)delegate;
-- (void)setDelegate:(id)delegate;
+- (void)setDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
/**
- * Synchronously parses the given data.
- * This means the delegate methods will get called before this method returns.
+ * Asynchronously parses the given data.
+ * The delegate methods will be dispatch_async'd as events occur.
**/
- (void)parseData:(NSData *)data;
@@ -44,4 +35,6 @@
- (void)xmppParser:(XMPPParser *)sender didFail:(NSError *)error;
+- (void)xmppParserDidParseData:(XMPPParser *)sender;
+
@end
Oops, something went wrong.

0 comments on commit b793e60

Please sign in to comment.