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 | #import <Adium/AIPlugin.h> |
---|
18 | |
---|
19 | #define PATH_LOGS @"/Logs" |
---|
20 | #define LOGGING_DEFAULT_PREFS @"LoggingDefaults" |
---|
21 | |
---|
22 | #define PREF_GROUP_LOGGING @"Logging" |
---|
23 | #define KEY_LOGGER_ENABLE @"Enable Logging" |
---|
24 | |
---|
25 | #define PREF_KEYPATH_LOGGER_ENABLE PREF_GROUP_LOGGING @"." KEY_LOGGER_ENABLE |
---|
26 | |
---|
27 | #define XML_LOGGING_NAMESPACE @"http://purl.org/net/ulf/ns/0.4-02" |
---|
28 | |
---|
29 | @class AIAccount, AIHTMLDecoder, AIChat, AILoggerPreferences; |
---|
30 | |
---|
31 | @interface AILoggerPlugin : AIPlugin { |
---|
32 | AILoggerPreferences *preferences; |
---|
33 | |
---|
34 | //Current logging settings |
---|
35 | BOOL observingContent; |
---|
36 | BOOL logHTML; |
---|
37 | |
---|
38 | NSMutableDictionary *activeAppenders; |
---|
39 | NSMutableDictionary *appenderCloseTimers; |
---|
40 | |
---|
41 | AIHTMLDecoder *xhtmlDecoder; |
---|
42 | NSDictionary *statusTranslation; |
---|
43 | |
---|
44 | //Log viewer menu items |
---|
45 | NSMenuItem *logViewerMenuItem; |
---|
46 | NSMenuItem *viewContactLogsMenuItem; |
---|
47 | NSMenuItem *viewContactLogsContextMenuItem; |
---|
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 | int logsToIndex; |
---|
70 | int logsIndexed; |
---|
71 | int 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)showLogViewerToSelectedContact:(id)sender; |
---|
84 | - (void)showLogViewerToSelectedContextContact:(id)sender; |
---|
85 | |
---|
86 | //Log indexing |
---|
87 | - (void)initLogIndexing; |
---|
88 | - (void)prepareLogContentSearching; |
---|
89 | - (void)cleanUpLogContentSearching; |
---|
90 | - (SKIndexRef)logContentIndex; |
---|
91 | - (void)markLogDirtyAtPath:(NSString *)path forChat:(AIChat *)chat; |
---|
92 | - (void)markLogDirtyAtPath:(NSString *)path; |
---|
93 | - (BOOL)getIndexingProgress:(int *)complete outOf:(int *)total; |
---|
94 | |
---|
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 | |
---|