Skip to content

Commit

Permalink
asmack with bosh support (based on niess work)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtreffer committed Feb 3, 2010
1 parent 98e1704 commit f751f01
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 10 deletions.
22 changes: 18 additions & 4 deletions build.bash
Expand Up @@ -24,11 +24,24 @@ fetch() {
)
}

gitfetch() {
(
cd src
if ! [ -f "${2}/.git/config" ]; then
git clone "${1}" "${2}"
else
cd "${2}"
git pull
fi
)
}

fetchall() {
fetch "http://svn.igniterealtime.org/svn/repos/smack/trunk/source/" "smack"
gitfetch "git://github.com/rtreffer/smack.git" "smack"
fetch "http://svn.apache.org/repos/asf/qpid/trunk/qpid/java/management/common/src/main/" "qpid"
fetch "http://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/" "harmony"
fetch "https://dnsjava.svn.sourceforge.net/svnroot/dnsjava/trunk" "dnsjava"
fetch "https://kenai.com/svn/jbosh~main/trunk/jbosh/src/main/java" "jbosh"
}

copyfolder() {
Expand All @@ -48,12 +61,13 @@ buildsrc() {
rm -rf build/src
mkdir build/src
mkdir build/src/trunk
copyfolder "src/smack" "build/src/trunk" "."
copyfolder "src/smack/source/" "build/src/trunk" "."
copyfolder "src/qpid/java" "build/src/trunk" "org/apache/qpid/management/common/sasl"
copyfolder "src/novell-openldap-jldap" "build/src/trunk" "."
copyfolder "src/dnsjava" "build/src/trunk" "org"
copyfolder "src/harmony" "build/src/trunk" "."
copyfolder "src/custom" "build/src/trunk" "."
copyfolder "src/jbosh" "build/src/trunk" "."
}

patchsrc() {
Expand All @@ -62,10 +76,10 @@ patchsrc() {
cd build/src/trunk/
for PATCH in `(cd "../../../${1}" ; find -maxdepth 1 -type f)|sort` ; do
if echo $PATCH | grep '\.sh$'; then
if [ -f "../../../${1}/$PATCH" ]; then "../../../${1}/$PATCH" ; fi
if [ -f "../../../${1}/$PATCH" ]; then "../../../${1}/$PATCH" || exit 1 ; fi
fi
if echo $PATCH | grep '\.patch$'; then
if [ -f "../../../${1}/$PATCH" ]; then patch -p0 < "../../../${1}/$PATCH" ; fi
if [ -f "../../../${1}/$PATCH" ]; then patch -p0 < "../../../${1}/$PATCH" || exit 1 ; fi
fi
done
)
Expand Down
6 changes: 3 additions & 3 deletions patch/30-swtich-debugging-implementations.patch
@@ -1,6 +1,6 @@
--- org/jivesoftware/smack/XMPPConnection.java 2009-12-06 21:02:51.000000000 +0100
+++ ../../src-unpatched/trunk/org/jivesoftware/smack/XMPPConnection.java 2009-12-06 20:59:23.000000000 +0100
@@ -1027,12 +1027,12 @@
--- ../../../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 =
Expand Down
4 changes: 4 additions & 0 deletions patch/32-remove-jbosh-xlightweb.sh
@@ -0,0 +1,4 @@
#!/bin/bash

rm com/kenai/jbosh/XLightWeb*.java

13 changes: 13 additions & 0 deletions patch/buddycloud/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;
39 changes: 39 additions & 0 deletions patch/buddycloud/20-PubSubNode-getAllSubscriptions.patch
@@ -0,0 +1,39 @@
Index: org/jivesoftware/smackx/pubsub/PubSubElementType.java
===================================================================
--- org/jivesoftware/smackx/pubsub/PubSubElementType.java (revision 11464)
+++ org/jivesoftware/smackx/pubsub/PubSubElementType.java (working copy)
@@ -41,6 +41,7 @@
SUBSCRIBE("subscribe", PubSubNamespace.BASIC),
SUBSCRIPTION("subscription", PubSubNamespace.BASIC),
SUBSCRIPTIONS("subscriptions", PubSubNamespace.BASIC),
+ SUBSCRIPTIONS_OWNER("subscriptions", PubSubNamespace.OWNER),
UNSUBSCRIBE("unsubscribe", PubSubNamespace.BASIC);

private String eName;
Index: org/jivesoftware/smackx/pubsub/Node.java
===================================================================
--- org/jivesoftware/smackx/pubsub/Node.java (revision 11464)
+++ org/jivesoftware/smackx/pubsub/Node.java (working copy)
@@ -131,6 +131,22 @@
}

/**
+ * Get all subscriptions currently associated with this node.
+ * This includes foreign jids and uses the #owner namespace.
+ *
+ * @return List of {@link Subscription}
+ *
+ * @trhows XMPPException
+ */
+ public List<Subscription> getAllSubscriptions()
+ throws XMPPException
+ {
+ PubSub reply = (PubSub)sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.SUBSCRIPTIONS_OWNER, getId()), PubSubNamespace.OWNER);
+ SubscriptionsExtension subElem = (SubscriptionsExtension)reply.getExtension(PubSubElementType.SUBSCRIPTIONS_OWNER);
+ return subElem.getSubscriptions();
+ }
+
+ /**
* The user subscribes to the node using the supplied jid. The
* bare jid portion of this one must match the jid for the connection.
*
13 changes: 13 additions & 0 deletions patch/buddycloud/30-PubSubNode-protected-constructor.patch
@@ -0,0 +1,13 @@
Index: org/jivesoftware/smackx/pubsub/Node.java
===================================================================
--- org/jivesoftware/smackx/pubsub/Node.java (revision 11464)
+++ org/jivesoftware/smackx/pubsub/Node.java (working copy)
@@ -48,7 +48,7 @@
* @param connection The connection the node is associated with
* @param nodeName The node id
*/
- Node(Connection connection, String nodeName)
+ protected Node(Connection connection, String nodeName)
{
con = connection;
id = nodeName;
6 changes: 3 additions & 3 deletions src/custom/de/measite/smack/AndroidDebugger.java
Expand Up @@ -3,7 +3,7 @@
import org.jivesoftware.smack.debugger.SmackDebugger;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.*;

Expand All @@ -30,7 +30,7 @@ public class AndroidDebugger implements SmackDebugger {
public static boolean printInterpreted = false;
private SimpleDateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss aaa");

private XMPPConnection connection = null;
private Connection connection = null;

private PacketListener listener = null;
private ConnectionListener connListener = null;
Expand All @@ -40,7 +40,7 @@ public class AndroidDebugger implements SmackDebugger {
private ReaderListener readerListener;
private WriterListener writerListener;

public AndroidDebugger(XMPPConnection connection, Writer writer, Reader reader) {
public AndroidDebugger(Connection connection, Writer writer, Reader reader) {
this.connection = connection;
this.writer = writer;
this.reader = reader;
Expand Down

0 comments on commit f751f01

Please sign in to comment.