diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-06-03 01:50:40 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-06-03 01:50:40 +0000 |
commit | e8e97e86a0c8e18171fbca0d588ab3ba640f58c1 (patch) | |
tree | 09299b559db95754b918eb73da4a4d533c9ae831 /EssentialsXMPP/src/com/earth2me/essentials/xmpp | |
parent | f6cedda1e227f4e8e5a18bfc864ef515f286850e (diff) | |
download | Essentials-e8e97e86a0c8e18171fbca0d588ab3ba640f58c1.tar Essentials-e8e97e86a0c8e18171fbca0d588ab3ba640f58c1.tar.gz Essentials-e8e97e86a0c8e18171fbca0d588ab3ba640f58c1.tar.lz Essentials-e8e97e86a0c8e18171fbca0d588ab3ba640f58c1.tar.xz Essentials-e8e97e86a0c8e18171fbca0d588ab3ba640f58c1.zip |
Fixes for XMPP: display message on /setxmpp, ignore resource on xmpp addresses, reconnect on reload
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1575 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsXMPP/src/com/earth2me/essentials/xmpp')
3 files changed, 8 insertions, 4 deletions
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java index c4702b969..4a14ef730 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java @@ -22,5 +22,6 @@ public class Commandsetxmpp extends EssentialsCommand } EssentialsXMPP.getInstance().setAddress(user, args[0]); + user.sendMessage("XMPP address set to "+args[0]); } } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java index 17e2bb136..861e8fc02 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java @@ -48,6 +48,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP xmpp = new XMPPManager(this); ess.addReloadListener(users); + ess.addReloadListener(xmpp); if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) { LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll")); diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java index 028c283b9..9ce9d72e0 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java @@ -26,6 +26,7 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Presence; +import org.jivesoftware.smack.util.StringUtils; public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IConf @@ -84,7 +85,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager sendCommand(chat, message); break; default: - parent.getServer().broadcastMessage("<XMPP:" + chat.getParticipant() + "> " + message); + parent.getServer().broadcastMessage("<XMPP:" + StringUtils.parseBareAddress(chat.getParticipant()) + "> " + message); } } } @@ -138,7 +139,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager if (!createdLocally) { chat.addMessageListener(this); - final Chat old = chats.put(chat.getParticipant(), chat); + final Chat old = chats.put(StringUtils.parseBareAddress(chat.getParticipant()), chat); if (old != null) { old.removeMessageListener(this); @@ -259,7 +260,8 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager { for (Player p : matches) { - p.sendMessage("[" + chat.getParticipant() + ">" + p.getDisplayName() + "] " + message); + + p.sendMessage("[" +StringUtils.parseBareAddress(chat.getParticipant()) + ">" + p.getDisplayName() + "] " + message); } } } @@ -267,7 +269,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager private void sendCommand(final Chat chat, final String message) { - if (config.getStringList("op-users", new ArrayList<String>()).contains(chat.getParticipant())) + if (config.getStringList("op-users", new ArrayList<String>()).contains(StringUtils.parseBareAddress(chat.getParticipant()))) { final CraftServer craftServer = (CraftServer)parent.getServer(); if (craftServer != null) |