1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Add StreamFeatureProvider

so that AccountManager and the CapsExtension can be moved to
smack-extensions, where they belong.
This commit is contained in:
Florian Schmaus 2014-09-11 23:58:07 +02:00
parent fc51f3df48
commit 46a4402a69
22 changed files with 396 additions and 151 deletions

View file

@ -0,0 +1,28 @@
/**
*
* Copyright © 2014 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.initializer.tcp;
import org.jivesoftware.smack.initializer.UrlInitializer;
public class SmackTcpSmackInitalizer extends UrlInitializer {
@Override
protected String getProvidersUrl() {
return "classpath:org.jivesoftware.smack/smacktcp.providers";
}
}

View file

@ -917,19 +917,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
this.writer = writer;
}
@Override
protected void parseFeaturesSubclass(String name, String namespace, XmlPullParser parser) {
switch(name) {
case StreamManagementFeature.ELEMENT:
if (namespace.equals(StreamManagement.NAMESPACE)) {
addStreamFeature(StreamManagementFeature.INSTANCE);
} else {
LOGGER.fine("Unsupported Stream Management version: " + namespace);
}
break;
}
}
@Override
protected void afterFeaturesReceived() throws SecurityRequiredException, NotConnectedException {
StartTls startTlsFeature = getFeature(StartTls.ELEMENT, StartTls.NAMESPACE);

View file

@ -0,0 +1,33 @@
/**
*
* Copyright © 2014 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.tcp.sm.provider;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.StreamFeatureProvider;
import org.jivesoftware.smack.tcp.sm.packet.StreamManagement.StreamManagementFeature;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
public class StreamManagementStreamFeatureProvider implements StreamFeatureProvider {
@Override
public PacketExtension parseStreamFeature(XmlPullParser parser)
throws XmlPullParserException {
return StreamManagementFeature.INSTANCE;
}
}

View file

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<smackProviders>
<!-- XEP-0198: Stream Management -->
<streamFeatureProvider>
<elementName>sm</elementName>
<namespace>urn:xmpp:sm:3</namespace>
<className>org.jivesoftware.smack.tcp.sm.provider.StreamManagementStreamFeatureProvider</className>
</streamFeatureProvider>
</smackProviders>