aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol/event
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2012-07-12 17:00:53 +0000
committerYana Stamcheva <yana@jitsi.org>2012-07-12 17:00:53 +0000
commit2a5e9c4895f6e04c15645c5898a9ab7537b8ffb2 (patch)
tree62756bba2293d47b2ddab54a02b63147751050dd /src/net/java/sip/communicator/service/protocol/event
parent99a732d5f448270181b48edcae7960854052939b (diff)
downloadjitsi-2a5e9c4895f6e04c15645c5898a9ab7537b8ffb2.zip
jitsi-2a5e9c4895f6e04c15645c5898a9ab7537b8ffb2.tar.gz
jitsi-2a5e9c4895f6e04c15645c5898a9ab7537b8ffb2.tar.bz2
Adds last message correction functionality. Implementation provided by Ivan Vergiliev.
Diffstat (limited to 'src/net/java/sip/communicator/service/protocol/event')
-rw-r--r--src/net/java/sip/communicator/service/protocol/event/MessageDeliveredEvent.java43
-rw-r--r--src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java33
-rw-r--r--src/net/java/sip/communicator/service/protocol/event/MessageReceivedEvent.java39
3 files changed, 113 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/service/protocol/event/MessageDeliveredEvent.java b/src/net/java/sip/communicator/service/protocol/event/MessageDeliveredEvent.java
index 0ffc91b..17a6e0a 100644
--- a/src/net/java/sip/communicator/service/protocol/event/MessageDeliveredEvent.java
+++ b/src/net/java/sip/communicator/service/protocol/event/MessageDeliveredEvent.java
@@ -33,6 +33,12 @@ public class MessageDeliveredEvent
* A timestamp indicating the exact date when the event occurred.
*/
private final long timestamp;
+
+ /**
+ * The ID of the message being corrected, or null if this was a new message
+ * and not a message correction.
+ */
+ private String correctedMessageUID;
/**
* Constructor.
@@ -44,6 +50,21 @@ public class MessageDeliveredEvent
{
this(source, to, System.currentTimeMillis());
}
+
+ /**
+ * Creates a <tt>MessageDeliveredEvent</tt> representing delivery of the
+ * <tt>source</tt> message to the specified <tt>to</tt> contact.
+ *
+ * @param source the <tt>Message</tt> whose delivery this event represents.
+ * @param to the <tt>Contact</tt> that this message was sent to.
+ * @param correctedMessageUID The ID of the message being corrected.
+ */
+ public MessageDeliveredEvent(Message source, Contact to,
+ String correctedMessageUID)
+ {
+ this(source, to, System.currentTimeMillis());
+ this.correctedMessageUID = correctedMessageUID;
+ }
/**
* Creates a <tt>MessageDeliveredEvent</tt> representing delivery of the
@@ -93,4 +114,26 @@ public class MessageDeliveredEvent
return timestamp;
}
+ /**
+ * Returns the ID of the message being corrected, or null if this was a
+ * new message and not a message correction.
+ *
+ * @return the ID of the message being corrected, or null if this was a
+ * new message and not a message correction.
+ */
+ public String getCorrectedMessageUID()
+ {
+ return correctedMessageUID;
+ }
+
+ /**
+ * Sets the ID of the message being corrected to the passed ID.
+ *
+ * @param correctedMessageUID The ID of the message being corrected.
+ */
+ public void setCorrectedMessageUID(String correctedMessageUID)
+ {
+ this.correctedMessageUID = correctedMessageUID;
+ }
+
}
diff --git a/src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java b/src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java
index cba4101..e0f60a3 100644
--- a/src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java
+++ b/src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java
@@ -75,6 +75,12 @@ public class MessageDeliveryFailedEvent
private final long timestamp;
/**
+ * The ID of the message being corrected, or null if this was a new message
+ * and not a message correction.
+ */
+ private String correctedMessageUID;
+
+ /**
* Constructor.
*
* @param source the message
@@ -87,6 +93,23 @@ public class MessageDeliveryFailedEvent
{
this(source, to, errorCode, System.currentTimeMillis(), null);
}
+
+ /**
+ * Constructor.
+ *
+ * @param source the message
+ * @param to the "to" contact
+ * @param correctedMessageUID The ID of the message being corrected.
+ * @param errorCode error code
+ */
+ public MessageDeliveryFailedEvent(Message source,
+ Contact to,
+ String correctedMessageUID,
+ int errorCode)
+ {
+ this(source, to, errorCode, System.currentTimeMillis(), null);
+ this.correctedMessageUID = correctedMessageUID;
+ }
/**
* Creates a <tt>MessageDeliveryFailedEvent</tt> indicating failure of
@@ -190,4 +213,14 @@ public class MessageDeliveryFailedEvent
{
return reasonPhrase;
}
+
+ /**
+ * Sets the ID of the message being corrected to the passed ID.
+ *
+ * @param correctedMessageUID The ID of the message being corrected.
+ */
+ public String getCorrectedMessageUID()
+ {
+ return correctedMessageUID;
+ }
}
diff --git a/src/net/java/sip/communicator/service/protocol/event/MessageReceivedEvent.java b/src/net/java/sip/communicator/service/protocol/event/MessageReceivedEvent.java
index 959101b..cd15cf6 100644
--- a/src/net/java/sip/communicator/service/protocol/event/MessageReceivedEvent.java
+++ b/src/net/java/sip/communicator/service/protocol/event/MessageReceivedEvent.java
@@ -55,6 +55,12 @@ public class MessageReceivedEvent
* The type of message event that this instance represents.
*/
private int eventType = -1;
+
+ /**
+ * The ID of the message being corrected, or null if this is a new message
+ * and not a correction.
+ */
+ private String correctedMessageUID = null;
/**
* Creates a <tt>MessageReceivedEvent</tt> representing reception of the
@@ -77,6 +83,23 @@ public class MessageReceivedEvent
*
* @param source the <tt>Message</tt> whose reception this event represents.
* @param from the <tt>Contact</tt> that has sent this message.
+ * @param timestamp the exact date when the event ocurred.
+ */
+ public MessageReceivedEvent(Message source, Contact from,
+ String correctedMessageUID)
+ {
+ this(source, from, System.currentTimeMillis(),
+ CONVERSATION_MESSAGE_RECEIVED);
+ this.correctedMessageUID = correctedMessageUID;
+ }
+
+ /**
+ * Creates a <tt>MessageReceivedEvent</tt> representing reception of the
+ * <tt>source</tt> message received from the specified <tt>from</tt>
+ * contact.
+ *
+ * @param source the <tt>Message</tt> whose reception this event represents.
+ * @param from the <tt>Contact</tt> that has sent this message.
* @param timestamp the exact date when the event occurred.
* @param eventType the type of message event that this instance represents
* (one of the XXX_MESSAGE_RECEIVED static fields).
@@ -92,10 +115,10 @@ public class MessageReceivedEvent
}
/**
- * Returns a reference to the <tt>Contact</tt> that has send the
+ * Returns a reference to the <tt>Contact</tt> that has sent the
* <tt>Message</tt> whose reception this event represents.
*
- * @return a reference to the <tt>Contact</tt> that has send the
+ * @return a reference to the <tt>Contact</tt> that has sent the
* <tt>Message</tt> whose reception this event represents.
*/
public Contact getSourceContact()
@@ -135,4 +158,16 @@ public class MessageReceivedEvent
{
return eventType;
}
+
+ /**
+ * Returns the correctedMessageUID The ID of the message being corrected,
+ * or null if this is a new message and not a correction.
+ *
+ * @return the correctedMessageUID The ID of the message being corrected,
+ * or null if this is a new message and not a correction.
+ */
+ public String getCorrectedMessageUID()
+ {
+ return correctedMessageUID;
+ }
}