/soc/2012/michael/android: 492b9639628c: Fixed some problems in ...
Michael Zangl
michael at soc.pidgin.im
Sat Jul 7 03:34:27 EDT 2012
Changeset: 492b9639628c0b44bc5f473aefc4ceb5f3b7cfe1
Author: Michael Zangl <michael at soc.pidgin.im>
Date: 2012-07-02 22:15 +0200
Branch: soc.2012.android
URL: http://hg.pidgin.im/soc/2012/michael/android/rev/492b9639628c
Description:
Fixed some problems in GList interface and protocol list to make Android display it.
diffstat:
android/workspace/im.pidgin.libpurple.build/buildscripts/purple.ant | 5 +-
android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java | 21 ++++++-
android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/account/ProtocolListAdapter.java | 16 +++--
android/workspace/im.pidgin.libpurple/native/CoreManager.c | 26 ++++++---
android/workspace/im.pidgin.libpurple/native/GListReference.c | 2 +
android/workspace/im.pidgin.libpurple/native/build.ant | 1 +
android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/account/PurpleAccountManager.java | 1 +
android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/CoreManager.java | 6 ++
android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GListReference.java | 1 +
9 files changed, 58 insertions(+), 21 deletions(-)
diffs (255 lines):
diff --git a/android/workspace/im.pidgin.libpurple.build/buildscripts/purple.ant b/android/workspace/im.pidgin.libpurple.build/buildscripts/purple.ant
--- a/android/workspace/im.pidgin.libpurple.build/buildscripts/purple.ant
+++ b/android/workspace/im.pidgin.libpurple.build/buildscripts/purple.ant
@@ -29,7 +29,10 @@
--disable-gnutls
--disable-dbus
--disable-farstream
- --disable-plugins --with-static-prpls="oscar"
+ --disable-perl
+ --disable-tcl
+ --disable-plugins
+ --with-static-prpls="all"
noinst_PROGRAMS=""
CFLAGS="-I${libpurple.prefix}/include -I${libpurple.prefix}/include/libxml2 -DANDROID"
LDFLAGS="-L${libpurple.prefix}/lib"
diff --git a/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java b/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java
--- a/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java
+++ b/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java
@@ -2,6 +2,7 @@
import im.pidgin.libpurple.account.PurpleAccount;
import im.pidgin.libpurple.core.PurpleInstance;
+import im.pidgin.libpurple.plugin.PurplePlugin;
import im.pidgin.libpurple.testclient.about.AboutView;
import im.pidgin.libpurple.testclient.account.AccountEditView;
import im.pidgin.libpurple.testclient.accountlist.AccountListView;
@@ -9,6 +10,7 @@
import im.pidgin.libpurple.testclient.core.ViewController;
import java.util.LinkedList;
+import java.util.List;
import android.app.Activity;
import android.os.Bundle;
@@ -29,9 +31,20 @@
getFilesDir());
}
+ printStats();
+
displayAccountList();
}
+ private void printStats() {
+ List<PurplePlugin> list = instance.getPluginList().getPlugins();
+ System.out.println("The following " + list.size()
+ + " plugins are loaded:");
+ for (PurplePlugin plugin : list) {
+ System.out.println("Installed plugin: " + plugin.getId());
+ }
+ }
+
private void showView(TestClientView view) {
if (!viewStack.isEmpty()) {
viewStack.peekLast().notifyRemove();
@@ -74,7 +87,7 @@
public void onBackPressed() {
goBack();
}
-
+
@Override
public void displayAbout() {
showView(new AboutView(this));
@@ -92,19 +105,19 @@
@Override
public void displayNewAccountDialog() {
- showView(new AccountEditView(this));
+ showView(new AccountEditView(this));
}
@Override
public void displayBuddylist() {
// TODO Auto-generated method stub
-
+
}
@Override
public void displayConversation() {
// TODO Auto-generated method stub
-
+
}
@Override
diff --git a/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/account/ProtocolListAdapter.java b/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/account/ProtocolListAdapter.java
--- a/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/account/ProtocolListAdapter.java
+++ b/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/account/ProtocolListAdapter.java
@@ -5,6 +5,7 @@
import im.pidgin.libpurple.testclient.R;
import java.util.ArrayList;
+import java.util.List;
import android.view.LayoutInflater;
import android.view.View;
@@ -17,10 +18,11 @@
private final ArrayList<PurpleProtocolPlugin> protocols;
private final LayoutInflater inflater;
- public ProtocolListAdapter(LayoutInflater inflater, PurplePluginList pluginList) {
+ public ProtocolListAdapter(LayoutInflater inflater,
+ PurplePluginList pluginList) {
this.inflater = inflater;
- protocols = new ArrayList<PurpleProtocolPlugin>(
- pluginList.getProtocolPlugins());
+ List<PurpleProtocolPlugin> plugins = pluginList.getProtocolPlugins();
+ protocols = new ArrayList<PurpleProtocolPlugin>(plugins);
}
@Override
@@ -44,12 +46,14 @@
if (arg1 != null) {
root = arg1;
} else {
- root = inflater.inflate(R.layout.protocollist_item, arg2);
+ root = inflater.inflate(R.layout.protocollist_item, null);
root.setPadding(2, 2, 2, 2);
}
- TextView name = (TextView) root.findViewById(R.id.protocollist_item_name);
+ TextView name = (TextView) root
+ .findViewById(R.id.protocollist_item_name);
name.setText(getProtocol(arg0).getName());
- TextView summary = (TextView) root.findViewById(R.id.protocollist_item_name);
+ TextView summary = (TextView) root
+ .findViewById(R.id.protocollist_item_name);
summary.setText(getProtocol(arg0).getSummary());
return root;
}
diff --git a/android/workspace/im.pidgin.libpurple/native/CoreManager.c b/android/workspace/im.pidgin.libpurple/native/CoreManager.c
--- a/android/workspace/im.pidgin.libpurple/native/CoreManager.c
+++ b/android/workspace/im.pidgin.libpurple/native/CoreManager.c
@@ -25,12 +25,16 @@
JavaObjectReference coreManagerInstance;
/* protocol init functions */
-extern gboolean purple_init_jabber_plugin(void);
-extern gboolean purple_init_msn_plugin(void);
-extern gboolean purple_init_aim_plugin(void);
-extern gboolean purple_init_icq_plugin(void);
-extern gboolean purple_init_yahoo_plugin(void);
-
+extern gboolean
+purple_init_jabber_plugin(void);
+extern gboolean
+purple_init_msn_plugin(void);
+extern gboolean
+purple_init_aim_plugin(void);
+extern gboolean
+purple_init_icq_plugin(void);
+extern gboolean
+purple_init_yahoo_plugin(void);
/**
* Called on a ui init event from the core.
@@ -56,7 +60,7 @@
* Method: startCore_native
* Signature: (Ljava/lang/String;)Z
*/JNIEXPORT jboolean JNICALL
- Java_im_pidgin_libpurple_core_CoreManager_startCore_1native(JNIEnv *env,
+Java_im_pidgin_libpurple_core_CoreManager_startCore_1native(JNIEnv *env,
jobject obj, jstring uiName)
{
jboolean success;
@@ -86,10 +90,12 @@
__android_log_print(ANDROID_LOG_INFO, "jni", "loading blist");
purple_set_blist(purple_blist_new());
purple_blist_load();
+ __android_log_print(ANDROID_LOG_INFO, "jni", "loaded plugins: %i",
+ g_list_length(purple_plugins_get_all()));
+ __android_log_print(ANDROID_LOG_INFO, "jni",
+ "loaded protocol plugins: %i",
+ g_list_length(purple_plugins_get_protocols()));
//purple_plugins_load_saved("/plugins/loaded");
- purple_plugin_load(purple_plugins_find_with_id("aim"));
- purple_plugin_load(purple_plugins_find_with_id("msn"));
- purple_plugin_load(purple_plugins_find_with_id("icq"));
purple_pounces_load();
}
diff --git a/android/workspace/im.pidgin.libpurple/native/GListReference.c b/android/workspace/im.pidgin.libpurple/native/GListReference.c
--- a/android/workspace/im.pidgin.libpurple/native/GListReference.c
+++ b/android/workspace/im.pidgin.libpurple/native/GListReference.c
@@ -16,6 +16,8 @@
Java_im_pidgin_libpurple_glib_GListReference_length_1native(JNIEnv *env,
jobject obj)
{
+ __android_log_print(ANDROID_LOG_INFO, "jni", "list: %p. length: %i",
+ (void *) getGList(env, obj), g_list_length(getGList(env, obj)));
return g_list_length(getGList(env, obj));
}
diff --git a/android/workspace/im.pidgin.libpurple/native/build.ant b/android/workspace/im.pidgin.libpurple/native/build.ant
--- a/android/workspace/im.pidgin.libpurple/native/build.ant
+++ b/android/workspace/im.pidgin.libpurple/native/build.ant
@@ -37,6 +37,7 @@
<javah classdefinition="im.pidgin.libpurple.account.PurpleStatus" to="${javah.out}" />
<javah classdefinition="im.pidgin.libpurple.blist.PurpleBlist" to="${javah.out}" />
+ <javah classdefinition="im.pidgin.libpurple.blist.PurpleBlistManager" to="${javah.out}" />
<javah classdefinition="im.pidgin.libpurple.blist.PurpleBlistGroup" to="${javah.out}" />
<javah classdefinition="im.pidgin.libpurple.blist.PurpleBlistNode" to="${javah.out}" />
<javah classdefinition="im.pidgin.libpurple.blist.PurpleContact" to="${javah.out}" />
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/account/PurpleAccountManager.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/account/PurpleAccountManager.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/account/PurpleAccountManager.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/account/PurpleAccountManager.java
@@ -145,6 +145,7 @@
PurpleProtocolPlugin protocol) {
PurpleAccount account = PurpleAccount.newAccount(getManager(),
username, protocol);
+ knownAccounts.put(account.getNativePointer(), account);
addAccount_native(account.getNativePointer());
return account;
}
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/CoreManager.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/CoreManager.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/CoreManager.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/CoreManager.java
@@ -1,6 +1,7 @@
package im.pidgin.libpurple.core;
import im.pidgin.libpurple.account.PurpleAccountManager;
+import im.pidgin.libpurple.blist.PurpleBlistManager;
import im.pidgin.libpurple.core.thread.PurpleThread;
import im.pidgin.libpurple.plugin.PurplePluginList;
import im.pidgin.libpurple.plugin.PurplePluginManager;
@@ -21,6 +22,8 @@
private final PurplePluginList pluginManager = new PurplePluginManager(this);
+ private final PurpleBlistManager blist = new PurpleBlistManager(this);
+
/**
* Initializes libpurple by setting all the ui ops and calling
* purple_core_init().
@@ -59,4 +62,7 @@
return pluginManager;
}
+ public PurpleBlistManager getBlist() {
+ return blist;
+ }
}
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GListReference.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GListReference.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GListReference.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GListReference.java
@@ -13,6 +13,7 @@
super(list);
this.peerGenerator = peerGenerator;
this.modifyable = modifyable;
+ System.out.println("Length: " + length() + ", list: " + list);
}
protected int length() {
More information about the Commits
mailing list