/soc/2012/michael/android: 7351011da309: Added methods to create...

Michael Zangl michael at soc.pidgin.im
Tue Jul 17 11:17:05 EDT 2012


Changeset: 7351011da3091df366d4ecbb05799c68229a04af
Author:	 Michael Zangl <michael at soc.pidgin.im>
Date:	 2012-07-14 10:58 +0200
Branch:	 soc.2012.android
URL: http://hg.pidgin.im/soc/2012/michael/android/rev/7351011da309

Description:

Added methods to create new blist nodes and listeners to listen for node changes.

diffstat:

 android/workspace/im.pidgin.libpurple/.cproject                                              |   75 ++++-
 android/workspace/im.pidgin.libpurple/native/ConversationManager.c                           |  129 ++++----
 android/workspace/im.pidgin.libpurple/native/CoreManager.c                                   |    3 +-
 android/workspace/im.pidgin.libpurple/native/EventLoop.c                                     |    4 +-
 android/workspace/im.pidgin.libpurple/native/PurpleAccount.c                                 |   84 ++++-
 android/workspace/im.pidgin.libpurple/native/PurpleAccountManager.c                          |   16 +-
 android/workspace/im.pidgin.libpurple/native/PurpleBlistManager.c                            |  151 +++++++++-
 android/workspace/im.pidgin.libpurple/native/helpers.c                                       |    2 +-
 android/workspace/im.pidgin.libpurple/native/helpers.h                                       |   15 +-
 android/workspace/im.pidgin.libpurple/native/logging.c                                       |    8 +-
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/account/PurpleAccount.java     |   67 +++-
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlist.java         |   11 +
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistGroup.java    |   12 +
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistListener.java |   12 +
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistManager.java  |  119 +++++++-
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java     |   10 +-
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleContact.java       |   44 ++-
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/buddy/PurpleBuddy.java         |   62 ++++
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/buddy/PurpleBuddyListener.java |   11 +
 android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/core/PurpleInstance.java       |    5 +
 20 files changed, 707 insertions(+), 133 deletions(-)

diffs (truncated from 1370 to 300 lines):

diff --git a/android/workspace/im.pidgin.libpurple/.cproject b/android/workspace/im.pidgin.libpurple/.cproject
--- a/android/workspace/im.pidgin.libpurple/.cproject
+++ b/android/workspace/im.pidgin.libpurple/.cproject
@@ -126,7 +126,7 @@
 								<option id="gnu.c.link.option.paths.727652150" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
 									<listOptionValue builtIn="false" value=""${workspace_loc:/im.pidgin.libpurple.build/build/prefix/lib}""/>
 								</option>
-								<option id="gnu.c.link.option.shared.1562332002" superClass="gnu.c.link.option.shared" value="true" valueType="boolean"/>
+								<option id="gnu.c.link.option.shared.1562332002" name="Shared (-shared)" superClass="gnu.c.link.option.shared" value="true" valueType="boolean"/>
 								<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.425224706" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
 									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
 									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
@@ -147,6 +147,79 @@
 			</storageModule>
 			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
 		</cconfiguration>
+		<cconfiguration id="cdt.managedbuild.config.gnu.so.debug.1745735721">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.so.debug.1745735721" moduleId="org.eclipse.cdt.core.settings" name="X86">
+				<externalSettings>
+					<externalSetting>
+						<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/im.pidgin.libpurple"/>
+						<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/im.pidgin.libpurple/X86"/>
+						<entry flags="RESOLVED" kind="libraryFile" name="im.pidgin.libpurple"/>
+					</externalSetting>
+				</externalSettings>
+				<extensions>
+					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+				</extensions>
+			</storageModule>
+			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+				<configuration artifactExtension="so" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.so.debug.1745735721" name="X86" parent="cdt.managedbuild.config.gnu.so.debug">
+					<folderInfo id="cdt.managedbuild.config.gnu.so.debug.1745735721." name="/" resourcePath="">
+						<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.209686057" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
+							<targetPlatform id="cdt.managedbuild.target.gnu.platform.so.debug.656763621" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.so.debug"/>
+							<builder buildPath="${workspace_loc:/im.pidgin.libpurple/X86}" id="cdt.managedbuild.target.gnu.builder.so.debug.1359492899" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.so.debug"/>
+							<tool id="cdt.managedbuild.tool.gnu.archiver.base.1061557494" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.1248043531" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
+								<option id="gnu.cpp.compiler.so.debug.option.optimization.level.141436244" name="Optimization Level" superClass="gnu.cpp.compiler.so.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+								<option id="gnu.cpp.compiler.so.debug.option.debugging.level.1053898672" name="Debug Level" superClass="gnu.cpp.compiler.so.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.910888794" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug">
+								<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.so.debug.option.optimization.level.197201624" name="Optimization Level" superClass="gnu.c.compiler.so.debug.option.optimization.level" valueType="enumerated"/>
+								<option id="gnu.c.compiler.so.debug.option.debugging.level.1007772549" name="Debug Level" superClass="gnu.c.compiler.so.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+								<option id="gnu.c.compiler.option.include.paths.1533716925" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+									<listOptionValue builtIn="false" value="/usr/lib/jvm/java-1.6.0-openjdk/include"/>
+									<listOptionValue builtIn="false" value="/usr/local/include/glib-2.0"/>
+									<listOptionValue builtIn="false" value="/usr/local/lib/glib-2.0/include"/>
+									<listOptionValue builtIn="false" value="/usr/include/glib-2.0"/>
+									<listOptionValue builtIn="false" value="/usr/include/libxml2"/>
+								</option>
+								<option id="gnu.c.compiler.option.preprocessor.def.symbols.1975353103" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+									<listOptionValue builtIn="false" value="X86"/>
+								</option>
+								<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.205025133" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1635656648" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug">
+								<option defaultValue="true" id="gnu.c.link.so.debug.option.shared.405347103" name="Shared (-shared)" superClass="gnu.c.link.so.debug.option.shared" valueType="boolean"/>
+								<option id="gnu.c.link.option.libs.164998706" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
+									<listOptionValue builtIn="false" value="gobject-2.0"/>
+									<listOptionValue builtIn="false" value="gmodule-2.0"/>
+									<listOptionValue builtIn="false" value="gthread-2.0"/>
+									<listOptionValue builtIn="false" value="glib-2.0"/>
+									<listOptionValue builtIn="false" value="xml2"/>
+								</option>
+								<option id="gnu.c.link.option.paths.220161904" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
+									<listOptionValue builtIn="false" value="/usr/local/lib"/>
+								</option>
+								<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.408341589" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
+								</inputType>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.1090188366" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug">
+								<option defaultValue="true" id="gnu.cpp.link.so.debug.option.shared.283085789" name="Shared (-shared)" superClass="gnu.cpp.link.so.debug.option.shared" valueType="boolean"/>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.assembler.so.debug.1328620061" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug">
+								<inputType id="cdt.managedbuild.tool.gnu.assembler.input.321063991" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+							</tool>
+						</toolChain>
+					</folderInfo>
+				</configuration>
+			</storageModule>
+			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+		</cconfiguration>
 	</storageModule>
 	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
 		<project id="im.pidgin.libpurple.null.1844386711" name="im.pidgin.libpurple"/>
diff --git a/android/workspace/im.pidgin.libpurple/native/ConversationManager.c b/android/workspace/im.pidgin.libpurple/native/ConversationManager.c
--- a/android/workspace/im.pidgin.libpurple/native/ConversationManager.c
+++ b/android/workspace/im.pidgin.libpurple/native/ConversationManager.c
@@ -11,90 +11,92 @@
 #include <libpurple/conversation.h>
 
 JavaObjectReference conversationManager = JAVA_NULL_OBJECT_REF;
-static void create_conversation(PurpleConversation* conv);
-static void destroy_conversation(PurpleConversation* conv);
-static void write_im(PurpleConversation* conv, const char* who, const char* message, PurpleMessageFlags flags, time_t mtime);
+static void
+create_conversation(PurpleConversation* conv);
+static void
+destroy_conversation(PurpleConversation* conv);
+static void
+write_im(PurpleConversation* conv, const char* who, const char* message,
+		PurpleMessageFlags flags, time_t mtime);
 
-PurpleConversationUiOps conversation_ui_ops = {
-		create_conversation,
-		destroy_conversation,
-		NULL,
-		write_im,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-};
+PurpleConversationUiOps conversation_ui_ops = { create_conversation,
+		destroy_conversation, NULL, write_im, NULL, NULL, NULL, NULL, NULL,
+		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, };
 
-static void* conv_get_handle() {
+static void*
+conv_get_handle()
+{
 	static int handle;
 	return &handle;
 }
 
-static void create_conversation(PurpleConversation* conv) {
-static JavaMethodIDCache methodCache = METHOD_CACHE("createConversation", "(J)V");
+static void
+create_conversation(PurpleConversation* conv)
+{
+	static JavaMethodIDCache methodCache =
+			METHOD_CACHE("createConversation", "(J)V");
 
-		jmethodID mid;
-		jlong conv_ptr;
+	jmethodID mid;
+	jlong conv_ptr;
 
-		CALLBACK_START_VOID(&conversationManager);
+	CALLBACK_START_VOID(&conversationManager);
 
-		conv_ptr = pToLong(conv);
+	conv_ptr = pToLong(conv);
 
-		mid = getMethodIDCachedReferenced(env, conversationManager.class, &methodCache);
-		if (mid != NULL) {
-			(*env)->CallVoidMethod(env, conversationManager.handlerObject, mid, conv_ptr);
-		}
+	mid = getMethodIDCachedReferenced(env, conversationManager.java_class,
+			&methodCache);
+	if (mid != NULL) {
+		(*env)->CallVoidMethod(env, conversationManager.handlerObject, mid,
+				conv_ptr);
 	}
+}
 
-static void destroy_conversation(PurpleConversation* conv) {
-static JavaMethodIDCache methodCache = METHOD_CACHE("destroyConversation", "(J)V");
+static void
+destroy_conversation(PurpleConversation* conv)
+{
+	static JavaMethodIDCache methodCache =
+			METHOD_CACHE("destroyConversation", "(J)V");
 
-		jmethodID mid;
-		jlong conv_ptr;
+	jmethodID mid;
+	jlong conv_ptr;
 
-		CALLBACK_START_VOID(&conversationManager);
+	CALLBACK_START_VOID(&conversationManager);
 
-		conv_ptr = pToLong(conv);
+	conv_ptr = pToLong(conv);
 
-		mid = getMethodIDCachedReferenced(env, conversationManager.class, &methodCache);
-		if (mid != NULL) {
-			(*env)->CallVoidMethod(env, conversationManager.handlerObject, mid, conv_ptr);
-		}
+	mid = getMethodIDCachedReferenced(env, conversationManager.java_class,
+			&methodCache);
+	if (mid != NULL) {
+		(*env)->CallVoidMethod(env, conversationManager.handlerObject, mid,
+				conv_ptr);
 	}
+}
 
-static void write_im(PurpleConversation* conv, const char* who, const char* message, PurpleMessageFlags flags, time_t mtime) {
-static JavaMethodIDCache methodCache = METHOD_CACHE("writeIm", "(JLjava/lang/String;Ljava/lang/String;IJ)V");
+static void
+write_im(PurpleConversation* conv, const char* who, const char* message,
+		PurpleMessageFlags flags, time_t mtime)
+{
+	static JavaMethodIDCache methodCache =
+					METHOD_CACHE("writeIm", "(JLjava/lang/String;Ljava/lang/String;IJ)V");
 
-		jmethodID mid;
-		jlong conv_ptr;
-		jstring who_obj;
-		jstring message_obj;
+	jmethodID mid;
+	jlong conv_ptr;
+	jstring who_obj;
+	jstring message_obj;
 
-		CALLBACK_START_VOID(&conversationManager);
+	CALLBACK_START_VOID(&conversationManager);
 
-		conv_ptr = pToLong(conv);
-		who_obj = (*env)->NewStringUTF(env, who);
-		message_obj = (*env)->NewStringUTF(env, message);
+	conv_ptr = pToLong(conv);
+	who_obj = (*env)->NewStringUTF(env, who);
+	message_obj = (*env)->NewStringUTF(env, message);
 
-		mid = getMethodIDCachedReferenced(env, conversationManager.class, &methodCache);
-		if (mid != NULL && who_obj != NULL && message_obj != NULL) {
-			(*env)->CallVoidMethod(env, conversationManager.handlerObject, mid, conv_ptr, who_obj, message_obj, (jint) flags, (jlong) mtime);
-		}
+	mid = getMethodIDCachedReferenced(env, conversationManager.java_class,
+			&methodCache);
+	if (mid != NULL && who_obj != NULL && message_obj != NULL) {
+		(*env)->CallVoidMethod(env, conversationManager.handlerObject, mid,
+				conv_ptr, who_obj, message_obj, (jint) flags, (jlong) mtime);
 	}
-
-
+}
 
 static void
 update_buddy_typing(PurpleAccount* account, const char* who)
@@ -111,7 +113,7 @@
 	account_ptr = pToLong(account);
 	who_obj = (*env)->NewStringUTF(env, who);
 
-	mid = getMethodIDCachedReferenced(env, conversationManager.class,
+	mid = getMethodIDCachedReferenced(env, conversationManager.java_class,
 			&methodCache);
 	if (mid != NULL && who_obj != NULL) {
 		(*env)->CallVoidMethod(env, conversationManager.handlerObject, mid,
@@ -129,8 +131,7 @@
 {
 	setJavaObject(&conversationManager, env, obj);
 	purple_signal_connect(purple_conversations_get_handle(), "buddy-typing",
-			conv_get_handle(), PURPLE_CALLBACK(update_buddy_typing),
-			NULL);
+			conv_get_handle(), PURPLE_CALLBACK(update_buddy_typing), NULL);
 	purple_signal_connect(purple_conversations_get_handle(),
 			"buddy-typing-stopped", conv_get_handle(),
 			PURPLE_CALLBACK(update_buddy_typing), NULL);
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
@@ -9,7 +9,6 @@
 #include <libpurple/plugin.h>
 #include <libpurple/blist.h>
 #include <libpurple/pounce.h>
-#include <android/log.h>
 
 #include "CoreManager.h"
 #include "EventLoop.h"
@@ -36,7 +35,7 @@
 
 	CALLBACK_START_VOID(&coreManagerInstance);
 
-	mid = getMethodIDCachedReferenced(env, coreManagerInstance.class,
+	mid = getMethodIDCachedReferenced(env, coreManagerInstance.java_class,
 			&methodCache);
 	if (mid != NULL) {
 		(*env)->CallVoidMethod(env, coreManagerInstance.handlerObject, mid);
diff --git a/android/workspace/im.pidgin.libpurple/native/EventLoop.c b/android/workspace/im.pidgin.libpurple/native/EventLoop.c
--- a/android/workspace/im.pidgin.libpurple/native/EventLoop.c
+++ b/android/workspace/im.pidgin.libpurple/native/EventLoop.c
@@ -66,7 +66,7 @@
 	function_ptr = pToLong(function);
 	data_ptr = pToLong(data);
 
-	mid = getMethodIDCachedReferenced(env, eventloop.class, &methodCache);
+	mid = getMethodIDCachedReferenced(env, eventloop.java_class, &methodCache);
 	if (mid != NULL) {
 		result = (*env)->CallIntMethod(env, eventloop.handlerObject, mid,
 				(jint) interval, function_ptr, data_ptr);



More information about the Commits mailing list