delete spaces and tabs on line ends

This commit is contained in:
noformnocontent 2013-02-13 00:25:02 +01:00
parent f7240ea2e5
commit 8d89461be7
28 changed files with 222 additions and 222 deletions

View file

@ -15,7 +15,7 @@ class Bungloo:
self.preferences = Windows.Preferences(self) self.preferences = Windows.Preferences(self)
self.preferences.show() self.preferences.show()
self.oauth_implementation = Windows.Oauth(self) self.oauth_implementation = Windows.Oauth(self)
if self.controller.stringForKey("user_access_token") != "": if self.controller.stringForKey("user_access_token") != "":
self.authentification_succeded() self.authentification_succeded()
@ -61,7 +61,7 @@ class Controller(QtCore.QObject):
self.app = app self.app = app
os.path.expanduser("~/.bungloo/") os.path.expanduser("~/.bungloo/")
self.config_path = os.path.expanduser('~/.bungloo/bungloo.cfg') self.config_path = os.path.expanduser('~/.bungloo/bungloo.cfg')
if os.access(self.config_path, os.R_OK): if os.access(self.config_path, os.R_OK):
with open(self.config_path, 'r') as f: with open(self.config_path, 'r') as f:
@ -196,7 +196,7 @@ class Controller(QtCore.QObject):
msgBox = QtGui.QMessageBox() msgBox = QtGui.QMessageBox()
msgBox.setText(errorMessage) msgBox.setText(errorMessage)
msgBox.exec_() msgBox.exec_()
@QtCore.pyqtSlot(str, str) @QtCore.pyqtSlot(str, str)
def alertTitleWithMessage(self, title, message): def alertTitleWithMessage(self, title, message):
msgBox = QtGui.QMessageBox() msgBox = QtGui.QMessageBox()
@ -230,6 +230,6 @@ class Console(QtCore.QObject):
def debug(self, string): def debug(self, string):
print "<js DEBUG>: " + string print "<js DEBUG>: " + string
if __name__ == "__main__": if __name__ == "__main__":
Bungloo() Bungloo()

View file

@ -33,7 +33,7 @@ class WebViewCreator(QtWebKit.QWebView):
self.is_local = local self.is_local = local
self.connect(self, SIGNAL("linkClicked (const QUrl&)"), self.app.controller.openQURL) self.connect(self, SIGNAL("linkClicked (const QUrl&)"), self.app.controller.openQURL)
self.setPage(WebPage(self, self.app)) self.setPage(WebPage(self, self.app))
def load_local(self, callback=None): def load_local(self, callback=None):
self.page().settings().setAttribute(QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True) self.page().settings().setAttribute(QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True)
self.page().settings().setAttribute(QtWebKit.QWebSettings.LocalStorageEnabled, True) self.page().settings().setAttribute(QtWebKit.QWebSettings.LocalStorageEnabled, True)
@ -47,7 +47,7 @@ class WebViewCreator(QtWebKit.QWebView):
self.load(QtCore.QUrl(url)) self.load(QtCore.QUrl(url))
def load_url(self, url, callback=None): def load_url(self, url, callback=None):
self.loadFinished.connect(lambda ok: self.load_finished(ok, callback)) self.loadFinished.connect(lambda ok: self.load_finished(ok, callback))
self.load(QtCore.QUrl(url)) self.load(QtCore.QUrl(url))
def load_finished(self, ok, callback=None): def load_finished(self, ok, callback=None):
@ -81,14 +81,14 @@ class NetworkAccessManager(QNetworkAccessManager):
self.setCookieJar(old_manager.cookieJar()) self.setCookieJar(old_manager.cookieJar())
self.setProxy(old_manager.proxy()) self.setProxy(old_manager.proxy())
self.setProxyFactory(old_manager.proxyFactory()) self.setProxyFactory(old_manager.proxyFactory())
def createRequest(self, operation, request, data): def createRequest(self, operation, request, data):
if request.url().scheme() != "bungloo": if request.url().scheme() != "bungloo":
return QNetworkAccessManager.createRequest(self, operation, request, data) return QNetworkAccessManager.createRequest(self, operation, request, data)
else: else:
self.bungloo_callback(request.url()) self.bungloo_callback(request.url())
return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QNetworkRequest(QtCore.QUrl())) return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QNetworkRequest(QtCore.QUrl()))
class PostModel: class PostModel:
def __init__(self): def __init__(self):

View file

@ -99,7 +99,7 @@ class Timeline:
def initUI(self): def initUI(self):
newPostAction = QtGui.QAction("&New Post", self.window) newPostAction = QtGui.QAction("&New Post", self.window)
newPostAction.setShortcut("Ctrl+N") newPostAction.setShortcut("Ctrl+N")
newPostAction.setStatusTip("Open new post window") newPostAction.setStatusTip("Open new post window")
newPostAction.triggered.connect(self.app.controller.openNewMessageWidow) newPostAction.triggered.connect(self.app.controller.openNewMessageWidow)
@ -253,12 +253,12 @@ class NewPost(Helper.RestorableWindow):
self.imageFilePath = None self.imageFilePath = None
def initUI(self): def initUI(self):
newPostAction = QtGui.QAction("&New Post", self) newPostAction = QtGui.QAction("&New Post", self)
newPostAction.setShortcut("Ctrl+N") newPostAction.setShortcut("Ctrl+N")
newPostAction.setStatusTip("Open new post window") newPostAction.setStatusTip("Open new post window")
newPostAction.triggered.connect(self.app.controller.openNewMessageWidow) newPostAction.triggered.connect(self.app.controller.openNewMessageWidow)
sendPostAction = QtGui.QAction("&Send Post", self) sendPostAction = QtGui.QAction("&Send Post", self)
sendPostAction.setShortcut("Ctrl+Return") sendPostAction.setShortcut("Ctrl+Return")
sendPostAction.setStatusTip("Send post") sendPostAction.setStatusTip("Send post")
sendPostAction.triggered.connect(self.sendMessage) sendPostAction.triggered.connect(self.sendMessage)

View file

@ -19,7 +19,7 @@
d = [NSUserDefaults standardUserDefaults]; d = [NSUserDefaults standardUserDefaults];
//[d removeObjectForKey:@"user_access_token"]; //[d removeObjectForKey:@"user_access_token"];
} }
return self; return self;
} }
@ -50,7 +50,7 @@
char *_password = nil; char *_password = nil;
SecKeychainItemRef item = nil; SecKeychainItemRef item = nil;
SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &_passwordLength, (void **)&_password, &item); SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &_passwordLength, (void **)&_password, &item);
OSStatus status; OSStatus status;
void * passwordData = (void*)[_secret cStringUsingEncoding:NSUTF8StringEncoding]; void * passwordData = (void*)[_secret cStringUsingEncoding:NSUTF8StringEncoding];
UInt32 passwordLength = strlen((char*)passwordData); UInt32 passwordLength = strlen((char*)passwordData);
@ -85,11 +85,11 @@
char *password = nil; char *password = nil;
SecKeychainItemRef item = nil; SecKeychainItemRef item = nil;
SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &passwordLength, (void **)&password, &item); SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &passwordLength, (void **)&password, &item);
if (!item) { if (!item) {
return nil; return nil;
} }
//Get password //Get password
NSString *passwordString = [[[NSString alloc] initWithData:[NSData dataWithBytes:password length:passwordLength] encoding:NSUTF8StringEncoding] autorelease]; NSString *passwordString = [[[NSString alloc] initWithData:[NSData dataWithBytes:password length:passwordLength] encoding:NSUTF8StringEncoding] autorelease];
SecKeychainItemFreeContent(NULL, password); SecKeychainItemFreeContent(NULL, password);

View file

@ -213,7 +213,7 @@
string = nil; string = nil;
break; break;
} }
return string; return string;
} }

View file

@ -26,48 +26,48 @@
{ {
[timelineViewWindow setExcludedFromWindowsMenu:YES]; [timelineViewWindow setExcludedFromWindowsMenu:YES];
[mentionsViewWindow setExcludedFromWindowsMenu:YES]; [mentionsViewWindow setExcludedFromWindowsMenu:YES];
[self initHotKeys]; [self initHotKeys];
[GrowlApplicationBridge setGrowlDelegate:self]; [GrowlApplicationBridge setGrowlDelegate:self];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self [nc addObserver:self
selector:@selector(openNewMessageWindow:) selector:@selector(openNewMessageWindow:)
name:@"openNewMessageWindow" name:@"openNewMessageWindow"
object:nil]; object:nil];
[nc addObserver:self [nc addObserver:self
selector:@selector(sendTweet:) selector:@selector(sendTweet:)
name:@"sendTweet" name:@"sendTweet"
object:nil]; object:nil];
[nc addObserver:self [nc addObserver:self
selector:@selector(authentificationSucceded:) selector:@selector(authentificationSucceded:)
name:@"authentificationSucceded" name:@"authentificationSucceded"
object:nil]; object:nil];
[nc addObserver:self [nc addObserver:self
selector:@selector(getTweetUpdates:) selector:@selector(getTweetUpdates:)
name:@"getTweetUpdates" name:@"getTweetUpdates"
object:nil]; object:nil];
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:self [appleEventManager setEventHandler:self
andSelector:@selector(handleGetURLEvent:withReplyEvent:) andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass forEventClass:kInternetEventClass
andEventID:kAEGetURL]; andEventID:kAEGetURL];
viewDelegate = [[ViewDelegate alloc] init]; viewDelegate = [[ViewDelegate alloc] init];
accessToken = [[AccessToken alloc] init]; accessToken = [[AccessToken alloc] init];
BOOL forceLogin = NO; BOOL forceLogin = NO;
/* /*
if (![accessToken stringForKey:@"version-0.6.0-new-login"]) { if (![accessToken stringForKey:@"version-0.6.0-new-login"]) {
[self logout:self]; [self logout:self];
forceLogin = YES; forceLogin = YES;
[accessToken setString:nil forKey:@"entity"]; [accessToken setString:nil forKey:@"entity"];
[accessToken setString:@"yes" forKey:@"version-0.6.0-new-login"]; [accessToken setString:@"yes" forKey:@"version-0.6.0-new-login"];
}*/ }*/
if (forceLogin || ![accessToken stringForKey:@"user_access_token"] || ![accessToken secret]) { if (forceLogin || ![accessToken stringForKey:@"user_access_token"] || ![accessToken secret]) {
[timelineViewWindow performClose:self]; [timelineViewWindow performClose:self];
[mentionsViewWindow performClose:self]; [mentionsViewWindow performClose:self];
@ -89,7 +89,7 @@
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Webkit/"]; NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Webkit/"];
NSURL *url = [NSURL fileURLWithPath:path]; NSURL *url = [NSURL fileURLWithPath:path];
NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@index.html", path] encoding:NSUTF8StringEncoding error:nil]; NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@index.html", path] encoding:NSUTF8StringEncoding error:nil];
oauthView = [[WebView alloc] init]; oauthView = [[WebView alloc] init];
viewDelegate.oauthView = oauthView; viewDelegate.oauthView = oauthView;
[[oauthView mainFrame] loadHTMLString:index_string baseURL:url]; [[oauthView mainFrame] loadHTMLString:index_string baseURL:url];
@ -107,11 +107,11 @@
if (viewDelegate.timelineView != timelineView) if (viewDelegate.timelineView != timelineView)
{ {
[self initOauth]; [self initOauth];
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Webkit/"]; NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Webkit/"];
NSURL *url = [NSURL fileURLWithPath:path]; NSURL *url = [NSURL fileURLWithPath:path];
NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@index.html", path] encoding:NSUTF8StringEncoding error:nil]; NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@index.html", path] encoding:NSUTF8StringEncoding error:nil];
viewDelegate.timelineView = timelineView; viewDelegate.timelineView = timelineView;
[[timelineView mainFrame] loadHTMLString:index_string baseURL:url]; [[timelineView mainFrame] loadHTMLString:index_string baseURL:url];
[timelineView setFrameLoadDelegate:viewDelegate]; [timelineView setFrameLoadDelegate:viewDelegate];
@ -121,7 +121,7 @@
//WebPreferences* prefs = [timelineView preferences]; //WebPreferences* prefs = [timelineView preferences];
//[prefs _setLocalStorageDatabasePath:localStoragePath]; //[prefs _setLocalStorageDatabasePath:localStoragePath];
//[prefs setLocalStorageEnabled:YES]; //[prefs setLocalStorageEnabled:YES];
viewDelegate.mentionsView = mentionsView; viewDelegate.mentionsView = mentionsView;
[[mentionsView mainFrame] loadHTMLString:index_string baseURL:url]; [[mentionsView mainFrame] loadHTMLString:index_string baseURL:url];
[mentionsView setFrameLoadDelegate:viewDelegate]; [mentionsView setFrameLoadDelegate:viewDelegate];
@ -131,7 +131,7 @@
//prefs = [mentionsView preferences]; //prefs = [mentionsView preferences];
//[prefs _setLocalStorageDatabasePath:localStoragePath]; //[prefs _setLocalStorageDatabasePath:localStoragePath];
//[prefs setLocalStorageEnabled:YES]; //[prefs setLocalStorageEnabled:YES];
viewDelegate.conversationView = conversationView; viewDelegate.conversationView = conversationView;
[[conversationView mainFrame] loadHTMLString:index_string baseURL:url]; [[conversationView mainFrame] loadHTMLString:index_string baseURL:url];
[conversationView setFrameLoadDelegate:viewDelegate]; [conversationView setFrameLoadDelegate:viewDelegate];
@ -141,7 +141,7 @@
//prefs = [conversationView preferences]; //prefs = [conversationView preferences];
//[prefs _setLocalStorageDatabasePath:localStoragePath]; //[prefs _setLocalStorageDatabasePath:localStoragePath];
//[prefs setLocalStorageEnabled:YES]; //[prefs setLocalStorageEnabled:YES];
viewDelegate.profileView = profileView; viewDelegate.profileView = profileView;
[[profileView mainFrame] loadHTMLString:index_string baseURL:url]; [[profileView mainFrame] loadHTMLString:index_string baseURL:url];
[profileView setFrameLoadDelegate:viewDelegate]; [profileView setFrameLoadDelegate:viewDelegate];
@ -166,8 +166,8 @@
{ {
NSInteger newTweetKey = kVK_ANSI_M; // http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes NSInteger newTweetKey = kVK_ANSI_M; // http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
NSInteger newTweetModifierKey = controlKey + cmdKey + optionKey; // cmdKey 256, shitfKey 512, optionKey 2048, controlKey 4096 NSInteger newTweetModifierKey = controlKey + cmdKey + optionKey; // cmdKey 256, shitfKey 512, optionKey 2048, controlKey 4096
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger defaultsNewTweetKey = (NSInteger)[defaults integerForKey:@"newTweetKey"]; NSInteger defaultsNewTweetKey = (NSInteger)[defaults integerForKey:@"newTweetKey"];
@ -179,7 +179,7 @@
{ {
[defaults setInteger:newTweetKey forKey:@"newTweetKey"]; [defaults setInteger:newTweetKey forKey:@"newTweetKey"];
} }
NSInteger defaultsNewTweetModifierKey = (NSInteger)[defaults integerForKey:@"newTweetModifierKey"]; NSInteger defaultsNewTweetModifierKey = (NSInteger)[defaults integerForKey:@"newTweetModifierKey"];
if ([defaults objectForKey:@"newTweetModifierKey"] != nil) if ([defaults objectForKey:@"newTweetModifierKey"] != nil)
{ {
@ -189,9 +189,9 @@
{ {
[defaults setInteger:newTweetModifierKey forKey:@"newTweetModifierKey"]; [defaults setInteger:newTweetModifierKey forKey:@"newTweetModifierKey"];
} }
[defaults synchronize]; [defaults synchronize];
NSUInteger cocoaModifiers = 0; NSUInteger cocoaModifiers = 0;
if (newTweetModifierKey & shiftKey) cocoaModifiers = cocoaModifiers | NSShiftKeyMask; if (newTweetModifierKey & shiftKey) cocoaModifiers = cocoaModifiers | NSShiftKeyMask;
if (newTweetModifierKey & optionKey) cocoaModifiers = cocoaModifiers | NSAlternateKeyMask; if (newTweetModifierKey & optionKey) cocoaModifiers = cocoaModifiers | NSAlternateKeyMask;
@ -200,22 +200,22 @@
[globalHotkeyMenuItem setKeyEquivalent:[Constants stringFromVirtualKeyCode:newTweetKey]]; [globalHotkeyMenuItem setKeyEquivalent:[Constants stringFromVirtualKeyCode:newTweetKey]];
[globalHotkeyMenuItem setKeyEquivalentModifierMask:cocoaModifiers]; [globalHotkeyMenuItem setKeyEquivalentModifierMask:cocoaModifiers];
/* CARBON from http://github.com/Xjs/drama-button/blob/carbon/Drama_ButtonAppDelegate.m */ /* CARBON from http://github.com/Xjs/drama-button/blob/carbon/Drama_ButtonAppDelegate.m */
EventTypeSpec eventType; EventTypeSpec eventType;
eventType.eventClass = kEventClassKeyboard; eventType.eventClass = kEventClassKeyboard;
eventType.eventKind = kEventHotKeyPressed; eventType.eventKind = kEventHotKeyPressed;
InstallApplicationEventHandler(&handler, 1, &eventType, NULL, NULL); InstallApplicationEventHandler(&handler, 1, &eventType, NULL, NULL);
EventHotKeyID g_HotKeyID; EventHotKeyID g_HotKeyID;
g_HotKeyID.id = 1; g_HotKeyID.id = 1;
EventHotKeyRef g_HotKeyRef; EventHotKeyRef g_HotKeyRef;
RegisterEventHotKey(newTweetKey, newTweetModifierKey, g_HotKeyID, GetApplicationEventTarget(), 0, &g_HotKeyRef); RegisterEventHotKey(newTweetKey, newTweetModifierKey, g_HotKeyID, GetApplicationEventTarget(), 0, &g_HotKeyRef);
/* end CARBON */ /* end CARBON */
} }
@ -285,13 +285,13 @@
- (IBAction)openNewMessageWindow:(id)sender - (IBAction)openNewMessageWindow:(id)sender
{ {
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil]; [[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
} }
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string isPrivate:(BOOL)isPrivate - (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string isPrivate:(BOOL)isPrivate
{ {
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
NewMessageWindow *newMessage = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil]; NewMessageWindow *newMessage = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
[newMessage inReplyTo:userName statusId:statusId withString:string]; [newMessage inReplyTo:userName statusId:statusId withString:string];
[newMessage setIsPrivate:isPrivate]; [newMessage setIsPrivate:isPrivate];
@ -300,9 +300,9 @@
- (void)openNewMessageWindowWithString:(NSString *)aString - (void)openNewMessageWindowWithString:(NSString *)aString
{ {
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
NSRange range = [aString rangeOfString:@"oauthtoken"]; NSRange range = [aString rangeOfString:@"oauthtoken"];
if (range.length > 0) if (range.length > 0)
{ {
[oauthView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"bungloo_instance.requestAccessToken('%@')", aString]]; [oauthView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"bungloo_instance.requestAccessToken('%@')", aString]];
@ -310,7 +310,7 @@
else else
{ {
NewMessageWindow *newTweet = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil]; NewMessageWindow *newTweet = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
[newTweet withString:aString]; [newTweet withString:aString];
} }
} }
@ -325,12 +325,12 @@
PostModel *post = (PostModel *)[sender object]; PostModel *post = (PostModel *)[sender object];
NSString *text = [[post.text stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"] stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]; NSString *text = [[post.text stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"] stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
text = [text stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"]; text = [text stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];
NSString *locationObject = @"null"; NSString *locationObject = @"null";
if (post.location) { if (post.location) {
locationObject = [NSString stringWithFormat:@"[%f, %f]", post.location.coordinate.latitude, post.location.coordinate.longitude]; locationObject = [NSString stringWithFormat:@"[%f, %f]", post.location.coordinate.latitude, post.location.coordinate.longitude];
} }
NSString *imageFilePath = @"null"; NSString *imageFilePath = @"null";
if (post.imageFilePath) { if (post.imageFilePath) {
NSError *error; NSError *error;
@ -340,12 +340,12 @@
[data release]; [data release];
imageFilePath = [NSString stringWithFormat:@"\"data:%@;base64,%@\"", mimeType, base64]; imageFilePath = [NSString stringWithFormat:@"\"data:%@;base64,%@\"", mimeType, base64];
} }
NSString *isPrivate = @"false"; NSString *isPrivate = @"false";
if (post.isPrivate) { if (post.isPrivate) {
isPrivate = @"true"; isPrivate = @"true";
} }
NSString *func = [NSString stringWithFormat:@"bungloo_instance.sendNewMessage(\"%@\", \"%@\", \"%@\", %@, %@, %@)", NSString *func = [NSString stringWithFormat:@"bungloo_instance.sendNewMessage(\"%@\", \"%@\", \"%@\", %@, %@, %@)",
text, text,
post.inReplyTostatusId, post.inReplyTostatusId,
@ -361,7 +361,7 @@
{ {
NSFileManager *fileManager = [NSFileManager defaultManager]; NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *pathToPlugin = [@"~/Library/Application Support/Bungloo/Plugin.js" stringByExpandingTildeInPath]; NSString *pathToPlugin = [@"~/Library/Application Support/Bungloo/Plugin.js" stringByExpandingTildeInPath];
if([fileManager fileExistsAtPath:pathToPlugin]) if([fileManager fileExistsAtPath:pathToPlugin])
{ {
return [NSString stringWithFormat:@"%@", [NSURL fileURLWithPath:pathToPlugin]]; return [NSString stringWithFormat:@"%@", [NSURL fileURLWithPath:pathToPlugin]];
@ -432,7 +432,7 @@
self.accessToken.userId = userId; self.accessToken.userId = userId;
self.accessToken.screenName = screenName; self.accessToken.screenName = screenName;
[timelineViewWindow makeKeyAndOrderFront:self]; [timelineViewWindow makeKeyAndOrderFront:self];
[[NSNotificationCenter defaultCenter] postNotificationName:@"authentificationSucceded" object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"authentificationSucceded" object:nil];
}*/ }*/
@ -456,13 +456,13 @@
- (IBAction)logout:(id)sender - (IBAction)logout:(id)sender
{ {
[oauthView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"]; [oauthView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
[timelineViewWindow performClose:self]; [timelineViewWindow performClose:self];
[mentionsViewWindow performClose:self]; [mentionsViewWindow performClose:self];
[conversationViewWindow performClose:self]; [conversationViewWindow performClose:self];
[profileViewWindow performClose:self]; [profileViewWindow performClose:self];
[self.loginViewWindow makeKeyAndOrderFront:self]; [self.loginViewWindow makeKeyAndOrderFront:self];
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"]; [timelineView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"]; [mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
} }
@ -474,7 +474,7 @@
{ {
//[self unreadMentions:0]; //[self unreadMentions:0];
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.setAllMentionsRead();"]; [mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.setAllMentionsRead();"];
} }
} }
- (void)getTweetUpdates:(id)sender - (void)getTweetUpdates:(id)sender
@ -508,9 +508,9 @@
NSDictionary *userInfo = (NSDictionary *)clickContext; NSDictionary *userInfo = (NSDictionary *)clickContext;
NSString *postId = [userInfo objectForKey:@"postId"]; NSString *postId = [userInfo objectForKey:@"postId"];
NSString *entity = [userInfo objectForKey:@"entity"]; NSString *entity = [userInfo objectForKey:@"entity"];
[self showConversationForPostId:postId andEntity:entity]; [self showConversationForPostId:postId andEntity:entity];
NSString *js = [NSString stringWithFormat:@"bungloo_instance.mentionRead('%@', '%@');", postId, entity]; NSString *js = [NSString stringWithFormat:@"bungloo_instance.mentionRead('%@', '%@');", postId, entity];
[mentionsView stringByEvaluatingJavaScriptFromString:js]; [mentionsView stringByEvaluatingJavaScriptFromString:js];
} }

View file

@ -390,8 +390,8 @@
/*! @brief Tries to fill in missing keys in a notification dictionary. /*! @brief Tries to fill in missing keys in a notification dictionary.
* @param notifDict The dictionary to fill in. * @param notifDict The dictionary to fill in.
* @return The dictionary with the keys filled in. This will be a separate instance from \a notifDict. * @return The dictionary with the keys filled in. This will be a separate instance from \a notifDict.
* @discussion This function examines the \a notifDict for missing keys, and * @discussion This function examines the \a notifDict for missing keys, and
* tries to get them from the last known registration dictionary. As of 1.1, * tries to get them from the last known registration dictionary. As of 1.1,
* the keys that it will look for are: * the keys that it will look for are:
* *
* \li <code>GROWL_APP_NAME</code> * \li <code>GROWL_APP_NAME</code>
@ -410,8 +410,8 @@
*@abstract Lets the app know whether growl:// is registered on the system, used for certain methods below this *@abstract Lets the app know whether growl:// is registered on the system, used for certain methods below this
*@return Returns whether growl:// is registered on the system *@return Returns whether growl:// is registered on the system
*@discussion Methods such as openGrowlPreferences rely on the growl:// URL scheme to function *@discussion Methods such as openGrowlPreferences rely on the growl:// URL scheme to function
* Further, this method can provide a check on whether Growl is installed, * Further, this method can provide a check on whether Growl is installed,
* however, the framework will not be relying on this method for choosing when/how to notify, * however, the framework will not be relying on this method for choosing when/how to notify,
* and it is not recommended that the app rely on it for other than whether to use growl:// methods * and it is not recommended that the app rely on it for other than whether to use growl:// methods
*@since Growl.framework 1.4 *@since Growl.framework 1.4
*/ */
@ -421,7 +421,7 @@
* @method openGrowlPreferences: * @method openGrowlPreferences:
* @abstract Open Growl preferences, optionally to this app's settings, growl:// method * @abstract Open Growl preferences, optionally to this app's settings, growl:// method
* @param showApp Whether to show the application's settings, otherwise just opens to the last position * @param showApp Whether to show the application's settings, otherwise just opens to the last position
* @return Return's whether opening the URL was succesfull or not. * @return Return's whether opening the URL was succesfull or not.
* @discussion Will launch if Growl is installed, but not running, and open the preferences window * @discussion Will launch if Growl is installed, but not running, and open the preferences window
* Uses growl:// URL scheme * Uses growl:// URL scheme
* @since Growl.framework 1.4 * @since Growl.framework 1.4

View file

@ -12,15 +12,15 @@
+(NSString *)mimeTypeForFileAtPath:(NSString *)path error:(NSError **)err { +(NSString *)mimeTypeForFileAtPath:(NSString *)path error:(NSError **)err {
NSString *uti, *mimeType = nil; NSString *uti, *mimeType = nil;
if (!(uti = [[NSWorkspace sharedWorkspace] typeOfFile:path error:err])) if (!(uti = [[NSWorkspace sharedWorkspace] typeOfFile:path error:err]))
return nil; return nil;
if (err) if (err)
*err = nil; *err = nil;
if ((mimeType = (NSString *)UTTypeCopyPreferredTagWithClass((CFStringRef)uti, kUTTagClassMIMEType))) if ((mimeType = (NSString *)UTTypeCopyPreferredTagWithClass((CFStringRef)uti, kUTTagClassMIMEType)))
mimeType = NSMakeCollectable(mimeType); mimeType = NSMakeCollectable(mimeType);
return mimeType; return mimeType;
} }

View file

@ -15,7 +15,7 @@
{ {
if ([base64Encoding length] % 4 != 0) if ([base64Encoding length] % 4 != 0)
return nil; return nil;
NSString *plist = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><plist version=\"1.0\"><data>%@</data></plist>", base64Encoding]; NSString *plist = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><plist version=\"1.0\"><data>%@</data></plist>", base64Encoding];
return [NSPropertyListSerialization propertyListWithData:[plist dataUsingEncoding:NSASCIIStringEncoding] options:0 format:NULL error:NULL]; return [NSPropertyListSerialization propertyListWithData:[plist dataUsingEncoding:NSASCIIStringEncoding] options:0 format:NULL error:NULL];
} }
@ -28,14 +28,14 @@
NSRange endRange = [plist rangeOfData:[@"</data>" dataUsingEncoding:NSASCIIStringEncoding] options:NSDataSearchBackwards range:fullRange]; NSRange endRange = [plist rangeOfData:[@"</data>" dataUsingEncoding:NSASCIIStringEncoding] options:NSDataSearchBackwards range:fullRange];
if (startRange.location == NSNotFound || endRange.location == NSNotFound) if (startRange.location == NSNotFound || endRange.location == NSNotFound)
return nil; return nil;
NSUInteger base64Location = startRange.location + startRange.length; NSUInteger base64Location = startRange.location + startRange.length;
NSUInteger base64length = endRange.location - base64Location; NSUInteger base64length = endRange.location - base64Location;
NSData *base64Data = [NSData dataWithBytesNoCopy:(void *)((uintptr_t)base64Location + (uintptr_t)[plist bytes]) length:base64length freeWhenDone:NO]; NSData *base64Data = [NSData dataWithBytesNoCopy:(void *)((uintptr_t)base64Location + (uintptr_t)[plist bytes]) length:base64length freeWhenDone:NO];
NSString *base64Encoding = [[NSString alloc] initWithData:base64Data encoding:NSASCIIStringEncoding]; NSString *base64Encoding = [[NSString alloc] initWithData:base64Data encoding:NSASCIIStringEncoding];
base64Encoding = [base64Encoding stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; base64Encoding = [base64Encoding stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
base64Encoding = [base64Encoding stringByReplacingOccurrencesOfString:@"\n" withString:@""]; base64Encoding = [base64Encoding stringByReplacingOccurrencesOfString:@"\n" withString:@""];
#if __has_feature(objc_arc) #if __has_feature(objc_arc)
return base64Encoding; return base64Encoding;
#else #else

View file

@ -88,10 +88,10 @@
{ {
// Insert code here to read your document from the given data of the specified type. If the given outError != NULL, ensure that you set *outError when returning NO. // Insert code here to read your document from the given data of the specified type. If the given outError != NULL, ensure that you set *outError when returning NO.
// You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead. // You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead.
// For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead. // For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead.
if ( outError != NULL ) if ( outError != NULL )
{ {
*outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
@ -102,25 +102,25 @@
- (void)inReplyTo:(NSString *)entity statusId:(NSString *)statusId withString:(NSString *)string - (void)inReplyTo:(NSString *)entity statusId:(NSString *)statusId withString:(NSString *)string
{ {
[textField setStringValue:string]; [textField setStringValue:string];
NSInteger location = [string rangeOfString:@" "].location; NSInteger location = [string rangeOfString:@" "].location;
NSInteger length = 0; NSInteger length = 0;
if (location != NSNotFound) { if (location != NSNotFound) {
length = [[textField stringValue] length] - location - 1; length = [[textField stringValue] length] - location - 1;
} }
NSRange range = {location + 1, length}; NSRange range = {location + 1, length};
[[textField currentEditor] setSelectedRange:range]; [[textField currentEditor] setSelectedRange:range];
[inReplyTostatusId release]; [inReplyTostatusId release];
inReplyTostatusId = statusId; inReplyTostatusId = statusId;
[inReplyTostatusId retain]; [inReplyTostatusId retain];
[inReplyToEntity release]; [inReplyToEntity release];
inReplyToEntity = entity; inReplyToEntity = entity;
[inReplyToEntity retain]; [inReplyToEntity retain];
[self controlTextDidChange:nil]; [self controlTextDidChange:nil];
} }
@ -130,7 +130,7 @@
NSRange range = {[[textField stringValue] length] , 0}; NSRange range = {[[textField stringValue] length] , 0};
[[textField currentEditor] setSelectedRange:range]; [[textField currentEditor] setSelectedRange:range];
NSLog(@"BB"); NSLog(@"BB");
[self controlTextDidChange:nil]; [self controlTextDidChange:nil];
} }
@ -155,7 +155,7 @@
{ {
NSRect frame = [(NSButton *)sender frame]; NSRect frame = [(NSButton *)sender frame];
NSPoint menuOrigin = [[(NSButton *)sender superview] convertPoint:NSMakePoint(frame.origin.x, frame.origin.y+frame.size.height) toView:nil]; NSPoint menuOrigin = [[(NSButton *)sender superview] convertPoint:NSMakePoint(frame.origin.x, frame.origin.y+frame.size.height) toView:nil];
NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseDown NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseDown
location:menuOrigin location:menuOrigin
modifierFlags:NSLeftMouseDownMask // 0x100 modifierFlags:NSLeftMouseDownMask // 0x100
@ -165,7 +165,7 @@
eventNumber:0 eventNumber:0
clickCount:1 clickCount:1
pressure:1]; pressure:1];
[NSMenu popUpContextMenu:self.addMenu withEvent:event forView:self.addMenuButton]; [NSMenu popUpContextMenu:self.addMenu withEvent:event forView:self.addMenuButton];
} }
@ -190,7 +190,7 @@
if(c < 0) { if(c < 0) {
[counter setTextColor:[NSColor redColor]]; [counter setTextColor:[NSColor redColor]];
} else { } else {
[counter setTextColor:[NSColor controlTextColor]]; [counter setTextColor:[NSColor controlTextColor]];
} }
} }
@ -212,7 +212,7 @@
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{ - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
NSLog(@"CLLocationManager Error: %@", error); NSLog(@"CLLocationManager Error: %@", error);
NSMenuItem *menuItem = [self.addMenu itemAtIndex:0]; NSMenuItem *menuItem = [self.addMenu itemAtIndex:0];
[menuItem setTitle:@"Current location not available"]; [menuItem setTitle:@"Current location not available"];
} }
@ -252,17 +252,17 @@
- (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector - (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector
{ {
BOOL retval = NO; BOOL retval = NO;
BOOL isEnter = [[NSApp currentEvent] keyCode] == 76; BOOL isEnter = [[NSApp currentEvent] keyCode] == 76;
if (commandSelector == @selector(insertNewline:) && !isEnter) { if (commandSelector == @selector(insertNewline:) && !isEnter) {
NSText *text = [[textField window] fieldEditor:YES forObject:nil]; NSText *text = [[textField window] fieldEditor:YES forObject:nil];
NSRange range = [text selectedRange]; NSRange range = [text selectedRange];
NSString *stringBefore = [textField.stringValue substringToIndex:range.location]; NSString *stringBefore = [textField.stringValue substringToIndex:range.location];
NSString *stringAfter = [textField.stringValue substringFromIndex:range.location + range.length]; NSString *stringAfter = [textField.stringValue substringFromIndex:range.location + range.length];
textField.stringValue = [NSString stringWithFormat:@"%@\n%@", stringBefore, stringAfter]; textField.stringValue = [NSString stringWithFormat:@"%@\n%@", stringBefore, stringAfter];
NSRange r = NSMakeRange(range.location + 1, 0); NSRange r = NSMakeRange(range.location + 1, 0);
@ -275,7 +275,7 @@
retval = YES; retval = YES;
[self sendPost:control]; [self sendPost:control];
} }
return retval; return retval;
} }
@ -288,17 +288,17 @@
if (!self.imageFilePath) if (!self.imageFilePath)
{ {
[menuItem setTitle:@"Remove photo"]; [menuItem setTitle:@"Remove photo"];
NSOpenPanel* openDlg = [NSOpenPanel openPanel]; NSOpenPanel* openDlg = [NSOpenPanel openPanel];
[openDlg setPrompt:@"Select"]; [openDlg setPrompt:@"Select"];
[openDlg setDelegate:self]; [openDlg setDelegate:self];
// Enable the selection of files in the dialog. // Enable the selection of files in the dialog.
[openDlg setCanChooseFiles:YES]; [openDlg setCanChooseFiles:YES];
// Enable the selection of directories in the dialog. // Enable the selection of directories in the dialog.
[openDlg setCanChooseDirectories:NO]; [openDlg setCanChooseDirectories:NO];
// Display the dialog. If the OK button was pressed, // Display the dialog. If the OK button was pressed,
// process the files. // process the files.
if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton ) if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton )
@ -306,7 +306,7 @@
// Get an array containing the full filenames of all // Get an array containing the full filenames of all
// files and directories selected. // files and directories selected.
NSArray* files = [openDlg filenames]; NSArray* files = [openDlg filenames];
// Loop through all the files and process them. // Loop through all the files and process them.
for( int i = 0; i < [files count]; i++ ) for( int i = 0; i < [files count]; i++ )
{ {
@ -327,7 +327,7 @@
if ([ext isEqualToString:@""] || [ext isEqualToString:@"/"] || ext == nil || ext == NULL || [ext length] < 1) { if ([ext isEqualToString:@""] || [ext isEqualToString:@"/"] || ext == nil || ext == NULL || [ext length] < 1) {
return YES; return YES;
} }
NSEnumerator* tagEnumerator = [[NSArray arrayWithObjects:@"png", @"jpg", @"gif", @"jpeg", nil] objectEnumerator]; NSEnumerator* tagEnumerator = [[NSArray arrayWithObjects:@"png", @"jpg", @"gif", @"jpeg", nil] objectEnumerator];
NSString* allowedExt; NSString* allowedExt;
while ((allowedExt = [tagEnumerator nextObject])) while ((allowedExt = [tagEnumerator nextObject]))
@ -337,7 +337,7 @@
return YES; return YES;
} }
} }
return NO; return NO;
} }

View file

@ -13,16 +13,16 @@
NSString *title; NSString *title;
NSDate *date; NSDate *date;
NSString *itemDescription; NSString *itemDescription;
NSURL *releaseNotesURL; NSURL *releaseNotesURL;
NSString *DSASignature; NSString *DSASignature;
NSString *minimumSystemVersion; NSString *minimumSystemVersion;
NSURL *fileURL; NSURL *fileURL;
NSString *versionString; NSString *versionString;
NSString *displayVersionString; NSString *displayVersionString;
NSDictionary *propertiesDictionary; NSDictionary *propertiesDictionary;
} }

View file

@ -15,7 +15,7 @@
@interface SUUpdater : NSObject { @interface SUUpdater : NSObject {
NSTimer *checkTimer; NSTimer *checkTimer;
SUUpdateDriver *driver; SUUpdateDriver *driver;
SUHost *host; SUHost *host;
IBOutlet id delegate; IBOutlet id delegate;
} }

View file

@ -16,7 +16,7 @@
@protocol SUVersionComparison @protocol SUVersionComparison
/*! /*!
@method @method
@abstract An abstract method to compare two version strings. @abstract An abstract method to compare two version strings.
@discussion Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, and NSOrderedSame if they are equivalent. @discussion Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, and NSOrderedSame if they are equivalent.
*/ */

View file

@ -16,13 +16,13 @@
- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message;{ - (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message;{
if (![message isKindOfClass:[NSDictionary class]]) return; if (![message isKindOfClass:[NSDictionary class]]) return;
NSString *viewName = @"TimelineView"; NSString *viewName = @"TimelineView";
if (sender == mentionsView) viewName = @"MentionsView"; if (sender == mentionsView) viewName = @"MentionsView";
if (sender == conversationView) viewName = @"ConversationView"; if (sender == conversationView) viewName = @"ConversationView";
if (sender == oauthView) viewName = @"OauthView"; if (sender == oauthView) viewName = @"OauthView";
if (sender == profileView) viewName = @"ProfileView"; if (sender == profileView) viewName = @"ProfileView";
NSLog(@"js<%@>: %@:%@: %@", NSLog(@"js<%@>: %@:%@: %@",
viewName, viewName,
[[message objectForKey:@"sourceURL"] lastPathComponent], [[message objectForKey:@"sourceURL"] lastPathComponent],
@ -46,7 +46,7 @@
NSLocalizedString(@"OK", @""), // default button NSLocalizedString(@"OK", @""), // default button
NSLocalizedString(@"Cancel", @""), // alt button NSLocalizedString(@"Cancel", @""), // alt button
nil); nil);
return NSAlertDefaultReturn == result; return NSAlertDefaultReturn == result;
return NO; return NO;
} }
@ -56,45 +56,45 @@
} }
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
NSFileManager *fileManager = [NSFileManager defaultManager]; NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *pathToJsPlugin = [@"~/Library/Application Support/bungloo/Plugin.js" stringByExpandingTildeInPath]; NSString *pathToJsPlugin = [@"~/Library/Application Support/bungloo/Plugin.js" stringByExpandingTildeInPath];
NSString *pathToCssPlugin = [@"~/Library/Application Support/bungloo/Plugin.css" stringByExpandingTildeInPath]; NSString *pathToCssPlugin = [@"~/Library/Application Support/bungloo/Plugin.css" stringByExpandingTildeInPath];
if([fileManager fileExistsAtPath:pathToCssPlugin]) if([fileManager fileExistsAtPath:pathToCssPlugin])
{ {
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setTimeout(function() { loadCssPlugin('file://localhost%@') }, 1000);", pathToCssPlugin]]; [sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setTimeout(function() { loadCssPlugin('file://localhost%@') }, 1000);", pathToCssPlugin]];
} }
if([fileManager fileExistsAtPath:pathToJsPlugin]) if([fileManager fileExistsAtPath:pathToJsPlugin])
{ {
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setTimeout(function() { loadJsPlugin('file://localhost%@') }, 1000);", pathToJsPlugin]]; [sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setTimeout(function() { loadJsPlugin('file://localhost%@') }, 1000);", pathToJsPlugin]];
} }
[sender stringByEvaluatingJavaScriptFromString:@"var OS_TYPE = 'mac';"]; [sender stringByEvaluatingJavaScriptFromString:@"var OS_TYPE = 'mac';"];
if (sender == oauthView) { if (sender == oauthView) {
[oauthView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('oauth') }"]; [oauthView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('oauth') }"];
} else if(sender == conversationView) { } else if(sender == conversationView) {
[conversationView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('conversation') }"]; [conversationView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('conversation') }"];
} else if(sender == profileView) { } else if(sender == profileView) {
[profileView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('profile') }"]; [profileView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('profile') }"];
} else { } else {
NSString *action = @"timeline"; NSString *action = @"timeline";
NSString *delay = @"1"; NSString *delay = @"1";
if (sender == mentionsView) { if (sender == mentionsView) {
action = @"mentions"; action = @"mentions";
delay = @"1000"; delay = @"1000";
} }
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"function HostAppGo() { start('%@') }", action]]; [sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"function HostAppGo() { start('%@') }", action]];
} }
} }
@ -104,7 +104,7 @@
// FIXME // FIXME
/* /*
NSMutableArray *menuItems = [NSMutableArray arrayWithArray:defaultMenuItems]; NSMutableArray *menuItems = [NSMutableArray arrayWithArray:defaultMenuItems];
for (NSMenuItem*item in defaultMenuItems) { for (NSMenuItem*item in defaultMenuItems) {
if ([[item title] isEqualToString:@"Reload"]) { if ([[item title] isEqualToString:@"Reload"]) {
//[item setAction:@selector(reload:)]; //[item setAction:@selector(reload:)];
@ -113,7 +113,7 @@
[menuItems addObject:item]; [menuItems addObject:item];
} }
}*/ }*/
return defaultMenuItems; return defaultMenuItems;
} }
@ -126,7 +126,7 @@
{ {
NSFileManager *fileManager = [NSFileManager defaultManager]; NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *pathToPlugin = [@"~/Library/Application Support/Bungloo/Plugin.js" stringByExpandingTildeInPath]; NSString *pathToPlugin = [@"~/Library/Application Support/Bungloo/Plugin.js" stringByExpandingTildeInPath];
if([fileManager fileExistsAtPath:pathToPlugin]) if([fileManager fileExistsAtPath:pathToPlugin])
{ {
return [NSString stringWithFormat:@"%@", [NSURL fileURLWithPath:pathToPlugin]]; return [NSString stringWithFormat:@"%@", [NSURL fileURLWithPath:pathToPlugin]];

View file

@ -174,7 +174,7 @@
<p>Moved reply icon to left so it is easier to use when the scrollbar is shown</p> <p>Moved reply icon to left so it is easier to use when the scrollbar is shown</p>
<p>Login with the [Login] button now works</p> <p>Login with the [Login] button now works</p>
<p>Fixed automatic updates so it will work next time again.</p> <p>Fixed automatic updates so it will work next time again.</p>
<hr /> <hr />
<h1>Tentia 0.2.0</h2> <h1>Tentia 0.2.0</h2>
@ -191,15 +191,15 @@
<p>Mentions now appear as realnames</p> <p>Mentions now appear as realnames</p>
<hr /> <hr />
<h1>Tentia 0.1.1</h1> <h1>Tentia 0.1.1</h1>
<p>Bugfixes</p> <p>Bugfixes</p>
<p>Changed to send on Cmd+Enter.</p> <p>Changed to send on Cmd+Enter.</p>
<hr /> <hr />
<h1>Tentia 0.1.0</h1> <h1>Tentia 0.1.0</h1>
<p>First attempt to rewrite the old Twitter client Twittia to a new and shiny Tent client Tentia.</p> <p>First attempt to rewrite the old Twitter client Twittia to a new and shiny Tent client Tentia.</p>
</body> </body>
</html> </html>

View file

@ -39,7 +39,7 @@ ol li, .error, header.profile {
} }
body > ol > li { body > ol > li {
} }
body > ol > li:first-child { body > ol > li:first-child {

View file

@ -47,7 +47,7 @@ function(HostApp, Core, Paths, URI) {
var dom_element = _this.getStatusDOMElement(status); var dom_element = _this.getStatusDOMElement(status);
if (node) { if (node) {
node.parentNode.insertBefore(dom_element, node); node.parentNode.insertBefore(dom_element, node);
} else { } else {
@ -115,7 +115,7 @@ function(HostApp, Core, Paths, URI) {
var _this = this; var _this = this;
var callback = function(resp) { var callback = function(resp) {
var statuses = JSON.parse(resp.responseText); var statuses = JSON.parse(resp.responseText);
for (var i = 0; i < statuses.length; i++) { for (var i = 0; i < statuses.length; i++) {

View file

@ -33,13 +33,13 @@ function(HostApp, Timeline, URI, Paths) {
for (var i = 0; i < statuses.length; i++) { for (var i = 0; i < statuses.length; i++) {
var status = statuses[i]; var status = statuses[i];
var name; var name;
var profile = this.cache.profiles.getItem(status.entity); var profile = this.cache.profiles.getItem(status.entity);
if(profile) { if(profile) {
name = profile["https://tent.io/types/info/basic/v0.1.0"].name; name = profile["https://tent.io/types/info/basic/v0.1.0"].name;
} }
HostApp.notificateUserAboutMention(status.content.text, name || status.entity, status.id, status.entity); HostApp.notificateUserAboutMention(status.content.text, name || status.entity, status.id, status.entity);
}; };
} }
@ -52,7 +52,7 @@ function(HostApp, Timeline, URI, Paths) {
add_to_search = add_to_search || {}; add_to_search = add_to_search || {};
if (!add_to_search["mentioned_entity"]) { if (!add_to_search["mentioned_entity"]) {
add_to_search["mentioned_entity"] = HostApp.stringForKey("entity"); add_to_search["mentioned_entity"] = HostApp.stringForKey("entity");
} }
Timeline.prototype.getNewData.call(this, add_to_search); Timeline.prototype.getNewData.call(this, add_to_search);

View file

@ -92,7 +92,7 @@ function(HostApp, Paths, Hmac) {
// mac_key // mac_key
// mac_algorithm // mac_algorithm
this.register_data = register_data; this.register_data = register_data;
// Needed for later App Registration Modification // Needed for later App Registration Modification
HostApp.setStringForKey(register_data["mac_key"], "app_mac_key"); HostApp.setStringForKey(register_data["mac_key"], "app_mac_key");
HostApp.setStringForKey(register_data["mac_key_id"], "app_mac_key_id"); HostApp.setStringForKey(register_data["mac_key_id"], "app_mac_key_id");
@ -130,9 +130,9 @@ function(HostApp, Paths, Hmac) {
}; };
var auth_header = Hmac.makeAuthHeader( var auth_header = Hmac.makeAuthHeader(
url, url,
http_method, http_method,
HostApp.stringForKey("app_mac_key"), HostApp.stringForKey("app_mac_key"),
HostApp.stringForKey("app_mac_key_id") HostApp.stringForKey("app_mac_key_id")
); );
@ -147,13 +147,13 @@ function(HostApp, Paths, Hmac) {
Oauth.prototype.requestAccessTokenTicketFinished = function(responseBody) { Oauth.prototype.requestAccessTokenTicketFinished = function(responseBody) {
var access = JSON.parse(responseBody); var access = JSON.parse(responseBody);
HostApp.setStringForKey(access["access_token"], "user_access_token"); HostApp.setStringForKey(access["access_token"], "user_access_token");
HostApp.setSecret(access["mac_key"]); HostApp.setSecret(access["mac_key"]);
HostApp.setStringForKey(access["mac_algorithm"], "user_mac_algorithm"); HostApp.setStringForKey(access["mac_algorithm"], "user_mac_algorithm");
HostApp.setStringForKey(access["token_type"], "user_token_type"); HostApp.setStringForKey(access["token_type"], "user_token_type");
HostApp.loggedIn(); HostApp.loggedIn();
} }
@ -162,9 +162,9 @@ function(HostApp, Paths, Hmac) {
var url = Paths.mkApiRootPath("/apps/" + HostApp.stringForKey("app_id")); var url = Paths.mkApiRootPath("/apps/" + HostApp.stringForKey("app_id"));
var http_method = "DELETE"; var http_method = "DELETE";
var auth_header = Hmac.makeAuthHeader( var auth_header = Hmac.makeAuthHeader(
url, url,
http_method, http_method,
HostApp.stringForKey("app_mac_key"), HostApp.stringForKey("app_mac_key"),
HostApp.stringForKey("app_mac_key_id") HostApp.stringForKey("app_mac_key_id")
); );
@ -178,10 +178,10 @@ function(HostApp, Paths, Hmac) {
HostApp.setStringForKey(null, "user_mac_algorithm"); HostApp.setStringForKey(null, "user_mac_algorithm");
HostApp.setStringForKey(null, "user_token_type"); HostApp.setStringForKey(null, "user_token_type");
HostApp.setStringForKey(null, "api_root"); HostApp.setStringForKey(null, "api_root");
HostApp.setStringForKey(null, "entity"); HostApp.setStringForKey(null, "entity");
}, null, auth_header); }, null, auth_header);
} }
return Oauth; return Oauth;

View file

@ -253,7 +253,7 @@ function(HostApp, Core, Paths, URI) {
this.populate(this.profile_template.location, basic.location); this.populate(this.profile_template.location, basic.location);
this.populate(this.profile_template.gender, basic.gender); this.populate(this.profile_template.gender, basic.gender);
this.populate(this.profile_template.bio, basic.bio); this.populate(this.profile_template.bio, basic.bio);
if(basic.website_url) { if(basic.website_url) {
var url = basic.website_url; var url = basic.website_url;
@ -405,7 +405,7 @@ function(HostApp, Core, Paths, URI) {
var _this = this; var _this = this;
if (this.following_id) { if (this.following_id) {
this.setFollowingButton(false); this.setFollowingButton(false);
var url = Paths.mkApiRootPath("/followings/") + this.following_id; var url = Paths.mkApiRootPath("/followings/") + this.following_id;
Paths.getURL(url, "DELETE", function(resp) { Paths.getURL(url, "DELETE", function(resp) {
@ -566,7 +566,7 @@ function(HostApp, Core, Paths, URI) {
}, null, false); // do not send auth-headers }, null, false); // do not send auth-headers
} }
}); });
} }
return li; return li;

View file

@ -146,7 +146,7 @@ function(Core, Paths, HostApp, URI) {
if (!callback) { if (!callback) {
callback = function(data) { _this.getNewData(); } callback = function(data) { _this.getNewData(); }
} }
Core.prototype.repost.call(this, id, entity, callback); Core.prototype.repost.call(this, id, entity, callback);
} }
Timeline.prototype.logout = function() { Timeline.prototype.logout = function() {

View file

@ -56,7 +56,7 @@ function(URI, CacheStorage, require) {
Cache.prototype.stopGettingFollowings = function() { Cache.prototype.stopGettingFollowings = function() {
clearTimeout(this.intervall); clearTimeout(this.intervall);
} }
return Cache; return Cache;
}); });

View file

@ -17,9 +17,9 @@ function() {
CacheStorage.prototype.getItem = function(key) { CacheStorage.prototype.getItem = function(key) {
var item = null; var item = null;
try { // If localStorage doesn't work then just leave it empty try { // If localStorage doesn't work then just leave it empty
item = JSON.parse(localStorage.getItem(this.mkPath(key))); item = JSON.parse(localStorage.getItem(this.mkPath(key)));
} catch(e) {} } catch(e) {}
return item; return item;
@ -35,7 +35,7 @@ function() {
var length_path = this.mkInternalPath("_length"); var length_path = this.mkInternalPath("_length");
var length = parseInt(localStorage.getItem(length_path), 10) + 1; var length = parseInt(localStorage.getItem(length_path), 10) + 1;
localStorage.setItem(length_path, length); localStorage.setItem(length_path, length);
} }
} catch(e) {} } catch(e) {}
} }
@ -49,7 +49,7 @@ function() {
var length_path = this.mkInternalPath("_length"); var length_path = this.mkInternalPath("_length");
var length = parseInt(localStorage.getItem(length_path), 10) - 1; var length = parseInt(localStorage.getItem(length_path), 10) - 1;
localStorage.setItem(length_path, length); localStorage.setItem(length_path, length);
} }
} catch(e) {} } catch(e) {}
}; };
@ -62,7 +62,7 @@ function() {
} }
} }
localStorage.setItem(this.mkInternalPath("_length"), 0); localStorage.setItem(this.mkInternalPath("_length"), 0);
} catch(e) {} } catch(e) {}
} }

View file

@ -18,20 +18,20 @@ function(jQuery, Paths, URI, HostApp, Cache) {
if(this.template == "undefined") { if(this.template == "undefined") {
return jQuery.extend(true, {}, this.template); return jQuery.extend(true, {}, this.template);
} }
var a = document.createElement("a"); var a = document.createElement("a");
var item = document.createElement("li"); var item = document.createElement("li");
var aside = document.createElement("aside"); var aside = document.createElement("aside");
item.appendChild(aside); item.appendChild(aside);
var reply_to = a.cloneNode(); var reply_to = a.cloneNode();
reply_to.className = "reply_to" reply_to.className = "reply_to"
reply_to.innerText = " "; reply_to.innerText = " ";
reply_to.href = "#"; reply_to.href = "#";
aside.appendChild(reply_to); aside.appendChild(reply_to);
var repost = a.cloneNode(); var repost = a.cloneNode();
repost.className = "repost"; repost.className = "repost";
repost.innerText = " "; repost.innerText = " ";
@ -43,29 +43,29 @@ function(jQuery, Paths, URI, HostApp, Cache) {
remove.innerText = " "; remove.innerText = " ";
remove.href = "#"; remove.href = "#";
aside.appendChild(remove); aside.appendChild(remove);
var image = document.createElement("img"); var image = document.createElement("img");
image.className = "image"; image.className = "image";
image.src = "img/default-avatar.png"; image.src = "img/default-avatar.png";
image.onmousedown = function(e) { e.preventDefault(); }; image.onmousedown = function(e) { e.preventDefault(); };
item.appendChild(image); item.appendChild(image);
var image_username = a.cloneNode(); var image_username = a.cloneNode();
image.appendChild(image_username); image.appendChild(image_username);
var data = document.createElement("div"); var data = document.createElement("div");
data.className = "data"; data.className = "data";
item.appendChild(data); item.appendChild(data);
var head = document.createElement("h1"); var head = document.createElement("h1");
data.appendChild(head); data.appendChild(head);
var username = a.cloneNode(); var username = a.cloneNode();
head.appendChild(username); head.appendChild(username);
var space = document.createTextNode(" "); var space = document.createTextNode(" ");
head.appendChild(space); head.appendChild(space);
var geo = document.createElement("a"); var geo = document.createElement("a");
geo.style.display = "none"; geo.style.display = "none";
head.appendChild(geo); head.appendChild(geo);
@ -80,7 +80,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
head.appendChild(is_private); head.appendChild(is_private);
head.appendChild(space.cloneNode()); head.appendChild(space.cloneNode());
var pin = document.createElement("img"); var pin = document.createElement("img");
pin.src = "img/pin.png"; pin.src = "img/pin.png";
pin.alt = "Map link"; pin.alt = "Map link";
@ -102,29 +102,29 @@ function(jQuery, Paths, URI, HostApp, Cache) {
head.appendChild(reposted_by) head.appendChild(reposted_by)
var message = document.createElement("p"); var message = document.createElement("p");
message.className = "message"; message.className = "message";
data.appendChild(message); data.appendChild(message);
var images = document.createElement("p") var images = document.createElement("p")
images.className = "images"; images.className = "images";
data.appendChild(images); data.appendChild(images);
var date = message.cloneNode(); var date = message.cloneNode();
date.className = "date"; date.className = "date";
data.appendChild(date); data.appendChild(date);
var ago = a.cloneNode(); var ago = a.cloneNode();
date.appendChild(ago); date.appendChild(ago);
var from = document.createTextNode(" from "); var from = document.createTextNode(" from ");
date.appendChild(from) date.appendChild(from)
var source = document.createElement("a"); var source = document.createElement("a");
source.className = "source"; source.className = "source";
date.appendChild(source) date.appendChild(source)
this.template = { this.template = {
item: item, item: item,
reply_to: reply_to, reply_to: reply_to,
@ -238,15 +238,15 @@ function(jQuery, Paths, URI, HostApp, Cache) {
}, null, false); // do not send auth-headers }, null, false); // do not send auth-headers
} }
}); });
} }
if (status && status.permissions && !status.permissions.public) { if (status && status.permissions && !status.permissions.public) {
template.is_private.style.display = ''; template.is_private.style.display = '';
} }
var text = ""; var text = "";
if (status.type == "https://tent.io/types/post/photo/v0.1.0") { if (status.type == "https://tent.io/types/post/photo/v0.1.0") {
text = status.content.caption; text = status.content.caption;
} else { } else {
@ -271,7 +271,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
for (var i = 0; i < status.attachments.length; i++) { for (var i = 0; i < status.attachments.length; i++) {
// closure needed for the callback // closure needed for the callback
(function() { (function() {
var attachment = status.attachments[i]; var attachment = status.attachments[i];
var img = new Image(); var img = new Image();
@ -317,7 +317,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
HostApp.showConversation(status.id, status.entity); HostApp.showConversation(status.id, status.entity);
return false; return false;
} }
// {"type":"Point","coordinates":[57.10803113,12.25854746]} // {"type":"Point","coordinates":[57.10803113,12.25854746]}
if (status.content && status.content.location && (typeof status.content.location.type == "undefined" || status.content.location.type == "Point")) { if (status.content && status.content.location && (typeof status.content.location.type == "undefined" || status.content.location.type == "Point")) {
var href = "http://www.openstreetmap.org/?mlat=" + status.content.location.coordinates[0] + "&mlon=" + status.content.location.coordinates[1] + "&zoom=12" var href = "http://www.openstreetmap.org/?mlat=" + status.content.location.coordinates[0] + "&mlon=" + status.content.location.coordinates[1] + "&zoom=12"
@ -328,7 +328,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
if (typeof status.__repost != "undefined") { if (typeof status.__repost != "undefined") {
template.source.href = status.__repost.app.url; template.source.href = status.__repost.app.url;
template.source.innerHTML = status.__repost.app.name; template.source.innerHTML = status.__repost.app.name;
template.source.title = status.__repost.app.url; template.source.title = status.__repost.app.url;
} else { } else {
template.source.href = status.app.url; template.source.href = status.app.url;
template.source.innerHTML = status.app.name; template.source.innerHTML = status.app.name;
@ -372,7 +372,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
} }
var reposted_count = $(post).find(".reposted_by ul li").length + 1; var reposted_count = $(post).find(".reposted_by ul li").length + 1;
var people_person = reposted_count == 1 ? "person" : "people"; var people_person = reposted_count == 1 ? "person" : "people";
$(post).find(".reposted_by span").html("by " + reposted_count + " " + people_person); $(post).find(".reposted_by span").html("by " + reposted_count + " " + people_person);
@ -381,12 +381,12 @@ function(jQuery, Paths, URI, HostApp, Cache) {
var li = $("<li/>"); var li = $("<li/>");
li.attr("id", "post-" + repost.id) li.attr("id", "post-" + repost.id)
var a = $("<a/>"); var a = $("<a/>");
a.attr("href", repost.entity); a.attr("href", repost.entity);
a.attr("title", repost.entity); a.attr("title", repost.entity);
a.html(repost.entity); a.html(repost.entity);
li.append(a); li.append(a);
$(post).find(".reposted_by ul").append(li); $(post).find(".reposted_by ul").append(li);
a.click(function(e) { a.click(function(e) {
@ -600,10 +600,10 @@ function(jQuery, Paths, URI, HostApp, Cache) {
Core.prototype.logout = function() { Core.prototype.logout = function() {
this.body.innerHTML = ""; this.body.innerHTML = "";
} }
// Helper functions // Helper functions
@ -613,9 +613,9 @@ function(jQuery, Paths, URI, HostApp, Cache) {
if(url.startsWith("http://j.mp/")) { if(url.startsWith("http://j.mp/")) {
api = "http://api.j.mp"; api = "http://api.j.mp";
} }
var api_url = api + "/v3/expand?format=json&apiKey=R_4fc2a1aa461d076556016390fa6400f6&login=twittia&shortUrl=" + url; // FIXME: new api key var api_url = api + "/v3/expand?format=json&apiKey=R_4fc2a1aa461d076556016390fa6400f6&login=twittia&shortUrl=" + url; // FIXME: new api key
jQuery.ajax({ jQuery.ajax({
url: api_url, url: api_url,
success: function(data) { success: function(data) {
@ -636,7 +636,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
var text = node.innerHTML; var text = node.innerHTML;
var mentions_in_text = []; var mentions_in_text = [];
var res = text.match(/(\^[\w:/.]+(?:[\w]))/ig); var res = text.match(/(\^[\w:/.]+(?:[\w]))/ig);
if (res) { if (res) {
@ -665,7 +665,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
(function(mention) { // need this closure (function(mention) { // need this closure
var profile = function(profile) { var profile = function(profile) {
var basic = profile["https://tent.io/types/info/basic/v0.1.0"]; var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
if (profile) { if (profile) {
@ -675,7 +675,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
} }
var new_text = node.innerHTML.replace( var new_text = node.innerHTML.replace(
mention.text, mention.text,
"<a href='" + mention.entity + "' class='name' title='" + mention.entity + "'>" "<a href='" + mention.entity + "' class='name' title='" + mention.entity + "'>"
+ name + name
+ "</a>" + "</a>"
@ -712,7 +712,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
if (resp.status >= 200 && resp.status < 400) { if (resp.status >= 200 && resp.status < 400) {
var p = JSON.parse(resp.responseText); var p = JSON.parse(resp.responseText);
_this.cache.profiles.setItem(mention.entity, p); _this.cache.profiles.setItem(mention.entity, p);
profile(p) profile(p)
} }
}, null, false); // do not send auth-headers }, null, false); // do not send auth-headers
} }
@ -726,16 +726,16 @@ function(jQuery, Paths, URI, HostApp, Cache) {
Core.prototype.parseMentions = function(text, post_id, entity) { Core.prototype.parseMentions = function(text, post_id, entity) {
var mentions = []; var mentions = [];
if (post_id && entity && post_id != "(null)" && entity != "(null)") { if (post_id && entity && post_id != "(null)" && entity != "(null)") {
mentions.push({ mentions.push({
post: post_id, post: post_id,
entity: entity entity: entity
}) })
} }
var res = text.match(/(\^[\w:/]+\.[\w:/.]+(?:[\w]))/ig); var res = text.match(/(\^[\w:/]+\.[\w:/.]+(?:[\w]))/ig);
if (res) { if (res) {
for (var i = 0; i < res.length; i++) { for (var i = 0; i < res.length; i++) {
var e = res[i].substring(1); var e = res[i].substring(1);
@ -791,7 +791,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
return text.replace(hash, "$1$2<a href='https://skate.io/search?q=%23$3'>$3</a>"); return text.replace(hash, "$1$2<a href='https://skate.io/search?q=%23$3'>$3</a>");
} }
Core.prototype.replyTo = function(entity, status_id, mentions, is_private) { Core.prototype.replyTo = function(entity, status_id, mentions, is_private) {
var string = "^" + entity.replace("https://", "") + " "; var string = "^" + entity.replace("https://", "") + " ";
for (var i = 0; i < mentions.length; i++) { for (var i = 0; i < mentions.length; i++) {
@ -815,7 +815,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
} else { } else {
var reposted_by = ul.parent(".reposted_by"); var reposted_by = ul.parent(".reposted_by");
var reposted_count = reposted_by.find("ul li").length; var reposted_count = reposted_by.find("ul li").length;
var people_person = reposted_count == 1 ? "person" : "people"; var people_person = reposted_count == 1 ? "person" : "people";
reposted_by.find("span").html("by " + reposted_count + " " + people_person); reposted_by.find("span").html("by " + reposted_count + " " + people_person);

View file

@ -18,7 +18,7 @@ function(URI, CryptoJS) {
port = url.protocol() == "https" ? "443" : "80"; port = url.protocol() == "https" ? "443" : "80";
} }
var normalizedRequestString = "" var normalizedRequestString = ""
+ time_stamp + '\n' + time_stamp + '\n'
+ nonce + '\n' + nonce + '\n'
+ http_method + '\n' + http_method + '\n'

View file

@ -1,5 +1,5 @@
define(function() { define(function() {
var HostApp = {}; var HostApp = {};
HostApp.setStringForKey = function(string, key) { HostApp.setStringForKey = function(string, key) {
@ -10,16 +10,16 @@ define(function() {
controller.setStringForKey(string, key); controller.setStringForKey(string, key);
} }
} }
HostApp.setSecret = function(string) { HostApp.setSecret = function(string) {
if (OS_TYPE == "mac") { if (OS_TYPE == "mac") {
controller.setSecret_(string); controller.setSecret_(string);
} else { } else {
controller.setStringForKey(string, "user_mac_key"); controller.setStringForKey(string, "user_mac_key");
} }
} }
HostApp.secret = function() { HostApp.secret = function() {
if (OS_TYPE == "mac") { if (OS_TYPE == "mac") {
return controller.secret(); return controller.secret();
@ -140,6 +140,6 @@ define(function() {
} }
} }
return HostApp; return HostApp;
}); });

View file

@ -46,13 +46,13 @@ function(jQuery, HostApp, Hmac, Cache) {
if (auth_header !== false && typeof user_access_token != "undefined") { if (auth_header !== false && typeof user_access_token != "undefined") {
auth_header = Hmac.makeAuthHeader( auth_header = Hmac.makeAuthHeader(
url, url,
http_method, http_method,
HostApp.secret(), HostApp.secret(),
user_access_token user_access_token
); );
xhr.setRequestHeader("Authorization", auth_header); xhr.setRequestHeader("Authorization", auth_header);
} }
} }
}, },
url: url, url: url,
@ -85,14 +85,14 @@ function(jQuery, HostApp, Hmac, Cache) {
if (user_access_token) { if (user_access_token) {
auth_header = Hmac.makeAuthHeader( auth_header = Hmac.makeAuthHeader(
url, url,
"POST", "POST",
HostApp.secret(), HostApp.secret(),
user_access_token user_access_token
); );
xhr.setRequestHeader("Authorization", auth_header); xhr.setRequestHeader("Authorization", auth_header);
} }
}, },
url: url, url: url,
contentType: "multipart/form-data;boundary=" + boundary, contentType: "multipart/form-data;boundary=" + boundary,

View file

@ -9,7 +9,7 @@ function start(view) {
if (view == "oauth") { if (view == "oauth") {
require(["controller/Oauth"], function(Oauth) { require(["controller/Oauth"], function(Oauth) {
bungloo_instance = new Oauth(); bungloo_instance = new Oauth();
}); });
@ -17,9 +17,9 @@ function start(view) {
} else if (view == "timeline") { } else if (view == "timeline") {
require(["controller/Timeline"], function(Timeline) { require(["controller/Timeline"], function(Timeline) {
bungloo_instance = new Timeline(); bungloo_instance = new Timeline();
}); });
} else if (view == "mentions") { } else if (view == "mentions") {
@ -131,7 +131,7 @@ function loadCssPlugin(css_url) {
} }
function debug(string) { function debug(string) {
if (typeof string != "string") { if (typeof string != "string") {
string = JSON.stringify(string); string = JSON.stringify(string);
} }
@ -141,18 +141,18 @@ function debug(string) {
function go() { // wait untill everything is loaded function go() { // wait untill everything is loaded
setTimeout(function() { setTimeout(function() {
if (typeof HostAppGo != typeof __not_defined__) { if (typeof HostAppGo != typeof __not_defined__) {
HostAppGo(); HostAppGo();
} else { } else {
go(); go();
} }
}, 500); }, 500);
} }
go(); go();