mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-10-29 11:47:01 +00:00
SPARK-2355: Use hasExtension()
This commit is contained in:
parent
91a421009a
commit
efda43bf5d
@ -347,7 +347,7 @@ public class Workspace extends JPanel implements StanzaListener {
|
||||
boolean isGroupChat = message.getType() == Message.Type.groupchat;
|
||||
|
||||
// Check if Conference invite. If so, do not handle here.
|
||||
if (message.getExtension("x", "jabber:x:conference") != null) {
|
||||
if (message.hasExtension("x", "jabber:x:conference")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -521,8 +521,7 @@ public class ChatRoomImpl extends ChatRoom {
|
||||
}
|
||||
|
||||
// Do not Handle offline messages. Offline messages are handling by Workspace.
|
||||
DelayInformation offlineInformation = message.getExtension("delay", "urn:xmpp:delay");
|
||||
if (offlineInformation != null &&
|
||||
if (message.hasExtension("delay", "urn:xmpp:delay") &&
|
||||
(message.getType() == Message.Type.chat ||
|
||||
message.getType() == Message.Type.normal)) {
|
||||
return;
|
||||
|
||||
@ -391,8 +391,7 @@ public class StatusBar extends JPanel implements VCardListener {
|
||||
}
|
||||
|
||||
if ((presence.getMode() == currentPresence.getMode()) && (presence.getType() == currentPresence.getType()) && (presence.getStatus().equals(currentPresence.getStatus()))) {
|
||||
ExtensionElement pe = presence.getExtension("x", "vcard-temp:x:update");
|
||||
if (pe != null) {
|
||||
if (presence.hasExtension("x", "vcard-temp:x:update")) {
|
||||
// Update VCard
|
||||
loadVCard();
|
||||
}
|
||||
|
||||
@ -203,8 +203,7 @@ public class BroadcastPlugin extends SparkTabHandler implements Plugin, StanzaLi
|
||||
final Message message = (Message) stanza;
|
||||
|
||||
// Do not handle errors or offline messages
|
||||
final DelayInformation offlineInformation = message.getExtension("delay", "urn:xmpp:delay");
|
||||
if (offlineInformation != null || message.getError() != null) {
|
||||
if (message.hasExtension("delay", "urn:xmpp:delay") || message.getError() != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -337,8 +336,7 @@ public class BroadcastPlugin extends SparkTabHandler implements Plugin, StanzaLi
|
||||
|
||||
SparkManager.getChatManager().fireGlobalMessageReceievedListeners(chatRoom, message);
|
||||
|
||||
DelayInformation inf = message.getExtension("delay", "urn:xmpp:delay");
|
||||
if (inf == null) {
|
||||
if (message.hasExtension("delay", "urn:xmpp:delay")) {
|
||||
SoundPreference soundPreference = (SoundPreference) SparkManager.getPreferenceManager().getPreference(new SoundPreference().getNamespace());
|
||||
SoundPreferences preferences = soundPreference.getPreferences();
|
||||
if (preferences.isPlayIncomingSound()) {
|
||||
|
||||
@ -73,10 +73,8 @@ public class SoundPlugin implements Plugin, MessageListener, ChatRoomListener {
|
||||
|
||||
@Override
|
||||
public void messageReceived(ChatRoom room, Message message) {
|
||||
|
||||
// Do not play sounds on history updates.
|
||||
DelayInformation inf = message.getExtension("delay", "urn:xmpp:delay");
|
||||
if (inf != null) {
|
||||
if (message.hasExtension("delay", "urn:xmpp:delay")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -270,10 +270,11 @@ public class WorkgroupManager {
|
||||
public void handleContactItem(final ContactItem contactItem) {
|
||||
Presence presence = contactItem.getPresence();
|
||||
|
||||
ExtensionElement workgroup = presence.getExtension("workgroup", "http://jivesoftware.com/protocol/workgroup");
|
||||
ExtensionElement notifyQueue = presence.getExtension("notify-queue", "http://jabber.org/protocol/workgroup");
|
||||
// TODO It probably can be WorkgroupInformation.class but it has namespace http://jabber.org/protocol/workgroup
|
||||
boolean hasWorkgroup = presence.hasExtension("workgroup", "http://jivesoftware.com/protocol/workgroup");
|
||||
boolean hasNotifyQueue = presence.hasExtension("notify-queue", "http://jabber.org/protocol/workgroup");
|
||||
|
||||
if (workgroup == null && notifyQueue == null) {
|
||||
if (!hasWorkgroup && !hasNotifyQueue) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -403,7 +404,7 @@ public class WorkgroupManager {
|
||||
public boolean handleInvitation(final XMPPConnection conn, final MultiUserChat room, final EntityBareJid inviter, final String reason, final String password, final Message message) {
|
||||
invites.add(inviter);
|
||||
|
||||
if (message.getExtension("workgroup", "http://jabber.org/protocol/workgroup") != null) {
|
||||
if (message.hasExtension("workgroup", "http://jabber.org/protocol/workgroup")) {
|
||||
Localpart workgroupName = inviter.getLocalpart();
|
||||
GroupChatRoom groupChatRoom = ConferenceUtils.enterRoomOnSameThread(workgroupName, room.getRoom(), null, password);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user