Prevent sending 0-byte files. Fixes #8711.
[adiumx.git] / Source / AILoggerPlugin.h
blobdbf0fd21946b043f3a8859facd70ab1411c3c722
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.
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.
17 #import <Adium/AIPlugin.h>
19 #define PATH_LOGS @"/Logs"
20 #define LOGGING_DEFAULT_PREFS @"LoggingDefaults"
22 #define PREF_GROUP_LOGGING @"Logging"
23 #define KEY_LOGGER_ENABLE @"Enable Logging"
25 #define PREF_KEYPATH_LOGGER_ENABLE PREF_GROUP_LOGGING @"." KEY_LOGGER_ENABLE
27 #define XML_LOGGING_NAMESPACE @"http://purl.org/net/ulf/ns/0.4-02"
29 @class AIAccount, AIHTMLDecoder, AIChat, AILoggerPreferences;
31 @interface AILoggerPlugin : AIPlugin {
32 AILoggerPreferences *preferences;
34 //Current logging settings
35 BOOL observingContent;
36 BOOL logHTML;
38 NSMutableDictionary *activeAppenders;
39 NSMutableDictionary *appenderCloseTimers;
41 AIHTMLDecoder *xhtmlDecoder;
42 NSDictionary *statusTranslation;
44 //Log viewer menu items
45 NSMenuItem *logViewerMenuItem;
46 NSMenuItem *viewContactLogsMenuItem;
47 NSMenuItem *viewContactLogsContextMenuItem;
49 //Log content search index
50 BOOL logIndexingEnabled; //Does this system use log indexing?
51 SKIndexRef index_Content;
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 NSLock *indexingThreadLock; //Locked by the plugin when a dirty all or clean thread is running
58 //Locked by the plugin while the index is being modified
59 NSConditionLock *logWritingLock;
61 //Array of dirty logs / Logs that need re-indexing. (Locked access)
62 NSMutableArray *dirtyLogArray;
63 NSLock *dirtyLogLock;
65 //Indexing progress
66 int logsToIndex;
67 int logsIndexed;
68 int logIndexingPauses;
72 //Paths
73 + (NSString *)logBasePath;
74 + (NSString *)relativePathForLogWithObject:(NSString *)object onAccount:(AIAccount *)account;
75 + (NSString *)fileNameForLogWithObject:(NSString *)object onDate:(NSDate *)date;
77 //Message History
78 + (NSArray *)sortedArrayOfLogFilesForChat:(AIChat *)chat;
80 //Log viewer
81 - (void)showLogViewerToSelectedContact:(id)sender;
82 - (void)showLogViewerToSelectedContextContact:(id)sender;
84 //Log indexing
85 - (void)initLogIndexing;
86 - (void)prepareLogContentSearching;
87 - (void)cleanUpLogContentSearching;
88 - (SKIndexRef)logContentIndex;
89 - (void)markLogDirtyAtPath:(NSString *)path forChat:(AIChat *)chat;
90 - (void)markLogDirtyAtPath:(NSString *)path;
91 - (BOOL)getIndexingProgress:(int *)complete outOf:(int *)total;
94 - (void)stopIndexingThreads;
95 - (void)dirtyAllLogs;
96 - (void)cleanDirtyLogs;
97 - (void)pauseIndexing;
98 - (void)resumeIndexing;
100 - (void)removePathsFromIndex:(NSSet *)paths;
102 @end