mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Fixes for XMPP: Prevent loops on errors
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1577 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
991a5cb24c
commit
5a47d18a9b
1 changed files with 23 additions and 24 deletions
|
@ -65,7 +65,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
|||
}
|
||||
catch (XMPPException ex)
|
||||
{
|
||||
disableChat(address, ex);
|
||||
disableChat(address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,9 +73,11 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
|||
@Override
|
||||
public void processMessage(final Chat chat, final Message msg)
|
||||
{
|
||||
final String message = msg.getBody();
|
||||
if (message.length() > 0)
|
||||
// Normally we should log the error message
|
||||
// But we would create a loop if the connection to a log-user fails.
|
||||
if (msg.getType() != Message.Type.error && msg.getBody().length() > 0)
|
||||
{
|
||||
final String message = msg.getBody();
|
||||
switch (message.charAt(0))
|
||||
{
|
||||
case '@':
|
||||
|
@ -199,10 +201,8 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Ignore all exception and just print them to the console
|
||||
// Ignore all exceptions
|
||||
// Otherwise we create a loop.
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,14 +279,13 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
|||
}
|
||||
}
|
||||
|
||||
private void disableChat(final String address, final XMPPException exception)
|
||||
private void disableChat(final String address)
|
||||
{
|
||||
final Chat chat = chats.get(address);
|
||||
if (chat != null)
|
||||
{
|
||||
chat.removeMessageListener(this);
|
||||
chats.remove(address);
|
||||
LOGGER.log(Level.WARNING, "Failed to send xmpp message.", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue