XMPP: Don't send messages from spy users back to them.

This commit is contained in:
snowleo 2011-10-30 00:18:34 +02:00
parent 094a747db3
commit 5196237c46
3 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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()));
}
}
}