diff options
Diffstat (limited to 'asmack-master/patch')
24 files changed, 1020 insertions, 0 deletions
diff --git a/asmack-master/patch/00-relocate-javax.security.sh b/asmack-master/patch/00-relocate-javax.security.sh new file mode 100755 index 0000000..0924208 --- /dev/null +++ b/asmack-master/patch/00-relocate-javax.security.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +mkdir -p org/apache/harmony/ +mv javax org/apache/harmony/ +find org/apache/harmony/ -name '*.java' -exec sed -i 's:package javax:package org.apache.harmony.javax:g' '{}' ';' +find -name '*.java' -exec sed -i 's:import javax.security.sasl:import org.apache.harmony.javax.security.sasl:g' '{}' ';' +find -name '*.java' -exec sed -i 's:import javax.security.auth:import org.apache.harmony.javax.security.auth:g' '{}' ';' + diff --git a/asmack-master/patch/00-remove-javax-dns.sh b/asmack-master/patch/00-remove-javax-dns.sh new file mode 100755 index 0000000..a4f8f23 --- /dev/null +++ b/asmack-master/patch/00-remove-javax-dns.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +rm org/jivesoftware/smack/util/dns/JavaxResolver.java diff --git a/asmack-master/patch/10-remove-unused-harmony.sh b/asmack-master/patch/10-remove-unused-harmony.sh new file mode 100755 index 0000000..ae0b4e3 --- /dev/null +++ b/asmack-master/patch/10-remove-unused-harmony.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +rm -rf org/ietf/ + +rm -rf org/apache/harmony/auth +rm -rf org/apache/harmony/javax/security/auth/kerberos/ +rm -rf org/apache/harmony/javax/security/auth/x500/ + +rm org/apache/harmony/javax/security/auth/Policy.java + diff --git a/asmack-master/patch/11-remove-nls-harmony.sh b/asmack-master/patch/11-remove-nls-harmony.sh new file mode 100755 index 0000000..f1281f5 --- /dev/null +++ b/asmack-master/patch/11-remove-nls-harmony.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +find org/apache/harmony -name '*.java' -exec sed -i 's:import org.apache.harmony.auth.internal.nls.Messages;::' '{}' ';' +find org/apache/harmony -name '*.java' -exec sed -i 's:Messages.getString(\("[^"]*"\)):\1:g' '{}' ';' + diff --git a/asmack-master/patch/12-harmony-nls-msg.patch b/asmack-master/patch/12-harmony-nls-msg.patch new file mode 100644 index 0000000..b201f60 --- /dev/null +++ b/asmack-master/patch/12-harmony-nls-msg.patch @@ -0,0 +1,59 @@ +diff -ur ../../src-unpatched/trunk/org/apache/harmony/javax/security/auth/login/LoginContext.java ./org/apache/harmony/javax/security/auth/login/LoginContext.java +--- ../../src-unpatched/trunk/org/apache/harmony/javax/security/auth/login/LoginContext.java 2009-12-06 15:31:24.000000000 +0100 ++++ ./org/apache/harmony/javax/security/auth/login/LoginContext.java 2009-12-06 15:36:20.000000000 +0100 +@@ -161,7 +161,7 @@ + } + entries = config.getAppConfigurationEntry("other"); //$NON-NLS-1$ + if (entries == null) { +- throw new LoginException(Messages.getString("auth.35", name)); //$NON-NLS-1$ ++ throw new LoginException("auth.35 " + name); //$NON-NLS-1$ + } + } + +@@ -524,8 +524,8 @@ + try { + klass = Class.forName(klassName, false, contextClassLoader); + } catch (ClassNotFoundException ex) { +- throw (LoginException) new LoginException(Messages.getString( +- "auth.39", klassName)).initCause(ex); //$NON-NLS-1$ ++ throw (LoginException) new LoginException( ++ "auth.39 " + klassName).initCause(ex); //$NON-NLS-1$ + } + } + +@@ -533,12 +533,12 @@ + try { + module = (LoginModule) klass.newInstance(); + } catch (IllegalAccessException ex) { +- throw (LoginException) new LoginException(Messages.getString( +- "auth.3A", klassName)) //$NON-NLS-1$ ++ throw (LoginException) new LoginException( ++ "auth.3A " + klassName) //$NON-NLS-1$ + .initCause(ex); + } catch (InstantiationException ex) { +- throw (LoginException) new LoginException(Messages.getString( +- "auth.3A", klassName)) //$NON-NLS-1$ ++ throw (LoginException) new LoginException( ++ "auth.3A" + klassName) //$NON-NLS-1$ + .initCause(ex); + } + module.initialize(subject, callbackHandler, sharedState, entry.getOptions()); +diff -ur ../../src-unpatched/trunk/org/apache/harmony/javax/security/auth/Subject.java ./org/apache/harmony/javax/security/auth/Subject.java +--- ../../src-unpatched/trunk/org/apache/harmony/javax/security/auth/Subject.java 2009-12-06 15:31:24.000000000 +0100 ++++ ./org/apache/harmony/javax/security/auth/Subject.java 2009-12-06 15:32:10.000000000 +0100 +@@ -669,7 +669,7 @@ + + if (!c.isAssignableFrom(o.getClass())) { + throw new IllegalArgumentException( +- Messages.getString("auth.0C", c.getName())); //$NON-NLS-1$ ++ "auth.0C " + c.getName()); //$NON-NLS-1$ + } + + if (elements.contains(o)) { +@@ -779,4 +779,4 @@ + } + } + } +-} +\ No newline at end of file ++} diff --git a/asmack-master/patch/13-mock-configuration.patch b/asmack-master/patch/13-mock-configuration.patch new file mode 100644 index 0000000..ce93b26 --- /dev/null +++ b/asmack-master/patch/13-mock-configuration.patch @@ -0,0 +1,33 @@ +diff -ur ../../src-unpatched/trunk/org/apache/harmony/javax/security/auth/login/Configuration.java ./org/apache/harmony/javax/security/auth/login/Configuration.java +--- ../../src-unpatched/trunk/org/apache/harmony/javax/security/auth/login/Configuration.java 2009-12-06 18:40:25.000000000 +0100 ++++ ./org/apache/harmony/javax/security/auth/login/Configuration.java 2009-12-06 18:44:23.000000000 +0100 +@@ -20,8 +20,6 @@ + import java.security.AccessController; + import org.apache.harmony.javax.security.auth.AuthPermission; + +-import org.apache.harmony.security.fortress.PolicyUtils; +- + public abstract class Configuration { + + // the current configuration +@@ -56,8 +54,18 @@ + * exception, wraps it with SecurityException and throws further. + */ + private static final Configuration getDefaultProvider() { +- return AccessController.doPrivileged(new PolicyUtils.ProviderLoader<Configuration>( +- LOGIN_CONFIGURATION_PROVIDER, Configuration.class)); ++ return new Configuration() { ++ ++ @Override ++ public void refresh() { ++ } ++ ++ @Override ++ public AppConfigurationEntry[] getAppConfigurationEntry( ++ String applicationName) { ++ return new AppConfigurationEntry[0]; ++ } ++ }; + } + + /** diff --git a/asmack-master/patch/20-remove-mxparser.sh b/asmack-master/patch/20-remove-mxparser.sh new file mode 100755 index 0000000..c1d6318 --- /dev/null +++ b/asmack-master/patch/20-remove-mxparser.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +find org/jivesoftware -name '*.java' -exec sed -i 's:import org.xmlpull.mxp1.MXParser:import org.xmlpull.v1.XmlPullParserFactory:' '{}' ';' +find org/jivesoftware -name '*.java' -exec sed -i 's:new MXParser():XmlPullParserFactory.newInstance().newPullParser():g' '{}' ';' + diff --git a/asmack-master/patch/21-remove-unused-smack.sh b/asmack-master/patch/21-remove-unused-smack.sh new file mode 100755 index 0000000..078ff04 --- /dev/null +++ b/asmack-master/patch/21-remove-unused-smack.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +rm org/jivesoftware/smack/debugger/LiteDebugger.java +rm org/jivesoftware/smackx/debugger/EnhancedDebugger.java +rm org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java + diff --git a/asmack-master/patch/22-remove-beans.Property-deps.patch b/asmack-master/patch/22-remove-beans.Property-deps.patch new file mode 100644 index 0000000..8653716 --- /dev/null +++ b/asmack-master/patch/22-remove-beans.Property-deps.patch @@ -0,0 +1,30 @@ +--- ../../src-unpatched/trunk/org/jivesoftware/smack/util/PacketParserUtils.java 2009-12-06 19:45:45.000000000 +0100 ++++ org/jivesoftware/smack/util/PacketParserUtils.java 2009-12-06 19:48:13.000000000 +0100 +@@ -25,7 +25,6 @@ + import org.jivesoftware.smack.provider.ProviderManager; + import org.xmlpull.v1.XmlPullParser; + +-import java.beans.PropertyDescriptor; + import java.io.ByteArrayInputStream; + import java.io.ObjectInputStream; + import java.util.ArrayList; +@@ -828,14 +827,14 @@ + if (eventType == XmlPullParser.START_TAG) { + String name = parser.getName(); + String stringValue = parser.nextText(); +- PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass); +- // Load the class type of the property. +- Class<?> propertyType = descriptor.getPropertyType(); ++ Class propertyType = object.getClass().getMethod( ++ "get" + Character.toUpperCase(name.charAt(0)) + name.substring(1)).getReturnType(); + // Get the value of the property by converting it from a + // String to the correct object type. + Object value = decode(propertyType, stringValue); + // Set the value of the bean. +- descriptor.getWriteMethod().invoke(object, value); ++ object.getClass().getMethod("set" + Character.toUpperCase(name.charAt(0)) + name.substring(1), propertyType) ++ .invoke(object, value); + } + else if (eventType == XmlPullParser.END_TAG) { + if (parser.getName().equals(elementName)) { + diff --git a/asmack-master/patch/23-strip-unused-xml-transform.patch b/asmack-master/patch/23-strip-unused-xml-transform.patch new file mode 100644 index 0000000..24debbd --- /dev/null +++ b/asmack-master/patch/23-strip-unused-xml-transform.patch @@ -0,0 +1,50 @@ +--- org/jivesoftware/smackx/pubsub/util/XmlUtils.java 2012-06-05 14:35:54.518687907 +0200 ++++ org/jivesoftware/smackx/pubsub/util/XmlUtils.java 2012-06-05 21:07:13.038946699 +0200 +@@ -14,47 +14,15 @@ + package org.jivesoftware.smackx.pubsub.util;
+
+ import java.io.StringReader;
+
+-import javax.xml.transform.OutputKeys;
+-import javax.xml.transform.Transformer;
+-import javax.xml.transform.TransformerFactory;
+-import javax.xml.transform.stream.StreamResult;
+-import javax.xml.transform.stream.StreamSource;
+-
+ /**
+ * Simple utility for pretty printing xml.
+ *
+ * @author Robin Collier
+ */
+ public class XmlUtils
+ {
+- /**
+- *
+- * @param header Just a title for the stanza for readability. Single word no spaces since
+- * it is inserted as the root element in the output.
+- * @param xml The string to pretty print
+- */
+- static public void prettyPrint(String header, String xml)
+- {
+- try
+- {
+- Transformer transformer = TransformerFactory.newInstance().newTransformer();
+- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
+-
+- if (header != null)
+- {
+- xml = "\n<" + header + ">" + xml + "</" + header + '>';
+- }
+- transformer.transform(new StreamSource(new StringReader(xml)), new StreamResult(System.out));
+- }
+- catch (Exception e)
+- {
+- System.out.println("Something wrong with xml in \n---------------\n" + xml + "\n---------------");
+- e.printStackTrace();
+- }
+- }
+
+ static public void appendAttribute(StringBuilder builder, String att, String value)
+ {
+ builder.append(" ");
diff --git a/asmack-master/patch/24-disable-sasl-methods.patch b/asmack-master/patch/24-disable-sasl-methods.patch new file mode 100644 index 0000000..eda5eb0 --- /dev/null +++ b/asmack-master/patch/24-disable-sasl-methods.patch @@ -0,0 +1,20 @@ +--- ../../src-unpatched/trunk/org/jivesoftware/smack/SASLAuthentication.java 2009-12-07 00:03:46.000000000 +0100 ++++ org/jivesoftware/smack/SASLAuthentication.java 2009-12-07 00:05:46.000000000 +0100 +@@ -91,11 +91,11 @@ + registerSASLMechanism("PLAIN", SASLPlainMechanism.class);
+ registerSASLMechanism("ANONYMOUS", SASLAnonymous.class);
+
+- supportSASLMechanism("GSSAPI",0);
+- supportSASLMechanism("DIGEST-MD5",1);
+- supportSASLMechanism("CRAM-MD5",2);
+- supportSASLMechanism("PLAIN",3);
+- supportSASLMechanism("ANONYMOUS",4);
++// supportSASLMechanism("GSSAPI",0);
++ supportSASLMechanism("DIGEST-MD5",0);
++// supportSASLMechanism("CRAM-MD5",2);
++ supportSASLMechanism("PLAIN",1);
++ supportSASLMechanism("ANONYMOUS",2);
+
+ }
+
+ diff --git a/asmack-master/patch/30-switch-debugging-implementations.patch b/asmack-master/patch/30-switch-debugging-implementations.patch new file mode 100644 index 0000000..93be2a0 --- /dev/null +++ b/asmack-master/patch/30-switch-debugging-implementations.patch @@ -0,0 +1,17 @@ +--- ../../../src/smack/org/jivesoftware/smack/Connection.java 2010-02-03 23:29:21.000000000 +0100 ++++ org/jivesoftware/smack/Connection.java 2010-02-03 23:56:56.000000000 +0100 +@@ -743,12 +743,12 @@ + if (debuggerClass == null) { + try { + debuggerClass = +- Class.forName("org.jivesoftware.smackx.debugger.EnhancedDebugger"); ++ Class.forName("de.measite.smack.AndroidDebugger"); + } + catch (Exception ex) { + try { + debuggerClass = +- Class.forName("org.jivesoftware.smack.debugger.LiteDebugger"); ++ Class.forName("org.jivesoftware.smack.debugger.ConsoleDebugger"); + } + catch (Exception ex2) { + ex2.printStackTrace(); diff --git a/asmack-master/patch/31-remove-dns-wrapper.sh b/asmack-master/patch/31-remove-dns-wrapper.sh new file mode 100755 index 0000000..c8c5ede --- /dev/null +++ b/asmack-master/patch/31-remove-dns-wrapper.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +rm org/xbill/DNS/spi/DNSJavaNameServiceDescriptor.java + diff --git a/asmack-master/patch/32-remove-jbosh-xlightweb.sh b/asmack-master/patch/32-remove-jbosh-xlightweb.sh new file mode 100755 index 0000000..53ad364 --- /dev/null +++ b/asmack-master/patch/32-remove-jbosh-xlightweb.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +rm com/kenai/jbosh/XLightWeb*.java + diff --git a/asmack-master/patch/33-jbosh-android.patch b/asmack-master/patch/33-jbosh-android.patch new file mode 100644 index 0000000..33a9b7d --- /dev/null +++ b/asmack-master/patch/33-jbosh-android.patch @@ -0,0 +1,446 @@ +diff --git com/kenai/jbosh/ApacheHTTPResponse.java com/kenai/jbosh/ApacheHTTPResponse.java +new file mode 100644 +index 0000000..9f6731f +--- /dev/null ++++ com/kenai/jbosh/ApacheHTTPResponse.java +@@ -0,0 +1,253 @@ ++/* ++ * Copyright 2009 Guenther Niess ++ * ++ * 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 com.kenai.jbosh; ++ ++import java.io.IOException; ++import java.util.concurrent.locks.Lock; ++import java.util.concurrent.locks.ReentrantLock; ++ ++import org.apache.http.HttpEntity; ++import org.apache.http.HttpResponse; ++import org.apache.http.client.HttpClient; ++import org.apache.http.client.methods.HttpPost; ++import org.apache.http.entity.ByteArrayEntity; ++ ++import org.apache.http.protocol.BasicHttpContext; ++import org.apache.http.protocol.HttpContext; ++import org.apache.http.util.EntityUtils; ++ ++final class ApacheHTTPResponse implements HTTPResponse { ++ ++ /////////////////////////////////////////////////////////////////////////// ++ // Constants: ++ ++ /** ++ * Name of the accept encoding header. ++ */ ++ private static final String ACCEPT_ENCODING = "Accept-Encoding"; ++ ++ /** ++ * Value to use for the ACCEPT_ENCODING header. ++ */ ++ private static final String ACCEPT_ENCODING_VAL = ++ ZLIBCodec.getID() + ", " + GZIPCodec.getID(); ++ ++ /** ++ * Name of the character set to encode the body to/from. ++ */ ++ private static final String CHARSET = "UTF-8"; ++ ++ /** ++ * Content type to use when transmitting the body data. ++ */ ++ private static final String CONTENT_TYPE = "text/xml; charset=utf-8"; ++ ++ /////////////////////////////////////////////////////////////////////////// ++ // Class variables: ++ ++ /** ++ * Lock used for internal synchronization. ++ */ ++ private final Lock lock = new ReentrantLock(); ++ ++ /** ++ * The execution state of an HTTP process. ++ */ ++ private final HttpContext context; ++ ++ /** ++ * HttpClient instance to use to communicate. ++ */ ++ private final HttpClient client; ++ ++ /** ++ * The HTTP POST request is sent to the server. ++ */ ++ private final HttpPost post; ++ ++ /** ++ * A flag which indicates if the transmission was already done. ++ */ ++ private boolean sent; ++ ++ /** ++ * Exception to throw when the response data is attempted to be accessed, ++ * or {@code null} if no exception should be thrown. ++ */ ++ private BOSHException toThrow; ++ ++ /** ++ * The response body which was received from the server or {@code null} ++ * if that has not yet happened. ++ */ ++ private AbstractBody body; ++ ++ /** ++ * The HTTP response status code. ++ */ ++ private int statusCode; ++ ++ /////////////////////////////////////////////////////////////////////////// ++ // Constructors: ++ ++ /** ++ * Create and send a new request to the upstream connection manager, ++ * providing deferred access to the results to be returned. ++ * ++ * @param client client instance to use when sending the request ++ * @param cfg client configuration ++ * @param params connection manager parameters from the session creation ++ * response, or {@code null} if the session has not yet been established ++ * @param request body of the client request ++ */ ++ ApacheHTTPResponse( ++ final HttpClient client, ++ final BOSHClientConfig cfg, ++ final CMSessionParams params, ++ final AbstractBody request) { ++ super(); ++ this.client = client; ++ this.context = new BasicHttpContext(); ++ this.post = new HttpPost(cfg.getURI().toString()); ++ this.sent = false; ++ ++ try { ++ String xml = request.toXML(); ++ byte[] data = xml.getBytes(CHARSET); ++ ++ String encoding = null; ++ if (cfg.isCompressionEnabled() && params != null) { ++ AttrAccept accept = params.getAccept(); ++ if (accept != null) { ++ if (accept.isAccepted(ZLIBCodec.getID())) { ++ encoding = ZLIBCodec.getID(); ++ data = ZLIBCodec.encode(data); ++ } else if (accept.isAccepted(GZIPCodec.getID())) { ++ encoding = GZIPCodec.getID(); ++ data = GZIPCodec.encode(data); ++ } ++ } ++ } ++ ++ ByteArrayEntity entity = new ByteArrayEntity(data); ++ entity.setContentType(CONTENT_TYPE); ++ if (encoding != null) { ++ entity.setContentEncoding(encoding); ++ } ++ post.setEntity(entity); ++ if (cfg.isCompressionEnabled()) { ++ post.setHeader(ACCEPT_ENCODING, ACCEPT_ENCODING_VAL); ++ } ++ } catch (Exception e) { ++ toThrow = new BOSHException("Could not generate request", e); ++ } ++ } ++ ++ /////////////////////////////////////////////////////////////////////////// ++ // HTTPResponse interface methods: ++ ++ /** ++ * Abort the client transmission and response processing. ++ */ ++ public void abort() { ++ if (post != null) { ++ post.abort(); ++ toThrow = new BOSHException("HTTP request aborted"); ++ } ++ } ++ ++ /** ++ * Wait for and then return the response body. ++ * ++ * @return body of the response ++ * @throws InterruptedException if interrupted while awaiting the response ++ * @throws BOSHException on communication failure ++ */ ++ public AbstractBody getBody() throws InterruptedException, BOSHException { ++ if (toThrow != null) { ++ throw(toThrow); ++ } ++ lock.lock(); ++ try { ++ if (!sent) { ++ awaitResponse(); ++ } ++ } finally { ++ lock.unlock(); ++ } ++ return body; ++ } ++ ++ /** ++ * Wait for and then return the response HTTP status code. ++ * ++ * @return HTTP status code of the response ++ * @throws InterruptedException if interrupted while awaiting the response ++ * @throws BOSHException on communication failure ++ */ ++ public int getHTTPStatus() throws InterruptedException, BOSHException { ++ if (toThrow != null) { ++ throw(toThrow); ++ } ++ lock.lock(); ++ try { ++ if (!sent) { ++ awaitResponse(); ++ } ++ } finally { ++ lock.unlock(); ++ } ++ return statusCode; ++ } ++ ++ /////////////////////////////////////////////////////////////////////////// ++ // Package-private methods: ++ ++ /** ++ * Await the response, storing the result in the instance variables of ++ * this class when they arrive. ++ * ++ * @throws InterruptedException if interrupted while awaiting the response ++ * @throws BOSHException on communication failure ++ */ ++ private synchronized void awaitResponse() throws BOSHException { ++ HttpEntity entity = null; ++ try { ++ HttpResponse httpResp = client.execute(post, context); ++ entity = httpResp.getEntity(); ++ byte[] data = EntityUtils.toByteArray(entity); ++ String encoding = entity.getContentEncoding() != null ? ++ entity.getContentEncoding().getValue() : ++ null; ++ if (ZLIBCodec.getID().equalsIgnoreCase(encoding)) { ++ data = ZLIBCodec.decode(data); ++ } else if (GZIPCodec.getID().equalsIgnoreCase(encoding)) { ++ data = GZIPCodec.decode(data); ++ } ++ body = StaticBody.fromString(new String(data, CHARSET)); ++ statusCode = httpResp.getStatusLine().getStatusCode(); ++ sent = true; ++ } catch (IOException iox) { ++ abort(); ++ toThrow = new BOSHException("Could not obtain response", iox); ++ throw(toThrow); ++ } catch (RuntimeException ex) { ++ abort(); ++ throw(ex); ++ } ++ } ++} +diff --git com/kenai/jbosh/ApacheHTTPSender.java com/kenai/jbosh/ApacheHTTPSender.java +new file mode 100644 +index 0000000..2abb4ee +--- /dev/null ++++ com/kenai/jbosh/ApacheHTTPSender.java +@@ -0,0 +1,156 @@ ++/* ++ * Copyright 2009 Guenther Niess ++ * ++ * 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 com.kenai.jbosh; ++ ++import java.util.concurrent.locks.Lock; ++import java.util.concurrent.locks.ReentrantLock; ++ ++import org.apache.http.HttpHost; ++import org.apache.http.HttpVersion; ++import org.apache.http.client.HttpClient; ++import org.apache.http.conn.ClientConnectionManager; ++import org.apache.http.conn.params.ConnManagerParams; ++import org.apache.http.conn.params.ConnRoutePNames; ++import org.apache.http.conn.scheme.PlainSocketFactory; ++import org.apache.http.conn.scheme.Scheme; ++import org.apache.http.conn.scheme.SchemeRegistry; ++import org.apache.http.conn.ssl.SSLSocketFactory; ++import org.apache.http.impl.client.DefaultHttpClient; ++import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; ++import org.apache.http.params.BasicHttpParams; ++import org.apache.http.params.HttpParams; ++import org.apache.http.params.HttpProtocolParams; ++ ++/** ++ * Implementation of the {@code HTTPSender} interface which uses the ++ * Apache HttpClient API to send messages to the connection manager. ++ */ ++final class ApacheHTTPSender implements HTTPSender { ++ ++ /** ++ * Lock used for internal synchronization. ++ */ ++ private final Lock lock = new ReentrantLock(); ++ ++ /** ++ * Session configuration. ++ */ ++ private BOSHClientConfig cfg; ++ ++ /** ++ * HttpClient instance to use to communicate. ++ */ ++ private HttpClient httpClient; ++ ++ /////////////////////////////////////////////////////////////////////////// ++ // Constructors: ++ ++ /** ++ * Prevent construction apart from our package. ++ */ ++ ApacheHTTPSender() { ++ // Load Apache HTTP client class ++ HttpClient.class.getName(); ++ } ++ ++ /////////////////////////////////////////////////////////////////////////// ++ // HTTPSender interface methods: ++ ++ /** ++ * {@inheritDoc} ++ */ ++ public void init(final BOSHClientConfig session) { ++ lock.lock(); ++ try { ++ cfg = session; ++ httpClient = initHttpClient(session); ++ } finally { ++ lock.unlock(); ++ } ++ } ++ ++ /** ++ * {@inheritDoc} ++ */ ++ public void destroy() { ++ lock.lock(); ++ try { ++ if (httpClient != null) { ++ httpClient.getConnectionManager().shutdown(); ++ } ++ } finally { ++ cfg = null; ++ httpClient = null; ++ lock.unlock(); ++ } ++ } ++ ++ /** ++ * {@inheritDoc} ++ */ ++ public HTTPResponse send( ++ final CMSessionParams params, ++ final AbstractBody body) { ++ HttpClient mClient; ++ BOSHClientConfig mCfg; ++ lock.lock(); ++ try { ++ if (httpClient == null) { ++ httpClient = initHttpClient(cfg); ++ } ++ mClient = httpClient; ++ mCfg = cfg; ++ } finally { ++ lock.unlock(); ++ } ++ return new ApacheHTTPResponse(mClient, mCfg, params, body); ++ } ++ ++ /////////////////////////////////////////////////////////////////////////// ++ // Package-private methods: ++ ++ private synchronized HttpClient initHttpClient(final BOSHClientConfig config) { ++ // Create and initialize HTTP parameters ++ HttpParams params = new BasicHttpParams(); ++ ConnManagerParams.setMaxTotalConnections(params, 100); ++ HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); ++ HttpProtocolParams.setUseExpectContinue(params, false); ++ if (config != null && ++ config.getProxyHost() != null && ++ config.getProxyPort() != 0) { ++ HttpHost proxy = new HttpHost( ++ config.getProxyHost(), ++ config.getProxyPort()); ++ params.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); ++ } ++ ++ // Create and initialize scheme registry ++ SchemeRegistry schemeRegistry = new SchemeRegistry(); ++ schemeRegistry.register( ++ new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); ++ SSLSocketFactory sslFactory = SSLSocketFactory.getSocketFactory(); ++ sslFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); ++ schemeRegistry.register( ++ new Scheme("https", sslFactory, 443)); ++ ++ // Create an HttpClient with the ThreadSafeClientConnManager. ++ // This connection manager must be used if more than one thread will ++ // be using the HttpClient. ++ ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry); ++ return new DefaultHttpClient(cm, params); ++ } ++} +diff --git com/kenai/jbosh/BodyParserXmlPull.java com/kenai/jbosh/BodyParserXmlPull.java +index cc95236..5f23b06 100644 +--- com/kenai/jbosh/BodyParserXmlPull.java ++++ com/kenai/jbosh/BodyParserXmlPull.java +@@ -22,7 +22,6 @@ import java.lang.ref.SoftReference; + import java.util.logging.Level; + import java.util.logging.Logger; + import javax.xml.XMLConstants; +-import javax.xml.namespace.QName; + import org.xmlpull.v1.XmlPullParser; + import org.xmlpull.v1.XmlPullParserException; + import org.xmlpull.v1.XmlPullParserFactory; +diff --git com/kenai/jbosh/BodyQName.java com/kenai/jbosh/BodyQName.java +index fc7ab0c..83acdf1 100644 +--- com/kenai/jbosh/BodyQName.java ++++ com/kenai/jbosh/BodyQName.java +@@ -16,8 +16,6 @@ + + package com.kenai.jbosh; + +-import javax.xml.namespace.QName; +- + /** + * Qualified name of an attribute of the wrapper element. This class is + * analagous to the {@code javax.xml.namespace.QName} class. diff --git a/asmack-master/patch/34-pin-jbosh-http-sender.patch b/asmack-master/patch/34-pin-jbosh-http-sender.patch new file mode 100644 index 0000000..daf96df --- /dev/null +++ b/asmack-master/patch/34-pin-jbosh-http-sender.patch @@ -0,0 +1,11 @@ +--- com/kenai/jbosh/BOSHClient.java 2010-01-13 20:57:36.000000000 +0100 ++++ com/kenai/jbosh/BOSHClient.java 2010-02-04 17:40:45.678169320 +0100 +@@ -232,7 +232,7 @@ + * HTTPSender instance. + */ + private final HTTPSender httpSender = +- ServiceLib.loadService(HTTPSender.class); ++ new ApacheHTTPSender(); + + /** + * Storage for test hook implementation. diff --git a/asmack-master/patch/35-pin-jbosh-boddy-parser.patch b/asmack-master/patch/35-pin-jbosh-boddy-parser.patch new file mode 100644 index 0000000..f4c63e8 --- /dev/null +++ b/asmack-master/patch/35-pin-jbosh-boddy-parser.patch @@ -0,0 +1,11 @@ +--- com/kenai/jbosh/StaticBody.java 2010-01-13 20:57:36.000000000 +0100 ++++ com/kenai/jbosh/StaticBody.java 2010-02-04 17:59:06.037770746 +0100 +@@ -42,7 +42,7 @@ + * Selected parser to be used to process raw XML messages. + */ + private static final BodyParser PARSER = +- ServiceLib.loadService(BodyParser.class); ++ new BodyParserXmlPull(); + + /** + * Size of the internal buffer when copying from a stream. diff --git a/asmack-master/patch/40-enable-custom-sasl.sh b/asmack-master/patch/40-enable-custom-sasl.sh new file mode 100755 index 0000000..476bd5b --- /dev/null +++ b/asmack-master/patch/40-enable-custom-sasl.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +find -name '*.java' -exec sed -i 's:import org.apache.harmony.javax.security.sasl.Sasl;:import de.measite.smack.Sasl;:g' '{}' ';' + diff --git a/asmack-master/patch/41-fix-digest-md5.patch b/asmack-master/patch/41-fix-digest-md5.patch new file mode 100644 index 0000000..5f7f1dc --- /dev/null +++ b/asmack-master/patch/41-fix-digest-md5.patch @@ -0,0 +1,13 @@ +--- ../../src-unpatched/trunk/com/novell/sasl/client/DigestMD5SaslClient.java 2009-12-07 19:14:10.000000000 +0100 ++++ com/novell/sasl/client/DigestMD5SaslClient.java 2009-12-07 19:19:07.000000000 +0100 +@@ -673,8 +673,8 @@ + digestResponse.append("00000001"); //nounce count + digestResponse.append(",qop="); + digestResponse.append(m_qopValue); +- digestResponse.append(",digest-uri=\"ldap/"); +- digestResponse.append(m_serverName); ++ digestResponse.append(",digest-uri=\""); ++ digestResponse.append(m_digestURI); + digestResponse.append("\",response="); + digestResponse.append(response); + digestResponse.append(",charset=utf-8,nonce=\""); diff --git a/asmack-master/patch/beem/10-PubSubManager-non-final.patch b/asmack-master/patch/beem/10-PubSubManager-non-final.patch new file mode 100644 index 0000000..4fca228 --- /dev/null +++ b/asmack-master/patch/beem/10-PubSubManager-non-final.patch @@ -0,0 +1,13 @@ +Index: org/jivesoftware/smackx/pubsub/PubSubManager.java +=================================================================== +--- org/jivesoftware/smackx/pubsub/PubSubManager.java (revision 11464) ++++ org/jivesoftware/smackx/pubsub/PubSubManager.java (working copy) +@@ -41,7 +41,7 @@ + *
+ * @author Robin Collier
+ */
+-final public class PubSubManager
++public class PubSubManager
+ {
+ private XMPPConnection con;
+ private String to;
diff --git a/asmack-master/patch/beem/50-improved-pubsub.patch b/asmack-master/patch/beem/50-improved-pubsub.patch new file mode 100644 index 0000000..a3704e7 --- /dev/null +++ b/asmack-master/patch/beem/50-improved-pubsub.patch @@ -0,0 +1,46 @@ +--- ../../../src/smack/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java (révision 11644) ++++ org/jivesoftware/smackx/pubsub/provider/ItemProvider.java (copie de travail) +@@ -45,6 +45,8 @@ + }
+ else
+ {
++ while (tag != XmlPullParser.START_TAG)
++ tag = parser.next();
+ String payloadElemName = parser.getName();
+ String payloadNS = parser.getNamespace();
+
+--- ../../../src/org/jivesoftware/smackx/pubsub/Node.java (révision 11644) ++++ org/jivesoftware/smackx/pubsub/Node.java (copie de travail) +@@ -60,7 +60,7 @@ + *
+ * For example, OpenFire requires the server to be prefixed by <b>pubsub</b>
+ */
+- void setTo(String toAddress)
++ public void setTo(String toAddress)
+ {
+ to = toAddress;
+ }
+--- ../../../src/org/jivesoftware/smackx/pubsub/LeafNode.java (révision 11644) ++++ org/jivesoftware/smackx/pubsub/LeafNode.java (copie de travail) +@@ -34,7 +34,7 @@ + */
+ public class LeafNode extends Node
+ {
+- LeafNode(Connection connection, String nodeName)
++ public LeafNode(Connection connection, String nodeName)
+ {
+ super(connection, nodeName);
+ }
+--- ../../../src/org/jivesoftware/smackx/pubsub/PubSubManager.java (révision 11644) ++++ org/jivesoftware/smackx/pubsub/PubSubManager.java (copie de travail) +@@ -43,8 +43,8 @@ + */
+ final public class PubSubManager
+ {
+- private Connection con;
+- private String to;
++ protected Connection con;
++ protected String to;
+ private Map<String, Node> nodeMap = new ConcurrentHashMap<String, Node>();
+
+ /**
diff --git a/asmack-master/patch/beem/COPYING b/asmack-master/patch/beem/COPYING new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/asmack-master/patch/beem/COPYING @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/asmack-master/patch/beem/README.txt b/asmack-master/patch/beem/README.txt new file mode 100644 index 0000000..ce58c89 --- /dev/null +++ b/asmack-master/patch/beem/README.txt @@ -0,0 +1,9 @@ +This directory contains different patch to apply on asmack sources. These +patches will allow us to build a custom flavour of asmack for Beem. This +directory must be copied in the patch directory of asmack in order to be used. +Then build asmack the usual way. + +All the patches are released under the Apache License, Version 2.0 +You may obtain a copy of the License at +http://www.apache.org.licenses/LICENCE-2.0 + diff --git a/asmack-master/patch/oldpatch/45-protected-xmpp-socket.patch b/asmack-master/patch/oldpatch/45-protected-xmpp-socket.patch new file mode 100644 index 0000000..72f2d97 --- /dev/null +++ b/asmack-master/patch/oldpatch/45-protected-xmpp-socket.patch @@ -0,0 +1,11 @@ +--- org/jivesoftware/smack/XMPPConnection.java 2010-02-13 11:13:16.478541616 +0100 ++++ org/jivesoftware/smack/XMPPConnection.java 2010-02-13 11:58:49.798590947 +0100 +@@ -55,7 +55,7 @@ + /** + * The socket which is used for this connection. + */ +- Socket socket; ++ protected Socket socket; + + String connectionID = null; + private String user = null; |