--- a/src/com/beem/project/beem/BeemService.java Tue Oct 26 00:41:03 2010 +0200
+++ b/src/com/beem/project/beem/BeemService.java Tue Oct 26 00:59:27 2010 +0200
@@ -61,7 +61,6 @@
import org.jivesoftware.smackx.pubsub.provider.ItemsProvider;
import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
import org.jivesoftware.smackx.pubsub.provider.EventProvider;
-import org.jivesoftware.smackx.provider.PEPProvider;
import android.app.Notification;
import android.app.NotificationManager;
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Tue Oct 26 00:41:03 2010 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Tue Oct 26 00:59:27 2010 +0200
@@ -56,7 +56,6 @@
import org.jivesoftware.smackx.ChatStateManager;
import org.jivesoftware.smackx.ServiceDiscoveryManager;
import org.jivesoftware.smackx.packet.DiscoverInfo;
-import org.jivesoftware.smackx.pubsub.PayloadItem;
import android.app.Notification;
import android.app.PendingIntent;
@@ -82,7 +81,6 @@
import com.beem.project.beem.ui.Subscription;
import com.beem.project.beem.utils.BeemBroadcastReceiver;
import com.beem.project.beem.utils.Status;
-import com.beem.project.beem.smack.avatar.AvatarMetadataExtension;
import com.beem.project.beem.smack.avatar.AvatarCache;
import com.beem.project.beem.smack.avatar.FileAvatarCache;
import com.beem.project.beem.smack.avatar.AvatarManager;
@@ -251,17 +249,6 @@
}
}
- private void testPEP() {
- Log.d(TAG, "TEST PEP activate");
- AvatarMetadataExtension meta = new AvatarMetadataExtension();
- AvatarMetadataExtension.Info info = new AvatarMetadataExtension.Info("test", "image/png", 5);
- info.setUrl("http://elyzion.net/img.png");
- meta.addInfo(info);
- PayloadItem<AvatarMetadataExtension> item = new PayloadItem<AvatarMetadataExtension>("test", meta);
- // pmgr.publish(item, "urn:xmpp:avatar:data");
- Log.d(TAG, "END TEST PEP ");
- }
-
/**
* {@inheritDoc}
*/
@@ -502,7 +489,6 @@
cacheDir = new File(cacheDir, "/Android/data/com.beem.project.beem/cache/");
AvatarCache avatarCache = new FileAvatarCache(cacheDir);
new AvatarManager(mAdaptee, avatarCache, true);
- testPEP();
}
/**
--- a/src/com/beem/project/beem/smack/avatar/AvatarExtension.java Tue Oct 26 00:41:03 2010 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarExtension.java Tue Oct 26 00:59:27 2010 +0200
@@ -57,6 +57,7 @@
/**
* Create an AvatarExtension.
+ * @param base64 the data of the avatar as a base64 string
*/
public AvatarExtension(final String base64) {
mData = base64;
@@ -64,6 +65,7 @@
/**
* Create an AvatarExtension.
+ * @param data the data of the avatar
*/
public AvatarExtension(final byte[] data) {
mData = Base64.encodeBytes(data);
--- a/src/com/beem/project/beem/smack/avatar/AvatarManager.java Tue Oct 26 00:41:03 2010 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarManager.java Tue Oct 26 00:59:27 2010 +0200
@@ -43,8 +43,6 @@
*/
package com.beem.project.beem.smack.avatar;
-import android.util.Log;
-
import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
import com.beem.project.beem.smack.pep.PEPListener;
import com.beem.project.beem.smack.pep.PepSubManager;
@@ -78,7 +76,6 @@
* @param autoDownload true to enable auto download of avatars
*/
public AvatarManager(final Connection con, final AvatarCache cache, final boolean autoDownload) {
- Log.d("AvatarMgr", "creation");
mCon = con;
mPep = new PepSubManager(mCon);
mAutoDownload = autoDownload;
@@ -126,7 +123,8 @@
// TODO check the hash before store
mCache.put(info.getId(), avatar);
} catch (IOException e) {
- Log.d("AvatarMgr", "Error while downloading avatar", e);
+ System.err.println("Error while downloading avatar");
+ e.printStackTrace();
}
}
@@ -143,13 +141,11 @@
@Override
public void eventReceived(String from, String node, List<Item> items) {
- Log.d("AvatarMgr", "Received pep event ");
Item i = items.get(0);
if (i instanceof PayloadItem) {
PayloadItem<PacketExtension> pi = (PayloadItem<PacketExtension>) i;
PacketExtension ex = pi.getPayload();
if (ex instanceof AvatarMetadataExtension) {
- Log.d("AvatarMgr", "Received avatar meta");
AvatarMetadataExtension ext = (AvatarMetadataExtension) ex;
Info info = selectAvatar(ext.getInfos());
if (!mCache.contains(info.getId()))
--- a/src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java Tue Oct 26 00:41:03 2010 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java Tue Oct 26 00:59:27 2010 +0200
@@ -47,7 +47,7 @@
import org.jivesoftware.smack.Connection;
// API level 8
//import android.net.http.AndroidHttpClient;
-import org.apache.http.client.HttpClient;
+//import org.apache.http.client.HttpClient;
/**
* A factory for AvatarRetriever.
--- a/src/com/beem/project/beem/smack/avatar/HttpClientAvatarRetriever.java Tue Oct 26 00:41:03 2010 +0200
+++ b/src/com/beem/project/beem/smack/avatar/HttpClientAvatarRetriever.java Tue Oct 26 00:59:27 2010 +0200
@@ -46,7 +46,6 @@
import java.io.InputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.net.URL;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.client.methods.HttpGet;
@@ -79,7 +78,7 @@
* @param url the url of the avatar to download.
*/
public HttpClientAvatarRetriever(final String url) {
- mUrl= url;
+ mUrl = url;
mClient = new DefaultHttpClient();
}
@@ -88,8 +87,8 @@
HttpUriRequest request;
try {
request = new HttpGet(mUrl);
- } catch(IllegalArgumentException e) {
- IOException ioe = new IOException("Invalid url " +mUrl);
+ } catch (IllegalArgumentException e) {
+ IOException ioe = new IOException("Invalid url " + mUrl);
ioe.initCause(e);
throw ioe;
}
--- a/src/com/beem/project/beem/smack/avatar/XmppAvatarRetriever.java Tue Oct 26 00:41:03 2010 +0200
+++ b/src/com/beem/project/beem/smack/avatar/XmppAvatarRetriever.java Tue Oct 26 00:59:27 2010 +0200
@@ -63,6 +63,13 @@
private String mFrom;
private String mId;
+ /**
+ * Create an XmppAvatarRetriever.
+ *
+ * @param con the xmpp connection
+ * @param from the contact from which we retrieve the avatar
+ * @param id the id of the avatar to retrieve
+ */
public XmppAvatarRetriever(final Connection con, final String from, final String id) {
mPubsub = new PepSubManager(con, from);
mFrom = from;
--- a/src/com/beem/project/beem/smack/pep/PepSubManager.java Tue Oct 26 00:41:03 2010 +0200
+++ b/src/com/beem/project/beem/smack/pep/PepSubManager.java Tue Oct 26 00:59:27 2010 +0200
@@ -107,6 +107,13 @@
mPepListeners.remove(listener);
}
+ /**
+ * Get a PepNode.
+ * This node is obtain without checking its existence as PEP should auto create it.
+ *
+ * @param nodeName the node name
+ * @return the node
+ */
public LeafNode getPEPNode(String nodeName) {
LeafNode node = new LeafNode(con, nodeName);
node.setTo(to);