| 1 | /* |
---|
| 2 | * Adium is the legal property of its developers, whose names are listed in the copyright file included |
---|
| 3 | * with this source distribution. |
---|
| 4 | * |
---|
| 5 | * This program is free software; you can redistribute it and/or modify it under the terms of the GNU |
---|
| 6 | * General Public License as published by the Free Software Foundation; either version 2 of the License, |
---|
| 7 | * or (at your option) any later version. |
---|
| 8 | * |
---|
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
---|
| 10 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
| 11 | * Public License for more details. |
---|
| 12 | * |
---|
| 13 | * You should have received a copy of the GNU General Public License along with this program; if not, |
---|
| 14 | * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 15 | */ |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | #define PATH_LOGS @"/Logs" |
---|
| 19 | #define LOGGING_DEFAULT_PREFS @"LoggingDefaults" |
---|
| 20 | |
---|
| 21 | #define PREF_GROUP_LOGGING @"Logging" |
---|
| 22 | #define KEY_LOGGER_ENABLE @"Enable Logging" |
---|
| 23 | |
---|
| 24 | #define PREF_KEYPATH_LOGGER_ENABLE PREF_GROUP_LOGGING @"." KEY_LOGGER_ENABLE |
---|
| 25 | |
---|
| 26 | #define XML_LOGGING_NAMESPACE @"http://purl.org/net/ulf/ns/0.4-02" |
---|
| 27 | |
---|
| 28 | @class AIAccount, AIHTMLDecoder, AIChat, AILoggerPreferences; |
---|
| 29 | |
---|
| 30 | @interface AILoggerPlugin : AIPlugin { |
---|
| 31 | AILoggerPreferences *preferences; |
---|
| 32 | |
---|
| 33 | //Current logging settings |
---|
| 34 | BOOL observingContent; |
---|
| 35 | BOOL logHTML; |
---|
| 36 | |
---|
| 37 | NSMutableDictionary *activeAppenders; |
---|
| 38 | NSMutableDictionary *appenderCloseTimers; |
---|
| 39 | |
---|
| 40 | AIHTMLDecoder *xhtmlDecoder; |
---|
| 41 | NSDictionary *statusTranslation; |
---|
| 42 | |
---|
| 43 | //Log viewer menu items |
---|
| 44 | NSMenuItem *logViewerMenuItem; |
---|
| 45 | NSMenuItem *viewContactLogsMenuItem; |
---|
| 46 | NSMenuItem *viewContactLogsContextMenuItem; |
---|
| 47 | NSMenuItem *viewGroupLogsContextMenuItem; |
---|
| 48 | |
---|
| 49 | //Log content search index |
---|
| 50 | BOOL logIndexingEnabled; //Does this system use log indexing? |
---|
| 51 | SKIndexRef index_Content; |
---|
| 52 | |
---|
| 53 | //Dirty all information (First build of the dirty cache) |
---|
| 54 | BOOL stopIndexingThreads; //Set to YES to abort a dirty all or clean |
---|
| 55 | BOOL suspendDirtyArraySave; //YES to prevent saving of the dirty index |
---|
| 56 | BOOL isFlushingIndex; |
---|
| 57 | NSLock *indexingThreadLock; //Locked by the plugin when a dirty all or clean thread is running |
---|
| 58 | |
---|
| 59 | //Locked by the plugin while the index is being modified |
---|
| 60 | NSConditionLock *logWritingLock; |
---|
| 61 | //Locked by the plugin while the index is being closed |
---|
| 62 | NSConditionLock *logClosingLock; |
---|
| 63 | |
---|
| 64 | //Array of dirty logs / Logs that need re-indexing. (Locked access) |
---|
| 65 | NSMutableArray *dirtyLogArray; |
---|
| 66 | NSLock *dirtyLogLock; |
---|
| 67 | |
---|
| 68 | //Indexing progress |
---|
| 69 | NSInteger logsToIndex; |
---|
| 70 | NSInteger logsIndexed; |
---|
| 71 | NSInteger logIndexingPauses; |
---|
| 72 | |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | //Paths |
---|
| 76 | + (NSString *)logBasePath; |
---|
| 77 | + (NSString *)relativePathForLogWithObject:(NSString *)object onAccount:(AIAccount *)account; |
---|
| 78 | |
---|
| 79 | //Message History |
---|
| 80 | + (NSArray *)sortedArrayOfLogFilesForChat:(AIChat *)chat; |
---|
| 81 | |
---|
| 82 | //Log viewer |
---|
| 83 | - (void)showLogViewerAndReindex:(id)sender; |
---|
| 84 | - (void)showLogViewerToSelectedContact:(id)sender; |
---|
| 85 | - (void)showLogViewerToSelectedContextContact:(id)sender; |
---|
| 86 | |
---|
| 87 | //Log indexing |
---|
| 88 | - (void)initLogIndexing; |
---|
| 89 | - (void)prepareLogContentSearching; |
---|
| 90 | - (void)cleanUpLogContentSearching; |
---|
| 91 | - (SKIndexRef)logContentIndex; |
---|
| 92 | - (void)markLogDirtyAtPath:(NSString *)path forChat:(AIChat *)chat; |
---|
| 93 | - (void)markLogDirtyAtPath:(NSString *)path; |
---|
| 94 | - (BOOL)getIndexingProgress:(NSUInteger *)complete outOf:(NSUInteger *)total; |
---|
| 95 | |
---|
| 96 | - (void)stopIndexingThreads; |
---|
| 97 | - (void)dirtyAllLogs; |
---|
| 98 | - (void)cleanDirtyLogs; |
---|
| 99 | - (void)pauseIndexing; |
---|
| 100 | - (void)resumeIndexing; |
---|
| 101 | |
---|
| 102 | - (void)removePathsFromIndex:(NSSet *)paths; |
---|
| 103 | |
---|
| 104 | @end |
---|
| 105 | |
---|