summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Young <consult.awy@gmail.com>2015-02-13 13:02:32 (GMT)
committerAlan Young <consult.awy@gmail.com>2015-04-10 06:52:20 (GMT)
commitf78677be53af975b22fadaad92eafd43abc18f1d (patch)
tree1aa06ecbe3b8abec26addfc41514922d1d3b8c07
parent7d2101b93b6253c3ea15b663f7f3dc385cb21364 (diff)
downloadstroke-f78677be53af975b22fadaad92eafd43abc18f1d.zip
stroke-f78677be53af975b22fadaad92eafd43abc18f1d.tar.bz2
Changes to support MUCController first cut
Change-Id: I5ae22fee5a68a7a5d3575a576fb6eb490487c171
-rw-r--r--src/com/isode/stroke/elements/Message.java10
-rw-r--r--src/com/isode/stroke/elements/Stanza.java12
-rw-r--r--src/com/isode/stroke/muc/MUC.java2
-rw-r--r--src/com/isode/stroke/muc/MUCBookmark.java8
4 files changed, 20 insertions, 12 deletions
diff --git a/src/com/isode/stroke/elements/Message.java b/src/com/isode/stroke/elements/Message.java
index 5cfb58f..7760ff5 100644
--- a/src/com/isode/stroke/elements/Message.java
+++ b/src/com/isode/stroke/elements/Message.java
@@ -1,9 +1,5 @@
/*
- * Copyright (c) 2010, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2010, Remko Tronçon.
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
* All rights reserved.
*/
package com.isode.stroke.elements;
@@ -24,6 +20,10 @@ public class Message extends Stanza {
}
return "";
}
+
+ public boolean hasSubject() {
+ return getPayload(new Subject()) != null;
+ }
public void setSubject(String subject) {
updatePayload(new Subject(subject));
diff --git a/src/com/isode/stroke/elements/Stanza.java b/src/com/isode/stroke/elements/Stanza.java
index 9a4b907..8a5aadd 100644
--- a/src/com/isode/stroke/elements/Stanza.java
+++ b/src/com/isode/stroke/elements/Stanza.java
@@ -172,4 +172,16 @@ public abstract class Stanza implements Element {
Delay delay = getPayload(new Delay());
return delay != null ? delay.getStamp() : null;
}
+
+ public Date getTimestampFrom(final JID jid) {
+ Vector<Delay> delays = getPayloads(new Delay());
+ for (int i = 0; i < delays.size(); ++i) {
+ Delay delay = delays.get(i);
+ if (delay.getFrom().equals(jid)) {
+ return delay.getStamp();
+ }
+ }
+ return getTimestamp();
+ }
+
}
diff --git a/src/com/isode/stroke/muc/MUC.java b/src/com/isode/stroke/muc/MUC.java
index 900bb7d..ed3c34a 100644
--- a/src/com/isode/stroke/muc/MUC.java
+++ b/src/com/isode/stroke/muc/MUC.java
@@ -625,7 +625,7 @@ public class MUC {
return ownMUCJID.compare(j, CompareType.WithoutResource) == 0;
}
- private void handleUserLeft(LeavingType type) {
+ public void handleUserLeft(LeavingType type) {
String resource = ownMUCJID.getResource();
if (occupants.containsKey(resource)) {
MUCOccupant me = occupants.get(resource);
diff --git a/src/com/isode/stroke/muc/MUCBookmark.java b/src/com/isode/stroke/muc/MUCBookmark.java
index 64f3d9d..42b9dff 100644
--- a/src/com/isode/stroke/muc/MUCBookmark.java
+++ b/src/com/isode/stroke/muc/MUCBookmark.java
@@ -1,9 +1,5 @@
/*
- * Copyright (c) 2012, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2010, Remko Tronçon.
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
* All rights reserved.
*/
@@ -42,7 +38,7 @@ public class MUCBookmark {
* @param room room jabber id, not null
* @param bookmarkName name of bookmark, can be null
*/
- MUCBookmark(JID room, String bookmarkName) {
+ public MUCBookmark(JID room, String bookmarkName) {
this.room_ = room;
this.name_ = bookmarkName;
this.autojoin_ = false;