aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-09-04 10:28:13 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-09-04 10:28:13 +0200
commit1d6c09e8ffd68bca5c3a51ea21684f1c91bde7de (patch)
treef689c7188f284df7d6fda4867535eb47fc429b0b /src/eu/siacs
parent50f90d37b8a873a523da9bfcafdd3984451f9549 (diff)
parent5b24534ab6a0ee6ff0d54ccfd9c16b795ead44a3 (diff)
Merge pull request #397 from GZep/development
XEP-0172
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/entities/Contact.java7
-rw-r--r--src/eu/siacs/conversations/parser/PresenceParser.java7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/entities/Contact.java b/src/eu/siacs/conversations/entities/Contact.java
index ce697df4..8a6fd99c 100644
--- a/src/eu/siacs/conversations/entities/Contact.java
+++ b/src/eu/siacs/conversations/entities/Contact.java
@@ -32,6 +32,7 @@ public class Contact implements ListItem {
protected String accountUuid;
protected String systemName;
protected String serverName;
+ protected String presenceName;
protected String jid;
protected int subscription = 0;
protected String systemAccount;
@@ -76,6 +77,8 @@ public class Contact implements ListItem {
return this.systemName;
} else if (this.serverName != null) {
return this.serverName;
+ } else if (this.presenceName != null) {
+ return this.presenceName;
} else {
return this.jid.split("@")[0];
}
@@ -175,6 +178,10 @@ public class Contact implements ListItem {
this.systemName = systemName;
}
+ public void setPresenceName(String presenceName) {
+ this.presenceName = presenceName;
+ }
+
public String getSystemAccount() {
return systemAccount;
}
diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java
index 32667007..18c23060 100644
--- a/src/eu/siacs/conversations/parser/PresenceParser.java
+++ b/src/eu/siacs/conversations/parser/PresenceParser.java
@@ -49,7 +49,7 @@ public class PresenceParser extends AbstractParser implements
if (packet.getFrom() == null) {
return;
}
- String[] fromParts = packet.getFrom().split("/");
+ String[] fromParts = packet.getFrom().split("/", 2);
String type = packet.getAttribute("type");
if (fromParts[0].equals(account.getJid())) {
if (fromParts.length == 2) {
@@ -60,7 +60,6 @@ public class PresenceParser extends AbstractParser implements
account.removePresence(fromParts[1]);
}
}
-
} else {
Contact contact = account.getRoster().getContact(packet.getFrom());
if (type == null) {
@@ -108,6 +107,10 @@ public class PresenceParser extends AbstractParser implements
contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST);
}
}
+ Element nick = packet.findChild("nick", "http://jabber.org/protocol/nick");
+ if (nick != null) {
+ contact.setPresenceName(nick.getContent());
+ }
}
mXmppConnectionService.updateRosterUi();
}