Permalink
Browse files

Added start of User List parser.

Added UserList Request and Response type
  • Loading branch information...
1 parent 568366e commit 34f0344fc9e13a03d70c14631d6589531db3dcc1 @catsby catsby committed with alexrepty Jun 10, 2010
Showing with 66 additions and 0 deletions.
  1. +2 −0 MGTwitterRequestTypes.h
  2. +17 −0 MGTwitterUserListsParser.h
  3. +47 −0 MGTwitterUserListsParser.m
@@ -47,6 +47,7 @@ typedef enum _MGTwitterRequestType {
MGTwitterImageRequest, // requesting an image
MGTwitterFriendIDsRequest, // request the numeric IDs for every user the specified user is following
MGTwitterFollowerIDsRequest, // request the numeric IDs of the followers of the specified user
+ MGTwitterUserListsRequest,
#if YAJL_AVAILABLE || TOUCHJSON_AVAILABLE
MGTwitterSearchRequest, // performing a search
MGTwitterSearchCurrentTrendsRequest, // getting the current trends
@@ -69,6 +70,7 @@ typedef enum _MGTwitterResponseType {
#endif
MGTwitterSocialGraph = 10,
MGTwitterOAuthToken = 11,
+ MGTwitterUserLists = 12,
} MGTwitterResponseType;
// This key is added to each tweet or direct message returned,
@@ -0,0 +1,17 @@
+//
+// MGTwitterUserListsParser.h
+// MGTwitterEngine
+//
+// Created by Clinton Shryock on 6/10/10.
+// Copyright 2010 scary-robot. All rights reserved.
+//
+
+#import "MGTwitterEngineGlobalHeader.h"
+
+#import "MGTwitterStatusesParser.h"
+
+@interface MGTwitterUserListsParser : MGTwitterStatusesParser {
+
+}
+
+@end
@@ -0,0 +1,47 @@
+//
+// MGTwitterUserListsParser.m
+// MGTwitterEngine
+//
+// Created by Clinton Shryock on 6/10/10.
+// Copyright 2010 scary-robot. All rights reserved.
+//
+
+#import "MGTwitterUserListsParser.h"
+
+
+@implementation MGTwitterUserListsParser
+
+#pragma mark NSXMLParser delegate methods
+
+
+- (void)parser:(NSXMLParser *)theParser didStartElement:(NSString *)elementName
+ namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
+ attributes:(NSDictionary *)attributeDict
+{
+ //NSLog(@"Started element: %@ (%@)", elementName, attributeDict);
+ [self setLastOpenedElement:elementName];
+
+ if ([elementName isEqualToString:@"list"]) {
+ // Make new entry in parsedObjects.
+ NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
+ [parsedObjects addObject:newNode];
+ currentNode = newNode;
+ } else if (currentNode) {
+ // Create relevant name-value pair.
+ [currentNode setObject:[NSMutableString string] forKey:elementName];
+ }
+}
+
+- (void)parser:(NSXMLParser *)theParser didEndElement:(NSString *)elementName
+ namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
+{
+ [super parser:theParser didEndElement:elementName namespaceURI:namespaceURI qualifiedName:qName];
+
+ if ([elementName isEqualToString:@"user"]) {
+ [self addSource];
+ currentNode = nil;
+ }
+}
+
+
+@end

0 comments on commit 34f0344

Please sign in to comment.