Skip to content

Commit

Permalink
Added start of User List parser.
Browse files Browse the repository at this point in the history
Added UserList Request and Response type
  • Loading branch information
catsby authored and alexrepty committed Sep 4, 2010
1 parent 568366e commit 34f0344
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MGTwitterRequestTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions MGTwitterUserListsParser.h
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions MGTwitterUserListsParser.m
Original file line number Diff line number Diff line change
@@ -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.