summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-10-30 00:18:34 +0200
committersnowleo <schneeleo@gmail.com>2011-10-30 00:18:55 +0200
commit5196237c4679e7607e412bf10aa60a2393871917 (patch)
treedf4fc2e994305cd5df7171c843d2655893176155
parent094a747db355668e0940603c20c7f35ba6d77c64 (diff)
downloadEssentials-5196237c4679e7607e412bf10aa60a2393871917.tar
Essentials-5196237c4679e7607e412bf10aa60a2393871917.tar.gz
Essentials-5196237c4679e7607e412bf10aa60a2393871917.tar.lz
Essentials-5196237c4679e7607e412bf10aa60a2393871917.tar.xz
Essentials-5196237c4679e7607e412bf10aa60a2393871917.zip
XMPP: Don't send messages from spy users back to them.
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java7
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java2
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java2
3 files changed, 7 insertions, 4 deletions
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
index 34f862627..631d1b21b 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
@@ -124,14 +124,17 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
}
@Override
- public void broadcastMessage(final IUser sender, final String message)
+ public void broadcastMessage(final IUser sender, final String message, final String xmppAddress)
{
ess.broadcastMessage(sender, message);
try
{
for (String address : getSpyUsers())
{
- sendMessage(address, message);
+ if (!address.equalsIgnoreCase(xmppAddress))
+ {
+ sendMessage(address, message);
+ }
}
}
catch (Exception ex)
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java
index 1ed9fa732..0635ca131 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java
@@ -24,5 +24,5 @@ public interface IEssentialsXMPP extends Plugin
boolean toggleSpy(final Player user);
- void broadcastMessage(final IUser sender, final String message);
+ void broadcastMessage(final IUser sender, final String message, final String xmppAddress);
}
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
index d7aedb9f4..cbe89f9d6 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
@@ -103,7 +103,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
break;
default:
final IUser sender = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant()));
- parent.broadcastMessage(sender, "="+sender.getDisplayName()+": "+ message);
+ parent.broadcastMessage(sender, "="+sender.getDisplayName()+": "+ message, StringUtils.parseBareAddress(chat.getParticipant()));
}
}
}