Checkstyle and javadoc.
authorDa Risk <darisk972@gmail.com>
Wed, 22 Sep 2010 14:09:54 +0200
changeset 802 20308ad77837
parent 801 9093c2de4159
child 803 8a3a48e85b63
Checkstyle and javadoc.
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/service/XmppConnectionAdapter.java
src/com/beem/project/beem/smack/AvatarMetadataExtension.java
src/com/beem/project/beem/smack/AvatarMetadataProvider.java
src/com/beem/project/beem/smack/avatar/AvatarManager.java
src/com/beem/project/beem/smack/avatar/AvatarMetadataExtension.java
src/com/beem/project/beem/smack/avatar/AvatarMetadataProvider.java
src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java
--- a/src/com/beem/project/beem/BeemService.java	Tue Sep 21 00:34:33 2010 +0200
+++ b/src/com/beem/project/beem/BeemService.java	Wed Sep 22 14:09:54 2010 +0200
@@ -85,7 +85,7 @@
 import com.beem.project.beem.utils.BeemBroadcastReceiver;
 import com.beem.project.beem.utils.BeemConnectivity;
 import com.beem.project.beem.utils.Status;
-import com.beem.project.beem.smack.AvatarMetadataProvider;
+import com.beem.project.beem.smack.avatar.AvatarMetadataProvider;
 import com.beem.project.beem.smack.caps.CapsProvider;
 
 /**
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Tue Sep 21 00:34:33 2010 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Wed Sep 22 14:09:54 2010 +0200
@@ -51,19 +51,12 @@
 import org.jivesoftware.smack.XMPPConnection;
 import org.jivesoftware.smack.XMPPException;
 import org.jivesoftware.smack.filter.PacketFilter;
-import org.jivesoftware.smack.filter.PacketExtensionFilter;
 import org.jivesoftware.smack.packet.Packet;
-import org.jivesoftware.smack.packet.PacketExtension;
-import org.jivesoftware.smack.*;
-import org.jivesoftware.smack.filter.*;
-import org.jivesoftware.smack.packet.*;
 import org.jivesoftware.smack.packet.Presence;
 import org.jivesoftware.smackx.ChatStateManager;
 import org.jivesoftware.smackx.ServiceDiscoveryManager;
 import org.jivesoftware.smackx.packet.DiscoverInfo;
 import org.jivesoftware.smackx.pubsub.PayloadItem;
-import org.jivesoftware.smackx.pubsub.ItemsExtension;
-import org.jivesoftware.smackx.pubsub.EventElement;
 
 import android.app.Notification;
 import android.app.PendingIntent;
@@ -89,11 +82,10 @@
 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.AvatarMetadataExtension;
+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;
-import com.beem.project.beem.smack.pep.PepSubManager;
 
 /**
  * This class implements an adapter for XMPPConnection.
@@ -259,33 +251,14 @@
 	}
     }
 
-    private void makeNoise()
-    {
-	Notification notif = new Notification(android.R.drawable.stat_notify_more, mService.getString(
-		    R.string.AcceptContactRequest, "NOISE"), System.currentTimeMillis());
-	notif.flags = Notification.FLAG_AUTO_CANCEL;
-	Intent intent = new Intent(mService, Subscription.class);
-	intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-	notif.setLatestEventInfo(mService, "NOISE", mService
-		.getString(R.string.AcceptContactRequestFrom, "noise"), PendingIntent.getActivity(mService, 0,
-		    intent, PendingIntent.FLAG_ONE_SHOT));
-	int id = 42;
-	mService.sendNotification(id, notif);
-    }
-
     private void testPEP() {
 	Log.d(TAG, "TEST PEP activate");
-
 	AvatarMetadataExtension meta = new AvatarMetadataExtension();
-	AvatarMetadataExtension.Info info = new AvatarMetadataExtension.Info();
-	info.id = "test";
+	AvatarMetadataExtension.Info info = new AvatarMetadataExtension.Info("test", "image/png", 5);
 	info.setUrl("http://elyzion.net/img.png");
-	info.bytes = 5;
-	info.type="image/png";
 	meta.addInfo(info);
 	PayloadItem<AvatarMetadataExtension> item = new PayloadItem<AvatarMetadataExtension>("test", meta);
-//         pmgr.publish(item, "urn:xmpp:avatar:data");
-	
+	//         pmgr.publish(item, "urn:xmpp:avatar:data");
 	Log.d(TAG, "END TEST PEP ");
     }
 
@@ -432,48 +405,6 @@
 	return mRoster;
     }
 
-    /**
-     * enregistre les features dispo dans notre version Liste de features que Telepathy supporte.
-     */
-    private void initFeatures() {
-	ServiceDiscoveryManager.setIdentityName("Beem");
-	ServiceDiscoveryManager.setIdentityType("phone");
-	ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
-	if (sdm == null)
-	    sdm = new ServiceDiscoveryManager(mAdaptee);
-
-	sdm.addFeature("http://jabber.org/protocol/disco#info");
-	sdm.addFeature("jabber:iq:privacy");
-	sdm.addFeature("http://jabber.org/protocol/caps");
-	sdm.addFeature("urn:xmpp:avatar:metadata");
-	sdm.addFeature("urn:xmpp:avatar:metadata+notify");
-	sdm.addFeature("urn:xmpp:avatar:data");
-	sdm.addFeature("http://jabber.org/protocol/nick");
-	sdm.addFeature("http://jabber.org/protocol/nick+notify");
-
-	mChatStateManager = ChatStateManager.getInstance(mAdaptee);
-	BeemCapsManager caps = new BeemCapsManager(sdm, mAdaptee, mService);
-	caps.setNode("http://www.beem-project.com");
-    }
-
-    private void discoverServerFeatures() {
-	try {
-	    // jid et server
-	    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
-	    DiscoverInfo info = sdm.discoverInfo("elyzion.net");
-	    Iterator<DiscoverInfo.Identity> it = info.getIdentities();
-	    while (it.hasNext()) {
-		DiscoverInfo.Identity identity = it.next();
-		if ("pubsub".equals(identity.getCategory()) && "pep".equals(identity.getType())) {
-		    initPEP();
-		    break;
-		}
-	    }
-	} catch (XMPPException e) {
-	    // No Pep
-	}
-    
-    }
 
     /**
      * Returns true if currently authenticated by successfully calling the login method.
@@ -516,17 +447,62 @@
 	return mErrorMsg;
     }
 
+    /**
+     * Initialize the features provided by beem.
+     */
+    private void initFeatures() {
+	ServiceDiscoveryManager.setIdentityName("Beem");
+	ServiceDiscoveryManager.setIdentityType("phone");
+	ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
+	if (sdm == null)
+	    sdm = new ServiceDiscoveryManager(mAdaptee);
+
+	sdm.addFeature("http://jabber.org/protocol/disco#info");
+	sdm.addFeature("jabber:iq:privacy");
+	sdm.addFeature("http://jabber.org/protocol/caps");
+	sdm.addFeature("urn:xmpp:avatar:metadata");
+	sdm.addFeature("urn:xmpp:avatar:metadata+notify");
+	sdm.addFeature("urn:xmpp:avatar:data");
+	sdm.addFeature("http://jabber.org/protocol/nick");
+	sdm.addFeature("http://jabber.org/protocol/nick+notify");
+
+	mChatStateManager = ChatStateManager.getInstance(mAdaptee);
+	BeemCapsManager caps = new BeemCapsManager(sdm, mAdaptee, mService);
+	caps.setNode("http://www.beem-project.com");
+    }
+
+    /**
+     * Discover the features provided by the server.
+     */
+    private void discoverServerFeatures() {
+	try {
+	    // jid et server
+	    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
+	    DiscoverInfo info = sdm.discoverInfo("elyzion.net");
+	    Iterator<DiscoverInfo.Identity> it = info.getIdentities();
+	    while (it.hasNext()) {
+		DiscoverInfo.Identity identity = it.next();
+		if ("pubsub".equals(identity.getCategory()) && "pep".equals(identity.getType())) {
+		    initPEP();
+		}
+	    }
+	} catch (XMPPException e) {
+	    // No Pep
+	}
+    }
+
+    /**
+     * Initialize PEP.
+     */
     private void initPEP() {
-		// Enable pep sending
-		// API 8
-		// mService.getExternalCacheDir()
-		File cacheDir = Environment.getExternalStorageDirectory();
-		cacheDir = new File(cacheDir,"/Android/data/com.beem.project.beem/cache/");
-		AvatarCache avatarCache = new FileAvatarCache(cacheDir);
-		new AvatarManager(mAdaptee, avatarCache, true);
-		testPEP();
-		System.err.println("TEST PEP");
-    
+	// Enable pep sending
+	// API 8
+	// mService.getExternalCacheDir()
+	File cacheDir = Environment.getExternalStorageDirectory();
+	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/AvatarMetadataExtension.java	Tue Sep 21 00:34:33 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-
-package com.beem.project.beem.smack;
-
-import java.util.List;
-import java.util.LinkedList;
-import org.jivesoftware.smack.packet.PacketExtension;
-
-public class AvatarMetadataExtension implements PacketExtension {
-    List<Info> infos = new LinkedList<Info>();
-
-    public AvatarMetadataExtension() {
-    }
-
-    public List<Info> getInfos() {
-	return infos;
-    }
-
-    public void addInfo(Info info) {
-	infos.add(info);
-    }
-
-    @Override
-    public String getElementName() {
-	return "metadata";
-    }
-
-    @Override
-    public String getNamespace() {
-	return "urn:xmpp:avatar:metadata";
-    }
-
-//     @Override
-    protected String getNode() {
-	return "urn:xmpp:avatar:metadata";
-    }
-
-//     @Override
-    protected String getItemDetailsXML() {
-	StringBuilder builder = new StringBuilder("<metadata xmlns=\"");
-	builder.append(getNode()).append("\">");
-	for (Info info : infos) {
-	    builder.append(info.toXML());
-	}
-	builder.append("</metadata>");
-
-	return builder.toString();
-    }
-
-    @Override
-    public String toXML() {
-	return getItemDetailsXML();
-    }
-
-    public static class Info {
-	 public int bytes;
-	 public int height;
-	 public String id;
-	 public String type;
-	 private String url;
-	 public int width;
-
-	 public void setUrl(String url) {
-	    this.url = url;
-	 }
-
-	 public String getUrl() {
-	    return url;
-	 }
-
-	 public String getId() {
-	    return id;
-	 }
-
-	 public String toXML() {
-	     StringBuilder builder = new StringBuilder("<info ");
-	     builder.append("bytes=\"" + bytes + "\"");
-	     builder.append(" id=\"" + id + "\"");
-	     builder.append(" type=\"" + type + "\"");
-
-	     if (height > 0)
-		 builder.append(" height=\"" + height + "\"");
-	     if (width > 0)
-		 builder.append(" width=\"" + width + "\"");
-	     if (url != null)
-		 builder.append(" url=\"" + url + "\"");
-	     builder.append(" />");
-	     return builder.toString();
-	 }
-    }
-}
--- a/src/com/beem/project/beem/smack/AvatarMetadataProvider.java	Tue Sep 21 00:34:33 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-
-package com.beem.project.beem.smack;
-
-import org.jivesoftware.smack.packet.PacketExtension;
-import org.jivesoftware.smack.provider.PacketExtensionProvider;
-import org.xmlpull.v1.XmlPullParser;
-import android.util.Log;
-
-public class AvatarMetadataProvider implements PacketExtensionProvider {
-
-    /**
-     * Creates a new AvatarMetadataProvider.
-     * ProviderManager requires that every PacketExtensionProvider has a public, no-argument constructor
-     */
-    public AvatarMetadataProvider() {
-    }
-
-    @Override
-    public PacketExtension parseExtension(XmlPullParser parser)
-	throws Exception {
-	Log.e("PROVIDER", "begin parsing");
-	AvatarMetadataExtension metadata = new AvatarMetadataExtension();
-	boolean done = false;
-	StringBuilder buffer = new StringBuilder();
-	while (!done) {
-	    int eventType = parser.next();
-	    if (eventType == XmlPullParser.START_TAG) {
-		if (parser.getName().equals("info")) {
-		    AvatarMetadataExtension.Info info = new AvatarMetadataExtension.Info();
-		    info.bytes = Integer.parseInt(parser.getAttributeValue(null, "bytes"));
-		    info.height = Integer.parseInt(parser.getAttributeValue(null, "height"));
-		    info.width = Integer.parseInt(parser.getAttributeValue(null, "width"));
-		    info.id = parser.getAttributeValue(null, "id");
-		    info.type = parser.getAttributeValue(null, "type");
-		    info.setUrl(parser.getAttributeValue(null, "url"));
-		    Log.e("PROVIDER", "add info");
-		    metadata.addInfo(info);
-		}
-	    } else if (eventType == XmlPullParser.END_TAG) {
-		    if (parser.getName().equals(metadata.getElementName())) {
-			done = true;
-		    }
-	    }
-	}
-	Log.e("PROVIDER", "end parsing");
-	return metadata;
-    }
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarManager.java	Tue Sep 21 00:34:33 2010 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarManager.java	Wed Sep 22 14:09:54 2010 +0200
@@ -45,8 +45,9 @@
 
 import android.util.Log;
 
-import com.beem.project.beem.smack.AvatarMetadataExtension;
-import com.beem.project.beem.smack.AvatarMetadataExtension.Info;
+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;
 
 import java.io.IOException;
 
@@ -56,8 +57,6 @@
 import org.jivesoftware.smack.packet.PacketExtension;
 import org.jivesoftware.smackx.pubsub.Item;
 import org.jivesoftware.smackx.pubsub.PayloadItem;
-import com.beem.project.beem.smack.pep.PepSubManager;
-import com.beem.project.beem.smack.pep.PEPListener;
 
 /**
  * This class deals with the avatar data.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/smack/avatar/AvatarMetadataExtension.java	Wed Sep 22 14:09:54 2010 +0200
@@ -0,0 +1,257 @@
+/*
+    BEEM is a videoconference application on the Android Platform.
+
+    Copyright (C) 2009 by Frederic-Charles Barthelery,
+                          Jean-Manuel Da Silva,
+                          Nikita Kozlov,
+                          Philippe Lago,
+                          Jean Baptiste Vergely,
+                          Vincent Veronis.
+
+    This file is part of BEEM.
+
+    BEEM is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    BEEM is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with BEEM.  If not, see <http://www.gnu.org/licenses/>.
+
+    Please send bug reports with examples or suggestions to
+    contact@beem-project.com or http://dev.beem-project.com/
+
+    Epitech, hereby disclaims all copyright interest in the program "Beem"
+    written by Frederic-Charles Barthelery,
+               Jean-Manuel Da Silva,
+               Nikita Kozlov,
+               Philippe Lago,
+               Jean Baptiste Vergely,
+               Vincent Veronis.
+
+    Nicolas Sadirac, November 26, 2009
+    President of Epitech.
+
+    Flavien Astraud, November 26, 2009
+    Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jivesoftware.smack.packet.PacketExtension;
+
+/**
+ * PacketExtension to represent the Avatar metadata.
+ * XML namespace urn:xmpp:avatar:metadata
+ *
+ */
+public class AvatarMetadataExtension implements PacketExtension {
+    private List<Info> mInfos = new LinkedList<Info>();
+
+    /**
+     * Create an AvatarMetadataExtension.
+     */
+    public AvatarMetadataExtension() {
+    }
+
+    /**
+     * Get the metadata informations.
+     *
+     * @return a list of informations
+     */
+    public List<Info> getInfos() {
+	return mInfos;
+    }
+
+    /**
+     * Add a metadate information.
+     *
+     * @param info the metadata information to add
+     */
+    public void addInfo(Info info) {
+	mInfos.add(info);
+    }
+
+    @Override
+    public String getElementName() {
+	return "metadata";
+    }
+
+    @Override
+    public String getNamespace() {
+	return "urn:xmpp:avatar:metadata";
+    }
+
+    @Override
+    public String toXML() {
+	StringBuilder builder = new StringBuilder("<metadata xmlns=\"");
+	builder.append(getNamespace()).append("\">");
+	for (Info info : infos) {
+	    builder.append(info.toXML());
+	}
+	builder.append("</metadata>");
+	return builder.toString();
+    }
+
+    /**
+     * A metadata information element.
+     */
+    public static class Info {
+	private int mBytes;
+	private int mHeight;
+	private int mWidth;
+	private String mId;
+	private String mType;
+	private String mUrl;
+
+	/**
+	 * Create an Info.
+	 *
+	 * @param id the id of the info
+	 * @param type the MIME type of the avatar
+	 * @param bytes the size of the avatar in bytes
+	 */
+	public Info(final String id, final String type, final int bytes) {
+	    mId = id;
+	    mType = type;
+	    mBytes = bytes;
+	}
+
+	/**
+	 * Set the size of the avatar in bytes.
+	 *
+	 * @param bytes the size
+	 */
+	public void setBytes(int bytes) {
+	    this.mBytes = bytes;
+	}
+
+	/**
+	 * Set the size of the avatar in bytes.
+	 *
+	 * @return the size
+	 */
+	public int getBytes() {
+	    return mBytes;
+	}
+
+	/**
+	 * Set the height.
+	 *
+	 * @param height the height
+	 */
+	public void setHeight(int height) {
+	    this.mHeight = height;
+	}
+
+	/**
+	 * Get the height.
+	 *
+	 * @return the height
+	 */
+	public int getHeight() {
+	    return mHeight;
+	}
+
+	/**
+	 * Set the width.
+	 *
+	 * @param width the width
+	 */
+	public void setWidth(int width) {
+	    this.mWidth = width;
+	}
+
+	/**
+	 * Get the width.
+	 *
+	 * @return the width
+	 */
+	public int getWidth() {
+	    return mWidth;
+	}
+
+	/**
+	 * Set the url.
+	 *
+	 * @param url the url
+	 */
+	public void setUrl(String url) {
+	    this.mUrl = url;
+	}
+
+	/**
+	 * Get the url.
+	 *
+	 * @return the url, null if no url is present
+	 */
+	public String getUrl() {
+	    return mUrl;
+	}
+
+	/**
+	 * Get the id.
+	 *
+	 * @return the id
+	 */
+	public String getId() {
+	    return mId;
+	}
+
+	/**
+	 * Set the id.
+	 *
+	 * @param id the id
+	 */
+	public void setId(String id) {
+	    this.mId = id;
+	}
+
+	/**
+	 * Set the MIME type of the avatar.
+	 *
+	 * @param type the type
+	 */
+	public void setType(String type) {
+	    this.mType = type;
+	}
+
+	/**
+	 * Get the MIME type of the avatar.
+	 *
+	 * @return the type, null if no type is present
+	 */
+	public String getType() {
+	    return mType;
+	}
+
+	/**
+	 * Return this information as an xml element.
+	 *
+	 * @return an xml element representing this information
+	 */
+	public String toXML() {
+	    StringBuilder builder = new StringBuilder("<info ");
+	    builder.append("id=\"" + mId + "\"");
+	    builder.append(" type=\"" + mType + "\"");
+	    builder.append(" bytes=\"" + mBytes + "\"");
+
+	    if (mHeight > 0)
+		builder.append(" height=\"" + mHeight + "\"");
+	    if (mWidth > 0)
+		builder.append(" width=\"" + mWidth + "\"");
+	    if (mUrl != null)
+		builder.append(" url=\"" + mUrl + "\"");
+	    builder.append(" />");
+	    return builder.toString();
+	}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/smack/avatar/AvatarMetadataProvider.java	Wed Sep 22 14:09:54 2010 +0200
@@ -0,0 +1,93 @@
+/*
+    BEEM is a videoconference application on the Android Platform.
+
+    Copyright (C) 2009 by Frederic-Charles Barthelery,
+                          Jean-Manuel Da Silva,
+                          Nikita Kozlov,
+                          Philippe Lago,
+                          Jean Baptiste Vergely,
+                          Vincent Veronis.
+
+    This file is part of BEEM.
+
+    BEEM is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    BEEM is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with BEEM.  If not, see <http://www.gnu.org/licenses/>.
+
+    Please send bug reports with examples or suggestions to
+    contact@beem-project.com or http://dev.beem-project.com/
+
+    Epitech, hereby disclaims all copyright interest in the program "Beem"
+    written by Frederic-Charles Barthelery,
+               Jean-Manuel Da Silva,
+               Nikita Kozlov,
+               Philippe Lago,
+               Jean Baptiste Vergely,
+               Vincent Veronis.
+
+    Nicolas Sadirac, November 26, 2009
+    President of Epitech.
+
+    Flavien Astraud, November 26, 2009
+    Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import org.jivesoftware.smack.packet.PacketExtension;
+import org.jivesoftware.smack.provider.PacketExtensionProvider;
+import org.xmlpull.v1.XmlPullParser;
+
+/**
+ * A PacketExtensionProvider to parse the Avatar metadata.
+ * XML namespace urn:xmpp:avatar:metadata
+ */
+public class AvatarMetadataProvider implements PacketExtensionProvider {
+
+    /**
+     * Creates a new AvatarMetadataProvider.
+     * ProviderManager requires that every PacketExtensionProvider has a public, no-argument constructor
+     */
+    public AvatarMetadataProvider() {
+    }
+
+    @Override
+    public PacketExtension parseExtension(XmlPullParser parser)
+	throws Exception {
+	AvatarMetadataExtension metadata = new AvatarMetadataExtension();
+	boolean done = false;
+	StringBuilder buffer = new StringBuilder();
+	while (!done) {
+	    int eventType = parser.next();
+	    if (eventType == XmlPullParser.START_TAG) {
+		if ("info".equals(parser.getName())) {
+		    int bytes = Integer.parseInt(parser.getAttributeValue(null, "bytes"));
+		    int height = Integer.parseInt(parser.getAttributeValue(null, "height"));
+		    int width = Integer.parseInt(parser.getAttributeValue(null, "width"));
+		    String id = parser.getAttributeValue(null, "id");
+		    String type = parser.getAttributeValue(null, "type");
+		    String url = parser.getAttributeValue(null, "url");
+		    AvatarMetadataExtension.Info info = new AvatarMetadataExtension.Info(id, type, bytes);
+		    info.setHeight(height);
+		    info.setWidth(width);
+		    info.setUrl(url);
+		    metadata.addInfo(info);
+		}
+	    } else if (eventType == XmlPullParser.END_TAG) {
+		if (parser.getName().equals(metadata.getElementName())) {
+		    done = true;
+		}
+	    }
+	}
+	return metadata;
+    }
+}
--- a/src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java	Tue Sep 21 00:34:33 2010 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java	Wed Sep 22 14:09:54 2010 +0200
@@ -43,13 +43,13 @@
 */
 package com.beem.project.beem.smack.avatar;
 
-import com.beem.project.beem.smack.AvatarMetadataExtension.Info;
+import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
 import org.jivesoftware.smack.Connection;
 
 /**
  * A factory for AvatarRetriever.
  */
-public class AvatarRetrieverFactory {
+public final class AvatarRetrieverFactory {
 
     /**
      * Private constructor.