diff options
Diffstat (limited to '')
-rw-r--r-- | comm/chat/components/public/imILogger.idl | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/comm/chat/components/public/imILogger.idl b/comm/chat/components/public/imILogger.idl new file mode 100644 index 0000000000..fd8e632d5d --- /dev/null +++ b/comm/chat/components/public/imILogger.idl @@ -0,0 +1,86 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" +#include "nsIFile.idl" + +interface imIAccount; +interface prplIAccountBuddy; +interface imIBuddy; +interface imIContact; +interface imIMessage; +interface prplIConversation; + +[scriptable, uuid(7771402c-ff55-41f5-86b4-59b93f9b0693)] +interface imILogConversation: nsISupports { + readonly attribute AUTF8String title; + readonly attribute AUTF8String name; + // Value in microseconds. + readonly attribute PRTime startDate; + + // Simplified account implementation: + // - alias will always be empty + // - name (always the normalizedName) + // - statusInfo will return IMServices.core.globalUserStatus + // - protocol will only contain a "name" attribute, with the prpl's normalized name. + // Other methods/attributes aren't implemented. + readonly attribute imIAccount account; + + readonly attribute boolean isChat; // always false (compatibility with prplIConversation). + readonly attribute prplIAccountBuddy buddy; // always null (compatibility with prplIConvIM). + + Array<imIMessage> getMessages(); +}; + +[scriptable, uuid(27712ece-ad2c-4504-87d5-9e2c16d40fef)] +interface imILog: nsISupports { + readonly attribute AUTF8String path; + // Value in seconds. + readonly attribute PRTime time; + readonly attribute AUTF8String format; + // Returns a promise that resolves to an imILogConversation instance, or null + // if the log format isn't JSON. + jsval getConversation(); +}; + +[scriptable, function, uuid(2ab5f8ac-4b89-4954-9a4a-7c167f1e3b0d)] +interface imIProcessLogsCallback: nsISupports { + // The callback can return a promise. If it does, then it will not be called + // on the next log until this promise resolves. If it throws (or rejects), + // iteration will stop. + jsval processLog(in AUTF8String aLogPath); +}; + +[scriptable, uuid(7e2476dc-8199-4454-9661-b78ee73fa49e)] +interface imILogger: nsISupports { + // Returns a promise that resolves to an imILog instance. + jsval getLogFromFile(in AUTF8String aFilePath, [optional] in boolean aGroupByDay); + // Returns a promise that resolves to the log file paths if a log writer + // exists for the conversation, or null otherwise. The promise resolves + // after any pending I/O operations on the files complete. + jsval getLogPathsForConversation(in prplIConversation aConversation); + + // Below methods return promises that resolve to {imILog[]}. + + // Get logs for a contact. + jsval getLogsForContact(in imIContact aContact); + // Get logs for a conversation. + jsval getLogsForConversation(in prplIConversation aConversation); + // Get logs that are from the same conversation. + jsval getSimilarLogs(in imILog aLog); + + // Asynchronously iterates through log folders for all prpls and accounts and + // invokes the callback on every log file. Returns a promise that resolves when + // iteration is complete. If the callback returns a promise, iteration pauses + // until the promise resolves. If the callback throws (or rejects), iteration + // will stop and the returned promise will reject with the same error. + jsval forEach(in imIProcessLogsCallback aCallback); + + // Returns the folder storing all logs for aAccount. + AUTF8String getLogFolderPathForAccount(in imIAccount aAccount); + + // Removes the folder storing all logs for aAccount. + // Be sure the account is disconnected before using this. + jsval deleteLogFolderForAccount(in imIAccount aAccount); +}; |