Skip to content

Commit

Permalink
MGTwitterEngine re-import.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgemmell committed Aug 9, 2008
0 parents commit 96b2053
Show file tree
Hide file tree
Showing 44 changed files with 6,447 additions and 0 deletions.
16 changes: 16 additions & 0 deletions AppController.h
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
96 changes: 96 additions & 0 deletions AppController.m
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 added English.lproj/InfoPlist.strings
Binary file not shown.
Loading

0 comments on commit 96b2053

Please sign in to comment.