From 03420f821237e03bf9881addddb4d78586edbc51 Mon Sep 17 00:00:00 2001 From: emsquared Date: Fri, 20 Jul 2012 10:30:38 -0400 Subject: [PATCH] Improvements. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit — Redesigned command index. Tab completion now has only access to the commands Textual provides instead of allowing users to use "AUTHENTICATE" or other commands use only internally. This does not stop them from manually entering them. We will forward to server if they do. — Added -destroyAllEvidence to IRCWorld. Equivalent of the CLEARALL command. — As part of our command index rebuild the defines IRCCommandIndex are now nonexistent. Please see IRC.h if you use these within a plugin. — Fixed bundled scripts being favored over custom ones. (Fixes #294) --- Classes/Controllers/TXMasterController.m | 8 +- Classes/Controllers/TXMenuController.m | 56 +- .../Preferences/TDCPreferencesController.m | 6 +- Classes/Headers/IRC.h | 114 +--- Classes/Headers/IRCWorld.h | 2 + Classes/Headers/StaticDefinitions.h | 1 + Classes/Headers/TLOGrowlController.h | 7 + Classes/Headers/TPCPreferences.h | 5 +- Classes/Headers/TVCLogLine.h | 2 + Classes/Helpers/THOPluginItem.m | 2 +- Classes/IRC/IRCClient.m | 479 +++++++------- Classes/IRC/IRCSendingMessage.m | 27 +- Classes/IRC/IRCWorld.m | 19 + .../Sockets/GCDAsyncSocketExtensions.m | 21 +- Classes/Preferences/TPCPreferences.m | 606 +++++++++++------- Classes/Views/Channel View/TVCLogController.m | 6 +- Classes/Views/Channel View/TVCLogPolicy.m | 2 +- .../project.pbxproj | 5 - Resources/Info.plist | 4 +- .../English.lproj/BasicLanguage.strings | 2 +- .../project.pbxproj | 13 - Resources/Styles/Astria/copyright.txt | 2 +- 22 files changed, 716 insertions(+), 673 deletions(-) diff --git a/Classes/Controllers/TXMasterController.m b/Classes/Controllers/TXMasterController.m index 02c3d2a7b1..9931bb262c 100755 --- a/Classes/Controllers/TXMasterController.m +++ b/Classes/Controllers/TXMasterController.m @@ -67,7 +67,7 @@ - (void)awakeFromNib [TPCPreferences setMasterController:self]; [TPCPreferences initPreferences]; - + [self.text setBackgroundColor:[NSColor clearColor]]; [_NSNotificationCenter() addObserver:self selector:@selector(themeStyleDidChange:) name:TXThemePreferenceChangedNotification object:nil]; @@ -464,7 +464,7 @@ - (void)sendText:(NSString *)command - (void)textEntered { - [self sendText:IRCCommandIndexPrivmsg]; + [self sendText:IRCPrivateCommandIndex("privmsg")]; } - (void)showMemberListSplitView:(BOOL)showList @@ -831,7 +831,7 @@ - (void)completeNick:(BOOL)forward if (commandMode) { choices = [NSMutableArray array]; - for (NSString *command in [TPCPreferences commandIndexList].allKeys) { + for (NSString *command in [TPCPreferences publicIRCCommandList]) { [choices safeAddObject:[command lowercaseString]]; } @@ -1186,7 +1186,7 @@ - (void)shiftTab:(NSEvent *)e - (void)sendMsgAction:(NSEvent *)e { - [self sendText:IRCCommandIndexAction]; + [self sendText:IRCPrivateCommandIndex("action")]; } - (void)_moveInputHistory:(BOOL)up checkScroller:(BOOL)scroll event:(NSEvent *)event diff --git a/Classes/Controllers/TXMenuController.m b/Classes/Controllers/TXMenuController.m index 504b9c7346..a6f93985a1 100755 --- a/Classes/Controllers/TXMenuController.m +++ b/Classes/Controllers/TXMenuController.m @@ -806,7 +806,7 @@ - (void)showServerChannelList:(id)sender if (_noClient || _notConnected) return; [u createChannelListDialog]; - [u send:IRCCommandIndexList, nil]; + [u send:IRCPrivateCommandIndex("list"), nil]; } - (void)addServer:(id)sender @@ -1000,7 +1000,7 @@ - (void)topicSheet:(TDCTopicSheet *)sender onOK:(NSString *)topic if (_noClientOrChannel || _isClient || _isQuery) return; if ([u encryptOutgoingMessage:&topic channel:c] == YES) { - [u send:IRCCommandIndexTopic, c.name, topic, nil]; + [u send:IRCPrivateCommandIndex("topic"), c.name, topic, nil]; } } @@ -1042,7 +1042,7 @@ - (void)modeSheetOnOK:(TDCModeSheet *)sender NSString *changeStr = [c.mode getChangeCommand:sender.mode]; if (NSObjectIsNotEmpty(changeStr)) { - [u sendLine:[NSString stringWithFormat:@"%@ %@ %@", IRCCommandIndexMode, c.name, changeStr]]; + [u sendLine:[NSString stringWithFormat:@"%@ %@ %@", IRCPrivateCommandIndex("mode"), c.name, changeStr]]; } } @@ -1263,7 +1263,7 @@ - (void)inviteSheet:(TDCInviteSheet *)sender onSelectChannel:(NSString *)channel if (u && NSObjectIsNotEmpty(channelName)) { for (NSString *nick in sender.nicks) { - [u send:IRCCommandIndexInvite, nick, channelName, nil]; + [u send:IRCPrivateCommandIndex("invite"), nick, channelName, nil]; } } } @@ -1295,7 +1295,7 @@ - (void)memberSendCTCPTime:(id)sender if (_noClient || _isClient) return; for (IRCUser *m in [self selectedMembers:sender]) { - [u sendCTCPQuery:m.nick command:IRCCommandIndexTime text:nil]; + [u sendCTCPQuery:m.nick command:IRCPrivateCommandIndex("ctcp_time") text:nil]; } [self deselectMembers:sender]; @@ -1309,7 +1309,7 @@ - (void)memberSendCTCPVersion:(id)sender if (_noClient || _isClient) return; for (IRCUser *m in [self selectedMembers:sender]) { - [u sendCTCPQuery:m.nick command:IRCCommandIndexVersion text:nil]; + [u sendCTCPQuery:m.nick command:IRCPrivateCommandIndex("ctcp_version") text:nil]; } [self deselectMembers:sender]; @@ -1323,7 +1323,7 @@ - (void)memberSendCTCPUserinfo:(id)sender if (_noClient || _isClient) return; for (IRCUser *m in [self selectedMembers:sender]) { - [u sendCTCPQuery:m.nick command:IRCCommandIndexUserinfo text:nil]; + [u sendCTCPQuery:m.nick command:IRCPrivateCommandIndex("ctcp_userinfo") text:nil]; } [self deselectMembers:sender]; @@ -1337,7 +1337,7 @@ - (void)memberSendCTCPClientInfo:(id)sender if (_noClient || _isClient) return; for (IRCUser *m in [self selectedMembers:sender]) { - [u sendCTCPQuery:m.nick command:IRCCommandIndexClientinfo text:nil]; + [u sendCTCPQuery:m.nick command:IRCPrivateCommandIndex("ctcp_clientinfo") text:nil]; } [self deselectMembers:sender]; @@ -1420,33 +1420,33 @@ - (void)processModeChange:(id)sender mode:(NSString *)tmode } - (void)memberModeChangeOp:(id)sender -{ - [self processModeChange:sender mode:@"OP"]; +{ + [self processModeChange:sender mode:IRCPublicCommandIndex("op")]; } - (void)memberModeChangeDeop:(id)sender { - [self processModeChange:sender mode:@"DEOP"]; + [self processModeChange:sender mode:IRCPublicCommandIndex("deop")]; } - (void)memberModeChangeHalfop:(id)sender { - [self processModeChange:sender mode:@"HALFOP"]; + [self processModeChange:sender mode:IRCPublicCommandIndex("halfop")]; } - (void)memberModeChangeDehalfop:(id)sender { - [self processModeChange:sender mode:@"DEHALFOP"]; + [self processModeChange:sender mode:IRCPublicCommandIndex("dehalfop")]; } - (void)memberModeChangeVoice:(id)sender { - [self processModeChange:sender mode:@"VOICE"]; + [self processModeChange:sender mode:IRCPublicCommandIndex("voice")]; } - (void)memberModeChangeDevoice:(id)sender { - [self processModeChange:sender mode:@"DEVOICE"]; + [self processModeChange:sender mode:IRCPublicCommandIndex("devoice")]; } - (void)memberKickFromChannel:(id)sender @@ -1471,7 +1471,7 @@ - (void)memberBanFromServer:(id)sender if (_noClientOrChannel || _isClient || _isQuery) return; for (IRCUser *m in [self selectedMembers:sender]) { - [u sendCommand:[NSString stringWithFormat:@"BAN %@", m.nick] completeTarget:YES target:c.name]; + [u sendCommand:[NSString stringWithFormat:@"%@ %@", IRCPublicCommandIndex("ban"), m.nick] completeTarget:YES target:c.name]; } [self deselectMembers:sender]; @@ -1485,7 +1485,8 @@ - (void)memberKickbanFromChannel:(id)sender if (_noClientOrChannel || _isClient || _isQuery) return; for (IRCUser *m in [self selectedMembers:sender]) { - [u sendCommand:[NSString stringWithFormat:@"KICKBAN %@ %@", m.nick, [TPCPreferences defaultKickMessage]] + [u sendCommand:[NSString stringWithFormat:@"%@ %@ %@", + IRCPublicCommandIndex("kickban"), m.nick, [TPCPreferences defaultKickMessage]] completeTarget:YES target:c.name]; } @@ -1500,7 +1501,8 @@ - (void)memberKillFromServer:(id)sender if (_noClientOrChannel || _isClient) return; for (IRCUser *m in [self selectedMembers:sender]) { - [u sendCommand:[NSString stringWithFormat:@"KILL %@ %@", m.nick, [TPCPreferences IRCopDefaultKillMessage]]]; + [u sendCommand:[NSString stringWithFormat:@"%@ %@ %@", + IRCPublicCommandIndex("kill"), m.nick, [TPCPreferences IRCopDefaultKillMessage]]]; } [self deselectMembers:sender]; @@ -1517,7 +1519,8 @@ - (void)memberGlineFromServer:(id)sender if ([m.nick isEqualNoCase:u.myNick]) { [u printDebugInformation:TXTFLS(@"SelfBanDetectedMessage", u.serverHostname) channel:c]; } else { - [u sendCommand:[NSString stringWithFormat:@"GLINE %@ %@", m.nick, [TPCPreferences IRCopDefaultGlineMessage]]]; + [u sendCommand:[NSString stringWithFormat:@"%@ %@ %@", + IRCPublicCommandIndex("gline"), m.nick, [TPCPreferences IRCopDefaultGlineMessage]]]; } } @@ -1532,7 +1535,8 @@ - (void)memberShunFromServer:(id)sender if (_noClientOrChannel || _isClient) return; for (IRCUser *m in [self selectedMembers:sender]) { - [u sendCommand:[NSString stringWithFormat:@"SHUN %@ %@", m.nick, [TPCPreferences IRCopDefaultShunMessage]]]; + [u sendCommand:[NSString stringWithFormat:@"%@ %@ %@", + IRCPublicCommandIndex("shun"), m.nick, [TPCPreferences IRCopDefaultShunMessage]]]; } [self deselectMembers:sender]; @@ -1623,7 +1627,7 @@ - (void)showChannelBanList:(id)sender if (_noChannel || _isClient || _isQuery) return; [[self.world selectedClient] createChanBanListDialog]; - [[self.world selectedClient] send:IRCCommandIndexMode, [c name], @"+b", nil]; + [[self.world selectedClient] send:IRCPrivateCommandIndex("mode"), [c name], @"+b", nil]; } - (void)showChannelBanExceptionList:(id)sender @@ -1633,7 +1637,7 @@ - (void)showChannelBanExceptionList:(id)sender if (_noChannel || _isClient || _isQuery) return; [[self.world selectedClient] createChanBanExceptionListDialog]; - [[self.world selectedClient] send:IRCCommandIndexMode, [c name], @"+e", nil]; + [[self.world selectedClient] send:IRCPrivateCommandIndex("mode"), [c name], @"+e", nil]; } - (void)showChannelInviteExceptionList:(id)sender @@ -1643,7 +1647,7 @@ - (void)showChannelInviteExceptionList:(id)sender if (_noChannel || _isClient || _isQuery) return; [[self.world selectedClient] createChanInviteExceptionListDialog]; - [[self.world selectedClient] send:IRCCommandIndexMode, [c name], @"+I", nil]; + [[self.world selectedClient] send:IRCPrivateCommandIndex("mode"), [c name], @"+I", nil]; } - (void)openHelpMenuLinkItem:(id)sender @@ -1757,7 +1761,8 @@ - (void)toggleChannelModerationMode:(id)sender if (_noChannel || _isClient || _isQuery) return; - [[self.world selectedClient] sendCommand:[NSString stringWithFormat:@"MODE %@ %@", [c name], (([sender tag] == 1) ? @"-m" : @"+m")]]; + [[self.world selectedClient] sendCommand:[NSString stringWithFormat:@"%@ %@ %@", + IRCPublicCommandIndex("mode"), [c name], (([sender tag] == 1) ? @"-m" : @"+m")]]; } - (void)toggleChannelInviteMode:(id)sender @@ -1766,7 +1771,8 @@ - (void)toggleChannelInviteMode:(id)sender if (_noChannel || _isClient || _isQuery) return; - [[self.world selectedClient] sendCommand:[NSString stringWithFormat:@"MODE %@ %@", [c name], (([sender tag] == 1) ? @"-i" : @"+i")]]; + [[self.world selectedClient] sendCommand:[NSString stringWithFormat:@"%@ %@ %@", + IRCPublicCommandIndex("mode"), [c name], (([sender tag] == 1) ? @"-i" : @"+i")]]; } - (void)toggleDeveloperMode:(id)sender diff --git a/Classes/Dialogs/Preferences/TDCPreferencesController.m b/Classes/Dialogs/Preferences/TDCPreferencesController.m index 665cae15a9..b56a798ef5 100755 --- a/Classes/Dialogs/Preferences/TDCPreferencesController.m +++ b/Classes/Dialogs/Preferences/TDCPreferencesController.m @@ -526,9 +526,7 @@ - (void)onChangedTheme:(id)sender newRenderVersion = self.world.viewTheme.other.renderingEngineVersion; if (NSDissimilarObjects(oldRenderVersion, newRenderVersion)) { - for (IRCClient *u in self.world.clients) { - [u sendCommand:@"CLEARALL"]; - } + [self.world destroyAllEvidence]; } } @@ -550,7 +548,7 @@ - (void)changeItemFont:(NSFontManager *)sender [TPCPreferences setThemeChannelViewFontName:[newFont fontName]]; [TPCPreferences setThemeChannelViewFontSize:[newFont pointSize]]; - [self setValue:[newFont fontName] forKey:@"themeChannelViewFontName"]; + [self setValue: [newFont fontName] forKey:@"themeChannelViewFontName"]; [self setValue:@([newFont pointSize]) forKey:@"themeChannelViewFontSize"]; [self onStyleChanged:nil]; diff --git a/Classes/Headers/IRC.h b/Classes/Headers/IRC.h index 625fe7c338..e7b750d878 100755 --- a/Classes/Headers/IRC.h +++ b/Classes/Headers/IRC.h @@ -37,106 +37,18 @@ #import "TextualApplication.h" -#define IRCCommandIndexAction @"ACTION" -#define IRCCommandIndexAdchat @"ADCHAT" -#define IRCCommandIndexAuthenticate @"AUTHENTICATE" -#define IRCCommandIndexAme @"AME" -#define IRCCommandIndexAmsg @"AMSG" -#define IRCCommandIndexAway @"AWAY" -#define IRCCommandIndexBan @"BAN" -#define IRCCommandIndexChatops @"CHATOPS" -#define IRCCommandIndexCap @"CAP" -#define IRCCommandIndexCaps @"CAPS" -#define IRCCommandIndexClear @"CLEAR" -#define IRCCommandIndexClearall @"CLEARALL" -#define IRCCommandIndexClientinfo @"CLIENTINFO" -#define IRCCommandIndexClose @"CLOSE" -#define IRCCommandIndexConn @"CONN" -#define IRCCommandIndexConnect @"CONN" -#define IRCCommandIndexCtcp @"CTCP" -#define IRCCommandIndexCtcpreply @"CTCPREPLY" -#define IRCCommandIndexCycle @"CYCLE" -#define IRCCommandIndexDcc @"DCC" -#define IRCCommandIndexDebug @"DEBUG" -#define IRCCommandIndexDehalfop @"DEHALFOP" -#define IRCCommandIndexDeop @"DEOP" -#define IRCCommandIndexDevoice @"DEVOICE" -#define IRCCommandIndexEcho @"ECHO" -#define IRCCommandIndexError @"ERROR" -#define IRCCommandIndexGline @"GLINE" -#define IRCCommandIndexGzline @"GZLINE" -#define IRCCommandIndexGlobops @"GLOBOPS" -#define IRCCommandIndexHalfop @"HALFOP" -#define IRCCommandIndexHop @"HOP" -#define IRCCommandIndexIcbadge @"ICBADGE" -#define IRCCommandIndexCcbadge @"CCBADGE" -#define IRCCommandIndexIgnore @"IGNORE" -#define IRCCommandIndexInvite @"INVITE" -#define IRCCommandIndexIson @"ISON" -#define IRCCommandIndexJ @"J" -#define IRCCommandIndexJoin @"JOIN" -#define IRCCommandIndexKb @"KB" -#define IRCCommandIndexKick @"KICK" -#define IRCCommandIndexKickban @"KICKBAN" -#define IRCCommandIndexKill @"KILL" -#define IRCCommandIndexLeave @"LEAVE" -#define IRCCommandIndexLagcheck @"LAGCHECK" -#define IRCCommandIndexList @"LIST" -#define IRCCommandIndexLoadPlugins @"LOAD_PLUGINS" -#define IRCCommandIndexLocops @"LOCOPS" -#define IRCCommandIndexM @"M" -#define IRCCommandIndexMe @"ME" -#define IRCCommandIndexMode @"MODE" -#define IRCCommandIndexMsg @"MSG" -#define IRCCommandIndexMute @"MUTE" -#define IRCCommandIndexMylag @"MYLAG" -#define IRCCommandIndexMyversion @"MYVERSION" -#define IRCCommandIndexNachat @"NACHAT" -#define IRCCommandIndexNames @"NAMES" -#define IRCCommandIndexNick @"NICK" -#define IRCCommandIndexNncoloreset @"NNCOLORESET" -#define IRCCommandIndexNotice @"NOTICE" -#define IRCCommandIndexOmsg @"OMSG" -#define IRCCommandIndexOnotice @"ONOTICE" -#define IRCCommandIndexOp @"OP" -#define IRCCommandIndexPart @"PART" -#define IRCCommandIndexPass @"PASS" -#define IRCCommandIndexPing @"PING" -#define IRCCommandIndexPong @"PONG" -#define IRCCommandIndexPrivmsg @"PRIVMSG" -#define IRCCommandIndexQuery @"QUERY" -#define IRCCommandIndexQuit @"QUIT" -#define IRCCommandIndexQuote @"QUOTE" -#define IRCCommandIndexRaw @"RAW" -#define IRCCommandIndexRejoin @"REJOIN" -#define IRCCommandIndexRemove @"REMOVE" -#define IRCCommandIndexSend @"SEND" -#define IRCCommandIndexServer @"SERVER" -#define IRCCommandIndexShun @"SHUN" -#define IRCCommandIndexSslcontext @"SSLCONTEXT" -#define IRCCommandIndexT @"T" -#define IRCCommandIndexTempshun @"TEMPSHUN" -#define IRCCommandIndexTime @"TIME" -#define IRCCommandIndexTimer @"TIMER" -#define IRCCommandIndexTopic @"TOPIC" -#define IRCCommandIndexUmode @"UMODE" -#define IRCCommandIndexUnban @"UNBAN" -#define IRCCommandIndexUnignore @"UNIGNORE" -#define IRCCommandIndexUnloadPlugins @"UNLOAD_PLUGINS" -#define IRCCommandIndexUnmute @"UNMUTE" -#define IRCCommandIndexUser @"USER" -#define IRCCommandIndexUserinfo @"USERINFO" -#define IRCCommandIndexVersion @"VERSION" -#define IRCCommandIndexVoice @"VOICE" -#define IRCCommandIndexWallops @"WALLOPS" -#define IRCCommandIndexWatch @"WATCH" -#define IRCCommandIndexWeights @"WEIGHTS" -#define IRCCommandIndexWho @"WHO" -#define IRCCommandIndexWhois @"WHOIS" -#define IRCCommandIndexWhowas @"WHOWAS" -#define IRCCommandIndexZline @"ZLINE" -#define IRCCommandIndexSme @"SME" -#define IRCCommandIndexSmsg @"SMSG" - #define TXMaximumIRCBodyLength 520 #define TXMaximumNodesPerModeCommand 4 + +/* Historically, we used a few dozen "IRCCommandIndex" defines to match + a define against the actual IRC command it represents. Instead, we now hand a + key sent to IRC[*]CommandIndex() down to our lower level APIs to match the key + against the actual IRC Command. The key does not necessarily match the actual + command being sent either. For example, CTCP commands have the ctcp_ prefix. + + This thing is overly complex for no good reasons… */ + +TEXTUAL_EXTERN NSString *IRCCommandIndex(const char *key) TEXTUAL_DEPRECATED; + +TEXTUAL_EXTERN NSString *IRCPrivateCommandIndex(const char *key); +TEXTUAL_EXTERN NSString *IRCPublicCommandIndex(const char *key); diff --git a/Classes/Headers/IRCWorld.h b/Classes/Headers/IRCWorld.h index 239fc06d01..3fe0dded98 100755 --- a/Classes/Headers/IRCWorld.h +++ b/Classes/Headers/IRCWorld.h @@ -143,5 +143,7 @@ - (void)clearContentsOfClient:(IRCClient *)u; - (void)clearContentsOfChannel:(IRCChannel *)c inClient:(IRCClient *)u; +- (void)destroyAllEvidence; + - (TVCLogController *)createLogWithClient:(IRCClient *)client channel:(IRCChannel *)channel; @end \ No newline at end of file diff --git a/Classes/Headers/StaticDefinitions.h b/Classes/Headers/StaticDefinitions.h index b451934c3d..7d23901766 100755 --- a/Classes/Headers/StaticDefinitions.h +++ b/Classes/Headers/StaticDefinitions.h @@ -111,6 +111,7 @@ #define NSDissimilarObjects(o,n) (o != n) #define TEXTUAL_EXTERN __attribute__((visibility("default"))) +#define TEXTUAL_DEPRECATED __attribute__((deprecated)) /* Item types */ typedef double TXNSDouble; diff --git a/Classes/Headers/TLOGrowlController.h b/Classes/Headers/TLOGrowlController.h index 70bfcac50e..e96a449ac3 100755 --- a/Classes/Headers/TLOGrowlController.h +++ b/Classes/Headers/TLOGrowlController.h @@ -53,6 +53,13 @@ typedef enum TXNotificationType : NSInteger { TXNotificationAddressBookMatchType = 1010, } TXNotificationType; +#define TXNotificationDialogStandardNicknameFormat @"<%@>: %@" +#define TXNotificationDialogActionNicknameFormat @"• %@: %@" + +#define TXNotificationHighlightLogStandardActionFormat @"• %@: %@" +#define TXNotificationHighlightLogStandardMessageFormat @"%@ %@" +#define TXNotificationHighlightLogAlternativeActionFormat @"• %@ %@" + #ifdef TXNativeNotificationCenterAvailable #define GrowlControllerDelegate GrowlApplicationBridgeDelegate,NSUserNotificationCenterDelegate #else diff --git a/Classes/Headers/TPCPreferences.h b/Classes/Headers/TPCPreferences.h index 837a4785e9..3128b0862f 100755 --- a/Classes/Headers/TPCPreferences.h +++ b/Classes/Headers/TPCPreferences.h @@ -128,8 +128,9 @@ typedef enum TXHostmaskBanFormat : NSInteger { + (void)setTranscriptFolder:(id)value; + (void)stopUsingTranscriptFolderBookmarkResources; -+ (NSDictionary *)commandIndexList; ++ (NSArray *)publicIRCCommandList; + (NSInteger)indexOfIRCommand:(NSString *)command; ++ (NSInteger)indexOfIRCommand:(NSString *)command publicSearch:(BOOL)isPublic; + (NSString *)defaultRealname; + (NSString *)defaultUsername; @@ -245,6 +246,8 @@ typedef enum TXHostmaskBanFormat : NSInteger { + (NSArray *)excludeWords; + (void)cleanUpWords; ++ (void)defaultIRCClientPrompt:(BOOL)forced; + + (void)initPreferences; + (void)sync; @end \ No newline at end of file diff --git a/Classes/Headers/TVCLogLine.h b/Classes/Headers/TVCLogLine.h index a698d24d74..be3ae0cc5f 100755 --- a/Classes/Headers/TVCLogLine.h +++ b/Classes/Headers/TVCLogLine.h @@ -42,6 +42,8 @@ #define TXLogLineNoticeNicknameFormat @"-%@-" #define TXLogLineCTCPTypeNicknameFormat @"-%@ CTCP-" +#define TXLogLineSpecialNoticeMessageFormat @"[%@]: %@" + typedef enum TVCLogLineType : NSInteger { TVCLogLineSystemType, TVCLogLineErrorType, diff --git a/Classes/Helpers/THOPluginItem.m b/Classes/Helpers/THOPluginItem.m index f2896e03c1..f579ee62d7 100755 --- a/Classes/Helpers/THOPluginItem.m +++ b/Classes/Helpers/THOPluginItem.m @@ -68,7 +68,7 @@ - (void)initWithPluginClass:(Class)primaryClass if (NSObjectIsNotEmpty(pluginRules)) { for (NSString *command in pluginRules) { - if ([TPCPreferences indexOfIRCommand:command] >= 1) { + if ([TPCPreferences indexOfIRCommand:command publicSearch:NO] >= 1) { id objectValue = pluginRules[command]; if ([objectValue isKindOfClass:[NSArray class]]) { diff --git a/Classes/IRC/IRCClient.m b/Classes/IRC/IRCClient.m index 07a1042869..54c1823dcd 100755 --- a/Classes/IRC/IRCClient.m +++ b/Classes/IRC/IRCClient.m @@ -338,7 +338,7 @@ - (void)onISONTimer:(id)sender [userstr appendFormat:@" %@", name]; } - [self send:IRCCommandIndexIson, userstr, nil]; + [self send:IRCPrivateCommandIndex("ison"), userstr, nil]; } } @@ -478,14 +478,14 @@ - (void)chanBanDialogOnUpdate:(TDChanBanSheet *)sender { [sender.list removeAllObjects]; - [self send:IRCCommandIndexMode, [self.world.selectedChannel name], @"+b", nil]; + [self send:IRCPrivateCommandIndex("mode"), [self.world.selectedChannel name], @"+b", nil]; } - (void)chanBanDialogWillClose:(TDChanBanSheet *)sender { if (NSObjectIsNotEmpty(sender.modes)) { for (NSString *mode in sender.modes) { - [self sendLine:[NSString stringWithFormat:@"%@ %@ %@", IRCCommandIndexMode, [self.world selectedChannel].name, mode]]; + [self sendLine:[NSString stringWithFormat:@"%@ %@ %@", IRCPrivateCommandIndex("mode"), [self.world selectedChannel].name, mode]]; } } @@ -520,14 +520,14 @@ - (void)chanInviteExceptionDialogOnUpdate:(TDChanInviteExceptionSheet *)sender { [sender.list removeAllObjects]; - [self send:IRCCommandIndexMode, [self.world.selectedChannel name], @"+I", nil]; + [self send:IRCPrivateCommandIndex("mode"), [self.world.selectedChannel name], @"+I", nil]; } - (void)chanInviteExceptionDialogWillClose:(TDChanInviteExceptionSheet *)sender { if (NSObjectIsNotEmpty(sender.modes)) { for (NSString *mode in sender.modes) { - [self sendLine:[NSString stringWithFormat:@"%@ %@ %@", IRCCommandIndexMode, [self.world selectedChannel].name, mode]]; + [self sendLine:[NSString stringWithFormat:@"%@ %@ %@", IRCPrivateCommandIndex("mode"), [self.world selectedChannel].name, mode]]; } } @@ -565,14 +565,14 @@ - (void)chanBanExceptionDialogOnUpdate:(TDChanBanExceptionSheet *)sender { [sender.list removeAllObjects]; - [self send:IRCCommandIndexMode, [self.world.selectedChannel name], @"+e", nil]; + [self send:IRCPrivateCommandIndex("mode"), [self.world.selectedChannel name], @"+e", nil]; } - (void)chanBanExceptionDialogWillClose:(TDChanBanExceptionSheet *)sender { if (NSObjectIsNotEmpty(sender.modes)) { for (NSString *mode in sender.modes) { - [self sendLine:[NSString stringWithFormat:@"%@ %@ %@", IRCCommandIndexMode, [self.world selectedChannel].name, mode]]; + [self sendLine:[NSString stringWithFormat:@"%@ %@ %@", IRCPrivateCommandIndex("mode"), [self.world selectedChannel].name, mode]]; } } @@ -597,7 +597,7 @@ - (void)listDialogOnUpdate:(TDCListDialog *)sender { [sender.list removeAllObjects]; - [self sendLine:IRCCommandIndexList]; + [self sendLine:IRCPrivateCommandIndex("list")]; } - (void)listDialogOnJoin:(TDCListDialog *)sender channel:(NSString *)channel @@ -641,7 +641,7 @@ - (void)onPongTimer:(id)sender [self disconnect]; } else if (timeSpent >= _pingInterval) { - [self send:IRCCommandIndexPing, self.serverHostname, nil]; + [self send:IRCPrivateCommandIndex("ping"), self.serverHostname, nil]; } } @@ -821,7 +821,7 @@ - (void)quit:(NSString *)comment comment = self.config.leavingComment; } - [self send:IRCCommandIndexQuit, comment, nil]; + [self send:IRCPrivateCommandIndex("quit"), comment, nil]; [self performSelector:@selector(disconnect) withObject:nil afterDelay:2.0]; } @@ -838,7 +838,7 @@ - (void)changeNick:(NSString *)newNick self.inputNick = newNick; self.sentNick = newNick; - [self send:IRCCommandIndexNick, newNick, nil]; + [self send:IRCPrivateCommandIndex("nick"), newNick, nil]; } - (void)_joinKickedChannel:(IRCChannel *)channel @@ -906,7 +906,7 @@ - (void)joinUnlistedChannel:(NSString *)channel password:(NSString *)password - (void)forceJoinChannel:(NSString *)channel password:(NSString *)password { - [self send:IRCCommandIndexJoin, channel, password, nil]; + [self send:IRCPrivateCommandIndex("join"), channel, password, nil]; } - (void)partUnlistedChannel:(NSString *)channel withComment:(NSString *)comment @@ -935,14 +935,14 @@ - (void)partChannel:(IRCChannel *)channel withComment:(NSString *)comment comment = self.config.leavingComment; } - [self send:IRCCommandIndexPart, channel.name, comment, nil]; + [self send:IRCPrivateCommandIndex("part"), channel.name, comment, nil]; } - (void)sendWhois:(NSString *)nick { if (self.isLoggedIn == NO) return; - [self send:IRCCommandIndexWhois, nick, nick, nil]; + [self send:IRCPrivateCommandIndex("whois"), nick, nick, nil]; } - (void)changeOp:(IRCChannel *)channel users:(NSArray *)inputUsers mode:(char)mode value:(BOOL)value @@ -972,7 +972,7 @@ - (void)changeOp:(IRCChannel *)channel users:(NSArray *)inputUsers mode:(char)mo NSMutableString *s = [NSMutableString string]; - [s appendFormat:@"%@ %@ %c", IRCCommandIndexMode, channel.name, ((value) ? '+' : '-')]; + [s appendFormat:@"%@ %@ %c", IRCPrivateCommandIndex("mode"), channel.name, ((value) ? '+' : '-')]; for (NSInteger i = (ary.count - 1); i >= 0; --i) { [s appendFormat:@"%c", mode]; @@ -991,7 +991,7 @@ - (void)changeOp:(IRCChannel *)channel users:(NSArray *)inputUsers mode:(char)mo - (void)kick:(IRCChannel *)channel target:(NSString *)nick { - [self send:IRCCommandIndexKick, channel.name, nick, [TPCPreferences defaultKickMessage], nil]; + [self send:IRCPrivateCommandIndex("kick"), channel.name, nick, [TPCPreferences defaultKickMessage], nil]; } - (void)quickJoin:(NSArray *)chans @@ -1031,9 +1031,9 @@ - (void)quickJoin:(NSArray *)chans if ((targetData.length + passData.length) > TXMaximumIRCBodyLength) { if (NSObjectIsEmpty(prevTarget)) { if (NSObjectIsEmpty(prevPass)) { - [self send:IRCCommandIndexJoin, prevTarget, nil]; + [self send:IRCPrivateCommandIndex("join"), prevTarget, nil]; } else { - [self send:IRCCommandIndexJoin, prevTarget, prevPass, nil]; + [self send:IRCPrivateCommandIndex("join"), prevTarget, prevPass, nil]; } [target setString:c.name]; @@ -1053,9 +1053,9 @@ - (void)quickJoin:(NSArray *)chans if (NSObjectIsNotEmpty(target)) { if (NSObjectIsEmpty(pass)) { - [self send:IRCCommandIndexJoin, target, nil]; + [self send:IRCPrivateCommandIndex("join"), target, nil]; } else { - [self send:IRCCommandIndexJoin, target, pass, nil]; + [self send:IRCPrivateCommandIndex("join"), target, pass, nil]; } } } @@ -1270,7 +1270,7 @@ -(void)executeTextualCmdScript:(NSDictionary *)details NSString *finalResult = [result stringValue].trim; if (NSObjectIsNotEmpty(finalResult)) { - [self.world.iomt inputText:finalResult command:IRCCommandIndexPrivmsg]; + [self.world.iomt inputText:finalResult command:IRCPrivateCommandIndex("privmsg")]; } } }]; @@ -1299,7 +1299,7 @@ -(void)executeTextualCmdScript:(NSDictionary *)details NSString *finalResult = [result stringValue].trim; if (NSObjectIsNotEmpty(finalResult)) { - [self.world.iomt inputText:finalResult command:IRCCommandIndexPrivmsg]; + [self.world.iomt inputText:finalResult command:IRCPrivateCommandIndex("privmsg")]; } } } else { @@ -1344,7 +1344,7 @@ -(void)executeTextualCmdScript:(NSDictionary *)details NSString *outputString = [NSString stringWithData:outputData encoding:NSUTF8StringEncoding]; if (NSObjectIsNotEmpty(outputString)) { - [self.world.iomt inputText:outputString command:IRCCommandIndexPrivmsg]; + [self.world.iomt inputText:outputString command:IRCPrivateCommandIndex("privmsg")]; } } @@ -1428,7 +1428,7 @@ - (void)sendPrivmsgToSelectedChannel:(NSString *)message { NSAttributedString *new = [NSAttributedString emptyStringWithBase:message]; - [self sendText:new command:IRCCommandIndexPrivmsg channel:[self.world selectedChannelOn:self]]; + [self sendText:new command:IRCPrivateCommandIndex("privmsg") channel:[self.world selectedChannelOn:self]]; } - (void)sendText:(NSAttributedString *)str command:(NSString *)command channel:(IRCChannel *)channel @@ -1439,9 +1439,9 @@ - (void)sendText:(NSAttributedString *)str command:(NSString *)command channel:( TVCLogLineType type; - if ([command isEqualToString:IRCCommandIndexNotice]) { + if ([command isEqualToString:IRCPrivateCommandIndex("notice")]) { type = TVCLogLineNoticeType; - } else if ([command isEqualToString:IRCCommandIndexAction]) { + } else if ([command isEqualToString:IRCPrivateCommandIndex("action")]) { type = TVCLogLineActionType; } else { type = TVCLogLinePrivateMessageType; @@ -1475,9 +1475,9 @@ - (void)sendText:(NSAttributedString *)str command:(NSString *)command channel:( NSString *cmd = command; if (type == TVCLogLineActionType) { - cmd = IRCCommandIndexPrivmsg; + cmd = IRCPrivateCommandIndex("privmsg"); - newstr = [NSString stringWithFormat:@"%c%@ %@%c", 0x01, IRCCommandIndexAction, newstr, 0x01]; + newstr = [NSString stringWithFormat:@"%c%@ %@%c", 0x01, IRCPrivateCommandIndex("action"), newstr, 0x01]; } else if (type == TVCLogLinePrivateMessageType) { [channel detectOutgoingConversation:newstr]; } @@ -1501,7 +1501,7 @@ - (void)sendCTCPQuery:(NSString *)target command:(NSString *)command text:(NSStr trail = [NSString stringWithFormat:@"%c%@%c", 0x01, command, 0x01]; } - [self send:IRCCommandIndexPrivmsg, target, trail, nil]; + [self send:IRCPrivateCommandIndex("privmsg"), target, trail, nil]; } - (void)sendCTCPReply:(NSString *)target command:(NSString *)command text:(NSString *)text @@ -1514,12 +1514,12 @@ - (void)sendCTCPReply:(NSString *)target command:(NSString *)command text:(NSStr trail = [NSString stringWithFormat:@"%c%@%c", 0x01, command, 0x01]; } - [self send:IRCCommandIndexNotice, target, trail, nil]; + [self send:IRCPrivateCommandIndex("notice"), target, trail, nil]; } - (void)sendCTCPPing:(NSString *)target { - [self sendCTCPQuery:target command:IRCCommandIndexPing text:[NSString stringWithFormat:@"%qu", mach_absolute_time()]]; + [self sendCTCPQuery:target command:IRCPrivateCommandIndex("ctcp_ping") text:[NSString stringWithFormat:@"%qu", mach_absolute_time()]]; } - (BOOL)sendCommand:(id)str @@ -1549,7 +1549,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString IRCChannel *selChannel = nil; - if ([cmd isEqualToString:IRCCommandIndexMode] && ([s.string hasPrefix:@"+"] || [s.string hasPrefix:@"-"]) == NO) { + if ([cmd isEqualToString:IRCPublicCommandIndex("mode")] && ([s.string hasPrefix:@"+"] || [s.string hasPrefix:@"-"]) == NO) { // Do not complete for /mode #chname ... } else if (completeTarget && targetChannelName) { selChannel = [self findChannel:targetChannelName]; @@ -1565,8 +1565,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString [s deleteCharactersInRange:NSMakeRange(0, 1)]; } - switch ([TPCPreferences indexOfIRCommand:cmd]) { - case 3: // Command: AWAY + switch ([TPCPreferences indexOfIRCommand:cmd publicSearch:YES]) { + case 5004: // Command: AWAY { NSString *msg = s.string; @@ -1591,7 +1591,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 5: // Command: INVITE + case 5030: // Command: INVITE { /* invite nick[ nick[ ...]] [channel] */ @@ -1618,8 +1618,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 51: // Command: J - case 7: // Command: JOIN + case 5031: // Command: J + case 5032: // Command: JOIN { if (selChannel && selChannel.isChannel && NSObjectIsEmpty(s)) { targetChannelName = selChannel.name; @@ -1635,12 +1635,12 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString } } - [self send:IRCCommandIndexJoin, targetChannelName, s.string, nil]; + [self send:IRCPrivateCommandIndex("join"), targetChannelName, s.string, nil]; return YES; break; } - case 8: // Command: KICK + case 5033: // Command: KICK { if (selChannel && selChannel.isChannel) { targetChannelName = selChannel.name; @@ -1667,7 +1667,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 9: // Command: KILL + case 5035: // Command: KILL { NSString *peer = s.getToken.string; @@ -1678,24 +1678,24 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString reason = [TPCPreferences IRCopDefaultKillMessage]; } - [self send:IRCCommandIndexKill, peer, reason, nil]; + [self send:IRCPrivateCommandIndex("kill"), peer, reason, nil]; } return YES; break; } - case 10: // Command: LIST + case 5037: // Command: LIST { if (PointerIsEmpty(self.channelListDialog)) { [self createChannelListDialog]; } - [self send:IRCCommandIndexList, s.string, nil]; + [self send:IRCPrivateCommandIndex("list"), s.string, nil]; return YES; break; } - case 13: // Command: NICK + case 5048: // Command: NICK { NSString *newnick = s.getToken.string; @@ -1714,42 +1714,40 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 14: // Command: NOTICE - case 19: // Command: PRIVMSG - case 27: // Command: ACTION - case 38: // Command: OMSG - case 39: // Command: ONOTICE - case 54: // Command: ME - case 55: // Command: MSG - case 92: // Command: SME - case 93: // Command: SMSG + case 5050: // Command: NOTICE + case 5051: // Command: OMSG + case 5052: // Command: ONOTICE + case 5041: // Command: ME + case 5043: // Command: MSG + case 5064: // Command: SME + case 5065: // Command: SMSG { BOOL opMsg = NO; BOOL secretMsg = NO; - if ([cmd isEqualToString:IRCCommandIndexMsg]) { - cmd = IRCCommandIndexPrivmsg; - } else if ([cmd isEqualToString:IRCCommandIndexOmsg]) { + if ([cmd isEqualToString:IRCPublicCommandIndex("msg")]) { + cmd = IRCPrivateCommandIndex("privmsg"); + } else if ([cmd isEqualToString:IRCPublicCommandIndex("omsg")]) { opMsg = YES; - cmd = IRCCommandIndexPrivmsg; - } else if ([cmd isEqualToString:IRCCommandIndexOnotice]) { + cmd = IRCPrivateCommandIndex("privmsg"); + } else if ([cmd isEqualToString:IRCPublicCommandIndex("onotice")]) { opMsg = YES; - cmd = IRCCommandIndexNotice; - } else if ([cmd isEqualToString:IRCCommandIndexSme]) { + cmd = IRCPrivateCommandIndex("notice"); + } else if ([cmd isEqualToString:IRCPublicCommandIndex("sme")]) { secretMsg = YES; - cmd = IRCCommandIndexMe; - } else if ([cmd isEqualToString:IRCCommandIndexSmsg]) { + cmd = IRCPublicCommandIndex("me"); + } else if ([cmd isEqualToString:IRCPublicCommandIndex("smsg")]) { secretMsg = YES; - cmd = IRCCommandIndexPrivmsg; + cmd = IRCPrivateCommandIndex("privmsg"); } - if ([cmd isEqualToString:IRCCommandIndexPrivmsg] || - [cmd isEqualToString:IRCCommandIndexNotice] || - [cmd isEqualToString:IRCCommandIndexAction]) { + if ([cmd isEqualToString:IRCPrivateCommandIndex("privmsg")] || + [cmd isEqualToString:IRCPrivateCommandIndex("notice")] || + [cmd isEqualToString:IRCPrivateCommandIndex("action")]) { if (opMsg) { if (selChannel && selChannel.isChannel && [s.string isChannelName] == NO) { @@ -1760,8 +1758,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString } else { targetChannelName = s.getToken.string; } - } else if ([cmd isEqualToString:IRCCommandIndexMe]) { - cmd = IRCCommandIndexAction; + } else if ([cmd isEqualToString:IRCPublicCommandIndex("me")]) { + cmd = IRCPrivateCommandIndex("action"); if (selChannel) { targetChannelName = selChannel.name; @@ -1770,11 +1768,13 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString } } - if ([cmd isEqualToString:IRCCommandIndexPrivmsg] || - [cmd isEqualToString:IRCCommandIndexNotice]) { + if ([cmd isEqualToString:IRCPrivateCommandIndex("privmsg")] || + [cmd isEqualToString:IRCPrivateCommandIndex("notice")]) { if ([s.string hasPrefix:@"\x01"]) { - cmd = (([cmd isEqualToString:IRCCommandIndexPrivmsg]) ? IRCCommandIndexCtcp : IRCCommandIndexCtcpreply); + cmd = (([cmd isEqualToString:IRCPrivateCommandIndex("privmsg")]) ? + IRCPrivateCommandIndex("ctcp") : + IRCPrivateCommandIndex("ctcp_ctcpreply")); [s deleteCharactersInRange:NSMakeRange(0, 1)]; @@ -1790,13 +1790,13 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString } } - if ([cmd isEqualToString:IRCCommandIndexCtcp]) { + if ([cmd isEqualToString:IRCPrivateCommandIndex("ctcp")]) { NSMutableAttributedString *t = s.mutableCopy; NSString *subCommand = [t.getToken.string uppercaseString]; - if ([subCommand isEqualToString:IRCCommandIndexAction]) { - cmd = IRCCommandIndexAction; + if ([subCommand isEqualToString:IRCPrivateCommandIndex("action")]) { + cmd = IRCPrivateCommandIndex("action"); s = t; @@ -1807,7 +1807,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString if (NSObjectIsNotEmpty(subCommand)) { targetChannelName = s.getToken.string; - if ([subCommand isEqualToString:IRCCommandIndexPing]) { + if ([subCommand isEqualToString:IRCPrivateCommandIndex("ctcp_ping")]) { [self sendCTCPPing:targetChannelName]; } else { [self sendCTCPQuery:targetChannelName command:subCommand text:s.string]; @@ -1818,7 +1818,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString } } - if ([cmd isEqualToString:IRCCommandIndexCtcpreply]) { + if ([cmd isEqualToString:IRCPrivateCommandIndex("ctcp_ctcpreply")]) { targetChannelName = s.getToken.string; NSString *subCommand = s.getToken.string; @@ -1828,18 +1828,18 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; } - if ([cmd isEqualToString:IRCCommandIndexPrivmsg] || - [cmd isEqualToString:IRCCommandIndexNotice] || - [cmd isEqualToString:IRCCommandIndexAction]) { + if ([cmd isEqualToString:IRCPrivateCommandIndex("privmsg")] || + [cmd isEqualToString:IRCPrivateCommandIndex("notice")] || + [cmd isEqualToString:IRCPrivateCommandIndex("action")]) { if (NSObjectIsEmpty(s)) return NO; if (NSObjectIsEmpty(targetChannelName)) return NO; TVCLogLineType type; - if ([cmd isEqualToString:IRCCommandIndexNotice]) { + if ([cmd isEqualToString:IRCPrivateCommandIndex("notice")]) { type = TVCLogLineNoticeType; - } else if ([cmd isEqualToString:IRCCommandIndexAction]) { + } else if ([cmd isEqualToString:IRCPrivateCommandIndex("action")]) { type = TVCLogLineActionType; } else { type = TVCLogLinePrivateMessageType; @@ -1892,10 +1892,10 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString NSString *localCmd = cmd; - if ([localCmd isEqualToString:IRCCommandIndexAction]) { - localCmd = IRCCommandIndexPrivmsg; + if ([localCmd isEqualToString:IRCPrivateCommandIndex("action")]) { + localCmd = IRCPrivateCommandIndex("privmsg"); - t = [NSString stringWithFormat:@"\x01%@ %@\x01", IRCCommandIndexAction, t]; + t = [NSString stringWithFormat:@"\x01%@ %@\x01", IRCPrivateCommandIndex("action"), t]; } [self send:localCmd, chname, t, nil]; @@ -1936,15 +1936,15 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 20: // Command: QUIT + case 5057: // Command: QUIT { [self quit:s.string.trim]; return YES; break; } - case 21: // Command: TOPIC - case 61: // Command: T + case 5070: // Command: TOPIC + case 5067: // Command: T { if (selChannel && selChannel.isChannel && [s.string isChannelName] == NO) { targetChannelName = selChannel.name; @@ -1962,23 +1962,23 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString IRCChannel *c = [self findChannel:targetChannelName]; if ([self encryptOutgoingMessage:&topic channel:c] == YES) { - [self send:IRCCommandIndexTopic, targetChannelName, topic, nil]; + [self send:IRCPrivateCommandIndex("topic"), targetChannelName, topic, nil]; } } return YES; break; } - case 23: // Command: WHO + case 5079: // Command: WHO { self.inWhoInfoRun = YES; - [self send:IRCCommandIndexWho, s.string, nil]; + [self send:IRCPrivateCommandIndex("who"), s.string, nil]; return YES; break; } - case 24: // Command: WHOIS + case 5080: // Command: WHOIS { NSString *peer = s.string; @@ -1993,22 +1993,22 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString } if ([s.string contains:NSStringWhitespacePlaceholder]) { - [self sendLine:[NSString stringWithFormat:@"%@ %@", IRCCommandIndexWhois, peer]]; + [self sendLine:[NSString stringWithFormat:@"%@ %@", IRCPrivateCommandIndex("whois"), peer]]; } else { - [self send:IRCCommandIndexWhois, peer, peer, nil]; + [self send:IRCPrivateCommandIndex("whois"), peer, peer, nil]; } return YES; break; } - case 32: // Command: CTCP + case 5014: // Command: CTCP { targetChannelName = s.getToken.string; if (NSObjectIsNotEmpty(targetChannelName)) { NSString *subCommand = [s.getToken.string uppercaseString]; - if ([subCommand isEqualToString:IRCCommandIndexPing]) { + if ([subCommand isEqualToString:IRCPrivateCommandIndex("ctcp_ping")]) { [self sendCTCPPing:targetChannelName]; } else { [self sendCTCPQuery:targetChannelName command:subCommand text:s.string]; @@ -2018,7 +2018,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 33: // Command: CTCPREPLY + case 5015: // Command: CTCPREPLY { targetChannelName = s.getToken.string; @@ -2029,8 +2029,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 41: // Command: BAN - case 64: // Command: UNBAN + case 5005: // Command: BAN + case 5072: // Command: UNBAN { if (c) { NSString *peer = s.getToken.string; @@ -2040,10 +2040,10 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString NSString *host = ((user) ? [user banMask] : peer); - if ([cmd isEqualToString:IRCCommandIndexBan]) { - [self sendCommand:[NSString stringWithFormat:@"MODE +b %@", host] completeTarget:YES target:c.name]; + if ([cmd isEqualToString:IRCPublicCommandIndex("ban")]) { + [self sendCommand:[NSString stringWithFormat:@"%@ +b %@", IRCPublicCommandIndex("mode"), host] completeTarget:YES target:c.name]; } else { - [self sendCommand:[NSString stringWithFormat:@"MODE -b %@", host] completeTarget:YES target:c.name]; + [self sendCommand:[NSString stringWithFormat:@"%@ -b %@", IRCPublicCommandIndex("mode"), host] completeTarget:YES target:c.name]; } } } @@ -2051,27 +2051,27 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 11: // Command: MODE - case 45: // Command: DEHALFOP - case 46: // Command: DEOP - case 47: // Command: DEVOICE - case 48: // Command: HALFOP - case 56: // Command: OP - case 63: // Command: VOICE - case 66: // Command: UMODE - case 53: // Command: M + case 5042: // Command: MODE + case 5019: // Command: DEHALFOP + case 5020: // Command: DEOP + case 5021: // Command: DEVOICE + case 5026: // Command: HALFOP + case 5053: // Command: OP + case 5076: // Command: VOICE + case 5071: // Command: UMODE + case 5040: // Command: M { - if ([cmd isEqualToString:IRCCommandIndexM]) { - cmd = IRCCommandIndexMode; + if ([cmd isEqualToString:IRCPublicCommandIndex("m")]) { + cmd = IRCPrivateCommandIndex("mode"); } - if ([cmd isEqualToString:IRCCommandIndexMode]) { + if ([cmd isEqualToString:IRCPublicCommandIndex("mode")]) { if (selChannel && selChannel.isChannel && [s.string isModeChannelName] == NO) { targetChannelName = selChannel.name; } else if (([s.string hasPrefix:@"+"] || [s.string hasPrefix:@"-"]) == NO) { targetChannelName = s.getToken.string; } - } else if ([cmd isEqualToString:IRCCommandIndexUmode]) { + } else if ([cmd isEqualToString:IRCPublicCommandIndex("umode")]) { [s insertAttributedString:[NSAttributedString emptyStringWithBase:NSStringWhitespacePlaceholder] atIndex:0]; [s insertAttributedString:[NSAttributedString emptyStringWithBase:self.myNick] atIndex:0]; } else { @@ -2116,7 +2116,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString NSMutableString *line = [NSMutableString string]; - [line appendString:IRCCommandIndexMode]; + [line appendString:IRCPrivateCommandIndex("mode")]; if (NSObjectIsNotEmpty(targetChannelName)) { [line appendString:NSStringWhitespacePlaceholder]; @@ -2133,7 +2133,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 42: // Command: CLEAR + case 5010: // Command: CLEAR { if (c) { [self.world clearContentsOfChannel:c inClient:self]; @@ -2155,8 +2155,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 43: // Command: CLOSE - case 77: // Command: REMOVE + case 5012: // Command: CLOSE + case 5061: // Command: REMOVE { NSString *nick = s.getToken.string; @@ -2171,9 +2171,9 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 44: // Command: REJOIN - case 49: // Command: CYCLE - case 58: // Command: HOP + case 5060: // Command: REJOIN + case 5016: // Command: CYCLE + case 5027: // Command: HOP { if (c) { NSString *pass = nil; @@ -2189,8 +2189,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 50: // Command: IGNORE - case 65: // Command: UNIGNORE + case 5029: // Command: IGNORE + case 5073: // Command: UNIGNORE { if (NSObjectIsEmpty(s)) { [self.world.menuController showServerPropertyDialog:self ignore:@"--"]; @@ -2222,7 +2222,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString [g processHostMaskRegex]; - if ([cmd isEqualToString:IRCCommandIndexIgnore]) { + if ([cmd isEqualToString:IRCPublicCommandIndex("ignore")]) { BOOL found = NO; for (IRCAddressBook *e in self.config.ignores) { @@ -2258,15 +2258,15 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 57: // Command: RAW - case 60: // Command: QUOTE + case 5059: // Command: RAW + case 5058: // Command: QUOTE { [self sendLine:s.string]; return YES; break; } - case 59: // Command: QUERY + case 5056: // Command: QUERY { NSString *nick = s.getToken.string; @@ -2283,7 +2283,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 62: // Command: TIMER + case 5069: // Command: TIMER { NSInteger interval = [s.getToken.string integerValue]; @@ -2306,7 +2306,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 68: // Command: WEIGHTS + case 5078: // Command: WEIGHTS { if (c) { NSInteger tc = 0; @@ -2329,8 +2329,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 69: // Command: ECHO - case 70: // Command: DEBUG + case 5022: // Command: ECHO + case 5018: // Command: DEBUG { if ([s.string isEqualNoCase:@"raw on"]) { self.rawModeEnabled = YES; @@ -2347,7 +2347,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 71: // Command: CLEARALL + case 5011: // Command: CLEARALL { if ([TPCPreferences clearAllOnlyOnActiveServer]) { [self.world clearContentsOfClient:self]; @@ -2359,28 +2359,18 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString [c setTreeUnreadCount:0]; [c setKeywordCount:0]; } - } else { - for (IRCClient *u in [self.world clients]) { - [self.world clearContentsOfClient:u]; - - for (IRCChannel *c in [u channels]) { - [self.world clearContentsOfChannel:c inClient:u]; - [c setDockUnreadCount:0]; - [c setTreeUnreadCount:0]; - [c setKeywordCount:0]; - } - } + [self.world updateIcon]; + [self.world reloadTree]; + [self.world markAllAsRead]; + } else { + [self.world destroyAllEvidence]; } - [self.world updateIcon]; - [self.world reloadTree]; - [self.world markAllAsRead]; - return YES; break; } - case 72: // Command: AMSG + case 5003: // Command: AMSG { [s insertAttributedString:[NSAttributedString emptyStringWithBase:@"MSG "] atIndex:0]; @@ -2409,7 +2399,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 73: // Command: AME + case 5002: // Command: AME { [s insertAttributedString:[NSAttributedString emptyStringWithBase:@"ME "] atIndex:0]; @@ -2438,8 +2428,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 78: // Command: KB - case 79: // Command: KICKBAN + case 5083: // Command: KB + case 5034: // Command: KICKBAN { if (c) { NSString *peer = s.getToken.string; @@ -2455,15 +2445,15 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString reason = [TPCPreferences defaultKickMessage]; } - [self send:IRCCommandIndexMode, c.name, @"+b", host, nil]; - [self send:IRCCommandIndexKick, c.name, user.nick, reason, nil]; + [self send:IRCPrivateCommandIndex("mode"), c.name, @"+b", host, nil]; + [self send:IRCPrivateCommandIndex("kick"), c.name, user.nick, reason, nil]; } } return YES; break; } - case 81: // Command: ICBADGE + case 5028: // Command: ICBADGE { if ([s.string contains:NSStringWhitespacePlaceholder] == NO) return NO; @@ -2475,7 +2465,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 82: // Command: SERVER + case 5062: // Command: SERVER { if (NSObjectIsNotEmpty(s)) { [self.world createConnection:s.string chan:nil]; @@ -2484,7 +2474,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 83: // Command: CONN + case 5013: // Command: CONN { if (NSObjectIsNotEmpty(s)) { [self.config setHost:s.getToken.string]; @@ -2497,7 +2487,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 84: // Command: MYVERSION + case 5046: // Command: MYVERSION { NSString *ref = [TPCPreferences gitBuildReference]; NSString *name = [TPCPreferences applicationName]; @@ -2518,7 +2508,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 74: // Command: MUTE + case 5044: // Command: MUTE { if (self.world.soundMuted) { [self printBoth:[self.world selectedChannelOn:self] type:TVCLogLineReplyType text:TXTLS(@"SoundIsAlreadyMuted")]; @@ -2531,7 +2521,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 75: // Command: UNMUTE + case 5075: // Command: UNMUTE { if (self.world.soundMuted) { [self printBoth:[self.world selectedChannelOn:self] type:TVCLogLineReplyType text:TXTLS(@"SoundIsNoLongerMuted")]; @@ -2544,39 +2534,39 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 76: // Command: UNLOAD_PLUGINS + case 5074: // Command: UNLOAD_PLUGINS { [NSBundle.invokeInBackgroundThread deallocBundlesFromMemory:self.world]; return YES; break; } - case 91: // Command: LOAD_PLUGINS + case 5038: // Command: LOAD_PLUGINS { [NSBundle.invokeInBackgroundThread loadBundlesIntoMemory:self.world]; return YES; break; } - case 94: // Command: LAGCHECK - case 95: // Command: MYLAG + case 5084: // Command: LAGCHECK + case 5045: // Command: MYLAG { self.lastLagCheck = CFAbsoluteTimeGetCurrent(); - if ([cmd isEqualNoCase:IRCCommandIndexMylag]) { + if ([cmd isEqualNoCase:IRCPublicCommandIndex("mylag")]) { self.sendLagcheckToChannel = YES; } - [self sendCTCPQuery:self.myNick command:IRCCommandIndexLagcheck text:[NSString stringWithDouble:self.lastLagCheck]]; + [self sendCTCPQuery:self.myNick command:IRCPrivateCommandIndex("ctcp_lagcheck") text:[NSString stringWithDouble:self.lastLagCheck]]; [self printDebugInformation:TXTLS(@"LagCheckRequestSentMessage")]; return YES; break; } - case 96: // Command: ZLINE - case 97: // Command: GLINE - case 98: // Command: GZLINE + case 5082: // Command: ZLINE + case 5023: // Command: GLINE + case 5025: // Command: GZLINE { NSString *peer = s.getToken.string; @@ -2610,8 +2600,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 99: // Command: SHUN - case 100: // Command: TEMPSHUN + case 5063: // Command: SHUN + case 5068: // Command: TEMPSHUN { NSString *peer = s.getToken.string; @@ -2619,7 +2609,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString [self send:cmd, peer, s.string, nil]; } else { if (peer) { - if ([cmd isEqualToString:IRCCommandIndexTempshun]) { + if ([cmd isEqualToString:IRCPublicCommandIndex("tempshun")]) { NSString *reason = s.getToken.string.trim; if (NSObjectIsEmpty(reason)) { @@ -2659,8 +2649,8 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 102: // Command: CAP - case 103: // Command: CAPS + case 5006: // Command: CAP + case 5007: // Command: CAPS { if (NSObjectIsNotEmpty(self.acceptedCaps)) { NSString *caps = [self.acceptedCaps componentsJoinedByString:@", "]; @@ -2673,7 +2663,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 104: // Command: CCBADGE + case 5008: // Command: CCBADGE { NSString *chan = s.getToken.string; @@ -2704,7 +2694,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 105: // Command: NNCOLORESET + case 5049: // Command: NNCOLORESET { if (PointerIsNotEmpty(c) && c.isChannel) { for (IRCUser *u in c.members) { @@ -2715,7 +2705,7 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; break; } - case 106: // Command: SSLCONTEXT + case 5066: // Command: SSLCONTEXT { [self.conn.conn openSSLCertificateTrustDialog]; @@ -2730,14 +2720,14 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString #ifdef TXUserScriptsFolderAvailable NSArray *scriptPaths = @[ - NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]), + NSStringNilValueSubstitute([TPCPreferences whereScriptsUnsupervisedPath]), NSStringNilValueSubstitute([TPCPreferences whereScriptsPath]), - NSStringNilValueSubstitute([TPCPreferences whereScriptsUnsupervisedPath]) + NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]) ]; #else NSArray *scriptPaths = @[ - NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]), - NSStringNilValueSubstitute([TPCPreferences whereScriptsPath]) + NSStringNilValueSubstitute([TPCPreferences whereScriptsPath]), + NSStringNilValueSubstitute([TPCPreferences whereScriptsLocalPath]) ]; #endif @@ -2778,12 +2768,13 @@ - (BOOL)sendCommand:(id)str completeTarget:(BOOL)completeTarget target:(NSString return YES; } else { if (scriptFound) { - NSDictionary *inputInfo = - @{@"channel": NSStringNilValueSubstitute(c.name), + NSDictionary *inputInfo = @{ + @"channel": NSStringNilValueSubstitute(c.name), @"path": scriptPath, @"input": s.string, @"completeTarget": @(completeTarget), - @"target": NSStringNilValueSubstitute(targetChannelName)}; + @"target": NSStringNilValueSubstitute(targetChannelName) + }; [self.invokeInBackgroundThread executeTextualCmdScript:inputInfo]; @@ -3056,9 +3047,9 @@ - (BOOL)notifyText:(TXNotificationType)type lineType:(TVCLogLineType)ltype targe NSString *desc; if (ltype == TVCLogLineActionType || ltype == TVCLogLineActionNoHighlightType) { - desc = [NSString stringWithFormat:@"• %@: %@", nick, text]; + desc = [NSString stringWithFormat:TXNotificationDialogActionNicknameFormat, nick, text]; } else { - desc = [NSString stringWithFormat:@"<%@> %@", nick, text]; + desc = [NSString stringWithFormat:TXNotificationDialogStandardNicknameFormat, nick, text]; } if (channel) { @@ -3612,11 +3603,11 @@ - (void)receivePrivmsgAndNotice:(IRCMessage *)m text = [text safeSubstringToIndex:n]; } - if ([m.command isEqualToString:IRCCommandIndexPrivmsg]) { + if ([m.command isEqualToString:IRCPrivateCommandIndex("privmsg")]) { if ([[text uppercaseString] hasPrefix:@"ACTION "]) { text = [text safeSubstringFromIndex:7]; - [self receiveText:m command:IRCCommandIndexAction text:text identified:identified]; + [self receiveText:m command:IRCPrivateCommandIndex("action") text:text identified:identified]; } else { [self receiveCTCPQuery:m text:text]; } @@ -3635,9 +3626,9 @@ - (void)receiveText:(IRCMessage *)m command:(NSString *)cmd text:(NSString *)tex TVCLogLineType type = TVCLogLinePrivateMessageType; - if ([cmd isEqualToString:IRCCommandIndexNotice]) { + if ([cmd isEqualToString:IRCPrivateCommandIndex("notice")]) { type = TVCLogLineNoticeType; - } else if ([cmd isEqualToString:IRCCommandIndexAction]) { + } else if ([cmd isEqualToString:IRCPrivateCommandIndex("action")]) { type = TVCLogLineActionType; } @@ -3842,7 +3833,7 @@ - (void)receiveText:(IRCMessage *)m command:(NSString *)cmd text:(NSString *)tex if (NSObjectIsNotEmpty(self.config.nickPassword) && self.isIdentifiedWithSASL == NO) { self.serverHasNickServ = YES; - [self send:IRCCommandIndexPrivmsg, @"NickServ", + [self send:IRCPrivateCommandIndex("privmsg"), @"NickServ", [NSString stringWithFormat:@"IDENTIFY %@", self.config.nickPassword], nil]; } } else if ([text hasPrefix:@"This nick is owned by someone else"]) { @@ -3850,7 +3841,7 @@ - (void)receiveText:(IRCMessage *)m command:(NSString *)cmd text:(NSString *)tex if (NSObjectIsNotEmpty(self.config.nickPassword)) { self.serverHasNickServ = YES; - [self send:IRCCommandIndexPrivmsg, @"NickServ@services.dal.net", [NSString stringWithFormat:@"IDENTIFY %@", self.config.nickPassword], nil]; + [self send:IRCPrivateCommandIndex("privmsg"), @"NickServ@services.dal.net", [NSString stringWithFormat:@"IDENTIFY %@", self.config.nickPassword], nil]; } } } else { @@ -3935,7 +3926,7 @@ - (void)receiveCTCPQuery:(IRCMessage *)m text:(NSString *)text return; } - if ([command isEqualToString:IRCCommandIndexDcc]) { + if ([command isEqualToString:IRCPrivateCommandIndex("dcc")]) { [self printDebugInformationToConsole:TXTLS(@"DCCRequestErrorMessage")]; } else { IRCChannel *target = nil; @@ -3946,15 +3937,15 @@ - (void)receiveCTCPQuery:(IRCMessage *)m text:(NSString *)text NSString *text = TXTFLS(@"IRCRecievedCTCPRequest", command, nick); - if ([command isEqualToString:IRCCommandIndexLagcheck] == NO) { + if ([command isEqualToString:IRCPrivateCommandIndex("ctcp_lagcheck")] == NO) { [self printBoth:target type:TVCLogLineCTCPType text:text receivedAt:m.receivedAt]; } - if ([command isEqualToString:IRCCommandIndexPing]) { + if ([command isEqualToString:IRCPrivateCommandIndex("ctcp_ping")]) { [self sendCTCPReply:nick command:command text:s]; - } else if ([command isEqualToString:IRCCommandIndexTime]) { + } else if ([command isEqualToString:IRCPrivateCommandIndex("ctcp_time")]) { [self sendCTCPReply:nick command:command text:[[NSDate date] descriptionWithLocale:[NSLocale currentLocale]]]; - } else if ([command isEqualToString:IRCCommandIndexVersion]) { + } else if ([command isEqualToString:IRCPrivateCommandIndex("ctcp_version")]) { NSString *fakever = [TPCPreferences masqueradeCTCPVersion]; if (NSObjectIsNotEmpty(fakever)) { @@ -3970,11 +3961,11 @@ - (void)receiveCTCPQuery:(IRCMessage *)m text:(NSString *)text [self sendCTCPReply:nick command:command text:text]; } - } else if ([command isEqualToString:IRCCommandIndexUserinfo]) { + } else if ([command isEqualToString:IRCPrivateCommandIndex("ctcp_userinfo")]) { [self sendCTCPReply:nick command:command text:NSStringEmptyPlaceholder]; - } else if ([command isEqualToString:IRCCommandIndexClientinfo]) { + } else if ([command isEqualToString:IRCPrivateCommandIndex("ctcp_clientinfo")]) { [self sendCTCPReply:nick command:command text:TXTLS(@"IRCCTCPSupportedReplies")]; - } else if ([command isEqualToString:IRCCommandIndexLagcheck]) { + } else if ([command isEqualToString:IRCPrivateCommandIndex("ctcp_lagcheck")]) { if (self.lastLagCheck == 0) { [self printDebugInformationToConsole:TXTFLS(@"IRCCTCPRequestIgnored", command, nick)]; } @@ -4035,7 +4026,7 @@ - (void)receiveCTCPReply:(IRCMessage *)m text:(NSString *)text c = [self.world selectedChannelOn:self]; } - if ([command isEqualToString:IRCCommandIndexPing]) { + if ([command isEqualToString:IRCPrivateCommandIndex("ctcp_ping")]) { uint64_t delta = (mach_absolute_time() - [s longLongValue]); mach_timebase_info_data_t info; @@ -4057,12 +4048,12 @@ - (void)requestUserHosts:(IRCChannel *)c if ([c.name isChannelName]) { [c setIsModeInit:YES]; - [self send:IRCCommandIndexMode, c.name, nil]; + [self send:IRCPrivateCommandIndex("mode"), c.name, nil]; if (self.userhostInNames == NO) { // We can skip requesting WHO, we already have this information. - [self send:IRCCommandIndexWho, c.name, nil, nil]; + [self send:IRCPrivateCommandIndex("who"), c.name, nil, nil]; } } } @@ -4397,7 +4388,7 @@ - (void)receiveMode:(IRCMessage *)m } if (performWho) { - [self send:IRCCommandIndexWho, c.name, nil, nil]; + [self send:IRCPrivateCommandIndex("who"), c.name, nil, nil]; } [self printBoth:c type:TVCLogLineModeType text:TXTFLS(@"IRCModeSet", nick, modeStr) receivedAt:m.receivedAt]; @@ -4455,11 +4446,11 @@ - (void)sendNextCap if (self.pendingCaps && [self.pendingCaps count]) { NSString *cap = [self.pendingCaps lastObject]; - [self send:IRCCommandIndexCap, @"REQ", cap, nil]; + [self send:IRCPrivateCommandIndex("cap"), @"REQ", cap, nil]; [self.pendingCaps removeLastObject]; } else { - [self send:IRCCommandIndexCap, @"END", nil]; + [self send:IRCPrivateCommandIndex("cap"), @"END", nil]; } } } @@ -4493,7 +4484,7 @@ - (void)cap:(NSString*)cap result:(BOOL)supported self.inSASLRequest = YES; [self pauseCap]; - [self send:IRCCommandIndexAuthenticate, @"PLAIN", nil]; + [self send:IRCPrivateCommandIndex("cap_authenticate"), @"PLAIN", nil]; } else if ([cap isEqualNoCase:@"userhost-in-names"]) { self.userhostInNames = YES; } else if ([cap isEqualNoCase:@"multi-prefix"]) { @@ -4518,7 +4509,7 @@ - (void)receiveCapacityOrAuthenticationRequest:(IRCMessage *)m star = [star trim]; action = [action trim]; - if ([command isEqualNoCase:IRCCommandIndexCap]) { + if ([command isEqualNoCase:IRCPrivateCommandIndex("cap")]) { if ([base isEqualNoCase:@"LS"]) { NSArray *caps = [action componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; @@ -4559,11 +4550,11 @@ - (void)receiveCapacityOrAuthenticationRequest:(IRCMessage *)m NSArray *authStrings = [authString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString *string in authStrings) { - [self send:IRCCommandIndexAuthenticate, string, nil]; + [self send:IRCPrivateCommandIndex("cap_authenticate"), string, nil]; } if (NSObjectIsEmpty(authStrings) || [(NSString *)[authStrings lastObject] length] == 400) { - [self send:IRCCommandIndexAuthenticate, @"+", nil]; + [self send:IRCPrivateCommandIndex("cap_authenticate"), @"+", nil]; } } } @@ -4571,7 +4562,7 @@ - (void)receiveCapacityOrAuthenticationRequest:(IRCMessage *)m - (void)receivePing:(IRCMessage *)m { - [self send:IRCCommandIndexPong, [m sequence:0], nil]; + [self send:IRCPrivateCommandIndex("pong"), [m sequence:0], nil]; } - (void)receiveInit:(IRCMessage *)m @@ -5158,7 +5149,7 @@ - (void)receiveNumericReply:(IRCMessage *)m NSString *m = c.config.mode; if (NSObjectIsNotEmpty(m)) { - NSString *line = [NSString stringWithFormat:@"%@ %@ %@", IRCCommandIndexMode, chname, m]; + NSString *line = [NSString stringWithFormat:@"%@ %@ %@", IRCPrivateCommandIndex("mode"), chname, m]; [self sendLine:line]; } @@ -5175,7 +5166,7 @@ - (void)receiveNumericReply:(IRCMessage *)m if (NSObjectIsNotEmpty(topic)) { if ([self encryptOutgoingMessage:&topic channel:c] == YES) { - [self send:IRCCommandIndexTopic, chname, topic, nil]; + [self send:IRCPrivateCommandIndex("topic"), chname, topic, nil]; } } } @@ -5433,7 +5424,7 @@ - (void)receiveNickCollisionError:(IRCMessage *)m if (self.tryingNickNumber < altNicks.count) { NSString *nick = [altNicks safeObjectAtIndex:self.tryingNickNumber]; - [self send:IRCCommandIndexNick, nick, nil]; + [self send:IRCPrivateCommandIndex("nick"), nick, nil]; } else { [self tryAnotherNick]; } @@ -5476,7 +5467,7 @@ - (void)tryAnotherNick self.sentNick = [self.sentNick stringByAppendingString:@"_"]; } - [self send:IRCCommandIndexNick, self.sentNick, nil]; + [self send:IRCPrivateCommandIndex("nick"), self.sentNick, nil]; } #pragma mark - @@ -5586,18 +5577,18 @@ - (void)ircConnectionDidConnect:(IRCConnection *)sender realName = self.config.nick; } - [self send:IRCCommandIndexCap, @"LS", nil]; + [self send:IRCPrivateCommandIndex("cap"), @"LS", nil]; if (NSObjectIsNotEmpty(self.config.password)) { - [self send:IRCCommandIndexPass, self.config.password, nil]; + [self send:IRCPrivateCommandIndex("pass"), self.config.password, nil]; } - [self send:IRCCommandIndexNick, self.sentNick, nil]; + [self send:IRCPrivateCommandIndex("nick"), self.sentNick, nil]; if (self.config.bouncerMode) { // Fuck psybnc — use ZNC - [self send:IRCCommandIndexUser, user, [NSString stringWithDouble:modeParam], @"*", [@":" stringByAppendingString:realName], nil]; + [self send:IRCPrivateCommandIndex("user"), user, [NSString stringWithDouble:modeParam], @"*", [@":" stringByAppendingString:realName], nil]; } else { - [self send:IRCCommandIndexUser, user, [NSString stringWithDouble:modeParam], @"*", realName, nil]; + [self send:IRCPrivateCommandIndex("user"), user, [NSString stringWithDouble:modeParam], @"*", realName, nil]; } [self.world reloadTree]; @@ -5684,90 +5675,92 @@ - (void)ircConnectionDidReceive:(NSData *)data if (m.numericReply > 0) { [self receiveNumericReply:m]; } else { - switch ([TPCPreferences indexOfIRCommand:cmd]) { - case 4: // Command: ERROR + NSInteger switchNumeric = [TPCPreferences indexOfIRCommand:cmd publicSearch:NO]; + + switch (switchNumeric) { + case 1016: // Command: ERROR { [self receiveError:m]; break; } - case 5: // Command: INVITE + case 1018: // Command: INVITE { [self receiveInvite:m]; break; } - case 7: // Command: JOIN + case 1020: // Command: JOIN { [self receiveJoin:m]; break; } - case 8: // Command: KICK + case 1021: // Command: KICK { [self receiveKick:m]; break; } - case 9: // Command: KILL + case 1022: // Command: KILL { [self receiveKill:m]; break; } - case 11: // Command: MODE + case 1026: // Command: MODE { [self receiveMode:m]; break; } - case 13: // Command: NICK + case 1029: // Command: NICK { [self receiveNick:m]; break; } - case 14: // Command: NOTICE - case 19: // Command: PRIVMSG + case 1030: // Command: NOTICE + case 1035: // Command: PRIVMSG { [self receivePrivmsgAndNotice:m]; break; } - case 15: // Command: PART + case 1031: // Command: PART { [self receivePart:m]; break; } - case 17: // Command: PING + case 1033: // Command: PING { [self receivePing:m]; break; } - case 20: // Command: QUIT + case 1036: // Command: QUIT { [self receiveQuit:m]; break; } - case 21: // Command: TOPIC + case 1039: // Command: TOPIC { [self receiveTopic:m]; break; } - case 80: // Command: WALLOPS - case 85: // Command: CHATOPS - case 86: // Command: GLOBOPS - case 87: // Command: LOCOPS - case 88: // Command: NACHAT - case 89: // Command: ADCHAT + case 1038: // Command: WALLOPS + case 1006: // Command: CHATOPS + case 1017: // Command: GLOBOPS + case 1024: // Command: LOCOPS + case 1027: // Command: NACHAT + case 1003: // Command: ADCHAT { [m.params safeInsertObject:m.sender.nick atIndex:0]; NSString *text = [m.params safeObjectAtIndex:1]; [m.params safeRemoveObjectAtIndex:1]; - [m.params safeInsertObject:[NSString stringWithFormat:@"[%@]: %@", m.command, text] atIndex:1]; + [m.params safeInsertObject:[NSString stringWithFormat:TXLogLineSpecialNoticeMessageFormat, m.command, text] atIndex:1]; - m.command = IRCCommandIndexNotice; + m.command = IRCPrivateCommandIndex("notice"); [self receivePrivmsgAndNotice:m]; break; } - case 101: // Command: AUTHENTICATE - case 102: // Command: CAP + case 1005: // Command: AUTHENTICATE + case 1004: // Command: CAP { [self receiveCapacityOrAuthenticationRequest:m]; break; diff --git a/Classes/IRC/IRCSendingMessage.m b/Classes/IRC/IRCSendingMessage.m index 9219b7355a..548400e634 100755 --- a/Classes/IRC/IRCSendingMessage.m +++ b/Classes/IRC/IRCSendingMessage.m @@ -61,22 +61,21 @@ - (NSString *)string { if (NSObjectIsEmpty(self.string)) { BOOL forceCompleteColon = NO; - - if ([self.command isEqualToString:IRCCommandIndexPrivmsg] || - [self.command isEqualToString:IRCCommandIndexNotice]) { + if ([self.command isEqualToString:IRCPrivateCommandIndex("privmsg")] || + [self.command isEqualToString:IRCPrivateCommandIndex("notice")]) { forceCompleteColon = YES; - } else if ([self.command isEqualToString:IRCCommandIndexNick] - || [self.command isEqualToString:IRCCommandIndexMode] - || [self.command isEqualToString:IRCCommandIndexJoin] - || [self.command isEqualToString:IRCCommandIndexNames] - || [self.command isEqualToString:IRCCommandIndexWho] - || [self.command isEqualToString:IRCCommandIndexList] - || [self.command isEqualToString:IRCCommandIndexInvite] - || [self.command isEqualToString:IRCCommandIndexWhois] - || [self.command isEqualToString:IRCCommandIndexWhowas] - || [self.command isEqualToString:IRCCommandIndexIson] - || [self.command isEqualToString:IRCCommandIndexUser]) { + } else if ( [self.command isEqualToString:IRCPrivateCommandIndex("nick")] + || [self.command isEqualToString:IRCPrivateCommandIndex("mode")] + || [self.command isEqualToString:IRCPrivateCommandIndex("join")] + || [self.command isEqualToString:IRCPrivateCommandIndex("names")] + || [self.command isEqualToString:IRCPrivateCommandIndex("who")] + || [self.command isEqualToString:IRCPrivateCommandIndex("list")] + || [self.command isEqualToString:IRCPrivateCommandIndex("invite")] + || [self.command isEqualToString:IRCPrivateCommandIndex("whois")] + || [self.command isEqualToString:IRCPrivateCommandIndex("whowas")] + || [self.command isEqualToString:IRCPrivateCommandIndex("ison")] + || [self.command isEqualToString:IRCPrivateCommandIndex("user")]) { self.completeColon = NO; } diff --git a/Classes/IRC/IRCWorld.m b/Classes/IRC/IRCWorld.m index 8dd20cddc4..bfc5dda030 100755 --- a/Classes/IRC/IRCWorld.m +++ b/Classes/IRC/IRCWorld.m @@ -199,6 +199,25 @@ - (void)resetLoadedBundles self.bundlesWithOutputRules = [NSDictionary new]; } +- (void)destroyAllEvidence +{ + for (IRCClient *u in self.clients) { + [self clearContentsOfClient:u]; + + for (IRCChannel *c in [u channels]) { + [self clearContentsOfChannel:c inClient:u]; + + [c setDockUnreadCount:0]; + [c setTreeUnreadCount:0]; + [c setKeywordCount:0]; + } + } + + [self updateIcon]; + [self reloadTree]; + [self markAllAsRead]; +} + - (void)addHighlightInChannel:(IRCChannel *)channel withMessage:(NSString *)message { if ([TPCPreferences logAllHighlightsToQuery]) { diff --git a/Classes/Library/External Libraries/Sockets/GCDAsyncSocketExtensions.m b/Classes/Library/External Libraries/Sockets/GCDAsyncSocketExtensions.m index 09f50c2c54..1d5b042280 100755 --- a/Classes/Library/External Libraries/Sockets/GCDAsyncSocketExtensions.m +++ b/Classes/Library/External Libraries/Sockets/GCDAsyncSocketExtensions.m @@ -54,15 +54,15 @@ + (void)useSSLWithConnection:(id)socket delegate:(id)theDelegate NSMutableDictionary *settings = [NSMutableDictionary dictionary]; - settings[CFItemRefToID(kCFStreamSSLLevel)] = CFItemRefToID(kCFStreamSocketSecurityLevelNegotiatedSSL); - settings[CFItemRefToID(kCFStreamSSLPeerName)] = CFItemRefToID(kCFNull); + settings[CFItemRefToID(kCFStreamSSLLevel)] = CFItemRefToID(kCFStreamSocketSecurityLevelNegotiatedSSL); + settings[CFItemRefToID(kCFStreamSSLPeerName)] = CFItemRefToID(kCFNull); if (client.config.isTrustedConnection) { - settings[CFItemRefToID(kCFStreamSSLIsServer)] = CFItemRefToID(kCFBooleanFalse); - settings[CFItemRefToID(kCFStreamSSLAllowsAnyRoot)] = CFItemRefToID(kCFBooleanTrue); - settings[CFItemRefToID(kCFStreamSSLAllowsExpiredRoots)] = CFItemRefToID(kCFBooleanTrue); - settings[CFItemRefToID(kCFStreamSSLAllowsExpiredCertificates)] = CFItemRefToID(kCFBooleanTrue); - settings[CFItemRefToID(kCFStreamSSLValidatesCertificateChain)] = CFItemRefToID(kCFBooleanFalse); + settings[CFItemRefToID(kCFStreamSSLIsServer)] = CFItemRefToID(kCFBooleanFalse); + settings[CFItemRefToID(kCFStreamSSLAllowsAnyRoot)] = CFItemRefToID(kCFBooleanTrue); + settings[CFItemRefToID(kCFStreamSSLAllowsExpiredRoots)] = CFItemRefToID(kCFBooleanTrue); + settings[CFItemRefToID(kCFStreamSSLAllowsExpiredCertificates)] = CFItemRefToID(kCFBooleanTrue); + settings[CFItemRefToID(kCFStreamSSLValidatesCertificateChain)] = CFItemRefToID(kCFBooleanFalse); } [socket startTLS:settings]; @@ -74,7 +74,8 @@ + (BOOL)badSSLCertErrorFound:(NSError *)error NSString *domain = [error domain]; if ([domain isEqualToString:TXkCFStreamErrorDomainSSL]) { - NSArray *errorCodes = @[@(errSSLBadCert), + NSArray *errorCodes = @[ + @(errSSLBadCert), @(errSSLNoRootCert), @(errSSLCertExpired), @(errSSLPeerBadCert), @@ -184,12 +185,12 @@ - (void)useSocksProxyVersion:(NSInteger)version } settings[CFItemRefToID(kCFStreamPropertySOCKSProxyHost)] = host; - [settings setInteger:port forKey:CFItemRefToID(kCFStreamPropertySOCKSProxyPort)]; + settings[CFItemRefToID(kCFStreamPropertySOCKSProxyPort)] = @(port); if (NSObjectIsNotEmpty(user)) settings[CFItemRefToID(kCFStreamPropertySOCKSUser)] = user; if (NSObjectIsNotEmpty(password)) settings[CFItemRefToID(kCFStreamPropertySOCKSPassword)] = password; - CFReadStreamSetProperty(theReadStream, kCFStreamPropertySOCKSProxy, (__bridge CFStringRef)(settings)); + CFReadStreamSetProperty (theReadStream, kCFStreamPropertySOCKSProxy, (__bridge CFStringRef)(settings)); CFWriteStreamSetProperty(theWriteStream, kCFStreamPropertySOCKSProxy, (__bridge CFStringRef)(settings)); } diff --git a/Classes/Preferences/TPCPreferences.m b/Classes/Preferences/TPCPreferences.m index f4a87629e1..f486f92078 100755 --- a/Classes/Preferences/TPCPreferences.m +++ b/Classes/Preferences/TPCPreferences.m @@ -35,11 +35,6 @@ *********************************************************************** */ -/* TPCPreferences is one of our highest level objects. It is a wrapper for a lot - of the data handed down to the application beyond simple preference values. It also - provides information such as the IRC command index, version information, local - directory paths, etc. */ - #import "TextualApplication.h" @implementation TPCPreferences @@ -52,7 +47,7 @@ @implementation TPCPreferences /* masterController was only added to use with -invertSidebarColors, but having a reference in this class can make some calls much simplier. Instead of digging down through delegates to find something… we can just call this. - + The master control has pointers to everything. */ + (TXMasterController *)masterController @@ -77,7 +72,7 @@ + (NSDictionary *)textualInfoPlist return [[NSBundle mainBundle] infoDictionary]; } -+ (NSDictionary *)systemInfoPlist ++ (NSDictionary *)systemInfoPlist { return systemVersionPlist; } @@ -85,120 +80,243 @@ + (NSDictionary *)systemInfoPlist #pragma mark - #pragma mark Command Index -static NSMutableDictionary *commandIndex = nil; +static NSArray *IRCUserAccessibleCommandIndexMap; +static NSArray *IRCInternalUseCommandIndexMap; -+ (NSDictionary *)commandIndexList ++ (void)populateCommandIndex { - return commandIndex; + 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)], + ]; + + IRCUserAccessibleCommandIndexMap = @[ // Open Key: 5085 + @[@"adchat", @"ADCHAT", @(5001), @(NO)], + @[@"ame", @"AME", @(5002), @(NO)], + @[@"amsg", @"AMSG", @(5003), @(NO)], + @[@"away", @"AWAY", @(5004), @(NO)], + @[@"ban", @"BAN", @(5005), @(NO)], + @[@"cap", @"CAP", @(5006), @(NO)], + @[@"caps", @"CAPS", @(5007), @(NO)], + @[@"ccbadge", @"CCBADGE", @(5008), @(YES)], + @[@"chatops", @"CHATOPS", @(5009), @(NO)], + @[@"clear", @"CLEAR", @(5010), @(NO)], + @[@"clearall", @"CLEARALL", @(5011), @(NO)], + @[@"close", @"CLOSE", @(5012), @(NO)], + @[@"conn", @"CONN", @(5013), @(NO)], + @[@"ctcp", @"CTCP", @(5014), @(NO)], + @[@"ctcpreply", @"CTCPREPLY", @(5015), @(NO)], + @[@"cycle", @"CYCLE", @(5016), @(NO)], + @[@"dcc", @"DCC", @(5017), @(NO)], + @[@"debug", @"DEBUG", @(5018), @(NO)], + @[@"dehalfop", @"DEHALFOP", @(5019), @(NO)], + @[@"deop", @"DEOP", @(5020), @(NO)], + @[@"devoice", @"DEVOICE", @(5021), @(NO)], + @[@"echo", @"ECHO", @(5022), @(NO)], + @[@"gline", @"GLINE", @(5023), @(NO)], + @[@"globops", @"GLOBOPS", @(5024), @(NO)], + @[@"gzline", @"GZLINE", @(5025), @(NO)], + @[@"halfop", @"HALFOP", @(5026), @(NO)], + @[@"hop", @"HOP", @(5027), @(NO)], + @[@"icbadge", @"ICBADGE", @(5028), @(YES)], + @[@"ignore", @"IGNORE", @(5029), @(NO)], + @[@"invite", @"INVITE", @(5030), @(NO)], + @[@"j", @"J", @(5031), @(NO)], + @[@"join", @"JOIN", @(5032), @(NO)], + @[@"kb", @"KB" , @(5083), @(NO)], + @[@"kick", @"KICK", @(5033), @(NO)], + @[@"kickban", @"KICKBAN", @(5034), @(NO)], + @[@"kill", @"KILL", @(5035), @(NO)], + @[@"lagcheck", @"LAGCHECK", @(5084), @(NO)], + @[@"leave", @"LEAVE", @(5036), @(NO)], + @[@"list", @"LIST", @(5037), @(NO)], + @[@"load_plugins", @"LOAD_PLUGINS", @(5038), @(YES)], + @[@"locops", @"LOCOPS", @(5039), @(NO)], + @[@"m", @"M", @(5040), @(NO)], + @[@"me", @"ME", @(5041), @(NO)], + @[@"mode", @"MODE", @(5042), @(NO)], + @[@"msg", @"MSG", @(5043), @(NO)], + @[@"mute", @"MUTE", @(5044), @(NO)], + @[@"mylag", @"MYLAG", @(5045), @(NO)], + @[@"myversion", @"MYVERSION", @(5046), @(NO)], + @[@"nachat", @"NACHAT", @(5047), @(NO)], + @[@"nick", @"NICK", @(5048), @(NO)], + @[@"nncoloreset", @"NNCOLORESET", @(5049), @(YES)], + @[@"notice", @"NOTICE", @(5050), @(NO)], + @[@"omsg", @"OMSG", @(5051), @(NO)], + @[@"onotice", @"ONOTICE", @(5052), @(NO)], + @[@"op", @"OP", @(5053), @(NO)], + @[@"part", @"PART", @(5054), @(NO)], + @[@"pass", @"PASS", @(5055), @(NO)], + @[@"query", @"QUERY", @(5056), @(NO)], + @[@"quit", @"QUIT", @(5057), @(NO)], + @[@"quote", @"QUOTE", @(5058), @(NO)], + @[@"raw", @"RAW", @(5059), @(NO)], + @[@"rejoin", @"REJOIN", @(5060), @(NO)], + @[@"remove", @"REMOVE", @(5061), @(NO)], + @[@"server", @"SERVER", @(5062), @(NO)], + @[@"shun", @"SHUN", @(5063), @(NO)], + @[@"sme", @"SME", @(5064), @(NO)], + @[@"smsg", @"SMSG", @(5065), @(NO)], + @[@"sslcontext", @"SSLCONTEXT", @(5066), @(NO)], + @[@"t", @"T", @(5067), @(NO)], + @[@"tempshun", @"TEMPSHUN", @(5068), @(NO)], + @[@"timer", @"TIMER", @(5069), @(NO)], + @[@"topic", @"TOPIC", @(5070), @(NO)], + @[@"umode", @"UMODE", @(5071), @(NO)], + @[@"unban", @"UNBAN", @(5072), @(NO)], + @[@"unignore", @"UNIGNORE", @(5073), @(NO)], + @[@"unload_plugins", @"UNLOAD_PLUGINS", @(5074), @(YES)], + @[@"unmute", @"UNMUTE", @(5075), @(NO)], + @[@"voice", @"VOICE", @(5076), @(NO)], + @[@"wallops", @"WALLOPS", @(5077), @(NO)], + @[@"weights", @"WEIGHTS", @(5078), @(NO)], + @[@"who", @"WHO", @(5079), @(NO)], + @[@"whois", @"WHOIS", @(5080), @(NO)], + @[@"whowas", @"WHOWAS", @(5081), @(NO)], + @[@"zline", @"ZLINE", @(5082), @(NO)], + ]; +} + ++ (NSArray *)IRCCommandIndex:(BOOL)isPublic +{ + if (isPublic == NO) { + return IRCInternalUseCommandIndexMap; + } else { + return IRCUserAccessibleCommandIndexMap; + } } -+ (void)populateCommandIndex +#pragma mark - + ++ (NSArray *)publicIRCCommandList +{ + NSMutableArray *index = [NSMutableArray array]; + + BOOL inDevMode = [_NSUserDefaults() boolForKey:TXDeveloperEnvironmentToken]; + + for (NSArray *indexInfo in IRCUserAccessibleCommandIndexMap) { + BOOL developerOnly = [indexInfo boolAtIndex:3]; + + if (inDevMode == NO && developerOnly) { + continue; + } + + [index addObject:indexInfo[1]]; + } + + return index; +} + +#pragma mark - + ++ (NSString *)IRCCommandFromIndexKey:(NSString *)key publicSearch:(BOOL)isPublic +{ + NSArray *searchPath = [self.class IRCCommandIndex:isPublic]; + + for (NSArray *indexInfo in searchPath) { + NSString *matchKey = indexInfo[0]; + + if ([matchKey isEqualNoCase:key]) { + return indexInfo[1]; + } + } + + return nil; +} + +#pragma mark - + +NSString *IRCCommandIndex(const char *key) +{ + return IRCPublicCommandIndex(key); +} + +NSString *IRCPrivateCommandIndex(const char *key) +{ + return [TPCPreferences IRCCommandFromIndexKey:[NSString stringWithUTF8String:key] publicSearch:NO]; +} + +NSString *IRCPublicCommandIndex(const char *key) +{ + return [TPCPreferences IRCCommandFromIndexKey:[NSString stringWithUTF8String:key] publicSearch:NO]; +} + +#pragma mark - + ++ (NSInteger)indexOfIRCommand:(NSString *)command +{ + return [self.class indexOfIRCommand:command publicSearch:YES]; +} + ++ (NSInteger)indexOfIRCommand:(NSString *)command publicSearch:(BOOL)isPublic { - /* This needs to be redesigned… */ - commandIndex = [NSMutableDictionary new]; - - commandIndex[IRCCommandIndexAction] = @"27"; - commandIndex[IRCCommandIndexAdchat] = @"89"; - commandIndex[IRCCommandIndexAme] = @"73"; - commandIndex[IRCCommandIndexAmsg] = @"72"; - commandIndex[IRCCommandIndexAuthenticate] = @"101"; - commandIndex[IRCCommandIndexAway] = @"3"; - commandIndex[IRCCommandIndexBan] = @"41"; - commandIndex[IRCCommandIndexCap] = @"102"; - commandIndex[IRCCommandIndexCaps] = @"103"; - commandIndex[IRCCommandIndexCcbadge] = @"104"; - commandIndex[IRCCommandIndexChatops] = @"85"; - commandIndex[IRCCommandIndexClear] = @"42"; - commandIndex[IRCCommandIndexClearall] = @"71"; - commandIndex[IRCCommandIndexClientinfo] = @"31"; - commandIndex[IRCCommandIndexClose] = @"43"; - commandIndex[IRCCommandIndexConn] = @"83"; - commandIndex[IRCCommandIndexCtcp] = @"32"; - commandIndex[IRCCommandIndexCtcpreply] = @"33"; - commandIndex[IRCCommandIndexCycle] = @"44"; - commandIndex[IRCCommandIndexDcc] = @"28"; - commandIndex[IRCCommandIndexDebug] = @"70"; - commandIndex[IRCCommandIndexDehalfop] = @"45"; - commandIndex[IRCCommandIndexDeop] = @"46"; - commandIndex[IRCCommandIndexDevoice] = @"47"; - commandIndex[IRCCommandIndexEcho] = @"69"; - commandIndex[IRCCommandIndexError] = @"4"; - commandIndex[IRCCommandIndexGline] = @"97"; - commandIndex[IRCCommandIndexGlobops] = @"86"; - commandIndex[IRCCommandIndexGzline] = @"98"; - commandIndex[IRCCommandIndexHalfop] = @"48"; - commandIndex[IRCCommandIndexHop] = @"49"; - commandIndex[IRCCommandIndexIcbadge] = @"81"; - commandIndex[IRCCommandIndexIgnore] = @"50"; - commandIndex[IRCCommandIndexInvite] = @"5"; - commandIndex[IRCCommandIndexIson] = @"6"; - commandIndex[IRCCommandIndexJ] = @"51"; - commandIndex[IRCCommandIndexJoin] = @"7"; - commandIndex[IRCCommandIndexKick] = @"8"; - commandIndex[IRCCommandIndexKickban] = @"79"; - commandIndex[IRCCommandIndexKill] = @"9"; - commandIndex[IRCCommandIndexLagcheck] = @"94"; - commandIndex[IRCCommandIndexLeave] = @"52"; - commandIndex[IRCCommandIndexList] = @"10"; - commandIndex[IRCCommandIndexLoadPlugins] = @"91"; - commandIndex[IRCCommandIndexLocops] = @"87"; - commandIndex[IRCCommandIndexM] = @"53"; - commandIndex[IRCCommandIndexMe] = @"54"; - commandIndex[IRCCommandIndexMode] = @"11"; - commandIndex[IRCCommandIndexMsg] = @"55"; - commandIndex[IRCCommandIndexMute] = @"74"; - commandIndex[IRCCommandIndexMylag] = @"95"; - commandIndex[IRCCommandIndexMyversion] = @"84"; - commandIndex[IRCCommandIndexNachat] = @"88"; - commandIndex[IRCCommandIndexNames] = @"12"; - commandIndex[IRCCommandIndexNick] = @"13"; - commandIndex[IRCCommandIndexNncoloreset] = @"105"; - commandIndex[IRCCommandIndexNotice] = @"14"; - commandIndex[IRCCommandIndexOmsg] = @"38"; - commandIndex[IRCCommandIndexOnotice] = @"39"; - commandIndex[IRCCommandIndexOp] = @"56"; - commandIndex[IRCCommandIndexPart] = @"15"; - commandIndex[IRCCommandIndexPass] = @"16"; - commandIndex[IRCCommandIndexPing] = @"17"; - commandIndex[IRCCommandIndexPong] = @"18"; - commandIndex[IRCCommandIndexPrivmsg] = @"19"; - commandIndex[IRCCommandIndexQuery] = @"59"; - commandIndex[IRCCommandIndexQuit] = @"20"; - commandIndex[IRCCommandIndexQuote] = @"60"; - commandIndex[IRCCommandIndexRaw] = @"57"; - commandIndex[IRCCommandIndexRejoin] = @"58"; - commandIndex[IRCCommandIndexRemove] = @"77"; - commandIndex[IRCCommandIndexSend] = @"29"; - commandIndex[IRCCommandIndexServer] = @"82"; - commandIndex[IRCCommandIndexShun] = @"99"; - commandIndex[IRCCommandIndexSme] = @"92"; - commandIndex[IRCCommandIndexSmsg] = @"93"; - commandIndex[IRCCommandIndexSslcontext] = @"106"; - commandIndex[IRCCommandIndexT] = @"61"; - commandIndex[IRCCommandIndexTempshun] = @"100"; - commandIndex[IRCCommandIndexTime] = @"34"; - commandIndex[IRCCommandIndexTimer] = @"62"; - commandIndex[IRCCommandIndexTopic] = @"21"; - commandIndex[IRCCommandIndexUmode] = @"66"; - commandIndex[IRCCommandIndexUnban] = @"64"; - commandIndex[IRCCommandIndexUnignore] = @"65"; - commandIndex[IRCCommandIndexUnloadPlugins] = @"76"; - commandIndex[IRCCommandIndexUnmute] = @"75"; - commandIndex[IRCCommandIndexUser] = @"22"; - commandIndex[IRCCommandIndexUserinfo] = @"35"; - commandIndex[IRCCommandIndexVersion] = @"36"; - commandIndex[IRCCommandIndexVoice] = @"63"; - commandIndex[IRCCommandIndexWallops] = @"80"; - commandIndex[IRCCommandIndexWeights] = @"68"; - commandIndex[IRCCommandIndexWho] = @"23"; - commandIndex[IRCCommandIndexWhois] = @"24"; - commandIndex[IRCCommandIndexWhowas] = @"25"; - commandIndex[IRCCommandIndexZline] = @"96"; -} - -+ (NSInteger)indexOfIRCommand:(NSString *)command -{ - return [commandIndex integerForKey:[command uppercaseString]]; + NSArray *searchPath = [self.class IRCCommandIndex:isPublic]; + + BOOL inDevMode = [_NSUserDefaults() boolForKey:TXDeveloperEnvironmentToken]; + + for (NSArray *indexInfo in searchPath) { + NSString *matValue = indexInfo[1]; + + if (isPublic) { + BOOL developerOnly = [indexInfo boolAtIndex:3]; + + if (inDevMode == NO && developerOnly) { + continue; + } + } + + if ([matValue isEqualNoCase:command]) { + return [indexInfo integerAtIndex:2]; + } + } + + return -1; } #pragma mark - @@ -259,44 +377,44 @@ + (NSString *)_whereApplicationSupportPath + (NSString *)whereApplicationSupportPath { NSString *dest = [[self _whereApplicationSupportPath] stringByAppendingPathComponent:@"/Textual IRC/"]; - + if ([_NSFileManager() fileExistsAtPath:dest] == NO) { [_NSFileManager() createDirectoryAtPath:dest withIntermediateDirectories:YES attributes:nil error:NULL]; } - + return dest; } + (NSString *)whereScriptsPath { NSString *dest = [[self _whereApplicationSupportPath] stringByAppendingPathComponent:@"/Textual IRC/Scripts/"]; - + if ([_NSFileManager() fileExistsAtPath:dest] == NO) { [_NSFileManager() createDirectoryAtPath:dest withIntermediateDirectories:YES attributes:nil error:NULL]; } - + return dest; } + (NSString *)whereThemesPath { NSString *dest = [[self _whereApplicationSupportPath] stringByAppendingPathComponent:@"/Textual IRC/Styles/"]; - + if ([_NSFileManager() fileExistsAtPath:dest] == NO) { [_NSFileManager() createDirectoryAtPath:dest withIntermediateDirectories:YES attributes:nil error:NULL]; } - + return dest; } + (NSString *)wherePluginsPath { NSString *dest = [[self _whereApplicationSupportPath] stringByAppendingPathComponent:@"/Textual IRC/Extensions/"]; - + if ([_NSFileManager() fileExistsAtPath:dest] == NO) { [_NSFileManager() createDirectoryAtPath:dest withIntermediateDirectories:YES attributes:nil error:NULL]; } - + return dest; } @@ -310,32 +428,32 @@ + (NSString *)whereScriptsUnsupervisedPath { if ([TPCPreferences featureAvailableToOSXMountainLion]) { NSString *pathHead = [NSString stringWithFormat:@"/Library/Application Scripts/%@/", [TPCPreferences applicationBundleIdentifier]]; - + return [NSHomeDirectory() stringByAppendingPathComponent:pathHead]; - + /* // This was creating a lot of leaks in Mountain Lion Preview 4. - // Commenting out for now… - - return [_NSFileManager() URLForDirectory:NSApplicationScriptsDirectory - inDomain:NSUserDomainMask - appropriateForURL:nil - create:YES - error:NULL].relativePath; - */ + // Commenting out for now… + + return [_NSFileManager() URLForDirectory:NSApplicationScriptsDirectory + inDomain:NSUserDomainMask + appropriateForURL:nil + create:YES + error:NULL].relativePath; + */ } - + return NSStringEmptyPlaceholder; } #endif + (NSString *)whereThemesLocalPath { - return [[self whereResourcePath] stringByAppendingPathComponent:@"Styles"]; + return [[self whereResourcePath] stringByAppendingPathComponent:@"Styles"]; } + (NSString *)wherePluginsLocalPath { - return [[self whereResourcePath] stringByAppendingPathComponent:@"Extensions"]; + return [[self whereResourcePath] stringByAppendingPathComponent:@"Extensions"]; } + (NSString *)whereAppStoreReceipt @@ -343,7 +461,7 @@ + (NSString *)whereAppStoreReceipt return [[self whereMainApplicationBundle] stringByAppendingPathComponent:@"/Contents/_MASReceipt/receipt"]; } -+ (NSString *)whereResourcePath ++ (NSString *)whereResourcePath { return [[NSBundle mainBundle] resourcePath]; } @@ -362,7 +480,7 @@ + (void)stopUsingTranscriptFolderBookmarkResources { if (NSObjectIsNotEmpty(transcriptFolderResolvedBookmark)) { [transcriptFolderResolvedBookmark stopAccessingSecurityScopedResource]; - + transcriptFolderResolvedBookmark = nil; } } @@ -374,23 +492,23 @@ + (NSString *)transcriptFolder return [transcriptFolderResolvedBookmark path]; } else { NSData *bookmark = [_NSUserDefaults() dataForKey:@"LogTranscriptDestinationSecurityBookmark"]; - + if (NSObjectIsNotEmpty(bookmark)) { NSError *error; - + NSURL *resolvedBookmark = [NSURL URLByResolvingBookmarkData:bookmark options:NSURLBookmarkResolutionWithSecurityScope relativeToURL:nil bookmarkDataIsStale:NO error:&error]; - + if (error) { NSLog(@"Error creating bookmark for URL: %@", error); } else { [resolvedBookmark startAccessingSecurityScopedResource]; - + transcriptFolderResolvedBookmark = resolvedBookmark; - + return [transcriptFolderResolvedBookmark path]; } } @@ -399,7 +517,7 @@ + (NSString *)transcriptFolder return nil; } else { NSString *base = [_NSUserDefaults() objectForKey:@"LogTranscriptDestination"]; - + return [base stringByExpandingTildeInPath]; } } @@ -408,14 +526,14 @@ + (void)setTranscriptFolder:(id)value { // "value" can either be returned as an absolute path on non-sandboxed // versions of Textual or as an NSData object on sandboxed versions. - + if ([self sandboxEnabled]) { if ([TPCPreferences securityScopedBookmarksAvailable] == NO) { return; } - + [self stopUsingTranscriptFolderBookmarkResources]; - + [_NSUserDefaults() setObject:value forKey:@"LogTranscriptDestinationSecurityBookmark"]; } else { [_NSUserDefaults() setObject:value forKey:@"LogTranscriptDestination"]; @@ -428,7 +546,7 @@ + (void)setTranscriptFolder:(id)value + (BOOL)sandboxEnabled { NSString *suffix = [NSString stringWithFormat:@"Containers/%@/Data", [TPCPreferences applicationBundleIdentifier]]; - + return [NSHomeDirectory() hasSuffix:suffix]; } @@ -467,7 +585,7 @@ + (NSString *)defaultRealname return [_NSUserDefaults() objectForKey:@"DefaultIdentity -> Realname"]; } -#pragma mark - +#pragma mark - #pragma mark General Preferences + (NSInteger)autojoinMaxChannelJoins @@ -510,7 +628,7 @@ + (BOOL)invertSidebarColors if (internalMasterController.viewTheme.other.forceInvertSidebarColors) { return YES; } - + return [_NSUserDefaults() boolForKey:@"InvertSidebarColors"]; } @@ -840,7 +958,7 @@ + (NSString *)titleForEvent:(TXNotificationType)event case TXNotificationAddressBookMatchType: return TXTLS(@"TXNotificationAddressBookMatchType"); default: return nil; } - + return nil; } @@ -860,111 +978,111 @@ + (NSString *)keyForEvent:(TXNotificationType)event case TXNotificationAddressBookMatchType: return @"NotificationType -> Address Bok Match"; default: return nil; } - + return nil; } + (NSString *)soundForEvent:(TXNotificationType)event { NSString *okey = [self keyForEvent:event]; - + if (NSObjectIsEmpty(okey)) { return nil; } - + NSString *key = [okey stringByAppendingString:@" -> Sound"]; - + return [_NSUserDefaults() objectForKey:key]; } + (void)setSound:(NSString *)value forEvent:(TXNotificationType)event { NSString *okey = [self keyForEvent:event]; - + if (NSObjectIsEmpty(okey)) { return; } - + NSString *key = [okey stringByAppendingString:@" -> Sound"]; - + [_NSUserDefaults() setObject:value forKey:key]; } + (BOOL)growlEnabledForEvent:(TXNotificationType)event { NSString *okey = [self keyForEvent:event]; - + if (NSObjectIsEmpty(okey)) { return NO; } - + NSString *key = [okey stringByAppendingString:@" -> Enabled"]; - + return [_NSUserDefaults() boolForKey:key]; } + (void)setGrowlEnabled:(BOOL)value forEvent:(TXNotificationType)event { NSString *okey = [self keyForEvent:event]; - + if (NSObjectIsEmpty(okey)) { return; } - + NSString *key = [okey stringByAppendingString:@" -> Enabled"]; - + [_NSUserDefaults() setBool:value forKey:key]; } + (BOOL)growlStickyForEvent:(TXNotificationType)event { NSString *okey = [self keyForEvent:event]; - + if (NSObjectIsEmpty(okey)) { return NO; } - + NSString *key = [okey stringByAppendingString:@" -> Sticky"]; - + return [_NSUserDefaults() boolForKey:key]; } + (void)setGrowlSticky:(BOOL)value forEvent:(TXNotificationType)event { NSString *okey = [self keyForEvent:event]; - + if (NSObjectIsEmpty(okey)) { return; } - + NSString *key = [okey stringByAppendingString:@" -> Sticky"]; - + [_NSUserDefaults() setBool:value forKey:key]; } + (BOOL)disableWhileAwayForEvent:(TXNotificationType)event { NSString *okey = [self keyForEvent:event]; - + if (NSObjectIsEmpty(okey)) { return NO; } - + NSString *key = [okey stringByAppendingString:@" -> Disable While Away"]; - + return [_NSUserDefaults() boolForKey:key]; } + (void)setDisableWhileAway:(BOOL)value forEvent:(TXNotificationType)event { NSString *okey = [self keyForEvent:event]; - + if (NSObjectIsEmpty(okey)) { return; } - + NSString *key = [okey stringByAppendingString:@" -> Disable While Away"]; - + [_NSUserDefaults() setBool:value forKey:key]; } @@ -1007,12 +1125,12 @@ + (void)loadKeywords } else { keywords = [NSMutableArray new]; } - + NSArray *ary = [_NSUserDefaults() objectForKey:@"Highlight List -> Primary Matches"]; - + for (NSDictionary *e in ary) { NSString *s = e[@"string"]; - + if (NSObjectIsNotEmpty(s)) { [keywords safeAddObject:s]; } @@ -1026,12 +1144,12 @@ + (void)loadExcludeWords } else { excludeWords = [NSMutableArray new]; } - + NSArray *ary = [_NSUserDefaults() objectForKey:@"Highlight List -> Excluded Matches"]; - + for (NSDictionary *e in ary) { NSString *s = e[@"string"]; - + if (s) [excludeWords safeAddObject:s]; } } @@ -1039,29 +1157,29 @@ + (void)loadExcludeWords + (void)cleanUpWords:(NSString *)key { NSArray *src = [_NSUserDefaults() objectForKey:key]; - + NSMutableArray *ary = [NSMutableArray array]; - + for (NSDictionary *e in src) { NSString *s = e[@"string"]; - + if (NSObjectIsNotEmpty(s)) { [ary safeAddObject:s]; } } - + [ary sortUsingSelector:@selector(caseInsensitiveCompare:)]; - + NSMutableArray *saveAry = [NSMutableArray array]; - + for (NSString *s in ary) { NSMutableDictionary *dic = [NSMutableDictionary dictionary]; - + dic[@"string"] = s; - + [saveAry safeAddObject:dic]; } - + [_NSUserDefaults() setObject:saveAry forKey:key]; [_NSUserDefaults() synchronize]; } @@ -1097,7 +1215,7 @@ + (NSInteger)totalRunTime { totalRunTime = [_NSUserDefaults() integerForKey:@"TXRunTime"]; totalRunTime += [NSDate secondsSinceUnixTimestamp:startUpTime]; - + return totalRunTime; } @@ -1121,48 +1239,48 @@ + (void)observeValueForKeyPath:(NSString *)key ofObject:(id)object change:(NSDic #pragma mark - #pragma mark Initialization -+ (void)defaultIRCClientSheetCallback:(TLOPopupPromptReturnType)returnCode -{ ++ (void)defaultIRCClientSheetCallback:(TLOPopupPromptReturnType)returnCode +{ if (returnCode == TLOPopupPromptReturnPrimaryType) { NSString *bundleID = [TPCPreferences applicationBundleIdentifier]; - + OSStatus changeResult; - + changeResult = LSSetDefaultHandlerForURLScheme((__bridge CFStringRef)@"irc", (__bridge CFStringRef)(bundleID)); - + changeResult = LSSetDefaultHandlerForURLScheme((__bridge CFStringRef)@"ircs", (__bridge CFStringRef)(bundleID)); - + #pragma unused(changeResult) } } -+ (void)defaultIRCClientPrompt ++ (void)defaultIRCClientPrompt:(BOOL)forced { [NSThread sleepForTimeInterval:1.5]; - + NSURL *baseURL = [NSURL URLWithString:@"irc:"]; - + CFURLRef appURL = NULL; OSStatus status = LSGetApplicationForURL((__bridge CFURLRef)baseURL, kLSRolesAll, NULL, &appURL); - + if (status == noErr) { NSBundle *mainBundle = [NSBundle mainBundle]; NSBundle *baseBundle = [NSBundle bundleWithURL:CFBridgingRelease(appURL)]; - - if ([[baseBundle bundleIdentifier] isNotEqualTo:[mainBundle bundleIdentifier]]) { + + if ([[baseBundle bundleIdentifier] isNotEqualTo:[mainBundle bundleIdentifier]] || forced) { TLOPopupPrompts *prompt = [TLOPopupPrompts new]; - + [prompt sheetWindowWithQuestion:[NSApp keyWindow] target:self action:@selector(defaultIRCClientSheetCallback:) body:TXTLS(@"SetAsDefaultIRCClientPromptMessage") title:TXTLS(@"SetAsDefaultIRCClientPromptTitle") - defaultButton:TXTLS(@"YesButton") - alternateButton:TXTLS(@"NoButton") + defaultButton:TXTLS(@"YesButton") + alternateButton:TXTLS(@"NoButton") otherButton:nil - suppressionKey:@"default_irc_client" + suppressionKey:@"default_irc_client" suppressionText:nil]; } } @@ -1171,24 +1289,24 @@ + (void)defaultIRCClientPrompt + (void)initPreferences { NSInteger numberOfRuns = 0; - + numberOfRuns = [_NSUserDefaults() integerForKey:@"TXRunCount"]; numberOfRuns += 1; - + [_NSUserDefaults() setInteger:numberOfRuns forKey:@"TXRunCount"]; - + #ifndef IS_TRIAL_BINARY if (numberOfRuns >= 2) { - [self.invokeInBackgroundThread defaultIRCClientPrompt]; - } + [self.invokeInBackgroundThread defaultIRCClientPrompt:NO]; + } #endif - + startUpTime = [NSDate epochTime]; - + // ====================================================== // - + NSMutableDictionary *d = [NSMutableDictionary dictionary]; - + [d setBool:YES forKey:@"AutomaticallyAddScrollbackMarker"]; [d setBool:YES forKey:@"ConfirmApplicationQuit"]; [d setBool:YES forKey:@"DisableNotificationsForActiveWindow"]; @@ -1210,27 +1328,27 @@ + (void)initPreferences [d setBool:YES forKey:@"NotificationType -> Highlight -> Enabled"]; [d setBool:YES forKey:@"NotificationType -> Address Bok Match -> Enabled"]; [d setBool:YES forKey:@"NotificationType -> Private Message (New) -> Enabled"]; - + d[@"NotificationType -> Highlight -> Sound"] = @"Glass"; d[@"ScanForIRCopAlertInServerNoticesMatch"] = @"ircop alert"; - + d[@"DefaultIdentity -> Nickname"] = @"Guest"; d[@"DefaultIdentity -> Username"] = @"textual"; d[@"DefaultIdentity -> Realname"] = @"Textual User"; - + d[@"IRCopDefaultLocalizaiton -> Shun Reason"] = TXTLS(@"ShunReason"); d[@"IRCopDefaultLocalizaiton -> Kill Reason"] = TXTLS(@"KillReason"); d[@"IRCopDefaultLocalizaiton -> G:Line Reason"] = TXTLS(@"GlineReason"); - + d[@"Theme -> Name"] = TXDefaultTextualLogStyle; d[@"Theme -> Font Name"] = TXDefaultTextualLogFont; d[@"Theme -> Nickname Format"] = TXLogLineUndefinedNicknameFormat; d[@"Theme -> Timestamp Format"] = TXDefaultTextualTimestampFormat; - + d[@"LogTranscriptDestination"] = @"~/Documents/Textual Logs"; - + d[@"ChannelOperatorDefaultLocalization -> Kick Reasone"] = TXTLS(@"KickReason"); - + [d setInteger:2 forKey:@"AutojoinMaximumChannelJoinCount"]; [d setInteger:300 forKey:@"ScrollbackMaximumLineCount"]; [d setInteger:300 forKey:@"InlineMediaScalingWidth"]; @@ -1240,63 +1358,63 @@ + (void)initPreferences [d setInteger:TXHostmaskBanWHAINNFormat forKey:@"DefaultBanCommandHostmaskFormat"]; [d setInteger:TXNoticeSendServerConsoleType forKey:@"DestinationOfNonserverNotices"]; [d setInteger:TXUserDoubleClickQueryAction forKey:@"UserListDoubleClickAction"]; - + [d setDouble:0.05 forKey:@"LogViewMessageQueueLoopDelay -> Console"]; [d setDouble:0.07 forKey:@"LogViewMessageQueueLoopDelay -> Channel"]; [d setDouble:12.0 forKey:@"Theme -> Font Size"]; [d setDouble:1.0 forKey:@"MainWindowTransparencyLevel"]; - + // ====================================================== // - + [TPCPreferencesMigrationAssistant convertExistingGlobalPreferences]; - + [_NSUserDefaults() registerDefaults:d]; - + [_NSUserDefaults() addObserver:(id)self forKeyPath:@"Highlight List -> Primary Matches" options:NSKeyValueObservingOptionNew context:NULL]; [_NSUserDefaults() addObserver:(id)self forKeyPath:@"Highlight List -> Excluded Matches" options:NSKeyValueObservingOptionNew context:NULL]; - + systemVersionPlist = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/ServerVersion.plist"]; - + if (NSObjectIsEmpty(systemVersionPlist)) { systemVersionPlist = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]; } - + if (NSObjectIsEmpty(systemVersionPlist)) { exit(10); } - + [self loadKeywords]; [self loadExcludeWords]; [self populateCommandIndex]; - + /* Sandbox Check */ - + [_NSUserDefaults() setBool:[TPCPreferences sandboxEnabled] forKey:@"Security -> Sandbox Enabled"]; [_NSUserDefaults() setBool:[TPCPreferences securityScopedBookmarksAvailable] forKey:@"Security -> Scoped Bookmarks Available"]; - + /* Font Check */ - + if ([NSFont fontIsAvailable:[TPCPreferences themeChannelViewFontName]] == NO) { [_NSUserDefaults() setObject:TXDefaultTextualLogFont forKey:@"Theme -> Font Name"]; } - + /* Theme Check */ - + NSString *themeName = [TPCViewTheme extractThemeName:[TPCPreferences themeName]]; NSString *themePath; - + themePath = [TPCPreferences whereThemesPath]; themePath = [themePath stringByAppendingPathComponent:themeName]; - + if ([_NSFileManager() fileExistsAtPath:themePath] == NO) { themePath = [TPCPreferences whereThemesLocalPath]; themePath = [themePath stringByAppendingPathComponent:themeName]; - + if ([_NSFileManager() fileExistsAtPath:themePath] == NO) { [_NSUserDefaults() setObject:TXDefaultTextualLogStyle forKey:@"Theme -> Name"]; } else { NSString *newName = [NSString stringWithFormat:@"resource:%@", themeName]; - + [_NSUserDefaults() setObject:newName forKey:@"Theme -> Name"]; } } diff --git a/Classes/Views/Channel View/TVCLogController.m b/Classes/Views/Channel View/TVCLogController.m index edd5b23867..7635c29f19 100755 --- a/Classes/Views/Channel View/TVCLogController.m +++ b/Classes/Views/Channel View/TVCLogController.m @@ -816,12 +816,12 @@ - (BOOL)print:(TVCLogLine *)line withHTML:(BOOL)rawHTML if (type == TVCLogLineActionType) { if ([nicknameBody hasSuffix:@":"]) { - messageBody = [NSString stringWithFormat:@"• %@ %@", nicknameBody, line.body]; + messageBody = [NSString stringWithFormat:TXNotificationHighlightLogAlternativeActionFormat, nicknameBody, line.body]; } else { - messageBody = [NSString stringWithFormat:@"• %@: %@", nicknameBody, line.body]; + messageBody = [NSString stringWithFormat:TXNotificationHighlightLogStandardActionFormat, nicknameBody, line.body]; } } else { - messageBody = [NSString stringWithFormat:@"%@ %@", nicknameBody, line.body]; + messageBody = [NSString stringWithFormat:TXNotificationHighlightLogStandardMessageFormat, nicknameBody, line.body]; } [self.world addHighlightInChannel:self.channel withMessage:messageBody]; diff --git a/Classes/Views/Channel View/TVCLogPolicy.m b/Classes/Views/Channel View/TVCLogPolicy.m index 8748e1cec8..d5b8e43533 100755 --- a/Classes/Views/Channel View/TVCLogPolicy.m +++ b/Classes/Views/Channel View/TVCLogPolicy.m @@ -38,7 +38,7 @@ #import "TextualApplication.h" #define _WebMenuItemTagInspectElement 2024 -#define _WebMenuItemTagIRCopServices 42354 +#define _WebMenuItemTagIRCopServices 42354 @implementation TVCLogPolicy diff --git a/Main Project (Textual).xcodeproj/project.pbxproj b/Main Project (Textual).xcodeproj/project.pbxproj index ddd9d44b18..1077a00518 100644 --- a/Main Project (Textual).xcodeproj/project.pbxproj +++ b/Main Project (Textual).xcodeproj/project.pbxproj @@ -2443,7 +2443,6 @@ GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO; GCC_WARN_UNINITIALIZED_AUTOS = YES; @@ -2496,7 +2495,6 @@ GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO; GCC_WARN_UNINITIALIZED_AUTOS = YES; @@ -2583,7 +2581,6 @@ GCC_PREPROCESSOR_DEFINITIONS = "TEXTUAL_SANDBOX_DISABLED=1"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO; GCC_WARN_UNINITIALIZED_AUTOS = YES; @@ -2654,7 +2651,6 @@ GCC_PREPROCESSOR_DEFINITIONS = "IS_TRIAL_BINARY=1"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO; GCC_WARN_UNINITIALIZED_AUTOS = YES; @@ -2725,7 +2721,6 @@ GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO; GCC_WARN_UNINITIALIZED_AUTOS = YES; diff --git a/Resources/Info.plist b/Resources/Info.plist index 840f3de68b..23fd413def 100755 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -47,8 +47,8 @@ TXBundleBuildCodeName Turtle Soup TXBundleBuildNumber - 11874 + 11907 TXBundleBuildReference - 2.1.1-241-gf8f6fdd-appstore,llvm4.0 + 2.1.1-242-gfc85b73-debug,llvm4.0 diff --git a/Resources/Localization/English.lproj/BasicLanguage.strings b/Resources/Localization/English.lproj/BasicLanguage.strings index 40ba6a29d4..5216e237de 100644 --- a/Resources/Localization/English.lproj/BasicLanguage.strings +++ b/Resources/Localization/English.lproj/BasicLanguage.strings @@ -160,7 +160,7 @@ "LagCheckRequestReplyRating_06" = "Slow."; "LagCheckRequestReplyRating_07" = "Very Slow."; "LagCheckRequestReplyRating_08" = "Dang! Call your ISP."; -"LagCheckRequestReplyRating_09" = "You Fail! (www.youfail.org)"; +"LagCheckRequestReplyRating_09" = "You Fail! (www.youfail.org)"; "ListDialogHasChannels" = "%i Public Channels"; "ListDialogHasSearchResults" = "%1$i Public Channels - %2$i Search Results"; diff --git a/Resources/Plugins/Blowfish Key Control/Blowfish Key Control Extension.xcodeproj/project.pbxproj b/Resources/Plugins/Blowfish Key Control/Blowfish Key Control Extension.xcodeproj/project.pbxproj index a63bb240fd..2923623b63 100755 --- a/Resources/Plugins/Blowfish Key Control/Blowfish Key Control Extension.xcodeproj/project.pbxproj +++ b/Resources/Plugins/Blowfish Key Control/Blowfish Key Control Extension.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 4C8AF6EA158E99F40026668C /* PLWeakCompatibilityStubs.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C8AF6E9158E99F40026668C /* PLWeakCompatibilityStubs.m */; }; 4CEE0DD112E09A1900C5096E /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CEE0DD012E09A1900C5096E /* Cocoa.framework */; }; 4CEE0E8912E09A9800C5096E /* TPI_BlowfishCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEE0E8812E09A9800C5096E /* TPI_BlowfishCommands.m */; }; /* End PBXBuildFile section */ @@ -15,7 +14,6 @@ /* Begin PBXFileReference section */ 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 4C88849E158EB9B400747ABB /* PLWeakCompatibilityStubs.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PLWeakCompatibilityStubs.m; sourceTree = ""; }; - 4C8AF6E9158E99F40026668C /* PLWeakCompatibilityStubs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PLWeakCompatibilityStubs.m; path = "../External Libraries/ARC Weak Refrences/PLWeakCompatibilityStubs.m"; sourceTree = ""; }; 4CEE0DD012E09A1900C5096E /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 4CEE0E8712E09A9800C5096E /* TPI_BlowfishCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPI_BlowfishCommands.h; sourceTree = ""; }; 4CEE0E8812E09A9800C5096E /* TPI_BlowfishCommands.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TPI_BlowfishCommands.m; sourceTree = ""; }; @@ -66,7 +64,6 @@ isa = PBXGroup; children = ( 4C888499158EB9B400747ABB /* ARC Weak Refrences */, - 4C828A8A15811352007C7D92 /* PLWeakCompatibility */, 4CEE0E8712E09A9800C5096E /* TPI_BlowfishCommands.h */, 4CEE0E8812E09A9800C5096E /* TPI_BlowfishCommands.m */, ); @@ -90,15 +87,6 @@ name = "System Frameworks"; sourceTree = ""; }; - 4C828A8A15811352007C7D92 /* PLWeakCompatibility */ = { - isa = PBXGroup; - children = ( - 4C8AF6E9158E99F40026668C /* PLWeakCompatibilityStubs.m */, - ); - name = PLWeakCompatibility; - path = ../../../Classes/Library/PLWeakCompatibility; - sourceTree = ""; - }; 4C888499158EB9B400747ABB /* ARC Weak Refrences */ = { isa = PBXGroup; children = ( @@ -161,7 +149,6 @@ buildActionMask = 2147483647; files = ( 4CEE0E8912E09A9800C5096E /* TPI_BlowfishCommands.m in Sources */, - 4C8AF6EA158E99F40026668C /* PLWeakCompatibilityStubs.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Resources/Styles/Astria/copyright.txt b/Resources/Styles/Astria/copyright.txt index c1bed8d091..e45caaa726 100755 --- a/Resources/Styles/Astria/copyright.txt +++ b/Resources/Styles/Astria/copyright.txt @@ -1 +1 @@ -Copyright © 2010, 2011, 2012 Alexander S¿rlie. \ No newline at end of file +Copyright © 2010, 2011, 2012 Alexander Sørlie. \ No newline at end of file