Changeset 2662
- Timestamp:
- 05/07/05 14:01:47 (3 years ago)
- Files:
-
- trunk/Colloquy.pch (modified) (1 diff)
- trunk/Colloquy.xcode/project.pbxproj (modified) (4 diffs)
- trunk/JVChatTranscript.h (modified) (1 diff)
- trunk/JVChatTranscript.m (modified) (4 diffs)
- trunk/JVChatTranscriptBrowserPanel.m (modified) (6 diffs)
- trunk/Languages/English.lproj/Colloquy.nib/classes.nib (modified) (1 diff)
- trunk/Languages/English.lproj/Colloquy.nib/info.nib (modified) (2 diffs)
- trunk/Languages/English.lproj/Colloquy.nib/keyedobjects.nib (modified) (previous)
- trunk/Languages/English.lproj/JVChatTranscriptBrowserPanel.nib (added)
- trunk/Languages/English.lproj/JVChatTranscriptBrowserPanel.nib/classes.nib (added)
- trunk/Languages/English.lproj/JVChatTranscriptBrowserPanel.nib/info.nib (added)
- trunk/Languages/English.lproj/JVChatTranscriptBrowserPanel.nib/keyedobjects.nib (added)
- trunk/MVApplicationController.h (modified) (3 diffs)
- trunk/MVApplicationController.m (modified) (5 diffs)
- trunk/Resources/cc.javelin.colloquy.plist (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Colloquy.pch
r2656 r2662 15 15 16 16 #endif 17 18 #ifdef MAC_OS_X_VERSION_10_4 19 #include <sys/xattr.h> 20 #endif 21 22 // define these here so they weak link for Panther letting the binary be backwards compatible 23 extern int fsetxattr(int fd, const char *name, const void *value, size_t size, u_int32_t position, int options) __attribute__((weak_import)); 24 extern ssize_t fgetxattr(int fd, const char *name, void *value, size_t size, u_int32_t position, int options) __attribute__((weak_import)); trunk/Colloquy.xcode/project.pbxproj
r2661 r2662 1080 1080 sourceTree = "<group>"; 1081 1081 }; 1082 1C3972DD082D30D200DCF3CF = {1083 fileRef = 1C3972DB082D30D200DCF3CF;1084 isa = PBXBuildFile;1085 settings = {1086 };1087 };1088 1082 1C3972DE082D30D200DCF3CF = { 1089 1083 fileRef = 1C3972DC082D30D200DCF3CF; 1084 isa = PBXBuildFile; 1085 settings = { 1086 }; 1087 }; 1088 1C397368082D3ED000DCF3CF = { 1089 children = ( 1090 1C397369082D3ED000DCF3CF, 1091 ); 1092 isa = PBXVariantGroup; 1093 name = JVChatTranscriptBrowserPanel.nib; 1094 path = ""; 1095 refType = 4; 1096 sourceTree = "<group>"; 1097 }; 1098 1C397369082D3ED000DCF3CF = { 1099 isa = PBXFileReference; 1100 lastKnownFileType = wrapper.nib; 1101 name = English; 1102 path = Languages/English.lproj/JVChatTranscriptBrowserPanel.nib; 1103 refType = 4; 1104 sourceTree = "<group>"; 1105 }; 1106 1C39736A082D3ED000DCF3CF = { 1107 fileRef = 1C397368082D3ED000DCF3CF; 1090 1108 isa = PBXBuildFile; 1091 1109 settings = { … … 2523 2541 0AA8117B0826E08000A3BF2D, 2524 2542 1C05F4560828727D006FCB72, 2543 1C39736A082D3ED000DCF3CF, 2525 2544 ); 2526 2545 isa = PBXResourcesBuildPhase; … … 3195 3214 1CB2CD86052DDC560094AAA4, 3196 3215 1CF5F8DD07D537F70019DC13, 3197 1C3972DD082D30D200DCF3CF,3198 3216 ); 3199 3217 isa = PBXCopyFilesBuildPhase; … … 5583 5601 1CBECE3A0508D58F000001C8, 5584 5602 1CBECE380508D58F000001C8, 5603 1C397368082D3ED000DCF3CF, 5585 5604 1C0A4C980799BDAF0093B702, 5586 5605 1C0A4C9A0799BDAF0093B702, trunk/JVChatTranscript.h
r2629 r2662 3 3 @class JVChatEvent; 4 4 @class JVChatSession; 5 6 extern NSString *JVChatTranscriptUpdatedNotification; 5 7 6 8 @protocol JVChatTranscriptElement trunk/JVChatTranscript.m
r2629 r2662 12 12 #import <libxml/xinclude.h> 13 13 14 #ifdef MAC_OS_X_VERSION_10_4 15 #include <sys/xattr.h> 16 #endif 17 18 // define this here so they weak link for Panther letting the binary will load 19 extern int fsetxattr(int fd, const char *name, const void *value, size_t size, u_int32_t position, int options) __attribute__((weak_import)); 14 NSString *JVChatTranscriptUpdatedNotification = @"JVChatTranscriptUpdatedNotification"; 20 15 21 16 #pragma mark - … … 946 941 [self _changeFileAttributesAtPath:path]; 947 942 943 [[NSNotificationCenter defaultCenter] postNotificationName:JVChatTranscriptUpdatedNotification object:self]; 944 948 945 return ret; 949 946 } … … 963 960 [xmlData release]; 964 961 965 if( [url isFileURL] ) [self _changeFileAttributesAtPath:[url path]]; 962 if( [url isFileURL] ) { 963 [self _changeFileAttributesAtPath:[url path]]; 964 [[NSNotificationCenter defaultCenter] postNotificationName:JVChatTranscriptUpdatedNotification object:self]; 965 } 966 966 } 967 967 … … 1138 1138 [_logFile writeData:[@"</log>" dataUsingEncoding:NSUTF8StringEncoding]]; 1139 1139 1140 [[NSNotificationCenter defaultCenter] postNotificationName:JVChatTranscriptUpdatedNotification object:self]; 1141 1140 1142 xmlBufferFree( buf ); 1141 1143 } trunk/JVChatTranscriptBrowserPanel.m
r2661 r2662 28 28 -(NSString *)indexPath 29 29 { 30 return [[ self logsPath] stringByAppendingPathComponent:@"LogsIndex"];30 return [[@"~/Library/Application Support/Colloquy" stringByExpandingTildeInPath] stringByAppendingPathComponent:@"Transcript Search Index"]; 31 31 } 32 32 33 33 -(NSString *)dirtyPath 34 34 { 35 return [[ self logsPath] stringByAppendingPathComponent:@"Dirty Logs"];35 return [[@"~/Library/Application Support/Colloquy" stringByExpandingTildeInPath] stringByAppendingPathComponent:@"Dirty Transcripts"]; 36 36 } 37 37 … … 96 96 97 97 #ifdef MAC_OS_X_VERSION_10_4 98 if (NSAppKitVersionNumber > NSAppKitVersionNumber10_3_5) 99 { 98 if( floor( NSAppKitVersionNumber ) == NSAppKitVersionNumber10_3 ) { 100 99 FILE* logsFile = fopen([path fileSystemRepresentation],"r"); 101 100 if (logsFile) … … 106 105 ssize_t size; 107 106 108 if ((size=fgetxattr(fd,"server",buffer,1023,0, NULL))>0)107 if ((size=fgetxattr(fd,"server",buffer,1023,0,0))>0) 109 108 { 110 109 buffer[size]=0; … … 112 111 } 113 112 114 if ((size=fgetxattr(fd,"target",buffer,1023,0, NULL))>0)113 if ((size=fgetxattr(fd,"target",buffer,1023,0,0))>0) 115 114 { 116 115 buffer[size]=0; … … 118 117 } 119 118 120 if ((size=fgetxattr(fd,"dateBegan",buffer,1023,0, NULL))>0)119 if ((size=fgetxattr(fd,"dateBegan",buffer,1023,0,0))>0) 121 120 { 122 121 buffer[size]=0; … … 274 273 CFRange resultRange = CFRangeMake(0, resultCount); 275 274 276 //Read the results in LOG_RESULT_CLUMP_SIZE at a time277 275 SKSearchResultsGetInfoInRange(results,resultRange,outDocumentsArray,NULL,outScoresArray); 278 276 int i; trunk/Languages/English.lproj/Colloquy.nib/classes.nib
r2609 r2662 43 43 showConnectionManager = id; 44 44 showPreferences = id; 45 showTranscriptBrowser = id; 45 46 showTransferManager = id; 46 47 }; trunk/Languages/English.lproj/Colloquy.nib/info.nib
r2595 r2662 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string> 38 66 356 240 0 0 1024 746</string>6 <string>245 320 356 240 0 0 1280 832 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> 9 9 <key>29</key> 10 <string> 21 533 383 44 0 0 1024 746</string>10 <string>68 774 383 44 0 0 1280 832 </string> 11 11 </dict> 12 12 <key>IBFramework Version</key> … … 14 14 <key>IBOldestOS</key> 15 15 <integer>3</integer> 16 <key>IBOpenObjects</key> 17 <array> 18 <integer>29</integer> 19 </array> 16 20 <key>IBSystem Version</key> 17 21 <string>8A428</string> trunk/MVApplicationController.h
r2602 r2662 1 1 extern NSString *JVChatStyleInstalledNotification; 2 2 extern NSString *JVChatEmoticonSetInstalledNotification; 3 extern NSString *JVMachineBecameIdleNotification; 4 extern NSString *JVMachineStoppedIdlingNotification; 3 5 4 @interface MVApplicationController : NSObject {} 6 @class JVChatTranscriptBrowserPanel; 7 8 @interface MVApplicationController : NSObject { 9 io_registry_entry_t _hidEntry; 10 NSTimer *_idleCheck; 11 NSTimeInterval _lastIdle; 12 BOOL _isIdle; 13 } 14 5 15 - (IBAction) checkForUpdate:(id) sender; 6 16 - (IBAction) connectToSupportRoom:(id) sender; … … 10 20 - (IBAction) showPreferences:(id) sender; 11 21 - (IBAction) showTransferManager:(id) sender; 22 - (IBAction) showTranscriptBrowser:(id) sender; 12 23 - (IBAction) showConnectionManager:(id) sender; 13 24 - (IBAction) showBuddyList:(id) sender; … … 18 29 19 30 + (BOOL) isTerminating; 31 32 - (NSTimeInterval) idleTime; 20 33 @end 21 34 trunk/MVApplicationController.m
r2655 r2662 27 27 #import "JVGetCommand.h" 28 28 #import "JVDirectChatPanel.h" 29 #import "JVChatTranscriptBrowserPanel.h" 29 30 30 31 #import <Foundation/NSDebug.h> … … 38 39 NSString *JVChatStyleInstalledNotification = @"JVChatStyleInstalledNotification"; 39 40 NSString *JVChatEmoticonSetInstalledNotification = @"JVChatEmoticonSetInstalledNotification"; 41 NSString *JVMachineBecameIdleNotification = @"JVMachineBecameIdleNotification"; 42 NSString *JVMachineStoppedIdlingNotification = @"JVMachineStoppedIdlingNotification"; 43 40 44 static BOOL applicationIsTerminating = NO; 41 45 42 46 @implementation MVApplicationController 47 - (id) init { 48 if( ( self = [super init] ) ) { 49 mach_port_t masterPort = 0; 50 kern_return_t err = IOMasterPort( MACH_PORT_NULL, &masterPort ); 51 52 io_iterator_t hidIter = 0; 53 err = IOServiceGetMatchingServices( masterPort, IOServiceMatching( "IOHIDSystem" ), &hidIter ); 54 55 _hidEntry = IOIteratorNext( hidIter ); 56 IOObjectRelease( hidIter ); 57 58 _isIdle = NO; 59 _lastIdle = 0.; 60 _idleCheck = [[NSTimer scheduledTimerWithTimeInterval:30. target:self selector:@selector( checkIdle: ) userInfo:nil repeats:YES] retain]; 61 } 62 63 return self; 64 } 65 66 - (void) dealloc { 67 if( _hidEntry ) { 68 IOObjectRelease( _hidEntry ); 69 _hidEntry = nil; 70 } 71 72 [super dealloc]; 73 } 74 75 #pragma mark - 76 43 77 + (BOOL) isTerminating { 44 78 extern BOOL applicationIsTerminating; 45 79 return applicationIsTerminating; 80 } 81 82 #pragma mark - 83 84 // idle stuff adapted from a post by Jonathan 'Wolf' Rentzsch on the cocoa-dev mailing list. 85 86 - (NSTimeInterval) idleTime { 87 NSMutableDictionary *hidProperties = nil; 88 kern_return_t err = IORegistryEntryCreateCFProperties( _hidEntry, (CFMutableDictionaryRef *) &hidProperties, kCFAllocatorDefault, 0 ); 89 90 id hidIdleTimeObj = [hidProperties objectForKey:@"HIDIdleTime"]; 91 unsigned long long result; 92 93 if( [hidIdleTimeObj isKindOfClass:[NSData class]] ) [hidIdleTimeObj getBytes:&result]; 94 else result = [hidIdleTimeObj longLongValue]; 95 96 [hidProperties release]; 97 98 return ( result / 1000000000. ); 99 } 100 101 - (void) checkIdle:(id) sender { 102 NSTimeInterval idle = [self idleTime]; 103 104 if( _isIdle ) { 105 if( idle < _lastIdle ) { 106 // no longer idle 107 108 _isIdle = NO; 109 [[NSNotificationCenter defaultCenter] postNotificationName:JVMachineStoppedIdlingNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithDouble:idle] forKey:@"idleTime"]]; 110 111 // reschedule the timer, to check for idle every 30 seconds 112 [_idleCheck invalidate]; 113 [_idleCheck autorelease]; 114 115 _idleCheck = [[NSTimer scheduledTimerWithTimeInterval:30. target:self selector:@selector( checkIdle: ) userInfo:nil repeats:YES] retain]; 116 } 117 } else { 118 if( idle > [[NSUserDefaults standardUserDefaults] integerForKey:@"JVIdleTime"] ) { 119 // we're now idle 120 121 _isIdle = YES; 122 [[NSNotificationCenter defaultCenter] postNotificationName:JVMachineBecameIdleNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithDouble:idle] forKey:@"idleTime"]]; 123 124 // reschedule the timer, we will check every second to catch the user's return quickly 125 [_idleCheck invalidate]; 126 [_idleCheck autorelease]; 127 128 _idleCheck = [[NSTimer scheduledTimerWithTimeInterval:1. target:self selector:@selector( checkIdle: ) userInfo:nil repeats:YES] retain]; 129 } 130 } 131 132 _lastIdle = idle; 46 133 } 47 134 … … 86 173 [[MVConnectionsController defaultController] hideConnectionManager:nil]; 87 174 else [[MVConnectionsController defaultController] showConnectionManager:nil]; 175 } 176 177 - (IBAction) showTranscriptBrowser:(id) sender { 178 [[JVChatTranscriptBrowserPanel sharedBrowser] showBrowser:self]; 88 179 } 89 180 … … 347 438 [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[[NSBundle mainBundle] bundleIdentifier] ofType:@"plist"]]]; 348 439 [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector( handleURLEvent:withReplyEvent: ) forEventClass:kInternetEventClass andEventID:kAEGetURL]; 349 350 440 #ifdef DEBUG 351 441 NSDebugEnabled = YES; … … 396 486 [MVFileTransferController defaultController]; 397 487 [MVBuddyListController sharedBuddyList]; 488 [JVChatTranscriptBrowserPanel sharedBrowser]; 398 489 399 490 [[[[[[NSApplication sharedApplication] mainMenu] itemAtIndex:1] submenu] itemWithTag:20] setSubmenu:[MVConnectionsController favoritesMenu]]; trunk/Resources/cc.javelin.colloquy.plist
r2435 r2662 67 67 <key>MVChatNaturalActions</key> 68 68 <false/> 69 <key>JVIdleTime</key> 70 <integer>300</integer> 69 71 <key>JVChatServers</key> 70 72 <array>
