author alta88
Tue, 29 Sep 2015 14:23:07 -0600
changeset 18469 3ddf3a3eaf07d5e6c1a98bfbe184dab32841ed03
parent 18136 afc53c36ca1f5a08aa37b9320b3e5bbacae764e4
child 21000 b0e38b2324c339f3e765ab8f63acabf10cbaaa73
permissions -rw-r--r--
Bug 1202150 - Silence compiler warnings in nsMsgDBView and friends, part 6 final stragglers. r=rkent a=aleth,IanN SM CLOSED TREE

/* 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 */

#include "nsISupports.idl"
#include "nsISimpleEnumerator.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 Services.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).

  void getMessages([optional] out unsigned long messageCount,
                   [retval, array, size_is(messageCount)] out imIMessage messages);

  // Callers that process the messages asynchronously should use the enumerator
  // instead of the array version of the getMessages* methods to avoid paying
  // up front the cost of xpconnect wrapping all message objects.
  nsISimpleEnumerator getMessagesEnumerator([optional] out unsigned long messageCount);

[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 nsISimpleEnumerator instances.

  // Get logs for a username that may not be in the contact list.
  jsval getLogsForAccountAndName(in imIAccount aAccount,
                                 in AUTF8String aNormalizedName,
                                 [optional] in boolean aGroupByDay);

  jsval getLogsForAccountBuddy(in prplIAccountBuddy aAccountBuddy,
                               [optional] in boolean aGroupByDay);
  jsval getLogsForBuddy(in imIBuddy aBuddy,
                        [optional] in boolean aGroupByDay);
  jsval getLogsForContact(in imIContact aContact,
                          [optional] in boolean aGroupByDay);

  jsval getLogsForConversation(in prplIConversation aConversation,
                               [optional] in boolean aGroupByDay);
  jsval getSystemLogsForAccount(in imIAccount aAccount);
  jsval getSimilarLogs(in imILog aLog,
                       [optional] in boolean aGroupByDay);

  // 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);