Merge pull request #644 from SamWhited/barejidchecks

s/getResourcepart().isEmpty()/isBareJid()/ [EOM]
This commit is contained in:
Daniel Gultsch 2014-11-09 20:05:38 +01:00
commit a45a343604
5 changed files with 7 additions and 7 deletions

View File

@ -83,7 +83,7 @@ public class Account extends AbstractEntity {
final String avatar) {
this.uuid = uuid;
this.jid = jid;
if (jid.getResourcepart().isEmpty()) {
if (jid.isBareJid()) {
this.setResource("mobile");
}
this.password = password;

View File

@ -244,7 +244,7 @@ public class MucOptions {
&& conversation.getBookmark().getNick() != null) {
return conversation.getBookmark().getNick();
} else {
if (!conversation.getContactJid().getResourcepart().isEmpty()) {
if (!conversation.getContactJid().isBareJid()) {
return conversation.getContactJid().getResourcepart();
} else {
return account.getUsername();

View File

@ -69,7 +69,7 @@ public abstract class AbstractParser {
// TODO: Handle this?
from = null;
}
String presence = from == null || from.getResourcepart().isEmpty() ? "" : from.getResourcepart();
String presence = from == null || from.isBareJid() ? "" : from.getResourcepart();
Contact contact = account.getRoster().getContact(from);
long timestamp = getTimestamp(packet);
if (timestamp >= contact.lastseen.time) {

View File

@ -40,7 +40,7 @@ public class MessageParser extends AbstractParser implements
finishedMessage.setRemoteMsgId(packet.getId());
finishedMessage.markable = isMarkable(packet);
if (conversation.getMode() == Conversation.MODE_MULTI
&& !jid.getResourcepart().isEmpty()) {
&& !jid.isBareJid()) {
finishedMessage.setType(Message.TYPE_PRIVATE);
finishedMessage.setCounterpart(packet.getFrom());
finishedMessage.setTrueCounterpart(conversation.getMucOptions()

View File

@ -56,7 +56,7 @@ public class PresenceParser extends AbstractParser implements
final Jid from = packet.getFrom();
String type = packet.getAttribute("type");
if (from.toBareJid().equals(account.getJid().toBareJid())) {
if (!from.getResourcepart().isEmpty()) {
if (!from.isBareJid()) {
if (type == null) {
account.updatePresence(from.getResourcepart(),
Presences.parseShow(packet.findChild("show")));
@ -69,7 +69,7 @@ public class PresenceParser extends AbstractParser implements
Contact contact = account.getRoster().getContact(packet.getFrom());
if (type == null) {
String presence;
if (!from.getResourcepart().isEmpty()) {
if (!from.isBareJid()) {
presence = from.getResourcepart();
} else {
presence = "";