/* 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(7d302db0-3813-4c51-8372-c7eb5fc9f3d3)]
interface prplIProtocol: nsISupports {
  // aId is the prpl id, this method is used so that classes
  // implementing several protocol plugins can know which protocol is
  // desired for this instance.
  void init(in AUTF8String aId);

  readonly attribute AUTF8String name;
  readonly attribute AUTF8String id;
  // A name that can be used to check for duplicates and is the basis
  // for the directory name for log storage.
  readonly attribute AUTF8String normalizedName;

  // returns a chrome URI pointing to a folder that contains the files:
  // icon.png icon32.png and icon48.png
  readonly attribute AUTF8String iconBaseURI;

  // returns an enumerator of prplIPref
  nsISimpleEnumerator getOptions();

  // returns an enumerator of prplIUsernameSplit
  nsISimpleEnumerator getUsernameSplit();

  // descriptive text to put in the username input box when it is empty
  readonly attribute AUTF8String usernameEmptyText;

  // Use this function to avoid attempting to create duplicate accounts
  boolean accountExists(in AUTF8String aName);

  // These should all be stuff that some plugins can do and others can't.

  // OPT_PROTO_UNIQUE_CHATNAME Use a unique name, not an alias, for
  // chat rooms.
  //  XMPP lets you choose what name you want for chat. So it
  //  shouldn't be pulling the alias for when you're in chat; it gets
  //  annoying.
  readonly attribute boolean uniqueChatName;

  // OPT_PROTO_CHAT_TOPIC Chat rooms have topics.
  //  IRC and XMPP support this.
  readonly attribute boolean chatHasTopic;

  // OPT_PROTO_NO_PASSWORD Don't require passwords for sign-in.
  //  Zephyr doesn't require passwords, so there's no need for a
  //  password prompt.
  readonly attribute boolean noPassword;

  // OPT_PROTO_MAIL_CHECK Notify on new mail.
  //  MSN and Yahoo notify you when you have new mail.
  readonly attribute boolean newMailNotification;

  // OPT_PROTO_IM_IMAGE Images in IMs.
  //  Oscar lets you send images in direct IMs.
  readonly attribute boolean imagesInIM;

  // OPT_PROTO_PASSWORD_OPTIONAL Allow passwords to be optional.
  //  Passwords in IRC are optional, and are needed for certain
  //  functionality.
  readonly attribute boolean passwordOptional;

  // OPT_PROTO_USE_POINTSIZE Allows font size to be specified in sane
  // point size.
  //  Probably just XMPP and Y!M
  readonly attribute boolean usePointSize;

  // OPT_PROTO_REGISTER_NOSCREENNAME Set the Register button active
  // when screenname is not given.
  //  Gadu-Gadu doesn't need a screenname to register new account.
  readonly attribute boolean registerNoScreenName;

  // OPT_PROTO_SLASH_COMMANDS_NATIVE  Indicates that slash commands
  // are native to this protocol.
  // Used as a hint that unknown commands should not be sent as messages.
  readonly attribute boolean slashCommandsNative;

  // Indicates if the protocol plugin can use a purpleIProxy for the
  // account, or uses the Mozilla proxy settings for all accounts.
  readonly attribute boolean usePurpleProxy;

  // Get the protocol specific part of an already initialized
  // imIAccount instance.
  prplIAccount getAccount(in imIAccount aImAccount);
};

[scriptable, uuid(20c4971a-f7c2-4781-8e85-69fee7b83a3d)]
interface prplIUsernameSplit: nsISupports {
  readonly attribute AUTF8String label;
  readonly attribute AUTF8String defaultValue;
  readonly attribute char separator;

  /* reverse is true if the separator should be found starting at
     the end of the string, false otherwise. */
  readonly attribute boolean reverse;
};
