summaryrefslogtreecommitdiffstats
path: root/comm/chat/components/public/prplIMessage.idl
blob: 610c6a477ddb9032db69948621ab34672016ca4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* 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;
  /**
   * An ID for this message provided by the protocol. Used for finding the
   * message in the conversation for actions like editing. This is expected to
   * be absolute per conversation, meaning if two prplIMessages in the same
   * conversation have identical |remoteId|s they refer to the same message in
   * the conversation as far as the protocol is concerned.
   */
  readonly attribute AUTF8String remoteId;
  /** The name of the message sender. */
  readonly attribute AUTF8String who;
  /** The alias of the message sender (frequently the same as who). */
  readonly attribute AUTF8String alias;
  /** The original message, if it was modified, e.g. via OTR. */
  readonly attribute AUTF8String originalMessage;
  /** The message that will be sent over the wire. */
           attribute AUTF8String message;
  /** An icon to associate with the message sender. */
  readonly attribute AUTF8String iconURL;
  /** The time the message was sent, in seconds. */
  readonly attribute PRTime time;
  /** The conversation the message was sent to. */
  readonly attribute prplIConversation conversation;

  /** Outgoing message. */
  readonly attribute boolean outgoing;
  /** Incoming message. */
  readonly attribute boolean incoming;
  /** System message, i.e. a message from the server or client (not from another user). */
  readonly attribute boolean system;
  /** Auto response. */
  readonly attribute boolean autoResponse;
  /** Contains your nick, e.g. if you were pinged. */
  readonly attribute boolean containsNick;
  /** This message should not be logged. */
  readonly attribute boolean noLog;
  /** Error message. */
  readonly attribute boolean error;
  /** Delayed message, e.g. it was received from a queue of historical messages on the server. */
  readonly attribute boolean delayed;
  /** "Raw" message - don't apply formatting. */
  readonly attribute boolean noFormat;
  /** Message contains images. */
  readonly attribute boolean containsImages;
  /** Message is a notification. */
  readonly attribute boolean notification;
  /** Message should not be auto-linkified. */
  readonly attribute boolean noLinkification;
  /** Do not collapse the message. */
  readonly attribute boolean noCollapse;
  /** Message is encrypted. */
  readonly attribute boolean isEncrypted;
  /** The message should be displayed as an action/emote. */
  readonly attribute boolean action;
  /** Message was deleted, this is a placeholder for it */
  readonly attribute boolean deleted;

  /**
   * Get an array of actions the user may perform on this message.
   *
   * @returns prplIMessageAction[]
   */
  Array<prplIMessageAction> getActions();

  /**
   * Called when the message is first displayed to the user. Only invoked for
   * the latest message in a conversation.
   */
  void whenDisplayed();

  /**
   * Called when the message has been read by the user, as defined by it being
   * above the unread marker in the conversation. Only called for the message
   * immediately above the marker.
   */
  void whenRead();
};