chat/components/public/imIAccountsService.idl
author Philipp Kewisch <mozilla@kewis.ch>
Sun, 14 Jan 2018 13:03:57 +0100
changeset 58730 07e9ccb0dc2714f6f387efec1ccddc83fd4a5fb4
parent 22915 f81a23bfefcd0f6ec6215fbde12f8af2bc7749f1
child 98246 fdba1f075412ace9f7b4fb41ed10383e3e3ba0ab
permissions -rw-r--r--
Bug 1429452 - Add Persian language to Thunderbird nightly build. r=tomprince MozReview-Commit-ID: DD7O9R2yAl3

/* 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 "nsISimpleEnumerator.idl"
#include "imIAccount.idl"

[scriptable, uuid(b3b6459a-5c26-47b8-8e9c-ba838b6f632a)]
interface imIAccountsService: nsISupports {
  void initAccounts();
  void unInitAccounts();

  /* This attribute is set to AUTOLOGIN_ENABLED by default. It can be set to
     any other value before the initialization of this service to prevent
     accounts with autoLogin enabled from being connected when libpurple is
     initialized.
     Any value other than the ones listed below will disable autoLogin and
     display a generic message in the Account Manager. */
  attribute short autoLoginStatus;

  const short AUTOLOGIN_ENABLED = 0;
  const short AUTOLOGIN_USER_DISABLED = 1;
  const short AUTOLOGIN_SAFE_MODE = 2;
  const short AUTOLOGIN_CRASH = 3;
  const short AUTOLOGIN_START_OFFLINE = 4;

  /* The method should be used to connect all accounts with autoLogin enabled.
     Some use cases:
       - if the autologin was disabled at startup
       - after a loss of internet connectivity that disconnected all accounts.
  */
  void processAutoLogin();

  imIAccount getAccountById(in AUTF8String aAccountId);

  /* will throw NS_ERROR_FAILURE if not found */
  imIAccount getAccountByNumericId(in unsigned long aAccountId);

  nsISimpleEnumerator getAccounts();

  /* will fire the event account-added */
  imIAccount createAccount(in AUTF8String aName, in AUTF8String aPrpl);

  /* will fire the event account-removed */
  void deleteAccount(in AUTF8String aAccountId);
};

/*
 account related notifications sent to nsIObserverService:
   - account-added: a new account has been created
   - account-removed: the account has been deleted
   - account-connecting: the account is being connected
   - account-connected: the account is now connected
   - account-connect-error: the account is disconnect with an error.
     (before account-disconnecting)
   - account-disconnecting: the account is being disconnected
   - account-disconnected: the account is now disconnected
   - account-updated: when some settings have changed
   - account-list-updated: when the list of account is reordered.
   These events can be watched using an nsIObserver.
   The associated imIAccount will be given as a parameter
   (except for account-list-updated).
*/