Move privacy lists from core to extensions

This commit is contained in:
Florian Schmaus 2014-02-15 22:35:38 +01:00
parent 2ad517b6dd
commit 38a3531ec6
16 changed files with 42 additions and 65 deletions

View File

@ -1,14 +0,0 @@
package org.jivesoftware.smack.initializer;
/**
* Loads the default provider file for the Smack core on initialization.
*
* @author Robin Collier
*
*/
public class CoreInitializer extends UrlProviderFileInitializer implements SmackInitializer {
protected String getFilePath() {
return "classpath:org.jivesoftware.smack/core.providers";
}
}

View File

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<!-- Providers file for default Smack extensions -->
<smackProviders>
<!-- Privacy -->
<iqProvider>
<elementName>query</elementName>
<namespace>jabber:iq:privacy</namespace>
<className>org.jivesoftware.smack.provider.PrivacyProvider</className>
</iqProvider>
</smackProviders>

View File

@ -19,9 +19,7 @@
<!-- Classes that will be loaded when Smack starts --> <!-- Classes that will be loaded when Smack starts -->
<startupClasses> <startupClasses>
<className>org.jivesoftware.smack.initializer.CoreInitializer</className>
<className>org.jivesoftware.smack.initializer.VmArgInitializer</className> <className>org.jivesoftware.smack.initializer.VmArgInitializer</className>
<className>org.jivesoftware.smack.PrivacyListManager</className>
<className>org.jivesoftware.smack.ReconnectionManager</className> <className>org.jivesoftware.smack.ReconnectionManager</className>
</startupClasses> </startupClasses>

View File

@ -1,17 +0,0 @@
package org.jivesoftware.smack.initializer;
import static org.junit.Assert.assertTrue;
import org.jivesoftware.smack.initializer.CoreInitializer;
import org.junit.Test;
public class CoreInitializerTest {
@Test
public void testCoreInitializer() {
CoreInitializer ci = new CoreInitializer();
ci.initialize();
assertTrue(ci.getExceptions().size() == 0);
}
}

View File

@ -80,6 +80,11 @@
<td><a href="http://www.xmpp.org/extensions/xep-0115.html">XEP-0115</a></td> <td><a href="http://www.xmpp.org/extensions/xep-0115.html">XEP-0115</a></td>
<td>Generic publish and subscribe functionality.</td> <td>Generic publish and subscribe functionality.</td>
</tr> </tr>
<tr>
<td><a href="privacy.html">Privacy Lists</a></td>
<td><a href="http://www.xmpp.org/extensions/xep-0016.html">XEP-0016</a></td>
<td>Enabling or disabling communication with other entities.</td>
</tr>
</table> </table>
</body> </body>
</html> </html>

View File

@ -153,7 +153,7 @@ The listener becomes notified after performing:
<p class="subheader">References</p> <p class="subheader">References</p>
<ul> <ul>
<li><a href="http://www.xmpp.org/specs/rfc3921.html#privacy">Blocking communication</a> from the RFC3921. <li><a href="http://xmpp.org/extensions/xep-0016.html">XEP-0016: Privacy Lists</a>
</ul> </ul>
</p> </p>

View File

@ -23,6 +23,7 @@
<a href="filetransfer.html">File Transfer</a><br> <a href="filetransfer.html">File Transfer</a><br>
<a href="pubsub.html">PubSub</a><br> <a href="pubsub.html">PubSub</a><br>
<a href="caps.html">Entity Capabilities</a><br> <a href="caps.html">Entity Capabilities</a><br>
<a href="privacy.html">Privacy</a><br>
</p> </p>
</body> </body>

View File

@ -22,7 +22,6 @@
<li><a href="providers.html">Provider Architecture</a> <li><a href="providers.html">Provider Architecture</a>
<li><a href="properties.html">Packet Properties</a> <li><a href="properties.html">Packet Properties</a>
<li><a href="debugging.html">Debugging with Smack</a> <li><a href="debugging.html">Debugging with Smack</a>
<li><a href="privacy.html">Privacy</a>
<p> <p>
<li><a href="extensions/index.html">Smack Extensions Manual</a> <li><a href="extensions/index.html">Smack Extensions Manual</a>
</ul> </ul>

View File

@ -12,17 +12,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jivesoftware.smack; package org.jivesoftware.smackx.privacy;
import org.jivesoftware.smack.packet.PrivacyItem;
import org.jivesoftware.smackx.privacy.packet.PrivacyItem;
import java.util.List; import java.util.List;
/** /**
* A privacy list represents a list of contacts that is a read only class used to represent a set of allowed or blocked communications. * A privacy list represents a list of contacts that is a read only class used to represent a set of allowed or blocked communications.
* Basically it can:<ul> * Basically it can:<ul>
* *
* <li>Handle many {@link org.jivesoftware.smack.packet.PrivacyItem}.</li> * <li>Handle many {@link org.jivesoftware.smackx.privacy.packet.PrivacyItem}.</li>
* <li>Answer if it is the default list.</li> * <li>Answer if it is the default list.</li>
* <li>Answer if it is the active list.</li> * <li>Answer if it is the active list.</li>
* </ul> * </ul>

View File

@ -15,9 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jivesoftware.smack; package org.jivesoftware.smackx.privacy;
import org.jivesoftware.smack.packet.PrivacyItem; import org.jivesoftware.smackx.privacy.packet.PrivacyItem;
import java.util.List; import java.util.List;

View File

@ -15,13 +15,19 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jivesoftware.smack; package org.jivesoftware.smackx.privacy;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.ConnectionCreationListener;
import org.jivesoftware.smack.PacketCollector;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.*; import org.jivesoftware.smack.filter.*;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Privacy; import org.jivesoftware.smackx.privacy.packet.Privacy;
import org.jivesoftware.smack.packet.PrivacyItem; import org.jivesoftware.smackx.privacy.packet.PrivacyItem;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.*; import java.util.*;

View File

@ -15,13 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jivesoftware.smack.packet; package org.jivesoftware.smackx.privacy.packet;
import java.util.*; import java.util.*;
import org.jivesoftware.smack.packet.IQ;
/** /**
* A Privacy IQ Packet, is used by the {@link org.jivesoftware.smack.PrivacyListManager} * A Privacy IQ Packet, is used by the {@link org.jivesoftware.smackx.privacy.PrivacyListManager}
* and {@link org.jivesoftware.smack.provider.PrivacyProvider} to allow and block * and {@link org.jivesoftware.smackx.privacy.provider.PrivacyProvider} to allow and block
* communications from other users. It contains the appropriate structure to suit * communications from other users. It contains the appropriate structure to suit
* user-defined privacy lists. Different configured Privacy packages are used in the * user-defined privacy lists. Different configured Privacy packages are used in the
* server & manager communication in order to: * server & manager communication in order to:

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jivesoftware.smack.packet; package org.jivesoftware.smackx.privacy.packet;
/** /**
* A privacy item acts a rule that when matched defines if a packet should be blocked or not. * A privacy item acts a rule that when matched defines if a packet should be blocked or not.

View File

@ -12,21 +12,22 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.jivesoftware.smack.provider; package org.jivesoftware.smackx.privacy.provider;
import org.jivesoftware.smack.packet.DefaultPacketExtension; import org.jivesoftware.smack.packet.DefaultPacketExtension;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Privacy; import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.packet.PrivacyItem; import org.jivesoftware.smackx.privacy.packet.Privacy;
import org.jivesoftware.smackx.privacy.packet.PrivacyItem;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* The PrivacyProvider parses {@link Privacy} packets. {@link Privacy} * The PrivacyProvider parses {@link Privacy} packets. {@link Privacy}
* Parses the <tt>query</tt> sub-document and creates an instance of {@link Privacy}. * Parses the <tt>query</tt> sub-document and creates an instance of {@link Privacy}.
* For each <tt>item</tt> in the <tt>list</tt> element, it creates an instance * For each <tt>item</tt> in the <tt>list</tt> element, it creates an instance
* of {@link PrivacyItem} and {@link org.jivesoftware.smack.packet.PrivacyItem.PrivacyRule}. * of {@link PrivacyItem} and {@link org.jivesoftware.smackx.privacy.packet.PrivacyItem.PrivacyRule}.
* *
* @author Francisco Vives * @author Francisco Vives
*/ */

View File

@ -449,4 +449,11 @@
<className>org.jivesoftware.smackx.ping.provider.PingProvider</className> <className>org.jivesoftware.smackx.ping.provider.PingProvider</className>
</iqProvider> </iqProvider>
<!-- Privacy -->
<iqProvider>
<elementName>query</elementName>
<namespace>jabber:iq:privacy</namespace>
<className>org.jivesoftware.smackx.privacy.provider.PrivacyProvider</className>
</iqProvider>
</smackProviders> </smackProviders>

View File

@ -9,5 +9,6 @@
<className>org.jivesoftware.smackx.iqlast.LastActivityManager</className> <className>org.jivesoftware.smackx.iqlast.LastActivityManager</className>
<className>org.jivesoftware.smackx.commands.AdHocCommandManager</className> <className>org.jivesoftware.smackx.commands.AdHocCommandManager</className>
<className>org.jivesoftware.smackx.ping.PingManager</className> <className>org.jivesoftware.smackx.ping.PingManager</className>
<className>org.jivesoftware.smackx.privacy.PrivacyListManager</className>
</startupClasses> </startupClasses>
</smack> </smack>