From dd6f76fcac4550bb13442ffb53794628d3920a2e Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Wed, 20 Dec 2006 22:05:38 +0000 Subject: [PATCH] Fixed loading of vcard of other users when using an anonymous connection. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6452 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smackx/packet/VCard.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/org/jivesoftware/smackx/packet/VCard.java b/source/org/jivesoftware/smackx/packet/VCard.java index 21303fb82..ac515040c 100644 --- a/source/org/jivesoftware/smackx/packet/VCard.java +++ b/source/org/jivesoftware/smackx/packet/VCard.java @@ -471,7 +471,7 @@ public class VCard extends IQ { * @throws XMPPException thrown if there was an issue setting the VCard in the server. */ public void save(XMPPConnection connection) throws XMPPException { - checkAuthenticated(connection); + checkAuthenticated(connection, true); setType(IQ.Type.SET); setFrom(connection.getUser()); @@ -495,7 +495,7 @@ public class VCard extends IQ { * and not anonymous. */ public void load(XMPPConnection connection) throws XMPPException { - checkAuthenticated(connection); + checkAuthenticated(connection, true); setFrom(connection.getUser()); doLoad(connection, connection.getUser()); @@ -505,7 +505,7 @@ public class VCard extends IQ { * Load VCard information for a given user. Connection should be authenticated and not anonymous. */ public void load(XMPPConnection connection, String user) throws XMPPException { - checkAuthenticated(connection); + checkAuthenticated(connection, false); setTo(user); doLoad(connection, user); @@ -561,14 +561,14 @@ public class VCard extends IQ { } } - private void checkAuthenticated(XMPPConnection connection) { + private void checkAuthenticated(XMPPConnection connection, boolean checkForAnonymous) { if (connection == null) { throw new IllegalArgumentException("No connection was provided"); } if (!connection.isAuthenticated()) { throw new IllegalArgumentException("Connection is not authenticated"); } - if (connection.isAnonymous()) { + if (checkForAnonymous && connection.isAnonymous()) { throw new IllegalArgumentException("Connection cannot be anonymous"); } }