aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/parser
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-20 16:26:40 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-20 16:26:40 +0200
commit37aacbeb74919524138e5ab0d25f656f9a9f1b7d (patch)
treed523593c0833879d824a3792e5e186e63711843c /src/eu/siacs/conversations/parser
parent0b86f65bdc8dfd979be752798b7cbc3c28317c53 (diff)
fixed presence splitting
Diffstat (limited to 'src/eu/siacs/conversations/parser')
-rw-r--r--src/eu/siacs/conversations/parser/AbstractParser.java2
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java16
-rw-r--r--src/eu/siacs/conversations/parser/PresenceParser.java4
3 files changed, 11 insertions, 11 deletions
diff --git a/src/eu/siacs/conversations/parser/AbstractParser.java b/src/eu/siacs/conversations/parser/AbstractParser.java
index 25fcd921..efbf5aef 100644
--- a/src/eu/siacs/conversations/parser/AbstractParser.java
+++ b/src/eu/siacs/conversations/parser/AbstractParser.java
@@ -60,7 +60,7 @@ public abstract class AbstractParser {
protected void updateLastseen(Element packet, Account account,
boolean presenceOverwrite) {
- String[] fromParts = packet.getAttribute("from").split("/");
+ String[] fromParts = packet.getAttribute("from").split("/",2);
String from = fromParts[0];
String presence = null;
if (fromParts.length >= 2) {
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index b9fe3c15..96f45542 100644
--- a/src/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/eu/siacs/conversations/parser/MessageParser.java
@@ -25,7 +25,7 @@ public class MessageParser extends AbstractParser implements
}
private Message parseChat(MessagePacket packet, Account account) {
- String[] fromParts = packet.getFrom().split("/");
+ String[] fromParts = packet.getFrom().split("/",2);
Conversation conversation = mXmppConnectionService
.findOrCreateConversation(account, fromParts[0], false);
conversation.setLatestMarkableMessageId(getMarkableMessageId(packet));
@@ -57,9 +57,9 @@ public class MessageParser extends AbstractParser implements
}
private Message parseOtrChat(MessagePacket packet, Account account) {
- boolean properlyAddressed = (packet.getTo().split("/").length == 2)
+ boolean properlyAddressed = (packet.getTo().split("/",2).length == 2)
|| (account.countPresences() == 1);
- String[] fromParts = packet.getFrom().split("/");
+ String[] fromParts = packet.getFrom().split("/",2);
Conversation conversation = mXmppConnectionService
.findOrCreateConversation(account, fromParts[0], false);
String presence;
@@ -132,7 +132,7 @@ public class MessageParser extends AbstractParser implements
private Message parseGroupchat(MessagePacket packet, Account account) {
int status;
- String[] fromParts = packet.getFrom().split("/");
+ String[] fromParts = packet.getFrom().split("/",2);
if (mXmppConnectionService.find(account.pendingConferenceLeaves,
account, fromParts[0]) != null) {
return null;
@@ -221,7 +221,7 @@ public class MessageParser extends AbstractParser implements
return null;
}
}
- String[] parts = fullJid.split("/");
+ String[] parts = fullJid.split("/",2);
Conversation conversation = mXmppConnectionService
.findOrCreateConversation(account, parts[0], false);
conversation.setLatestMarkableMessageId(getMarkableMessageId(packet));
@@ -253,7 +253,7 @@ public class MessageParser extends AbstractParser implements
}
private void parseError(MessagePacket packet, Account account) {
- String[] fromParts = packet.getFrom().split("/");
+ String[] fromParts = packet.getFrom().split("/",2);
mXmppConnectionService.markMessage(account, fromParts[0],
packet.getId(), Message.STATUS_SEND_FAILED);
}
@@ -267,14 +267,14 @@ public class MessageParser extends AbstractParser implements
String id = packet
.findChild("displayed", "urn:xmpp:chat-markers:0")
.getAttribute("id");
- String[] fromParts = packet.getAttribute("from").split("/");
+ String[] fromParts = packet.getAttribute("from").split("/",2);
updateLastseen(packet, account, true);
mXmppConnectionService.markMessage(account, fromParts[0], id,
Message.STATUS_SEND_DISPLAYED);
} else if (packet.hasChild("received", "urn:xmpp:chat-markers:0")) {
String id = packet.findChild("received", "urn:xmpp:chat-markers:0")
.getAttribute("id");
- String[] fromParts = packet.getAttribute("from").split("/");
+ String[] fromParts = packet.getAttribute("from").split("/",2);
updateLastseen(packet, account, false);
mXmppConnectionService.markMessage(account, fromParts[0], id,
Message.STATUS_SEND_RECEIVED);
diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java
index 05ffa67e..e240a858 100644
--- a/src/eu/siacs/conversations/parser/PresenceParser.java
+++ b/src/eu/siacs/conversations/parser/PresenceParser.java
@@ -22,7 +22,7 @@ public class PresenceParser extends AbstractParser implements
PgpEngine mPgpEngine = mXmppConnectionService.getPgpEngine();
if (packet.hasChild("x", "http://jabber.org/protocol/muc#user")) {
Conversation muc = mXmppConnectionService.find(account, packet
- .getAttribute("from").split("/")[0]);
+ .getAttribute("from").split("/",2)[0]);
if (muc != null) {
boolean before = muc.getMucOptions().online();
muc.getMucOptions().processPacket(packet, mPgpEngine);
@@ -32,7 +32,7 @@ public class PresenceParser extends AbstractParser implements
}
} else if (packet.hasChild("x", "http://jabber.org/protocol/muc")) {
Conversation muc = mXmppConnectionService.find(account, packet
- .getAttribute("from").split("/")[0]);
+ .getAttribute("from").split("/",2)[0]);
if (muc != null) {
boolean before = muc.getMucOptions().online();
muc.getMucOptions().processPacket(packet, mPgpEngine);