nick parsing (xep 0172) also enabled for messages and for pep
This commit is contained in:
parent
1d6c09e8ff
commit
7a3bc5dc45
|
@ -328,12 +328,20 @@ public class MessageParser extends AbstractParser implements
|
||||||
mXmppConnectionService.fetchAvatar(account, avatar);
|
mXmppConnectionService.fetchAvatar(account, avatar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (node.equals("http://jabber.org/protocol/nick")) {
|
||||||
Log.d(Config.LOGTAG, account.getJid() + ": " + node + " from "
|
Element item = items.findChild("item");
|
||||||
+ from);
|
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);
|
notify = (SystemClock.elapsedRealtime() - lastCarbonMessageReceived) > (Config.CARBON_GRACE_PERIOD * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.parseNick(packet, account);
|
||||||
|
|
||||||
if ((packet.getType() == MessagePacket.TYPE_CHAT)) {
|
if ((packet.getType() == MessagePacket.TYPE_CHAT)) {
|
||||||
if ((packet.getBody() != null)
|
if ((packet.getBody() != null)
|
||||||
&& (packet.getBody().startsWith("?OTR"))) {
|
&& (packet.getBody().startsWith("?OTR"))) {
|
||||||
|
@ -446,4 +456,16 @@ public class MessageParser extends AbstractParser implements
|
||||||
parseEvent(event, packet.getFrom(), account);
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue