aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xmpp/stanzas
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-08-31 16:28:21 +0200
committeriNPUTmice <daniel@gultsch.de>2014-08-31 16:28:21 +0200
commit1ac5be485502e7d6d4c117335e083c684739e6af (patch)
tree279c22e269158dde838f31ebcf3daf4272573583 /src/eu/siacs/conversations/xmpp/stanzas
parent8d456085e57334dc34707a49666006619e2c77c6 (diff)
some code cleanup
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/stanzas')
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java12
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java15
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/MessagePacket.java16
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/PresencePacket.java3
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java4
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/streammgmt/EnablePacket.java2
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/streammgmt/RequestPacket.java2
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java4
8 files changed, 28 insertions, 30 deletions
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java b/src/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java
index 204a6bec..eef41c79 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/AbstractStanza.java
@@ -15,20 +15,20 @@ public class AbstractStanza extends Element {
public String getFrom() {
return getAttribute("from");
}
-
+
public String getId() {
return this.getAttribute("id");
}
-
+
public void setTo(String to) {
setAttribute("to", to);
}
-
+
public void setFrom(String from) {
- setAttribute("from",from);
+ setAttribute("from", from);
}
-
+
public void setId(String id) {
- setAttribute("id",id);
+ setAttribute("id", id);
}
}
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java b/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java
index 1d4e44d1..9df05e67 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/IqPacket.java
@@ -2,9 +2,8 @@ package eu.siacs.conversations.xmpp.stanzas;
import eu.siacs.conversations.xml.Element;
-
public class IqPacket extends AbstractStanza {
-
+
public static final int TYPE_ERROR = -1;
public static final int TYPE_SET = 0;
public static final int TYPE_RESULT = 1;
@@ -33,25 +32,25 @@ public class IqPacket extends AbstractStanza {
break;
}
}
-
+
public IqPacket() {
super("iq");
}
-
+
public Element query() {
Element query = findChild("query");
- if (query==null) {
+ if (query == null) {
query = addChild("query");
}
return query;
}
-
+
public Element query(String xmlns) {
Element query = query();
query.setAttribute("xmlns", xmlns);
return query();
}
-
+
public int getType() {
String type = getAttribute("type");
if ("error".equals(type)) {
@@ -66,7 +65,7 @@ public class IqPacket extends AbstractStanza {
return 1000;
}
}
-
+
public IqPacket generateRespone(int type) {
IqPacket packet = new IqPacket(type);
packet.setTo(this.getFrom());
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/MessagePacket.java b/src/eu/siacs/conversations/xmpp/stanzas/MessagePacket.java
index 433b08c9..386d9dc8 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/MessagePacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/MessagePacket.java
@@ -9,20 +9,20 @@ public class MessagePacket extends AbstractStanza {
public static final int TYPE_GROUPCHAT = 3;
public static final int TYPE_ERROR = 4;
public static final int TYPE_HEADLINE = 5;
-
+
public MessagePacket() {
super("message");
}
-
+
public String getBody() {
Element body = this.findChild("body");
- if (body!=null) {
+ if (body != null) {
return body.getContent();
} else {
return null;
}
}
-
+
public void setBody(String text) {
this.children.remove(findChild("body"));
Element body = new Element("body");
@@ -33,7 +33,7 @@ public class MessagePacket extends AbstractStanza {
public void setType(int type) {
switch (type) {
case TYPE_CHAT:
- this.setAttribute("type","chat");
+ this.setAttribute("type", "chat");
break;
case TYPE_GROUPCHAT:
this.setAttribute("type", "groupchat");
@@ -43,14 +43,14 @@ public class MessagePacket extends AbstractStanza {
case TYPE_NORMAL:
break;
default:
- this.setAttribute("type","chat");
+ this.setAttribute("type", "chat");
break;
}
}
-
+
public int getType() {
String type = getAttribute("type");
- if (type==null) {
+ if (type == null) {
return TYPE_NORMAL;
} else if (type.equals("normal")) {
return TYPE_NORMAL;
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/PresencePacket.java b/src/eu/siacs/conversations/xmpp/stanzas/PresencePacket.java
index dfbab78c..7ea32099 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/PresencePacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/PresencePacket.java
@@ -1,8 +1,7 @@
package eu.siacs.conversations.xmpp.stanzas;
-
public class PresencePacket extends AbstractStanza {
-
+
public PresencePacket() {
super("presence");
}
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java
index 6fe3ea2b..c936891c 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java
@@ -6,8 +6,8 @@ public class AckPacket extends AbstractStanza {
public AckPacket(int sequence, int smVersion) {
super("a");
- this.setAttribute("xmlns","urn:xmpp:sm:"+smVersion);
- this.setAttribute("h", ""+sequence);
+ this.setAttribute("xmlns", "urn:xmpp:sm:" + smVersion);
+ this.setAttribute("h", "" + sequence);
}
}
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/EnablePacket.java b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/EnablePacket.java
index 0ca7a4fd..78cd81ed 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/EnablePacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/EnablePacket.java
@@ -6,7 +6,7 @@ public class EnablePacket extends AbstractStanza {
public EnablePacket(int smVersion) {
super("enable");
- this.setAttribute("xmlns","urn:xmpp:sm:"+smVersion);
+ this.setAttribute("xmlns", "urn:xmpp:sm:" + smVersion);
this.setAttribute("resume", "true");
}
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/RequestPacket.java b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/RequestPacket.java
index d42ae9b0..98cfc748 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/RequestPacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/RequestPacket.java
@@ -6,7 +6,7 @@ public class RequestPacket extends AbstractStanza {
public RequestPacket(int smVersion) {
super("r");
- this.setAttribute("xmlns","urn:xmpp:sm:"+smVersion);
+ this.setAttribute("xmlns", "urn:xmpp:sm:" + smVersion);
}
}
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java
index dcf32101..df039d5a 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java
@@ -6,9 +6,9 @@ public class ResumePacket extends AbstractStanza {
public ResumePacket(String id, int sequence, int smVersion) {
super("resume");
- this.setAttribute("xmlns","urn:xmpp:sm:"+smVersion);
+ this.setAttribute("xmlns", "urn:xmpp:sm:" + smVersion);
this.setAttribute("previd", id);
- this.setAttribute("h", ""+sequence);
+ this.setAttribute("h", "" + sequence);
}
}