Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/carpeaqua/MGTwitterEngine

  • Loading branch information...
commit 4f9f5834ee33f1f2354bae072d97d838baf51ecf 2 parents d2883de + 2b73398
Alexander Repty authored
View
3  AppController.m
@@ -38,10 +38,11 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
#define TESTING_ID 1131604824
#define TESTING_PRIMARY_USER @"gnitset"
- #define TESTING_SECONDARY_USER @"chockenberry"
+ #define TESTING_SECONDARY_USER @"justin"
#define TESTING_MESSAGE_ID 52182684
// Status methods:
+ // NSLog(@"getHomeTimelineFor: connectionIdentifier = %@", [twitterEngine getHomeTimelineSinceID:0 startingAtPage:0 count:20]);
//NSLog(@"getUserTimelineFor: connectionIdentifier = %@", [twitterEngine getUserTimelineFor:TESTING_SECONDARY_USER sinceID:0 startingAtPage:0 count:3]);
//NSLog(@"getUpdate: connectionIdentifier = %@", [twitterEngine getUpdate:TESTING_ID]);
//NSLog(@"sendUpdate: connectionIdentifier = %@", [twitterEngine sendUpdate:[@"This is a test on " stringByAppendingString:[[NSDate date] description]]]);
View
3  MGTwitterEngine.h
@@ -89,6 +89,9 @@
- (NSString *)getPublicTimeline; // statuses/public_timeline
+- (NSString *)getHomeTimelineSinceID:(MGTwitterEngineID)sinceID startingAtPage:(int)pageNum count:(int)count; // statuses/home_timeline
+- (NSString *)getHomeTimelineSinceID:(MGTwitterEngineID)sinceID withMaximumID:(MGTwitterEngineID)maxID startingAtPage:(int)pageNum count:(int)count; // statuses/home_timeline
+
- (NSString *)getFollowedTimelineSinceID:(MGTwitterEngineID)sinceID startingAtPage:(int)pageNum count:(int)count; // statuses/friends_timeline
- (NSString *)getFollowedTimelineSinceID:(MGTwitterEngineID)sinceID withMaximumID:(MGTwitterEngineID)maxID startingAtPage:(int)pageNum count:(int)count; // statuses/friends_timeline
View
30 MGTwitterEngine.m
@@ -1044,6 +1044,36 @@ - (NSString *)getPublicTimeline
#pragma mark -
+- (NSString *)getHomeTimelineSinceID:(MGTwitterEngineID)sinceID startingAtPage:(int)page count:(int)count; // statuses/home_timeline
+{
+ return [self getHomeTimelineSinceID:sinceID withMaximumID:0 startingAtPage:page count:count];
+}
+
+- (NSString *)getHomeTimelineSinceID:(MGTwitterEngineID)sinceID withMaximumID:(MGTwitterEngineID)maxID startingAtPage:(int)page count:(int)count; // statuses/home_timeline
+{
+ NSString *path = [NSString stringWithFormat:@"statuses/home_timeline.%@", API_FORMAT];
+
+ NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
+ if (sinceID > 0) {
+ [params setObject:[NSString stringWithFormat:@"%llu", sinceID] forKey:@"since_id"];
+ }
+ if (maxID > 0) {
+ [params setObject:[NSString stringWithFormat:@"%llu", maxID] forKey:@"max_id"];
+ }
+ if (page > 0) {
+ [params setObject:[NSString stringWithFormat:@"%d", page] forKey:@"page"];
+ }
+ if (count > 0) {
+ [params setObject:[NSString stringWithFormat:@"%d", count] forKey:@"count"];
+ }
+
+ return [self _sendRequestWithMethod:nil path:path queryParameters:params body:nil
+ requestType:MGTwitterHomeTimelineRequest
+ responseType:MGTwitterStatuses];
+
+}
+
+#pragma mark -
- (NSString *)getFollowedTimelineSinceID:(MGTwitterEngineID)sinceID startingAtPage:(int)page count:(int)count
{
View
4 MGTwitterLibXMLParser.m
@@ -223,6 +223,10 @@ - (NSDictionary *)_statusDictionaryForNodeWithName:(const xmlChar *)parentNodeNa
[dictionary setObject:number forKey:[NSString stringWithUTF8String:(const char *)name]];
}
}
+ else if (xmlStrEqual(name, BAD_CAST "retweeted_status"))
+ {
+ [dictionary setObject:[self _statusDictionaryForNodeWithName:name] forKey:[NSString stringWithUTF8String:(const char *)name]];
+ }
else
{
// process element as a string
View
1  MGTwitterRequestTypes.h
@@ -10,6 +10,7 @@
typedef enum _MGTwitterRequestType {
MGTwitterPublicTimelineRequest = 0, // latest statuses from the public timeline
+ MGTwitterHomeTimelineRequest, // latest statuses from the home timeline
MGTwitterFollowedTimelineRequest, // latest statuses from the people that the current users follows
MGTwitterUserTimelineRequest, // statuses archive for the current user
MGTwitterUserTimelineForUserRequest, // statuses archive for the specified user
View
7 MGTwitterStatusesParser.m
@@ -32,6 +32,11 @@ - (void)parser:(NSXMLParser *)theParser didStartElement:(NSString *)elementName
NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
[currentNode setObject:newNode forKey:elementName];
currentNode = newNode;
+ } else if ([elementName isEqualToString:@"retweeted_status"]) {
+ // Add a 'retweet_status' dictionary to current node.
+ NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
+ [currentNode setObject:newNode forKey:elementName];
+ currentNode = newNode;
} else if (currentNode) {
// Create relevant name-value pair.
[currentNode setObject:[NSMutableString string] forKey:elementName];
@@ -59,6 +64,8 @@ - (void)parser:(NSXMLParser *)theParser didEndElement:(NSString *)elementName
} else if ([elementName isEqualToString:@"status"]) {
[self addSource];
currentNode = nil;
+ } else if ([elementName isEqualToString:@"retweeted_status"]){
+ currentNode = [parsedObjects lastObject];
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.