aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/sip/communicator/service/protocol')
-rw-r--r--src/net/java/sip/communicator/service/protocol/NotificationMessage.java103
-rw-r--r--src/net/java/sip/communicator/service/protocol/event/MessageWaitingEvent.java47
2 files changed, 150 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/service/protocol/NotificationMessage.java b/src/net/java/sip/communicator/service/protocol/NotificationMessage.java
new file mode 100644
index 0000000..6078f82
--- /dev/null
+++ b/src/net/java/sip/communicator/service/protocol/NotificationMessage.java
@@ -0,0 +1,103 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.protocol;
+
+/**
+ * A notification message that is used to deliver notifications for an waiting
+ * server message.
+ *
+ * @see MessageWaitingListener, MessageWaitingEvent
+ *
+ * @author Yana Stamcheva
+ */
+public class NotificationMessage
+{
+ /**
+ * The contact from which the message is coming.
+ */
+ private final String fromContact;
+
+ /**
+ * The name of the group of messages to which this message belongs,
+ * if there's any.
+ */
+ private final String messageGroup;
+
+ /**
+ * Additional details related to the message.
+ */
+ private final String messageDetails;
+
+ /**
+ * The text of the message.
+ */
+ private final String messageText;
+
+ /**
+ * Creates an instance of <tt>NotificationMessage</tt> by specifying the
+ * name of the contact from which the message is, the message group, any
+ * additional details and the message actual text.
+ *
+ * @param fromContact the contact from which the message is coming
+ * @param messageGroup the name of the group of messages to which this
+ * message belongs
+ * @param messageDetails additional details related to the message
+ * @param messageText the text of the message
+ */
+ public NotificationMessage( String fromContact,
+ String messageGroup,
+ String messageDetails,
+ String messageText)
+ {
+ this.fromContact = fromContact;
+ this.messageGroup = messageGroup;
+ this.messageDetails = messageDetails;
+ this.messageText = messageText;
+ }
+
+ /**
+ * Returns the contact from which the message is coming
+ *
+ * @return the contact from which the message is coming
+ */
+ public String getFromContact()
+ {
+ return fromContact;
+ }
+
+ /**
+ * Returns the name of the group of messages to which this
+ * message belongs.
+ *
+ * @return the name of the group of messages to which this
+ * message belongs
+ */
+ public String getMessageGroup()
+ {
+ return messageGroup;
+ }
+
+ /**
+ * Returns the additional details related to the message
+ *
+ * @return the additional details related to the message
+ */
+ public String getMessageDetails()
+ {
+ return messageDetails;
+ }
+
+ /**
+ * Returns the text of the message
+ *
+ * @return the text of the message
+ */
+ public String getMessageText()
+ {
+ return messageText;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/protocol/event/MessageWaitingEvent.java b/src/net/java/sip/communicator/service/protocol/event/MessageWaitingEvent.java
index b705cec..6ba8fd5 100644
--- a/src/net/java/sip/communicator/service/protocol/event/MessageWaitingEvent.java
+++ b/src/net/java/sip/communicator/service/protocol/event/MessageWaitingEvent.java
@@ -56,6 +56,11 @@ public class MessageWaitingEvent
private OperationSetMessageWaiting.MessageType messageType;
/**
+ * The list of notification messages concerned by this event.
+ */
+ private List<NotificationMessage> messageList;
+
+ /**
* Constructs the Event with the given source, typically the provider and
* number of messages.
*
@@ -76,6 +81,39 @@ public class MessageWaitingEvent
int unreadUrgentMessages,
int readUrgentMessages)
{
+ this( source,
+ messageType,
+ account,
+ unreadMessages,
+ readMessages,
+ unreadUrgentMessages,
+ readUrgentMessages,
+ null);
+ }
+
+ /**
+ * Constructs the Event with the given source, typically the provider and
+ * number of messages.
+ *
+ * @param messageType the message type for this event.
+ * @param source the protocol provider from which this event is coming.
+ * @param account the account URI we can use to reach the messages.
+ * @param unreadMessages the unread messages.
+ * @param readMessages the read messages.
+ * @param unreadUrgentMessages the unread urgent messages.
+ * @param readUrgentMessages the read urgent messages.
+ * @param messages the list of messages that this event is about.
+ */
+ public MessageWaitingEvent(
+ ProtocolProviderService source,
+ OperationSetMessageWaiting.MessageType messageType,
+ String account,
+ int unreadMessages,
+ int readMessages,
+ int unreadUrgentMessages,
+ int readUrgentMessages,
+ List<NotificationMessage> messages)
+ {
super(source);
this.messageType = messageType;
@@ -84,6 +122,7 @@ public class MessageWaitingEvent
this.readMessages = readMessages;
this.unreadUrgentMessages = unreadUrgentMessages;
this.readUrgentMessages = readUrgentMessages;
+ this.messageList = messages;
}
/**
@@ -150,4 +189,12 @@ public class MessageWaitingEvent
{
return messageType;
}
+
+ public Iterator<NotificationMessage> getMessages()
+ {
+ if (messageList != null)
+ return messageList.iterator();
+
+ return null;
+ }
}