author Florian Quèze <>
Sun, 12 Jan 2014 19:15:20 +0100
changeset 22915 f81a23bfefcd0f6ec6215fbde12f8af2bc7749f1
parent 22288 e2835df49f17e90118906b03388084d743f54d50
parent 12009 84ac3c71109811da751f0ef2d72108075938f094
child 98246 fdba1f075412ace9f7b4fb41ed10383e3e3ba0ab
permissions -rw-r--r--
Bug 956609 - Land the IM front-end in comm-central, r=florian.

/* 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 "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
     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).