-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 96b2053
Showing
44 changed files
with
6,447 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// AppController.h | ||
// MGTwitterEngine | ||
// | ||
// Created by Matt Gemmell on 10/02/2008. | ||
// Copyright 2008 Instinctive Code. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "MGTwitterEngine.h" | ||
|
||
@interface AppController : NSObject <MGTwitterEngineDelegate> { | ||
MGTwitterEngine *twitterEngine; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// | ||
// AppController.m | ||
// MGTwitterEngine | ||
// | ||
// Created by Matt Gemmell on 10/02/2008. | ||
// Copyright 2008 Instinctive Code. | ||
// | ||
|
||
#import "AppController.h" | ||
|
||
|
||
@implementation AppController | ||
|
||
|
||
- (void)awakeFromNib | ||
{ | ||
// Put your Twitter username and password here: | ||
NSString *username = @""; | ||
NSString *password = @""; | ||
|
||
// Make sure you entered your login details before running this code... ;) | ||
if ([username isEqualToString:@""] || [password isEqualToString:@""]) { | ||
NSLog(@"You forgot to specify your username/password in AppController.m!"); | ||
[NSApp terminate:self]; | ||
} | ||
|
||
// Create a TwitterEngine and set our login details. | ||
twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self]; | ||
[twitterEngine setUsername:username password:password]; | ||
|
||
// Get updates from people the authenticated user follows. | ||
[twitterEngine getFollowedTimelineFor:username since:nil startingAtPage:0]; | ||
} | ||
|
||
|
||
- (void)dealloc | ||
{ | ||
[twitterEngine release]; | ||
[super dealloc]; | ||
} | ||
|
||
|
||
#pragma mark MGTwitterEngineDelegate methods | ||
|
||
|
||
- (void)requestSucceeded:(NSString *)requestIdentifier | ||
{ | ||
NSLog(@"Request succeeded (%@)", requestIdentifier); | ||
} | ||
|
||
|
||
- (void)requestFailed:(NSString *)requestIdentifier withError:(NSError *)error | ||
{ | ||
NSLog(@"Twitter request failed! (%@) Error: %@ (%@)", | ||
requestIdentifier, | ||
[error localizedDescription], | ||
[[error userInfo] objectForKey:NSErrorFailingURLStringKey]); | ||
} | ||
|
||
|
||
- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)identifier | ||
{ | ||
NSLog(@"Got statuses:\r%@", statuses); | ||
} | ||
|
||
|
||
- (void)directMessagesReceived:(NSArray *)messages forRequest:(NSString *)identifier | ||
{ | ||
NSLog(@"Got direct messages:\r%@", messages); | ||
} | ||
|
||
|
||
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)identifier | ||
{ | ||
NSLog(@"Got user info:\r%@", userInfo); | ||
} | ||
|
||
|
||
- (void)miscInfoReceived:(NSArray *)miscInfo forRequest:(NSString *)identifier | ||
{ | ||
NSLog(@"Got misc info:\r%@", miscInfo); | ||
} | ||
|
||
|
||
- (void)imageReceived:(NSImage *)image forRequest:(NSString *)identifier | ||
{ | ||
NSLog(@"Got an image: %@", image); | ||
|
||
// Save image to the Desktop. | ||
NSString *path = [[NSString stringWithFormat:@"~/Desktop/%@.tiff", identifier] | ||
stringByExpandingTildeInPath]; | ||
[[image TIFFRepresentation] writeToFile:path atomically:NO]; | ||
} | ||
|
||
|
||
@end |
Binary file not shown.
Oops, something went wrong.