chat/components/public/imIAccountsService.idl
author alta88
Tue, 29 Sep 2015 14:23:07 -0600
changeset 18469 3ddf3a3eaf07d5e6c1a98bfbe184dab32841ed03
parent 15599 f81a23bfefcd0f6ec6215fbde12f8af2bc7749f1
child 31677 0039bbdb02808a79e7622ea62e006d14db307178
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 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).
*/