From c2e504e6faffee8a9b1e62201250f142448ccd73 Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Sun, 11 Aug 2024 13:16:27 +0300 Subject: [PATCH] ContactList hide error when trying to get last activity from a server that doesn't support it yet Signed-off-by: Sergey Ponomarev --- .../jivesoftware/spark/ui/ContactInfoWindow.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/jivesoftware/spark/ui/ContactInfoWindow.java b/core/src/main/java/org/jivesoftware/spark/ui/ContactInfoWindow.java index ac6d76626..3ba8ec7da 100644 --- a/core/src/main/java/org/jivesoftware/spark/ui/ContactInfoWindow.java +++ b/core/src/main/java/org/jivesoftware/spark/ui/ContactInfoWindow.java @@ -31,7 +31,9 @@ import org.jivesoftware.resource.Res; import org.jivesoftware.resource.SparkRes; +import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.Presence; +import org.jivesoftware.smack.packet.StanzaError.Condition; import org.jivesoftware.smackx.vcardtemp.packet.VCard; import org.jivesoftware.smackx.iqlast.packet.LastActivity; import org.jivesoftware.smackx.iqlast.LastActivityManager; @@ -261,9 +263,14 @@ public void customizeUI(ContactItem contactItem) { status += Res.getString("message.idle.for", time); } } - } catch (Exception e1) { - Log.warning( "Unable to get Last Activity from: " + contactItem.toString(), e1 ); - } + } catch (XMPPException.XMPPErrorException e) { + Condition condition = e.getStanzaError().getCondition(); + if (condition != Condition.feature_not_implemented) { + Log.warning("Unable to get Last Activity from: " + contactItem, e); + } + } catch (Exception e) { + Log.warning("Unable to get Last Activity from: " + contactItem, e); + } } statusLabel.setText(status);