aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index 10859345..0f95627d 100644
--- a/src/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/eu/siacs/conversations/parser/MessageParser.java
@@ -328,12 +328,20 @@ public class MessageParser extends AbstractParser implements
mXmppConnectionService.fetchAvatar(account, avatar);
}
}
- } else {
- Log.d(Config.LOGTAG, account.getJid() + ": " + node + " from "
- + from);
+ } else if (node.equals("http://jabber.org/protocol/nick")) {
+ Element item = items.findChild("item");
+ if (item != null) {
+ Element nick = item.findChild("nick",
+ "http://jabber.org/protocol/nick");
+ if (nick != null) {
+ if (from != null) {
+ Contact contact = account.getRoster().getContact(
+ from);
+ contact.setPresenceName(nick.getContent());
+ }
+ }
+ }
}
- } else {
- Log.d(Config.LOGTAG, event.toString());
}
}
@@ -363,6 +371,8 @@ public class MessageParser extends AbstractParser implements
notify = (SystemClock.elapsedRealtime() - lastCarbonMessageReceived) > (Config.CARBON_GRACE_PERIOD * 1000);
}
+ this.parseNick(packet, account);
+
if ((packet.getType() == MessagePacket.TYPE_CHAT)) {
if ((packet.getBody() != null)
&& (packet.getBody().startsWith("?OTR"))) {
@@ -446,4 +456,16 @@ public class MessageParser extends AbstractParser implements
parseEvent(event, packet.getFrom(), account);
}
}
+
+ private void parseNick(MessagePacket packet, Account account) {
+ Element nick = packet.findChild("nick",
+ "http://jabber.org/protocol/nick");
+ if (nick != null) {
+ if (packet.getFrom() != null) {
+ Contact contact = account.getRoster().getContact(
+ packet.getFrom());
+ contact.setPresenceName(nick.getContent());
+ }
+ }
+ }
}