/soc/2012/michael/android: a3f7975e8e44: Implemented basic Blist...

Michael Zangl michael at soc.pidgin.im
Sat Jul 7 03:34:26 EDT 2012


Changeset: a3f7975e8e44529025ed655d80d87b651746fa7c
Author:	 Michael Zangl <michael at soc.pidgin.im>
Date:	 2012-06-30 16:55 +0200
Branch:	 soc.2012.android
URL: http://hg.pidgin.im/soc/2012/michael/android/rev/a3f7975e8e44

Description:

Implemented basic Blist construction methods.

diffstat:

 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistGroup.java     |  11 +++
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java      |  32 +++++++++-
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleContact.java        |   8 ++-
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/buddy/PurpleBuddy.java          |   9 ++-
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/plugin/PurplePluginManager.java |   6 +-
 5 files changed, 60 insertions(+), 6 deletions(-)

diffs (114 lines):

diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistGroup.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistGroup.java
new file mode 100644
--- /dev/null
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistGroup.java
@@ -0,0 +1,11 @@
+package im.pidgin.libpurple.blist;
+
+import im.pidgin.libpurple.core.CoreManager;
+
+public class PurpleBlistGroup extends PurpleBlistNode {
+
+	protected PurpleBlistGroup(long nativePointer, CoreManager manager) {
+		super(nativePointer, manager);
+	}
+
+}
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java
@@ -1,5 +1,35 @@
 package im.pidgin.libpurple.blist;
 
-public class PurpleBlistNode {
+import im.pidgin.libpurple.buddy.PurpleBuddy;
+import im.pidgin.libpurple.constants.BlistConstants;
+import im.pidgin.libpurple.core.CoreManager;
+import im.pidgin.libpurple.core.PeeredPurpleManaged;
 
+/**
+ * This is a primitive Buddy list node.
+ * 
+ * @author michaelz
+ * 
+ */
+public class PurpleBlistNode extends PeeredPurpleManaged {
+
+	protected PurpleBlistNode(long nativePointer, CoreManager manager) {
+		super(nativePointer, manager);
+	}
+
+	public static PurpleBlistNode constructNode(long nativePointer,
+			CoreManager manager) {
+		int type = getTypeFor_native(nativePointer);
+		switch (type) {
+		case BlistConstants.PURPLE_BLIST_BUDDY_NODE:
+			return new PurpleBuddy(nativePointer, manager);
+		case BlistConstants.PURPLE_BLIST_CONTACT_NODE:
+			return new PurpleContact(nativePointer, manager);
+
+		default:
+			return new PurpleBlistNode(nativePointer, manager);
+		}
+	}
+
+	private static native int getTypeFor_native(long nativePointer);
 }
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleContact.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleContact.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleContact.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleContact.java
@@ -1,5 +1,11 @@
 package im.pidgin.libpurple.blist;
 
-public class PurpleContact {
+import im.pidgin.libpurple.core.CoreManager;
+
+public class PurpleContact extends PurpleBlistNode {
+
+	protected PurpleContact(long nativePointer, CoreManager manager) {
+		super(nativePointer, manager);
+	}
 
 }
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/buddy/PurpleBuddy.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/buddy/PurpleBuddy.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/buddy/PurpleBuddy.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/buddy/PurpleBuddy.java
@@ -1,5 +1,12 @@
 package im.pidgin.libpurple.buddy;
 
-public class PurpleBuddy {
+import im.pidgin.libpurple.blist.PurpleBlistNode;
+import im.pidgin.libpurple.core.CoreManager;
+
+public class PurpleBuddy extends PurpleBlistNode {
+
+	public PurpleBuddy(long nativePointer, CoreManager manager) {
+		super(nativePointer, manager);
+	}
 
 }
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/plugin/PurplePluginManager.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/plugin/PurplePluginManager.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/plugin/PurplePluginManager.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/plugin/PurplePluginManager.java
@@ -54,18 +54,18 @@
 		return GList.fromNativeList(getPlugins_native(), this, false);
 	}
 
-	private native long getProtocolPlugins_native();
+	private native long getPlugins_native();
 
 	/* (non-Javadoc)
 	 * @see im.pidgin.libpurple.plugin.PurplePluginList#getProtocolPlugins()
 	 */
 	@Override
 	public List<PurpleProtocolPlugin> getProtocolPlugins() {
-		return GList.fromNativeList(getPlugins_native(),
+		return GList.fromNativeList(getProtocolPlugins_native(),
 				new ProtocolPluginGenerator(), false);
 	}
 
-	private native long getPlugins_native();
+	private native long getProtocolPlugins_native();
 
 	protected PurpleProtocolPlugin getProtocolPeer(long protocol_native) {
 		PurplePlugin p = getPeer(protocol_native);



More information about the Commits mailing list