--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/asmack-beem/beem_patches/50-improved-pubsub.patch Tue Oct 26 00:30:38 2010 +0200
@@ -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>();
+
+ /**
Binary file libs/asmack-android-7-beem.jar has changed
--- a/src/com/beem/project/beem/smack/avatar/XmppAvatarRetriever.java Tue Oct 05 23:53:21 2010 +0200
+++ b/src/com/beem/project/beem/smack/avatar/XmppAvatarRetriever.java Tue Oct 26 00:30:38 2010 +0200
@@ -47,24 +47,24 @@
import java.util.Arrays;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smackx.pubsub.PubSubManager;
-import org.jivesoftware.smackx.pubsub.Node;
import org.jivesoftware.smackx.pubsub.LeafNode;
import org.jivesoftware.smackx.pubsub.Item;
import org.jivesoftware.smackx.pubsub.PayloadItem;
+import com.beem.project.beem.smack.pep.PepSubManager;
+
/**
* An AvatarRetriever which retrieve the avatar over the XMPP connection.
*/
public class XmppAvatarRetriever implements AvatarRetriever {
private static String AVATARDATANODE = "urn:xmpp:avatar:data";
- private PubSubManager mPubsub;
+ private PepSubManager mPubsub;
private String mFrom;
private String mId;
public XmppAvatarRetriever(final Connection con, final String from, final String id) {
- mPubsub = new PubSubManager(con, from);
+ mPubsub = new PepSubManager(con, from);
mFrom = from;
mId = id;
}
@@ -72,19 +72,14 @@
@Override
public byte[] getAvatar() {
try {
- Node node = mPubsub.getNode(AVATARDATANODE);
- if (node instanceof LeafNode) {
- LeafNode lnode = (LeafNode) node;
- List<Item> items = lnode.getItems(Arrays.asList(mId));
- // TODO the rest ^^
- PayloadItem<AvatarExtension> item = (PayloadItem<AvatarExtension>) items.get(0);
- AvatarExtension avatar = item.getPayload();
- return avatar.getData();
- }
+ LeafNode node = mPubsub.getPEPNode(AVATARDATANODE);
+ List<Item> items = node.getItems(Arrays.asList(mId));
+ PayloadItem<AvatarExtension> item = (PayloadItem<AvatarExtension>) items.get(0);
+ AvatarExtension avatar = item.getPayload();
+ return avatar.getData();
} catch (XMPPException e) {
return null;
}
- return null;
}
}
--- a/src/com/beem/project/beem/smack/pep/PepSubManager.java Tue Oct 05 23:53:21 2010 +0200
+++ b/src/com/beem/project/beem/smack/pep/PepSubManager.java Tue Oct 26 00:30:38 2010 +0200
@@ -56,6 +56,7 @@
import org.jivesoftware.smackx.pubsub.Item;
import org.jivesoftware.smackx.pubsub.ItemsExtension;
import org.jivesoftware.smackx.pubsub.PubSubManager;
+import org.jivesoftware.smackx.pubsub.LeafNode;
/**
* Little extension of {@link PubSubManager} which allows to add {@link PEPListener}.
@@ -106,6 +107,12 @@
mPepListeners.remove(listener);
}
+ public LeafNode getPEPNode(String nodeName) {
+ LeafNode node = new LeafNode(con, nodeName);
+ node.setTo(to);
+ return node;
+ }
+
/**
* Initialize the PepSubManager.
*