--- a/.classpath Sat Mar 14 22:19:51 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry excluding="jlibrtpDemos/XmlPacketPlayer.java|jlibrtpDemos/XmlPacketRecorder.java" kind="src" path="src"/>
- <classpathentry kind="lib" path="libs/smack.jar" sourcepath="/home/nikita/devel/smack_src_3_1_0"/>
- <classpathentry kind="lib" path="libs/smackx-debug.jar"/>
- <classpathentry kind="lib" path="libs/smackx-jingle.jar" sourcepath="/home/nikita/devel/smack_src_3_1_0"/>
- <classpathentry kind="lib" path="libs/smackx.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="/home/nikita/android/android.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,2 @@
+bin/*
+R.java
--- a/.project Sat Mar 14 22:19:51 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>smack</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.android.ide.eclipse.adt.ApkBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
--- a/AndroidManifest.xml Sat Mar 14 22:19:51 2009 +0100
+++ b/AndroidManifest.xml Mon Mar 23 16:54:42 2009 +0100
@@ -1,15 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.beem.project.beem"
- android:versionCode="1"
- android:versionName="1.0">
- <application android:label="@string/app_name">
- <activity android:name=".Beem"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
+ package="com.beem.project.beem" android:versionCode="1"
+ android:versionName="1.0">
+ <application android:label="@string/app_name">
+ <activity android:name=".ui.Beem" android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name=".ui.ContactList" android:label="@string/app_name" />
+ <service android:name="BeemService" android:enabled="true"
+ android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE">
+ <intent-filter>
+ <action android:name="com.beem.project.beem.BeemService"></action>
+ </intent-filter>
+ </service>
+ </application>
+ <permission android:permissionGroup="android.permission-group.NETWORK"
+ android:label="BeemService" android:description="@string/BeemServiceDescription"
+ android:name="com.beem.project.beem.BEEM_SERVICE"></permission>
+ <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+ <uses-permission android:name="android.permission.VIBRATE"></uses-permission>
+ <uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
</manifest>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Beem-ecipse-formatter.xml Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles version="11">
+<profile kind="CodeFormatterProfile" name="Eclipse [good tabsize]" version="11">
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="mixed"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="8"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
+<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
+<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+</profile>
+</profiles>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/checkstyle.xml Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,225 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions from:
+
+ - the Java Language Specification at
+ http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+ - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+ - the Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+ - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+
+ <!-- Checks that a package.html file exists for each package. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
+ <module name="PackageHtml"/>
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <module name="NewlineAtEndOfFile"/>
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation"/>
+
+
+ <module name="TreeWalker">
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <module name="JavadocMethod">
+ <property name="allowUndeclaredRTE" value="true"/>
+ </module>
+ <module name="JavadocType"/>
+ <module name="JavadocVariable">
+ <property name="scope" value="package" />
+ </module>
+ <module name="JavadocStyle">
+ <property name="checkEmptyJavadoc" value="true"/>
+ </module>
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName"/>
+ <module name="LocalFinalVariableName"/>
+ <module name="LocalVariableName"/>
+ <module name="MemberName">
+ <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/>
+ </module>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
+
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!-- <module name="Header"> -->
+ <!-- The follow property value demonstrates the ability -->
+ <!-- to have access to ANT properties. In this case it uses -->
+ <!-- the ${basedir} property to allow Checkstyle to be run -->
+ <!-- from any directory within a project. See property -->
+ <!-- expansion, -->
+ <!-- http://checkstyle.sf.net/config.html#properties -->
+ <!-- <property -->
+ <!-- name="headerFile" -->
+ <!-- value="${basedir}/java.header"/> -->
+ <!-- </module> -->
+
+ <!-- Following interprets the header file as regular expressions. -->
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="FileLength"/>
+ <module name="LineLength">
+ <property name="max" value="120" />
+ </module>
+ <module name="MethodLength"/>
+ <module name="ParameterNumber"/>
+ <module name="AnonInnerLength">
+ <property name="max" value="60" />
+ </module>
+
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad"/>
+ <module name="MethodParamPad"/>
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <!-- We want mixed tabulation
+ <module name="TabCharacter"/>
+ -->
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks"/>
+ <module name="EmptyBlock"/>
+ <module name="LeftCurly"/>
+ <!--
+ <module name="NeedBraces"/>
+ -->
+ <module name="RightCurly"/>
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <module name="CovariantEquals"/>
+ <module name="AvoidInlineConditionals"/>
+ <module name="InnerAssignment" />
+ <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField">
+ <property name="ignoreConstructorParameter" value="true"/>
+ <property name="ignoreAbstractMethods" value="true"/>
+ <property name="ignoreSetter" value="true"/>
+ </module>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ <!--
+ <module name="MagicNumber"/>
+ -->
+ <module name="MissingSwitchDefault"/>
+ <module name="RedundantThrows"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+ <module name="StringLiteralEquality"/>
+ <module name="SuperFinalize"/>
+ <module name="IllegalCatch"/>
+ <module name="IllegalThrows"/>
+ <module name="PackageDeclaration"/>
+ <module name="JUnitTestCase"/>
+ <module name="DeclarationOrder"/>
+ <module name="ExplicitInitialization"/>
+ <module name="DefaultComesLast"/>
+ <module name="MissingCtor"/>
+ <module name="FallThrough"/>
+ <module name="MultipleStringLiterals"/>
+ <module name="MultipleVariableDeclarations"/>
+ <module name="UnnecessaryParentheses"/>
+ <module name="ParameterAssignment"/>
+ <module name="SuperClone"/>
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <module name="DesignForExtension"/>
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+ <module name="VisibilityModifier"/>
+ <module name="MutableException"/>
+
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="ArrayTypeStyle"/>
+ <module name="FinalParameters">
+ <property name="tokens" value="CTOR_DEF"/>
+ </module>
+ <module name="Indentation"/>
+
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ <module name="TodoComment"/>
+ <module name="UpperEll"/>
+
+ <module name="BooleanExpressionComplexity"/>
+ <module name="UpperEll"/>
+
+
+ <module name="ArrayTypeStyle"/>
+
+ </module>
+ <module name="StrictDuplicateCode"/>
+ <module name="NewlineAtEndOfFile"/>
+
+</module>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/new-android-r1.diff Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,436 @@
+Index: source/org/jivesoftware/smack/XMPPConnection.java
+===================================================================
+--- source/org/jivesoftware/smack/XMPPConnection.java (révision 10982)
++++ source/org/jivesoftware/smack/XMPPConnection.java (copie de travail)
+@@ -1082,7 +1082,7 @@
+ catch (Exception ex) {
+ try {
+ debuggerClass =
+- Class.forName("org.jivesoftware.smack.debugger.LiteDebugger");
++ Class.forName("org.jivesoftware.smack.debugger.ConsoleDebugger");
+ }
+ catch (Exception ex2) {
+ ex2.printStackTrace();
+Index: source/org/jivesoftware/smack/sasl/SASLMechanism.java
+===================================================================
+--- source/org/jivesoftware/smack/sasl/SASLMechanism.java (révision 10982)
++++ source/org/jivesoftware/smack/sasl/SASLMechanism.java (copie de travail)
+@@ -20,24 +20,18 @@
+
+ package org.jivesoftware.smack.sasl;
+
+-import org.jivesoftware.smack.XMPPException;
+-import org.jivesoftware.smack.SASLAuthentication;
+-import org.jivesoftware.smack.util.Base64;
+-
+ import java.io.IOException;
+-import java.util.Map;
+ import java.util.HashMap;
++import java.util.Map;
++
++import javax.security.auth.callback.Callback;
+ import javax.security.auth.callback.CallbackHandler;
+ import javax.security.auth.callback.UnsupportedCallbackException;
+-import javax.security.auth.callback.Callback;
+-import javax.security.auth.callback.NameCallback;
+-import javax.security.auth.callback.PasswordCallback;
+-import javax.security.sasl.RealmCallback;
+-import javax.security.sasl.RealmChoiceCallback;
+-import javax.security.sasl.Sasl;
+-import javax.security.sasl.SaslClient;
+-import javax.security.sasl.SaslException;
+
++import org.jivesoftware.smack.SASLAuthentication;
++import org.jivesoftware.smack.XMPPException;
++import org.jivesoftware.smack.util.Base64;
++
+ /**
+ * Base class for SASL mechanisms. Subclasses must implement these methods:
+ * <ul>
+@@ -56,7 +50,7 @@
+ public abstract class SASLMechanism implements CallbackHandler {
+
+ private SASLAuthentication saslAuthentication;
+- protected SaslClient sc;
++ //protected SaslClient sc;
+ protected String authenticationId;
+ protected String password;
+ protected String hostname;
+@@ -88,7 +82,7 @@
+
+ String[] mechanisms = { getName() };
+ Map<String,String> props = new HashMap<String,String>();
+- sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
++ //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
+ authenticate();
+ }
+
+@@ -105,7 +99,7 @@
+ public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
+ String[] mechanisms = { getName() };
+ Map<String,String> props = new HashMap<String,String>();
+- sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
++ //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
+ authenticate();
+ }
+
+@@ -113,17 +107,17 @@
+ StringBuilder stanza = new StringBuilder();
+ stanza.append("<auth mechanism=\"").append(getName());
+ stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">");
+- try {
+- if(sc.hasInitialResponse()) {
+- byte[] response = sc.evaluateChallenge(new byte[0]);
+- String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
+- if(authenticationText != null && !authenticationText.equals("")) {
+- stanza.append(authenticationText);
+- }
+- }
+- } catch (SaslException e) {
+- throw new XMPPException("SASL authentication failed", e);
+- }
++// try {
++// if(sc.hasInitialResponse()) {
++// byte[] response = sc.evaluateChallenge(new byte[0]);
++// String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
++// if(authenticationText != null && !authenticationText.equals("")) {
++// stanza.append(authenticationText);
++// }
++// }
++// } catch (SaslException e) {
++// throw new XMPPException("SASL authentication failed", e);
++// }
+ stanza.append("</auth>");
+
+ // Send the authentication to the server
+@@ -142,12 +136,12 @@
+ // Build the challenge response stanza encoding the response text
+ StringBuilder stanza = new StringBuilder();
+
+- byte response[];
+- if(challenge != null) {
+- response = sc.evaluateChallenge(Base64.decode(challenge));
+- } else {
+- response = sc.evaluateChallenge(null);
+- }
++ byte response[] = null;
++// if(challenge != null) {
++// response = sc.evaluateChallenge(Base64.decode(challenge));
++// } else {
++// response = sc.evaluateChallenge(null);
++// }
+
+ String authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES);
+ if(authenticationText.equals("")) {
+@@ -179,21 +173,21 @@
+ */
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+- if (callbacks[i] instanceof NameCallback) {
+- NameCallback ncb = (NameCallback)callbacks[i];
+- ncb.setName(authenticationId);
+- } else if(callbacks[i] instanceof PasswordCallback) {
+- PasswordCallback pcb = (PasswordCallback)callbacks[i];
+- pcb.setPassword(password.toCharArray());
+- } else if(callbacks[i] instanceof RealmCallback) {
+- RealmCallback rcb = (RealmCallback)callbacks[i];
+- rcb.setText(hostname);
+- } else if(callbacks[i] instanceof RealmChoiceCallback){
+- //unused
+- //RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];
+- } else {
++// if (callbacks[i] instanceof NameCallback) {
++// NameCallback ncb = (NameCallback)callbacks[i];
++// ncb.setName(authenticationId);
++// } else if(callbacks[i] instanceof PasswordCallback) {
++// PasswordCallback pcb = (PasswordCallback)callbacks[i];
++// pcb.setPassword(password.toCharArray());
++// } else if(callbacks[i] instanceof RealmCallback) {
++// RealmCallback rcb = (RealmCallback)callbacks[i];
++// rcb.setText(hostname);
++// } else if(callbacks[i] instanceof RealmChoiceCallback){
++// //unused
++// //RealmChoiceCallback rccb = (RealmChoiceCallback)callbacks[i];
++// } else {
+ throw new UnsupportedCallbackException(callbacks[i]);
+- }
++ //}
+ }
+ }
+ }
+Index: source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java
+===================================================================
+--- source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java (révision 10982)
++++ source/org/jivesoftware/smack/sasl/SASLGSSAPIMechanism.java (copie de travail)
+@@ -25,8 +25,6 @@
+ import java.io.IOException;
+ import java.util.Map;
+ import java.util.HashMap;
+-import javax.security.sasl.Sasl;
+-import javax.security.sasl.SaslClient;
+ import javax.security.auth.callback.CallbackHandler;
+
+ /**
+@@ -62,8 +60,8 @@
+ public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
+ String[] mechanisms = { getName() };
+ Map props = new HashMap();
+- props.put(Sasl.SERVER_AUTH,"TRUE");
+- sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
++ //props.put(Sasl.SERVER_AUTH,"TRUE");
++ //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
+ authenticate();
+ }
+
+@@ -81,8 +79,8 @@
+ public void authenticate(String username, String host, String password) throws IOException, XMPPException {
+ String[] mechanisms = { getName() };
+ Map props = new HashMap();
+- props.put(Sasl.SERVER_AUTH,"TRUE");
+- sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
++ //props.put(Sasl.SERVER_AUTH,"TRUE");
++ //sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
+ authenticate();
+ }
+
+Index: source/org/jivesoftware/smack/ConnectionConfiguration.java
+===================================================================
+--- source/org/jivesoftware/smack/ConnectionConfiguration.java (révision 10982)
++++ source/org/jivesoftware/smack/ConnectionConfiguration.java (copie de travail)
+@@ -57,13 +57,13 @@
+
+ private boolean compressionEnabled = false;
+
+- private boolean saslAuthenticationEnabled = true;
++ private boolean saslAuthenticationEnabled = false;
+ /**
+ * Used to get information from the user
+ */
+ private CallbackHandler callbackHandler;
+
+- private boolean debuggerEnabled = XMPPConnection.DEBUG_ENABLED;
++ private boolean debuggerEnabled = true;//XMPPConnection.DEBUG_ENABLED;
+
+ // Flag that indicates if a reconnection should be attempted when abruptly disconnected
+ private boolean reconnectionAllowed = true;
+@@ -517,7 +517,7 @@
+ * logging into the server.
+ */
+ public void setSASLAuthenticationEnabled(boolean saslAuthenticationEnabled) {
+- this.saslAuthenticationEnabled = saslAuthenticationEnabled;
++ //this.saslAuthenticationEnabled = saslAuthenticationEnabled;
+ }
+
+ /**
+Index: source/org/jivesoftware/smack/util/DNSUtil.java
+===================================================================
+--- source/org/jivesoftware/smack/util/DNSUtil.java (révision 10982)
++++ source/org/jivesoftware/smack/util/DNSUtil.java (copie de travail)
+@@ -24,9 +24,6 @@
+
+ import javax.naming.NamingEnumeration;
+ import javax.naming.directory.Attribute;
+-import javax.naming.directory.Attributes;
+-import javax.naming.directory.DirContext;
+-import javax.naming.directory.InitialDirContext;
+
+ /**
+ * Utilty class to perform DNS lookups for XMPP services.
+@@ -41,13 +38,13 @@
+ */
+ private static Map cache = new Cache(100, 1000*60*10);
+
+- private static DirContext context;
++// private static DirContext context;
+
+ static {
+ try {
+ Hashtable env = new Hashtable();
+ env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
+- context = new InitialDirContext(env);
++ // context = new InitialDirContext(env);
+ }
+ catch (Exception e) {
+ // Ignore.
+@@ -79,64 +76,7 @@
+ * server can be reached at for the specified domain.
+ */
+ public static HostAddress resolveXMPPDomain(String domain) {
+- if (context == null) {
+ return new HostAddress(domain, 5222);
+- }
+- String key = "c" + domain;
+- // Return item from cache if it exists.
+- if (cache.containsKey(key)) {
+- HostAddress address = (HostAddress)cache.get(key);
+- if (address != null) {
+- return address;
+- }
+- }
+- String bestHost = domain;
+- int bestPort = 5222;
+- int bestPriority = 0;
+- int bestWeight = 0;
+- try {
+- Attributes dnsLookup = context.getAttributes("_xmpp-client._tcp." + domain, new String[]{"SRV"});
+- Attribute srvAttribute = dnsLookup.get("SRV");
+- NamingEnumeration srvRecords = srvAttribute.getAll();
+- while(srvRecords.hasMore()) {
+- String srvRecord = (String) srvRecords.next();
+- String [] srvRecordEntries = srvRecord.split(" ");
+- int priority = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 4]);
+- int port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
+- int weight = Integer.parseInt(srvRecordEntries[srvRecordEntries.length - 3]);
+- String host = srvRecordEntries[srvRecordEntries.length-1];
+-
+- // Randomize the weight.
+- weight *= Math.random() * weight;
+-
+- if ((bestPriority == 0) || (priority < bestPriority)) {
+- // Choose a server with the lowest priority.
+- bestPriority = priority;
+- bestWeight = weight;
+- bestHost = host;
+- bestPort = port;
+- } else if (priority == bestPriority) {
+- // When we have like priorities then randomly choose a server based on its weight
+- // The weights were randomized above.
+- if (weight > bestWeight) {
+- bestWeight = weight;
+- bestHost = host;
+- bestPort = port;
+- }
+- }
+- }
+- }
+- catch (Exception e) {
+- // Ignore.
+- }
+- // Host entries in DNS should end with a ".".
+- if (bestHost.endsWith(".")) {
+- bestHost = bestHost.substring(0, bestHost.length()-1);
+- }
+- HostAddress address = new HostAddress(bestHost, bestPort);
+- // Add item to cache.
+- cache.put(key, address);
+- return address;
+ }
+
+ /**
+@@ -157,49 +97,7 @@
+ * server can be reached at for the specified domain.
+ */
+ public static HostAddress resolveXMPPServerDomain(String domain) {
+- if (context == null) {
+ return new HostAddress(domain, 5269);
+- }
+- String key = "s" + domain;
+- // Return item from cache if it exists.
+- if (cache.containsKey(key)) {
+- HostAddress address = (HostAddress)cache.get(key);
+- if (address != null) {
+- return address;
+- }
+- }
+- String host = domain;
+- int port = 5269;
+- try {
+- Attributes dnsLookup =
+- context.getAttributes("_xmpp-server._tcp." + domain, new String[]{"SRV"});
+- String srvRecord = (String)dnsLookup.get("SRV").get();
+- String [] srvRecordEntries = srvRecord.split(" ");
+- port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
+- host = srvRecordEntries[srvRecordEntries.length-1];
+- }
+- catch (Exception e) {
+- // Attempt lookup with older "jabber" name.
+- try {
+- Attributes dnsLookup =
+- context.getAttributes("_jabber._tcp." + domain, new String[]{"SRV"});
+- String srvRecord = (String)dnsLookup.get("SRV").get();
+- String [] srvRecordEntries = srvRecord.split(" ");
+- port = Integer.parseInt(srvRecordEntries[srvRecordEntries.length-2]);
+- host = srvRecordEntries[srvRecordEntries.length-1];
+- }
+- catch (Exception e2) {
+- // Ignore.
+- }
+- }
+- // Host entries in DNS should end with a ".".
+- if (host.endsWith(".")) {
+- host = host.substring(0, host.length()-1);
+- }
+- HostAddress address = new HostAddress(host, port);
+- // Add item to cache.
+- cache.put(key, address);
+- return address;
+ }
+
+ /**
+@@ -253,4 +151,4 @@
+ return port == address.port;
+ }
+ }
+-}
+\ No newline at end of file
++}
+Index: source/org/jivesoftware/smack/util/PacketParserUtils.java
+===================================================================
+--- source/org/jivesoftware/smack/util/PacketParserUtils.java (révision 10982)
++++ source/org/jivesoftware/smack/util/PacketParserUtils.java (copie de travail)
+@@ -25,7 +25,7 @@
+ import org.jivesoftware.smack.provider.ProviderManager;
+ import org.xmlpull.v1.XmlPullParser;
+
+-import java.beans.PropertyDescriptor;
++//import java.beans.PropertyDescriptor;
+ import java.io.ByteArrayInputStream;
+ import java.io.ObjectInputStream;
+ import java.util.ArrayList;
+@@ -428,26 +428,26 @@
+ {
+ boolean done = false;
+ Object object = objectClass.newInstance();
+- while (!done) {
+- int eventType = parser.next();
+- if (eventType == XmlPullParser.START_TAG) {
+- String name = parser.getName();
+- String stringValue = parser.nextText();
+- PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
+- // Load the class type of the property.
+- Class propertyType = descriptor.getPropertyType();
+- // Get the value of the property by converting it from a
+- // String to the correct object type.
+- Object value = decode(propertyType, stringValue);
+- // Set the value of the bean.
+- descriptor.getWriteMethod().invoke(object, value);
+- }
+- else if (eventType == XmlPullParser.END_TAG) {
+- if (parser.getName().equals(elementName)) {
+- done = true;
+- }
+- }
+- }
++// while (!done) {
++// int eventType = parser.next();
++// if (eventType == XmlPullParser.START_TAG) {
++// String name = parser.getName();
++// String stringValue = parser.nextText();
++// PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
++// // Load the class type of the property.
++// Class propertyType = descriptor.getPropertyType();
++// // Get the value of the property by converting it from a
++// // String to the correct object type.
++// Object value = decode(propertyType, stringValue);
++// // Set the value of the bean.
++// descriptor.getWriteMethod().invoke(object, value);
++// }
++// else if (eventType == XmlPullParser.END_TAG) {
++// if (parser.getName().equals(elementName)) {
++// done = true;
++// }
++// }
++// }
+ return object;
+ }
+
Binary file libs/smack.jar has changed
Binary file libs/smackx-debug.jar has changed
Binary file libs/smackx-jingle.jar has changed
Binary file libs/smackx.jar has changed
Binary file res/drawable/avatar.png has changed
Binary file res/drawable/bart.jpg has changed
Binary file res/drawable/logo.jpg has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/beem.xml Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+
+ <ImageView android:id="@+id/logo"
+ android:src="@drawable/logo"
+ android:adjustViewBounds="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <TextView android:text="@string/BeemJabberID"
+ android:textSize="25sp"
+ android:paddingLeft="100sp"
+ android:paddingTop="50sp"
+ android:paddingBottom="15sp"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+
+ <ImageView android:id="@+id/avatar"
+ android:src="@drawable/bart"
+ android:paddingTop="10sp"
+ android:paddingBottom="10sp"
+ android:adjustViewBounds="true"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
+
+ <Button android:id="@+id/connection"
+ android:textSize="20sp"
+ android:singleLine="true"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
+
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/beemdialogsettings.xml Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Host/Port:"
+ android:minWidth="70dp"
+ />
+
+ <EditText android:id="@+id/host"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="16sp"
+ android:autoText="false"
+ android:capitalize="none"
+ android:minWidth="150dp"
+ android:scrollHorizontally="true"/>
+ <EditText android:id="@+id/port"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="16sp"
+ android:autoText="false"
+ android:minWidth="80dp"
+ android:capitalize="none"
+ android:scrollHorizontally="true"/>
+ </LinearLayout>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Userid:"
+ android:minWidth="70dp"
+ />
+ <EditText android:id="@+id/userid"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textSize="16sp"
+ android:autoText="false"
+ android:minWidth="250dp"
+ android:capitalize="none"
+ android:scrollHorizontally="true"/>
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Password:"
+ android:minWidth="70dp"
+ />
+ <EditText android:id="@+id/password"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:password="true"
+ android:textSize="16sp"
+ android:autoText="false"
+ android:minWidth="250dp"
+ android:capitalize="none"
+ android:scrollHorizontally="true"/>
+ </LinearLayout>
+
+ <Button android:id="@+id/ok"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="OK">
+ <requestFocus/>
+ </Button>
+</LinearLayout>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/contactlist.xml Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <ImageView android:id="@+id/avatar"
+ android:src="@drawable/avatar"
+ android:paddingLeft="50sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <TextView android:id="@+id/textchild"
+ android:textSize="16sp"
+ android:paddingLeft="100sp"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"/>
+
+ </LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/contactlistgroup.xml Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView android:id="@+id/textgroup"
+ android:height="50sp"
+ android:textSize="20sp"
+ android:textStyle="bold"
+ android:paddingTop="10sp"
+ android:paddingLeft="40sp"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+
+ </LinearLayout>
--- a/res/layout/main.xml Sat Mar 14 22:19:51 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
-<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Hello World, Beem"
- />
-</LinearLayout>
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/menu/beemmenu.xml Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,4 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:title="Creer ou Editer un compte" android:id="@+id/account_edit"/>
+ <item android:title="L'equipe Beem" android:id="@+id/account_about"/>
+</menu>
--- a/res/values/strings.xml Sat Mar 14 22:19:51 2009 +0100
+++ b/res/values/strings.xml Mon Mar 23 16:54:42 2009 +0100
@@ -1,4 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="app_name">Beem</string>
+ <string name="app_name">Beem</string>
+
+ <!-- Class Beem -->
+ <string name="BeemCreateAccount">Creer un compte</string>
+ <string name="BeemJabberID">Jabber ID</string>
+
+ <!-- Class BeemService -->
+ <string name="BeemServiceDescription">Use the Beem Service</string>
+ <string name="BeemServiceCreated">BeemService Created</string>
+ <string name="BeemServiceDestroyed">BeemService destroyed</string>
+
+ <!-- Preferences information -->
+ <string name="PreferenceFileName">Beem</string>
+ <string name="PreferenceLoginKey">login</string>
+ <string name="PreferenceHostKey">host</string>
+ <string name="PreferencePasswordKey">password</string>
+ <string name="PreferencePortKey">port</string>
</resources>
--- a/src/com/beem/project/beem/Beem.java Sat Mar 14 22:19:51 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-package com.beem.project.beem;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class Beem extends Activity {
-
- /** Called when the activity is first created.
- * @param savedInstanceState toto
- */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/BeemException.java Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,67 @@
+/**
+ *
+ */
+package com.beem.project.beem;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * @author darisk
+ *
+ */
+public class BeemException extends Exception implements Parcelable {
+
+ public static final Parcelable.Creator<BeemException> CREATOR = new Creator<BeemException>() {
+
+ @Override
+ public BeemException[] newArray(int size) {
+ // TODO Auto-generated method stub
+ return new BeemException[size];
+ }
+
+ @Override
+ public BeemException createFromParcel(Parcel source) {
+ // TODO Auto-generated method stub
+ return new BeemException(source);
+ }
+ };
+
+ public BeemException() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public BeemException(String detailMessage, Throwable throwable) {
+ super(detailMessage, throwable);
+ // TODO Auto-generated constructor stub
+ }
+
+ public BeemException(String detailMessage) {
+ super(detailMessage);
+ // TODO Auto-generated constructor stub
+ }
+
+ public BeemException(Throwable throwable) {
+ super(throwable);
+ // TODO Auto-generated constructor stub
+ }
+
+ private BeemException(Parcel parcel){
+ this(parcel.readString());
+ }
+
+ @Override
+ public int describeContents() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ // TODO Auto-generated method stub
+ dest.writeString(getLocalizedMessage());
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/BeemService.java Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,134 @@
+/**
+ *
+ */
+package com.beem.project.beem;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.RosterListener;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.app.Service;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.IBinder;
+import android.os.Looper;
+import android.os.RemoteException;
+import android.widget.Toast;
+
+import com.beem.project.beem.service.XMPPConnectionAdapter;
+import com.beem.project.beem.service.aidl.IXMPPConnection;
+import com.beem.project.beem.service.aidl.IXMPPFacade;
+/**
+ * @author darisk
+ *
+ */
+public class BeemService extends Service {
+
+ private NotificationManager notificationManager;
+
+ private IXMPPConnection connection;
+ private SharedPreferences settings;
+ private String mLogin;
+ private String mPassword;
+ private String mHost;
+
+ private IXMPPFacade.Stub bind = new IXMPPFacade.Stub() {
+
+ @Override
+ public IXMPPConnection getXMPPConnection() throws RemoteException {
+ return connection;
+ }
+
+ @Override
+ public void disconnect() throws RemoteException {
+ connection.disconnect();
+ }
+
+
+ @Override
+ public void connectAsync() throws RemoteException {
+ connection.connectAsync(mLogin, mPassword, "BEEM");
+ }
+
+
+ @Override
+ public void connectSync() throws RemoteException {
+ connection.connectSync(mLogin, mPassword, "BEEM");
+ }
+ };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.app.Service#onBind(android.content.Intent)
+ */
+ @Override
+ public IBinder onBind(Intent intent) {
+ showBasicNotification(R.string.BeemServiceCreated);
+ return bind;
+ // to forbid a client to bind
+ // return null;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ settings = getSharedPreferences(getString(R.string.PreferenceFileName),
+ MODE_PRIVATE);
+ mLogin = settings.getString(getString(R.string.PreferenceLoginKey), "");
+ mPassword = settings.getString(
+ getString(R.string.PreferencePasswordKey), "");
+ mHost = settings.getString(getString(R.string.PreferenceHostKey), "");
+ notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+ connection = new XMPPConnectionAdapter("10.0.2.2"); // address
+ }
+
+ private void showBasicNotification(int stringResource) {
+ String text = (String) getText(stringResource);
+ Notification notif = new Notification(R.drawable.logo, text, System
+ .currentTimeMillis());
+ notif.defaults = Notification.DEFAULT_ALL;
+ notif.setLatestEventInfo(this, text, text, PendingIntent.getActivity(
+ this, 0, new Intent(), 0));
+ notificationManager.notify(stringResource, notif);
+ Toast toast = Toast.makeText(this, R.string.BeemServiceCreated,
+ Toast.LENGTH_LONG);
+ toast.show();
+ }
+
+ @Override
+ public void onStart(Intent intent, int startId) {
+ try {
+ connection.connectSync(mLogin, mPassword, "BEEM");
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ closeConnection();
+ showBasicNotification(R.string.BeemServiceDestroyed);
+ }
+
+ private void closeConnection() {
+ if (connection != null)
+ try {
+ connection.disconnect();
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package com.beem.project.beem.service;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.XMPPException;
+
+import android.os.RemoteException;
+
+import com.beem.project.beem.service.aidl.IRosterEntry;
+import com.beem.project.beem.service.aidl.IRoster.Stub;
+
+/**
+ * @author darisk
+ *
+ */
+public class RosterAdapter extends com.beem.project.beem.service.aidl.IRoster.Stub {
+
+ private Roster adaptee;
+
+ public RosterAdapter(Roster roster) {
+ adaptee = roster;
+ }
+
+ @Override
+ public IRosterEntry createEntry(String user, String name, String[] groups)
+ throws RemoteException {
+ try {
+ adaptee.createEntry(user, name, groups);
+ } catch (XMPPException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public void createGroup(String groupname) throws RemoteException {
+ // TODO Auto-generated method stub
+ adaptee.createGroup(groupname);
+ }
+
+ @Override
+ public List getEntries() throws RemoteException {
+ // TODO Auto-generated method stub
+ Collection<RosterEntry> col = adaptee.getEntries();
+ ArrayList<IRosterEntry> result = new ArrayList<IRosterEntry>(col.size());
+ for (RosterEntry rosterEntry : col ) {
+ result.add(new RosterEntryAdapter(rosterEntry));
+ }
+ return result;
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/RosterEntryAdapter.java Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,42 @@
+/**
+ *
+ */
+package com.beem.project.beem.service;
+
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.packet.RosterPacket.ItemStatus;
+import org.jivesoftware.smack.packet.RosterPacket.ItemType;
+
+import android.os.IBinder;
+import android.os.RemoteException;
+
+import com.beem.project.beem.service.aidl.IRosterEntry;
+
+/**
+ * @author darisk
+ *
+ */
+public class RosterEntryAdapter extends IRosterEntry.Stub {
+
+ private RosterEntry adaptee;
+
+ public RosterEntryAdapter(RosterEntry entry) {
+ adaptee = entry;
+ }
+
+ @Override
+ public String getName() throws RemoteException {
+ return adaptee.getName();
+ }
+
+ @Override
+ public String getUser() throws RemoteException {
+ return adaptee.getUser();
+ }
+
+ @Override
+ public void setName(String name) throws RemoteException {
+ adaptee.setName(name);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/XMPPConnectionAdapter.java Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,263 @@
+/**
+ *
+ */
+package com.beem.project.beem.service;
+
+import org.jivesoftware.smack.ConnectionConfiguration;
+import org.jivesoftware.smack.ConnectionListener;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smackx.ServiceDiscoveryManager;
+import org.jivesoftware.smackx.jingle.JingleManager;
+
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+
+import com.beem.project.beem.BeemException;
+import com.beem.project.beem.service.aidl.IBeemConnectionListener;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IXMPPConnection;
+
+/**
+ * @author darisk
+ *
+ */
+public class XMPPConnectionAdapter extends IXMPPConnection.Stub {
+
+ private XMPPConnection adaptee;
+ private BeemException lastException;
+
+ private RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners = new RemoteCallbackList<IBeemConnectionListener>();
+ private ConnexionListenerAdapter mConListener = new ConnexionListenerAdapter();
+
+ public XMPPConnectionAdapter(XMPPConnection con) {
+ adaptee = con;
+
+ }
+
+ public XMPPConnectionAdapter(String serviceName) {
+ this(new XMPPConnection(serviceName));
+ }
+
+ public XMPPConnectionAdapter(ConnectionConfiguration config) {
+ this(new XMPPConnection(config));
+ }
+
+ @Override
+ public boolean connectSync(String username, String password, String resource)
+ throws RemoteException {
+ try {
+ adaptee.connect();
+ this.initFeatures(); // pour declarer les features xmpp qu'on supporte
+ adaptee.addConnectionListener(mConListener);
+ adaptee.login(username, password, resource);
+ lastException = null;
+ triggerAsynchronousConnectEvent();
+ return true;
+ } catch (XMPPException e) {
+ lastException = new BeemException(e);
+ }
+ return false;
+ }
+
+ public boolean disconnect() {
+ adaptee.disconnect();
+ lastException = null;
+ return true;
+ }
+
+ @Override
+ public IRoster getRoster() throws RemoteException {
+ return new RosterAdapter(adaptee.getRoster());
+ }
+
+ @Override
+ public void connectAsync(final String username, final String password, final String resource)
+ throws RemoteException {
+ Thread t = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ connectSync(username,password,resource);
+ } catch (RemoteException e) {
+
+ }
+ }
+ });
+ t.start();
+ }
+
+ @Override
+ public void addConnectionListener(IBeemConnectionListener listen)
+ throws RemoteException {
+ if (listen != null)
+ mRemoteConnListeners.register(listen);
+ }
+
+ @Override
+ public void removeConnectionListener(IBeemConnectionListener listen)
+ throws RemoteException {
+ if (listen != null)
+ mRemoteConnListeners.unregister(listen);
+ }
+
+ private void triggerAsynchronousConnectEvent() {
+ mConListener.onConnect();
+ }
+
+ private class ConnexionListenerAdapter implements ConnectionListener {
+
+ public void onConnect() {
+ final int N = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < N; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ listener.onConnect();
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+
+ @Override
+ public void connectionClosed() {
+ final int N = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < N; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ listener.connectionClosed();
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+
+ @Override
+ public void connectionClosedOnError(Exception arg0) {
+ final int N = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < N; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ listener.connectionClosedOnError();
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+
+ @Override
+ public void reconnectingIn(int arg0) {
+ final int N = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < N; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ listener.reconnectingIn(arg0);
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+
+ @Override
+ public void reconnectionFailed(Exception arg0) {
+ final int N = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < N; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ listener.reconnectionFailed();
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+
+ @Override
+ public void reconnectionSuccessful() {
+ final int N = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < N; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ listener.reconnectionSuccessful();
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+
+ }
+ /**
+ * @brief: enregistre les featues dispo dans notre version
+ Liste de features que Telepathy supporte:
+ "http://www.google.com/xmpp/protocol/session"
+ "http://www.google.com/transport/p2p"
+ "http://jabber.org/protocol/jingle"
+ "http://jabber.org/protocol/chatstates"
+ "http://jabber.org/protocol/nick"
+ "http://jabber.org/protocol/nick+notify"
+ "http://jabber.org/protocol/si"
+ "ttp://jabber.org/protocol/ibb"
+ "ttp://telepathy.freedesktop.org/xmpp/tubes"
+ "http://www.google.com/xmpp/protocol/voice/v1"
+ "http://jabber.org/protocol/jingle/description/audio"
+ "http://jabber.org/protocol/jingle/description/video"
+
+ Liste de features que pidgin `supporte' (on notera la cradence de l'annonce):
+ "jabber:iq:last"
+ "jabber:iq:oob"
+ "jabber:iq:time"
+ "jabber:iq:version"
+ "jabber:x:conference"
+ "urn:xmpp:attention:0"
+ "urn:xmpp:bob"
+ "urn:xmpp:ping"
+ "xmpp:urn:time"
+ "http://jabber.org/protocol/bytestreams"
+ "http://jabber.org/protocol/disco#info"
+ "http://jabber.org/protocol/disco#items"
+ "http://jabber.org/protocol/ibb"
+ "http://jabber.org/protocol/muc"
+ "http://jabber.org/protocol/muc#user"
+ "http://jabber.org/protocol/si"
+ "http://jabber.org/protocol/si/profile/file-transfer"
+ "http://jabber.org/protocol/xhtml-im"
+ "http://www.xmpp.org/extensions/xep-0199.html#ns"
+ "http://jabber.org/protocol/mood"
+ "http://jabber.org/protocol/mood+notify"
+ "http://jabber.org/protocol/nick"
+ "http://jabber.org/protocol/nick+notify"
+ "http://jabber.org/protocol/tune"
+ "http://jabber.org/protocol/tune+notify"
+ "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata"
+ "http://www.xmpp.org/extensions/xep-0084.html#ns-data"
+ "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata+notify"
+ "http://www.xmpp.org/extensions/xep-0167.html#ns" << Jingle RTP Sessions
+ */
+ private void initFeatures() {
+ JingleManager.setJingleServiceEnabled();
+ ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(adaptee);
+ sdm.addFeature("http://jabber.org/protocol/disco#info");
+ //sdm.addFeature("http://jabber.org/protocol/nick");
+
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IBeemConnectionListener.aidl Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,17 @@
+package com.beem.project.beem.service.aidl;
+
+interface IBeemConnectionListener {
+
+ void connectionClosed();
+
+ void onConnect();
+
+ //void connectionClosedOnError(in Exception e);
+ void connectionClosedOnError();
+
+ void reconnectingIn(in int seconds);
+
+ void reconnectionFailed();
+
+ void reconnectionSuccessful();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IRoster.aidl Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,14 @@
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IRosterEntry;
+
+interface IRoster {
+
+ IRosterEntry createEntry(in String user, in String name, in String[] groups);
+
+ void createGroup(in String groupname);
+
+ // List<IRosterEntry>
+ List getEntries();
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IRosterEntry.aidl Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,12 @@
+package com.beem.project.beem.service.aidl;
+
+interface IRosterEntry {
+
+ String getName();
+ String getUser();
+ void setName(in String name);
+ //TODO
+ // getStatus()
+ // getType
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IXMPPConnection.aidl Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,20 @@
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IBeemConnectionListener;
+
+interface IXMPPConnection {
+
+ boolean connectSync(in String username, in String password, in String resource);
+
+ void connectAsync(in String username, in String password, in String resource);
+
+ boolean disconnect();
+
+ // void login(String username, String password, String resource);
+
+ IRoster getRoster();
+
+ void addConnectionListener(in IBeemConnectionListener listen);
+ void removeConnectionListener(in IBeemConnectionListener listen);
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IXMPPFacade.aidl Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,15 @@
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IXMPPConnection;
+
+interface IXMPPFacade {
+
+ IXMPPConnection getXMPPConnection();
+
+ void connectSync();
+
+ void connectAsync();
+
+ void disconnect();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/Beem.java Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,109 @@
+package com.beem.project.beem.ui;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+import com.beem.project.beem.R;
+
+/**
+ * La principale activite to be continuous.
+ */
+public class Beem extends Activity {
+
+ private SharedPreferences mSettings;
+ private BeemDialogSettings mDialog;
+ private Button mButton;
+ private Handler mHandler;
+
+ /**
+ * Default constructor.
+ */
+ public Beem() {
+ super();
+ mHandler= new Handler();
+ }
+
+ /**
+ * Called when the activity is first created.
+ * @param savedInstanceState
+ * previous state.
+ */
+ @Override
+ public final void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.beem);
+ mSettings = getSharedPreferences(
+ getString(R.string.PreferenceFileName), MODE_PRIVATE);
+ mDialog = new BeemDialogSettings(this, mSettings);
+
+ mButton = (Button) findViewById(R.id.connection);
+ mButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mButton.getText() == getString(R.string.BeemCreateAccount))
+ mDialog.show();
+ else
+ startActivity(new Intent(Beem.this, ContactList.class));
+ }
+ });
+ showJID();
+ }
+
+ /**
+ * Callback for menu creation.
+ * @param menu
+ * the menu created
+ * @return true on success, false otherwise
+ */
+ @Override
+ public final boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.beemmenu, menu);
+ return true;
+ }
+
+ /**
+ * Callback for menu item selected.
+ * @param item
+ * the item selected
+ * @return true on success, false otherwise
+ */
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.account_edit:
+ mDialog.show();
+ return true;
+ case R.id.account_about:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Show jabber id in button.
+ */
+ public final void showJID() {
+ String jid = mSettings.getString(
+ getString(R.string.PreferenceLoginKey), "")
+ + "@"
+ + mSettings
+ .getString(getString(R.string.PreferenceHostKey), "");
+ if (jid.length() == 1)
+ jid = getString(R.string.BeemCreateAccount);
+ mButton.setText(jid);
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/BeemDialogSettings.java Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,76 @@
+package com.beem.project.beem.ui;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.beem.project.beem.R;
+
+/**
+ *
+ */
+public class BeemDialogSettings extends Dialog implements
+ android.view.View.OnClickListener {
+
+ private Beem mbeem;
+
+ private SharedPreferences mSettings;
+
+ public BeemDialogSettings(Beem beem, SharedPreferences settings) {
+ super(beem);
+ this.mbeem = beem;
+ this.mSettings = settings;
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ setContentView(R.layout.beemdialogsettings);
+ getWindow().setFlags(4, 4);
+ setTitle("Jabber Account Settings");
+ showSettings();
+ Button ok = (Button) findViewById(R.id.ok);
+ ok.setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ SharedPreferences.Editor editor = mSettings.edit();
+ Context ctx = getContext();
+ editor.putString(ctx.getString(R.string.PreferenceHostKey),
+ getWidgetText(R.id.host));
+ editor.putString(ctx.getString(R.string.PreferencePortKey),
+ getWidgetText(R.id.port));
+ editor.putString(ctx.getString(R.string.PreferenceLoginKey),
+ getWidgetText(R.id.userid));
+ editor.putString(ctx.getString(R.string.PreferencePasswordKey),
+ getWidgetText(R.id.password));
+ editor.commit();
+ this.mbeem.showJID();
+ dismiss();
+ }
+
+ private void showSettings() {
+ String tmp;
+ EditText eHost = (EditText) findViewById(R.id.host);
+ if ((tmp = mSettings.getString("host", "")) != "")
+ eHost.setText(tmp);
+ EditText ePort = (EditText) findViewById(R.id.port);
+ if ((tmp = mSettings.getString("port", "")) != "")
+ ePort.setText(tmp);
+ EditText eLogin = (EditText) findViewById(R.id.userid);
+ if ((tmp = mSettings.getString("login", "")) != "")
+ eLogin.setText(tmp);
+ EditText ePwd = (EditText) findViewById(R.id.password);
+ if ((tmp = mSettings.getString("password", "")) != "")
+ ePwd.setText(tmp);
+ }
+
+ private String getWidgetText(int id) {
+ EditText widget = (EditText) this.findViewById(id);
+ return widget.getText().toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/ContactList.java Mon Mar 23 16:54:42 2009 +0100
@@ -0,0 +1,134 @@
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import android.app.ExpandableListActivity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+import android.widget.ExpandableListAdapter;
+import android.widget.SimpleExpandableListAdapter;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.aidl.IBeemConnectionListener;
+import com.beem.project.beem.service.aidl.IXMPPConnection;
+import com.beem.project.beem.service.aidl.IXMPPFacade;
+
+public class ContactList extends ExpandableListActivity {
+
+ private IXMPPFacade mService = null;
+
+ @Override
+ public void onCreate(Bundle saveBundle) {
+ super.onCreate(saveBundle);
+ bindService(new Intent(this, BeemService.class), mConnection,
+ BIND_AUTO_CREATE | BIND_DEBUG_UNBIND);
+ }
+
+ private void showContactList() {
+ ExpandableListAdapter Adapter;
+ List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
+ List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
+
+ for (int i = 0; i < 2; i++) {
+ Map<String, String> curGroupMap = new HashMap<String, String>();
+ groupData.add(curGroupMap);
+ curGroupMap.put("NAME", "Group " + i);
+
+ List<Map<String, String>> children = new ArrayList<Map<String, String>>();
+ for (int j = 0; j < 5; j++) {
+ Map<String, String> curChildMap = new HashMap<String, String>();
+ children.add(curChildMap);
+ curChildMap.put("NAOME CHILD", "Child " + j);
+ }
+ childData.add(children);
+ }
+
+ Adapter = new SimpleExpandableListAdapter(this,
+ groupData, R.layout.contactlistgroup,
+ new String[] {"NAME"}, new int[] {R.id.textgroup},
+ childData, R.layout.contactlist,
+ new String[] {"NAME CHILD"}, new int[] {R.id.textchild});
+ setListAdapter(Adapter);
+ }
+
+ private ServiceConnection mConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mService = IXMPPFacade.Stub.asInterface(service);
+ try {
+ IXMPPConnection con = mService.getXMPPConnection();
+ con.addConnectionListener(new TestConnectionListener());
+ mService.connectSync();
+ Log.i("BEEM", "Connected !!!");
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ /*
+ * mService.getGroupList(); mService.getContactList();
+ */
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ }
+
+ };
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ unbindService(mConnection);
+ }
+
+ private class TestConnectionListener extends IBeemConnectionListener.Stub {
+
+ @Override
+ public void connectionClosed() throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void connectionClosedOnError() throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onConnect() throws RemoteException {
+ // TODO Auto-generated method stub
+ showContactList();
+ }
+
+ @Override
+ public void reconnectingIn(int seconds) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void reconnectionFailed() throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void reconnectionSuccessful() throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
+}