/* 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 "nsIRunnable.idl"
#include "prplIConversation.idl"

/*
 * An action that the user may perform in relation to a particular message.
 */
[scriptable, uuid(7e470f0e-d948-4d9a-b8dc-4beecf6554b9)]
interface prplIMessageAction: nsIRunnable
{
  /* The protocol plugins need to provide a localized label suitable
     for being shown in the user interface (for example as a context
     menu item). */
  readonly attribute AUTF8String label;
};

[scriptable, uuid(d6accb66-cdd2-4a91-8854-1156e65d5a43)]
interface prplIMessage: nsISupports {
  /* The uniqueness of the message id is only guaranteed across
     messages of a conversation, not across all messages created
     during the execution of the application. */
  readonly attribute unsigned long id;
  readonly attribute AUTF8String who;
  readonly attribute AUTF8String alias;
  readonly attribute AUTF8String originalMessage;
           attribute AUTF8String message;
  readonly attribute AUTF8String iconURL;
  // Value in seconds.
  readonly attribute PRTime time;
  readonly attribute prplIConversation conversation;

  /*  PURPLE_MESSAGE_SEND        = 0x0001, /**< Outgoing message. */
  readonly attribute boolean outgoing;
  /*  PURPLE_MESSAGE_RECV        = 0x0002, /**< Incoming message. */
  readonly attribute boolean incoming;
  /*  PURPLE_MESSAGE_SYSTEM      = 0x0004, /**< System message.   */
  readonly attribute boolean system;
  /*  PURPLE_MESSAGE_AUTO_RESP   = 0x0008, /**< Auto response.    */
  readonly attribute boolean autoResponse;
  /*  PURPLE_MESSAGE_ACTIVE_ONLY = 0x0010, /**< Hint to the UI that this
                                                message should not be
                                                shown in conversations
                                                which are only open for
                                                internal UI purposes
                                                (e.g. for contact-aware
                                                 conversions).           */
  /*  PURPLE_MESSAGE_NICK        = 0x0020, /**< Contains your nick.      */
  readonly attribute boolean containsNick;
  /*  PURPLE_MESSAGE_NO_LOG      = 0x0040, /**< Do not log.              */
  readonly attribute boolean noLog;
  /*  PURPLE_MESSAGE_ERROR       = 0x0200, /**< Error message.           */
  readonly attribute boolean error;
  /*  PURPLE_MESSAGE_DELAYED     = 0x0400, /**< Delayed message.         */
  readonly attribute boolean delayed;
  /*  PURPLE_MESSAGE_RAW         = 0x0800, /**< "Raw" message - don't
                                                apply formatting         */
  readonly attribute boolean noFormat;
  /*  PURPLE_MESSAGE_IMAGES      = 0x1000, /**< Message contains images  */
  readonly attribute boolean containsImages;
  /*  PURPLE_MESSAGE_NOTIFY      = 0x2000, /**< Message is a notification */
  readonly attribute boolean notification;
  /*  PURPLE_MESSAGE_NO_LINKIFY  = 0x4000  /**< Message should not be auto-linkified */
  readonly attribute boolean noLinkification;

  /* An array of actions the user may perform on this message.
     The first action will be the 'default' and may be performed
     automatically when the message is double clicked.
     'Reply' is usually a good default action. */
  void getActions([optional] out unsigned long actionCount,
                  [retval, array, size_is(actionCount)] out prplIMessageAction actions);
};
