/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is the Instantbird messenging client, released
 * 2007.
 *
 * The Initial Developer of the Original Code is
 * Florian QUEZE <florian@instantbird.org>.
 * Portions created by the Initial Developer are Copyright (C) 2007
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#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;
  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 PR_TRUE if the separator should be found starting at
     the end of the string, PR_FALSE otherwise. */
  readonly attribute boolean reverse;
};
