From 944ac37fc38b76294887d1f13ad65212b72a5db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20Cesar=20Bueno=20Cotta?= Date: Wed, 4 Jun 2014 22:27:16 -0300 Subject: [PATCH] Remove getConfiguration() from XMPPConnection interface definition. --- .../smack/AbstractXMPPConnection.java | 13 +++++++++-- .../java/org/jivesoftware/smack/Roster.java | 4 ++-- .../jivesoftware/smack/XMPPConnection.java | 22 +++++++++++++------ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index 3ced5f63d..2947aab5b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -240,8 +240,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { config = configuration; } - @Override - public ConnectionConfiguration getConfiguration() { + protected ConnectionConfiguration getConfiguration() { return config; } @@ -1089,4 +1088,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { super.finalize(); } } + + @Override + public RosterStore getRosterStore() { + return config.getRosterStore(); + } + + @Override + public boolean isRosterLoadedAtLogin() { + return config.isRosterLoadedAtLogin(); + } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/Roster.java b/smack-core/src/main/java/org/jivesoftware/smack/Roster.java index 96252fe8c..b935cd516 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/Roster.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/Roster.java @@ -122,7 +122,7 @@ public class Roster { */ Roster(final XMPPConnection connection) { this.connection = connection; - rosterStore = connection.getConfiguration().getRosterStore(); + rosterStore = connection.getRosterStore(); // Listen for any roster packets. connection.addPacketListener(new RosterPushListener(), ROSTER_PUSH_FILTER); // Listen for any presence packets. @@ -168,7 +168,7 @@ public class Roster { // again if it's an anonymous connection. if (connection.isAnonymous()) return; - if (!connection.getConfiguration().isRosterLoadedAtLogin()) + if (!connection.isRosterLoadedAtLogin()) return; try { Roster.this.reload(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index a0987a112..538a676e8 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -141,13 +141,6 @@ public interface XMPPConnection { */ public boolean isUsingCompression(); - /** - * Returns the configuration used to connect to the server. - * - * @return the configuration used to connect to the server. - */ - public ConnectionConfiguration getConfiguration(); - /** * Sends the specified packet to the server. * @@ -349,4 +342,19 @@ public interface XMPPConnection { * @return the currently active {@link FromMode} */ public FromMode getFromMode(); + + /** + * Get the permanent roster store. + * @return the permanent roster store or null + */ + public RosterStore getRosterStore(); + + /** + * Returns true if the roster will be loaded from the server when logging in. This + * is the common behaviour for clients but sometimes clients may want to differ this + * or just never do it if not interested in rosters. + * + * @return true if the roster will be loaded from the server when logging in. + */ + public boolean isRosterLoadedAtLogin(); }