From bd7d091196d87e0b3c352d088fc53fc8e4bb8e3f Mon Sep 17 00:00:00 2001 From: emsquared Date: Sun, 22 Jul 2012 18:34:38 -0400 Subject: [PATCH] Updates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit — Brand new JavaScript API. May break some themes. — Fixed bug resulting in WebView not loading properly when using @font-face. — Made it so some special commands are not returned when asking for the switch case index in our private command list. … Fixes a disconnect bug. --- Classes/Headers/IRCChannelConfig.h | 1 + Classes/Headers/StaticDefinitions.h | 2 +- .../Cocoa (Objective-C)/NSStringHelper.m | 4 +- Classes/IRC/IRCChannelConfig.m | 4 +- Classes/IRC/IRCWorld.m | 2 + Classes/Preferences/TPCPreferences.m | 104 +++++++------ Classes/Views/Channel View/LVCLogRenderer.m | 6 +- Classes/Views/Channel View/TVCLogController.m | 112 ++++++++++---- .../Channel View/TVCLogScriptEventSink.m | 13 +- Classes/Views/Channel View/TVCLogView.m | 2 +- .../project.pbxproj | 15 ++ Resources/Info.plist | 4 +- Resources/Javascript/API/core.js | 143 +++++++++++++----- Resources/Styles/Astria/scripts.js | 35 ++--- .../Styles/Matrix by bogo_lode/scripts.js | 36 +++-- Resources/Styles/Sapientia/scripts.js | 36 +++-- .../Simplified Dark Inverted/scripts.js | 36 +++-- Resources/Styles/Simplified Dark/scripts.js | 36 +++-- .../Styles/Simplified Light Blue/scripts.js | 36 +++-- Resources/Styles/Simplified Light/scripts.js | 36 +++-- 20 files changed, 393 insertions(+), 270 deletions(-) diff --git a/Classes/Headers/IRCChannelConfig.h b/Classes/Headers/IRCChannelConfig.h index fcacd0a143..d18d331735 100755 --- a/Classes/Headers/IRCChannelConfig.h +++ b/Classes/Headers/IRCChannelConfig.h @@ -44,6 +44,7 @@ typedef enum IRCChannelType : NSInteger { @interface IRCChannelConfig : NSObject @property (nonatomic, assign) IRCChannelType type; +@property (nonatomic, strong) NSString *guid; @property (nonatomic, strong) NSString *name; @property (nonatomic, strong) NSString *password; @property (nonatomic, assign) BOOL autoJoin; diff --git a/Classes/Headers/StaticDefinitions.h b/Classes/Headers/StaticDefinitions.h index 7d23901766..13965ffb4d 100755 --- a/Classes/Headers/StaticDefinitions.h +++ b/Classes/Headers/StaticDefinitions.h @@ -80,7 +80,7 @@ /* http://stackoverflow.com/questions/969130/nslog-tips-and-tricks */ #ifdef DEBUG - #define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); + #define DLog(fmt, ...) NSLog((@"%s [Line %d]: " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); #else #define DLog(...) #endif diff --git a/Classes/Helpers/Cocoa (Objective-C)/NSStringHelper.m b/Classes/Helpers/Cocoa (Objective-C)/NSStringHelper.m index 07b84ec29a..bac97ae5f5 100755 --- a/Classes/Helpers/Cocoa (Objective-C)/NSStringHelper.m +++ b/Classes/Helpers/Cocoa (Objective-C)/NSStringHelper.m @@ -677,8 +677,8 @@ - (CGFloat)pixelHeightInWidth:(NSInteger)width forcedFont:(NSFont *)font NSMutableDictionary *attributes = [NSMutableDictionary dictionary]; - attributes[NSFontAttributeName] = font; - attributes[NSParagraphStyleAttributeName] = paragraphStyle; + attributes[NSFontAttributeName] = font; + attributes[NSParagraphStyleAttributeName] = paragraphStyle; [baseMutable setAttributes:attributes range:NSMakeRange(0, baseMutable.length)]; diff --git a/Classes/IRC/IRCChannelConfig.m b/Classes/IRC/IRCChannelConfig.m index dc28e6617d..53484cb7e8 100755 --- a/Classes/IRC/IRCChannelConfig.m +++ b/Classes/IRC/IRCChannelConfig.m @@ -42,6 +42,8 @@ @implementation IRCChannelConfig - (id)init { if ((self = [super init])) { + self.guid = [NSString stringWithUUID]; + self.type = IRCChannelNormalType; self.ignoreInlineImages = NO; @@ -64,7 +66,7 @@ - (id)initWithDictionary:(NSDictionary *)dic { if ((self = [self init])) { dic = [TPCPreferencesMigrationAssistant convertIRCChannelConfiguration:dic]; - + self.type = (IRCChannelType)[dic integerForKey:@"channelType"]; self.name = (([dic stringForKey:@"channelName"]) ?: NSStringEmptyPlaceholder); diff --git a/Classes/IRC/IRCWorld.m b/Classes/IRC/IRCWorld.m index bfc5dda030..48df5f0751 100755 --- a/Classes/IRC/IRCWorld.m +++ b/Classes/IRC/IRCWorld.m @@ -643,6 +643,8 @@ - (void)selectClientAt:(NSInteger)n - (void)reloadTheme { + [self.dummyLog reloadTheme]; + self.viewTheme.name = [TPCPreferences themeName]; NSMutableArray *logs = [NSMutableArray array]; diff --git a/Classes/Preferences/TPCPreferences.m b/Classes/Preferences/TPCPreferences.m index 74ce721910..81844c28e5 100755 --- a/Classes/Preferences/TPCPreferences.m +++ b/Classes/Preferences/TPCPreferences.m @@ -86,53 +86,53 @@ + (NSDictionary *)systemInfoPlist + (void)populateCommandIndex { IRCInternalUseCommandIndexMap = @[ // Open Key: 1051 - @[@"action", @"ACTION", @(1002)], - @[@"adchat", @"ADCHAT", @(1003)], - @[@"away", @"AWAY", @(1050)], - @[@"cap", @"CAP", @(1004)], - @[@"cap_authenticate", @"AUTHENTICATE", @(1005)], - @[@"chatops", @"CHATOPS", @(1006)], - @[@"ctcp", @"CTCP", @(1007)], - @[@"ctcp_clientinfo", @"CLIENTINFO", @(1008)], - @[@"ctcp_ctcpreply", @"CTCPREPLY", @(1009)], - @[@"ctcp_lagcheck", @"LAGCHECK", @(1010)], - @[@"ctcp_ping", @"PING", @(1011)], - @[@"ctcp_time", @"TIME", @(1012)], - @[@"ctcp_userinfo", @"USERINFO", @(1013)], - @[@"ctcp_version", @"VERSION", @(1014)], - @[@"dcc", @"DCC", @(1015)], - @[@"error", @"ERROR", @(1016)], - @[@"gline", @"GLINE", @(1047)], - @[@"globops", @"GLOBOPS", @(1017)], - @[@"gzline", @"GZLINE", @(1048)], - @[@"invite", @"INVITE", @(1018)], - @[@"ison", @"ISON", @(1019)], - @[@"ison", @"ISON", @(1043)], - @[@"join", @"JOIN", @(1020)], - @[@"kick", @"KICK", @(1021)], - @[@"kill", @"KILL", @(1022)], - @[@"list", @"LIST", @(1023)], - @[@"locops", @"LOCOPS", @(1024)], - @[@"mode", @"MODE", @(1026)], - @[@"nachat", @"NACHAT", @(1027)], - @[@"names", @"NAMES", @(1028)], - @[@"nick", @"NICK", @(1029)], - @[@"notice", @"NOTICE", @(1030)], - @[@"part", @"PART", @(1031)], - @[@"pass", @"PASS", @(1032)], - @[@"ping", @"PING", @(1033)], - @[@"pong", @"PONG", @(1034)], - @[@"privmsg", @"PRIVMSG", @(1035)], - @[@"quit", @"QUIT", @(1036)], - @[@"shun", @"SHUN", @(1045)], - @[@"tempshun", @"TEMPSHUN", @(1046)], - @[@"topic", @"TOPIC", @(1039)], - @[@"user", @"USER", @(1037)], - @[@"wallops", @"WALLOPS", @(1038)], - @[@"who", @"WHO", @(1040)], - @[@"whois", @"WHOIS", @(1042)], - @[@"whowas", @"WHOWAS", @(1041)], - @[@"zline", @"ZLINE", @(1049)], + @[@"action", @"ACTION", @(1002), @(NO)], + @[@"adchat", @"ADCHAT", @(1003), @(YES)], + @[@"away", @"AWAY", @(1050), @(YES)], + @[@"cap", @"CAP", @(1004), @(YES)], + @[@"cap_authenticate", @"AUTHENTICATE", @(1005), @(YES)], + @[@"chatops", @"CHATOPS", @(1006), @(YES)], + @[@"ctcp", @"CTCP", @(1007), @(NO)], + @[@"ctcp_clientinfo", @"CLIENTINFO", @(1008), @(NO)], + @[@"ctcp_ctcpreply", @"CTCPREPLY", @(1009), @(NO)], + @[@"ctcp_lagcheck", @"LAGCHECK", @(1010), @(NO)], + @[@"ctcp_ping", @"PING", @(1011), @(NO)], + @[@"ctcp_time", @"TIME", @(1012), @(NO)], + @[@"ctcp_userinfo", @"USERINFO", @(1013), @(NO)], + @[@"ctcp_version", @"VERSION", @(1014), @(NO)], + @[@"dcc", @"DCC", @(1015), @(NO)], + @[@"error", @"ERROR", @(1016), @(YES)], + @[@"gline", @"GLINE", @(1047), @(YES)], + @[@"globops", @"GLOBOPS", @(1017), @(YES)], + @[@"gzline", @"GZLINE", @(1048), @(YES)], + @[@"invite", @"INVITE", @(1018), @(YES)], + @[@"ison", @"ISON", @(1019), @(YES)], + @[@"ison", @"ISON", @(1043), @(YES)], + @[@"join", @"JOIN", @(1020), @(YES)], + @[@"kick", @"KICK", @(1021), @(YES)], + @[@"kill", @"KILL", @(1022), @(YES)], + @[@"list", @"LIST", @(1023), @(YES)], + @[@"locops", @"LOCOPS", @(1024), @(YES)], + @[@"mode", @"MODE", @(1026), @(YES)], + @[@"nachat", @"NACHAT", @(1027), @(YES)], + @[@"names", @"NAMES", @(1028), @(YES)], + @[@"nick", @"NICK", @(1029), @(YES)], + @[@"notice", @"NOTICE", @(1030), @(YES)], + @[@"part", @"PART", @(1031), @(YES)], + @[@"pass", @"PASS", @(1032), @(YES)], + @[@"ping", @"PING", @(1033), @(YES)], + @[@"pong", @"PONG", @(1034), @(YES)], + @[@"privmsg", @"PRIVMSG", @(1035), @(YES)], + @[@"quit", @"QUIT", @(1036), @(YES)], + @[@"shun", @"SHUN", @(1045), @(YES)], + @[@"tempshun", @"TEMPSHUN", @(1046), @(YES)], + @[@"topic", @"TOPIC", @(1039), @(YES)], + @[@"user", @"USER", @(1037), @(YES)], + @[@"wallops", @"WALLOPS", @(1038), @(YES)], + @[@"who", @"WHO", @(1040), @(YES)], + @[@"whois", @"WHOIS", @(1042), @(YES)], + @[@"whowas", @"WHOWAS", @(1041), @(YES)], + @[@"zline", @"ZLINE", @(1049), @(YES)], ]; IRCUserAccessibleCommandIndexMap = @[ // Open Key: 5085 @@ -283,7 +283,7 @@ + (NSString *)IRCCommandFromIndexKey:(NSString *)key publicSearch:(BOOL)isPublic NSString *rkey = [TPCPreferences IRCCommandFromIndexKey:ckey publicSearch:NO]; - DLog(@"IRCPrivateCommandIndex(): %@; %@", ckey, rkey); + DLog(@"%@; %@", ckey, rkey); return rkey; } @@ -294,7 +294,7 @@ + (NSString *)IRCCommandFromIndexKey:(NSString *)key publicSearch:(BOOL)isPublic NSString *rkey = [TPCPreferences IRCCommandFromIndexKey:ckey publicSearch:YES]; - DLog(@"IRCPublicCommandIndex(): %@", ckey); + DLog(@"%@; %@", ckey, rkey); return rkey; } @@ -321,6 +321,12 @@ + (NSInteger)indexOfIRCommand:(NSString *)command publicSearch:(BOOL)isPublic if (inDevMode == NO && developerOnly) { continue; } + } else { + BOOL isNotSpecial = [indexInfo boolAtIndex:3]; + + if (isNotSpecial == NO) { + continue; + } } if ([matValue isEqualNoCase:command]) { diff --git a/Classes/Views/Channel View/LVCLogRenderer.m b/Classes/Views/Channel View/LVCLogRenderer.m index c4803234bf..521fd3c703 100755 --- a/Classes/Views/Channel View/LVCLogRenderer.m +++ b/Classes/Views/Channel View/LVCLogRenderer.m @@ -241,9 +241,9 @@ NSInteger mapColorValue(NSColor *color) link = [NSString stringWithFormat:@"http://%@", link]; } - return [NSString stringWithFormat:@"%@", link, logEscape(content)]; + return [NSString stringWithFormat:@"%@", link, logEscape(content)]; } else if (attr & _rendererChannelNameAttribute) { - return [NSString stringWithFormat:@"%@", logEscape(content)]; + return [NSString stringWithFormat:@"%@", logEscape(content)]; } else { BOOL matchedUser = NO; @@ -259,7 +259,7 @@ NSInteger mapColorValue(NSColor *color) if ([user.nick isEqualNoCase:client.myNick] == NO) { matchedUser = YES; - [s appendFormat:@"", [user colorNumber]]; + [s appendFormat:@"", [user colorNumber]]; } } } diff --git a/Classes/Views/Channel View/TVCLogController.m b/Classes/Views/Channel View/TVCLogController.m index 7635c29f19..e65446719c 100755 --- a/Classes/Views/Channel View/TVCLogController.m +++ b/Classes/Views/Channel View/TVCLogController.m @@ -38,7 +38,6 @@ #import "TextualApplication.h" #define _bottomEpsilon 0 -#define _timeBufferSize 256 @implementation TVCLogController @@ -183,9 +182,19 @@ - (void)messageQueueLoop - (void)loadAlternateHTML:(NSString *)newHTML { [(id)self.view setBackgroundColor:self.theme.other.underlyingWindowColor]; + [[self.view mainFrame] loadHTMLString:newHTML baseURL:self.theme.baseUrl]; } +- (void)executeScriptCommand:(NSString *)command withArguments:(NSArray *)args +{ + WebScriptObject *js_api = [self.view js_api]; + + if (js_api && [js_api isKindOfClass:[WebUndefined class]] == NO) { + [js_api callWebScriptMethod:command withArguments:args]; + } +} + - (NSInteger)scrollbackCorrectionInit { return (self.view.frame.size.height / 2); @@ -202,13 +211,15 @@ - (void)notifyDidBecomeVisible - (DOMDocument *)mainFrameDocument { - return [self.view mainFrameDocument]; + return [self.view.mainFrame DOMDocument]; } - (DOMNode *)html_head { DOMDocument *doc = [self mainFrameDocument]; + DOMNodeList *nodes = [doc getElementsByTagName:@"head"]; + DOMNode *head = [nodes item:0]; return head; @@ -253,6 +264,8 @@ - (void)setTopic:(NSString *)topic if (PointerIsEmpty(topic_body)) return NO; [(id)topic_body setInnerHTML:body]; + + [self executeScriptCommand:@"topicBarValueChanged" withArguments:@[topic]]; } return YES; @@ -274,6 +287,8 @@ - (void)moveToTop if (body) { [body setValue:@0 forKey:@"scrollTop"]; } + + [self executeScriptCommand:@"viewPositionMovedToTop" withArguments:@[]]; } - (void)moveToBottom @@ -290,6 +305,8 @@ - (void)moveToBottom if (body) { [body setValue:[body valueForKey:@"scrollHeight"] forKey:@"scrollTop"]; } + + [self executeScriptCommand:@"viewPositionMovedToBottom" withArguments:@[]]; } - (BOOL)viewingBottom @@ -351,10 +368,12 @@ - (void)mark [self restorePosition]; } + + [self executeScriptCommand:@"historyIndicatorAddedToView" withArguments:@[]]; return YES; } copy]; - + [self.messageQueue safeAddObject:messageBlock]; [self createViewLoop]; } @@ -374,10 +393,12 @@ - (void)unmark --self.count; } - + + [self executeScriptCommand:@"historyIndicatorRemovedFromView" withArguments:@[]]; + return YES; } copy]; - + [self.messageQueue safeAddObject:messageBlock]; [self createViewLoop]; } @@ -405,29 +426,28 @@ - (void)goToMark [[doc body] setValue:@(y - [self scrollbackCorrectionInit]) forKey:@"scrollTop"]; } + + [self executeScriptCommand:@"viewPositionMovedToHistoryIndicator" withArguments:@[]]; } - (void)reloadTheme { if (self.loaded == NO) return; - + DOMDocument *doc = [self mainFrameDocument]; if (PointerIsEmpty(doc)) return; - - WebScriptObject *js_api = [self.view js_api]; - - if (js_api && [js_api isKindOfClass:[WebUndefined class]] == NO) { - [js_api callWebScriptMethod:@"willDoThemeChange" withArguments:@[]]; - } - + + + [self executeScriptCommand:@"themeWillChange" withArguments:@[]]; + DOMElement *body = [self body:doc]; if (PointerIsEmpty(body)) return; - + self.html = [(id)body innerHTML]; - + self.scrollBottom = [self viewingBottom]; self.scrollTop = [[[doc body] valueForKey:@"scrollTop"] integerValue]; - + [self loadAlternateHTML:[self initialDocument:[self topicValue]]]; } @@ -438,6 +458,8 @@ - (void)clear self.html = nil; self.loaded = NO; self.count = 0; + + [self executeScriptCommand:@"viewContentsBeingCleared" withArguments:@[]]; [self loadAlternateHTML:[self initialDocument:[self topicValue]]]; } @@ -451,6 +473,8 @@ - (void)changeTextSize:(BOOL)bigger } else { [self.view makeTextSmaller:nil]; } + + [self executeScriptCommand:@"viewFontSizeChanged" withArguments:@[@(bigger)]]; [self restorePosition]; } @@ -501,6 +525,8 @@ - (void)jumpToLine:(NSInteger)line [[doc body] setValue:@(y - [self scrollbackCorrectionInit]) forKey:@"scrollTop"]; } + + [self executeScriptCommand:@"viewPositionMovedToLine" withArguments:@[@(line)]]; } - (void)nextHighlight @@ -736,7 +762,7 @@ - (BOOL)print:(TVCLogLine *)line withHTML:(BOOL)rawHTML if (line.nick) { NSString *htmltag = ((modernRender) ? @"div" : @"span"); - [s appendFormat:@"<%@ class=\"sender\" ondblclick=\"Textual.on_dblclick_nick()\" oncontextmenu=\"Textual.on_nick()\" type=\"%@\" nick=\"%@\"", htmltag, [TVCLogLine memberTypeString:line.memberType], line.nickInfo]; + [s appendFormat:@"<%@ class=\"sender\" ondblclick=\"Textual.nicknameDoubleClicked()\" oncontextmenu=\"Textual.openStandardNicknameContextualMenu()\" type=\"%@\" nick=\"%@\"", htmltag, [TVCLogLine memberTypeString:line.memberType], line.nickInfo]; if (line.memberType == TVCLogMemberNormalType && [TPCPreferences disableNicknameColors] == NO) { [s appendFormat:@" colornumber=\"%d\"", line.nickColorNumber]; @@ -781,7 +807,7 @@ - (BOOL)print:(TVCLogLine *)line withHTML:(BOOL)rawHTML [postedUrls safeAddObject:imageUrl]; } - [s appendFormat:@"", url, imageUrl, [TPCPreferences inlineImagesMaxWidth], TXTLS(@"LogViewHideInlineImageMessage")]; + [s appendFormat:@"", url, imageUrl, [TPCPreferences inlineImagesMaxWidth], TXTLS(@"LogViewHideInlineImageMessage")]; } } } @@ -806,7 +832,7 @@ - (BOOL)print:(TVCLogLine *)line withHTML:(BOOL)rawHTML } attrs[@"highlight"] = ((highlighted) ? @"true" : @"false"); - attrs[@"class"] = ((isText) ? @"line text" : @"line event"); + attrs[@"class"] = ((isText) ? @"line text" : @"line event"); [self writeLine:s attributes:attrs]; @@ -866,12 +892,7 @@ - (void)writeLine:(NSString *)aHtml attributes:(NSDictionary *)attrs [self.highlightedLineNumbers safeAddObject:@(self.lineNumber)]; } - WebScriptObject *js_api = [self.view js_api]; - - if (js_api && [js_api isKindOfClass:[WebUndefined class]] == NO) { - [js_api callWebScriptMethod:@"newMessagePostedToDisplay" - withArguments:@[@(self.lineNumber)]]; - } + [self executeScriptCommand:@"newMessagePostedToDisplay" withArguments:@[@(self.lineNumber)]]; return YES; } copy]; @@ -1029,9 +1050,29 @@ - (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window [self.js setValue:self.sink forKey:@"app"]; } +- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame +{ + NSLog(@"Log [%@] for channel [%@] on [%@] failed to load with error: %@", + [self description], [self.channel description], [self.client description], [error localizedDescription]); +} + +- (void)webView:(WebView *)sender resource:(id)identifier didFailLoadingWithError:(NSError *)error fromDataSource:(WebDataSource *)dataSource +{ + NSLog(@"Resource [%@] in log [%@] failed loading for channel [%@] on [%@] with error: %@", + identifier, [self description], [self.channel description], [self.client description], [error localizedDescription]); +} + +- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame +{ + NSLog(@"Log [%@] for channel [%@] on [%@] failed provisional load with error: %@", + [self description], [self.channel description], [self.client description], [error localizedDescription]); +} + - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { - self.loaded = YES; + [self executeScriptCommand:@"viewFinishedLoading" withArguments:@[]]; + + self.loaded = YES; self.loadingImages = 0; [self setUpScroller]; @@ -1081,12 +1122,21 @@ - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame e = next; } - - WebScriptObject *js_api = [self.view js_api]; - - if (js_api && [js_api isKindOfClass:[WebUndefined class]] == NO) { - [js_api callWebScriptMethod:@"doneThemeChange" withArguments:@[]]; + + NSString *viewType = @"server"; + + if (self.channel && self.channel.isChannel) { + viewType = @"channel"; + } else if (self.channel && self.channel.isTalk) { + viewType = @"talk"; } + + [self executeScriptCommand:@"viewInitiated" withArguments:@[ + NSStringNilValueSubstitute(viewType), + NSStringNilValueSubstitute(self.client.config.guid), + NSStringNilValueSubstitute(self.channel.config.guid), + NSStringNilValueSubstitute(self.channel.name) + ]]; } - (id)webView:(WebView *)sender identifierForInitialRequest:(NSURLRequest *)request fromDataSource:(WebDataSource *)dataSource diff --git a/Classes/Views/Channel View/TVCLogScriptEventSink.m b/Classes/Views/Channel View/TVCLogScriptEventSink.m index a7105f7862..542f3c6090 100755 --- a/Classes/Views/Channel View/TVCLogScriptEventSink.m +++ b/Classes/Views/Channel View/TVCLogScriptEventSink.m @@ -125,27 +125,22 @@ - (NSString *)hideInlineImage:(DOMHTMLAnchorElement *)object } } -- (void)setUrl:(NSString *)s +- (void)setURLAddress:(NSString *)s { [self.policy setUrl:[s gtm_stringByUnescapingFromHTML]]; } -- (void)setAddr:(NSString *)s -{ - [self.policy setAddr:[s gtm_stringByUnescapingFromHTML]]; -} - -- (void)setNick:(NSString *)s +- (void)setNickname:(NSString *)s { [self.policy setNick:[s gtm_stringByUnescapingFromHTML]]; } -- (void)setChan:(NSString *)s +- (void)setChannelName:(NSString *)s { [self.policy setChan:[s gtm_stringByUnescapingFromHTML]]; } -- (void)channelDoubleClicked +- (void)channelNameDoubleClicked { [self.policy channelDoubleClicked]; } diff --git a/Classes/Views/Channel View/TVCLogView.m b/Classes/Views/Channel View/TVCLogView.m index ba255eb562..26f3b81b0e 100755 --- a/Classes/Views/Channel View/TVCLogView.m +++ b/Classes/Views/Channel View/TVCLogView.m @@ -80,7 +80,7 @@ - (BOOL)maintainsInactiveSelection - (NSString *)contentString { - DOMHTMLDocument *doc = (DOMHTMLDocument *)[self mainFrameDocument]; + DOMDocument *doc = [self.mainFrame DOMDocument]; if (PointerIsEmpty(doc)) return NSStringEmptyPlaceholder; DOMElement *body = [doc body]; diff --git a/Main Project (Textual).xcodeproj/project.pbxproj b/Main Project (Textual).xcodeproj/project.pbxproj index 1077a00518..07f18fe278 100644 --- a/Main Project (Textual).xcodeproj/project.pbxproj +++ b/Main Project (Textual).xcodeproj/project.pbxproj @@ -2528,6 +2528,9 @@ 4C1DC5711580420500A47BC9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2545,6 +2548,9 @@ 4C1DC5721580420500A47BC9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2614,6 +2620,9 @@ 4CCF2F8F1580497B006FFE21 /* Release + No Sandbox */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2684,6 +2693,9 @@ 4CCF2F9115804987006FFE21 /* Release (Trial) */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -2754,6 +2766,9 @@ 4CCF2F97158049A8006FFE21 /* App Store Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES; + CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/Resources/Info.plist b/Resources/Info.plist index e2aafa6c43..4989e590ef 100755 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -47,8 +47,8 @@ TXBundleBuildCodeName Turtle Soup TXBundleBuildNumber - 11917 + 11958 TXBundleBuildReference - 2.1.1-244-ga7a3b5b-debug,llvm4.0 + 2.1.1-245-gdca2209-appstore,llvm4.0 diff --git a/Resources/Javascript/API/core.js b/Resources/Javascript/API/core.js index 6687f9580e..72570dc198 100755 --- a/Resources/Javascript/API/core.js +++ b/Resources/Javascript/API/core.js @@ -1,68 +1,135 @@ +/* ********************************************************************* + _____ _ _ ___ ____ ____ + |_ _|___ _| |_ _ _ __ _| | |_ _| _ \ / ___| + | |/ _ \ \/ / __| | | |/ _` | | | || |_) | | + | | __/> <| |_| |_| | (_| | | | || _ <| |___ + |_|\___/_/\_\\__|\__,_|\__,_|_| |___|_| \_\\____| + + Copyright (c) 2010 — 2012 Codeux Software & respective contributors. + Please see Contributors.pdf and Acknowledgements.pdf + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Textual IRC Client & Codeux Software nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + *********************************************************************** */ + Textual = { - newMessagePostedToDisplay: function(ln) { - // support the most important function of the - // old API with no changes necessary to themes - - if (window.newMessagePostedToDisplay != undefined) { - window.newMessagePostedToDisplay(ln) - } - - //var newLine = document.getElementById("line" + lineNumber); + /* Callbacks for each WebView in Textual. — Self explanatory. */ + + /* + viewInitiated: + + @viewType: Type of view being represented. Server console, channel, query, etc. + Possible values: server, channel, talk. — talk = private message. + @serverHash: A unique identifier to differentiate between each server a view may represent. + @channelHash: A unique identifier to differentiate between each channel a view may represent. + @channelName: Name of the view. Actual channel name, nickname for a private message, or blank for console. + */ + viewInitiated: function(viewType, serverHash, channelHash, channelName) {}, + + newMessagePostedToView: function(lineNumber) {}, + historyIndicatorAddedToView: function() {}, + historyIndicatorRemovedFromView: function() {}, + themeWillChange: function() {}, + topicBarValueChanged: function(newTopic) {}, + viewContentsBeingCleared: function() {}, + viewFinishedLoading: function() {}, + viewFontSizeChanged: function(bigger) {}, + viewPositionMovedToBottom: function() {}, + viewPositionMovedToHistoryIndicator: function() {}, + viewPositionMovedToLine: function(lineNumber) {}, + viewPositionMovedToTop: function() {}, + + /* *********************************************************************** */ + + /* Resource management. */ + + includeStyleResourceFile: function(file) + { + document.write(''); }, - include_js: function(jsFile) + includeScriptResourceFile: function(file) { if (/loaded|complete/.test(document.readyState)) { var js = document.createElement("script"); - js.src = jsFile; + js.src = file; js.type = "text/javascript"; document.getElementsByTagName("HEAD")[0].appendChild(js); } else { - document.write('