From 5393774a1cd597d3c575b06e37d899d0c4d8101c Mon Sep 17 00:00:00 2001 From: Thiago Camargo Date: Fri, 9 Mar 2007 18:30:48 +0000 Subject: [PATCH] Fix Presence Bug git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7430 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/jingle/JingleManager.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleManager.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleManager.java index dab5b833b..53fd398ba 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleManager.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleManager.java @@ -267,21 +267,23 @@ public class JingleManager implements JingleSessionListener { } public void presenceChanged(Presence presence) { - String xmppAddress = presence.getFrom(); - JingleSession aux = null; - for (JingleSession jingleSession : jingleSessions) { - if (jingleSession.getInitiator().equals(xmppAddress) || - jingleSession.getResponder().equals(xmppAddress)) { - aux = jingleSession; + if (!presence.isAvailable()) { + String xmppAddress = presence.getFrom(); + JingleSession aux = null; + for (JingleSession jingleSession : jingleSessions) { + if (jingleSession.getInitiator().equals(xmppAddress) || + jingleSession.getResponder().equals(xmppAddress)) { + aux = jingleSession; + } } + if (aux != null) + try { + aux.terminate(); + } + catch (XMPPException e) { + e.printStackTrace(); + } } - if (aux != null) - try { - aux.terminate(); - } - catch (XMPPException e) { - e.printStackTrace(); - } } });