Implement the Retweet API. This means checking home_timeline and sending proper retweet messages. Fixes #12556.
On an annoying note, home_timeline (despite saying "Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends") does not include outgoing retweets. This will either be fixed by Twitter quickly, or not. I'm tired of Twitter's inconsistent and buggy API. So, as such, there's currently no way to remove a retweet done by yourself.
2 // MGTwitterStatusesParser.m
5 // Created by Matt Gemmell on 11/02/2008.
6 // Copyright 2008 Instinctive Code.
9 #import "MGTwitterStatusesParser.h"
12 @implementation MGTwitterStatusesParser
15 #pragma mark NSXMLParser delegate methods
18 - (void)parser:(NSXMLParser *)theParser didStartElement:(NSString *)elementName
19 namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
20 attributes:(NSDictionary *)attributeDict
22 //NSLog(@"Started element: %@ (%@)", elementName, attributeDict);
23 [self setLastOpenedElement:elementName];
25 if ([elementName isEqualToString:@"status"]) {
26 // Make new entry in parsedObjects.
27 NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
28 [parsedObjects addObject:newNode];
29 currentNode = newNode;
30 } else if ([elementName isEqualToString:@"user"]) {
31 // Add a 'user' dictionary to current node.
32 NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
33 [currentNode setObject:newNode forKey:elementName];
34 currentNode = newNode;
35 } else if ([elementName isEqualToString:@"retweeted_status"]) {
36 // Add a 'retweeted_status' dictionary to current node.
37 NSMutableDictionary *newNode = [NSMutableDictionary dictionaryWithCapacity:0];
38 [currentNode setObject:newNode forKey:elementName];
39 currentNode = newNode;
40 } else if (currentNode) {
41 // Create relevant name-value pair.
42 [currentNode setObject:[NSMutableString string] forKey:elementName];
47 - (void)parser:(NSXMLParser *)theParser foundCharacters:(NSString *)characters
49 //NSLog(@"Found characters: %@", characters);
50 // Append found characters to value of lastOpenedElement in currentNode.
51 if (lastOpenedElement && currentNode) {
52 [[currentNode objectForKey:lastOpenedElement] appendString:characters];
57 - (void)parser:(NSXMLParser *)theParser didEndElement:(NSString *)elementName
58 namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
60 [super parser:theParser didEndElement:elementName namespaceURI:namespaceURI qualifiedName:qName];
62 if ([elementName isEqualToString:@"user"] || [elementName isEqualToString:@"retweeted_status"]) {
63 currentNode = [parsedObjects lastObject];
64 } else if ([elementName isEqualToString:@"status"]) {