Skip to content

Commit

Permalink
Fully implemented Saved Searches Methods, Block Methods
Browse files Browse the repository at this point in the history
Separated Help methods
Renamed some stuff in various places.
  • Loading branch information
nicktoumpelis committed Aug 19, 2009
1 parent 475826b commit dba1ff7
Show file tree
Hide file tree
Showing 17 changed files with 3,369 additions and 185 deletions.
2,779 changes: 2,706 additions & 73 deletions Canary.xcodeproj/genesis.pbxuser

Large diffs are not rendered by default.

261 changes: 220 additions & 41 deletions Canary.xcodeproj/genesis.perspectivev3

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions Canary.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
05A216A70FDD3FB1004748C4 /* ORSCanaryPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 05A216A60FDD3FB1004748C4 /* ORSCanaryPreferences.m */; };
05A5D7820F03F0D100B596A9 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A5D7810F03F0D100B596A9 /* Quartz.framework */; };
05C05A00103C08FE00C70832 /* ORSTwitterEngine+Help.m in Sources */ = {isa = PBXBuildFile; fileRef = 05C059FF103C08FE00C70832 /* ORSTwitterEngine+Help.m */; };
05C05A22103C09AC00C70832 /* ORSTwitterEngine+OAuth.m in Sources */ = {isa = PBXBuildFile; fileRef = 05C05A21103C09AC00C70832 /* ORSTwitterEngine+OAuth.m */; };
05C05A2D103C248A00C70832 /* ORSTwitterEngine+SavedSearches.m in Sources */ = {isa = PBXBuildFile; fileRef = 05C05A2C103C248A00C70832 /* ORSTwitterEngine+SavedSearches.m */; };
05C05AAD103C2CF600C70832 /* ORSTwitterEngine+Block.m in Sources */ = {isa = PBXBuildFile; fileRef = 05C05AAC103C2CF600C70832 /* ORSTwitterEngine+Block.m */; };
05FF7474103AAE0200E053E0 /* filterTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 05FF7472103AAE0200E053E0 /* filterTemplate.pdf */; };
05FF7475103AAE0200E053E0 /* sieveTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 05FF7473103AAE0200E053E0 /* sieveTemplate.pdf */; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
Expand Down Expand Up @@ -278,6 +281,12 @@
05A5D7810F03F0D100B596A9 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = "<absolute>"; };
05C059FE103C08FE00C70832 /* ORSTwitterEngine+Help.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ORSTwitterEngine+Help.h"; path = "Classes/Model/Twitter Engine/ORSTwitterEngine+Help.h"; sourceTree = "<group>"; };
05C059FF103C08FE00C70832 /* ORSTwitterEngine+Help.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ORSTwitterEngine+Help.m"; path = "Classes/Model/Twitter Engine/ORSTwitterEngine+Help.m"; sourceTree = "<group>"; };
05C05A20103C09AC00C70832 /* ORSTwitterEngine+OAuth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ORSTwitterEngine+OAuth.h"; path = "Classes/Model/Twitter Engine/ORSTwitterEngine+OAuth.h"; sourceTree = "<group>"; };
05C05A21103C09AC00C70832 /* ORSTwitterEngine+OAuth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ORSTwitterEngine+OAuth.m"; path = "Classes/Model/Twitter Engine/ORSTwitterEngine+OAuth.m"; sourceTree = "<group>"; };
05C05A2B103C248A00C70832 /* ORSTwitterEngine+SavedSearches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ORSTwitterEngine+SavedSearches.h"; path = "Classes/Model/Twitter Engine/ORSTwitterEngine+SavedSearches.h"; sourceTree = "<group>"; };
05C05A2C103C248A00C70832 /* ORSTwitterEngine+SavedSearches.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ORSTwitterEngine+SavedSearches.m"; path = "Classes/Model/Twitter Engine/ORSTwitterEngine+SavedSearches.m"; sourceTree = "<group>"; };
05C05AAB103C2CF600C70832 /* ORSTwitterEngine+Block.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ORSTwitterEngine+Block.h"; path = "Classes/Model/Twitter Engine/ORSTwitterEngine+Block.h"; sourceTree = "<group>"; };
05C05AAC103C2CF600C70832 /* ORSTwitterEngine+Block.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ORSTwitterEngine+Block.m"; path = "Classes/Model/Twitter Engine/ORSTwitterEngine+Block.m"; sourceTree = "<group>"; };
05FF7472103AAE0200E053E0 /* filterTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = filterTemplate.pdf; path = Resources/Images/filterTemplate.pdf; sourceTree = "<group>"; };
05FF7473103AAE0200E053E0 /* sieveTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = sieveTemplate.pdf; path = Resources/Images/sieveTemplate.pdf; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
Expand Down Expand Up @@ -322,6 +331,12 @@
053FBA9C0FA511A900DA370E /* ORSTwitterEngine+FavoritesAndDMAdditions.m */,
053FBA9D0FA511A900DA370E /* ORSTwitterEngine+HelpAndAccountAdditions.h */,
053FBAA20FA511A900DA370E /* ORSTwitterEngine+HelpAndAccountAdditions.m */,
05C05AAB103C2CF600C70832 /* ORSTwitterEngine+Block.h */,
05C05AAC103C2CF600C70832 /* ORSTwitterEngine+Block.m */,
05C05A2B103C248A00C70832 /* ORSTwitterEngine+SavedSearches.h */,
05C05A2C103C248A00C70832 /* ORSTwitterEngine+SavedSearches.m */,
05C05A20103C09AC00C70832 /* ORSTwitterEngine+OAuth.h */,
05C05A21103C09AC00C70832 /* ORSTwitterEngine+OAuth.m */,
05C059FE103C08FE00C70832 /* ORSTwitterEngine+Help.h */,
05C059FF103C08FE00C70832 /* ORSTwitterEngine+Help.m */,
053FBAA30FA511A900DA370E /* ORSUpdateDispatcher.h */,
Expand Down Expand Up @@ -769,6 +784,9 @@
053FBAF10FA5139300DA370E /* main.m in Sources */,
05A216A70FDD3FB1004748C4 /* ORSCanaryPreferences.m in Sources */,
05C05A00103C08FE00C70832 /* ORSTwitterEngine+Help.m in Sources */,
05C05A22103C09AC00C70832 /* ORSTwitterEngine+OAuth.m in Sources */,
05C05A2D103C248A00C70832 /* ORSTwitterEngine+SavedSearches.m in Sources */,
05C05AAD103C2CF600C70832 /* ORSTwitterEngine+Block.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
1 change: 1 addition & 0 deletions Classes/Controller/ORSCanaryController.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#import "ORSFilterTransformer.h"
#import "ORSFilterArrayTransformer.h"
#import "ORSScreenNameToBoolTransformer.h"
#import "ORSTwitterEngine+Block.h"

@interface ORSCanaryController : NSWindowController < GrowlApplicationBridgeDelegate > {
// Fundamentals
Expand Down
4 changes: 3 additions & 1 deletion Classes/Model/Twitter Engine/ORSSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
- (NSXMLDocument *) getXMLDocumentFromData:(NSData *)data;
- (NSXMLNode *) getNodeFromData:(NSData *)userData;
- (NSArray *) getAllStatusesFromData:(NSData *)statuses;
- (NSArray *) getAllUsersFromData:(NSData *)users;
- (NSArray *) usersFromData:(NSData *)data;
- (NSArray *) savedSearchesFromData:(NSData *)data;
- (NSArray *) IDsFromData:(NSData *)data;
- (NSArray *) getAllDMsFromData:(NSData *)directMessages;

// NSURLConnection delegates for asynchronous connections
Expand Down
22 changes: 18 additions & 4 deletions Classes/Model/Twitter Engine/ORSSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,33 @@ - (NSXMLNode *) getNodeFromData:(NSData *)data {
// Returns all the statuses as an array from the data received from the
// connection.
- (NSArray *) getAllStatusesFromData:(NSData *)statuses {
NSError *error = NULL;
NSError *error = nil;
NSXMLNode *root = [self getNodeFromData:statuses];
return [root nodesForXPath:@".//status" error:&error];
}

// Returns all the users as an array from the data received from the
// connection.
- (NSArray *) getAllUsersFromData:(NSData *)users {
NSError *error = NULL;
NSXMLNode *root = [self getNodeFromData:users];
- (NSArray *) usersFromData:(NSData *)data {
NSError *error = nil;
NSXMLNode *root = [self getNodeFromData:data];
return [root nodesForXPath:@".//user" error:&error];
}

// Returns all the saved searches as an array from the data received from the
// connectiom.
- (NSArray *) savedSearchesFromData:(NSData *)data {
NSError *error = nil;
NSXMLNode *root = [self getNodeFromData:data];
return [root nodesForXPath:@".//saved_search" error:&error];
}

- (NSArray *) IDsFromData:(NSData *)data {
NSError *error = nil;
NSXMLNode *root = [self getNodeFromData:data];
return [root nodesForXPath:@".//id" error:&error];
}

// Returns all the users as an array from the data received from the
// connection.
- (NSArray *) getAllDMsFromData:(NSData *)directMessages {
Expand Down
41 changes: 41 additions & 0 deletions Classes/Model/Twitter Engine/ORSTwitterEngine+Block.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// ORSTwitterEngine+Block.h
// Twitter Engine
//
// Created by Nicholas Toumpelis on 19/08/2009.
// Copyright 2008-2009 Ocean Road Software, Nick Toumpelis.
//
// Version 0.7.1
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

#import <Cocoa/Cocoa.h>
#import "ORSTwitterEngine.h"

@interface ORSTwitterEngine ( BlockMethods )

// Block methods
- (BOOL) blockUser:(NSString *)userID;
- (BOOL) unblockUser:(NSString *)userID;
- (BOOL) blocksUserWithID:(NSString *)identifier;
- (BOOL) blocksUserWithScreenName:(NSString *)screenName;
- (NSArray *) blockedUsers;
- (NSArray *) blockedIDs;

@end
119 changes: 119 additions & 0 deletions Classes/Model/Twitter Engine/ORSTwitterEngine+Block.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//
// ORSTwitterEngine+Block.h
// Twitter Engine
//
// Created by Nicholas Toumpelis on 19/08/2009.
// Copyright 2008-2009 Ocean Road Software, Nick Toumpelis.
//
// Version 0.7.1
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

#import "ORSTwitterEngine+Block.h"

@implementation ORSTwitterEngine ( BlockMethods )

// Change these two.
// blocks the user with the specified id
- (BOOL) blockUser:(NSString *)userID {
NSMutableString *path = [NSMutableString
stringWithString:@"blocks/create/"];
[path appendString:userID];
[path appendString:@".xml"];
NSXMLNode *node = [self getNodeFromData:[self executeRequestOfType:@"POST"
atPath:path
synchronously:NO]];
if ([[node name] isEqualToString:@"user"]) {
return YES;
} else {
return NO;
}
}

// unblocks the user with the specified id
- (BOOL) unblockUser:(NSString *)userID {
NSMutableString *path = [NSMutableString
stringWithString:@"blocks/destroy/"];
[path appendString:userID];
[path appendString:@".xml"];
NSXMLNode *node = [self getNodeFromData:[self executeRequestOfType:@"POST"
atPath:path
synchronously:NO]];
if ([[node name] isEqualToString:@"user"]) {
return YES;
} else {
return NO;
}
}

- (BOOL) blocksUserWithID:(NSString *)identifier {
NSMutableString *path = [NSMutableString
stringWithString:@"blocks/exists.xml?user_id="];
[path appendString:identifier];
NSXMLNode *node = [self getNodeFromData:[self executeRequestOfType:@"GET"
atPath:path
synchronously:synchronously]];
if ([[node name] isEqualToString:@"user"]) {
return YES;
} else {
return NO;
}
}

- (BOOL) blocksUserWithScreenName:(NSString *)screenName {
NSMutableString *path = [NSMutableString
stringWithString:@"blocks/exists.xml?screen_name="];
[path appendString:screenName];
NSXMLNode *node = [self getNodeFromData:[self executeRequestOfType:@"GET"
atPath:path
synchronously:synchronously]];
if ([[node name] isEqualToString:@"user"]) {
return YES;
} else {
return NO;
}
}

- (NSArray *) blockedUsers {
NSString *path = @"blocks/blocking.xml";
NSData *data = [self executeRequestOfType:@"GET"
atPath:path
synchronously:synchronously];
NSXMLNode *node = [self getNodeFromData:data];
if ([[node name] isEqualToString:@"users"]) {
return [self usersFromData:data];
} else {
return NULL;
}
}

- (NSArray *) blockedIDs {
NSString *path = @"blocks/blocking/ids.xml";
NSData *data = [self executeRequestOfType:@"GET"
atPath:path
synchronously:synchronously];
NSXMLNode *node = [self getNodeFromData:data];
if ([[node name] isEqualToString:@"ids"]) {
return [self IDsFromData:data];
} else {
return NULL;
}
}

@end
4 changes: 2 additions & 2 deletions Classes/Model/Twitter Engine/ORSTwitterEngine+Help.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

@interface ORSTwitterEngine ( HelpMethods )

- (BOOL) isTwitterOnline;
- (NSXMLNode *) getTwitterError;
- (BOOL) isTwitterUp;
- (NSXMLNode *) twitterError;

@end
4 changes: 2 additions & 2 deletions Classes/Model/Twitter Engine/ORSTwitterEngine+Help.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@implementation ORSTwitterEngine ( HelpMethods )

// tests whether Twitter is up
- (BOOL) isTwitterOnline {
- (BOOL) isTwitterUp {
NSString *path = @"help/text.xml";
NSXMLNode *node = [self getNodeFromData:[self
executeRequestOfType:@"GET" atPath:path synchronously:synchronously]];
Expand All @@ -42,7 +42,7 @@ - (BOOL) isTwitterOnline {
}

// gets Twitter error state
- (NSXMLNode *) getTwitterError {
- (NSXMLNode *) twitterError {
NSString *path = @"help/text.xml";
NSXMLNode *node = [self getNodeFromData:[self
executeRequestOfType:@"GET" atPath:path synchronously:synchronously]];
Expand Down
35 changes: 35 additions & 0 deletions Classes/Model/Twitter Engine/ORSTwitterEngine+OAuth.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// ORSTwitterEngine+OAuth.h
// Twitter Engine
//
// Created by Nicholas Toumpelis on 19/08/2009.
// Copyright 2008-2009 Ocean Road Software, Nick Toumpelis.
//
// Version 0.7.1
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

#import <Cocoa/Cocoa.h>
#import "ORSTwitterEngine.h"

@interface ORSTwitterEngine ( OAuthMethods )

// Placeholder for later

@end
34 changes: 34 additions & 0 deletions Classes/Model/Twitter Engine/ORSTwitterEngine+OAuth.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// ORSTwitterEngine+OAuth.h
// Twitter Engine
//
// Created by Nicholas Toumpelis on 19/08/2009.
// Copyright 2008-2009 Ocean Road Software, Nick Toumpelis.
//
// Version 0.7.1
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

#import "ORSTwitterEngine+OAuth.h"

@implementation ORSTwitterEngine ( OAuthMethods )

// Placeholder for later

@end
Loading

0 comments on commit dba1ff7

Please sign in to comment.