diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-09-20 16:26:40 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-09-20 16:26:40 +0200 |
commit | 37aacbeb74919524138e5ab0d25f656f9a9f1b7d (patch) | |
tree | d523593c0833879d824a3792e5e186e63711843c /src/eu/siacs/conversations/entities | |
parent | 0b86f65bdc8dfd979be752798b7cbc3c28317c53 (diff) |
fixed presence splitting
Diffstat (limited to 'src/eu/siacs/conversations/entities')
4 files changed, 10 insertions, 10 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java index 005b83db0..8395449db 100644 --- a/src/eu/siacs/conversations/entities/Conversation.java +++ b/src/eu/siacs/conversations/entities/Conversation.java @@ -230,7 +230,7 @@ public class Conversation extends AbstractEntity { return this.otrSession; } else { SessionID sessionId = new SessionID( - this.getContactJid().split("/")[0], presence, "xmpp"); + this.getContactJid().split("/",2)[0], presence, "xmpp"); this.otrSession = new SessionImpl(sessionId, getAccount() .getOtrEngine(service)); try { diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index ce496d271..9505c5cf7 100644 --- a/src/eu/siacs/conversations/entities/Message.java +++ b/src/eu/siacs/conversations/entities/Message.java @@ -246,9 +246,9 @@ public class Message extends AbstractEntity { public void setPresence(String presence) { if (presence == null) { - this.counterpart = this.counterpart.split("/")[0]; + this.counterpart = this.counterpart.split("/",2)[0]; } else { - this.counterpart = this.counterpart.split("/")[0] + "/" + presence; + this.counterpart = this.counterpart.split("/",2)[0] + "/" + presence; } } @@ -257,7 +257,7 @@ public class Message extends AbstractEntity { } public String getPresence() { - String[] counterparts = this.counterpart.split("/"); + String[] counterparts = this.counterpart.split("/",2); if (counterparts.length == 2) { return counterparts[1]; } else { diff --git a/src/eu/siacs/conversations/entities/MucOptions.java b/src/eu/siacs/conversations/entities/MucOptions.java index e9ab6908a..676fb4f40 100644 --- a/src/eu/siacs/conversations/entities/MucOptions.java +++ b/src/eu/siacs/conversations/entities/MucOptions.java @@ -134,7 +134,7 @@ public class MucOptions { } public void processPacket(PresencePacket packet, PgpEngine pgp) { - String[] fromParts = packet.getFrom().split("/"); + String[] fromParts = packet.getFrom().split("/",2); if (fromParts.length >= 2) { String name = fromParts[1]; String type = packet.getAttribute("type"); @@ -180,7 +180,7 @@ public class MucOptions { } } } else if (type.equals("unavailable")) { - deleteUser(packet.getAttribute("from").split("/")[1]); + deleteUser(packet.getAttribute("from").split("/",2)[1]); } else if (type.equals("error")) { Element error = packet.findChild("error"); if (error.hasChild("conflict")) { @@ -209,7 +209,7 @@ public class MucOptions { } public String getProposedNick() { - String[] mucParts = conversation.getContactJid().split("/"); + String[] mucParts = conversation.getContactJid().split("/",2); if (conversation.getBookmark() != null && conversation.getBookmark().getNick() != null) { return conversation.getBookmark().getNick(); @@ -309,7 +309,7 @@ public class MucOptions { } public String getJoinJid() { - return this.conversation.getContactJid().split("/")[0] + "/" + return this.conversation.getContactJid().split("/",2)[0] + "/" + this.joinnick; } diff --git a/src/eu/siacs/conversations/entities/Roster.java b/src/eu/siacs/conversations/entities/Roster.java index c6212f773..f11f0250d 100644 --- a/src/eu/siacs/conversations/entities/Roster.java +++ b/src/eu/siacs/conversations/entities/Roster.java @@ -15,12 +15,12 @@ public class Roster { } public boolean hasContact(String jid) { - String cleanJid = jid.split("/")[0]; + String cleanJid = jid.split("/",2)[0]; return contacts.containsKey(cleanJid); } public Contact getContact(String jid) { - String cleanJid = jid.split("/")[0].toLowerCase(Locale.getDefault()); + String cleanJid = jid.split("/",2)[0].toLowerCase(Locale.getDefault()); if (contacts.containsKey(cleanJid)) { return contacts.get(cleanJid); } else { |