Skip to content

Commit

Permalink
Updates.
Browse files Browse the repository at this point in the history
— 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.
  • Loading branch information
emsquared committed Jul 22, 2012
1 parent dca2209 commit bd7d091
Show file tree
Hide file tree
Showing 20 changed files with 393 additions and 270 deletions.
1 change: 1 addition & 0 deletions Classes/Headers/IRCChannelConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef enum IRCChannelType : NSInteger {

@interface IRCChannelConfig : NSObject <NSMutableCopying>
@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;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Headers/StaticDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Classes/Helpers/Cocoa (Objective-C)/NSStringHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)];

Expand Down
4 changes: 3 additions & 1 deletion Classes/IRC/IRCChannelConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ @implementation IRCChannelConfig
- (id)init
{
if ((self = [super init])) {
self.guid = [NSString stringWithUUID];

self.type = IRCChannelNormalType;

self.ignoreInlineImages = NO;
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions Classes/IRC/IRCWorld.m
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ - (void)selectClientAt:(NSInteger)n

- (void)reloadTheme
{
[self.dummyLog reloadTheme];

self.viewTheme.name = [TPCPreferences themeName];

NSMutableArray *logs = [NSMutableArray array];
Expand Down
104 changes: 55 additions & 49 deletions Classes/Preferences/TPCPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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]) {
Expand Down
6 changes: 3 additions & 3 deletions Classes/Views/Channel View/LVCLogRenderer.m
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ NSInteger mapColorValue(NSColor *color)
link = [NSString stringWithFormat:@"http://%@", link];
}

return [NSString stringWithFormat:@"<a href=\"%@\" class=\"url\" oncontextmenu=\"Textual.on_url()\">%@</a>", link, logEscape(content)];
return [NSString stringWithFormat:@"<a href=\"%@\" class=\"url\" oncontextmenu=\"Textual.openURLManagementContextualMenu()\">%@</a>", link, logEscape(content)];
} else if (attr & _rendererChannelNameAttribute) {
return [NSString stringWithFormat:@"<span class=\"channel\" ondblclick=\"Textual.on_dblclick_chname()\" oncontextmenu=\"Textual.on_chname()\">%@</span>", logEscape(content)];
return [NSString stringWithFormat:@"<span class=\"channel\" ondblclick=\"Textual.channelNameDoubleClicked()\" oncontextmenu=\"Textual.openChannelNameContextualMenu()\">%@</span>", logEscape(content)];
} else {
BOOL matchedUser = NO;

Expand All @@ -259,7 +259,7 @@ NSInteger mapColorValue(NSColor *color)
if ([user.nick isEqualNoCase:client.myNick] == NO) {
matchedUser = YES;

[s appendFormat:@"<span class=\"inline_nickname\" ondblclick=\"Textual.on_dblclick_ct_nick()\" oncontextmenu=\"Textual.on_ct_nick()\" colornumber=\"%d\">", [user colorNumber]];
[s appendFormat:@"<span class=\"inline_nickname\" ondblclick=\"Textual.inlineNicknameDoubleClicked()\" oncontextmenu=\"Textual.openInlineNicknameContextualMenu()\" colornumber=\"%d\">", [user colorNumber]];
}
}
}
Expand Down
Loading

0 comments on commit bd7d091

Please sign in to comment.