--- a/AndroidManifest.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.beem.project.beem"
- android:versionCode="15"
- android:versionName="0.1.8"
- android:installLocation="auto">
-
- <uses-sdk android:minSdkVersion="6" android:targetSdkVersion="16" />
- <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
-
- <permission android:permissionGroup="android.permission-group.NETWORK"
- android:label="BeemService" android:description="@string/BeemServiceDescription"
- android:name="com.beem.project.beem.BEEM_SERVICE"/>
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.VIBRATE"/>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
- <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
- <uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"/>
-
- <supports-screens android:largeScreens="true"
- android:normalScreens="true" android:smallScreens="true" android:anyDensity="true" />
-
- <application android:label="@string/app_name"
- android:icon="@drawable/beem_launcher_icon_silver"
- android:name=".BeemApplication"
- android:allowBackup="true" >
-
- <activity android:name=".ui.Login" android:label="@string/app_name"
- android:launchMode="standard">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name=".ui.wizard.Account" android:label="Account wizard" />
- <activity android:name=".ui.LoginAnim" android:label="@string/login_login_progress"
- android:launchMode="singleTop" android:screenOrientation="portrait" />
- <activity android:name=".ui.Settings" android:label="@string/edit_settings_name" />
- <activity android:name=".ui.Chat" android:label="@string/chat_name"
- android:launchMode="singleTop" />
- <activity android:name=".ui.ChangeStatus" android:label="@string/ChangeStatusActTitle"
- android:launchMode="singleTop"
- android:windowSoftInputMode="stateHidden" />
- <activity android:name=".ui.AddContact" android:label="@string/AddCActTitle" />
- <activity android:name=".ui.Subscription" android:label="@string/app_name" />
-
- <activity android:name=".ui.ContactList" android:label="@string/contact_list_name"
- android:launchMode="singleTask" />
-
- <activity android:name=".ui.GroupList" android:label="GroupList" />
- <activity android:name=".ui.PrivacyList" android:label="@string/privacy_list_name" />
-
- <!-- MemorizingTrustManagerActivity -->
- <activity android:name="de.duenndns.ssl.MemorizingActivity" />
- <!--
- Could be interesting if we would launch beem at startup <receiver
- android:name=".tool.BeemBroadcastReceiver" android:enabled="true">
- <intent-filter> <action
- android:name="android.intent.action.BOOT_COMPLETED" />
- </intent-filter> </receiver>
- -->
- <provider android:name=".providers.AvatarProvider"
- android:authorities="com.beem.project.beem.providers.avatarprovider"
- android:exported="true"
- />
-
- <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>
-
-</manifest>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/build.gradle Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,30 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion "22.0.0"
+
+ defaultConfig {
+ applicationId "com.beem.project.beem"
+ minSdkVersion 6
+ targetSdkVersion 22
+ versionCode 15
+ versionName "0.1.8"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/libs/README.txt Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,10 @@
+This directory contains the libraries used by BEEM.
+
+The principal one is asmack, a portage of the Smack library for the Android
+platform.
+
+The source of the asmack library can be downloaded at
+http://dev.beem-project.com/attachments/download/51/asmack-android-2.1-source-beem.zip
+
+See the file doc/asmack-beem/README.txt for more informations.
+
Binary file app/libs/android-support-v13.jar has changed
Binary file app/libs/asmack-android-16-beem.jar has changed
Binary file app/libs/lcrypto-jdk16-146-20110415.jar has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/proguard-rules.pro Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /opt/android-sdk-update-manager/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/AndroidManifest.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.beem.project.beem"
+ android:versionCode="15"
+ android:versionName="0.1.8"
+ android:installLocation="auto">
+
+ <uses-sdk android:minSdkVersion="6" android:targetSdkVersion="16" />
+ <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+
+ <permission android:permissionGroup="android.permission-group.NETWORK"
+ android:label="BeemService" android:description="@string/BeemServiceDescription"
+ android:name="com.beem.project.beem.BEEM_SERVICE"/>
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.VIBRATE"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+ <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
+ <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
+ <uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"/>
+
+ <supports-screens android:largeScreens="true"
+ android:normalScreens="true" android:smallScreens="true" android:anyDensity="true" />
+
+ <application android:label="@string/app_name"
+ android:icon="@drawable/beem_launcher_icon_silver"
+ android:name=".BeemApplication"
+ android:allowBackup="true" >
+
+ <activity android:name=".ui.Login" android:label="@string/app_name"
+ android:launchMode="standard">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name=".ui.wizard.Account" android:label="Account wizard" />
+ <activity android:name=".ui.LoginAnim" android:label="@string/login_login_progress"
+ android:launchMode="singleTop" android:screenOrientation="portrait" />
+ <activity android:name=".ui.Settings" android:label="@string/edit_settings_name" />
+ <activity android:name=".ui.Chat" android:label="@string/chat_name"
+ android:launchMode="singleTop" />
+ <activity android:name=".ui.ChangeStatus" android:label="@string/ChangeStatusActTitle"
+ android:launchMode="singleTop"
+ android:windowSoftInputMode="stateHidden" />
+ <activity android:name=".ui.AddContact" android:label="@string/AddCActTitle" />
+ <activity android:name=".ui.Subscription" android:label="@string/app_name" />
+
+ <activity android:name=".ui.ContactList" android:label="@string/contact_list_name"
+ android:launchMode="singleTask" />
+
+ <activity android:name=".ui.GroupList" android:label="GroupList" />
+ <activity android:name=".ui.PrivacyList" android:label="@string/privacy_list_name" />
+
+ <!-- MemorizingTrustManagerActivity -->
+ <activity android:name="de.duenndns.ssl.MemorizingActivity" />
+ <!--
+ Could be interesting if we would launch beem at startup <receiver
+ android:name=".tool.BeemBroadcastReceiver" android:enabled="true">
+ <intent-filter> <action
+ android:name="android.intent.action.BOOT_COMPLETED" />
+ </intent-filter> </receiver>
+ -->
+ <provider android:name=".providers.AvatarProvider"
+ android:authorities="com.beem.project.beem.providers.avatarprovider"
+ android:exported="true"
+ />
+
+ <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>
+
+</manifest>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/Contact.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,46 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+parcelable Contact;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/Message.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,46 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+parcelable Message;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/PresenceAdapter.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,46 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+parcelable PresenceAdapter;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/PrivacyListItem.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,46 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+parcelable PrivacyListItem;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/UserInfo.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,46 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+parcelable UserInfo;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IBeemConnectionListener.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,88 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+/**
+ * Interface to listen for connection events
+ * @author Da Risk <barthe_f@epitech.eu>
+ */
+interface IBeemConnectionListener {
+
+ /**
+ * Callback to call when the connection is closed
+ */
+ void connectionClosed();
+
+ /**
+ * Callback to call when the connection occurs
+ * @Deprecated
+ */
+ //void onConnect();
+
+ //void connectionClosedOnError(in Exception e);
+ /**
+ * Callback to call when the connection is closed on error
+ */
+ void connectionClosedOnError();
+
+ /**
+ * Callback to call when trying to reconnecting
+ */
+ void reconnectingIn(in int seconds);
+
+ /**
+ * Callback to call when the reconnection has failed
+ */
+ void reconnectionFailed();
+
+ /**
+ * Callback to call when the reconnection is successfull
+ */
+ void reconnectionSuccessful();
+
+ /**
+ * Callback to call when the connection Failed
+ */
+ void connectionFailed(in String errorMsg);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IBeemRosterListener.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,53 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.PresenceAdapter;
+
+interface IBeemRosterListener {
+ void onEntriesAdded(in List<String> addresses);
+ void onEntriesUpdated(in List<String> addresses);
+ void onEntriesDeleted(in List<String> addresses);
+ void onPresenceChanged(in PresenceAdapter presence);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IChat.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,121 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.Message;
+import com.beem.project.beem.service.aidl.IMessageListener;
+
+/**
+ * An aidl interface for Chat session.
+ */
+interface IChat {
+
+ /**
+ * Send a message.
+ * @param message the message to send
+ */
+ void sendMessage(in com.beem.project.beem.service.Message message);
+
+ /**
+ * Get the participant of the chat
+ * @return the participant
+ */
+ Contact getParticipant();
+
+ /**
+ * Add a message listener.
+ * @param listener the listener to add.
+ */
+ void addMessageListener(in IMessageListener listener);
+
+ /**
+ * Remove a message listener.
+ * @param listener the listener to remove.
+ */
+ void removeMessageListener(in IMessageListener listener);
+
+ String getState();
+
+ void setOpen(in boolean isOpen);
+
+ boolean isOpen();
+
+ int getUnreadMessageCount();
+
+ void setState(in String state);
+
+ List<com.beem.project.beem.service.Message> getMessages();
+
+ /**
+ * Try to start an OTR session.
+ */
+ void startOtrSession();
+
+ /**
+ * Stop the OTR session.
+ */
+ void endOtrSession();
+
+ /**
+ * get local OTR key fingerprints.
+ */
+ String getLocalOtrFingerprint();
+
+
+ /**
+ * get remote OTR key fingerprints.
+ */
+ String getRemoteOtrFingerprint();
+
+ void verifyRemoteFingerprint(in boolean ok);
+
+
+ /**
+ * get current OTR status.
+ */
+ String getOtrStatus();
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IChatManager.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,99 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.aidl.IChat;
+import com.beem.project.beem.service.aidl.IMessageListener;
+import com.beem.project.beem.service.aidl.IChatManagerListener;
+
+/**
+ * Aidl interface for a chat manager.
+ * The chat manager will manage all the chat sessions.
+ */
+interface IChatManager {
+
+ /**
+ * Create a chat session with a contact.
+ * @param contact the contact to chat with
+ * @param listener the callback to call when a new message comes from this chat session
+ * @return the chat session
+ */
+ IChat createChat(in Contact contact, in IMessageListener listener);
+
+ /**
+ * Get an existing Chat session with a contact.
+ * @return null if the chat session does not exist.
+ */
+ IChat getChat(in Contact contact);
+
+ /**
+ * Destroy a chat session with a contact.
+ * @param chat the chat session
+ */
+ void destroyChat(in IChat chat);
+
+ /**
+ * @param chat the chat.
+ */
+ void deleteChatNotification(in IChat chat);
+
+ /**
+ * Register a callback to call when a new chat session is created.
+ * @param listener the callback to add
+ */
+ void addChatCreationListener(in IChatManagerListener listener);
+
+ /**
+ * Remove a callback for the creation of new chat session.
+ * @param listener the callback to remove.
+ */
+ void removeChatCreationListener(in IChatManagerListener listener);
+
+ /**
+ * Get a list of contact which we are currently chatting.
+ * @return list of contact.
+ */
+ List<Contact> getOpenedChatList();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IChatManagerListener.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,61 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IChat;
+
+/**
+ * Aidl interface for ChatManager listener.
+ * This listener will execute on events like creation of chat session.
+ */
+interface IChatManagerListener {
+
+ /**
+ * Call when a new chat session is created.
+ * @param chat the created chat session
+ * @param locally true if the session is create by a chat manager.
+ */
+ void chatCreated(IChat chat, boolean locally);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IContact.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,53 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+interface IContact {
+
+ String getJID();
+
+ void setJID(String mjid);
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IMessageListener.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,69 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.Message;
+import com.beem.project.beem.service.aidl.IChat;
+
+interface IMessageListener {
+
+ /**
+ * This method is executed when a chat receive a message.
+ * @param chat the chat receiving the message.
+ * @param msg the message received in the chat.
+ */
+ void processMessage(in IChat chat, in com.beem.project.beem.service.Message msg);
+
+ /**
+ * This method is executed when a new ChatState is received by the chat.
+ * You can use IChat.getState() in order to get the new state.
+ * @param chat the chat changed.
+ */
+ void stateChanged(in IChat chat);
+ /**
+ * This method is executed when the otr session status change.
+ * @param otrState the new state of otr session.
+ */
+ void otrStateChanged(in String otrState);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IPrivacyListListener.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,51 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.PrivacyListItem;
+
+interface IPrivacyListListener {
+ void updatedPrivacyList(in String listName);
+ void setPrivacyList(in String listName, in List<PrivacyListItem> listItem);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IPrivacyListManager.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,66 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.PrivacyListItem;
+import com.beem.project.beem.service.aidl.IPrivacyListListener;
+
+interface IPrivacyListManager {
+ void createPrivacyList(in String listName, in List<PrivacyListItem> items);
+ void removePrivacyList(in String listName);
+ void editPrivacyList(in String listName, in List<PrivacyListItem> items);
+ String getActivePrivacyList();
+ String getDefaultPrivacyList();
+ void setActivePrivacyList(in String listName);
+ void setDefaultPrivacyList(in String listName);
+ void declineActivePrivacyList();
+ void declineDefaultPrivacyList();
+ List<String> getPrivacyLists();
+ void blockUser(in String listName, in String jid);
+ List<String> getBlockedUsersByList(in String listName);
+ List<String> getBlockedGroupsByList(in String listName);
+ void addPrivacyListListener(in IPrivacyListListener listener);
+ void removePrivacyListListener(in IPrivacyListListener listener);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IRoster.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,74 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IBeemRosterListener;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.PresenceAdapter;
+
+interface IRoster {
+
+ boolean addContact(in String user, in String name, in String[] groups);
+
+ void deleteContact(in Contact contact);
+
+ Contact getContact(in String jid);
+ void setContactName(in String jid, in String name);
+
+ void createGroup(in String groupname);
+
+ void addContactToGroup(in String groupName, in String jid);
+
+ void removeContactFromGroup(in String groupName, in String jid);
+
+ List<Contact> getContactList();
+
+ List<String> getGroupsNames();
+
+ PresenceAdapter getPresence(in String jid);
+
+ void addRosterListener(in IBeemRosterListener listen);
+ void removeRosterListener(in IBeemRosterListener listen);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IXmppConnection.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,79 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IBeemConnectionListener;
+import com.beem.project.beem.service.aidl.IChatManager;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
+
+interface IXmppConnection {
+
+ boolean connect();
+
+ boolean login();
+
+ boolean connectSync();
+
+ void connectAsync();
+
+ boolean disconnect();
+
+ IRoster getRoster();
+
+ void addConnectionListener(in IBeemConnectionListener listen);
+ void removeConnectionListener(in IBeemConnectionListener listen);
+
+ boolean isAuthentificated();
+
+ IChatManager getChatManager();
+
+ void changeStatusAndPriority(in int status, in String msg, in int priority);
+
+ void changeStatus(in int status, in String msg);
+
+ IPrivacyListManager getPrivacyListManager();
+
+ String getErrorMessage();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/aidl/com/beem/project/beem/service/aidl/IXmppFacade.aidl Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,113 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IXmppConnection;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IChatManager;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
+import com.beem.project.beem.service.PresenceAdapter;
+import com.beem.project.beem.service.UserInfo;
+
+import android.net.Uri;
+
+interface IXmppFacade {
+
+ /**
+ * Get the XmppConnection of the facade.
+ */
+ IXmppConnection createConnection();
+
+ /**
+ * Get the roster of the user
+ */
+ IRoster getRoster();
+
+ /**
+ * Connect and login synchronously on the server.
+ */
+ void connectSync();
+
+ /**
+ * Connect and login asynchronously on the server.
+ */
+ void connectAsync();
+
+ /**
+ * Disconnect from the server
+ */
+ void disconnect();
+
+ /**
+ * Get the chat manager.
+ */
+ IChatManager getChatManager();
+
+ /**
+ * Change the status of the user.
+ * @param status the status to set
+ * @param msg the message state to set
+ */
+ void changeStatus(in int status, in String msg);
+
+ void sendPresencePacket(in PresenceAdapter presence);
+
+ /**
+ * make a jingle audio call
+ * @param jid the receiver id
+ */
+ void call(in String jid);
+
+ boolean publishAvatar(in Uri avatarUri);
+
+ void disableAvatarPublishing();
+
+ /**
+ * Get the user informations.
+ * @return null if not connected
+ */
+ UserInfo getUserInfo();
+
+ IPrivacyListManager getPrivacyListManager();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/android/mms/util/SmileyParser.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.mms.util;
+
+import java.util.HashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import android.content.Context;
+import android.text.Spannable;
+import android.text.SpannableStringBuilder;
+import android.text.style.ImageSpan;
+
+import com.beem.project.beem.R;
+
+/**
+ * A class for annotating a CharSequence with spans to convert textual emoticons
+ * to graphical ones.
+ */
+public class SmileyParser {
+ // Singleton stuff
+ private static SmileyParser sInstance;
+ public static SmileyParser getInstance() { return sInstance; }
+ public static void init(Context context) {
+ sInstance = new SmileyParser(context);
+ }
+
+ private final Context mContext;
+ private final String[] mSmileyTexts;
+ private final Pattern mPattern;
+ private final HashMap<String, Integer> mSmileyToRes;
+
+ private SmileyParser(Context context) {
+ mContext = context;
+ mSmileyTexts = mContext.getResources().getStringArray(DEFAULT_SMILEY_TEXTS);
+ mSmileyToRes = buildSmileyToRes();
+ mPattern = buildPattern();
+ }
+
+ static class Smileys {
+ private static final int[] sIconIds = {
+ R.drawable.emo_im_happy,
+ R.drawable.emo_im_sad,
+ R.drawable.emo_im_winking,
+ R.drawable.emo_im_tongue_sticking_out,
+ R.drawable.emo_im_surprised,
+ R.drawable.emo_im_kissing,
+ R.drawable.emo_im_yelling,
+ R.drawable.emo_im_cool,
+ R.drawable.emo_im_money_mouth,
+ R.drawable.emo_im_foot_in_mouth,
+ R.drawable.emo_im_embarrassed,
+ R.drawable.emo_im_angel,
+ R.drawable.emo_im_undecided,
+ R.drawable.emo_im_crying,
+ R.drawable.emo_im_lips_are_sealed,
+ R.drawable.emo_im_laughing,
+ R.drawable.emo_im_wtf,
+ R.drawable.emo_im_heart,
+ R.drawable.emo_im_mad,
+ R.drawable.emo_im_smirk,
+ R.drawable.emo_im_pokerface
+ };
+
+ public static int HAPPY = 0;
+ public static int SAD = 1;
+ public static int WINKING = 2;
+ public static int TONGUE_STICKING_OUT = 3;
+ public static int SURPRISED = 4;
+ public static int KISSING = 5;
+ public static int YELLING = 6;
+ public static int COOL = 7;
+ public static int MONEY_MOUTH = 8;
+ public static int FOOT_IN_MOUTH = 9;
+ public static int EMBARRASSED = 10;
+ public static int ANGEL = 11;
+ public static int UNDECIDED = 12;
+ public static int CRYING = 13;
+ public static int LIPS_ARE_SEALED = 14;
+ public static int LAUGHING = 15;
+ public static int WTF = 16;
+ public static int MAD = 17;
+ public static int HEART = 18;
+ public static int SMIRK = 19;
+ public static int POKERFACE = 20;
+
+ public static int getSmileyResource(int which) {
+ return sIconIds[which];
+ }
+ }
+
+ // NOTE: if you change anything about this array, you must make the corresponding change
+ // to the string arrays: default_smiley_texts and default_smiley_names in res/values/arrays.xml
+ public static final int[] DEFAULT_SMILEY_RES_IDS = {
+ Smileys.getSmileyResource(Smileys.HAPPY), // 0
+ Smileys.getSmileyResource(Smileys.SAD), // 1
+ Smileys.getSmileyResource(Smileys.WINKING), // 2
+ Smileys.getSmileyResource(Smileys.TONGUE_STICKING_OUT), // 3
+ Smileys.getSmileyResource(Smileys.SURPRISED), // 4
+ Smileys.getSmileyResource(Smileys.KISSING), // 5
+ Smileys.getSmileyResource(Smileys.YELLING), // 6
+ Smileys.getSmileyResource(Smileys.COOL), // 7
+ Smileys.getSmileyResource(Smileys.MONEY_MOUTH), // 8
+ Smileys.getSmileyResource(Smileys.FOOT_IN_MOUTH), // 9
+ Smileys.getSmileyResource(Smileys.EMBARRASSED), // 10
+ Smileys.getSmileyResource(Smileys.ANGEL), // 11
+ Smileys.getSmileyResource(Smileys.UNDECIDED), // 12
+ Smileys.getSmileyResource(Smileys.CRYING), // 13
+ Smileys.getSmileyResource(Smileys.LIPS_ARE_SEALED), // 14
+ Smileys.getSmileyResource(Smileys.LAUGHING), // 15
+ Smileys.getSmileyResource(Smileys.WTF), // 16
+ Smileys.getSmileyResource(Smileys.MAD), // 17
+ Smileys.getSmileyResource(Smileys.HEART), // 18
+ Smileys.getSmileyResource(Smileys.SMIRK), // 19
+ Smileys.getSmileyResource(Smileys.POKERFACE), // 20
+ };
+
+ public static final int DEFAULT_SMILEY_TEXTS = R.array.default_smiley_texts;
+ public static final int DEFAULT_SMILEY_NAMES = R.array.default_smiley_names;
+
+ /**
+ * Builds the hashtable we use for mapping the string version
+ * of a smiley (e.g. ":-)") to a resource ID for the icon version.
+ */
+ private HashMap<String, Integer> buildSmileyToRes() {
+ if (DEFAULT_SMILEY_RES_IDS.length != mSmileyTexts.length) {
+ // Throw an exception if someone updated DEFAULT_SMILEY_RES_IDS
+ // and failed to update arrays.xml
+ throw new IllegalStateException("Smiley resource ID/text mismatch");
+ }
+
+ HashMap<String, Integer> smileyToRes =
+ new HashMap<String, Integer>(mSmileyTexts.length);
+ for (int i = 0; i < mSmileyTexts.length; i++) {
+ smileyToRes.put(mSmileyTexts[i], DEFAULT_SMILEY_RES_IDS[i]);
+ }
+
+ return smileyToRes;
+ }
+
+ /**
+ * Builds the regular expression we use to find smileys in {@link #addSmileySpans}.
+ */
+ private Pattern buildPattern() {
+ // Set the StringBuilder capacity with the assumption that the average
+ // smiley is 3 characters long.
+ StringBuilder patternString = new StringBuilder(mSmileyTexts.length * 3);
+
+ // Build a regex that looks like (:-)|:-(|...), but escaping the smilies
+ // properly so they will be interpreted literally by the regex matcher.
+ patternString.append('(');
+ for (String s : mSmileyTexts) {
+ patternString.append(Pattern.quote(s));
+ patternString.append('|');
+ }
+ // Replace the extra '|' with a ')'
+ patternString.replace(patternString.length() - 1, patternString.length(), ")");
+
+ return Pattern.compile(patternString.toString());
+ }
+
+
+ /**
+ * Adds ImageSpans to a CharSequence that replace textual emoticons such
+ * as :-) with a graphical version.
+ *
+ * @param text A CharSequence possibly containing emoticons
+ * @return A CharSequence annotated with ImageSpans covering any
+ * recognized emoticons.
+ */
+ public CharSequence addSmileySpans(CharSequence text) {
+ SpannableStringBuilder builder = new SpannableStringBuilder(text);
+
+ Matcher matcher = mPattern.matcher(text);
+ while (matcher.find()) {
+ int resId = mSmileyToRes.get(matcher.group());
+ builder.setSpan(new ImageSpan(mContext, resId),
+ matcher.start(), matcher.end(),
+ Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+
+ return builder;
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/BeemApplication.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,222 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+
+package com.beem.project.beem;
+
+import android.app.Application;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import android.text.TextUtils;
+
+import com.android.mms.util.SmileyParser;
+
+/**
+ * This class contains informations that needs to be global in the application.
+ * Theses informations must be necessary for the activities and the service.
+ * @author Da Risk <darisk972@gmail.com>
+ */
+public class BeemApplication extends Application {
+
+ /* Constants for PREFERENCE_KEY
+ * The format of the Preference key is :
+ * $name_KEY = "$name"
+ */
+ /** Preference key for account username. */
+ public static final String ACCOUNT_USERNAME_KEY = "account_username";
+ /** Preference key for account password. */
+ public static final String ACCOUNT_PASSWORD_KEY = "account_password";
+ /** Preference key set to true if using an Android account . */
+ public static final String USE_SYSTEM_ACCOUNT_KEY = "use_system_account";
+
+ /** Preference key for Android account type . */
+ public static final String ACCOUNT_SYSTEM_TYPE_KEY = "account_system_type";
+
+ /** Preference key set to true if using specific server details. */
+ public static final String ACCOUNT_SPECIFIC_SERVER_KEY = "account_specific_server";
+
+ /** Preference key for specific server hostname. */
+ public static final String ACCOUNT_SPECIFIC_SERVER_HOST_KEY = "account_specific_server_host";
+
+ /** Preference key for specific server port. */
+ public static final String ACCOUNT_SPECIFIC_SERVER_PORT_KEY = "account_specific_server_port";
+
+ /** Preference key for status (available, busy, away, ...). */
+ public static final String STATUS_KEY = "status";
+ /** Preference key for status message. */
+ public static final String STATUS_TEXT_KEY = "status_text";
+ /** Preference key for connection resource . */
+ public static final String CONNECTION_RESOURCE_KEY = "connection_resource";
+ /** Preference key for connection priority. */
+ public static final String CONNECTION_PRIORITY_KEY = "connection_priority";
+ /** Preference key for the use of a proxy. */
+ public static final String PROXY_USE_KEY = "proxy_use";
+ /** Preference key for the type of proxy. */
+ public static final String PROXY_TYPE_KEY = "proxy_type";
+ /** Preference key for the proxy server. */
+ public static final String PROXY_SERVER_KEY = "proxy_server";
+ /** Preference key for the proxy port. */
+ public static final String PROXY_PORT_KEY = "proxy_port";
+ /** Preference key for the proxy username. */
+ public static final String PROXY_USERNAME_KEY = "proxy_username";
+ /** Preference key for the proxy password. */
+ public static final String PROXY_PASSWORD_KEY = "proxy_password";
+ /** Preference key for vibrate on notification. */
+ public static final String NOTIFICATION_VIBRATE_KEY = "notification_vibrate";
+ /** Preference key for notification sound. */
+ public static final String NOTIFICATION_SOUND_KEY = "notification_sound";
+ /** Preference key for smack debugging. */
+ public static final String SMACK_DEBUG_KEY = "smack_debug";
+ /** Preference key for full Jid for login. */
+ public static final String FULL_JID_LOGIN_KEY = "full_jid_login";
+ /** Preference key for display offline contact. */
+ public static final String SHOW_OFFLINE_CONTACTS_KEY = "show_offline_contacts";
+ /** Preference key for hide the groups. */
+ public static final String HIDE_GROUPS_KEY = "hide_groups";
+ /** Preference key for auto away enable. */
+ public static final String USE_AUTO_AWAY_KEY = "use_auto_away";
+ /** Preference key for auto away message. */
+ public static final String AUTO_AWAY_MSG_KEY = "auto_away_msg";
+ /** Preference key for compact chat ui. */
+ public static final String USE_COMPACT_CHAT_UI_KEY = "use_compact_chat_ui";
+ /** Preference key for history path on the SDCard. */
+ public static final String CHAT_HISTORY_KEY = "settings_chat_history_path";
+ /** Preference key to show the jid in the contact list. */
+ public static final String SHOW_JID = "show_jid";
+
+ //TODO add the other one
+
+ private boolean mIsConnected;
+ private boolean mIsAccountConfigured;
+ private boolean mPepEnabled;
+ private SharedPreferences mSettings;
+ private final PreferenceListener mPreferenceListener = new PreferenceListener();
+
+ /**
+ * Constructor.
+ */
+ public BeemApplication() {
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ mSettings = PreferenceManager.getDefaultSharedPreferences(this);
+ String login = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
+ String password = mSettings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
+ boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
+ mIsAccountConfigured = !TextUtils.isEmpty(login) && (useSystemAccount || !TextUtils.isEmpty((password)));
+ mSettings.registerOnSharedPreferenceChangeListener(mPreferenceListener);
+ SmileyParser.init(this);
+ }
+
+ @Override
+ public void onTerminate() {
+ super.onTerminate();
+ mSettings.unregisterOnSharedPreferenceChangeListener(mPreferenceListener);
+ }
+
+ /**
+ * Tell if Beem is connected to a XMPP server.
+ * @return false if not connected.
+ */
+ public boolean isConnected() {
+ return mIsConnected;
+ }
+
+ /**
+ * Set the status of the connection to a XMPP server of BEEM.
+ * @param isConnected set for the state of the connection.
+ */
+ public void setConnected(boolean isConnected) {
+ mIsConnected = isConnected;
+ }
+
+ /**
+ * Tell if a XMPP account is configured.
+ * @return false if there is no account configured.
+ */
+ public boolean isAccountConfigured() {
+ return mIsAccountConfigured;
+ }
+
+ /**
+ * Enable Pep in the application context.
+ *
+ * @param enabled true to enable pep
+ */
+ public void setPepEnabled(boolean enabled) {
+ mPepEnabled = enabled;
+ }
+
+ /**
+ * Check if Pep is enabled.
+ *
+ * @return true if enabled
+ */
+ public boolean isPepEnabled() {
+ return mPepEnabled;
+ }
+
+ /**
+ * A listener for all the change in the preference file. It is used to maintain the global state of the application.
+ */
+ private class PreferenceListener implements SharedPreferences.OnSharedPreferenceChangeListener {
+
+ /**
+ * Constructor.
+ */
+ public PreferenceListener() {
+ }
+
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ if (BeemApplication.ACCOUNT_USERNAME_KEY.equals(key) || BeemApplication.ACCOUNT_PASSWORD_KEY.equals(key) || BeemApplication.USE_SYSTEM_ACCOUNT_KEY.equals(key)) {
+ String login = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
+ String password = mSettings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
+ boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
+ mIsAccountConfigured = !TextUtils.isEmpty(login) && (useSystemAccount || !TextUtils.isEmpty((password)));
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/BeemService.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,657 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem;
+
+import java.io.File;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+
+import javax.net.ssl.SSLContext;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.net.ConnectivityManager;
+import android.net.Uri;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.preference.PreferenceManager;
+import android.provider.Settings;
+import android.util.Log;
+
+import com.beem.project.beem.service.XmppConnectionAdapter;
+import com.beem.project.beem.service.XmppFacade;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.service.auth.AccountAuthenticator;
+import com.beem.project.beem.service.auth.PreferenceAuthenticator;
+import com.beem.project.beem.smack.avatar.AvatarMetadataProvider;
+import com.beem.project.beem.smack.avatar.AvatarProvider;
+import com.beem.project.beem.smack.ping.PingExtension;
+import com.beem.project.beem.smack.sasl.SASLGoogleOAuth2Mechanism;
+import com.beem.project.beem.smack.sasl.ScramSaslMechanism;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+import com.beem.project.beem.utils.BeemConnectivity;
+import com.beem.project.beem.utils.Status;
+
+import de.duenndns.ssl.MemorizingTrustManager;
+
+import org.jivesoftware.smack.ConnectionConfiguration;
+import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.Roster.SubscriptionMode;
+import org.jivesoftware.smack.SASLAuthentication;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.provider.ProviderManager;
+import org.jivesoftware.smack.proxy.ProxyInfo;
+import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
+import org.jivesoftware.smack.util.StringUtils;
+import org.jivesoftware.smackx.entitycaps.EntityCapsManager;
+import org.jivesoftware.smackx.entitycaps.SimpleDirectoryPersistentCache;
+import org.jivesoftware.smackx.entitycaps.packet.CapsExtension;
+import org.jivesoftware.smackx.packet.ChatStateExtension;
+import org.jivesoftware.smackx.provider.CapsExtensionProvider;
+import org.jivesoftware.smackx.provider.DelayInfoProvider;
+import org.jivesoftware.smackx.provider.DiscoverInfoProvider;
+import org.jivesoftware.smackx.provider.DiscoverItemsProvider;
+import org.jivesoftware.smackx.pubsub.provider.EventProvider;
+import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
+import org.jivesoftware.smackx.pubsub.provider.ItemsProvider;
+import org.jivesoftware.smackx.pubsub.provider.PubSubProvider;
+
+/**
+ * This class is for the Beem service.
+ * It must contains every global informations needed to maintain the background service.
+ * The connection to the xmpp server will be made asynchronously when the service
+ * will start.
+ * @author darisk
+ */
+public class BeemService extends Service {
+
+ /** The id to use for status notification. */
+ public static final int NOTIFICATION_STATUS_ID = 100;
+
+ private static final String TAG = "BeemService";
+ private static final int DEFAULT_XMPP_PORT = 5222;
+
+ private NotificationManager mNotificationManager;
+ private XmppConnectionAdapter mConnection;
+ private SharedPreferences mSettings;
+ private String mLogin;
+ private String mHost;
+ private String mService;
+ private int mPort;
+ private ConnectionConfiguration mConnectionConfiguration;
+ private IXmppFacade.Stub mBind;
+
+ private BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
+ private BeemServiceBroadcastReceiver mOnOffReceiver = new BeemServiceBroadcastReceiver();
+ private BeemServicePreferenceListener mPreferenceListener = new BeemServicePreferenceListener();
+
+ private boolean mOnOffReceiverIsRegistered;
+
+ private SSLContext sslContext;
+
+ /**
+ * Constructor.
+ */
+ public BeemService() {
+ }
+
+ /**
+ * Initialize the connection.
+ */
+ private void initConnectionConfig() {
+ // TODO add an option for this ?
+// SmackConfiguration.setPacketReplyTimeout(30000);
+ ProxyInfo proxyInfo = getProxyConfiguration();
+ boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
+ if (useSystemAccount) {
+ // when using system account, using SPECIFIC_SERVER settings is not a supported configuration.
+ SASLAuthentication.supportSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME);
+ String accountType = mSettings.getString(BeemApplication.ACCOUNT_SYSTEM_TYPE_KEY, "");
+ String accountName = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
+ Account account = getAccount(accountName, accountType);
+ if (account == null) {
+ mSettings.edit().putString(BeemApplication.ACCOUNT_USERNAME_KEY, "").commit();
+ } else
+ mConnectionConfiguration = getConnectionConfigurationForAccount(account, proxyInfo);
+ }
+ if (!useSystemAccount || mConnectionConfiguration == null) {
+ SASLAuthentication.unsupportSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME);
+ if (mSettings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false))
+ mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mService, proxyInfo);
+ else
+ mConnectionConfiguration = new ConnectionConfiguration(mService, proxyInfo);
+ mConnectionConfiguration.setCallbackHandler(new PreferenceAuthenticator(this));
+ }
+
+ if (mSettings.getBoolean("settings_key_xmpp_tls_use", false)
+ || mSettings.getBoolean("settings_key_gmail", false)) {
+ mConnectionConfiguration.setSecurityMode(SecurityMode.required);
+ }
+ if (mSettings.getBoolean(BeemApplication.SMACK_DEBUG_KEY, false))
+ mConnectionConfiguration.setDebuggerEnabled(true);
+ mConnectionConfiguration.setSendPresence(false);
+ mConnectionConfiguration.setRosterLoadedAtLogin(false);
+ // maybe not the universal path, but it works on most devices (Samsung Galaxy, Google Nexus One)
+ mConnectionConfiguration.setTruststoreType("BKS");
+ mConnectionConfiguration.setTruststorePath("/system/etc/security/cacerts.bks");
+ if (sslContext != null)
+ mConnectionConfiguration.setCustomSSLContext(sslContext);
+ }
+
+ /**
+ * Get the save proxy configuration.
+ *
+ * @return the proxy configuration
+ */
+ private ProxyInfo getProxyConfiguration() {
+ boolean useProxy = mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
+ if (useProxy) {
+ String stype = mSettings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
+ String phost = mSettings.getString(BeemApplication.PROXY_SERVER_KEY, "");
+ String puser = mSettings.getString(BeemApplication.PROXY_USERNAME_KEY, "");
+ String ppass = mSettings.getString(BeemApplication.PROXY_PASSWORD_KEY, "");
+ int pport = Integer.parseInt(mSettings.getString(BeemApplication.PROXY_PORT_KEY, "1080"));
+ ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
+ return new ProxyInfo(type, phost, pport, puser, ppass);
+ } else {
+ return ProxyInfo.forNoProxy();
+ }
+ }
+
+ /**
+ * Get the connection configuration for an Android system account.
+ *
+ * @param account the Android account
+ * @param proxy the proxy to use
+ * @return the ConnectionConfiguration or null if the account is not supported
+ */
+ private ConnectionConfiguration getConnectionConfigurationForAccount(Account account, ProxyInfo proxy) {
+ ConnectionConfiguration result = null;
+ if ("com.google".equals(account.type)) {
+ result = new ConnectionConfiguration("talk.google.com", DEFAULT_XMPP_PORT, proxy);
+ result.setServiceName(StringUtils.parseServer(account.name));
+ result.setCallbackHandler(new AccountAuthenticator(this, account));
+ result.setSecurityMode(SecurityMode.required);
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IBinder onBind(Intent intent) {
+ Log.d(TAG, "ONBIND()");
+ return mBind;
+ }
+
+ @Override
+ public boolean onUnbind(Intent intent) {
+ Log.d(TAG, "ONUNBIND()");
+ if (mConnection != null && !mConnection.getAdaptee().isConnected()) {
+ this.stopSelf();
+ }
+ return true;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ registerReceiver(mReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
+ mSettings = PreferenceManager.getDefaultSharedPreferences(this);
+ mSettings.registerOnSharedPreferenceChangeListener(mPreferenceListener);
+ if (mSettings.getBoolean(BeemApplication.USE_AUTO_AWAY_KEY, false)) {
+ mOnOffReceiverIsRegistered = true;
+ registerReceiver(mOnOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
+ registerReceiver(mOnOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_ON));
+ }
+ String tmpJid = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "").trim();
+ mLogin = StringUtils.parseName(tmpJid);
+ boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
+ mPort = DEFAULT_XMPP_PORT;
+ mService = StringUtils.parseServer(tmpJid);
+ mHost = mService;
+ initMemorizingTrustManager();
+
+ if (mSettings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false)) {
+ mHost = mSettings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_HOST_KEY, "").trim();
+ if ("".equals(mHost))
+ mHost = mService;
+ String tmpPort = mSettings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_PORT_KEY, "5222");
+ if (!"".equals(tmpPort))
+ mPort = Integer.parseInt(tmpPort);
+ }
+ if (mSettings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false)
+ || "gmail.com".equals(mService) || "googlemail.com".equals(mService)
+ || useSystemAccount) {
+ mLogin = tmpJid;
+ }
+
+ configure(ProviderManager.getInstance());
+
+ mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+
+ Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
+ mBind = new XmppFacade(this);
+ Log.d(TAG, "Create BeemService");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ mNotificationManager.cancelAll();
+ unregisterReceiver(mReceiver);
+ mSettings.unregisterOnSharedPreferenceChangeListener(mPreferenceListener);
+ if (mOnOffReceiverIsRegistered)
+ unregisterReceiver(mOnOffReceiver);
+ if (mConnection.isAuthentificated() && BeemConnectivity.isConnected(this))
+ mConnection.disconnect();
+ Log.i(TAG, "Stopping the service");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onStart(Intent intent, int startId) {
+ super.onStart(intent, startId);
+ Log.d(TAG, "onStart");
+ createConnectAsync();
+ }
+
+ /**
+ * Create the XmppConnectionAdapter.
+ * This method makes a network request so it must not be called on the main thread.
+ * @return the connection
+ */
+ public XmppConnectionAdapter createConnection() {
+ if (mConnection == null) {
+ initConnectionConfig();
+ mConnection = new XmppConnectionAdapter(mConnectionConfiguration, mLogin, null, this);
+ }
+ return mConnection;
+ }
+
+ /**
+ * Show a notification using the preference of the user.
+ * @param id the id of the notification.
+ * @param notif the notification to show
+ */
+ public void sendNotification(int id, Notification notif) {
+ if (mSettings.getBoolean(BeemApplication.NOTIFICATION_VIBRATE_KEY, true))
+ notif.defaults |= Notification.DEFAULT_VIBRATE;
+ notif.ledARGB = 0xff0000ff; // Blue color
+ notif.ledOnMS = 1000;
+ notif.ledOffMS = 1000;
+ notif.flags |= Notification.FLAG_SHOW_LIGHTS;
+ String ringtoneStr = mSettings.getString(BeemApplication.NOTIFICATION_SOUND_KEY,
+ Settings.System.DEFAULT_NOTIFICATION_URI.toString());
+ notif.sound = Uri.parse(ringtoneStr);
+ mNotificationManager.notify(id, notif);
+ }
+
+ /**
+ * Delete a notification.
+ * @param id the id of the notification
+ */
+ public void deleteNotification(int id) {
+ mNotificationManager.cancel(id);
+ }
+
+ /**
+ * Reset the status to online after a disconnect.
+ */
+ public void resetStatus() {
+ Editor edit = mSettings.edit();
+ edit.putInt(BeemApplication.STATUS_KEY, 1);
+ edit.commit();
+ }
+
+ /**
+ * Initialize Jingle from an XmppConnectionAdapter.
+ * @param adaptee XmppConnection used for jingle.
+ */
+ public void initJingle(XMPPConnection adaptee) {
+ }
+
+ /**
+ * Return a bind to an XmppFacade instance.
+ * @return IXmppFacade a bind to an XmppFacade instance
+ */
+ public IXmppFacade getBind() {
+ return mBind;
+ }
+
+ /**
+ * Get the preference of the service.
+ * @return the preference
+ */
+ public SharedPreferences getServicePreference() {
+ return mSettings;
+ }
+
+ /**
+ * Get the notification manager system service.
+ * @return the notification manager service.
+ */
+ public NotificationManager getNotificationManager() {
+ return mNotificationManager;
+ }
+
+ /**
+ * Utility method to create and make a connection asynchronously.
+ */
+ private synchronized void createConnectAsync() {
+ if (mConnection == null) {
+ new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ createConnection();
+ connectAsync();
+ }
+ }).start();
+ } else
+ connectAsync();
+ }
+
+ /**
+ * Utility method to connect asynchronously.
+ */
+ private void connectAsync() {
+ try {
+ mConnection.connectAsync();
+ } catch (RemoteException e) {
+ Log.w(TAG, "unable to connect", e);
+ }
+ }
+
+ /**
+ * Get the specified Android account.
+ *
+ * @param accountName the account name
+ * @param accountType the account type
+ *
+ * @return the account or null if it does not exist
+ */
+ private Account getAccount(String accountName, String accountType) {
+ AccountManager am = AccountManager.get(this);
+ for (Account a : am.getAccountsByType(accountType)) {
+ if (a.name.equals(accountName)) {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Install the MemorizingTrustManager in the ConnectionConfiguration of Smack.
+ */
+ private void initMemorizingTrustManager() {
+ try {
+ sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(null, MemorizingTrustManager.getInstanceList(this),
+ new java.security.SecureRandom());
+ } catch (GeneralSecurityException e) {
+ Log.w(TAG, "Unable to use MemorizingTrustManager", e);
+ }
+ }
+
+ /**
+ * A sort of patch from this thread: http://www.igniterealtime.org/community/thread/31118. Avoid ClassCastException
+ * by bypassing the classloading shit of Smack.
+ * @param pm The ProviderManager.
+ */
+ private void configure(ProviderManager pm) {
+ Log.d(TAG, "configure");
+ // Service Discovery # Items
+ pm.addIQProvider("query", "http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
+ // Service Discovery # Info
+ pm.addIQProvider("query", "http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
+
+ // Privacy
+ //pm.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider());
+ // Delayed Delivery only the new version
+ pm.addExtensionProvider("delay", "urn:xmpp:delay", new DelayInfoProvider());
+
+ // Service Discovery # Items
+ pm.addIQProvider("query", "http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
+ // Service Discovery # Info
+ pm.addIQProvider("query", "http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
+
+ // Chat State
+ ChatStateExtension.Provider chatState = new ChatStateExtension.Provider();
+ pm.addExtensionProvider("active", "http://jabber.org/protocol/chatstates", chatState);
+ pm.addExtensionProvider("composing", "http://jabber.org/protocol/chatstates",
+ chatState);
+ pm.addExtensionProvider("paused", "http://jabber.org/protocol/chatstates", chatState);
+ pm.addExtensionProvider("inactive", "http://jabber.org/protocol/chatstates", chatState);
+ pm.addExtensionProvider("gone", "http://jabber.org/protocol/chatstates", chatState);
+ // capabilities
+ pm.addExtensionProvider(CapsExtension.NODE_NAME, CapsExtension.XMLNS, new CapsExtensionProvider());
+
+ //Pubsub
+ pm.addIQProvider("pubsub", "http://jabber.org/protocol/pubsub", new PubSubProvider());
+ pm.addExtensionProvider("items", "http://jabber.org/protocol/pubsub", new ItemsProvider());
+ pm.addExtensionProvider("items", "http://jabber.org/protocol/pubsub", new ItemsProvider());
+ pm.addExtensionProvider("item", "http://jabber.org/protocol/pubsub", new ItemProvider());
+
+ pm.addExtensionProvider("items", "http://jabber.org/protocol/pubsub#event", new ItemsProvider());
+ pm.addExtensionProvider("item", "http://jabber.org/protocol/pubsub#event", new ItemProvider());
+ pm.addExtensionProvider("event", "http://jabber.org/protocol/pubsub#event", new EventProvider());
+ //TODO rajouter les manquants pour du full pubsub
+
+
+ //PEP avatar
+ pm.addExtensionProvider("metadata", "urn:xmpp:avatar:metadata", new AvatarMetadataProvider());
+ pm.addExtensionProvider("data", "urn:xmpp:avatar:data", new AvatarProvider());
+
+// PEPProvider pep = new PEPProvider();
+// AvatarMetadataProvider avaMeta = new AvatarMetadataProvider();
+// pep.registerPEPParserExtension("urn:xmpp:avatar:metadata", avaMeta);
+// pm.addExtensionProvider("event", "http://jabber.org/protocol/pubsub#event", pep);
+
+ // ping
+ pm.addIQProvider(PingExtension.ELEMENT, PingExtension.NAMESPACE, PingExtension.class);
+
+ /*
+ // Private Data Storage
+ pm.addIQProvider("query", "jabber:iq:private", new PrivateDataManager.PrivateDataIQProvider());
+ // Time
+ try {
+ pm.addIQProvider("query", "jabber:iq:time", Class.forName("org.jivesoftware.smackx.packet.Time"));
+ } catch (ClassNotFoundException e) {
+ Log.w("TestClient", "Can't load class for org.jivesoftware.smackx.packet.Time");
+ }
+ // Roster Exchange
+ pm.addExtensionProvider("x", "jabber:x:roster", new RosterExchangeProvider());
+ // Message Events
+ pm.addExtensionProvider("x", "jabber:x:event", new MessageEventProvider());
+ // XHTML
+ pm.addExtensionProvider("html", "http://jabber.org/protocol/xhtml-im", new XHTMLExtensionProvider());
+ // Group Chat Invitations
+ pm.addExtensionProvider("x", "jabber:x:conference", new GroupChatInvitation.Provider());
+ // Data Forms
+ pm.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());
+ // MUC User
+ pm.addExtensionProvider("x", "http://jabber.org/protocol/muc#user", new MUCUserProvider());
+ // MUC Admin
+ pm.addIQProvider("query", "http://jabber.org/protocol/muc#admin", new MUCAdminProvider());
+ // MUC Owner
+ pm.addIQProvider("query", "http://jabber.org/protocol/muc#owner", new MUCOwnerProvider());
+ // Version
+ try {
+ pm.addIQProvider("query", "jabber:iq:version", Class.forName("org.jivesoftware.smackx.packet.Version"));
+ } catch (ClassNotFoundException e) {
+ // Not sure what's happening here.
+ Log.w("TestClient", "Can't load class for org.jivesoftware.smackx.packet.Version");
+ }
+ // VCard
+ pm.addIQProvider("vCard", "vcard-temp", new VCardProvider());
+ // Offline Message Requests
+ pm.addIQProvider("offline", "http://jabber.org/protocol/offline", new OfflineMessageRequest.Provider());
+ // Offline Message Indicator
+ pm.addExtensionProvider("offline", "http://jabber.org/protocol/offline", new OfflineMessageInfo.Provider());
+ // Last Activity
+ pm.addIQProvider("query", "jabber:iq:last", new LastActivity.Provider());
+ // User Search
+ pm.addIQProvider("query", "jabber:iq:search", new UserSearch.Provider());
+ // SharedGroupsInfo
+ pm.addIQProvider("sharedgroup", "http://www.jivesoftware.org/protocol/sharedgroup",
+ new SharedGroupsInfo.Provider());
+ // JEP-33: Extended Stanza Addressing
+ pm.addExtensionProvider("addresses", "http://jabber.org/protocol/address", new MultipleAddressesProvider());
+ // FileTransfer
+ pm.addIQProvider("si", "http://jabber.org/protocol/si", new StreamInitiationProvider());
+ pm.addIQProvider("query", "http://jabber.org/protocol/bytestreams", new BytestreamsProvider());
+ pm.addIQProvider("open", "http://jabber.org/protocol/ibb", new IBBProviders.Open());
+ pm.addIQProvider("close", "http://jabber.org/protocol/ibb", new IBBProviders.Close());
+ pm.addExtensionProvider("data", "http://jabber.org/protocol/ibb", new IBBProviders.Data());
+
+ pm.addIQProvider("command", COMMAND_NAMESPACE, new AdHocCommandDataProvider());
+ pm.addExtensionProvider("malformed-action", COMMAND_NAMESPACE,
+ new AdHocCommandDataProvider.MalformedActionError());
+ pm.addExtensionProvider("bad-locale", COMMAND_NAMESPACE,
+ new AdHocCommandDataProvider.BadLocaleError());
+ pm.addExtensionProvider("bad-payload", COMMAND_NAMESPACE,
+ new AdHocCommandDataProvider.BadPayloadError());
+ pm.addExtensionProvider("bad-sessionid", COMMAND_NAMESPACE,
+ new AdHocCommandDataProvider.BadSessionIDError());
+ pm.addExtensionProvider("session-expired", COMMAND_NAMESPACE,
+ new AdHocCommandDataProvider.SessionExpiredError());
+ */
+
+ /* register additionnals sasl mechanisms */
+ SASLAuthentication.registerSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME,
+ SASLGoogleOAuth2Mechanism.class);
+ SASLAuthentication.registerSASLMechanism(ScramSaslMechanism.MECHANISM_NAME,
+ ScramSaslMechanism.class);
+
+ SASLAuthentication.supportSASLMechanism(ScramSaslMechanism.MECHANISM_NAME);
+ // Configure entity caps manager. This must be done only once
+ File f = new File(getCacheDir(), "entityCaps");
+ f.mkdirs();
+ try {
+ EntityCapsManager.setPersistentCache(new SimpleDirectoryPersistentCache(f));
+ } catch (IllegalStateException e) {
+ Log.v(TAG, "EntityCapsManager already initialized", e);
+ } catch (IOException e) {
+ Log.w(TAG, "EntityCapsManager not able to reuse persistent cache");
+ }
+ }
+
+ /**
+ * Listen on preference changes.
+ */
+ private class BeemServicePreferenceListener implements SharedPreferences.OnSharedPreferenceChangeListener {
+
+ /**
+ * ctor.
+ */
+ public BeemServicePreferenceListener() {
+ }
+
+ @Override
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ if (BeemApplication.USE_AUTO_AWAY_KEY.equals(key)) {
+ if (sharedPreferences.getBoolean(BeemApplication.USE_AUTO_AWAY_KEY, false)) {
+ mOnOffReceiverIsRegistered = true;
+ registerReceiver(mOnOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
+ registerReceiver(mOnOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_ON));
+ } else {
+ mOnOffReceiverIsRegistered = false;
+ unregisterReceiver(mOnOffReceiver);
+ }
+ }
+ }
+ }
+
+ /**
+ * Listen on some Intent broadcast, ScreenOn and ScreenOff.
+ */
+ private class BeemServiceBroadcastReceiver extends BroadcastReceiver {
+
+ private String mOldStatus;
+ private int mOldMode;
+
+ /**
+ * Constructor.
+ */
+ public BeemServiceBroadcastReceiver() {
+ }
+
+ @Override
+ public void onReceive(final Context context, final Intent intent) {
+ String intentAction = intent.getAction();
+ if (intentAction.equals(Intent.ACTION_SCREEN_OFF)) {
+ mOldMode = mConnection.getPreviousMode();
+ mOldStatus = mConnection.getPreviousStatus();
+ if (mConnection.isAuthentificated())
+ mConnection.changeStatus(Status.CONTACT_STATUS_AWAY,
+ mSettings.getString(BeemApplication.AUTO_AWAY_MSG_KEY, "Away"));
+ } else if (intentAction.equals(Intent.ACTION_SCREEN_ON)) {
+ if (mConnection.isAuthentificated())
+ mConnection.changeStatus(mOldMode, mOldStatus);
+ }
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/otr/BeemOtrManager.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,210 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.otr;
+
+import java.io.IOException;
+import java.security.KeyPair;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.java.otr4j.OtrEngine;
+import net.java.otr4j.OtrEngineHost;
+import net.java.otr4j.OtrEngineImpl;
+import net.java.otr4j.OtrEngineListener;
+import net.java.otr4j.OtrException;
+import net.java.otr4j.OtrKeyManagerImpl;
+import net.java.otr4j.OtrPolicy;
+import net.java.otr4j.OtrPolicyImpl;
+import net.java.otr4j.session.SessionID;
+import net.java.otr4j.session.SessionStatus;
+import android.util.Log;
+
+import com.beem.project.beem.service.ChatAdapter;
+
+/**
+ * BeemOtrManager.
+ */
+public class BeemOtrManager implements OtrEngineHost {
+
+ private static final String TAG = "BeemOtrEngineHostImpl";
+ private static BeemOtrManager INSTANCE;
+ //We will have a global policy for Beem as long as we won't need to modify the policy per chat.
+ private static final OtrPolicy mGlobalPolicy = new OtrPolicyImpl(OtrPolicy.ALLOW_V2 | OtrPolicy.ERROR_START_AKE);
+
+ private OtrEngine mOtrEngine;
+ private OtrKeyManagerImpl mOtrKeyManager;
+
+ //Map of chat, needed because of the message injection
+ private final Map<SessionID, ChatAdapter> mChats = new HashMap<SessionID, ChatAdapter>();
+
+ /**
+ * Private constructor prevents instantiation from other classes.
+ */
+ private BeemOtrManager() {
+ mOtrEngine = new OtrEngineImpl(this);
+ mOtrEngine.addOtrEngineListener(new BeemOtrListener());
+ try {
+ mOtrKeyManager = new OtrKeyManagerImpl("/sdcard/beem.keystore");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * getOtrManager.
+ * @return OtrEngine
+ */
+ public OtrEngine getOtrManager() {
+ return mOtrEngine;
+ }
+
+ /**
+ * BeemOtrManager.getInstance.
+ * @return BeemOtrManager
+ */
+ public static BeemOtrManager getInstance() {
+ if (INSTANCE == null)
+ INSTANCE = new BeemOtrManager();
+ return INSTANCE;
+ }
+
+ /**
+ * We must call addChat before stating a new otr session because we will need the chat instance for message
+ * injection.
+ * @param sessionID the otr sessionID.
+ * @param chat instance.
+ */
+ public void addChat(final SessionID sessionID, final ChatAdapter chat) {
+ mChats.put(sessionID, chat);
+ Log.d(TAG, "adding new OTR session " + sessionID);
+ }
+
+ /**
+ * We must remove the chat from the map after we ended the corresponding otr session.
+ * @param sessionID the otr sessionID to remove.
+ */
+ public void removeChat(final SessionID sessionID) {
+ mChats.remove(sessionID);
+ }
+
+ /**
+ * get the fingerprint of the remote part.
+ * @param sessionID the otr session
+ * @return a string containing the fingerprint
+ */
+ public String getRemoteFingerprint(final SessionID sessionID) {
+ return mOtrKeyManager.getRemoteFingerprint(sessionID);
+ }
+
+ /**
+ * set the remote fingerprint as verified.
+ * @param sessionId the current otr session
+ */
+ public void verifyRemoteFingerprint(final SessionID sessionId) {
+ mOtrKeyManager.verify(sessionId);
+ }
+
+ /**
+ * unsetthe remote fingerprint as verified.
+ * @param sessionId the current otr session
+ */
+ public void unverifyRemoteFingerprint(final SessionID sessionId) {
+ mOtrKeyManager.unverify(sessionId);
+ }
+
+ /**
+ * get the local fingerprint.
+ * @param sessionID the otr session
+ * @return a string containing the fingerprint
+ */
+ public String getLocalFingerprint(final SessionID sessionID) {
+ return mOtrKeyManager.getLocalFingerprint(sessionID);
+ }
+
+ @Override
+ public void injectMessage(SessionID sessionID, String msg) {
+ ChatAdapter chat = mChats.get(sessionID);
+ chat.injectMessage(msg);
+ }
+
+ @Override
+ public void showWarning(SessionID sessionID, String warning) {
+ Log.d(TAG, "Warning for " + sessionID + " : " + warning);
+ }
+
+ @Override
+ public void showError(SessionID sessionID, String error) {
+ Log.d(TAG, "Error for " + sessionID + " : " + error);
+ }
+
+ @Override
+ public OtrPolicy getSessionPolicy(SessionID sessionID) {
+ return mGlobalPolicy;
+ }
+
+ @Override
+ public KeyPair getKeyPair(SessionID sessionID) {
+ KeyPair kp = mOtrKeyManager.loadLocalKeyPair(sessionID);
+
+ if (kp != null)
+ return kp;
+
+ mOtrKeyManager.generateLocalKeyPair(sessionID);
+ return mOtrKeyManager.loadLocalKeyPair(sessionID);
+ }
+
+ /**
+ * BeemOtrListener.
+ */
+ private class BeemOtrListener implements OtrEngineListener {
+
+ @Override
+ public void sessionStatusChanged(final SessionID sessionID) {
+ Log.d(TAG, "OTR Status changed for " + sessionID + " : " + mOtrEngine.getSessionStatus(sessionID));
+ if (mOtrKeyManager.loadRemotePublicKey(sessionID) == null) {
+ mOtrKeyManager.savePublicKey(sessionID, mOtrEngine.getRemotePublicKey(sessionID));
+ }
+
+ SessionStatus status = mOtrEngine.getSessionStatus(sessionID);
+
+ if (status.equals(SessionStatus.ENCRYPTED) && mOtrKeyManager.isVerified(sessionID)) {
+ mChats.get(sessionID).otrStateChanged("AUTHENTICATED");
+ } else {
+ if (status.equals(SessionStatus.FINISHED)) {
+ try {
+ mChats.get(sessionID).localEndOtrSession();
+ } catch (OtrException e) {
+ Log.w(TAG, "error when closing local otr session", e);
+ }
+ }
+ else {
+ mChats.get(sessionID).otrStateChanged(status.toString());
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,49 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+
+/**
+ * This package contains BEEM's entry points.
+ */
+package com.beem.project.beem;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/providers/AvatarProvider.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,270 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.providers;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.content.UriMatcher;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.net.Uri;
+import android.os.Environment;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+
+
+/**
+ * A simple content provider we expose the differents avatar downloaded.
+ *
+ */
+public class AvatarProvider extends ContentProvider {
+
+ /** The content uri of this provider. */
+ public static final Uri CONTENT_URI =
+ Uri.parse("content://com.beem.project.beem.providers.avatarprovider");
+
+ /** The MIME type of a CONTENT_URI directory of Beem avatars. */
+ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.com.beem.project.beem.avatar";
+
+ /** The MIME type of a CONTENT_URI subdirectory of a single Beem avatar. */
+ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.com.beem.project.beem.avatar";
+
+ /**
+ * Id of the user avatar.
+ */
+ public static final String MY_AVATAR_ID = "my_avatar";
+
+
+ private static final String TAG = AvatarProvider.class.getSimpleName();
+ private static final String AUTHORITY = "com.beem.project.beem.providers.avatarprovider";
+
+ private static String[] columnNames = new String[] {Columns.ID, Columns.DATA};
+
+ private static final int AVATAR = 1;
+ private static final int AVATAR_ID = 2;
+ private static final UriMatcher URIMATCHER = new UriMatcher(AVATAR);
+
+ static
+ {
+ URIMATCHER.addURI(AUTHORITY, "*", AVATAR_ID);
+ // should not be needed if we pass AVATAR on the constructor but it does not work
+ URIMATCHER.addURI(AUTHORITY, null, AVATAR);
+ }
+
+ private String mDataPath;
+
+ /**
+ * Create an AvatarProvider.
+ */
+ public AvatarProvider() {
+ }
+
+ @Override
+ public boolean onCreate() {
+ File cacheDir = Environment.getExternalStorageDirectory();
+ File dataPath = new File(cacheDir, "/Android/data/com.beem.project.beem/cache/avatar");
+ dataPath.mkdirs();
+ mDataPath = dataPath.getAbsolutePath();
+ return true;
+ }
+
+ @Override
+ public ParcelFileDescriptor openFile(Uri uri, String mode)
+ throws FileNotFoundException {
+ return openFileHelper(uri, mode);
+ }
+
+ @Override
+ public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
+ MatrixCursor c = new MatrixCursor(columnNames);
+ int match = URIMATCHER.match(uri);
+ switch (match) {
+ case AVATAR:
+ File[] files = new File(mDataPath).listFiles();
+ if (files != null) {
+ for (File f : files) {
+ c.newRow().add(f.getName()).add(f.getAbsolutePath());
+ }
+ }
+ break;
+ case AVATAR_ID:
+ String id = uri.getPathSegments().get(0);
+ File f = new File(mDataPath, id);
+ if (f.exists() || MY_AVATAR_ID.equals(f.getName()))
+ c.newRow().add(f.getName()).add(f.getAbsolutePath());
+ break;
+ default:
+ Log.w(TAG, "Unsupported uri for query match = " + match);
+ }
+ if (c != null)
+ c.setNotificationUri(getContext().getContentResolver(), uri);
+ return c;
+ }
+
+ @Override
+ public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+ int match = URIMATCHER.match(uri);
+ String id = null;
+ switch (match) {
+ case AVATAR_ID:
+ id = uri.getPathSegments().get(0);
+ break;
+ default:
+ Log.w(TAG, "Unsupported uri for query match = " + match);
+ }
+
+ if (id == null)
+ return 0;
+
+ File f = new File(mDataPath, id);
+ try {
+ f.createNewFile();
+ getContext().getContentResolver().notifyChange(uri, null);
+ return 1;
+ } catch (IOException e) {
+ Log.e(TAG, "Error while creating file", e);
+ }
+ return 0;
+ }
+
+ @Override
+ public int delete(Uri uri, String selection, String[] selectionArgs) {
+ int res = 0;
+ boolean all = false;
+ String id = null;
+ int match = URIMATCHER.match(uri);
+ switch (match) {
+ case AVATAR_ID:
+ id = uri.getPathSegments().get(0);
+ break;
+ case AVATAR:
+ all = true;
+ break;
+ default:
+ Log.w(TAG, "Unsupported uri for query match = " + match);
+ }
+ File[] list = null;
+ if (id != null) {
+ list = new File[] {new File(mDataPath, id) };
+ } else if (all) {
+ list = new File(mDataPath).listFiles();
+ }
+
+ if (list == null)
+ return res;
+ for (File data : list) {
+ if (data.exists() && data.delete())
+ res++;
+ }
+ if (res > 0)
+ getContext().getContentResolver().notifyChange(uri, null);
+ return res;
+ }
+
+ @Override
+ public Uri insert(Uri uri, ContentValues values) {
+ int match = URIMATCHER.match(uri);
+ String id = null;
+ Uri result = null;
+ switch (match) {
+ case AVATAR:
+ id = values.getAsString(Columns.ID);
+ result = Uri.withAppendedPath(uri, id);
+ break;
+ case AVATAR_ID:
+ id = uri.getPathSegments().get(0);
+ result = uri;
+ break;
+ default:
+ Log.w(TAG, "Unsupported uri for query match = " + match);
+ }
+ if (id == null)
+ return null;
+
+ File f = new File(mDataPath, id);
+ try {
+ f.createNewFile();
+ if (result != null)
+ getContext().getContentResolver().notifyChange(result, null);
+ return result;
+ } catch (IOException e) {
+ Log.e(TAG, "Error while creating file", e);
+ }
+ return null;
+ }
+
+ @Override
+ public String getType(Uri uri) {
+ int match = URIMATCHER.match(uri);
+ switch (match) {
+ case AVATAR:
+ return CONTENT_TYPE;
+ case AVATAR_ID:
+ return CONTENT_ITEM_TYPE;
+ default:
+ Log.w(TAG, "Unsupported uri for query match = " + match);
+ }
+ return null;
+ }
+
+ /**
+ * The differents columns available in the AvatarProvider.
+ */
+ public interface Columns {
+
+ /** The id of the avatar.
+ * type: string */
+ String ID = "_id";
+
+ /** The path of the avatar file.
+ * type: string
+ * This field is readonly */
+ String DATA = "_data";
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/providers/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,49 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+
+
+/**
+ * ContentProviders for Beem.
+ */
+package com.beem.project.beem.providers;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/BeemAvatarCache.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,136 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import android.content.ContentResolver;
+import android.content.Context;
+
+import android.database.Cursor;
+
+import android.net.Uri;
+
+import com.beem.project.beem.providers.AvatarProvider;
+import com.beem.project.beem.smack.avatar.AvatarCache;
+
+
+/**
+ * An implementation of an AvatarCache which store the data of the filesystem.
+ */
+public class BeemAvatarCache implements AvatarCache {
+
+ private static final String TAG = BeemAvatarCache.class.getSimpleName();
+
+ private Context mContext;
+ private ContentResolver mContentResolver;
+
+ /**
+ * Create a BeemAvatarCache.
+ *
+ * @param ctx The android context of the cache.
+ */
+ public BeemAvatarCache(final Context ctx) {
+ mContext = ctx;
+ mContentResolver = mContext.getContentResolver();
+ }
+
+
+ @Override
+ public void put(String key, byte[] data) throws IOException {
+ Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
+ mContentResolver.insert(uri, null);
+ OutputStream os = new BufferedOutputStream(mContentResolver.openOutputStream(uri));
+ try {
+ os.write(data);
+ } finally {
+ os.close();
+ }
+ }
+
+ @Override
+ public void put(String key, InputStream in) throws IOException {
+ Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
+ mContentResolver.insert(uri, null);
+ OutputStream os = new BufferedOutputStream(mContentResolver.openOutputStream(uri));
+ try {
+ byte[] data = new byte[1024];
+ int nbread;
+ while ((nbread = in.read(data)) != -1)
+ os.write(data, 0, nbread);
+ } finally {
+ in.close();
+ os.close();
+ }
+ }
+
+ @Override
+ public byte[] get(String key) throws IOException {
+ Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
+ InputStream is = new BufferedInputStream(mContentResolver.openInputStream(uri));
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ byte[] data = new byte[1024];
+ is.read(data);
+ bos.write(data);
+ } finally {
+ is.close();
+ }
+ return bos.toByteArray();
+ }
+
+ @Override
+ public boolean contains(String key) {
+ Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
+ Cursor c = mContentResolver.query(uri, null, null, null, null);
+ boolean res = c.getCount() > 0;
+ c.close();
+ return res;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/BeemAvatarManager.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,170 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+
+package com.beem.project.beem.service;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.provider.MediaStore;
+import android.util.Log;
+
+import com.beem.project.beem.smack.avatar.AvatarManager;
+import com.beem.project.beem.smack.avatar.AvatarCache;
+import com.beem.project.beem.smack.avatar.AvatarMetadataExtension;
+
+import java.security.NoSuchAlgorithmException;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import com.beem.project.beem.smack.pep.PepSubManager;
+import org.jivesoftware.smack.Connection;
+
+/**
+ * An AvatarManager for Beem.
+ * It allows to publish avatar on the Android platform.
+ */
+public class BeemAvatarManager extends AvatarManager {
+ private static final String TAG = BeemAvatarManager.class.getSimpleName();
+ private static final int JPEG_QUALITY = 100;
+
+ private Context mContext;
+
+ /**
+ * Create a BeemAvatarManager.
+ *
+ * @param ctx the Android context
+ * @param con the connection
+ * @param pepMgr the PepSubManager of the connection
+ * @param cache the cache which will store the avatars
+ * @param autoDownload tre to enable auto download of avatars
+ */
+ public BeemAvatarManager(final Context ctx, final Connection con, final PepSubManager pepMgr,
+ final AvatarCache cache, final boolean autoDownload) {
+ super(con, pepMgr, cache, autoDownload);
+ mContext = ctx;
+ }
+
+ /**
+ * Publish an avatar.
+ *
+ * @param avatarUri the uri of the avatar
+ * @return true if the avatar was successfully published
+ */
+ public boolean publishAvatar(Uri avatarUri) {
+ try {
+ Bitmap bmp = MediaStore.Images.Media.getBitmap(mContext.getContentResolver(), avatarUri);
+ return publishAvatar(bmp);
+ } catch (IOException e) {
+ Log.d(TAG, "Error while publishing avatar " + avatarUri, e);
+ }
+ return false;
+ }
+
+ /**
+ * Publish an avatar.
+ * This will send the XMPP stanza to enable the publication of an avatar.
+ *
+ * @param bitmap the avatar to publish
+ * @return true on success false otherwise
+ */
+ private boolean publishAvatar(Bitmap bitmap) {
+ //TODO use the metadata available in the mediastore
+ AvatarMetadataExtension meta = new AvatarMetadataExtension();
+ // Probably a bug on prosody but only the last data sent is kept
+ // and in beem we retrieve the first info
+ AvatarMetadataExtension.Info jpeg = publishBitmap(bitmap, Bitmap.CompressFormat.JPEG, JPEG_QUALITY);
+ // The png format is mandatory for interoperability
+ AvatarMetadataExtension.Info png = publishBitmap(bitmap, Bitmap.CompressFormat.PNG, JPEG_QUALITY);
+ if (png == null)
+ return false;
+ meta.addInfo(png);
+ if (jpeg != null)
+ meta.addInfo(jpeg);
+ publishAvatarMetaData(png.getId(), meta);
+ return true;
+ }
+
+ /**
+ * Send this bitmap to the avatar data node of the pep server.
+ *
+ * @param bmp the avatar bitmap
+ * @param format the image format to publish this data
+ * @param quality the compression quality use for JPEG compression
+ * @return the resulting info associate with this bitmap. null if the operation failed
+ */
+ private AvatarMetadataExtension.Info publishBitmap(Bitmap bmp, Bitmap.CompressFormat format, int quality) {
+ try {
+ byte[] data = getBitmapByte(bmp, format, quality);
+ String dataid = getAvatarId(data);
+ if (!publishAvatarData(data))
+ return null;
+ String mimetype = "image/png";
+ if (Bitmap.CompressFormat.JPEG == format)
+ mimetype = "image/jpeg";
+ AvatarMetadataExtension.Info info = new AvatarMetadataExtension.Info(dataid, mimetype, data.length);
+ info.setHeight(bmp.getHeight());
+ info.setWidth(bmp.getWidth());
+ return info;
+ } catch (NoSuchAlgorithmException ex) {
+ return null;
+ }
+ }
+
+ /**
+ * Convert the bitmap to a byte array.
+ *
+ * @param bitmap the avatar bitmap
+ * @param format the resulting image format
+ * @param quality the compression quality use for JPEG compression
+ * @return the bitmap data or a array of 0 element on error
+ */
+ private byte[] getBitmapByte(Bitmap bitmap, Bitmap.CompressFormat format, int quality) {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ if (bitmap.compress(format, quality, bos))
+ return bos.toByteArray();
+ else
+ return new byte[0];
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/BeemChatManager.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,410 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Environment;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+import android.preference.PreferenceManager;
+import android.support.v4.app.NotificationCompat;
+import android.util.Log;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.providers.AvatarProvider;
+import com.beem.project.beem.service.aidl.IChat;
+import com.beem.project.beem.service.aidl.IChatManager;
+import com.beem.project.beem.service.aidl.IChatManagerListener;
+import com.beem.project.beem.service.aidl.IMessageListener;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.utils.Status;
+
+import net.java.otr4j.OtrException;
+
+import org.jivesoftware.smack.Chat;
+import org.jivesoftware.smack.ChatManager;
+import org.jivesoftware.smack.ChatManagerListener;
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.RosterListener;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.util.StringUtils;
+
+/**
+ * An adapter for smack's ChatManager. This class provides functionnality to handle chats.
+ * @author darisk
+ */
+public class BeemChatManager extends IChatManager.Stub {
+
+ private static final String TAG = "BeemChatManager";
+ private final ChatManager mAdaptee;
+ private final Map<String, ChatAdapter> mChats = new HashMap<String, ChatAdapter>();
+ private final ChatListener mChatListener = new ChatListener();
+ private final RemoteCallbackList<IChatManagerListener> mRemoteChatCreationListeners =
+ new RemoteCallbackList<IChatManagerListener>();
+ private final BeemService mService;
+ private final Roster mRoster;
+ private final ChatRosterListener mChatRosterListn = new ChatRosterListener();
+
+ /**
+ * Constructor.
+ * @param chatManager the smack ChatManager to adapt
+ * @param service the service which runs the chat manager
+ * @param roster roster used to get presences changes
+ */
+ public BeemChatManager(final ChatManager chatManager, final BeemService service, final Roster roster) {
+ mService = service;
+ mAdaptee = chatManager;
+ mRoster = roster;
+ mRoster.addRosterListener(mChatRosterListn);
+ mAdaptee.addChatListener(mChatListener);
+ }
+
+ @Override
+ public void addChatCreationListener(IChatManagerListener listener) throws RemoteException {
+ if (listener != null)
+ mRemoteChatCreationListeners.register(listener);
+ }
+
+ /**
+ * Create a chat session.
+ * @param contact the contact you want to chat with
+ * @param listener listener to use for chat events on this chat session
+ * @return the chat session
+ */
+ @Override
+ public IChat createChat(Contact contact, IMessageListener listener) {
+ String jid = contact.getJIDWithRes();
+ return createChat(jid, listener);
+ }
+
+ /**
+ * Create a chat session.
+ * @param jid the jid of the contact you want to chat with
+ * @param listener listener to use for chat events on this chat session
+ * @return the chat session
+ */
+ public IChat createChat(String jid, IMessageListener listener) {
+ String key = jid;
+ ChatAdapter result;
+ if (mChats.containsKey(key)) {
+ result = mChats.get(key);
+ result.addMessageListener(listener);
+ return result;
+ }
+ Chat c = mAdaptee.createChat(key, null);
+ // maybe a little probleme of thread synchronization
+ // if so use an HashTable instead of a HashMap for mChats
+ result = getChat(c);
+ result.addMessageListener(listener);
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void destroyChat(IChat chat) throws RemoteException {
+ // Can't remove it. otherwise we will lose all futur message in this chat
+ // chat.removeMessageListener(mChatListener);
+ if (chat == null)
+ return;
+ deleteChatNotification(chat);
+ mChats.remove(chat.getParticipant().getJID());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void deleteChatNotification(IChat chat) {
+ try {
+ mService.deleteNotification(chat.getParticipant().getJID().hashCode());
+ } catch (RemoteException e) {
+ Log.v(TAG, "Remote exception ", e);
+ }
+ }
+
+ /**
+ * Get an existing ChatAdapter or create it if necessary.
+ * @param chat The real instance of smack chat
+ * @return a chat adapter register in the manager
+ */
+ private ChatAdapter getChat(Chat chat) {
+ String key = chat.getParticipant();
+ if (mChats.containsKey(key)) {
+ return mChats.get(key);
+ }
+ ChatAdapter res = new ChatAdapter(chat);
+ boolean history = PreferenceManager.getDefaultSharedPreferences(mService.getBaseContext()).getBoolean(
+ "settings_key_history", false);
+ String accountUser = PreferenceManager.getDefaultSharedPreferences(mService.getBaseContext()).getString(
+ BeemApplication.ACCOUNT_USERNAME_KEY, "");
+ String historyPath = PreferenceManager.getDefaultSharedPreferences(mService.getBaseContext()).getString(
+ BeemApplication.CHAT_HISTORY_KEY, "");
+ if ("".equals(historyPath)) historyPath = "/Android/data/com.beem.project.beem/chat/";
+ res.setHistory(history);
+ res.setAccountUser(accountUser);
+ res.listenOtrSession();
+ res.setHistoryPath(new File(Environment.getExternalStorageDirectory(), historyPath));
+ Log.d(TAG, "getChat put " + key);
+ mChats.put(key, res);
+ return res;
+ }
+
+ @Override
+ public ChatAdapter getChat(Contact contact) {
+ String key = contact.getJIDWithRes();
+ return mChats.get(key);
+ }
+
+ /**
+ * This methods permits to retrieve the list of contacts who have an opened chat session with us.
+ * @return An List containing Contact instances.
+ * @throws RemoteException If a Binder remote-invocation error occurred.
+ */
+ public List<Contact> getOpenedChatList() throws RemoteException {
+ List<Contact> openedChats = new ArrayList<Contact>();
+ IRoster r = mService.getBind().getRoster();
+ for (ChatAdapter chat : mChats.values()) {
+ if (chat.getMessages().size() > 0) {
+ Contact t = r.getContact(chat.getParticipant().getJID());
+ if (t == null)
+ t = new Contact(chat.getParticipant().getJID());
+ openedChats.add(t);
+ }
+ }
+ return openedChats;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeChatCreationListener(IChatManagerListener listener) throws RemoteException {
+ if (listener != null)
+ mRemoteChatCreationListeners.unregister(listener);
+ }
+
+ /**
+ * A listener for all the chat creation event that happens on the connection.
+ * @author darisk
+ */
+ private class ChatListener extends IMessageListener.Stub implements ChatManagerListener {
+
+ /**
+ * Constructor.
+ */
+ public ChatListener() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void chatCreated(Chat chat, boolean locally) {
+ IChat newchat = getChat(chat);
+ Log.d(TAG, "Chat" + chat.toString() + " created locally " + locally + " with " + chat.getParticipant());
+ try {
+ newchat.addMessageListener(mChatListener);
+ final int n = mRemoteChatCreationListeners.beginBroadcast();
+
+ for (int i = 0; i < n; i++) {
+ IChatManagerListener listener = mRemoteChatCreationListeners.getBroadcastItem(i);
+ listener.chatCreated(newchat, locally);
+ }
+ mRemoteChatCreationListeners.finishBroadcast();
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ Log.w(TAG, " Error while triggering remote connection listeners in chat creation", e);
+ }
+ }
+
+ /**
+ * Create the PendingIntent to launch our activity if the user select this chat notification.
+ * @param chat A ChatAdapter instance
+ * @return A Chat activity PendingIntent
+ */
+ private PendingIntent makeChatIntent(IChat chat) {
+ Intent chatIntent = new Intent(mService, com.beem.project.beem.ui.Chat.class);
+ chatIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP
+ | Intent.FLAG_ACTIVITY_NEW_TASK);
+ try {
+ chatIntent.setData(chat.getParticipant().toUri());
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ PendingIntent contentIntent = PendingIntent.getActivity(mService, 0, chatIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT);
+ return contentIntent;
+ }
+
+ /**
+ * Set a notification of a new chat.
+ * @param chat The chat to access by the notification
+ * @param msgBody the body of the new message
+ */
+ private void notifyNewChat(IChat chat, String msgBody) {
+ NotificationCompat.Builder notif = new NotificationCompat.Builder(mService);
+ try {
+ String contactJid = chat.getParticipant().getJID();
+ Contact c = mService.getBind().getRoster().getContact(contactJid);
+ String contactName = contactJid;
+ if (c != null) {
+ contactName = c.getName();
+ Bitmap avatar = getAvatar(c);
+ notif.setLargeIcon(avatar);
+ }
+ notif.setTicker(contactName).setContentTitle(contactName);
+ notif.setContentText(msgBody);
+ notif.setSmallIcon(R.drawable.beem_status_icon_gray);
+ notif.setNumber(chat.getUnreadMessageCount());
+ notif.setContentIntent(makeChatIntent(chat));
+ notif.setAutoCancel(true).setWhen(System.currentTimeMillis());
+ mService.sendNotification(chat.getParticipant().getJID().hashCode(), notif.getNotification());
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ /**
+ * Get the avatar of a contact.
+ * @param c the contact
+ * @return the avatar of c or null if avatar is not defined
+ */
+ private Bitmap getAvatar(Contact c) {
+ String id = c.getAvatarId();
+ if (id == null)
+ id = "";
+ Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(id).build();
+ try {
+ InputStream in = mService.getContentResolver().openInputStream(uri);
+ return BitmapFactory.decodeStream(in);
+ } catch (FileNotFoundException e) {
+ Log.d(TAG, "Error loading avatar id: " + id, e);
+ return null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void processMessage(final IChat chat, Message message) {
+ try {
+ String body = message.getBody();
+ if (!chat.isOpen() && body != null) {
+ if (chat instanceof ChatAdapter) {
+ mChats.put(chat.getParticipant().getJID(), (ChatAdapter) chat);
+ }
+ notifyNewChat(chat, body);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ @Override
+ public void stateChanged(final IChat chat) {
+ }
+
+ @Override
+ public void otrStateChanged(String otrState) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+ }
+
+ /**
+ * implement a roster listener, is used to detect and close otr chats.
+ * @author nikita
+ *
+ */
+ private class ChatRosterListener implements RosterListener {
+
+ @Override
+ public void entriesAdded(Collection<String> arg0) {
+ }
+
+ @Override
+ public void entriesDeleted(Collection<String> arg0) {
+ }
+
+ @Override
+ public void entriesUpdated(Collection<String> arg0) {
+ }
+
+ @Override
+ public void presenceChanged(Presence presence) {
+ String key = StringUtils.parseBareAddress(presence.getFrom());
+ if (!mChats.containsKey(key)) {
+ return;
+ }
+
+ if (Status.getStatusFromPresence(presence) >= Status.CONTACT_STATUS_DISCONNECT) {
+ try {
+ mChats.get(key).localEndOtrSession();
+ } catch (OtrException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/ChatAdapter.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,522 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import android.os.Environment;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+import android.util.Log;
+
+import com.beem.project.beem.otr.BeemOtrManager;
+import com.beem.project.beem.service.aidl.IChat;
+import com.beem.project.beem.service.aidl.IMessageListener;
+
+import net.java.otr4j.OtrException;
+import net.java.otr4j.session.SessionID;
+
+import org.jivesoftware.smack.Chat;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.util.StringUtils;
+import org.jivesoftware.smackx.ChatState;
+import org.jivesoftware.smackx.ChatStateListener;
+
+/**
+ * An adapter for smack's Chat class.
+ * @author darisk
+ */
+public class ChatAdapter extends IChat.Stub {
+ private static final int HISTORY_MAX_SIZE = 50;
+ private static final String TAG = "ChatAdapter";
+ private static final String PROTOCOL = "XMPP";
+
+ private final Chat mAdaptee;
+ private final Contact mParticipant;
+ private String mState;
+ private boolean mIsOpen;
+ private final List<Message> mMessages;
+ private final RemoteCallbackList<IMessageListener> mRemoteListeners = new RemoteCallbackList<IMessageListener>();
+ private final MsgListener mMsgListener = new MsgListener();
+ private SessionID mOtrSessionId;
+ private boolean mIsHistory;
+ private File mHistoryPath;
+ private String mAccountUser;
+ private int mUnreadMsgCount;
+
+ /**
+ * Constructor.
+ * @param chat The chat to adapt
+ */
+ public ChatAdapter(final Chat chat) {
+ mAdaptee = chat;
+ mParticipant = new Contact(chat.getParticipant());
+ mMessages = new LinkedList<Message>();
+ mAdaptee.addMessageListener(mMsgListener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Contact getParticipant() throws RemoteException {
+ return mParticipant;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void sendMessage(com.beem.project.beem.service.Message message) throws RemoteException {
+ com.beem.project.beem.service.Message encrypted = otrEncryptMessage(message);
+ if (encrypted != null) {
+ transferMessage(encrypted);
+ } else {
+ transferMessage(message);
+ }
+ addMessage(message);
+ }
+
+ /**
+ * private method for sending message.
+ * @param message the message to send
+ */
+ private void transferMessage(com.beem.project.beem.service.Message message) {
+ org.jivesoftware.smack.packet.Message send = new org.jivesoftware.smack.packet.Message();
+ String msgBody = message.getBody();
+ send.setTo(message.getTo());
+ Log.w(TAG, "message to " + message.getTo());
+ send.setBody(msgBody);
+
+ send.setThread(message.getThread());
+ send.setSubject(message.getSubject());
+ send.setType(org.jivesoftware.smack.packet.Message.Type.chat);
+ // TODO gerer les messages contenant des XMPPError
+ // send.set
+ try {
+ mAdaptee.sendMessage(send);
+ } catch (XMPPException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * send message.
+ * @param msg to send.
+ */
+ public void injectMessage(String msg) {
+ Message msgToSend = new Message(mParticipant.getJIDWithRes(), Message.MSG_TYPE_CHAT);
+ msgToSend.setBody(msg);
+ transferMessage(msgToSend);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addMessageListener(IMessageListener listen) {
+ if (listen != null)
+ mRemoteListeners.register(listen);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeMessageListener(IMessageListener listen) {
+ if (listen != null) {
+ mRemoteListeners.unregister(listen);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getState() throws RemoteException {
+ return mState;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setState(String state) throws RemoteException {
+ mState = state;
+ }
+
+ /**
+ * Get the adaptee for the Chat.
+ * @return The real chat object
+ */
+ public Chat getAdaptee() {
+ return mAdaptee;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setOpen(boolean isOpen) {
+ this.mIsOpen = isOpen;
+ if (isOpen)
+ mUnreadMsgCount = 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOpen() {
+ return mIsOpen;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Message> getMessages() throws RemoteException {
+ return Collections.unmodifiableList(mMessages);
+ }
+
+ /**
+ * Add a message in the chat history.
+ * @param msg the message to add
+ */
+ private void addMessage(Message msg) {
+ if (mMessages.size() == HISTORY_MAX_SIZE)
+ mMessages.remove(0);
+ mMessages.add(msg);
+ if (!isOpen())
+ mUnreadMsgCount++;
+ if (!"".equals(msg.getBody()) && msg.getBody() != null) {
+ logMessage(msg);
+ }
+ }
+
+ /**
+ * Save message in SDCard.
+ * @param msg the message receive
+ * @param contactName the name of the contact
+ */
+ public void saveHistory(Message msg, String contactName) {
+ File path = getHistoryPath();
+ File filepath;
+ if (contactName.equals(msg.getFrom()))
+ filepath = new File(path, StringUtils.parseBareAddress(contactName));
+ else
+ filepath = new File(path, StringUtils.parseBareAddress(msg.getTo()));
+ path.mkdirs();
+ try {
+ FileWriter file = new FileWriter(filepath, true);
+ String log = msg.getTimestamp() + " " + contactName + " " + msg.getBody()
+ + System.getProperty("line.separator");
+ file.write(log);
+ file.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Error writing chat history", e);
+ }
+ }
+
+ /**
+ * set History enable/disable.
+ * @param isHisory history state
+ */
+ public void setHistory(boolean isHisory) {
+ this.mIsHistory = isHisory;
+ }
+
+ /**
+ * get History state.
+ * @return mIsHistory
+ */
+ public boolean getHistory() {
+ return mIsHistory;
+ }
+
+ /**
+ * Set Account user name.
+ * @param accountUser user name
+ */
+ public void setAccountUser(String accountUser) {
+ mAccountUser = accountUser;
+ }
+
+ /**
+ * get Account user name.
+ * @return mAccountUser
+ */
+ public String getAccountUser() {
+ return mAccountUser;
+ }
+
+ /**
+ * set History path.
+ * @param historyPath history path
+ */
+ public void setHistoryPath(File historyPath) {
+ this.mHistoryPath = historyPath;
+ }
+
+ /**
+ * get History path.
+ * @return mHistoryPath;
+ */
+ public File getHistoryPath() {
+ return mHistoryPath;
+ }
+
+ /**
+ * log a message.
+ * @param message message to log
+ */
+ private void logMessage(com.beem.project.beem.service.Message message) {
+ String state = Environment.getExternalStorageState();
+ if (mIsHistory && Environment.MEDIA_MOUNTED.equals(state))
+ saveHistory(message, mAccountUser);
+
+ }
+
+ /**
+ * encrypt a message with an otr session.
+ * @param unencrypted message with cleartext body
+ * @return message with encrypted body
+ */
+ private com.beem.project.beem.service.Message otrEncryptMessage(com.beem.project.beem.service.Message unencrypted) {
+
+ if (mOtrSessionId != null && unencrypted != null && unencrypted.getBody() != null) {
+ try {
+ String body = BeemOtrManager.getInstance().getOtrManager()
+ .transformSending(mOtrSessionId, unencrypted.getBody());
+ Message result = new Message(unencrypted.getTo(), unencrypted.getType());
+ result.setBody(body);
+ return result;
+ } catch (OtrException e) {
+ Log.e(TAG, "OTR: Unable to encrypt message", e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * This method is executed when the otr session status change.
+ * @param otrState the new state of otr session.
+ */
+ public void otrStateChanged(final String otrState) {
+ Message m = new Message(null, Message.MSG_TYPE_INFO);
+ m.setBody(otrState);
+ addMessage(m);
+ final int n = mRemoteListeners.beginBroadcast();
+
+ for (int i = 0; i < n; i++) {
+ IMessageListener listener = mRemoteListeners.getBroadcastItem(i);
+ try {
+ listener.otrStateChanged(otrState);
+ } catch (RemoteException e) {
+ Log.w(TAG, e.getMessage());
+ }
+ }
+ mRemoteListeners.finishBroadcast();
+ }
+
+ @Override
+ public void startOtrSession() throws RemoteException {
+ if (mOtrSessionId == null) {
+ mOtrSessionId = new SessionID(mAccountUser, mParticipant.getJIDWithRes(), PROTOCOL);
+ BeemOtrManager.getInstance().addChat(mOtrSessionId, this);
+ }
+
+ try {
+ BeemOtrManager.getInstance().getOtrManager().startSession(mOtrSessionId);
+ } catch (OtrException e) {
+ mOtrSessionId = null;
+ e.printStackTrace();
+ throw new RemoteException();
+ }
+ }
+
+ @Override
+ public void endOtrSession() throws RemoteException {
+ try {
+ localEndOtrSession();
+ } catch (OtrException e) {
+ e.printStackTrace();
+ throw new RemoteException();
+ }
+ }
+
+ /**
+ * end an Otr session.
+ * @return false if something bad happened.
+ * @throws OtrException an exception from otr
+ */
+ public boolean localEndOtrSession() throws OtrException {
+ if (mOtrSessionId == null)
+ return true;
+
+ BeemOtrManager.getInstance().getOtrManager().endSession(mOtrSessionId);
+ BeemOtrManager.getInstance().removeChat(mOtrSessionId);
+ mOtrSessionId = null;
+ listenOtrSession();
+ return true;
+ }
+
+ /**
+ * Start listenning to an OTR session.
+ */
+ public void listenOtrSession() {
+ if (mOtrSessionId != null)
+ return;
+
+ mOtrSessionId = new SessionID(mAccountUser, mParticipant.getJIDWithRes(), PROTOCOL);
+ BeemOtrManager.getInstance().addChat(mOtrSessionId, this);
+ //OtrEngineImpl will make a call to "this.getSession(sessionID)" which will instantiate our session.
+ BeemOtrManager.getInstance().getOtrManager().getSessionStatus(mOtrSessionId);
+ }
+
+ @Override
+ public String getLocalOtrFingerprint() throws RemoteException {
+ if (mOtrSessionId == null)
+ return null;
+
+ return BeemOtrManager.getInstance().getLocalFingerprint(mOtrSessionId);
+ }
+
+ @Override
+ public String getRemoteOtrFingerprint() throws RemoteException {
+ if (mOtrSessionId == null)
+ return null;
+
+ return BeemOtrManager.getInstance().getRemoteFingerprint(mOtrSessionId);
+ }
+
+ @Override
+ public void verifyRemoteFingerprint(boolean ok) {
+ if (mOtrSessionId != null) {
+ if (ok)
+ BeemOtrManager.getInstance().verifyRemoteFingerprint(mOtrSessionId);
+ else
+ BeemOtrManager.getInstance().unverifyRemoteFingerprint(mOtrSessionId);
+ }
+ }
+
+ @Override
+ public String getOtrStatus() throws RemoteException {
+ if (mOtrSessionId == null)
+ return null;
+ return BeemOtrManager.getInstance().getOtrManager().getSessionStatus(mOtrSessionId).toString();
+ }
+
+ @Override
+ public int getUnreadMessageCount() throws RemoteException {
+ return mUnreadMsgCount;
+ }
+
+ /**
+ * Listener.
+ */
+ private class MsgListener implements ChatStateListener {
+ /**
+ * Constructor.
+ */
+ public MsgListener() {
+ }
+
+ @Override
+ public void processMessage(Chat chat, org.jivesoftware.smack.packet.Message message) {
+ Message msg = new Message(message);
+ Log.d(TAG, "new msg " + msg.getBody());
+ String body;
+
+ if (mOtrSessionId != null) {
+ try {
+ body = BeemOtrManager.getInstance().getOtrManager()
+ .transformReceiving(mOtrSessionId, msg.getBody());
+ msg.setBody(body);
+ } catch (OtrException e) {
+ Log.w(TAG, "Unable to decrypt OTR message", e);
+ }
+ }
+ //TODO add que les message pas de type errors
+ ChatAdapter.this.addMessage(msg);
+ final int n = mRemoteListeners.beginBroadcast();
+ for (int i = 0; i < n; i++) {
+ IMessageListener listener = mRemoteListeners.getBroadcastItem(i);
+ try {
+ if (listener != null)
+ listener.processMessage(ChatAdapter.this, msg);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Error while diffusing message to listener", e);
+ }
+ }
+ mRemoteListeners.finishBroadcast();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void stateChanged(Chat chat, ChatState state) {
+ mState = state.name();
+ final int n = mRemoteListeners.beginBroadcast();
+
+ for (int i = 0; i < n; i++) {
+ IMessageListener listener = mRemoteListeners.getBroadcastItem(i);
+ try {
+ listener.stateChanged(ChatAdapter.this);
+ } catch (RemoteException e) {
+ Log.w(TAG, e.getMessage());
+ }
+ }
+ mRemoteListeners.finishBroadcast();
+ }
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/Contact.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,461 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jivesoftware.smack.RosterGroup;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.util.StringUtils;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.beem.project.beem.utils.Status;
+
+/**
+ * This class contains informations on a jabber contact.
+ * @author darisk
+ */
+public class Contact implements Parcelable {
+
+ /** Parcelable.Creator needs by Android. */
+ public static final Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
+
+ @Override
+ public Contact createFromParcel(Parcel source) {
+ return new Contact(source);
+ }
+
+ @Override
+ public Contact[] newArray(int size) {
+ return new Contact[size];
+ }
+ };
+
+ private int mID;
+ private int mStatus;
+ private final String mJID;
+ private String mSelectedRes;
+ private String mMsgState;
+ private List<String> mRes;
+ private final List<String> mGroups = new ArrayList<String>();
+ private String mName;
+ private String mAvatarId;
+
+ /**
+ * Construct a contact from a parcel.
+ * @param in parcel to use for construction
+ */
+ private Contact(final Parcel in) {
+ mID = in.readInt();
+ mStatus = in.readInt();
+ mJID = in.readString();
+ mSelectedRes = in.readString();
+ mName = in.readString();
+ mMsgState = in.readString();
+ mAvatarId = in.readString();
+ mRes = new ArrayList<String>();
+ in.readStringList(mRes);
+ in.readStringList(mGroups);
+ }
+
+ /**
+ * Constructor.
+ * @param jid JID of the contact
+ */
+ public Contact(final String jid) {
+ mJID = StringUtils.parseBareAddress(jid);
+ mName = mJID;
+ mStatus = Status.CONTACT_STATUS_DISCONNECT;
+ mMsgState = null;
+ mRes = new ArrayList<String>();
+ String res = StringUtils.parseResource(jid);
+ mSelectedRes = res;
+ if (!"".equals(res))
+ mRes.add(res);
+ }
+
+ /**
+ * Create a contact from a Uri.
+ * @param uri an uri for the contact
+ * @throws IllegalArgumentException if it is not a xmpp uri
+ */
+ public Contact(final Uri uri) {
+ if (!"xmpp".equals(uri.getScheme()))
+ throw new IllegalArgumentException();
+ String enduri = uri.getEncodedSchemeSpecificPart();
+ mJID = StringUtils.parseBareAddress(enduri);
+ mName = mJID;
+ mStatus = Status.CONTACT_STATUS_DISCONNECT;
+ mMsgState = null;
+ mRes = new ArrayList<String>();
+ String res = StringUtils.parseResource(enduri);
+ mSelectedRes = res;
+ mRes.add(res);
+ }
+
+ /**
+ * Make an xmpp uri for a spcific jid.
+ *
+ * @param jid the jid to represent as an uri
+ * @return an uri representing this jid.
+ */
+ public static Uri makeXmppUri(String jid) {
+ StringBuilder build = new StringBuilder("xmpp:");
+ String name = StringUtils.parseName(jid);
+ build.append(name);
+ if (!"".equals(name))
+ build.append('@');
+ build.append(StringUtils.parseServer(jid));
+ String resource = StringUtils.parseResource(jid);
+ if (!"".equals(resource)) {
+ build.append('/');
+ build.append(resource);
+ }
+ Uri u = Uri.parse(build.toString());
+ return u;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mID);
+ dest.writeInt(mStatus);
+ dest.writeString(mJID);
+ dest.writeString(mSelectedRes);
+ dest.writeString(mName);
+ dest.writeString(mMsgState);
+ dest.writeString(mAvatarId);
+ dest.writeStringList(getMRes());
+ dest.writeStringList(getGroups());
+ }
+
+ /**
+ * Add a group for the contact.
+ * @param group the group
+ */
+ public void addGroup(String group) {
+ if (!mGroups.contains(group))
+ mGroups.add(group);
+ }
+
+ /**
+ * Remove the contact from a group.
+ * @param group the group to delete the contact from.
+ */
+ public void delGroup(String group) {
+ mGroups.remove(group);
+ }
+
+ /**
+ * Add a resource for this contact.
+ * @param res the resource to add
+ */
+ public void addRes(String res) {
+ if (!mRes.contains(res))
+ mRes.add(res);
+ }
+
+ /**
+ * Delete a resource for this contact.
+ * @param res the resource de delete
+ */
+ public void delRes(String res) {
+ mRes.remove(res);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Get the groups the contact is in.
+ * @return the mGroups
+ */
+ public List<String> getGroups() {
+ return mGroups;
+ }
+
+ /**
+ * Get the id of the contact on the phone contact list.
+ * @return the mID
+ */
+ public int getID() {
+ return mID;
+ }
+
+ /**
+ * Get the Jabber ID of the contact.
+ * @return the Jabber ID
+ */
+ public String getJID() {
+ return mJID;
+ }
+
+ /**
+ * Get selected resource.
+ * @return the selected resource.
+ */
+ public String getSelectedRes() {
+ return mSelectedRes;
+ }
+
+ /**
+ * Get the list of resource for the contact.
+ * @return the mRes
+ */
+ public List<String> getMRes() {
+ return mRes;
+ }
+
+ /**
+ * Get the message status of the contact.
+ * @return the message status of the contact.
+ */
+ public String getMsgState() {
+ return mMsgState;
+ }
+
+ /**
+ * Get the name of the contact.
+ * @return the mName
+ */
+ public String getName() {
+ return mName;
+ }
+
+ /**
+ * Get the status of the contact.
+ * @return the mStatus
+ */
+ public int getStatus() {
+ return mStatus;
+ }
+
+ /**
+ * Get the avatar id of the contact.
+ *
+ * @return the avatar id or null if there is not
+ */
+ public String getAvatarId() {
+ return mAvatarId;
+ }
+
+ /**
+ * Set the groups the contact is in.
+ * @param groups list of groups
+ */
+ public void setGroups(Collection<RosterGroup> groups) {
+ this.mGroups.clear();
+ for (RosterGroup rosterGroup : groups) {
+ mGroups.add(rosterGroup.getName());
+ }
+ }
+
+ /**
+ * Set the groups the contact is in.
+ * @param groups the mGroups to set
+ */
+ public void setGroups(List<String> groups) {
+ mGroups.clear();
+ mGroups.addAll(groups);
+ }
+
+ /**
+ * set the id of te contact on the phone contact list.
+ * @param mid the mID to set
+ */
+ public void setID(int mid) {
+ mID = mid;
+ }
+
+ /**
+ * Set the avatar id of the contact.
+ *
+ * @param avatarId the avatar id
+ */
+ public void setAvatarId(String avatarId) {
+ mAvatarId = avatarId;
+ }
+
+ /**
+ * Set the resource of the contact.
+ * @param resource to set.
+ */
+ public void setSelectedRes(String resource) {
+ mSelectedRes = resource;
+ }
+
+ /**
+ * Set a list of resource for the contact.
+ * @param mRes the mRes to set
+ */
+ public void setMRes(List<String> mRes) {
+ this.mRes = mRes;
+ }
+
+ /**
+ * Set the message status of the contact.
+ * @param msgState the message status of the contact to set
+ */
+ public void setMsgState(String msgState) {
+ mMsgState = msgState;
+ }
+
+ /**
+ * Set the name of the contact.
+ * @param name the mName to set
+ */
+ public void setName(String name) {
+ if (name == null || "".equals(name)) {
+ this.mName = this.mJID;
+ this.mName = StringUtils.parseName(this.mName);
+ if (this.mName == null || "".equals(this.mName))
+ this.mName = this.mJID;
+ } else {
+ this.mName = name;
+ }
+ }
+
+ /**
+ * Set the status of the contact.
+ * @param status the mStatus to set
+ */
+ public void setStatus(int status) {
+ mStatus = status;
+ }
+
+ /**
+ * Set the status of the contact using a presence packet.
+ * @param presence the presence containing status
+ */
+ public void setStatus(Presence presence) {
+ mStatus = Status.getStatusFromPresence(presence);
+ mMsgState = presence.getStatus();
+ }
+
+ /**
+ * Set status for the contact.
+ * @param presence The presence packet which contains the status
+ */
+ public void setStatus(PresenceAdapter presence) {
+ mStatus = presence.getStatus();
+ mMsgState = presence.getStatusText();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ if (mJID != null)
+ return mJID + "/[" + mRes + "]";
+ return super.toString();
+ }
+
+ /**
+ * Get a URI to access the contact.
+ * @return the URI
+ */
+ public Uri toUri() {
+ return makeXmppUri(mJID);
+ }
+
+ /**
+ * Get a URI to access the specific contact on this resource.
+ * @param resource the resource of the contact
+ * @return the URI
+ */
+ public Uri toUri(String resource) {
+ StringBuilder build = new StringBuilder("xmpp:");
+ String name = StringUtils.parseName(mJID);
+ build.append(name);
+ if (!"".equals(name))
+ build.append('@');
+ build.append(StringUtils.parseServer(mJID));
+ if (!"".equals(resource)) {
+ build.append('/');
+ build.append(resource);
+ }
+ Uri u = Uri.parse(build.toString());
+ return u;
+ }
+
+ /**
+ * Get a JID to access the specific contact on this resource.
+ * @return the JID.
+ */
+ public String getJIDWithRes() {
+ StringBuilder build = new StringBuilder(mJID);
+ if (!"".equals(mSelectedRes))
+ build.append('/').append(mSelectedRes);
+ return build.toString();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof Contact))
+ return false;
+ if (other == this)
+ return true;
+ Contact c = (Contact) other;
+ return c.getJID().equals(getJID());
+ }
+
+ @Override
+ public int hashCode() {
+ return mJID.hashCode();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/LoginAsyncTask.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,134 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import android.os.AsyncTask;
+import android.os.RemoteException;
+import android.util.Log;
+import com.beem.project.beem.service.aidl.IXmppConnection;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+
+/**
+ * This is an asynchronous task that will launch a connection to the XMPP server.
+ * @see android.os.AsyncTask
+ * @author Da Risk <da_risk@elyzion.net>
+ */
+public class LoginAsyncTask extends AsyncTask<IXmppFacade, Integer, Boolean> {
+
+ /**
+ * State of a running connection.
+ */
+ public static final int STATE_CONNECTION_RUNNING = 0;
+ /**
+ * State of an already connected connection but authentication is running.
+ */
+ public static final int STATE_LOGIN_RUNNING = 1;
+ /**
+ * State of a connected and authenticated succesfully.
+ */
+ public static final int STATE_LOGIN_SUCCESS = 2;
+ /**
+ * State of a connected but failed authentication.
+ */
+ public static final int STATE_LOGIN_FAILED = 3;
+
+ private static final String TAG = "BeemLoginTask";
+
+ private IXmppConnection mConnection;
+ private String mErrorMessage;
+
+ /**
+ * Constructor.
+ */
+ public LoginAsyncTask() {
+ }
+
+ @Override
+ protected Boolean doInBackground(IXmppFacade... params) {
+ boolean result = true;
+ IXmppFacade facade = params[0];
+ try {
+ publishProgress(STATE_CONNECTION_RUNNING);
+ mConnection = facade.createConnection();
+ if (!mConnection.connect()) {
+ mErrorMessage = mConnection.getErrorMessage();
+ return false;
+ }
+ publishProgress(STATE_LOGIN_RUNNING);
+
+ if (!mConnection.login()) {
+ mErrorMessage = mConnection.getErrorMessage();
+ publishProgress(STATE_LOGIN_FAILED);
+ return false;
+ }
+ publishProgress(STATE_LOGIN_SUCCESS);
+ } catch (RemoteException e) {
+ mErrorMessage = "Exception during connection :" + e;
+ result = false;
+ }
+ return result;
+ }
+
+ /**
+ * Make sur to call the parent method when overriding this method.
+ */
+ @Override
+ protected void onCancelled() {
+ try {
+ if (mConnection != null && mConnection.isAuthentificated()) {
+ mConnection.disconnect();
+ }
+ } catch (RemoteException e) {
+ Log.d(TAG, "Remote exception", e);
+ }
+ }
+
+ /**
+ * Get the error Message.
+ * @return the error message. null if no error
+ */
+ public String getErrorMessage() {
+ return mErrorMessage;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/Message.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,322 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import org.jivesoftware.smack.packet.XMPPError;
+import org.jivesoftware.smackx.packet.DelayInformation;
+import org.jivesoftware.smack.packet.PacketExtension;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import java.util.Date;
+
+/**
+ * This class represents a instant message.
+ * @author darisk
+ */
+public class Message implements Parcelable {
+
+ /** Normal message type. Theese messages are like an email, with subject. */
+ public static final int MSG_TYPE_NORMAL = 100;
+
+ /** Chat message type. */
+ public static final int MSG_TYPE_CHAT = 200;
+
+ /** Group chat message type. */
+ public static final int MSG_TYPE_GROUP_CHAT = 300;
+
+ /** Error message type. */
+ public static final int MSG_TYPE_ERROR = 400;
+
+ /** Informational message type. */
+ public static final int MSG_TYPE_INFO = 500;
+
+ /** Parcelable.Creator needs by Android. */
+ public static final Parcelable.Creator<Message> CREATOR = new Parcelable.Creator<Message>() {
+
+ @Override
+ public Message createFromParcel(Parcel source) {
+ return new Message(source);
+ }
+
+ @Override
+ public Message[] newArray(int size) {
+ return new Message[size];
+ }
+ };
+
+ private int mType;
+ private String mBody;
+ private String mSubject;
+ private String mTo;
+ private String mFrom;
+ private String mThread;
+ private Date mTimestamp;
+
+ // TODO ajouter l'erreur
+
+ /**
+ * Constructor.
+ * @param to the destinataire of the message
+ * @param type the message type
+ */
+ public Message(final String to, final int type) {
+ mTo = to;
+ mType = type;
+ mBody = "";
+ mSubject = "";
+ mThread = "";
+ mFrom = null;
+ mTimestamp = new Date();
+ }
+
+ /**
+ * Constructor a message of type chat.
+ * @param to the destinataire of the message
+ */
+ public Message(final String to) {
+ this(to, MSG_TYPE_CHAT);
+ }
+
+ /**
+ * Construct a message from a smack message packet.
+ * @param smackMsg Smack message packet
+ */
+ public Message(final org.jivesoftware.smack.packet.Message smackMsg) {
+ this(smackMsg.getTo());
+ switch (smackMsg.getType()) {
+ case chat:
+ mType = MSG_TYPE_CHAT;
+ break;
+ case groupchat:
+ mType = MSG_TYPE_GROUP_CHAT;
+ break;
+ case normal:
+ mType = MSG_TYPE_NORMAL;
+ break;
+ // TODO gerer les message de type error
+ // this a little work around waiting for a better handling of error
+ // messages
+ case error:
+ mType = MSG_TYPE_ERROR;
+ break;
+ default:
+ mType = MSG_TYPE_NORMAL;
+ break;
+ }
+ this.mFrom = smackMsg.getFrom();
+ //TODO better handling of error messages
+ if (mType == MSG_TYPE_ERROR) {
+ XMPPError er = smackMsg.getError();
+ String msg = er.getMessage();
+ if (msg != null)
+ mBody = msg;
+ else
+ mBody = er.getCondition();
+ } else {
+ mBody = smackMsg.getBody();
+ mSubject = smackMsg.getSubject();
+ mThread = smackMsg.getThread();
+ }
+ PacketExtension pTime = smackMsg.getExtension("delay", "urn:xmpp:delay");
+ if (pTime instanceof DelayInformation) {
+ mTimestamp = ((DelayInformation) pTime).getStamp();
+ } else {
+ mTimestamp = new Date();
+ }
+ }
+
+ /**
+ * Construct a message from a parcel.
+ * @param in parcel to use for construction
+ */
+ private Message(final Parcel in) {
+ mType = in.readInt();
+ mTo = in.readString();
+ mBody = in.readString();
+ mSubject = in.readString();
+ mThread = in.readString();
+ mFrom = in.readString();
+ mTimestamp = new Date(in.readLong());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ // TODO Auto-generated method stub
+ dest.writeInt(mType);
+ dest.writeString(mTo);
+ dest.writeString(mBody);
+ dest.writeString(mSubject);
+ dest.writeString(mThread);
+ dest.writeString(mFrom);
+ dest.writeLong(mTimestamp.getTime());
+ }
+
+ /**
+ * Get the type of the message.
+ * @return the type of the message.
+ */
+ public int getType() {
+ return mType;
+ }
+
+ /**
+ * Set the type of the message.
+ * @param type the type to set
+ */
+ public void setType(int type) {
+ mType = type;
+ }
+
+ /**
+ * Get the body of the message.
+ * @return the Body of the message
+ */
+ public String getBody() {
+ return mBody;
+ }
+
+ /**
+ * Set the body of the message.
+ * @param body the body to set
+ */
+ public void setBody(String body) {
+ mBody = body;
+ }
+
+ /**
+ * Get the subject of the message.
+ * @return the subject
+ */
+ public String getSubject() {
+ return mSubject;
+ }
+
+ /**
+ * Set the subject of the message.
+ * @param subject the subject to set
+ */
+ public void setSubject(String subject) {
+ mSubject = subject;
+ }
+
+ /**
+ * Get the destinataire of the message.
+ * @return the destinataire of the message
+ */
+ public String getTo() {
+ return mTo;
+ }
+
+ /**
+ * Set the destinataire of the message.
+ * @param to the destinataire to set
+ */
+ public void setTo(String to) {
+ mTo = to;
+ }
+
+ /**
+ * Set the from field of the message.
+ * @param from the mFrom to set
+ */
+ public void setFrom(String from) {
+ this.mFrom = from;
+ }
+
+ /**
+ * Get the from field of the message.
+ * @return the mFrom
+ */
+ public String getFrom() {
+ return mFrom;
+ }
+
+ /**
+ * Get the thread of the message.
+ * @return the thread
+ */
+ public String getThread() {
+ return mThread;
+ }
+
+ /**
+ * Set the thread of the message.
+ * @param thread the thread to set
+ */
+ public void setThread(String thread) {
+ mThread = thread;
+ }
+
+ /**
+ * Set the Date of the message.
+ *
+ * @param date date of the message.
+ */
+ public void setTimestamp(Date date) {
+ mTimestamp = date;
+ }
+
+ /**
+ * Get the Date of the message.
+ *
+ * @return if it is a delayed message get the date the message was sended.
+ */
+ public Date getTimestamp() {
+ return mTimestamp;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int describeContents() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/PresenceAdapter.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,204 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import org.jivesoftware.smack.packet.Presence;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.beem.project.beem.utils.PresenceType;
+import com.beem.project.beem.utils.Status;
+
+/**
+ * this class contain contact presence informations.
+ * @author nikita
+ */
+public class PresenceAdapter implements Parcelable {
+
+ /** Parcelable.Creator needs by Android. */
+ public static final Parcelable.Creator<PresenceAdapter> CREATOR = new Parcelable.Creator<PresenceAdapter>() {
+
+ @Override
+ public PresenceAdapter createFromParcel(Parcel source) {
+ return new PresenceAdapter(source);
+ }
+
+ @Override
+ public PresenceAdapter[] newArray(int size) {
+ return new PresenceAdapter[size];
+ }
+ };
+
+ private int mType;
+ private int mStatus;
+ private String mTo;
+ private String mFrom;
+ private String mStatusText;
+
+ /**
+ * constructor from Parcel.
+ * @param source parcelable presence.
+ */
+ public PresenceAdapter(final Parcel source) {
+ mType = source.readInt();
+ mStatus = source.readInt();
+ mTo = source.readString();
+ mFrom = source.readString();
+ mStatusText = source.readString();
+ }
+
+ /**
+ * constructor from smack Presence.
+ * @param presence smack presence.
+ */
+ public PresenceAdapter(final Presence presence) {
+ mType = PresenceType.getPresenceType(presence);
+ mStatus = Status.getStatusFromPresence(presence);
+ mTo = presence.getTo();
+ mFrom = presence.getFrom();
+ mStatusText = presence.getStatus();
+ }
+
+ /* (non-Javadoc)
+ * @see android.os.Parcelable#describeContents()
+ */
+ @Override
+ public int describeContents() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /**
+ * mFrom getter.
+ * @return the mFrom
+ */
+ public String getFrom() {
+ return mFrom;
+ }
+
+ /**
+ * mStatus getter.
+ * @return the mStatus
+ */
+ public int getStatus() {
+ return mStatus;
+ }
+
+ /**
+ * mStatusText getter.
+ * @return the mStatusText
+ */
+ public String getStatusText() {
+ return mStatusText;
+ }
+
+ /**
+ * mTo getter.
+ * @return the mTo
+ */
+ public String getTo() {
+ return mTo;
+ }
+
+ /**
+ * mType getter.
+ * @return the mType
+ */
+ public int getType() {
+ return mType;
+ }
+
+ /**
+ * mFrom setter.
+ * @param from the mFrom to set
+ */
+ public void setFrom(final String from) {
+ this.mFrom = from;
+ }
+
+ /**
+ * mStatus setter.
+ * @param status the mStatus to set
+ */
+ public void setStatus(final int status) {
+ this.mStatus = status;
+ }
+
+ /**
+ * mStatusText setter.
+ * @param statusText the mStatusText to set
+ */
+ public void setStatusText(final String statusText) {
+ this.mStatusText = statusText;
+ }
+
+ /**
+ * mTo setter.
+ * @param to the mTo to set
+ */
+ public void setTo(final String to) {
+ this.mTo = to;
+ }
+
+ /**
+ * mType setter.
+ * @param type the type to set
+ */
+ public void setType(int type) {
+ this.mType = type;
+ }
+
+ /* (non-Javadoc)
+ * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mType);
+ dest.writeInt(mStatus);
+ dest.writeString(mTo);
+ dest.writeString(mFrom);
+ dest.writeString(mStatusText);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/PrivacyListItem.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,153 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A simplified version of the Smack PrivacyItem class.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class PrivacyListItem implements Parcelable {
+
+ /**
+ * Constructor. Needed to implements the Parcelable.Creator interface. Generates instances of PrivacyListItem from a
+ * Parcel.
+ */
+ public static final Parcelable.Creator<PrivacyListItem> CREATOR = new Parcelable.Creator<PrivacyListItem>() {
+ public PrivacyListItem createFromParcel(Parcel in) {
+ return new PrivacyListItem(in);
+ }
+
+ public PrivacyListItem[] newArray(int size) {
+ return new PrivacyListItem[size];
+ }
+ };
+
+ private int mType;
+ private String mValue;
+
+ /**
+ * Constructor.
+ */
+ public PrivacyListItem() {
+ }
+
+ /**
+ * Constructor. Generates instances of PrivacyListItem from a Parcel.
+ * @param in The Parcel used to initialize object's attributes.
+ */
+ public PrivacyListItem(final Parcel in) {
+ readFromParcel(in);
+ }
+
+ /**
+ * Constructor.
+ * @param type The type of the item.
+ * @param value The value of the item.
+ */
+ public PrivacyListItem(final int type, final String value) {
+ mType = type;
+ mValue = value;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Initialize object's attributes from a Parcel.
+ * @param in The Parcel used to initialize object's attributes.
+ */
+ public void readFromParcel(Parcel in) {
+ mType = in.readInt();
+ mValue = in.readString();
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mType);
+ dest.writeString(mValue);
+ }
+
+ /**
+ * PrivacyListItem type accessor.
+ * @return The type of the PrivacyListItem.
+ */
+ public int getType() {
+ return mType;
+ }
+
+ /**
+ * PrivacyListItem value accessor.
+ * @return The value of the PrivacyListItem.
+ */
+ public String getValue() {
+ return mValue;
+ }
+
+ /**
+ * PrivacyListItem type mutator.
+ * @param type The type of the PrivacyListItem.
+ */
+ public void setType(final int type) {
+ mType = type;
+ }
+
+ /**
+ * PrivacyListItem value mutator.
+ * @param value The value of the PrivacyListItem.
+ */
+ public void setValue(final String value) {
+ mValue = value;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/PrivacyListManagerAdapter.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,358 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jivesoftware.smack.PrivacyList;
+import org.jivesoftware.smack.PrivacyListListener;
+import org.jivesoftware.smack.PrivacyListManager;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.PrivacyItem;
+import org.jivesoftware.smack.packet.PrivacyItem.PrivacyRule;
+
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+import android.util.Log;
+
+import com.beem.project.beem.service.aidl.IPrivacyListListener;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
+
+/**
+ * An adapter for the Smack's PrivacyListManager.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class PrivacyListManagerAdapter extends IPrivacyListManager.Stub {
+
+ /** Class's Tag. */
+ public static final String TAG = "PrivacyListManagerAdapter";
+
+ private final PrivacyListManager mPrivacyListManager;
+
+ private final RemoteCallbackList<IPrivacyListListener> mPrivacyListListeners =
+ new RemoteCallbackList<IPrivacyListListener>();
+ private final PrivacyListListenerAdapter mPrivacyListListener = new PrivacyListListenerAdapter();
+
+ /**
+ * Constructor.
+ * @param privacyListManager the privacy list manager
+ */
+ public PrivacyListManagerAdapter(final PrivacyListManager privacyListManager) {
+ mPrivacyListManager = privacyListManager;
+ mPrivacyListManager.addListener(mPrivacyListListener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#blockUser(java.lang.String, java.lang.String)
+ */
+ @Override
+ public void blockUser(String listName, String jid) throws RemoteException {
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#createPrivacyList(java.lang.String, java.util.List)
+ */
+ @Override
+ public void createPrivacyList(String listName, List<PrivacyListItem> items) throws RemoteException {
+ Log.d(TAG, "BEGIN createPrivacyList.");
+ try {
+ List<PrivacyItem> privacyItems = new ArrayList<PrivacyItem>();
+
+ PrivacyItem item = new PrivacyItem(PrivacyItem.Type.subscription.name(), true, 2);
+ item.setValue(PrivacyRule.SUBSCRIPTION_BOTH);
+ privacyItems.add(item);
+
+ mPrivacyListManager.createPrivacyList(listName, privacyItems);
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ Log.d(TAG, "END createPrivacyList.");
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#declineActivePrivacyList()
+ */
+ @Override
+ public void declineActivePrivacyList() throws RemoteException {
+ try {
+ mPrivacyListManager.declineActiveList();
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#declineDefaultPrivacyList()
+ */
+ @Override
+ public void declineDefaultPrivacyList() throws RemoteException {
+ try {
+ mPrivacyListManager.declineDefaultList();
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#editPrivacyList(java.lang.String, java.util.List)
+ */
+ @Override
+ public void editPrivacyList(String listName, List<PrivacyListItem> items) throws RemoteException {
+ Log.d(TAG, "BEGIN editPrivacyList.");
+ try {
+ mPrivacyListManager.updatePrivacyList(listName, tranformPrivacyListItemsToPrivacyItems(items));
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ Log.d(TAG, "END editPrivacyList.");
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getActivePrivacyList()
+ */
+ @Override
+ public String getActivePrivacyList() throws RemoteException {
+ try {
+ PrivacyList activePrivacyList = mPrivacyListManager.getActiveList();
+ return activePrivacyList.toString();
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getBlockedGroupsByList(java.lang.String)
+ */
+ @Override
+ public List<String> getBlockedGroupsByList(String listName) throws RemoteException {
+ List<String> blockedGroups = new ArrayList<String>();
+ try {
+ PrivacyList pL = mPrivacyListManager.getPrivacyList(listName);
+ for (PrivacyItem pI : pL.getItems()) {
+ if (pI.getType().equals(PrivacyItem.Type.group) && !pI.isAllow())
+ blockedGroups.add(pI.getValue());
+ }
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ return blockedGroups;
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getBlockedUsersByList(java.lang.String)
+ */
+ @Override
+ public List<String> getBlockedUsersByList(String listName) throws RemoteException {
+ List<String> blockedUsers = new ArrayList<String>();
+ try {
+ PrivacyList pL = mPrivacyListManager.getPrivacyList(listName);
+ for (PrivacyItem pI : pL.getItems()) {
+ if (pI.getType().equals(PrivacyItem.Type.jid) && !pI.isAllow())
+ blockedUsers.add(pI.getValue());
+ }
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ return blockedUsers;
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getDefaultPrivacyList()
+ */
+ @Override
+ public String getDefaultPrivacyList() throws RemoteException {
+ try {
+ PrivacyList defaultPrivacyList = mPrivacyListManager.getDefaultList();
+ return defaultPrivacyList.toString();
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#removePrivacyList(java.lang.String)
+ */
+ @Override
+ public void removePrivacyList(String listName) throws RemoteException {
+ try {
+ mPrivacyListManager.deletePrivacyList(listName);
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#setActivePrivacyList(java.lang.String)
+ */
+ @Override
+ public void setActivePrivacyList(String listName) throws RemoteException {
+ try {
+ mPrivacyListManager.setActiveListName(listName);
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#setDefaultPrivacyList(java.lang.String)
+ */
+ @Override
+ public void setDefaultPrivacyList(String listName) throws RemoteException {
+ try {
+ mPrivacyListManager.setDefaultListName(listName);
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ /**
+ * From a List of PrivacyListItem get a List of PrivacyItem.
+ * @param items The List of PrivacyListItem.
+ * @return A list of PrivacyItem.
+ */
+ private List<PrivacyItem> tranformPrivacyListItemsToPrivacyItems(List<PrivacyListItem> items) {
+ List<PrivacyItem> rItems = new ArrayList<PrivacyItem>();
+ PrivacyItem.Type[] itemTypes = PrivacyItem.Type.values();
+
+ for (int i = 0; i < items.size(); i++) {
+ rItems.add(new PrivacyItem(itemTypes[items.get(i).getType()].name(), false, i));
+ }
+
+ return rItems;
+ }
+
+ /**
+ * From a List of PrivacyItem get a List of PrivacyListItem.
+ * @param items The List of PrivacyItem.
+ * @return A list of PrivacyListItem.
+ */
+ private List<PrivacyListItem> tranformPrivacyItemsToPrivacyListItems(List<PrivacyItem> items) {
+ List<PrivacyListItem> rItems = new ArrayList<PrivacyListItem>();
+
+ for (int i = 0; i < items.size(); i++) {
+ rItems.add(new PrivacyListItem(items.get(i).getType().ordinal(), items.get(i).getValue()));
+ }
+ return rItems;
+ }
+
+ /**
+ * An adapter for the Smack's PrivacyListListener.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+ private class PrivacyListListenerAdapter implements PrivacyListListener {
+ /**
+ * Constructor.
+ */
+ public PrivacyListListenerAdapter() { }
+
+ @Override
+ public void setPrivacyList(final String listName, final List<PrivacyItem> listItem) {
+ int i = mPrivacyListListeners.beginBroadcast();
+ while (i > 0) {
+ i--;
+ try {
+ mPrivacyListListeners.getBroadcastItem(i).setPrivacyList(listName,
+ tranformPrivacyItemsToPrivacyListItems(listItem));
+ } catch (RemoteException e) {
+ Log.w(TAG, e.getMessage());
+ }
+ }
+ mPrivacyListListeners.finishBroadcast();
+ }
+
+ @Override
+ public void updatedPrivacyList(final String listName) {
+ Log.d(TAG, "BEGIN updatedPrivacyList.");
+ int i = mPrivacyListListeners.beginBroadcast();
+ while (i > 0) {
+ i--;
+ try {
+ mPrivacyListListeners.getBroadcastItem(i).updatedPrivacyList(listName);
+ } catch (RemoteException e) {
+ Log.w(TAG, e.getMessage());
+ }
+ }
+ mPrivacyListListeners.finishBroadcast();
+ Log.d(TAG, "END updatedPrivacyList.");
+ }
+ }
+
+ @Override
+ public void addPrivacyListListener(IPrivacyListListener listener) throws RemoteException {
+ if (listener != null)
+ mPrivacyListListeners.register(listener);
+ }
+
+ @Override
+ public void removePrivacyListListener(IPrivacyListListener listener) throws RemoteException {
+ if (listener != null)
+ mPrivacyListListeners.unregister(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getPrivacyLists()
+ */
+ @Override
+ public List<String> getPrivacyLists() throws RemoteException {
+ Log.d(TAG, "BEGIN getPrivacyLists.");
+ List<String> res = new ArrayList<String>();
+ try {
+ PrivacyList[] registeredPrivacyLists = mPrivacyListManager.getPrivacyLists();
+ Log.d(TAG, "> registeredPrivacyLists size: " + registeredPrivacyLists.length);
+ if (registeredPrivacyLists.length > 0) {
+ for (int i = 0; i < registeredPrivacyLists.length; i++) {
+ res.add(registeredPrivacyLists[i].toString());
+ Log.d(TAG, "> " + res.get(i) + " added.");
+ }
+ }
+ } catch (XMPPException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ Log.d(TAG, "END getPrivacyLists.");
+ return res;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/RosterAdapter.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,416 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import android.content.Context;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+import android.util.Log;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.aidl.IBeemRosterListener;
+import com.beem.project.beem.smack.avatar.AvatarListener;
+import com.beem.project.beem.smack.avatar.AvatarManager;
+import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
+import com.beem.project.beem.utils.Status;
+
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.RosterGroup;
+import org.jivesoftware.smack.RosterListener;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.util.StringUtils;
+
+
+/**
+ * This class implement a Roster adapter for BEEM.
+ */
+public class RosterAdapter extends com.beem.project.beem.service.aidl.IRoster.Stub {
+
+ private static final String TAG = "RosterAdapter";
+ private final Roster mAdaptee;
+ private final RemoteCallbackList<IBeemRosterListener> mRemoteRosListeners =
+ new RemoteCallbackList<IBeemRosterListener>();
+ private final Map<Integer, String> mDefaultStatusMessages;
+ private final RosterListenerAdapter mRosterListener = new RosterListenerAdapter();
+ private Map<String, String> mAvatarIdmap = new HashMap<String, String>();
+ private AvatarManager mAvatarManager;
+
+ /**
+ * Constructor.
+ * @param roster The roster to adapt.
+ * @param context The context of the RosterAdapter.
+ */
+ public RosterAdapter(final Roster roster, final Context context) {
+ mAdaptee = roster;
+ roster.addRosterListener(mRosterListener);
+ mDefaultStatusMessages = createDefaultStatusMessagesMap(context);
+ }
+
+ /**
+ * Constructor.
+ * @param roster The roster to adapt.
+ * @param context The context of the RosterAdapter.
+ * @param avatarMgr The AvatarManager of the connection
+ */
+ public RosterAdapter(final Roster roster, final Context context, final AvatarManager avatarMgr) {
+ mAdaptee = roster;
+ roster.addRosterListener(mRosterListener);
+ mDefaultStatusMessages = createDefaultStatusMessagesMap(context);
+ mAvatarManager = avatarMgr;
+ if (mAvatarManager != null)
+ mAvatarManager.addAvatarListener(new AvatarEventListener());
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addRosterListener(IBeemRosterListener listen) throws RemoteException {
+ if (listen != null)
+ mRemoteRosListeners.register(listen);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean addContact(String user, String name, String[] groups) throws RemoteException {
+ RosterEntry contact = mAdaptee.getEntry(user);
+ try {
+ mAdaptee.createEntry(user, name, groups);
+ contact = mAdaptee.getEntry(user);
+ } catch (XMPPException e) {
+ Log.e(TAG, "Error while adding new contact", e);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void deleteContact(Contact contact) throws RemoteException {
+ try {
+ RosterEntry entry = mAdaptee.getEntry(contact.getJID());
+ mAdaptee.removeEntry(entry);
+ } catch (XMPPException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void createGroup(String groupname) throws RemoteException {
+ if (mAdaptee.getGroup(groupname) == null)
+ mAdaptee.createGroup(groupname);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Contact getContact(String jid) throws RemoteException {
+ if (mAdaptee.contains(jid))
+ return getContactFromRosterEntry(mAdaptee.getEntry(jid));
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Contact> getContactList() throws RemoteException {
+ boolean add = true;
+ Collection<RosterEntry> list = mAdaptee.getEntries();
+ List<Contact> coList = new ArrayList<Contact>(list.size());
+ for (RosterEntry entry : list) {
+ coList.add(getContactFromRosterEntry(entry));
+ }
+ return coList;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<String> getGroupsNames() throws RemoteException {
+ Collection<RosterGroup> groups = mAdaptee.getGroups();
+ List<String> result = new ArrayList<String>(groups.size());
+ for (RosterGroup rosterGroup : groups) {
+ result.add(rosterGroup.getName());
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeRosterListener(IBeemRosterListener listen) throws RemoteException {
+ if (listen != null)
+ mRemoteRosListeners.unregister(listen);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setContactName(String jid, String name) throws RemoteException {
+ mAdaptee.getEntry(jid).setName(name);
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IRoster#getPresence(java.lang.String)
+ */
+ @Override
+ public PresenceAdapter getPresence(String jid) throws RemoteException {
+ return new PresenceAdapter(mAdaptee.getPresence(jid));
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IRoster#addContactToGroup(java.lang.String, java.lang.String)
+ */
+ @Override
+ public void addContactToGroup(String groupName, String jid) throws RemoteException {
+ createGroup(groupName);
+ RosterGroup group = mAdaptee.getGroup(groupName);
+ try {
+ group.addEntry(mAdaptee.getEntry(jid));
+ } catch (XMPPException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IRoster#removeContactFromGroup(java.lang.String, java.lang.String)
+ */
+ @Override
+ public void removeContactFromGroup(String groupName, String jid) throws RemoteException {
+ RosterGroup group = mAdaptee.getGroup(groupName);
+ try {
+ group.removeEntry(mAdaptee.getEntry(jid));
+ } catch (XMPPException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Get a contact from a RosterEntry.
+ * @param entry a roster entry containing information for the contact.
+ * @return a contact for this entry.
+ */
+ private Contact getContactFromRosterEntry(RosterEntry entry) {
+ String user = entry.getUser();
+ Contact c = new Contact(user);
+ Presence p = mAdaptee.getPresence(user);
+
+ if (p.getStatus() == null || "".equals(p.getStatus()))
+ p.setStatus(mDefaultStatusMessages.get(Status.getStatusFromPresence(p)));
+ c.setStatus(p);
+ try {
+ c.setGroups(entry.getGroups());
+ } catch (NullPointerException e) {
+ Log.d(TAG, "Group list not ready", e);
+ }
+ Iterator<Presence> iPres = mAdaptee.getPresences(user);
+ while (iPres.hasNext()) {
+ p = iPres.next();
+ if (!p.getType().equals(Presence.Type.unavailable))
+ c.addRes(StringUtils.parseResource(p.getFrom()));
+ }
+ c.setName(entry.getName());
+ c.setAvatarId(mAvatarIdmap.get(user));
+ return c;
+ }
+
+ /**
+ * Create a map which contains default status messages.
+ * @param context The context of the roster adapter.
+ * @return A Map<Integer, String> which assigns a status to a message.
+ */
+ private Map<Integer, String> createDefaultStatusMessagesMap(Context context) {
+ Map<Integer, String> defaultStatusMessages = new HashMap<Integer, String>();
+ defaultStatusMessages.put(Status.CONTACT_STATUS_AVAILABLE, context
+ .getString(R.string.contact_status_msg_available));
+ defaultStatusMessages.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT, context
+ .getString(R.string.contact_status_msg_available_chat));
+ defaultStatusMessages.put(Status.CONTACT_STATUS_AWAY, context.getString(R.string.contact_status_msg_away));
+ defaultStatusMessages.put(Status.CONTACT_STATUS_BUSY, context.getString(R.string.contact_status_msg_dnd));
+ defaultStatusMessages.put(Status.CONTACT_STATUS_DISCONNECT, context
+ .getString(R.string.contact_status_msg_offline));
+ defaultStatusMessages.put(Status.CONTACT_STATUS_UNAVAILABLE, context.getString(R.string.contact_status_msg_xa));
+
+ return defaultStatusMessages;
+ }
+
+ /**
+ * Listener for the roster events. It will call the remote listeners registered.
+ * @author darisk
+ */
+ private class RosterListenerAdapter implements RosterListener {
+
+ /**
+ * Constructor.
+ */
+ public RosterListenerAdapter() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void entriesAdded(Collection<String> addresses) {
+ final int n = mRemoteRosListeners.beginBroadcast();
+
+ List<String> tab = new ArrayList<String>();
+ tab.addAll(addresses);
+ for (int i = 0; i < n; i++) {
+ IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
+ try {
+ listener.onEntriesAdded(tab);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Error while adding roster entries", e);
+ }
+ }
+ mRemoteRosListeners.finishBroadcast();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void entriesDeleted(Collection<String> addresses) {
+ final int n = mRemoteRosListeners.beginBroadcast();
+
+ List<String> tab = new ArrayList<String>();
+ tab.addAll(addresses);
+ for (int i = 0; i < n; i++) {
+ IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
+ try {
+ listener.onEntriesDeleted(tab);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Error while deleting roster entries", e);
+ }
+ }
+ mRemoteRosListeners.finishBroadcast();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void entriesUpdated(Collection<String> addresses) {
+ final int n = mRemoteRosListeners.beginBroadcast();
+
+ List<String> tab = new ArrayList<String>();
+ tab.addAll(addresses);
+ for (int i = 0; i < n; i++) {
+ IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
+ try {
+ listener.onEntriesUpdated(tab);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Error while updating roster entries", e);
+ }
+ }
+ mRemoteRosListeners.finishBroadcast();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void presenceChanged(Presence presence) {
+ final int n = mRemoteRosListeners.beginBroadcast();
+ Log.v(TAG, ">>> Presence changed for " + presence.getFrom());
+
+ for (int i = 0; i < n; i++) {
+ IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
+ try {
+ if (presence.getStatus() == null || "".equals(presence.getStatus())) {
+ presence.setStatus(mDefaultStatusMessages.get(Status.getStatusFromPresence(presence)));
+ }
+ listener.onPresenceChanged(new PresenceAdapter(presence));
+ } catch (RemoteException e) {
+ Log.w(TAG, "Error while updating roster presence entries", e);
+ }
+ }
+ mRemoteRosListeners.finishBroadcast();
+ }
+ }
+
+ /**
+ * Listener on avatar metadata event.
+ *
+ */
+ private class AvatarEventListener implements AvatarListener {
+
+ /**
+ * Constructor.
+ */
+ public AvatarEventListener() { }
+
+ @Override
+ public void onAvatarChange(String from, String avatarId, List<Info> avatarInfos) {
+ String bare = StringUtils.parseBareAddress(from);
+ if (avatarId == null)
+ mAvatarIdmap.remove(bare);
+ else if (avatarInfos.size() > 0) {
+ mAvatarIdmap.put(bare, avatarId);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/UserInfo.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,128 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * This class contains information about the user of the connection.
+ * These informations are sent by the connection.
+ *
+ */
+public class UserInfo implements Parcelable {
+
+ /** Parcelable.Creator needs by Android. */
+ public static final Parcelable.Creator<UserInfo> CREATOR = new Parcelable.Creator<UserInfo>() {
+
+ @Override
+ public UserInfo createFromParcel(Parcel source) {
+ return new UserInfo(source);
+ }
+
+ @Override
+ public UserInfo[] newArray(int size) {
+ return new UserInfo[size];
+ }
+ };
+
+ private final String mFullJid;
+ private String mAvatarId;
+
+ /**
+ * Construct a UserInfo from a parcel.
+ * @param in parcel to use for construction
+ */
+ private UserInfo(final Parcel in) {
+ mFullJid = in.readString();
+ mAvatarId = in.readString();
+ }
+
+ /**
+ * Constructor.
+ * @param jid jid of the user
+ */
+ public UserInfo(final String jid) {
+ // the jid is case insensitive
+ mFullJid = jid;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(mFullJid);
+ dest.writeString(mAvatarId);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Get the avatar id of the user.
+ *
+ * @return the avatar id
+ */
+ public String getAvatarId() {
+ return mAvatarId;
+ }
+
+ /**
+ * Set the avater id of the user.
+ *
+ * @param avatarId the avatar id
+ */
+ public void setAvatarId(String avatarId) {
+ mAvatarId = avatarId;
+ }
+
+ /**
+ * Get the full jid of the user.
+ *
+ * @return the jid
+ */
+ public String getJid() {
+ return mFullJid;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/XmppConnectionAdapter.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,773 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+ */
+package com.beem.project.beem.service;
+
+import java.util.Iterator;
+import java.util.List;
+
+import android.app.Notification;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+import android.support.v4.app.NotificationCompat;
+import android.util.Log;
+
+import com.beem.project.beem.BeemApplication;
+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.IChatManager;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IXmppConnection;
+import com.beem.project.beem.smack.avatar.AvatarCache;
+import com.beem.project.beem.smack.avatar.AvatarListener;
+import com.beem.project.beem.smack.avatar.AvatarMetadataExtension;
+import com.beem.project.beem.smack.pep.PepSubManager;
+import com.beem.project.beem.smack.ping.PingExtension;
+import com.beem.project.beem.ui.ChangeStatus;
+import com.beem.project.beem.ui.Subscription;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+import com.beem.project.beem.utils.Status;
+
+import org.jivesoftware.smack.ConnectionConfiguration;
+import org.jivesoftware.smack.ConnectionListener;
+import org.jivesoftware.smack.PacketListener;
+import org.jivesoftware.smack.PrivacyListManager;
+import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.filter.PacketFilter;
+import org.jivesoftware.smack.filter.PacketTypeFilter;
+import org.jivesoftware.smack.packet.IQ;
+import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.util.StringUtils;
+import org.jivesoftware.smackx.ChatStateManager;
+import org.jivesoftware.smackx.ServiceDiscoveryManager;
+import org.jivesoftware.smackx.entitycaps.EntityCapsManager;
+import org.jivesoftware.smackx.packet.DiscoverInfo;
+
+/**
+ * This class implements an adapter for XMPPConnection.
+ * @author darisk
+ */
+public class XmppConnectionAdapter extends IXmppConnection.Stub {
+
+ /**
+ * Beem connection closed Intent name.
+ */
+
+ private static final int SMACK_PRIORITY_MIN = -128;
+ private static final int SMACK_PRIORITY_MAX = 128;
+ private static final String TAG = "XMPPConnectionAdapter";
+ private final XMPPConnection mAdaptee;
+ private IChatManager mChatManager;
+ private final String mLogin;
+ private final String mPassword;
+ private String mResource;
+ private String mErrorMsg;
+ private RosterAdapter mRoster;
+ private int mPreviousPriority;
+ private int mPreviousMode;
+ private String mPreviousStatus;
+ private PrivacyListManagerAdapter mPrivacyListManager;
+ private ChatStateManager mChatStateManager;
+ private final BeemService mService;
+ private BeemApplication mApplication;
+ private BeemAvatarManager mAvatarManager;
+ private PepSubManager mPepManager;
+ private SharedPreferences mPref;
+ private final RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners =
+ new RemoteCallbackList<IBeemConnectionListener>();
+ private final SubscribePacketListener mSubscribePacketListener = new SubscribePacketListener();
+ private final PingListener mPingListener = new PingListener();
+
+ private final ConnexionListenerAdapter mConListener = new ConnexionListenerAdapter();
+
+ private UserInfo mUserInfo;
+ private final UserInfoManager mUserInfoManager = new UserInfoManager();
+
+ /**
+ * Constructor.
+ * @param config Configuration to use in order to connect
+ * @param login login to use on connect
+ * @param password password to use on connect
+ * @param service the background service associated with the connection.
+ */
+ public XmppConnectionAdapter(final ConnectionConfiguration config, final String login, final String password,
+ final BeemService service) {
+ this(new XMPPConnection(config), login, password, service);
+ }
+
+ /**
+ * Constructor.
+ * @param serviceName name of the service to connect to
+ * @param login login to use on connect
+ * @param password password to use on connect
+ * @param service the background service associated with the connection.
+ */
+ public XmppConnectionAdapter(final String serviceName, final String login, final String password,
+ final BeemService service) {
+ this(new XMPPConnection(serviceName), login, password, service);
+ }
+
+ /**
+ * Constructor.
+ * @param con The connection to adapt
+ * @param login The login to use
+ * @param password The password to use
+ * @param service the background service associated with the connection.
+ */
+ public XmppConnectionAdapter(final XMPPConnection con, final String login, final String password,
+ final BeemService service) {
+ mAdaptee = con;
+ PrivacyListManager.getInstanceFor(mAdaptee);
+ mLogin = login;
+ mPassword = password;
+ mService = service;
+ Context ctx = mService.getApplicationContext();
+ if (ctx instanceof BeemApplication) {
+ mApplication = (BeemApplication) ctx;
+ }
+ mPref = mService.getServicePreference();
+ try {
+ mPreviousPriority = Integer.parseInt(mPref.getString(BeemApplication.CONNECTION_PRIORITY_KEY, "0"));
+ } catch (NumberFormatException ex) {
+ mPreviousPriority = 0;
+ }
+ mResource = mPref.getString(BeemApplication.CONNECTION_RESOURCE_KEY, "Beem");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addConnectionListener(IBeemConnectionListener listen) throws RemoteException {
+ if (listen != null)
+ mRemoteConnListeners.register(listen);
+ }
+
+ @Override
+ public boolean connect() throws RemoteException {
+ if (mAdaptee.isConnected())
+ return true;
+ else {
+ try {
+ mAdaptee.connect();
+ mAdaptee.addConnectionListener(mConListener);
+ return true;
+ } catch (XMPPException e) {
+ Log.e(TAG, "Error while connecting", e);
+ try {
+ //TODO NIKITA DOES SOME SHIT !!! Fix this monstruosity
+ String str = mService.getResources().getString(
+ mService.getResources().getIdentifier(e.getXMPPError().getCondition().replace("-", "_"),
+ "string", "com.beem.project.beem"));
+ mErrorMsg = str;
+ } catch (NullPointerException e2) {
+ if (!"".equals(e.getMessage()))
+ mErrorMsg = e.getMessage();
+ else
+ mErrorMsg = e.toString();
+ }
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public boolean login() throws RemoteException {
+ if (mAdaptee.isAuthenticated())
+ return true;
+ if (!mAdaptee.isConnected())
+ return false;
+ try {
+
+ this.initFeatures(); // pour declarer les features xmpp qu'on
+ // supporte
+
+ PacketFilter filter = new PacketFilter() {
+
+ @Override
+ public boolean accept(Packet packet) {
+ if (packet instanceof Presence) {
+ Presence pres = (Presence) packet;
+ if (pres.getType() == Presence.Type.subscribe)
+ return true;
+ }
+ return false;
+ }
+ };
+
+ mAdaptee.addPacketListener(mSubscribePacketListener, filter);
+
+ filter = new PacketTypeFilter(PingExtension.class);
+ mAdaptee.addPacketListener(mPingListener, filter);
+
+ mAdaptee.login(mLogin, mPassword, mResource);
+ mUserInfo = new UserInfo(mAdaptee.getUser());
+ discoverServerFeatures();
+
+ mChatManager = new BeemChatManager(mAdaptee.getChatManager(), mService, mAdaptee.getRoster());
+ //nikita: I commented this line because of the logs provided in http://www.beem-project.com/issues/321
+ //Also, since the privacylistmanager isn't finished and used, it will be safer to not initialize it
+ //mPrivacyListManager = new PrivacyListManagerAdapter(PrivacyListManager.getInstanceFor(mAdaptee));
+ mService.initJingle(mAdaptee);
+
+ mApplication.setConnected(true);
+ int mode = mPref.getInt(BeemApplication.STATUS_KEY, 0);
+ String status = mPref.getString(BeemApplication.STATUS_TEXT_KEY, "");
+ changeStatus(mode, status);
+ return true;
+ } catch (XMPPException e) {
+ Log.e(TAG, "Error while connecting", e);
+ mErrorMsg = mService.getString(R.string.error_login_authentication);
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final void connectAsync() throws RemoteException {
+ if (mAdaptee.isConnected() || mAdaptee.isAuthenticated())
+ return;
+ Thread t = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ connectSync();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error while connecting asynchronously", e);
+ }
+ }
+ });
+ t.start();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean connectSync() throws RemoteException {
+ if (connect())
+ return login();
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void changeStatusAndPriority(int status, String msg, int priority) {
+ Presence pres = new Presence(Presence.Type.available);
+ String m;
+ if (msg != null)
+ m = msg;
+ else
+ m = mPreviousStatus;
+ pres.setStatus(m);
+ mPreviousStatus = m;
+ Presence.Mode mode = Status.getPresenceModeFromStatus(status);
+ if (mode != null) {
+ pres.setMode(mode);
+ mPreviousMode = status;
+ } else {
+ pres.setMode(Status.getPresenceModeFromStatus(mPreviousMode));
+ }
+ int p = priority;
+ if (priority < SMACK_PRIORITY_MIN)
+ p = SMACK_PRIORITY_MIN;
+ if (priority > SMACK_PRIORITY_MAX)
+ p = SMACK_PRIORITY_MAX;
+ mPreviousPriority = p;
+ pres.setPriority(p);
+ mAdaptee.sendPacket(pres);
+ updateNotification(Status.getStatusFromPresence(pres), m);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void changeStatus(int status, String msg) {
+ changeStatusAndPriority(status, msg, mPreviousPriority);
+ }
+
+ /**
+ * Get the AvatarManager of this connection.
+ * @return the AvatarManager or null if there is not
+ */
+ public BeemAvatarManager getAvatarManager() {
+ return mAvatarManager;
+ }
+
+ /**
+ * get the previous status.
+ * @return previous status.
+ */
+ public String getPreviousStatus() {
+ return mPreviousStatus;
+ }
+
+ /**
+ * get the previous mode.
+ * @return previous mode.
+ */
+ public int getPreviousMode() {
+ return mPreviousMode;
+ }
+
+ /**
+ * Update the notification for the Beem status.
+ * @param status the status to display.
+ * @param text the text to display.
+ */
+ private void updateNotification(int status, String text) {
+ Notification mStatusNotification;
+ mStatusNotification = new Notification(Status.getIconBarFromStatus(status), text, System.currentTimeMillis());
+ mStatusNotification.defaults = Notification.DEFAULT_LIGHTS;
+ mStatusNotification.flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
+
+ mStatusNotification.setLatestEventInfo(mService, "Beem Status", text,
+ PendingIntent.getActivity(mService, 0, new Intent(mService, ChangeStatus.class), 0));
+ // bypass the preferences for notification
+ mService.getNotificationManager().notify(BeemService.NOTIFICATION_STATUS_ID, mStatusNotification);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean disconnect() {
+ if (mAdaptee != null && mAdaptee.isConnected())
+ mAdaptee.disconnect();
+ return true;
+ }
+
+ /**
+ * Get the Smack XmppConnection.
+ * @return Smack XmppConnection
+ */
+ public XMPPConnection getAdaptee() {
+ return mAdaptee;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IChatManager getChatManager() throws RemoteException {
+ return mChatManager;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IRoster getRoster() throws RemoteException {
+ if (mRoster != null)
+ return mRoster;
+ Roster adap = mAdaptee.getRoster();
+ if (adap == null)
+ return null;
+ mRoster = new RosterAdapter(adap, mService, mAvatarManager);
+ return mRoster;
+ }
+
+ /**
+ * Get the user informations.
+ * @return the user infos or null if not logged
+ */
+ public UserInfo getUserInfo() {
+ return mUserInfo;
+ }
+
+ /**
+ * Returns true if currently authenticated by successfully calling the login method.
+ * @return true when successfully authenticated
+ */
+ public boolean isAuthentificated() {
+ return mAdaptee.isAuthenticated();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeConnectionListener(IBeemConnectionListener listen) throws RemoteException {
+ if (listen != null)
+ mRemoteConnListeners.unregister(listen);
+ }
+
+ /**
+ * PrivacyListManagerAdapter mutator.
+ * @param privacyListManager the privacy list manager
+ */
+ public void setPrivacyListManager(PrivacyListManagerAdapter privacyListManager) {
+ this.mPrivacyListManager = privacyListManager;
+ }
+
+ /**
+ * PrivacyListManagerAdapter accessor.
+ * @return the mPrivacyList
+ */
+ public PrivacyListManagerAdapter getPrivacyListManager() {
+ return mPrivacyListManager;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getErrorMessage() {
+ return mErrorMsg;
+ }
+
+ /**
+ * Initialize the features provided by beem.
+ */
+ private void initFeatures() {
+ ServiceDiscoveryManager.setIdentityName("Beem");
+ ServiceDiscoveryManager.setIdentityType("phone");
+ ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
+ if (sdm == null)
+ sdm = new ServiceDiscoveryManager(mAdaptee);
+
+ sdm.addFeature("http://jabber.org/protocol/disco#info");
+ //nikita: must be uncommented when the feature will be enabled
+ //sdm.addFeature("jabber:iq:privacy");
+ sdm.addFeature("http://jabber.org/protocol/caps");
+ sdm.addFeature("urn:xmpp:avatar:metadata");
+ sdm.addFeature("urn:xmpp:avatar:metadata+notify");
+ sdm.addFeature("urn:xmpp:avatar:data");
+ sdm.addFeature("http://jabber.org/protocol/nick");
+ sdm.addFeature("http://jabber.org/protocol/nick+notify");
+ sdm.addFeature(PingExtension.NAMESPACE);
+
+ mChatStateManager = ChatStateManager.getInstance(mAdaptee);
+
+ EntityCapsManager em = sdm.getEntityCapsManager();
+ em.setNode("http://www.beem-project.com");
+ }
+
+ /**
+ * Discover the features provided by the server.
+ */
+ private void discoverServerFeatures() {
+ try {
+ // jid et server
+ ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
+ DiscoverInfo info = sdm.discoverInfo(mAdaptee.getServiceName());
+ Iterator<DiscoverInfo.Identity> it = info.getIdentities();
+ while (it.hasNext()) {
+ DiscoverInfo.Identity identity = it.next();
+ if ("pubsub".equals(identity.getCategory()) && "pep".equals(identity.getType())) {
+ initPEP();
+ }
+ }
+ } catch (XMPPException e) {
+ Log.w(TAG, "Unable to discover server features", e);
+ }
+ }
+
+ /**
+ * Initialize PEP.
+ */
+ private void initPEP() {
+ // Enable pep sending
+ Log.d(TAG, "Pep enabled");
+ // API 8
+ // mService.getExternalCacheDir()
+ mPepManager = new PepSubManager(mAdaptee, StringUtils.parseBareAddress(mAdaptee.getUser()));
+ AvatarCache avatarCache = new BeemAvatarCache(mService);
+ mAvatarManager = new BeemAvatarManager(mService, mAdaptee, mPepManager, avatarCache, true);
+ mAvatarManager.addAvatarListener(mUserInfoManager);
+ mApplication.setPepEnabled(true);
+ }
+
+ /**
+ * Reset the application state.
+ */
+ private void resetApplication() {
+ mApplication.setConnected(false);
+ mApplication.setPepEnabled(false);
+ }
+
+ /**
+ * Listener for XMPP connection events. It will calls the remote listeners for connection events.
+ */
+ private class ConnexionListenerAdapter implements ConnectionListener {
+
+ /**
+ * Defaut constructor.
+ */
+ public ConnexionListenerAdapter() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void connectionClosed() {
+ Log.d(TAG, "closing connection");
+ mRoster = null;
+ Intent intent = new Intent(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED);
+ intent.putExtra("message", mService.getString(R.string.BeemBroadcastReceiverDisconnect));
+ intent.putExtra("normally", true);
+ mService.sendBroadcast(intent);
+ mService.stopSelf();
+ resetApplication();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void connectionClosedOnError(Exception exception) {
+ Log.d(TAG, "connectionClosedOnError");
+ mRoster = null;
+ Intent intent = new Intent(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED);
+ intent.putExtra("message", exception.getMessage());
+ mService.sendBroadcast(intent);
+ mService.stopSelf();
+ resetApplication();
+ }
+
+ /**
+ * Connection failed callback.
+ * @param errorMsg smack failure message
+ */
+ public void connectionFailed(String errorMsg) {
+ Log.d(TAG, "Connection Failed");
+ final int n = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < n; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ if (listener != null)
+ listener.connectionFailed(errorMsg);
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ Log.w(TAG, "Error while triggering remote connection listeners", e);
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ mService.stopSelf();
+ resetApplication();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void reconnectingIn(int arg0) {
+ Log.d(TAG, "reconnectingIn");
+ final int n = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < n; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ if (listener != null)
+ listener.reconnectingIn(arg0);
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ Log.w(TAG, "Error while triggering remote connection listeners", e);
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void reconnectionFailed(Exception arg0) {
+ Log.d(TAG, "reconnectionFailed");
+ final int r = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < r; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ if (listener != null)
+ listener.reconnectionFailed();
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ Log.w(TAG, "Error while triggering remote connection listeners", e);
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void reconnectionSuccessful() {
+ Log.d(TAG, "reconnectionSuccessful");
+ mApplication.setConnected(true);
+ PacketFilter filter = new PacketFilter() {
+
+ @Override
+ public boolean accept(Packet packet) {
+ if (packet instanceof Presence) {
+ Presence pres = (Presence) packet;
+ if (pres.getType() == Presence.Type.subscribe)
+ return true;
+ }
+ return false;
+ }
+ };
+
+ mAdaptee.addPacketListener(mSubscribePacketListener, filter);
+
+ final int n = mRemoteConnListeners.beginBroadcast();
+
+ for (int i = 0; i < n; i++) {
+ IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
+ try {
+ if (listener != null)
+ listener.reconnectionSuccessful();
+ } catch (RemoteException e) {
+ // The RemoteCallbackList will take care of removing the
+ // dead listeners.
+ Log.w(TAG, "Error while triggering remote connection listeners", e);
+ }
+ }
+ mRemoteConnListeners.finishBroadcast();
+ }
+ }
+
+ /**
+ * This PacketListener will set a notification when you got a subscribtion request.
+ * @author Da Risk <da_risk@elyzion.net>
+ */
+ private class SubscribePacketListener implements PacketListener {
+
+ /**
+ * Constructor.
+ */
+ public SubscribePacketListener() {
+ }
+
+ @Override
+ public void processPacket(Packet packet) {
+ String from = packet.getFrom();
+
+ NotificationCompat.Builder notif = new NotificationCompat.Builder(mService);
+ String title = mService.getString(R.string.AcceptContactRequest, from);
+ String text = mService.getString(R.string.AcceptContactRequestFrom, from);
+ notif.setTicker(title).setContentTitle(title);
+ notif.setContentText(text);
+ notif.setSmallIcon(R.drawable.beem_status_icon_gray);
+ notif.setAutoCancel(true).setWhen(System.currentTimeMillis());
+
+ Intent intent = new Intent(mService, Subscription.class);
+ intent.setData(Contact.makeXmppUri(from));
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ PendingIntent notifIntent = PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT);
+ notif.setContentIntent(notifIntent);
+
+ int id = packet.hashCode();
+ mService.sendNotification(id, notif.getNotification());
+ }
+ }
+
+ /**
+ * The UserInfoManager listen to XMPP events and update the user information accoldingly.
+ */
+ private class UserInfoManager implements AvatarListener {
+
+ /**
+ * Constructor.
+ */
+ public UserInfoManager() {
+ }
+
+ @Override
+ public void onAvatarChange(String from, String avatarId, List<AvatarMetadataExtension.Info> avatarInfos) {
+ String jid = StringUtils.parseBareAddress(mUserInfo.getJid());
+ String mfrom = StringUtils.parseBareAddress(from);
+ if (jid.equalsIgnoreCase(mfrom)) {
+ mUserInfo.setAvatarId(avatarId);
+ }
+ }
+ }
+
+ /**
+ * Listener for Ping request. It will respond with a Pong.
+ */
+ private class PingListener implements PacketListener {
+
+ /**
+ * Constructor.
+ */
+ public PingListener() {
+
+ }
+
+ @Override
+ public void processPacket(Packet packet) {
+ if (!(packet instanceof PingExtension))
+ return;
+ PingExtension p = (PingExtension) packet;
+ if (p.getType() == IQ.Type.GET) {
+ PingExtension pong = new PingExtension();
+ pong.setType(IQ.Type.RESULT);
+ pong.setTo(p.getFrom());
+ pong.setPacketID(p.getPacketID());
+ mAdaptee.sendPacket(pong);
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/XmppFacade.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,196 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service;
+
+import android.net.Uri;
+import android.os.RemoteException;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.service.aidl.IChatManager;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IXmppConnection;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.PresenceType;
+
+import org.jivesoftware.smack.packet.Presence;
+
+/**
+ * This class is a facade for the Beem Service.
+ * @author darisk
+ */
+public class XmppFacade extends IXmppFacade.Stub {
+
+ private XmppConnectionAdapter mConnexion;
+ private final BeemService service;
+
+ /**
+ * Create an XmppFacade.
+ *
+ * @param service the service providing the facade
+ */
+ public XmppFacade(final BeemService service) {
+ this.service = service;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void changeStatus(int status, String msg) {
+ initConnection();
+ mConnexion.changeStatus(status, msg);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void connectAsync() throws RemoteException {
+ initConnection();
+ mConnexion.connectAsync();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void connectSync() throws RemoteException {
+ initConnection();
+ mConnexion.connectSync();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IXmppConnection createConnection() throws RemoteException {
+ initConnection();
+ return mConnexion;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void disconnect() throws RemoteException {
+ initConnection();
+ mConnexion.disconnect();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IChatManager getChatManager() throws RemoteException {
+ initConnection();
+ return mConnexion.getChatManager();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IRoster getRoster() throws RemoteException {
+ initConnection();
+ return mConnexion.getRoster();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IPrivacyListManager getPrivacyListManager() {
+ initConnection();
+ return mConnexion.getPrivacyListManager();
+ }
+
+ @Override
+ public void sendPresencePacket(PresenceAdapter presence) throws RemoteException {
+ initConnection();
+ Presence presence2 = new Presence(PresenceType.getPresenceTypeFrom(presence.getType()));
+ presence2.setTo(presence.getTo());
+ mConnexion.getAdaptee().sendPacket(presence2);
+ }
+
+ /* (non-Javadoc)
+ * @see com.beem.project.beem.service.aidl.IXmppFacade#call(java.lang.String)
+ */
+ @Override
+ public void call(String jid) throws RemoteException {
+ }
+
+ @Override
+ public boolean publishAvatar(Uri avatarUri) throws RemoteException {
+ initConnection();
+ BeemAvatarManager mgr = mConnexion.getAvatarManager();
+ if (mgr == null)
+ return false;
+
+ return mgr.publishAvatar(avatarUri);
+ }
+
+ @Override
+ public void disableAvatarPublishing() throws RemoteException {
+ initConnection();
+ BeemAvatarManager mgr = mConnexion.getAvatarManager();
+ if (mgr != null)
+ mgr.disableAvatarPublishing();
+ }
+
+ @Override
+ public UserInfo getUserInfo() throws RemoteException {
+ initConnection();
+ return mConnexion.getUserInfo();
+ }
+
+ /**
+ * Initialize the connection.
+ */
+ private void initConnection() {
+ if (mConnexion == null) {
+ mConnexion = service.createConnection();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/auth/AccountAuthenticator.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,145 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.service.auth;
+
+import java.io.IOException;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.AuthenticatorException;
+import android.accounts.OperationCanceledException;
+import android.content.Context;
+import android.util.Log;
+
+import org.apache.harmony.javax.security.auth.callback.Callback;
+import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
+import org.apache.harmony.javax.security.auth.callback.NameCallback;
+import org.apache.harmony.javax.security.auth.callback.PasswordCallback;
+import org.apache.harmony.javax.security.auth.callback.UnsupportedCallbackException;
+import org.apache.harmony.javax.security.sasl.RealmCallback;
+import org.jivesoftware.smack.util.StringUtils;
+
+/**
+ * The AccountAuthenticator use an Android Account to authenticate.
+ */
+public class AccountAuthenticator implements CallbackHandler {
+ private static final String GOOGLE_TOKEN_TYPE = "oauth2:https://www.googleapis.com/auth/googletalk";
+ private static final String TAG = AccountAuthenticator.class.getSimpleName();
+
+ private AccountManager accountMgr;
+ private Account account;
+
+ /**
+ * Create an AccountAuthenticator.
+ *
+ * @param context the Android context
+ * @param account the account to use
+ *
+ */
+ public AccountAuthenticator(final Context context, final Account account) {
+ accountMgr = AccountManager.get(context);
+ this.account = account;
+ }
+
+ @Override
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ String tmpJid = account.name;
+ String service = StringUtils.parseServer(tmpJid);
+
+ for (int i = 0; i < callbacks.length; i++) {
+ if (callbacks[i] instanceof NameCallback) {
+ String authenticationId = StringUtils.parseName(tmpJid);
+ if (useFullJid(account)) {
+ authenticationId = tmpJid;
+ }
+ NameCallback ncb = (NameCallback) callbacks[i];
+ ncb.setName(authenticationId);
+ } else if (callbacks[i] instanceof PasswordCallback) {
+ PasswordCallback pcb = (PasswordCallback) callbacks[i];
+ // skip if password is asked for PKCS11 (SSL keystore)
+ String prompt = pcb.getPrompt();
+ if (prompt != null && prompt.startsWith("PKCS11 Password:"))
+ continue;
+ String password;
+ if (useToken(account))
+ password = getToken();
+ else
+ password = accountMgr.getPassword(account);
+ if (password == null)
+ password = "";
+ pcb.setPassword(password.toCharArray());
+ } else if (callbacks[i] instanceof RealmCallback) {
+ RealmCallback rcb = (RealmCallback) callbacks[i];
+ rcb.setText(service);
+ } else {
+ throw new UnsupportedCallbackException(callbacks[i]);
+ }
+ }
+ }
+
+ /**
+ * Test if the accout use the full jid to authenticate.
+ *
+ * @param accountt the account to test
+ *
+ * @return true if the account use full jid false otherwise
+ */
+ private boolean useFullJid(Account accountt) {
+ String type = accountt.type;
+ return "com.google".equals(type);
+ }
+
+ /**
+ * Test if the account use authentication token.
+ *
+ * @param accountt the account to test
+ *
+ * @return true if the account use token false otherwise
+ */
+ private boolean useToken(Account accountt) {
+ String type = accountt.type;
+ return "com.google".equals(type);
+ }
+
+ /**
+ * Get a authentication token from the Account.
+ *
+ * @return the token or en empty string if an error occurs
+ */
+ private String getToken() {
+ try {
+ return accountMgr.blockingGetAuthToken(account, GOOGLE_TOKEN_TYPE, true);
+ } catch (OperationCanceledException e) {
+ Log.v(TAG, "Token request canceled", e);
+ } catch (AuthenticatorException e) {
+ Log.d(TAG, "Unable to get token", e);
+ } catch (IOException e) {
+ Log.d(TAG, "Unable to get token", e);
+ }
+ return "";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/auth/PreferenceAuthenticator.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,92 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.service.auth;
+
+import java.io.IOException;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+
+import com.beem.project.beem.BeemApplication;
+
+import org.apache.harmony.javax.security.auth.callback.Callback;
+import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
+import org.apache.harmony.javax.security.auth.callback.NameCallback;
+import org.apache.harmony.javax.security.auth.callback.PasswordCallback;
+import org.apache.harmony.javax.security.auth.callback.UnsupportedCallbackException;
+import org.apache.harmony.javax.security.sasl.RealmCallback;
+import org.jivesoftware.smack.util.StringUtils;
+
+/**
+ * An Authenticator which look for credentials stored in preferences.
+ */
+public class PreferenceAuthenticator implements CallbackHandler {
+
+ private final SharedPreferences settings;
+
+ /**
+ * Create a PreferenceAuthenticator.
+ *
+ * @param context the Android context.
+ */
+ public PreferenceAuthenticator(final Context context) {
+ settings = PreferenceManager.getDefaultSharedPreferences(context);
+ }
+
+ @Override
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ String tmpJid = settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "").trim();
+ String service = StringUtils.parseServer(tmpJid);
+
+ for (int i = 0; i < callbacks.length; i++) {
+ if (callbacks[i] instanceof NameCallback) {
+ String authenticationId = StringUtils.parseName(tmpJid);
+ if (settings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false)
+ || "gmail.com".equals(service) || "googlemail.com".equals(service)) {
+ authenticationId = tmpJid;
+ }
+ NameCallback ncb = (NameCallback) callbacks[i];
+ ncb.setName(authenticationId);
+ } else if (callbacks[i] instanceof PasswordCallback) {
+ PasswordCallback pcb = (PasswordCallback) callbacks[i];
+ // skip if password is asked for PKCS11 (SSL keystore)
+ String prompt = pcb.getPrompt();
+ if (prompt != null && prompt.startsWith("PKCS11 Password:"))
+ continue;
+ String password = settings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
+ pcb.setPassword(password.toCharArray());
+ } else if (callbacks[i] instanceof RealmCallback) {
+ RealmCallback rcb = (RealmCallback) callbacks[i];
+ rcb.setText(service);
+ } else {
+ throw new UnsupportedCallbackException(callbacks[i]);
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/auth/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,31 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+
+/**
+ * This package contains different Authenticator used to login.
+ */
+package com.beem.project.beem.service.auth;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/service/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,47 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+*/
+/**
+ * This package contains all the class use by the service.
+ */
+package com.beem.project.beem.service;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarCache.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,90 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Interface for an AvatarCache.
+ * This can be improved to a generic cache.
+ *
+ */
+public interface AvatarCache {
+
+ /**
+ * Put some datas in cache.
+ *
+ * @param id the key id of the data
+ * @param data the data to cache
+ * @throws IOException if an IO error occurs while caching the data
+ */
+ void put(String id, byte[] data) throws IOException;
+
+ /**
+ * Put some datas in cache.
+ *
+ * @param id the key id of the data
+ * @param data an InputStream to the data to cache
+ * @throws IOException if an IO error occurs while caching the data
+ */
+ void put(String id, InputStream data) throws IOException;
+
+ /**
+ * Get some data from the cache.
+ *
+ * @param id the id of the data to get
+ * @return the cached data
+ * @throws IOException if an IO error occurs while geting the data
+ */
+ byte[] get(String id) throws IOException;
+
+ /**
+ * Test if a data is in cache.
+ *
+ * @param id the id of the data
+ * @return true if data is in cache false otherwise
+ */
+ boolean contains(String id);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarExtension.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,111 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import org.jivesoftware.smack.util.Base64;
+import org.jivesoftware.smack.packet.PacketExtension;
+
+/**
+ * PacketExtension to represent the Avatar data.
+ * XML namespace urn:xmpp:avatar:data
+ *
+ */
+public class AvatarExtension implements PacketExtension {
+
+ private String mData;
+
+ /**
+ * Create an AvatarExtension.
+ * @param base64 the data of the avatar as a base64 string
+ */
+ public AvatarExtension(final String base64) {
+ mData = base64;
+ }
+
+ /**
+ * Create an AvatarExtension.
+ * @param data the data of the avatar
+ */
+ public AvatarExtension(final byte[] data) {
+ mData = Base64.encodeBytes(data);
+ }
+
+ /**
+ * Get the avatar data as a Base64 string.
+ *
+ * @return a base64 string.
+ */
+ public String getBase64() {
+ return mData;
+ }
+
+ /**
+ * Get the avatar data.
+ *
+ * @return the decoded data
+ */
+ public byte[] getData() {
+ return Base64.decode(mData);
+ }
+
+ @Override
+ public String getElementName() {
+ return "data";
+ }
+
+ @Override
+ public String getNamespace() {
+ return "urn:xmpp:avatar:data";
+ }
+
+ @Override
+ public String toXML() {
+ StringBuilder builder = new StringBuilder("<data xmlns=\"");
+ builder.append(getNamespace()).append("\">");
+ builder.append(mData);
+ builder.append("</data>");
+ return builder.toString();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarListener.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,64 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.util.List;
+import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
+
+/**
+ * A listener for avatar changes event.
+ *
+ */
+public interface AvatarListener {
+
+ /**
+ * Event which is fired when a contact change avatar.
+ *
+ * @param from the contact who change his avatar
+ * @param avatarId the new avatar id, may be null if the contact set no avatar
+ * @param avatarInfos the metadata infos of the avatar, may be empty if the contact set no avatar
+ */
+ void onAvatarChange(String from, String avatarId, List<Info> avatarInfos);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarManager.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,292 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
+import com.beem.project.beem.smack.pep.PEPListener;
+import com.beem.project.beem.smack.pep.PepSubManager;
+
+import org.jivesoftware.smack.Connection;
+import org.jivesoftware.smack.packet.PacketExtension;
+import org.jivesoftware.smack.util.StringUtils;
+import org.jivesoftware.smackx.pubsub.Item;
+import org.jivesoftware.smackx.pubsub.LeafNode;
+import org.jivesoftware.smackx.pubsub.PayloadItem;
+
+/**
+ * This class deals with the avatar data.
+ * It can be configured to auto retrieve the avatar and put it in cache.
+ *
+ */
+public class AvatarManager {
+
+ /** The pubsub node for avatar data. */
+ public static final String AVATARDATA_NODE = "urn:xmpp:avatar:data";
+ /** The pubsub node for avatar metadata. */
+ public static final String AVATARMETADATA_NODE = "urn:xmpp:avatar:metadata";
+
+ private PepSubManager mPep;
+ private Connection mCon;
+ private boolean mAutoDownload;
+ private AvatarCache mCache;
+ private final List<AvatarListener> mListeners = new LinkedList<AvatarListener>();
+
+ /**
+ * Create an AvatarManager.
+ *
+ * @param con the connection
+ * @param pepMgr the PepSubManager of the Connection
+ * @param cache the cache which will store the avatars
+ * @param autoDownload true to enable auto download of avatars
+ */
+ public AvatarManager(final Connection con, final PepSubManager pepMgr,
+ final AvatarCache cache, final boolean autoDownload) {
+ mCon = con;
+ mPep = pepMgr;
+ mAutoDownload = autoDownload;
+ mCache = cache;
+ mPep.addPEPListener(new Listener());
+ }
+
+ /**
+ * Create an AvatarManager.
+ *
+ * @param con the connection
+ * @param pepMgr the PepSubManager of the Connection
+ * @param autoDownload true to enable auto download of avatars
+ */
+ protected AvatarManager(final Connection con, final PepSubManager pepMgr, final boolean autoDownload) {
+ mCon = con;
+ mPep = pepMgr;
+ mAutoDownload = autoDownload;
+ mPep.addPEPListener(new Listener());
+ mCache = new MemoryAvatarCache(100, 1800000);
+ }
+
+ /**
+ * Get an avatar from the cache.
+ *
+ * @param avatarId the id of the avatar
+ * @return the avatar or null if it cannot be retrieved from the cache
+ */
+ public byte[] getAvatar(String avatarId) {
+ if (avatarId == null)
+ return null;
+ try {
+ return mCache.get(avatarId);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Add an AvatarListener.
+ *
+ * @param listener the AvatarListener to add
+ */
+ public void addAvatarListener(AvatarListener listener) {
+ if (!mListeners.contains(listener))
+ mListeners.add(listener);
+ }
+
+ /**
+ * Remove an AvatarListener.
+ *
+ * @param listener the AvatarListener to remove
+ */
+ public void removeAvatarListener(AvatarListener listener) {
+ mListeners.remove(listener);
+ }
+
+ /**
+ * Download an avatar.
+ *
+ * @param from The jid of the user
+ * @param avatarId the id of the avatar
+ * @param info the metadata information of the avatar to download
+ * @return true if the download was successfull
+ */
+ public boolean downloadAvatar(String from, String avatarId, Info info) {
+ try {
+ AvatarRetriever retriever = AvatarRetrieverFactory.getRetriever(mCon, from, info);
+ byte[] avatar = retriever.getAvatar();
+ mCache.put(avatarId, avatar);
+ return true;
+ } catch (IOException e) {
+ System.err.println("Error while downloading avatar");
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * Disable the diffusion of your avatar.
+ */
+ public void disableAvatarPublishing() {
+ AvatarMetadataExtension metadata = new AvatarMetadataExtension();
+ publishAvatarMetaData(null, metadata);
+ }
+
+ /**
+ * Send an avatar image to the pep server.
+ *
+ * @param data the image data.
+ * @return true if the image where successfully sent. false otherwise
+ */
+ public boolean publishAvatarData(byte[] data) {
+ try {
+ String id = getAvatarId(data);
+ publishAvatarData(id, data);
+ return true;
+ } catch (NoSuchAlgorithmException e) {
+ System.err.println("Security error while publishing avatar data : " + e.getMessage());
+ return false;
+ }
+ }
+
+ /**
+ * Send the metadata of the avatar you want to publish.
+ * By sending this metadata, you publish an avatar.
+ *
+ * @param id the id of the metadata item
+ * @param metadata the metadata to publish
+ */
+ public void publishAvatarMetaData(String id, AvatarMetadataExtension metadata) {
+ PayloadItem<AvatarMetadataExtension> item = new PayloadItem<AvatarMetadataExtension>(id, metadata);
+ LeafNode node = mPep.getPEPNode(AVATARMETADATA_NODE);
+ node.publish(item);
+ }
+
+ /**
+ * Select the avatar to download.
+ * Subclass should override this method to take control over the selection process.
+ * This implementation select the first element.
+ *
+ * @param available list of the avatar metadata information
+ * @return the metadata of the avatar to download
+ */
+ protected Info selectAvatar(List<Info> available) {
+ return available.get(0);
+ }
+
+
+ /**
+ * Get the id corresponding to this avatar data.
+ *
+ * @param data the avatar data
+ * @return the id
+ * @throws NoSuchAlgorithmException if the sha-1 algorithm is unavailable
+ */
+ protected String getAvatarId(byte[] data) throws NoSuchAlgorithmException {
+ MessageDigest md = MessageDigest.getInstance("sha-1");
+ byte[] hash = md.digest(data);
+ return StringUtils.encodeHex(hash);
+ }
+
+ /**
+ * Publish an avatar data.
+ *
+ * @param id the id of the avatar data
+ * @param data the data of the avatar
+ */
+ private void publishAvatarData(String id, byte[] data) {
+ AvatarExtension avatar = new AvatarExtension(data);
+ PayloadItem<AvatarExtension> item = new PayloadItem<AvatarExtension>(id, avatar);
+ LeafNode node = mPep.getPEPNode(AVATARDATA_NODE);
+ node.publish(item);
+ }
+
+ /**
+ * Fire the listeners for avatar change.
+ *
+ * @param from the jid of the contact
+ * @param avatarId the new avatar id
+ * @param avatarInfos the metadata infos of the avatar
+ */
+ private void fireListeners(String from, String avatarId, List<Info> avatarInfos) {
+ for (AvatarListener l : mListeners)
+ l.onAvatarChange(from, avatarId, avatarInfos);
+ }
+
+
+ /**
+ * A listener to PEPEevent.
+ */
+ private class Listener implements PEPListener {
+
+ /**
+ * Create a listener.
+ */
+ public Listener() {
+ }
+
+ @Override
+ public void eventReceived(String from, String node, List<Item> items) {
+ if (!"urn:xmpp:avatar:metadata".equals(node))
+ return;
+ Item i = items.get(0);
+ if (i instanceof PayloadItem) {
+ PayloadItem<PacketExtension> pi = (PayloadItem<PacketExtension>) i;
+ PacketExtension ex = pi.getPayload();
+ if (ex instanceof AvatarMetadataExtension) {
+ AvatarMetadataExtension ext = (AvatarMetadataExtension) ex;
+ String id = i.getId();
+ List<Info> infos = ext.getInfos();
+ if (infos.size() > 0 && mAutoDownload) {
+ Info info = selectAvatar(infos);
+ if (!mCache.contains(id))
+ downloadAvatar(from, id, info);
+ }
+ fireListeners(from, id, infos);
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarMetadataExtension.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,257 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jivesoftware.smack.packet.PacketExtension;
+
+/**
+ * PacketExtension to represent the Avatar metadata.
+ * XML namespace urn:xmpp:avatar:metadata
+ *
+ */
+public class AvatarMetadataExtension implements PacketExtension {
+ private List<Info> mInfos = new LinkedList<Info>();
+
+ /**
+ * Create an AvatarMetadataExtension.
+ */
+ public AvatarMetadataExtension() {
+ }
+
+ /**
+ * Get the metadata informations.
+ *
+ * @return a list of informations
+ */
+ public List<Info> getInfos() {
+ return mInfos;
+ }
+
+ /**
+ * Add a metadate information.
+ *
+ * @param info the metadata information to add
+ */
+ public void addInfo(Info info) {
+ mInfos.add(info);
+ }
+
+ @Override
+ public String getElementName() {
+ return "metadata";
+ }
+
+ @Override
+ public String getNamespace() {
+ return "urn:xmpp:avatar:metadata";
+ }
+
+ @Override
+ public String toXML() {
+ StringBuilder builder = new StringBuilder("<metadata xmlns=\"");
+ builder.append(getNamespace()).append("\">");
+ for (Info info : mInfos) {
+ builder.append(info.toXML());
+ }
+ builder.append("</metadata>");
+ return builder.toString();
+ }
+
+ /**
+ * A metadata information element.
+ */
+ public static class Info {
+ private int mBytes;
+ private int mHeight;
+ private int mWidth;
+ private String mId;
+ private String mType;
+ private String mUrl;
+
+ /**
+ * Create an Info.
+ *
+ * @param id the id of the info
+ * @param type the MIME type of the avatar
+ * @param bytes the size of the avatar in bytes
+ */
+ public Info(final String id, final String type, final int bytes) {
+ mId = id;
+ mType = type;
+ mBytes = bytes;
+ }
+
+ /**
+ * Set the size of the avatar in bytes.
+ *
+ * @param bytes the size
+ */
+ public void setBytes(int bytes) {
+ this.mBytes = bytes;
+ }
+
+ /**
+ * Set the size of the avatar in bytes.
+ *
+ * @return the size
+ */
+ public int getBytes() {
+ return mBytes;
+ }
+
+ /**
+ * Set the height.
+ *
+ * @param height the height
+ */
+ public void setHeight(int height) {
+ this.mHeight = height;
+ }
+
+ /**
+ * Get the height.
+ *
+ * @return the height
+ */
+ public int getHeight() {
+ return mHeight;
+ }
+
+ /**
+ * Set the width.
+ *
+ * @param width the width
+ */
+ public void setWidth(int width) {
+ this.mWidth = width;
+ }
+
+ /**
+ * Get the width.
+ *
+ * @return the width
+ */
+ public int getWidth() {
+ return mWidth;
+ }
+
+ /**
+ * Set the url.
+ *
+ * @param url the url
+ */
+ public void setUrl(String url) {
+ this.mUrl = url;
+ }
+
+ /**
+ * Get the url.
+ *
+ * @return the url, null if no url is present
+ */
+ public String getUrl() {
+ return mUrl;
+ }
+
+ /**
+ * Get the id.
+ *
+ * @return the id
+ */
+ public String getId() {
+ return mId;
+ }
+
+ /**
+ * Set the id.
+ *
+ * @param id the id
+ */
+ public void setId(String id) {
+ this.mId = id;
+ }
+
+ /**
+ * Set the MIME type of the avatar.
+ *
+ * @param type the type
+ */
+ public void setType(String type) {
+ this.mType = type;
+ }
+
+ /**
+ * Get the MIME type of the avatar.
+ *
+ * @return the type, null if no type is present
+ */
+ public String getType() {
+ return mType;
+ }
+
+ /**
+ * Return this information as an xml element.
+ *
+ * @return an xml element representing this information
+ */
+ public String toXML() {
+ StringBuilder builder = new StringBuilder("<info ");
+ builder.append("id=\"" + mId + "\"");
+ builder.append(" type=\"" + mType + "\"");
+ builder.append(" bytes=\"" + mBytes + "\"");
+
+ if (mHeight > 0)
+ builder.append(" height=\"" + mHeight + "\"");
+ if (mWidth > 0)
+ builder.append(" width=\"" + mWidth + "\"");
+ if (mUrl != null)
+ builder.append(" url=\"" + mUrl + "\"");
+ builder.append(" />");
+ return builder.toString();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarMetadataProvider.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,110 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import org.jivesoftware.smack.packet.PacketExtension;
+import org.jivesoftware.smack.provider.PacketExtensionProvider;
+import org.xmlpull.v1.XmlPullParser;
+
+/**
+ * A PacketExtensionProvider to parse the Avatar metadata.
+ * XML namespace urn:xmpp:avatar:metadata
+ */
+public class AvatarMetadataProvider implements PacketExtensionProvider {
+
+ /**
+ * Creates a new AvatarMetadataProvider.
+ * ProviderManager requires that every PacketExtensionProvider has a public, no-argument constructor
+ */
+ public AvatarMetadataProvider() {
+ }
+
+ @Override
+ public PacketExtension parseExtension(XmlPullParser parser)
+ throws Exception {
+ AvatarMetadataExtension metadata = new AvatarMetadataExtension();
+ boolean done = false;
+ while (!done) {
+ int eventType = parser.next();
+ if (eventType == XmlPullParser.START_TAG) {
+ if ("info".equals(parser.getName())) {
+ String id = parser.getAttributeValue(null, "id");
+ String type = parser.getAttributeValue(null, "type");
+ String sbytes = parser.getAttributeValue(null, "bytes");
+ String sheight = parser.getAttributeValue(null, "height");
+ String swidth = parser.getAttributeValue(null, "width");
+ int bytes = 0;
+ AvatarMetadataExtension.Info info = null;
+ try {
+ if (sbytes != null)
+ bytes = Integer.parseInt(sbytes);
+ } catch (NumberFormatException e) { }
+ if (bytes != 0 && id != null && type != null)
+ info = new AvatarMetadataExtension.Info(id, type, bytes);
+ else // invalid info
+ continue;
+
+ String url = parser.getAttributeValue(null, "url");
+ info.setUrl(url);
+ try {
+ int height = 0;
+ int width = 0;
+ if (sheight != null)
+ height = Integer.parseInt(parser.getAttributeValue(null, "height"));
+ if (swidth != null)
+ width = Integer.parseInt(parser.getAttributeValue(null, "width"));
+ info.setHeight(height);
+ info.setWidth(width);
+ } catch (NumberFormatException e) { }
+ metadata.addInfo(info);
+ }
+ } else if (eventType == XmlPullParser.END_TAG) {
+ if (parser.getName().equals(metadata.getElementName())) {
+ done = true;
+ }
+ }
+ }
+ return metadata;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarProvider.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,80 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import org.jivesoftware.smack.packet.PacketExtension;
+import org.jivesoftware.smack.provider.PacketExtensionProvider;
+import org.xmlpull.v1.XmlPullParser;
+
+/**
+ * A PacketExtensionProvider to parse the Avatar data.
+ * XML namespace urn:xmpp:avatar:data
+ */
+public class AvatarProvider implements PacketExtensionProvider {
+
+ /**
+ * Creates a new AvatarProvider.
+ * ProviderManager requires that every PacketExtensionProvider has a public, no-argument constructor
+ */
+ public AvatarProvider() {
+ }
+
+ @Override
+ public PacketExtension parseExtension(XmlPullParser parser)
+ throws Exception {
+ boolean done = false;
+ while (!done) {
+ int eventType = parser.getEventType();
+ if (eventType == XmlPullParser.START_TAG) {
+ if ("data".equals(parser.getName())) {
+ String data = parser.nextText();
+ AvatarExtension avatar = new AvatarExtension(data);
+ return avatar;
+ }
+ }
+ parser.next();
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarRetriever.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,60 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.io.IOException;
+
+/**
+ * Interface for an AvatarRetriever.
+ */
+public interface AvatarRetriever {
+
+ /**
+ * Retrieve the avatar.
+ *
+ * @return the avatar
+ * @throws IOException if an IO error occurs while retrieving the avatar
+ */
+ byte[] getAvatar() throws IOException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,80 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
+import org.jivesoftware.smack.Connection;
+// API level 8
+//import android.net.http.AndroidHttpClient;
+//import org.apache.http.client.HttpClient;
+
+/**
+ * A factory for AvatarRetriever.
+ */
+public final class AvatarRetrieverFactory {
+
+ /**
+ * Private constructor.
+ */
+ private AvatarRetrieverFactory() {
+ }
+
+ /**
+ * Get a AvatarRetriever to retrieve this avatar.
+ *
+ * @param con the connection
+ * @param from the user which own the avatar
+ * @param info the metadata information of the avatar to retrieve
+ * @return an AvatarRetriever null if none can retrieve this avatar
+ */
+ public static AvatarRetriever getRetriever(Connection con, String from, Info info) {
+ String url = info.getUrl();
+ if (url != null) {
+ // return new HttpAvatarRetriever(url);
+ // HttpClient client = AndroidHttpClient.newInstance("Beem");
+ return new HttpClientAvatarRetriever(url);
+ }
+ return new XmppAvatarRetriever(con, from, info.getId());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/FileAvatarCache.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,121 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * An implementation of an AvatarCache which store the data of the filesystem.
+ */
+public class FileAvatarCache implements AvatarCache {
+
+ private File mStoreDir;
+
+ /**
+ * Create a FileAvatarCache.
+ *
+ * @param storedir The directory used to store the data.
+ */
+ public FileAvatarCache(final File storedir) {
+ if (storedir.exists() && !storedir.isDirectory())
+ throw new IllegalArgumentException("The store directory must be a directory");
+ mStoreDir = storedir;
+ mStoreDir.mkdirs();
+ }
+
+ @Override
+ public void put(String key, byte[] data) throws IOException {
+ File f = new File(mStoreDir, key);
+ OutputStream os = new BufferedOutputStream(new FileOutputStream(f));
+ try {
+ os.write(data);
+ } finally {
+ os.close();
+ }
+ }
+
+ @Override
+ public void put(String key, InputStream in) throws IOException {
+ File f = new File(mStoreDir, key);
+ OutputStream os = new BufferedOutputStream(new FileOutputStream(f));
+ try {
+ byte[] data = new byte[1024];
+ int nbread;
+ while ((nbread = in.read(data)) != -1)
+ os.write(data, 0, nbread);
+ } finally {
+ in.close();
+ os.close();
+ }
+ }
+
+ @Override
+ public byte[] get(String key) throws IOException {
+ File f = new File(mStoreDir, key);
+ InputStream is = new BufferedInputStream(new FileInputStream(f));
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ byte[] data = new byte[1024];
+ is.read(data);
+ bos.write(data);
+ } finally {
+ is.close();
+ }
+ return bos.toByteArray();
+ }
+
+ @Override
+ public boolean contains(String key) {
+ File f = new File(mStoreDir, key);
+ return f.exists();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/HttpAvatarRetriever.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,96 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * An AvatarRetriever which retrieve the avatar over HTTP.
+ */
+public class HttpAvatarRetriever implements AvatarRetriever {
+
+ private URL mUrl;
+ private String mUrlString;
+
+ /**
+ * Create a HttpAvatarRetriever.
+ *
+ * @param url the url of the avatar to download.
+ */
+ public HttpAvatarRetriever(final URL url) {
+ mUrl = url;
+ }
+
+ /**
+ * Create a HttpAvatarRetriever.
+ *
+ * @param url the url of the avatar to download.
+ */
+ public HttpAvatarRetriever(final String url) {
+ mUrlString = url;
+ }
+
+ @Override
+ public byte[] getAvatar() throws IOException {
+ if (mUrl == null)
+ mUrl = new URL(mUrlString);
+ InputStream in = mUrl.openStream();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ try {
+ byte[] data = new byte[1024];
+ int nbread;
+ while ((nbread = in.read(data)) != -1) {
+ os.write(data, 0, nbread);
+ }
+ } finally {
+ in.close();
+ os.close();
+ }
+ return os.toByteArray();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/HttpClientAvatarRetriever.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,112 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpEntity;
+
+/**
+ * An AvatarRetriever which retrieve the avatar over HTTP using the Apache HttpClient.
+ */
+public class HttpClientAvatarRetriever implements AvatarRetriever {
+
+ private String mUrl;
+ private HttpClient mClient;
+
+ /**
+ * Create a HttpAvatarRetriever.
+ *
+ * @param client the custom HttpClient to use to downlowad
+ * @param url the url of the avatar to download.
+ */
+ public HttpClientAvatarRetriever(final HttpClient client, final String url) {
+ mUrl = url;
+ mClient = client;
+ }
+
+ /**
+ * Create a HttpAvatarRetriever.
+ *
+ * @param url the url of the avatar to download.
+ */
+ public HttpClientAvatarRetriever(final String url) {
+ mUrl = url;
+ mClient = new DefaultHttpClient();
+ }
+
+ @Override
+ public byte[] getAvatar() throws IOException {
+ HttpUriRequest request;
+ try {
+ request = new HttpGet(mUrl);
+ } catch (IllegalArgumentException e) {
+ IOException ioe = new IOException("Invalid url " + mUrl);
+ ioe.initCause(e);
+ throw ioe;
+ }
+ HttpResponse response = mClient.execute(request);
+ HttpEntity entity = response.getEntity();
+ InputStream in = entity.getContent();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ try {
+ byte[] data = new byte[1024];
+ int nbread;
+ while ((nbread = in.read(data)) != -1) {
+ os.write(data, 0, nbread);
+ }
+ } finally {
+ in.close();
+ os.close();
+ }
+ return os.toByteArray();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/MemoryAvatarCache.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,85 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.jivesoftware.smack.util.Cache;
+
+/**
+ * An avatar cache which store the avatars in memory.
+ */
+public class MemoryAvatarCache implements AvatarCache {
+ private static final int BUFFER_SIZE = 1024;
+ private Cache<String, byte[]> mCache;
+
+ /**
+ * Create a MemoryAvatarCache.
+ *
+ * @param maxSize the maximum number of objects the cache will hold. -1 means the cache has no max size.
+ * @param maxlifetime the maximum amount of time (in ms) objects can exist in cache before being deleted.
+ * -1 means objects never expire.
+ */
+ public MemoryAvatarCache(final int maxSize, final long maxlifetime) {
+ mCache = new Cache<String, byte[]>(maxSize, maxlifetime);
+ }
+
+ @Override
+ public void put(String key, byte[] data) throws IOException {
+ mCache.put(key, data);
+ }
+
+ @Override
+ public void put(String key, InputStream in) throws IOException {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ try {
+ byte[] data = new byte[BUFFER_SIZE];
+ int nbread;
+ while ((nbread = in.read(data)) != -1)
+ os.write(data, 0, nbread);
+ } finally {
+ in.close();
+ os.close();
+ }
+ mCache.put(key, os.toByteArray());
+ }
+
+ @Override
+ public byte[] get(String key) throws IOException {
+ return mCache.get(key);
+ }
+
+ @Override
+ public boolean contains(String key) {
+ return mCache.containsKey(key);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/XmppAvatarRetriever.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,92 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.avatar;
+
+import java.util.List;
+import java.util.Arrays;
+import org.jivesoftware.smack.Connection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smackx.pubsub.LeafNode;
+import org.jivesoftware.smackx.pubsub.Item;
+import org.jivesoftware.smackx.pubsub.PayloadItem;
+
+import com.beem.project.beem.smack.pep.PepSubManager;
+
+/**
+ * An AvatarRetriever which retrieve the avatar over the XMPP connection.
+ */
+public class XmppAvatarRetriever implements AvatarRetriever {
+
+ private static String AVATARDATANODE = "urn:xmpp:avatar:data";
+ private PepSubManager mPubsub;
+ private String mFrom;
+ private String mId;
+
+ /**
+ * Create an XmppAvatarRetriever.
+ *
+ * @param con the xmpp connection
+ * @param from the contact from which we retrieve the avatar
+ * @param id the id of the avatar to retrieve
+ */
+ public XmppAvatarRetriever(final Connection con, final String from, final String id) {
+ mPubsub = new PepSubManager(con, from);
+ mFrom = from;
+ mId = id;
+ }
+
+ @Override
+ public byte[] getAvatar() {
+ try {
+ LeafNode node = mPubsub.getPEPNode(AVATARDATANODE);
+ List<Item> items = node.getItems(Arrays.asList(mId));
+ PayloadItem<AvatarExtension> item = (PayloadItem<AvatarExtension>) items.get(0);
+ AvatarExtension avatar = item.getPayload();
+ return avatar.getData();
+ } catch (XMPPException e) {
+ return null;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/avatar/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,48 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+
+/**
+ * This package contains implementation of XEP-0084 User Avatar.
+ */
+package com.beem.project.beem.smack.avatar;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/pep/PEPListener.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,63 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.pep;
+
+import org.jivesoftware.smackx.pubsub.Item;
+import java.util.List;
+
+/**
+ * A listener that is fired anytime a PEP event message is received.
+ */
+public interface PEPListener {
+
+ /**
+ * Called when PEP events are received.
+ *
+ * @param from the JID of the user who send the event
+ * @param node the node of the items in the event
+ * @param items the different items of the event
+ */
+ void eventReceived(String from, String node, List<Item> items);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/pep/PepSubManager.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,158 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.smack.pep;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jivesoftware.smack.Connection;
+import org.jivesoftware.smack.filter.PacketExtensionFilter;
+import org.jivesoftware.smack.filter.PacketFilter;
+import org.jivesoftware.smack.PacketListener;
+import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smackx.pubsub.EventElement;
+import org.jivesoftware.smackx.pubsub.EventElementType;
+import org.jivesoftware.smackx.pubsub.Item;
+import org.jivesoftware.smackx.pubsub.ItemsExtension;
+import org.jivesoftware.smackx.pubsub.PubSubManager;
+import org.jivesoftware.smackx.pubsub.LeafNode;
+
+/**
+ * Little extension of {@link PubSubManager} which allows to add {@link PEPListener}.
+ *
+ */
+public class PepSubManager extends PubSubManager {
+ private List<PEPListener> mPepListeners = new ArrayList<PEPListener>();
+ private PacketFilter mPacketFilter = new PacketExtensionFilter("event", "http://jabber.org/protocol/pubsub#event");
+
+ /**
+ * Create a PepSubManager.
+ *
+ * @param connection the connection
+ */
+ public PepSubManager(final Connection connection) {
+ super(connection);
+ init(connection);
+ }
+
+ /**
+ * Create a PepSubManager associated to the specified connection where the pubsub
+ * requests require a specific to address for packets.
+ *
+ * @param connection the connection
+ * @param toAddress The pubsub specific to address (required for some servers)
+ */
+ public PepSubManager(final Connection connection, final String toAddress) {
+ super(connection, toAddress);
+ init(connection);
+ }
+
+ /**
+ * Add a listener to PEP event.
+ *
+ * @param listener the listener
+ */
+ public void addPEPListener(PEPListener listener) {
+ if (!mPepListeners.contains(listener))
+ mPepListeners.add(listener);
+ }
+
+ /**
+ * Remove a listener to PEP event.
+ *
+ * @param listener the listener
+ */
+ public void removePEPListener(PEPListener listener) {
+ mPepListeners.remove(listener);
+ }
+
+ /**
+ * Get a PepNode.
+ * This node is obtain without checking its existence as PEP should auto create it.
+ *
+ * @param nodeName the node name
+ * @return the node
+ */
+ public LeafNode getPEPNode(String nodeName) {
+ LeafNode node = new LeafNode(con, nodeName);
+ node.setTo(to);
+ return node;
+ }
+
+ /**
+ * Initialize the PepSubManager.
+ *
+ * @param con the connection
+ */
+ private void init(Connection con) {
+ PacketListener packetListener = new PacketListener() {
+
+ @Override
+ public void processPacket(Packet packet) {
+ EventElement e = (EventElement) packet.getExtension("event", "http://jabber.org/protocol/pubsub#event");
+ if (e.getEventType() != EventElementType.items)
+ return;
+ ItemsExtension it = (ItemsExtension) e.getEvent();
+ if (it.getItemsElementType() != ItemsExtension.ItemsElementType.items)
+ return;
+ List<Item> items = (List<Item>) it.getItems();
+ firePEPListeners(packet.getFrom(), it.getNode(), items);
+ }
+ };
+ con.addPacketListener(packetListener, mPacketFilter);
+ }
+
+ /**
+ * Fire the PEP listeners.
+ *
+ * @param from the JID of the user who send the event
+ * @param node the node of the items in the event
+ * @param items the different items of the event
+ */
+ private void firePEPListeners(String from, String node, List<Item> items) {
+ for (PEPListener listener : mPepListeners) {
+ listener.eventReceived(from, node, items);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/pep/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,49 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+
+/**
+ * This package contains an implementation of XEP-0163 Personnal Eventing Protocol based on the pubsub implementation.
+ */
+package com.beem.project.beem.smack.pep;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/ping/PingExtension.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,61 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+*/
+
+package com.beem.project.beem.smack.ping;
+
+import org.jivesoftware.smack.packet.IQ;
+
+/**
+ * This extension represents a iq ping.
+ *
+ */
+public class PingExtension extends IQ {
+
+ /** Namespace of the Ping XEP. */
+ public static final String NAMESPACE = "urn:xmpp:ping";
+
+ /** Xml element name for the ping. */
+ public static final String ELEMENT = "ping";
+
+
+ /**
+ * Create a ping iq packet.
+ */
+ public PingExtension() {
+ }
+
+ @Override
+ public String getChildElementXML() {
+ if (getType() == IQ.Type.RESULT)
+ return null;
+ return "<" + ELEMENT + " xmlns=\"" + NAMESPACE + "\" />";
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/ping/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,34 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+*/
+
+/**
+ * This package contains implementation of XEP-0199 XMPP Ping.
+ */
+package com.beem.project.beem.smack.ping;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/sasl/SASLGoogleOAuth2Mechanism.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,141 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.smack.sasl;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import de.measite.smack.Sasl;
+
+import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
+import org.apache.harmony.javax.security.sasl.SaslException;
+import org.jivesoftware.smack.SASLAuthentication;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.Packet;
+import org.jivesoftware.smack.sasl.SASLMechanism;
+import org.jivesoftware.smack.util.Base64;
+
+/**
+ * An implementation of the SASL OAuth2 mechanism made by Google.
+ * The extension is described here :
+ * https://developers.google.com/talk/jep_extensions/oauth
+ */
+public class SASLGoogleOAuth2Mechanism extends SASLMechanism {
+
+ /**
+ * The name of the Google Oauth mechanism.
+ */
+ public static final String MECHANISM_NAME = "X-OAUTH2";
+
+ /**
+ * Create a SASLGoogleOAuth2Mechanism.
+ *
+ * @param saslAuthentication the smack SASLAuthentication.
+ *
+ */
+ public SASLGoogleOAuth2Mechanism(final SASLAuthentication saslAuthentication) {
+ super(saslAuthentication);
+ }
+
+ @Override
+ public void authenticate(String username, String host, String password) throws IOException, XMPPException {
+ //Since we were not provided with a CallbackHandler, we will use our own with the given
+ //information
+
+ //Set the authenticationID as the username, since they must be the same in this case.
+ this.authenticationId = username;
+ this.password = password;
+ this.hostname = host;
+
+ String[] mechanisms = {"PLAIN" };
+ Map<String, String> props = new HashMap<String, String>();
+ sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
+ authenticate();
+ }
+
+ @Override
+ public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
+ String[] mechanisms = {"PLAIN" };
+ Map<String, String> props = new HashMap<String, String>();
+ sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
+ authenticate();
+ }
+
+ @Override
+ protected void authenticate() throws IOException, XMPPException {
+ String authenticationText = null;
+ try {
+ if (sc.hasInitialResponse()) {
+ byte[] response = sc.evaluateChallenge(new byte[0]);
+ authenticationText = Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
+ }
+ } catch (SaslException e) {
+ throw new XMPPException("SASL authentication failed", e);
+ }
+
+ // Send the authentication to the server
+ getSASLAuthentication().send(new GoogleOAuthMechanism(authenticationText));
+ }
+
+ @Override
+ protected String getName() {
+ return MECHANISM_NAME;
+ }
+
+ /**
+ * Initiating SASL authentication by select a mechanism.
+ */
+ public static class GoogleOAuthMechanism extends Packet {
+ private final String authenticationText;
+
+ /**
+ * Create a GoogleOAuthMechanism.
+ *
+ * @param authenticationText the authentification token
+ *
+ */
+ public GoogleOAuthMechanism(final String authenticationText) {
+ this.authenticationText = authenticationText;
+ }
+
+ @Override
+ public String toXML() {
+ StringBuilder stanza = new StringBuilder();
+ stanza.append("<auth mechanism=\"").append(MECHANISM_NAME);
+ stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" "
+ + "auth:service=\"oauth2\" "
+ + "xmlns:auth=\"http://www.google.com/talk/protocol/auth\">");
+ if (authenticationText != null
+ && authenticationText.trim().length() > 0) {
+ stanza.append(authenticationText);
+ }
+ stanza.append("</auth>");
+ return stanza.toString();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/sasl/ScramSaslClient.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,302 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.smack.sasl;
+
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+import com.isode.stroke.base.ByteArray;
+import com.isode.stroke.sasl.SCRAMSHA1ClientAuthenticator;
+
+import org.apache.harmony.javax.security.auth.callback.Callback;
+import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
+import org.apache.harmony.javax.security.auth.callback.NameCallback;
+import org.apache.harmony.javax.security.auth.callback.PasswordCallback;
+import org.apache.harmony.javax.security.auth.callback.UnsupportedCallbackException;
+import org.apache.harmony.javax.security.sasl.SaslClient;
+import org.apache.harmony.javax.security.sasl.SaslException;
+
+/**
+ * A SaslClient which uses the SCRAM-SHA-! mechanism.
+ * This implementation is based on Stroke (http://swift.im/git/stroke)
+ */
+public class ScramSaslClient implements SaslClient {
+
+ private static final int NONCE_BYTE_COUNT = 32;
+ private static final int NONCE_HEX_COUNT = 2 * NONCE_BYTE_COUNT;
+ private static final char[] hexChars = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ private SCRAMSHA1ClientAuthenticator clientAuthenticator;
+ private CallbackHandler cbh;
+ private String authzid;
+
+ /**
+ * Create a ScramSaslClient.
+ * @param authorizationId the authorizationId uses by the client
+ * @param cbh a CallbackHandler to get more informations
+ */
+ public ScramSaslClient(final String authorizationId, final CallbackHandler cbh) {
+ this.cbh = cbh;
+ this.authzid = authorizationId;
+ }
+
+ /**
+ * Disposes of any system resources or security-sensitive information the
+ * SaslClient might be using. Invoking this method invalidates the
+ * SaslClient instance. This method is idempotent.
+ *
+ * @exception SaslException if a problem was encountered while disposing
+ * of the resources
+ */
+ @Override
+ public void dispose() throws SaslException {
+ }
+
+ /**
+ * Evaluates the challenge data and generates a response. If a challenge
+ * is received from the server during the authentication process, this
+ * method is called to prepare an appropriate next response to submit to
+ * the server.
+ *
+ * @param challenge The non-null challenge sent from the server. The
+ * challenge array may have zero length.
+ *
+ * @return The possibly null reponse to send to the server. It is null
+ * if the challenge accompanied a "SUCCESS" status and the
+ * challenge only contains data for the client to update its
+ * state and no response needs to be sent to the server.
+ * The response is a zero-length byte array if the client is to
+ * send a response with no data.
+ *
+ * @exception SaslException If an error occurred while processing the
+ * challenge or generating a response.
+ */
+ @Override
+ public byte[] evaluateChallenge(byte[] challenge) throws SaslException {
+ if (clientAuthenticator == null) {
+ Object[] userInfo = getUserInfo();
+ String authcid = (String) userInfo[0];
+ byte[] passwdBytes = (byte[]) userInfo[1];
+ String passwd = new String(passwdBytes);
+ String nonce = getClientNonce();
+ clientAuthenticator = new SCRAMSHA1ClientAuthenticator(nonce);
+ // some servers (ejabberd) reject the challenge if the
+ // scram attributes a (authzid) and n (authcid) are equals
+ // or they just don't handle the authzid
+ // So we just don't send it if they are the same
+ if (authcid != null && authcid.equals(authzid))
+ authzid = "";
+ clientAuthenticator.setCredentials(authcid, passwd, authzid);
+ return clientAuthenticator.getResponse().getData();
+ }
+ clientAuthenticator.setChallenge(new ByteArray(challenge));
+ return clientAuthenticator.getResponse().getData();
+ }
+
+ /**
+ * Returns the IANA-registered mechanism name of this SASL client.
+ * (e.g. "CRAM-MD5", "GSSAPI")
+ *
+ * @return "SCRAM-SHA-!" the IANA-registered mechanism name of this SASL
+ * client.
+ */
+ @Override
+ public String getMechanismName() {
+ return "SCRAM-SHA-1";
+ }
+
+ /**
+ * Retrieves the negotiated property. This method can be called only after
+ * the authentication exchange has completed (i.e., when isComplete()
+ * returns true); otherwise, an IllegalStateException is thrown.
+ *
+ *
+ * @param propName The non-null property name
+ *
+ * @return The value of the negotiated property. If null, the property was
+ * not negotiated or is not applicable to this mechanism. This
+ * implementation allways returns null.
+ *
+ * @exception IllegalStateException if this authentication exchange has
+ * not completed
+ */
+ @Override
+ public Object getNegotiatedProperty(String propName) {
+ return null;
+ }
+
+ /**
+ * Determines if this mechanism has an optional initial response. If true,
+ * caller should call evaluateChallenge() with an empty array to get the
+ * initial response.
+ *
+ * @return true if this mechanism has an initial response. This
+ * implementation always return true.
+ */
+ @Override
+ public boolean hasInitialResponse() {
+ return true;
+ }
+
+ /**
+ * Determines if the authentication exchange has completed. This method
+ * may be called at any time, but typically, it will not be called until
+ * the caller has received indication from the server (in a protocol-
+ * specific manner) that the exchange has completed.
+ *
+ * @return true if the authentication exchange has completed;
+ * false otherwise.
+ */
+ @Override
+ public boolean isComplete() {
+ if (clientAuthenticator == null)
+ return false;
+ return clientAuthenticator.getResponse() == null;
+ }
+
+ /**
+ * Unwraps a byte array received from the server. This method can be called
+ * only after the authentication exchange has completed (i.e., when
+ * isComplete() returns true) and only if the authentication exchange has
+ * negotiated integrity and/or privacy as the quality of protection;
+ * otherwise, an IllegalStateException is thrown.
+ *
+ * This implementation always throw an IllegalStateException.
+ *
+ * incoming is the contents of the SASL buffer as defined in RFC 2222
+ * without the leading four octet field that represents the length.
+ * offset and len specify the portion of incoming to use.
+ *
+ * @param incoming A non-null byte array containing the encoded bytes
+ * from the server
+ * @param offset The starting position at incoming of the bytes to use
+ *
+ * @param len The number of bytes from incoming to use
+ *
+ * @return A non-null byte array containing the decoded bytes
+ * @throws SaslException if an error occurs
+ *
+ */
+ @Override
+ public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
+ throw new IllegalStateException("SCRAM-SHA-1: this mechanism supports "
+ + "neither integrity nor privacy");
+ }
+
+ /**
+ * Wraps a byte array to be sent to the server. This method can be called
+ * only after the authentication exchange has completed (i.e., when
+ * isComplete() returns true) and only if the authentication exchange has
+ * negotiated integrity and/or privacy as the quality of protection;
+ * otherwise, an IllegalStateException is thrown.
+ *
+ * This implementation always throw an IllegalStateException.
+ *
+ * The result of this method will make up the contents of the SASL buffer as
+ * defined in RFC 2222 without the leading four octet field that represents
+ * the length. offset and len specify the portion of outgoing to use.
+ *
+ * @param outgoing A non-null byte array containing the bytes to encode
+ * @param offset The starting position at outgoing of the bytes to use
+ * @param len The number of bytes from outgoing to use
+ *
+ * @return A non-null byte array containing the encoded bytes
+ *
+ * @exception SaslException if incoming cannot be successfully unwrapped.
+ *
+ * @exception IllegalStateException if the authentication exchange has
+ * not completed, or if the negotiated quality of
+ * protection has neither integrity nor privacy.
+ */
+ @Override
+ public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
+ throw new IllegalStateException("SCRAM-SHA-1: this mechanism supports "
+ + "neither integrity nor privacy");
+ }
+
+
+ /**
+ * Calculates the Nonce value of the Client.
+ *
+ * @return Nonce value of the client
+ *
+ * @exception SaslException If an error Occurs
+ */
+ private String getClientNonce() throws SaslException {
+ byte[] nonceBytes = new byte[NONCE_BYTE_COUNT];
+ SecureRandom prng;
+ char[] hexNonce = new char[NONCE_HEX_COUNT];
+
+ try {
+ prng = SecureRandom.getInstance("SHA1PRNG");
+ prng.nextBytes(nonceBytes);
+ for (int i = 0; i < NONCE_BYTE_COUNT; i++) {
+ final int val = nonceBytes[i] & 0xff;
+ //low nibble
+ hexNonce[i * 2] = hexChars[val / 0x10];
+ //high nibble
+ hexNonce[(i * 2) + 1] = hexChars[val % 0x10];
+ }
+ return new String(hexNonce);
+ } catch (NoSuchAlgorithmException e) {
+ throw new SaslException("No random number generator available", e);
+ }
+ }
+
+ /**
+ * Get informations supplied by the user of the SaslClient.
+ * These informations are retrived by using the CallbackHandler.
+ *
+ * @return an array of object
+ * @throws SaslException if the informations cannot be retrieved
+ */
+ private Object[] getUserInfo() throws SaslException {
+ try {
+ final String userPrompt = "Authentication id: ";
+ final String pwPrompt = "Password: ";
+ NameCallback nameCb = new NameCallback(userPrompt);
+ PasswordCallback passwordCb = new PasswordCallback(pwPrompt, false);
+ cbh.handle(new Callback[] {nameCb, passwordCb });
+ String userid = nameCb.getName();
+ char[] pwchars = passwordCb.getPassword();
+ byte[] pwbytes;
+ if (pwchars != null) {
+ pwbytes = (new String(pwchars)).getBytes("UTF8");
+ passwordCb.clearPassword();
+ } else {
+ pwbytes = null;
+ }
+ return new Object[] {userid, pwbytes };
+ } catch (IOException e) {
+ throw new SaslException("Cannot get password", e);
+ } catch (UnsupportedCallbackException e) {
+ throw new SaslException("Cannot get userid/password", e);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/sasl/ScramSaslMechanism.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,81 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.smack.sasl;
+
+import java.io.IOException;
+
+
+import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
+import org.jivesoftware.smack.SASLAuthentication;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.sasl.SASLMechanism;
+
+/**
+ * An implementation of the SCRAM-SHA-1 SASL mechanism.
+ * This implementation is based on Stroke http://swift.im/git/stroke.
+ */
+public class ScramSaslMechanism extends SASLMechanism {
+
+ /**
+ * The name of the SASL mechanism.
+ */
+ public static final String MECHANISM_NAME = "SCRAM-SHA-1";
+
+ /**
+ * Create a ScramSaslMechanism.
+ *
+ * @param saslAuthentication the smack SASLAuthentication.
+ *
+ */
+ public ScramSaslMechanism(final SASLAuthentication saslAuthentication) {
+ super(saslAuthentication);
+ }
+
+ @Override
+ public void authenticate(String username, String host, String password) throws IOException, XMPPException {
+ this.authenticationId = username;
+ this.password = password;
+ this.hostname = host;
+
+ sc = new ScramSaslClient(username, this);
+ authenticate();
+ }
+
+ @Override
+ public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
+ this.authenticationId = username;
+ this.hostname = host;
+ sc = new ScramSaslClient(username, cbh);
+ authenticate();
+ }
+
+ @Override
+ protected String getName() {
+ return MECHANISM_NAME;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/smack/sasl/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,31 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+
+/**
+ * This package contains implementations of different SASL mechanism.
+ */
+package com.beem.project.beem.smack.sasl;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/AddContact.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,223 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+
+/**
+ * This activity is used to add a contact.
+ * @author nikita
+ */
+public class AddContact extends Activity {
+
+ private static final Intent SERVICE_INTENT = new Intent();
+ private static final String TAG = "AddContact";
+ private final List<String> mGroup = new ArrayList<String>();
+ private IXmppFacade mXmppFacade;
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+ private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
+ private final OkListener mOkListener = new OkListener();
+
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ /**
+ * Constructor.
+ */
+ public AddContact() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.addcontact);
+ Button ok = (Button) findViewById(R.id.addc_ok);
+ ok.setOnClickListener(mOkListener);
+ this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onStart()
+ */
+ @Override
+ protected void onStart() {
+ super.onStart();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ unbindService(mServConn);
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onDestroy()
+ */
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ this.unregisterReceiver(mReceiver);
+ }
+
+ /**
+ * Get the text of a widget.
+ * @param id the id of the widget.
+ * @return the text of the widget.
+ */
+ private String getWidgetText(int id) {
+ EditText widget = (EditText) this.findViewById(id);
+ return widget.getText().toString();
+ }
+
+ /**
+ * The ServiceConnection used to connect to the Beem service.
+ */
+ private class BeemServiceConnection implements ServiceConnection {
+
+ /**
+ * Constructor.
+ */
+ public BeemServiceConnection() {
+ }
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mXmppFacade = null;
+ }
+ }
+
+ /**
+ * Listener.
+ */
+ private class OkListener implements OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public OkListener() { }
+
+ @Override
+ public void onClick(View v) {
+ String login;
+ login = getWidgetText(R.id.addc_login);
+ if (TextUtils.isEmpty(login)) {
+ Toast.makeText(AddContact.this, getString(R.string.AddCContactAddedLoginError), Toast.LENGTH_SHORT)
+ .show();
+ return;
+ }
+ String alias;
+ alias = getWidgetText(R.id.addc_alias);
+ if (getWidgetText(R.id.addc_group).length() != 0)
+ mGroup.add(getWidgetText(R.id.addc_group));
+ try {
+ if (mXmppFacade != null) {
+ IRoster roster = mXmppFacade.getRoster();
+ if (roster.getContact(login) != null) {
+ mGroup.addAll(roster.getContact(login).getGroups());
+ Toast.makeText(AddContact.this, getString(R.string.AddCContactAlready), Toast.LENGTH_SHORT)
+ .show();
+ return;
+ }
+ if (!roster.addContact(login, alias, mGroup.toArray(new String[mGroup.size()]))) {
+ Toast.makeText(AddContact.this, getString(R.string.AddCContactAddedError), Toast.LENGTH_SHORT)
+ .show();
+ return;
+ } else {
+ Toast.makeText(AddContact.this, getString(R.string.AddCContactAdded), Toast.LENGTH_SHORT)
+ .show();
+ finish();
+ }
+ }
+ } catch (RemoteException e) {
+ Toast.makeText(AddContact.this, e.getMessage(), Toast.LENGTH_SHORT).show();
+ Log.e(TAG, "Problem adding contact", e);
+ }
+
+ }
+ };
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/ChangeStatus.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,602 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+
+package com.beem.project.beem.ui;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.ActivityNotFoundException;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.preference.PreferenceManager;
+import android.provider.MediaStore;
+import android.util.Log;
+import android.view.ContextThemeWrapper;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ListAdapter;
+import android.widget.Spinner;
+import android.widget.Toast;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.providers.AvatarProvider;
+import com.beem.project.beem.service.UserInfo;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+import com.beem.project.beem.utils.BeemConnectivity;
+import com.beem.project.beem.utils.Status;
+
+/**
+ * This Activity is used to change the status.
+ * @author nikita
+ */
+public class ChangeStatus extends Activity {
+
+ private static final Intent SERVICE_INTENT = new Intent();
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ private static final String TAG = ChangeStatus.class.getSimpleName();
+ private static final int AVAILABLE_FOR_CHAT_IDX = 0;
+ private static final int AVAILABLE_IDX = 1;
+ private static final int BUSY_IDX = 2;
+ private static final int AWAY_IDX = 3;
+ private static final int UNAVAILABLE_IDX = 4;
+ private static final int DISCONNECTED_IDX = 5;
+
+ private static final int ICON_SIZE = 80;
+
+ private static final int SELECT_PHOTO_DLG = 0;
+
+ private static final int CAMERA_WITH_DATA = 0;
+ private static final int PHOTO_PICKED_WITH_DATA = 1;
+
+ private static final File PHOTO_DIR = new File(
+ Environment.getExternalStorageDirectory() + "/DCIM/Camera");
+
+ private static final String KEY_CURRENT_PHOTO_FILE = "currentphotofile";
+
+ private static final Uri MY_AVATAR_URI = Uri.parse(AvatarProvider.CONTENT_URI + "/my_avatar");
+
+ private EditText mStatusMessageEditText;
+ private Toast mToast;
+ private Button mOk;
+ private Button mClear;
+ private Button mContact;
+ private Spinner mSpinner;
+ private ImageButton mAvatar;
+ private Uri mAvatarUri;
+
+ private SharedPreferences mSettings;
+ private ArrayAdapter<CharSequence> mAdapter;
+ private IXmppFacade mXmppFacade;
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+ private final OnClickListener mOnClickOk = new MyOnClickListener();
+ private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
+ private boolean mShowCurrentAvatar = true;
+ private boolean mDisableAvatar;
+ private File mCurrentPhotoFile;
+
+ /**
+ * Constructor.
+ */
+ public ChangeStatus() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Log.d(TAG, "oncreate");
+ setContentView(R.layout.changestatus);
+
+ mOk = (Button) findViewById(R.id.ChangeStatusOk);
+ mOk.setOnClickListener(mOnClickOk);
+
+ mClear = (Button) findViewById(R.id.ChangeStatusClear);
+ mClear.setOnClickListener(mOnClickOk);
+
+ mContact = (Button) findViewById(R.id.OpenContactList);
+ mContact.setOnClickListener(mOnClickOk);
+
+ BeemApplication app = (BeemApplication) getApplication();
+ mAvatar = (ImageButton) findViewById(R.id.avatarButton);
+ mAvatar.setOnClickListener(mOnClickOk);
+ if (!app.isPepEnabled()) {
+ View avatarPanel = findViewById(R.id.avatar_panel);
+ avatarPanel.setVisibility(View.GONE);
+ }
+
+
+ mSettings = PreferenceManager.getDefaultSharedPreferences(this);
+ mStatusMessageEditText = (EditText) findViewById(R.id.ChangeStatusMessage);
+ mStatusMessageEditText.setText(mSettings.getString(BeemApplication.STATUS_TEXT_KEY, ""));
+
+ mSpinner = (Spinner) findViewById(R.id.ChangeStatusSpinner);
+ mAdapter = ArrayAdapter.createFromResource(this, R.array.status_types, android.R.layout.simple_spinner_item);
+ mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ mSpinner.setAdapter(mAdapter);
+
+ mToast = Toast.makeText(this, R.string.ChangeStatusOk, Toast.LENGTH_LONG);
+ mSpinner.setSelection(getPreferenceStatusIndex());
+
+ this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (!BeemConnectivity.isConnected(getApplicationContext())) {
+ Intent i = new Intent(this, Login.class);
+ startActivity(i);
+ finish();
+ }
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ unbindService(mServConn);
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onDestroy()
+ */
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ this.unregisterReceiver(mReceiver);
+ }
+
+ /*
+ * The activity is often reclaimed by the system memory.
+ */
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ if (mCurrentPhotoFile != null) {
+ outState.putString(KEY_CURRENT_PHOTO_FILE, mCurrentPhotoFile.toString());
+ }
+ super.onSaveInstanceState(outState);
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ String fileName = savedInstanceState.getString(KEY_CURRENT_PHOTO_FILE);
+ if (fileName != null) {
+ mCurrentPhotoFile = new File(fileName);
+ }
+ super.onRestoreInstanceState(savedInstanceState);
+ }
+
+
+
+ @Override
+ protected Dialog onCreateDialog(int id) {
+ if (id == SELECT_PHOTO_DLG)
+ return createPickPhotoDialog();
+ return null;
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ // Ignore failed requests
+ if (resultCode != RESULT_OK) return;
+
+ switch (requestCode) {
+ case PHOTO_PICKED_WITH_DATA:
+ // We tell the activity to put the result in MY_AVATAR_URI
+ mAvatarUri = MY_AVATAR_URI;
+ Log.d(TAG, "selected avatar uri " + mAvatarUri);
+ if (mAvatarUri != null) {
+ // force reload of image even it is the same uri
+ mAvatar.setImageURI(null);
+ mAvatar.setImageURI(mAvatarUri);
+ mDisableAvatar = false;
+ mShowCurrentAvatar = false;
+ }
+ break;
+
+ case CAMERA_WITH_DATA:
+ doCropPhoto(mCurrentPhotoFile);
+ break;
+ default:
+ Log.w(TAG, "onActivityResult : invalid request code");
+
+ }
+ }
+
+ /**
+ * Return the status index from status the settings.
+ * @return the status index from status the settings.
+ */
+ private int getPreferenceStatusIndex() {
+ return mSettings.getInt(BeemApplication.STATUS_KEY, AVAILABLE_IDX);
+ }
+
+ /**
+ * Return the status text from status the settings.
+ * @param id status text id.
+ * @return the status text from status the settings.
+ */
+ private String getPreferenceString(int id) {
+ return mSettings.getString(getString(id), "");
+ }
+
+ /**
+ * convert status text to.
+ * @param item selected item text.
+ * @return item position in the array.
+ */
+ private int getStatusForService(String item) {
+ int result;
+ switch (mAdapter.getPosition(item)) {
+ case ChangeStatus.DISCONNECTED_IDX:
+ result = Status.CONTACT_STATUS_DISCONNECT;
+ break;
+ case ChangeStatus.AVAILABLE_FOR_CHAT_IDX:
+ result = Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
+ break;
+ case ChangeStatus.AVAILABLE_IDX:
+ result = Status.CONTACT_STATUS_AVAILABLE;
+ break;
+ case ChangeStatus.AWAY_IDX:
+ result = Status.CONTACT_STATUS_AWAY;
+ break;
+ case ChangeStatus.BUSY_IDX:
+ result = Status.CONTACT_STATUS_BUSY;
+ break;
+ case ChangeStatus.UNAVAILABLE_IDX:
+ result = Status.CONTACT_STATUS_UNAVAILABLE;
+ break;
+ default:
+ result = Status.CONTACT_STATUS_AVAILABLE;
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * ClickListener for the avatarButton.
+ *
+ * @param button the avatar button
+ */
+ private void onAvatarButton(View button) {
+ showDialog(SELECT_PHOTO_DLG);
+ }
+
+ /**
+ * Publish the selected avatar.
+ */
+ private void publishAvatar() {
+ try {
+ if (mDisableAvatar)
+ mXmppFacade.disableAvatarPublishing();
+ else if (mAvatarUri != null)
+ mXmppFacade.publishAvatar(mAvatarUri);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error while publishing avatar", e);
+ }
+ }
+
+ /**
+ * Display the current avatar in the button.
+ */
+ private void displayCurrentAvatar() {
+ try {
+ UserInfo ui = mXmppFacade.getUserInfo();
+ if (ui == null)
+ return;
+ String avatarId = ui.getAvatarId();
+ Log.d(TAG, "User info : avatar id " + avatarId);
+ if (avatarId != null) {
+ Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(avatarId).build();
+ mAvatar.setImageURI(uri);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error while displaying current avatar", e);
+ }
+ mShowCurrentAvatar = false;
+ }
+
+ /*
+ * Some codes from AOSP (platform/packages/apps/Contacts)
+ * to select and crop an image.
+ */
+
+ /**
+ * Creates a dialog offering two options: take a photo or pick a photo from the gallery.
+ * @return the dialog
+ */
+ private Dialog createPickPhotoDialog() {
+ // Wrap our context to inflate list items using correct theme
+ final Context dialogContext = new ContextThemeWrapper(this,
+ android.R.style.Theme_Light);
+
+ final ListAdapter adapter = ArrayAdapter.createFromResource(dialogContext,
+ R.array.pick_photo_items,
+ android.R.layout.simple_list_item_1);
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(dialogContext);
+ builder.setTitle(R.string.select_avatar);
+ builder.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ switch(which) {
+ case 0:
+ doTakePhoto();
+ break;
+ case 1:
+ doPickPhotoFromGallery();
+ break;
+ case 2:
+ mDisableAvatar = true;
+ mAvatar.setImageURI(null);
+ break;
+ default:
+ Log.w(TAG, "DialogInterface onClick : invalid which code");
+ }
+ }
+ });
+ return builder.create();
+ }
+
+ /**
+ * Create a file name for the icon photo using current time.
+ * @return the filename
+ */
+ private String getPhotoFileName() {
+ Date date = new Date(System.currentTimeMillis());
+ SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyyMMdd_HHmmss");
+ return dateFormat.format(date) + ".jpg";
+ }
+
+ /**
+ * Launches Camera to take a picture and store it in a file.
+ */
+ protected void doTakePhoto() {
+ try {
+ // Launch camera to take photo for selected contact
+ PHOTO_DIR.mkdirs();
+ mCurrentPhotoFile = new File(PHOTO_DIR, getPhotoFileName());
+ final Intent intent = getTakePickIntent(mCurrentPhotoFile);
+ startActivityForResult(intent, CAMERA_WITH_DATA);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
+ }
+ }
+
+ /**
+ * Constructs an intent for capturing a photo and storing it in a temporary file.
+ * @param f the temporary file to use to store the picture
+ * @return the intent
+ */
+ public static Intent getTakePickIntent(File f) {
+ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
+ return intent;
+ }
+
+ /**
+ * Sends a newly acquired photo to Gallery for cropping.
+ * @param f the image file to crop
+ */
+ protected void doCropPhoto(final File f) {
+ try {
+
+ // Add the image to the media store
+ // level 8
+ /*
+ MediaScannerConnection.scanFile(
+ this,
+ new String[] { f.getAbsolutePath() },
+ new String[] { null },
+ null);
+ */
+
+ // Launch gallery to crop the photo
+ final Intent intent = getCropImageIntent(Uri.fromFile(f));
+ startActivityForResult(intent, PHOTO_PICKED_WITH_DATA);
+ } catch (ActivityNotFoundException e) {
+ Log.e(TAG, "Cannot crop image", e);
+ Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
+ }
+ }
+
+ /**
+ * Constructs an intent for image cropping.
+ * @param photoUri the uri of the photo to crop
+ * @return the intent
+ */
+ public static Intent getCropImageIntent(Uri photoUri) {
+ Intent intent = new Intent("com.android.camera.action.CROP");
+ intent.setDataAndType(photoUri, "image/*");
+ intent.putExtra("crop", "true");
+ intent.putExtra("aspectX", 1);
+ intent.putExtra("aspectY", 1);
+ intent.putExtra("outputX", ICON_SIZE);
+ intent.putExtra("outputY", ICON_SIZE);
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, MY_AVATAR_URI);
+ return intent;
+ }
+
+ /**
+ * Launches Gallery to pick a photo.
+ */
+ protected void doPickPhotoFromGallery() {
+ try {
+ // Launch picker to choose photo for selected contact
+ final Intent intent = getPhotoPickIntent();
+ startActivityForResult(intent, PHOTO_PICKED_WITH_DATA);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
+ }
+ }
+
+ /**
+ * Constructs an intent for picking a photo from Gallery, cropping it and returning the bitmap.
+ * @return the intent
+ */
+ public static Intent getPhotoPickIntent() {
+ Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
+ intent.setType("image/*");
+ intent.putExtra("crop", "true");
+ intent.putExtra("aspectX", 1);
+ intent.putExtra("aspectY", 1);
+ intent.putExtra("outputX", ICON_SIZE);
+ intent.putExtra("outputY", ICON_SIZE);
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, MY_AVATAR_URI);
+ // use this to get the bitmap in the intent
+// intent.putExtra("return-data", true);
+ return intent;
+ }
+
+
+
+ /**
+ * connection to service.
+ * @author nikita
+ */
+ private class BeemServiceConnection implements ServiceConnection {
+
+ /**
+ * constructor.
+ */
+ public BeemServiceConnection() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
+ if (mShowCurrentAvatar)
+ displayCurrentAvatar();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mXmppFacade = null;
+ }
+ }
+
+ /**
+ * User have clicked on ok.
+ * @author nikita
+ */
+ private class MyOnClickListener implements OnClickListener {
+
+ /**
+ * constructor.
+ */
+ public MyOnClickListener() {
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == mOk) {
+ String msg = mStatusMessageEditText.getText().toString();
+ int status = getStatusForService((String) mSpinner.getSelectedItem());
+ Editor edit = mSettings.edit();
+ edit.putString(BeemApplication.STATUS_TEXT_KEY, msg);
+ if (status == Status.CONTACT_STATUS_DISCONNECT) {
+ stopService(new Intent(ChangeStatus.this, BeemService.class));
+ } else {
+ try {
+ mXmppFacade.changeStatus(status, msg.toString());
+ edit.putInt(BeemApplication.STATUS_KEY, mSpinner.getSelectedItemPosition());
+ publishAvatar();
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ mToast.show();
+ }
+ edit.commit();
+ ChangeStatus.this.finish();
+ } else if (v == mClear) {
+ mStatusMessageEditText.setText(null);
+ } else if (v == mContact) {
+ startActivity(new Intent(ChangeStatus.this, ContactList.class));
+ ChangeStatus.this.finish();
+ } else if (v == mAvatar)
+ onAvatarButton(v);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/Chat.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,1049 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.preference.PreferenceManager;
+import android.text.util.Linkify;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.view.inputmethod.EditorInfo;
+import android.widget.BaseAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.android.mms.util.SmileyParser;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.R;
+import com.beem.project.beem.providers.AvatarProvider;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.Message;
+import com.beem.project.beem.service.PresenceAdapter;
+import com.beem.project.beem.service.aidl.IBeemRosterListener;
+import com.beem.project.beem.service.aidl.IChat;
+import com.beem.project.beem.service.aidl.IChatManager;
+import com.beem.project.beem.service.aidl.IChatManagerListener;
+import com.beem.project.beem.service.aidl.IMessageListener;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.ui.dialogs.builders.ChatList;
+import com.beem.project.beem.ui.dialogs.builders.DisplayOtrFingerprint;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+import com.beem.project.beem.utils.Status;
+
+import org.jivesoftware.smack.packet.Presence.Mode;
+import org.jivesoftware.smack.util.StringUtils;
+
+
+/**
+ * This class represents an activity which allows the user to chat with his/her contacts.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class Chat extends Activity implements TextView.OnEditorActionListener {
+
+ private static final String TAG = "Chat";
+ private static final Intent SERVICE_INTENT = new Intent();
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+ private Handler mHandler = new Handler();
+
+ private IRoster mRoster;
+ private Contact mContact;
+
+ private TextView mContactNameTextView;
+ private TextView mContactStatusMsgTextView;
+ private TextView mContactChatState;
+ private TextView mContactOtrState;
+ private ImageView mContactStatusIcon;
+ private LayerDrawable mAvatarStatusDrawable;
+ private ListView mMessagesListView;
+ private EditText mInputField;
+ private Button mSendButton;
+ private final Map<Integer, Bitmap> mStatusIconsMap = new HashMap<Integer, Bitmap>();
+
+ private final List<MessageText> mListMessages = new ArrayList<MessageText>();
+
+ private IChat mChat;
+ private IChatManager mChatManager;
+ private final IMessageListener mMessageListener = new OnMessageListener();
+ private final IChatManagerListener mChatManagerListener = new ChatManagerListener();
+ private MessagesListAdapter mMessagesListAdapter = new MessagesListAdapter();
+
+ private final ServiceConnection mConn = new BeemServiceConnection();
+ private final BeemBroadcastReceiver mBroadcastReceiver = new BeemBroadcastReceiver();
+ private final BeemRosterListener mBeemRosterListener = new BeemRosterListener();
+ private IXmppFacade mXmppFacade;
+ private String mCurrentAvatarId;
+ private boolean mBinded;
+ private boolean mCompact;
+
+ /**
+ * Constructor.
+ */
+ public Chat() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onCreate(Bundle savedBundle) {
+ super.onCreate(savedBundle);
+ this.registerReceiver(mBroadcastReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
+
+ if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
+ }
+
+ mCompact = settings.getBoolean(BeemApplication.USE_COMPACT_CHAT_UI_KEY, false);
+ // UI
+ if (!mCompact) {
+ setContentView(R.layout.chat);
+ mContactNameTextView = (TextView) findViewById(R.id.chat_contact_name);
+ mContactStatusMsgTextView = (TextView) findViewById(R.id.chat_contact_status_msg);
+ mContactChatState = (TextView) findViewById(R.id.chat_contact_chat_state);
+ mContactStatusIcon = (ImageView) findViewById(R.id.chat_contact_status_icon);
+ mAvatarStatusDrawable = (LayerDrawable) mContactStatusIcon.getDrawable();
+ mAvatarStatusDrawable.setLayerInset(1, 36, 36, 0, 0);
+ } else {
+ setContentView(R.layout.chat_compact);
+ }
+ mContactOtrState = (TextView) findViewById(R.id.chat_contact_otr_state);
+ mMessagesListView = (ListView) findViewById(R.id.chat_messages);
+ mMessagesListView.setAdapter(mMessagesListAdapter);
+ mInputField = (EditText) findViewById(R.id.chat_input);
+ mInputField.setOnEditorActionListener(this);
+ mInputField.requestFocus();
+ mSendButton = (Button) findViewById(R.id.chat_send_message);
+ mSendButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ sendMessage();
+ }
+ });
+
+ prepareIconsStatus();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ mContact = new Contact(getIntent().getData());
+ if (!mBinded) {
+ bindService(SERVICE_INTENT, mConn, BIND_AUTO_CREATE);
+ mBinded = true;
+ }
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ this.unregisterReceiver(mBroadcastReceiver);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ try {
+ if (mChat != null) {
+ mChat.setOpen(false);
+ mChat.removeMessageListener(mMessageListener);
+ }
+ if (mRoster != null)
+ mRoster.removeRosterListener(mBeemRosterListener);
+ if (mChatManager != null)
+ mChatManager.removeChatCreationListener(mChatManagerListener);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ if (mBinded) {
+ unbindService(mConn);
+ mBinded = false;
+ }
+ mXmppFacade = null;
+ mRoster = null;
+ mChat = null;
+ mChatManager = null;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ setIntent(intent);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onSaveInstanceState(Bundle savedInstanceState) {
+ super.onSaveInstanceState(savedInstanceState);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public final boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.chat, menu);
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.chat_menu_contacts_list:
+ Intent contactListIntent = new Intent(this, ContactList.class);
+ contactListIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ startActivity(contactListIntent);
+ break;
+ case R.id.chat_menu_change_chat:
+ try {
+ final List<Contact> openedChats = mChatManager.getOpenedChatList();
+ Dialog chatList = new ChatList(Chat.this, openedChats).create();
+ chatList.show();
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ break;
+ case R.id.chat_menu_close_chat:
+ try {
+ mChatManager.destroyChat(mChat);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ this.finish();
+ break;
+ case R.id.chat_menu_start_otr_session:
+ try {
+ if (mChat == null) {
+ mChat = mChatManager.createChat(mContact, mMessageListener);
+ if (mChat != null) {
+ mChat.setOpen(true);
+ }
+ }
+ mChat.startOtrSession();
+ } catch (RemoteException e) {
+ Log.e(TAG, "start otr chats failed " + mChat, e);
+ }
+ break;
+ case R.id.chat_menu_stop_otr_session:
+ try {
+ if (mChat == null) {
+ mChat = mChatManager.createChat(mContact, mMessageListener);
+ if (mChat != null) {
+ mChat.setOpen(true);
+ }
+ }
+ mChat.endOtrSession();
+ } catch (RemoteException e) {
+ Log.e(TAG, "close otr chats failed " + mChat, e);
+ }
+ break;
+ case R.id.chat_menu_otr_verify_key:
+ try {
+ if (mChat == null) {
+ mChat = mChatManager.createChat(mContact, mMessageListener);
+ if (mChat != null) {
+ mChat.setOpen(true);
+ }
+ }
+ Dialog otrDialog = new DisplayOtrFingerprint(this, mChat).create();
+ otrDialog.show();
+ } catch (RemoteException e) {
+ Log.e(TAG, "getting local otr key failed " + mChat, e);
+ }
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Change the displayed chat.
+ * @param contact the targeted contact of the new chat
+ * @throws RemoteException If a Binder remote-invocation error occurred.
+ */
+ private void changeCurrentChat(Contact contact) throws RemoteException {
+ if (mChat != null) {
+ mChat.setOpen(false);
+ mChat.removeMessageListener(mMessageListener);
+ }
+ mChat = mChatManager.getChat(contact);
+ if (mChat != null) {
+ mChat.setOpen(true);
+ mChat.addMessageListener(mMessageListener);
+ mChatManager.deleteChatNotification(mChat);
+ updateOtrInformations(mChat.getOtrStatus());
+ }
+ mContact = mRoster.getContact(contact.getJID());
+ String res = contact.getSelectedRes();
+ if (mContact == null)
+ mContact = contact;
+ if (!"".equals(res)) {
+ mContact.setSelectedRes(res);
+ }
+ updateContactInformations();
+ updateContactStatusIcon();
+
+ playRegisteredTranscript();
+ }
+
+ /**
+ * Get all messages from the current chat and refresh the activity with them.
+ * @throws RemoteException If a Binder remote-invocation error occurred.
+ */
+ private void playRegisteredTranscript() throws RemoteException {
+ mListMessages.clear();
+ if (mChat != null) {
+ List<MessageText> msgList = convertMessagesList(mChat.getMessages());
+ mListMessages.addAll(msgList);
+ mMessagesListAdapter.notifyDataSetChanged();
+ }
+ }
+
+ /**
+ * Convert a list of Message coming from the service to a list of MessageText that can be displayed in UI.
+ * @param chatMessages the list of Message
+ * @return a list of message that can be displayed.
+ */
+ private List<MessageText> convertMessagesList(List<Message> chatMessages) {
+ List<MessageText> result = new ArrayList<MessageText>(chatMessages.size());
+ String remoteName = mContact.getName();
+ String localName = getString(R.string.chat_self);
+ MessageText lastMessage = null;
+
+ for (Message m : chatMessages) {
+ String name = remoteName;
+ String fromBareJid = StringUtils.parseBareAddress(m.getFrom());
+ if (m.getType() == Message.MSG_TYPE_ERROR) {
+ lastMessage = null;
+ result.add(new MessageText(fromBareJid, name, m.getBody(), true, m.getTimestamp()));
+ } else if (m.getType() == Message.MSG_TYPE_INFO) {
+ lastMessage = new MessageText("", "", m.getBody(), false);
+ result.add(lastMessage);
+
+ } else if (m.getType() == Message.MSG_TYPE_CHAT) {
+ if (fromBareJid == null) { //nofrom or from == yours
+ name = localName;
+ fromBareJid = "";
+ }
+
+ if (m.getBody() != null) {
+ if (lastMessage == null || !fromBareJid.equals(lastMessage.getBareJid())) {
+ lastMessage = new MessageText(fromBareJid, name, m.getBody(), false, m.getTimestamp());
+ result.add(lastMessage);
+ } else {
+ lastMessage.setMessage(lastMessage.getMessage().concat("\n" + m.getBody()));
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+ if (v == mInputField && actionId == EditorInfo.IME_ACTION_SEND) {
+ sendMessage();
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Send an XMPP message.
+ */
+ private void sendMessage() {
+ final String inputContent = mInputField.getText().toString();
+
+ if (!"".equals(inputContent)) {
+ Message msgToSend = new Message(mContact.getJIDWithRes(), Message.MSG_TYPE_CHAT);
+ msgToSend.setBody(inputContent);
+
+ try {
+ if (mChat == null) {
+ mChat = mChatManager.createChat(mContact, mMessageListener);
+ mChat.setOpen(true);
+ }
+ mChat.sendMessage(msgToSend);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+
+ final String self = getString(R.string.chat_self);
+ MessageText lastMessage = null;
+ if (mListMessages.size() != 0)
+ lastMessage = mListMessages.get(mListMessages.size() - 1);
+
+ if (lastMessage != null && lastMessage.getName().equals(self)) {
+ lastMessage.setMessage(lastMessage.getMessage().concat("\n" + inputContent));
+ lastMessage.setTimestamp(new Date());
+ } else
+ mListMessages.add(new MessageText(self, self, inputContent, false, new Date()));
+ mMessagesListAdapter.notifyDataSetChanged();
+ mInputField.setText(null);
+ }
+ }
+
+
+ /**
+ * Update the contact informations.
+ */
+ private void updateContactInformations() {
+ // Check for a contact name update
+ String name = mContact.getName();
+ String res = mContact.getSelectedRes();
+ if (!"".equals(res))
+ name += "(" + res + ")";
+ if (!mCompact) {
+ if (!(mContactNameTextView.getText().toString().equals(name)))
+ mContactNameTextView.setText(name);
+ //Check for a contact status message update
+ if (!(mContactStatusMsgTextView.getText().toString().equals(mContact.getMsgState()))) {
+ mContactStatusMsgTextView.setText(mContact.getMsgState());
+ Linkify.addLinks(mContactStatusMsgTextView, Linkify.WEB_URLS);
+ }
+ } else {
+ Mode m = Status.getPresenceModeFromStatus(mContact.getStatus());
+ if (m == null)
+ setTitle(getString(R.string.chat_name) + " " + name + " ("
+ + getString(R.string.contact_status_msg_offline) + ")");
+ else
+ setTitle(getString(R.string.chat_name) + " " + name + " (" + m.name() + ")");
+ }
+ }
+
+ /**
+ * Update the OTR informations.
+ * @param otrState the otr state
+ */
+ private void updateOtrInformations(final String otrState) {
+ String text = null;
+ if ("ENCRYPTED".equals(otrState)) {
+ text = Chat.this.getString(R.string.chat_otrstate_encrypted);
+ } else if ("FINISHED".equals(otrState)) {
+ text = Chat.this.getString(R.string.chat_otrstate_finished);
+ } else if ("AUTHENTICATED".equals(otrState)) {
+ text = Chat.this.getString(R.string.chat_otrstate_authenticated);
+ } else {
+ text = Chat.this.getString(R.string.chat_otrstate_plaintext);
+ }
+ if (mContactOtrState != null)
+ mContactOtrState.setText(text);
+ }
+
+ /**
+ * Update the contact status icon.
+ */
+ private void updateContactStatusIcon() {
+ if (mCompact)
+ return;
+ String id = mContact.getAvatarId();
+ if (id == null)
+ id = "";
+ Log.d(TAG, "update contact icon : " + id);
+ if (!id.equals(mCurrentAvatarId)) {
+ Drawable avatar = getAvatarDrawable(mContact.getAvatarId());
+ mAvatarStatusDrawable.setDrawableByLayerId(R.id.avatar, avatar);
+ mCurrentAvatarId = id;
+ }
+ mContactStatusIcon.setImageLevel(mContact.getStatus());
+ }
+
+ /**
+ * Get a Drawable containing the avatar icon.
+ * @param avatarId the avatar id to retrieve or null to get default
+ * @return a Drawable
+ */
+ private Drawable getAvatarDrawable(String avatarId) {
+ Drawable avatarDrawable = null;
+ if (avatarId != null) {
+ Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(avatarId).build();
+ InputStream in = null;
+ try {
+ try {
+ in = getContentResolver().openInputStream(uri);
+ avatarDrawable = Drawable.createFromStream(in, avatarId);
+ } finally {
+ if (in != null)
+ in.close();
+ }
+ } catch (IOException e) {
+ Log.w(TAG, "Error while setting the avatar", e);
+ }
+ }
+ if (avatarDrawable == null)
+ avatarDrawable = getResources().getDrawable(R.drawable.beem_launcher_icon_silver);
+ return avatarDrawable;
+ }
+
+ /**
+ * Prepare the status icons map.
+ */
+ private void prepareIconsStatus() {
+ mStatusIconsMap.put(Status.CONTACT_STATUS_AVAILABLE,
+ BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online));
+ mStatusIconsMap.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT,
+ BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online));
+ mStatusIconsMap.put(Status.CONTACT_STATUS_AWAY,
+ BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_away));
+ mStatusIconsMap.put(Status.CONTACT_STATUS_BUSY,
+ BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_busy));
+ mStatusIconsMap.put(Status.CONTACT_STATUS_DISCONNECT,
+ BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_offline));
+ mStatusIconsMap.put(Status.CONTACT_STATUS_UNAVAILABLE,
+ BitmapFactory.decodeResource(getResources(), R.drawable.status_requested));
+ }
+
+ /**
+ * Add smileys Spannable to a message string.
+ *
+ * @param msg the message containing optional smileys strings
+ * @return the message with smileys spannable
+ */
+ private CharSequence addSmileysToMessage(String msg) {
+ SmileyParser parser = SmileyParser.getInstance();
+ return parser.addSmileySpans(msg);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ private final class BeemServiceConnection implements ServiceConnection {
+
+ /**
+ * Constructor.
+ */
+ public BeemServiceConnection() {
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
+ try {
+ mRoster = mXmppFacade.getRoster();
+ if (mRoster != null)
+ mRoster.addRosterListener(mBeemRosterListener);
+ mChatManager = mXmppFacade.getChatManager();
+ if (mChatManager != null) {
+ mChatManager.addChatCreationListener(mChatManagerListener);
+ changeCurrentChat(mContact);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mXmppFacade = null;
+ try {
+ mRoster.removeRosterListener(mBeemRosterListener);
+ mChatManager.removeChatCreationListener(mChatManagerListener);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ private class BeemRosterListener extends IBeemRosterListener.Stub {
+
+ /**
+ * Constructor.
+ */
+ public BeemRosterListener() {
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void onEntriesAdded(List<String> addresses) throws RemoteException {
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void onEntriesDeleted(List<String> addresses) throws RemoteException {
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void onEntriesUpdated(List<String> addresses) throws RemoteException {
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void onPresenceChanged(final PresenceAdapter presence) throws RemoteException {
+ if (mContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mContact.setStatus(presence.getStatus());
+ mContact.setMsgState(presence.getStatusText());
+ updateContactInformations();
+ updateContactStatusIcon();
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ private class OnMessageListener extends IMessageListener.Stub {
+
+ /**
+ * Constructor.
+ */
+ public OnMessageListener() {
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void processMessage(IChat chat, final Message msg) throws RemoteException {
+ final String fromBareJid = StringUtils.parseBareAddress(msg.getFrom());
+
+ if (mContact.getJID().equals(fromBareJid)) {
+ mHandler.post(new Runnable() {
+
+ @Override
+ public void run() {
+ if (msg.getType() == Message.MSG_TYPE_ERROR) {
+ mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(), true, msg
+ .getTimestamp()));
+ mMessagesListAdapter.notifyDataSetChanged();
+ } else if (msg.getBody() != null) {
+ MessageText lastMessage = null;
+ if (mListMessages.size() != 0)
+ lastMessage = mListMessages.get(mListMessages.size() - 1);
+
+ if (lastMessage != null && lastMessage.getBareJid().equals(fromBareJid)) {
+ lastMessage.setMessage(lastMessage.getMessage().concat("\n" + msg.getBody()));
+ lastMessage.setTimestamp(msg.getTimestamp());
+ mListMessages.set(mListMessages.size() - 1, lastMessage);
+ } else if (msg.getBody() != null)
+ mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(),
+ false, msg.getTimestamp()));
+ mMessagesListAdapter.notifyDataSetChanged();
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void stateChanged(IChat chat) throws RemoteException {
+ final String state = chat.getState();
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ String text = null;
+ if ("active".equals(state)) {
+ text = Chat.this.getString(R.string.chat_state_active);
+ } else if ("composing".equals(state)) {
+ text = Chat.this.getString(R.string.chat_state_composing);
+ } else if ("gone".equals(state)) {
+ text = Chat.this.getString(R.string.chat_state_gone);
+ } else if ("inactive".equals(state)) {
+ text = Chat.this.getString(R.string.chat_state_inactive);
+ } else if ("paused".equals(state)) {
+ text = Chat.this.getString(R.string.chat_state_active);
+ }
+ if (!mCompact)
+ mContactChatState.setText(text);
+ }
+ });
+
+ }
+
+ @Override
+ public void otrStateChanged(final String otrState) throws RemoteException {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ updateOtrInformations(otrState);
+ mListMessages.add(new MessageText("", "", otrState, false));
+ mMessagesListAdapter.notifyDataSetChanged();
+ }
+ });
+
+ }
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ private class MessagesListAdapter extends BaseAdapter {
+
+ /**
+ * Constructor.
+ */
+ public MessagesListAdapter() {
+ }
+
+ /**
+ * Returns the number of messages contained in the messages list.
+ * @return The number of messages contained in the messages list.
+ */
+ @Override
+ public int getCount() {
+ return mListMessages.size();
+ }
+
+ /**
+ * Return an item from the messages list that is positioned at the position passed by parameter.
+ * @param position The position of the requested item.
+ * @return The item from the messages list at the requested position.
+ */
+ @Override
+ public Object getItem(int position) {
+ return mListMessages.get(position);
+ }
+
+ /**
+ * Return the id of an item from the messages list that is positioned at the position passed by parameter.
+ * @param position The position of the requested item.
+ * @return The id of an item from the messages list at the requested position.
+ */
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ /**
+ * Return the view of an item from the messages list.
+ * @param position The position of the requested item.
+ * @param convertView The old view to reuse if possible.
+ * @param parent The parent that this view will eventually be attached to.
+ * @return A View corresponding to the data at the specified position.
+ */
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View sv;
+ if (convertView == null) {
+ LayoutInflater inflater = Chat.this.getLayoutInflater();
+ sv = inflater.inflate(R.layout.chat_msg_row, null);
+ } else {
+ sv = convertView;
+ }
+ DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
+ MessageText msg = mListMessages.get(position);
+ TextView msgName = (TextView) sv.findViewById(R.id.chatmessagename);
+ msgName.setText(msg.getName());
+ msgName.setTextColor(Color.WHITE);
+ msgName.setError(null);
+ TextView msgText = (TextView) sv.findViewById(R.id.chatmessagetext);
+ CharSequence msgBody = addSmileysToMessage(msg.getMessage());
+ msgText.setText(msgBody);
+ registerForContextMenu(msgText);
+ TextView msgDate = (TextView) sv.findViewById(R.id.chatmessagedate);
+ if (msg.getTimestamp() != null) {
+ String date = df.format(msg.getTimestamp());
+ msgDate.setText(date);
+ }
+ if (msg.isError()) {
+ String err = getString(R.string.chat_error);
+ msgName.setText(err);
+ msgName.setTextColor(Color.RED);
+ msgName.setError(err);
+ }
+ return sv;
+ }
+ }
+
+ /**
+ * Class which simplify an Xmpp text message.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+ private class MessageText {
+ private String mBareJid;
+ private String mName;
+ private String mMessage;
+ private boolean mIsError;
+ private Date mTimestamp;
+
+ /**
+ * Constructor.
+ * @param bareJid A String containing the bare JID of the message's author.
+ * @param name A String containing the name of the message's author.
+ * @param message A String containing the message.
+ */
+ public MessageText(final String bareJid, final String name, final String message) {
+ mBareJid = bareJid;
+ mName = name;
+ mMessage = message;
+ mIsError = false;
+ }
+
+ /**
+ * Constructor.
+ * @param bareJid A String containing the bare JID of the message's author.
+ * @param name A String containing the name of the message's author.
+ * @param message A String containing the message.
+ * @param isError if the message is an error message.
+ */
+ public MessageText(final String bareJid, final String name, final String message, final boolean isError) {
+ mBareJid = bareJid;
+ mName = name;
+ mMessage = message;
+ mIsError = isError;
+ }
+
+ /**
+ * Constructor.
+ * @param bareJid A String containing the bare JID of the message's author.
+ * @param name A String containing the name of the message's author.
+ * @param message A String containing the message.
+ * @param isError if the message is an error message.
+ * @param date the time of the message.
+ */
+ public MessageText(final String bareJid, final String name, final String message, final boolean isError,
+ final Date date) {
+ mBareJid = bareJid;
+ mName = name;
+ mMessage = message;
+ mIsError = isError;
+ mTimestamp = date;
+ }
+
+ /**
+ * JID attribute accessor.
+ * @return A String containing the bare JID of the message's author.
+ */
+ public String getBareJid() {
+ return mBareJid;
+ }
+
+ /**
+ * Name attribute accessor.
+ * @return A String containing the name of the message's author.
+ */
+ public String getName() {
+ return mName;
+ }
+
+ /**
+ * Message attribute accessor.
+ * @return A String containing the message.
+ */
+ public String getMessage() {
+ return mMessage;
+ }
+
+ /**
+ * JID attribute mutator.
+ * @param bareJid A String containing the author's bare JID of the message.
+ */
+ @SuppressWarnings("unused")
+ public void setBareJid(String bareJid) {
+ mBareJid = bareJid;
+ }
+
+ /**
+ * Name attribute mutator.
+ * @param name A String containing the author's name of the message.
+ */
+ @SuppressWarnings("unused")
+ public void setName(String name) {
+ mName = name;
+ }
+
+ /**
+ * Message attribute mutator.
+ * @param message A String containing a message.
+ */
+ public void setMessage(String message) {
+ mMessage = message;
+ }
+
+ /**
+ * Get the message type.
+ * @return true if the message is an error message.
+ */
+ public boolean isError() {
+ return mIsError;
+ }
+
+ /**
+ * Set the Date of the message.
+ * @param date date of the message.
+ */
+ public void setTimestamp(Date date) {
+ mTimestamp = date;
+ }
+
+ /**
+ * Get the Date of the message.
+ * @return if it is a delayed message get the date the message was sended.
+ */
+ public Date getTimestamp() {
+ return mTimestamp;
+ }
+
+ }
+
+ /**
+ * This class is in charge of getting the new chat in the activity if someone talk to you.
+ */
+ private class ChatManagerListener extends IChatManagerListener.Stub {
+
+ /**
+ * Constructor.
+ */
+ public ChatManagerListener() {
+ }
+
+ @Override
+ public void chatCreated(IChat chat, boolean locally) {
+ if (locally)
+ return;
+ try {
+ String contactJid = mContact.getJIDWithRes();
+ String chatJid = chat.getParticipant().getJIDWithRes();
+ if (chatJid.equals(contactJid)) {
+ // This should not be happened but to be sure
+ if (mChat != null) {
+ mChat.setOpen(false);
+ mChat.removeMessageListener(mMessageListener);
+ }
+ mChat = chat;
+ mChat.setOpen(true);
+ mChat.addMessageListener(mMessageListener);
+ mChatManager.deleteChatNotification(mChat);
+ }
+ } catch (RemoteException ex) {
+ Log.e(TAG, "A remote exception occurs during the creation of a chat", ex);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/ContactList.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,590 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+
+*/
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import android.app.Dialog;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.preference.PreferenceManager;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v4.view.PagerTabStrip;
+import android.support.v4.view.ViewPager;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.PresenceAdapter;
+import com.beem.project.beem.service.aidl.IBeemRosterListener;
+import com.beem.project.beem.service.aidl.IChatManager;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.ui.dialogs.builders.Alias;
+import com.beem.project.beem.ui.dialogs.builders.ChatList;
+import com.beem.project.beem.ui.dialogs.builders.DeleteContact;
+import com.beem.project.beem.ui.dialogs.builders.ResendSubscription;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+
+import org.jivesoftware.smack.util.StringUtils;
+
+import static com.google.android.apps.iosched.util.LogUtils.*;
+
+/**
+ * The contact list activity displays the roster of the user.
+ */
+public class ContactList extends FragmentActivity {
+
+ private static final Intent SERVICE_INTENT = new Intent();
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ private static final String TAG = makeLogTag(ContactList.class);
+ private static final float PAGER_TAB_SECONDARY_ALPHA = 0.5f;
+ private final List<String> mListGroup = new ArrayList<String>();
+
+ /** Map containing a list of the different contacts of a given group.
+ * Each list is a @{link SortedList} so there is no need to sort it again.
+ * */
+ private final Map<String, List<Contact>> mContactOnGroup = new HashMap<String, List<Contact>>();
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+ private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
+ private final Map<String, ContactListAdapter> contactListAdapters = new HashMap<String, ContactListAdapter>();
+
+ private final BeemRosterListener mBeemRosterListener = new BeemRosterListener();
+ private IRoster mRoster;
+ private IXmppFacade mXmppFacade;
+ private IChatManager mChatManager;
+ private SharedPreferences mSettings;
+ private boolean mBinded;
+ private ViewPager viewPager;
+ private ListPagerAdapter groupsPagesAdapter;
+ private PagerTabStrip pagerTabs;
+
+ /**
+ * Constructor.
+ */
+ public ContactList() {
+ }
+
+ /**
+ * 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.contact_list, menu);
+ return true;
+ }
+
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.contact_list_menu_settings:
+ startActivity(new Intent(this, Settings.class));
+ return true;
+ case R.id.contact_list_menu_add_contact:
+ startActivity(new Intent(ContactList.this, AddContact.class));
+ return true;
+ case R.id.menu_change_status:
+ startActivity(new Intent(ContactList.this, ChangeStatus.class));
+ return true;
+ case R.id.contact_list_menu_chatlist:
+ List<Contact> openedChats;
+ try {
+ openedChats = mChatManager.getOpenedChatList();
+ LOGD(TAG, "opened chats = " + openedChats);
+ Dialog chatList = new ChatList(ContactList.this, openedChats).create();
+ chatList.show();
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ return true;
+ case R.id.menu_disconnect:
+ stopService(SERVICE_INTENT);
+ finish();
+ return true;
+ default:
+ return false;
+ }
+ }
+
+
+ @Override
+ protected void onCreate(Bundle saveBundle) {
+ super.onCreate(saveBundle);
+ mSettings = PreferenceManager.getDefaultSharedPreferences(this);
+ setContentView(R.layout.contactlist);
+
+ this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+
+ viewPager = (ViewPager) findViewById(R.id.pager);
+ groupsPagesAdapter = new ListPagerAdapter(getSupportFragmentManager(), viewPager);
+ pagerTabs = (PagerTabStrip) findViewById(R.id.tabstrip);
+ pagerTabs.setTabIndicatorColorResource(R.color.vert_manu);
+ pagerTabs.setNonPrimaryAlpha(PAGER_TAB_SECONDARY_ALPHA);
+
+ mListGroup.add(getString(R.string.contact_list_all_contact));
+ mListGroup.add(getString(R.string.contact_list_no_group));
+ groupsPagesAdapter.notifyDataSetChanged();
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ if (!mSettings.getBoolean(BeemApplication.HIDE_GROUPS_KEY, false))
+ showGroups();
+ else
+ hideGroups();
+
+ if (!mBinded)
+ mBinded = bindService(SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ try {
+ if (mRoster != null) {
+ mRoster.removeRosterListener(mBeemRosterListener);
+ mRoster = null;
+ }
+ } catch (RemoteException e) {
+ LOGD("ContactList", "Remote exception", e);
+ }
+ if (mBinded) {
+ unbindService(mServConn);
+ mBinded = false;
+ }
+ mXmppFacade = null;
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ this.unregisterReceiver(mReceiver);
+ LOGV(TAG, "onDestroy activity");
+ }
+
+ /**
+ * Get a {@link ContactListAdapter} for a group.
+ * The {@link ContactListAdapter} will be created if it is not exist.
+ * @param group the group
+ * @return the adapter
+ */
+ ContactListAdapter getContactListAdapter(String group) {
+ synchronized (contactListAdapters) {
+ ContactListAdapter contactListAdapter = contactListAdapters.get(group);
+ if (contactListAdapter == null) {
+ contactListAdapter = new ContactListAdapter(ContactList.this);
+ contactListAdapters.put(group, contactListAdapter);
+ }
+ boolean hideDisconnected = mSettings.getBoolean(BeemApplication.SHOW_OFFLINE_CONTACTS_KEY, false);
+ contactListAdapter.setOnlineOnly(hideDisconnected);
+ return contactListAdapter;
+ }
+ }
+
+ /**
+ * Exectute a context menu action on a specified contact.
+ * @param itemId the id of the menu action
+ * @param contact the contact
+ */
+ void doContextMenuAction(int itemId, Contact contact) {
+ switch (itemId) {
+ case R.id.contact_list_context_menu_call_item:
+ try {
+ mXmppFacade.call(contact.getJID() + "/psi");
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ break;
+ case R.id.contact_list_context_menu_userinfo_alias:
+ Dialog alias = new Alias(ContactList.this, mRoster, contact).create();
+ alias.show();
+ break;
+ case R.id.contact_list_context_menu_userinfo_subscription:
+ Dialog subscription = new ResendSubscription(ContactList.this,
+ mXmppFacade, contact).create();
+ subscription.show();
+ break;
+ case R.id.contact_list_context_menu_userinfo_delete:
+ Dialog delete = new DeleteContact(ContactList.this, mRoster, contact).create();
+ delete.show();
+ break;
+ default:
+ LOGW(TAG, "Context menu action not supported" + itemId);
+ break;
+ }
+
+ }
+
+ /**
+ * Show the groups view.
+ */
+ private void showGroups() {
+ pagerTabs.setVisibility(View.VISIBLE);
+ }
+
+ /**
+ * Hide the groups view.
+ */
+ private void hideGroups() {
+ pagerTabs.setVisibility(View.GONE);
+ }
+
+ /**
+ * Remove old groups on the banner.
+ * @throws RemoteException if an error occur when communicating with the service
+ */
+ private void cleanBannerGroup() throws RemoteException {
+ if (mListGroup.size() <= 2)
+ return;
+ List<String> rosterGroups = mRoster.getGroupsNames();
+ Collections.sort(rosterGroups);
+ List<String> realGroups = mListGroup.subList(1, mListGroup.size() - 1);
+ realGroups.clear();
+ realGroups.addAll(rosterGroups);
+ groupsPagesAdapter.notifyDataSetChanged();
+ }
+
+ /**
+ * Add a contact to the special list No Group and All contacts.
+ * The contact will be added if the list is not the current list otherwise
+ * the list must be modified in a Handler.
+ *
+ * @param contact the contact to add.
+ */
+ private void addToSpecialList(Contact contact) {
+ List<String> groups = contact.getGroups();
+
+ ContactListAdapter adapter = getContactListAdapter(getString(R.string.contact_list_all_contact));
+ adapter.put(contact);
+ if (groups.isEmpty()) {
+ adapter = getContactListAdapter(getString(R.string.contact_list_no_group));
+ adapter.put(contact);
+ }
+ }
+
+ /**
+ * Add a new group in the GroupBanner.
+ *
+ * @param group the group to add
+ */
+ private void addGroupInBanner(String group) {
+ List<String> realGroups = mListGroup.subList(1, mListGroup.size() - 1);
+ if (!mListGroup.contains(group)) {
+ boolean added = false;
+ // insert group in sorted list
+ for (ListIterator<String> iterator = realGroups.listIterator(); iterator.hasNext();) {
+ String currentGroup = (String) iterator.next();
+ if (currentGroup.compareTo(group) > 0) {
+ iterator.previous();
+ iterator.add(group);
+ added = true;
+ break;
+ }
+ }
+ if (!added)
+ realGroups.add(group);
+ groupsPagesAdapter.notifyDataSetChanged();
+ }
+ }
+
+ /**
+ * Listener on service event.
+ */
+ private class BeemRosterListener extends IBeemRosterListener.Stub {
+ /**
+ * Constructor.
+ */
+ public BeemRosterListener() {
+ }
+
+ /**
+ * {@inheritDoc}
+ * Simple stategy to handle the onEntriesAdded event.
+ * if contact has to be shown :
+ * <ul>
+ * <li> add him to his groups</li>
+ * <li> add him to the specials groups</>
+ * </ul>
+ */
+ @Override
+ public void onEntriesAdded(final List<String> addresses) throws RemoteException {
+ for (String newName : addresses) {
+ final Contact contact = mRoster.getContact(StringUtils.parseBareAddress(newName));
+ putContactInList(contact);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * Simple stategy to handle the onEntriesDeleted event.
+ * <ul>
+ * <li> Remove the contact from all groups</li>
+ * </ul>
+ */
+ @Override
+ public void onEntriesDeleted(final List<String> addresses) throws RemoteException {
+ LOGD(TAG, "onEntries deleted " + addresses);
+ for (String cToDelete : addresses) {
+ final Contact contact = new Contact(cToDelete);
+ for (final ContactListAdapter adapter : contactListAdapters.values()) {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ adapter.remove(contact);
+ }
+ });
+ }
+ }
+ cleanBannerGroup();
+
+ }
+
+ /**
+ * {@inheritDoc}
+ * Simple stategy to handle the onEntriesUpdated event.
+ * <ul>
+ * <li> Remove the contact from all groups</li>
+ * <li> if contact has to be shown add it to his groups</li>
+ * <li> if contact has to be shown add it to the specials groups</li>
+ * </ul>
+ */
+ @Override
+ public void onEntriesUpdated(final List<String> addresses) throws RemoteException {
+ LOGD(TAG, "onEntries updated " + addresses);
+ for (String cToDelete : addresses) {
+ Contact contact = new Contact(cToDelete);
+ for (ContactListAdapter adapter : contactListAdapters.values()) {
+ adapter.remove(contact);
+ }
+ }
+ for (String newName : addresses) {
+ final Contact contact = mRoster.getContact(StringUtils.parseBareAddress(newName));
+ putContactInList(contact);
+ }
+ cleanBannerGroup();
+ }
+
+ /**
+ * {@inheritDoc}
+ * Simple stategy to handle the onPresenceChanged event.
+ * <ul>
+ * <li> Remove the contact from all groups</li>
+ * <li> if contact has to be shown add it to his groups</li>
+ * <li> if contact has to be shown add it to the specials groups</li>
+ * </ul>
+ */
+ @Override
+ public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
+ String from = presence.getFrom();
+ final Contact contact = mRoster.getContact(StringUtils.parseBareAddress(from));
+ putContactInList(contact);
+ }
+
+ /**
+ * Put a contact in the different group list.
+ * @param contact the contact
+ */
+ private void putContactInList(final Contact contact) {
+ List<String> groups = contact.getGroups();
+ for (final String group : groups) {
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ addGroupInBanner(group);
+ ContactListAdapter contactListAdapter = getContactListAdapter(group);
+ contactListAdapter.put(contact);
+ }
+ });
+ }
+
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ addToSpecialList(contact);
+ }
+ });
+ }
+ }
+
+ /**
+ * The service connection used to connect to the Beem service.
+ */
+ private class BeemServiceConnection implements ServiceConnection {
+
+ /**
+ * Constructor.
+ */
+ public BeemServiceConnection() {
+ }
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
+ try {
+ mRoster = mXmppFacade.getRoster();
+ if (mRoster != null) {
+ List<String> tmpGroupList = mRoster.getGroupsNames();
+ cleanBannerGroup();
+ synchronized (contactListAdapters) {
+ for (ContactListAdapter ca : contactListAdapters.values()) {
+ ca.clear();
+ }
+ }
+ assignContactToGroups(mRoster.getContactList(), tmpGroupList);
+
+ mRoster.addRosterListener(mBeemRosterListener);
+ LOGD(TAG, "add roster listener");
+ mChatManager = mXmppFacade.getChatManager();
+ }
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ try {
+ mRoster.removeRosterListener(mBeemRosterListener);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ mXmppFacade = null;
+ mChatManager = null;
+ mRoster = null;
+ mListGroup.clear();
+ mContactOnGroup.clear();
+ mBinded = false;
+
+ }
+
+ /**
+ * Assign the differents contact to their groups.
+ * This methods will fill the mContactOnGroup map.
+ *
+ * @param contacts list of contacts
+ * @param groupNames list of existing groups
+ */
+ private void assignContactToGroups(List<Contact> contacts, List<String> groupNames) {
+ for (Contact c : contacts) {
+ addToSpecialList(c);
+
+ List<String> groups = c.getGroups();
+
+ for (String currentGroup : groups) {
+ addGroupInBanner(currentGroup);
+ ContactListAdapter cl = getContactListAdapter(currentGroup);
+ cl.put(c);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * PagerAdapter for the contact list.
+ */
+ private class ListPagerAdapter extends FragmentPagerAdapter {
+
+ /**
+ * Create a {@link ListPagerAdapter}.
+ * @param fm the {@link FragmentManager}
+ * @param viewPager the {@link ViewPager} associate with this adapter
+ */
+ public ListPagerAdapter(final FragmentManager fm, final ViewPager viewPager) {
+ super(fm);
+ viewPager.setAdapter(this);
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ String group = mListGroup.get(position);
+ ContactListFragment f = ContactListFragment.newInstance(group);
+ f.setListAdapter(getContactListAdapter(group));
+ return f;
+ }
+
+ @Override
+ public int getCount() {
+ return mListGroup.size();
+ }
+
+ @Override
+ public String getPageTitle(int position) {
+ return mListGroup.get(position);
+ }
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/ContactListAdapter.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,294 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.ui;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+import android.net.Uri;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.Filter;
+import android.widget.Filterable;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.R;
+import com.beem.project.beem.providers.AvatarProvider;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.utils.SortedList;
+import com.beem.project.beem.utils.Status;
+
+/**
+ * An Adapter for the contact list.
+ * It displays a list of contact in a particular group.
+ *
+ */
+public class ContactListAdapter extends BaseAdapter implements Filterable {
+ private static final String TAG = ContactListAdapter.class.getSimpleName();
+ private final ComparatorContactListByStatusAndName<Contact> mComparator =
+ new ComparatorContactListByStatusAndName<Contact>();
+ private List<Contact> mCurrentList;
+ private final List<Contact> allContacts = new SortedList<Contact>(new LinkedList<Contact>(), mComparator);
+ private final List<Contact> onlineContacts = new SortedList<Contact>(new LinkedList<Contact>(), mComparator);
+ private final Filter mFilter = new ContactFilter();
+ private final Context context;
+ private LayoutInflater mInflater;
+
+ private boolean showOnlineOnly;
+
+ /**
+ * Create a ContactListAdapter.
+ * @param c the android context
+ */
+ public ContactListAdapter(final Context c) {
+ mCurrentList = allContacts;
+ context = c;
+ mInflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ }
+
+ @Override
+ public int getCount() {
+ return mCurrentList.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return mCurrentList.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return mCurrentList.get(position).hashCode();
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View v = convertView;
+ if (convertView == null) {
+ v = mInflater.inflate(R.layout.contactlistcontact, null);
+ }
+ Contact c = mCurrentList.get(position);
+ bindView(v, c);
+ return v;
+ }
+
+ /**
+ * Put a contact in the list.
+ * @param c the contact
+ */
+ public void put(Contact c) {
+ put(c, allContacts);
+ if (Status.statusOnline(c.getStatus()))
+ put(c, onlineContacts);
+ notifyDataSetChanged();
+ }
+
+ /**
+ * Remove a contact from the list.
+ *
+ * @param c the contact
+ */
+ public void remove(Contact c) {
+ allContacts.remove(c);
+ onlineContacts.remove(c);
+ notifyDataSetChanged();
+ }
+
+ /**
+ * Clear the contact list.
+ */
+ public void clear() {
+ allContacts.clear();
+ onlineContacts.clear();
+ notifyDataSetChanged();
+ }
+
+ @Override
+ public Filter getFilter() {
+ return mFilter;
+ }
+
+ /**
+ * Bind a contact to the view.
+ * @param view the row view.
+ * @param curContact the contact.
+ */
+ private void bindView(View view, Contact curContact) {
+ if (curContact != null) {
+ TextView v = (TextView) view.findViewById(R.id.contactlistpseudo);
+ SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
+ if (settings.getBoolean(BeemApplication.SHOW_JID, false))
+ v.setText(curContact.getJID());
+ else
+ v.setText(curContact.getName());
+ v = (TextView) view.findViewById(R.id.contactlistmsgperso);
+ v.setText(curContact.getMsgState());
+ ImageView img = (ImageView) view.findViewById(R.id.avatar);
+ String avatarId = curContact.getAvatarId();
+ int contactStatus = curContact.getStatus();
+ Drawable avatar = getAvatarStatusDrawable(avatarId);
+ img.setImageDrawable(avatar);
+ img.setImageLevel(contactStatus);
+ }
+ }
+
+ /**
+ * Get a LayerDrawable containing the avatar and the status icon.
+ * The status icon will change with the level of the drawable.
+ * @param avatarId the avatar id to retrieve or null to get default
+ * @return a LayerDrawable
+ */
+ private Drawable getAvatarStatusDrawable(String avatarId) {
+ Drawable avatarDrawable = null;
+ if (avatarId != null) {
+ Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(avatarId).build();
+ InputStream in = null;
+ try {
+ try {
+ in = context.getContentResolver().openInputStream(uri);
+ avatarDrawable = Drawable.createFromStream(in, avatarId);
+ } finally {
+ if (in != null)
+ in.close();
+ }
+ } catch (IOException e) {
+ Log.w(TAG, "Error while setting the avatar " + avatarId, e);
+ }
+ }
+ if (avatarDrawable == null)
+ avatarDrawable = context.getResources().getDrawable(R.drawable.beem_launcher_icon_silver);
+ LayerDrawable ld = (LayerDrawable) context.getResources().getDrawable(R.drawable.avatar_status);
+ ld.setLayerInset(1, 36, 36, 0, 0);
+ ld.setDrawableByLayerId(R.id.avatar, avatarDrawable);
+ return ld;
+ }
+
+ /**
+ * Put a contact in a list.
+ * Helper method.
+ *
+ * @param c the contact
+ * @param list the list
+ */
+ private void put(Contact c, List<Contact> list) {
+ list.remove(c);
+ list.add(c);
+ }
+
+ /**
+ * Tell if the list display only online contacts.
+ *
+ * @return true if only online contacts are shown
+ */
+ public boolean isOnlineOnly() {
+ return showOnlineOnly;
+ }
+
+ /**
+ * Set the list to display only the online contacts.
+ *
+ * @param online true to display only online contacts
+ */
+ public void setOnlineOnly(boolean online) {
+ if (online != showOnlineOnly) {
+ showOnlineOnly = online;
+ mCurrentList = showOnlineOnly ? onlineContacts : allContacts;
+ notifyDataSetChanged();
+ }
+ }
+
+ /**
+ * A Filter which select Contact to display by searching in ther Jid.
+ */
+ private class ContactFilter extends Filter {
+
+ /**
+ * Create a ContactFilter.
+ */
+ public ContactFilter() { }
+
+ @Override
+ protected Filter.FilterResults performFiltering(CharSequence constraint) {
+ Log.d(TAG, "performFiltering");
+ List<Contact> result = mCurrentList;
+ if (constraint.length() > 0) {
+ result = new LinkedList<Contact>();
+ for (Contact c : mCurrentList) {
+ if (c.getJID().contains(constraint))
+ result.add(c);
+ }
+ }
+ Filter.FilterResults fr = new Filter.FilterResults();
+ fr.values = result;
+ fr.count = result.size();
+ return fr;
+ }
+
+ @Override
+ protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
+ Log.d(TAG, "publishResults");
+ List<Contact> contacts = (List<Contact>) results.values;
+ mCurrentList = contacts;
+ notifyDataSetChanged();
+ }
+ }
+
+ /**
+ * Comparator Contact by status and name.
+ */
+ private static class ComparatorContactListByStatusAndName<T> implements Comparator<T> {
+ /**
+ * Constructor.
+ */
+ public ComparatorContactListByStatusAndName() {
+ }
+
+ @Override
+ public int compare(T c1, T c2) {
+ if (((Contact) c1).getStatus() < ((Contact) c2).getStatus()) {
+ return 1;
+ } else if (((Contact) c1).getStatus() > ((Contact) c2).getStatus()) {
+ return -1;
+ } else
+ return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName());
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/ContactListFragment.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,172 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.ui;
+
+import java.util.List;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.ListFragment;
+import android.view.ContextMenu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+
+/**
+ * A Fragment which display a list of contacts.
+ */
+public class ContactListFragment extends ListFragment {
+ private String group;
+ private ContactList hostActivity;
+ private Contact mSelectedContact;
+
+ /**
+ * Create a ContactListFragment.
+ * @param group the group name
+ * @return the ContactListFragment
+ */
+ public static ContactListFragment newInstance(String group) {
+ ContactListFragment f = new ContactListFragment();
+ Bundle b = new Bundle();
+ b.putString("group", group);
+ f.setArguments(b);
+ return f;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ parseArguments();
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ hostActivity = (ContactList) activity;
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ ListAdapter adapter = hostActivity.getContactListAdapter(group);
+ setListAdapter(adapter);
+ registerForContextMenu(getListView());
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+ ContactListAdapter a = (ContactListAdapter) getListAdapter();
+ Contact c = (Contact) a.getItem(position);
+ Intent i = new Intent(getActivity(), Chat.class);
+ i.setData(c.toUri());
+ startActivity(i);
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ super.onCreateContextMenu(menu, v, menuInfo);
+ MenuInflater inflater = hostActivity.getMenuInflater();
+ inflater.inflate(R.menu.contactlist_context, menu);
+ AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
+ mSelectedContact = (Contact) getListAdapter().getItem(info.position);
+ menu.setHeaderTitle(mSelectedContact.getJID());
+ }
+
+ /**
+ * Parse the arguments submit to the Fragment.
+ */
+ private void parseArguments() {
+ Bundle b = getArguments();
+ if (b == null)
+ return;
+ group = b.getString("group");
+ }
+
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ Intent in;
+ boolean result = false;
+ if (mSelectedContact != null) {
+ switch (item.getItemId()) {
+ case R.id.contact_list_context_menu_chat_item:
+ List<String> res = mSelectedContact.getMRes();
+ if (res.isEmpty()) {
+ break;
+ }
+ for (String resv : res) {
+ in = new Intent(hostActivity, Chat.class);
+ in.setData(mSelectedContact.toUri(resv));
+ item.getSubMenu().add(resv).setIntent(in);
+ }
+ result = true;
+ break;
+ case R.id.contact_list_context_menu_call_item:
+ hostActivity.doContextMenuAction(item.getItemId(), mSelectedContact);
+ break;
+ case R.id.contact_list_context_menu_user_info:
+ item.getSubMenu().setHeaderTitle(mSelectedContact.getJID());
+ result = true;
+ break;
+ case R.id.contact_list_context_menu_userinfo_alias:
+ hostActivity.doContextMenuAction(item.getItemId(), mSelectedContact);
+ result = true;
+ break;
+ case R.id.contact_list_context_menu_userinfo_group:
+ in = new Intent(hostActivity, GroupList.class);
+ in.putExtra("contact", mSelectedContact);
+ startActivity(in);
+ result = true;
+ break;
+ case R.id.contact_list_context_menu_userinfo_subscription:
+ hostActivity.doContextMenuAction(item.getItemId(), mSelectedContact);
+ result = true;
+ break;
+ case R.id.contact_list_context_menu_userinfo_block:
+ result = true;
+ break;
+ case R.id.contact_list_context_menu_userinfo_delete:
+ hostActivity.doContextMenuAction(item.getItemId(), mSelectedContact);
+ result = true;
+ break;
+ default:
+ result = super.onContextItemSelected(item);
+ break;
+ }
+ return result;
+ }
+ return super.onContextItemSelected(item);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/GroupList.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,263 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.ListActivity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.View.OnKeyListener;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.CheckedTextView;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.AdapterView.OnItemClickListener;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.aidl.IRoster;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+
+/**
+ * That activity permit to manage user groups.
+ * @author nikita
+ */
+public class GroupList extends ListActivity {
+
+ private static final Intent SERVICE_INTENT = new Intent();
+
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+ private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
+ private IXmppFacade mXmppFacade;
+ private IRoster mRoster;
+ private String mJID;
+ private ArrayAdapter<String> mGroups;
+ private Contact mContact;
+ private TextView mText;
+ private final List<String> mStrings = new ArrayList<String>();
+
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ /**
+ * Constructor.
+ */
+ public GroupList() {
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onCreate(android.os.Bundle)
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.group_list);
+ mContact = getIntent().getParcelableExtra("contact");
+ mJID = mContact.getJID();
+ final ListView listView = getListView();
+
+ listView.setItemsCanFocus(false);
+ listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
+ listView.setOnItemClickListener(new GroupOnItemClickListener());
+
+ mText = (TextView) findViewById(R.id.GroupListText);
+ mText.setOnKeyListener(new GroupListOnKeyListener());
+ this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ unbindService(mServConn);
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onDestroy()
+ */
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ this.unregisterReceiver(mReceiver);
+ }
+
+ /**
+ * init activity list adapter.
+ */
+ private void setAdapter() {
+ try {
+ for (String group : mRoster.getGroupsNames()) {
+ mStrings.add(group);
+ }
+ mGroups = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, mStrings);
+ setListAdapter(mGroups);
+ mContact = mRoster.getContact(mJID);
+ for (String group : mContact.getGroups()) {
+ getListView().setItemChecked(mGroups.getPosition(group), true);
+ }
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Event when group is added.
+ */
+ private class GroupListOnKeyListener implements OnKeyListener {
+
+ /**
+ * Constructor.
+ */
+ public GroupListOnKeyListener() {
+ }
+
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ boolean result = false;
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_DPAD_CENTER:
+ case KeyEvent.KEYCODE_ENTER:
+ if (mText.getText().length() == 0)
+ return false;
+ String groupname = mText.getText().toString();
+ mGroups.add(groupname);
+ mText.setText(null);
+ result = true;
+ break;
+ default:
+ result = false;
+ }
+ }
+ return result;
+ }
+
+ }
+
+ /**
+ * Event click on list group contact.
+ */
+ private class GroupOnItemClickListener implements OnItemClickListener {
+
+ /**
+ * Constructor.
+ */
+ public GroupOnItemClickListener() {
+ }
+
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View v, int arg2, long arg3) {
+ CheckedTextView textView = (CheckedTextView) v;
+ if (!textView.isChecked()) {
+ try {
+ mRoster.addContactToGroup(textView.getText().toString(), mJID);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ } else {
+ try {
+ mRoster.removeContactFromGroup(textView.getText().toString(), mJID);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * The ServiceConnection used to connect to the Beem service.
+ */
+ private class BeemServiceConnection implements ServiceConnection {
+
+ /**
+ * Constructor.
+ */
+ public BeemServiceConnection() {
+ }
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
+ try {
+ mRoster = mXmppFacade.getRoster();
+ setAdapter();
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mXmppFacade = null;
+ mRoster = null;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/Login.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,192 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Application;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.R;
+import com.beem.project.beem.ui.wizard.Account;
+import com.beem.project.beem.utils.BeemConnectivity;
+
+/**
+ * This class is the main Activity for the Beem project.
+ * @author Da Risk <darisk@beem-project.com>
+ */
+public class Login extends Activity {
+
+ private static final int LOGIN_REQUEST_CODE = 1;
+ private TextView mTextView;
+ private boolean mIsResult;
+ private BeemApplication mBeemApplication;
+
+ /**
+ * Constructor.
+ */
+ public Login() {
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
+ Application app = getApplication();
+ if (app instanceof BeemApplication) {
+ mBeemApplication = (BeemApplication) app;
+ if (mBeemApplication.isConnected()) {
+ startActivity(new Intent(this, ContactList.class));
+ finish();
+ } else if (!mBeemApplication.isAccountConfigured()) {
+ startActivity(new Intent(this, Account.class));
+ finish();
+ }
+ }
+ setContentView(R.layout.login);
+ mTextView = (TextView) findViewById(R.id.log_as_msg);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ if (mBeemApplication.isAccountConfigured() && !mIsResult
+ && BeemConnectivity.isConnected(getApplicationContext())) {
+ mTextView.setText("");
+ Intent i = new Intent(this, LoginAnim.class);
+ startActivityForResult(i, LOGIN_REQUEST_CODE);
+ mIsResult = false;
+ } else {
+ mTextView.setText(R.string.login_start_msg);
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == LOGIN_REQUEST_CODE) {
+ mIsResult = true;
+ if (resultCode == Activity.RESULT_OK) {
+ startActivity(new Intent(this, ContactList.class));
+ finish();
+ } else if (resultCode == Activity.RESULT_CANCELED) {
+ if (data != null) {
+ String tmp = data.getExtras().getString("message");
+ Toast.makeText(Login.this, tmp, Toast.LENGTH_SHORT).show();
+ mTextView.setText(tmp);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.login, menu);
+ return true;
+ }
+
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ boolean result;
+ switch (item.getItemId()) {
+ case R.id.login_menu_settings:
+ mTextView.setText("");
+ startActivity(new Intent(Login.this, Settings.class));
+ result = true;
+ break;
+ case R.id.login_menu_about:
+ createAboutDialog();
+ result = true;
+ break;
+ case R.id.login_menu_login:
+ if (mBeemApplication.isAccountConfigured()) {
+ Intent i = new Intent(this, LoginAnim.class);
+ startActivityForResult(i, LOGIN_REQUEST_CODE);
+ }
+ result = true;
+ break;
+ default:
+ result = false;
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * Create an about "BEEM" dialog.
+ */
+ private void createAboutDialog() {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ String versionname;
+ try {
+ PackageManager pm = getPackageManager();
+ PackageInfo pi = pm.getPackageInfo("com.beem.project.beem", 0);
+ versionname = pi.versionName;
+ } catch (PackageManager.NameNotFoundException e) {
+ versionname = "";
+ }
+ String title = getString(R.string.login_about_title, versionname);
+ builder.setTitle(title).setMessage(R.string.login_about_msg).setCancelable(false);
+ builder.setNeutralButton(R.string.login_about_button, new DialogInterface.OnClickListener() {
+
+ public void onClick(DialogInterface dialog, int whichButton) {
+ dialog.cancel();
+ }
+ });
+ AlertDialog aboutDialog = builder.create();
+ aboutDialog.show();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/LoginAnim.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,269 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui;
+
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.LoginAsyncTask;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+
+import de.duenndns.ssl.MemorizingTrustManager;
+
+/**
+ * This class is an activity which display an animation during the connection with the server.
+ * @author Da Risk <darisk972@gmail.com>
+ */
+public class LoginAnim extends Activity {
+
+ private static final String TAG = "LoginAnim";
+ private static final Intent SERVICE_INTENT = new Intent();
+ private static final int RECEIVER_PRIORITY = 50;
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+ private ImageView mLogo;
+ private Animation mRotateAnim;
+ private final ServiceConnection mServConn = new LoginServiceConnection();
+ private IXmppFacade mXmppFacade;
+ private AsyncTask<IXmppFacade, Integer, Boolean> mTask;
+ private Button mCancelBt;
+ private TextView mLoginState;
+ private boolean mBinded;
+ private BroadcastReceiver mSslReceiver;
+
+ /**
+ * Constructor.
+ */
+ public LoginAnim() {
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onCreate(android.os.Bundle)
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.login_anim);
+ mLoginState = (TextView) findViewById(R.id.loginanim_status_text);
+ mLogo = (ImageView) findViewById(R.id.loginanim_logo_anim);
+ mRotateAnim = AnimationUtils.loadAnimation(this, R.anim.rotate_and_scale);
+ mCancelBt = (Button) findViewById(R.id.loginanim_cancel_button);
+ mCancelBt.setOnClickListener(new ClickListener());
+ mSslReceiver = new BroadcastReceiver() {
+ public void onReceive(Context ctx, Intent i) {
+ try {
+ Log.i(TAG, "Interception the SSL notification");
+ PendingIntent pi = i.getParcelableExtra(MemorizingTrustManager.INTERCEPT_DECISION_INTENT_LAUNCH);
+ pi.send();
+ abortBroadcast();
+ } catch (PendingIntent.CanceledException e) {
+ Log.e(TAG, "Error while displaying the SSL dialog", e);
+ }
+ }
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onStart()
+ */
+ @Override
+ protected void onStart() {
+ super.onStart();
+ mLogo.startAnimation(mRotateAnim);
+ if (mTask == null)
+ mTask = new LoginTask();
+ if (!mBinded)
+ mBinded = bindService(LoginAnim.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+ IntentFilter filter = new IntentFilter(MemorizingTrustManager.INTERCEPT_DECISION_INTENT
+ + "/" + getPackageName());
+ filter.setPriority(RECEIVER_PRIORITY);
+ registerReceiver(mSslReceiver, filter);
+
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onPause()
+ */
+ @Override
+ protected void onStop() {
+ super.onStop();
+ if (mBinded && mTask.getStatus() != AsyncTask.Status.RUNNING) {
+ unbindService(mServConn);
+ mXmppFacade = null;
+ mBinded = false;
+ }
+ unregisterReceiver(mSslReceiver);
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onKeyDown(int, android.view.KeyEvent)
+ */
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ // TODO use onBackPressed on Eclair (2.0)
+ if (keyCode == KeyEvent.KEYCODE_BACK && mTask.getStatus() != AsyncTask.Status.FINISHED) {
+ if (!mTask.cancel(true)) {
+ Log.d(TAG, "Can't interrupt the connection");
+ }
+ setResult(Activity.RESULT_CANCELED);
+ }
+ return super.onKeyDown(keyCode, event);
+ }
+
+ /**
+ * Click event listener on cancel button.
+ */
+ private class ClickListener implements OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ ClickListener() {
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == mCancelBt) {
+ if (!mTask.cancel(true)) {
+ Log.d(TAG, "Can't interrupt the connection");
+ }
+ setResult(Activity.RESULT_CANCELED);
+ finish();
+ }
+ }
+ }
+
+ /**
+ * Asynchronous class for connection.
+ */
+ private class LoginTask extends LoginAsyncTask {
+
+ /**
+ * Constructor.
+ */
+ LoginTask() {
+ }
+
+ /* (non-Javadoc)
+ * @see android.os.AsyncTask#onPostExecute(java.lang.Object)
+ */
+ @Override
+ protected void onPostExecute(Boolean result) {
+
+ if (result == null || !result) { // Task cancelled or exception
+ if (!result) {
+ Intent i = new Intent();
+ i.putExtra("message", getErrorMessage());
+ LoginAnim.this.setResult(Activity.RESULT_CANCELED, i);
+ } else
+ LoginAnim.this.setResult(Activity.RESULT_CANCELED);
+ LoginAnim.this.finish();
+ } else {
+ mCancelBt.setEnabled(false);
+ LoginAnim.this.startService(LoginAnim.SERVICE_INTENT);
+ LoginAnim.this.setResult(Activity.RESULT_OK);
+ LoginAnim.this.finish();
+ }
+ }
+
+ @Override
+ protected void onProgressUpdate(Integer ... values) {
+ mLoginState.setText(getResources().getStringArray(R.array.loganim_state)[values[0]]);
+ }
+
+ /* (non-Javadoc)
+ * @see android.os.AsyncTask#onCancelled()
+ */
+ @Override
+ protected void onCancelled() {
+ super.onCancelled();
+ LoginAnim.this.stopService(LoginAnim.SERVICE_INTENT);
+ }
+
+ }
+
+ /**
+ * The service connection used to connect to the Beem service.
+ */
+ private class LoginServiceConnection implements ServiceConnection {
+
+ /**
+ * Constructor.
+ */
+ public LoginServiceConnection() {
+ }
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
+ if (mTask.getStatus() == AsyncTask.Status.PENDING)
+ mTask = mTask.execute(mXmppFacade);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mXmppFacade = null;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/PrivacyList.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,361 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Dialog;
+import android.app.ListActivity;
+import android.content.ComponentName;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.content.DialogInterface.OnDismissListener;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.ContextMenu;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.PrivacyListItem;
+import com.beem.project.beem.service.aidl.IPrivacyListListener;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.ui.dialogs.builders.CreatePrivacyList;
+import com.beem.project.beem.ui.dialogs.builders.DeletePrivacyList;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+
+/**
+ * This class represents an activity which allows the user to manage his privacy lists.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class PrivacyList extends ListActivity {
+
+ private static final String TAG = "PrivacyList";
+ private static final Intent SERVICE_INTENT = new Intent();
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ private static final int DIALOG_CREATE = 0;
+ private static final int DIALOG_UPDATE_BUDDIES = 1;
+ private static final int DIALOG_UPDATE_GROUPS = 2;
+ private static final int DIALOG_DELETE = 3;
+
+ private static final String SAVED_INSTANCE_KEY_PRIVACY_LISTS = "PRIVACY_LISTS";
+
+ private Handler mHandler = new Handler();
+
+ private ArrayAdapter<String> mAdapter;
+ private final List<String> mPrivacyListNames = new ArrayList<String>();
+ private String mCurrPrivacyListName;
+
+ private final ServiceConnection mConn = new BeemServiceConnection();
+ private final BeemBroadcastReceiver mBroadcastReceiver = new BeemBroadcastReceiver();
+
+ private IPrivacyListManager mPrivacyListManager;
+ private IPrivacyListListener mPrivacyListListener;
+
+ /**
+ * Constructor.
+ */
+ public PrivacyList() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onSaveInstanceState(Bundle savedInstanceState) {
+ Log.d(TAG, "BEGIN onSaveInstanceState.");
+ savedInstanceState.putStringArrayList(SAVED_INSTANCE_KEY_PRIVACY_LISTS, (ArrayList<String>) mPrivacyListNames);
+ Log.d(TAG, "END onSaveInstanceState.");
+ super.onSaveInstanceState(savedInstanceState);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Log.d(TAG, "BEGIN onCreate.");
+
+ setContentView(R.layout.privacy_list);
+ registerForContextMenu(this.getListView());
+
+ mHandler = new Handler();
+
+ if (savedInstanceState != null && !savedInstanceState.isEmpty()) {
+ mPrivacyListNames.addAll(savedInstanceState.getStringArrayList(SAVED_INSTANCE_KEY_PRIVACY_LISTS));
+ }
+
+ mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mPrivacyListNames);
+ setListAdapter(mAdapter);
+
+ bindService(SERVICE_INTENT, mConn, BIND_AUTO_CREATE);
+
+ mPrivacyListListener = new PrivacyListListener();
+ this.registerReceiver(mBroadcastReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+
+ Log.d(TAG, "END onCreate.");
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ Log.v(TAG, "BEGIN onDestroy.");
+
+ if (mPrivacyListManager != null) {
+ try {
+ mPrivacyListManager.removePrivacyListListener(mPrivacyListListener);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ this.unregisterReceiver(mBroadcastReceiver);
+ unbindService(mConn);
+
+ Log.v(TAG, "END onDestroy.");
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onStart() {
+ super.onStart();
+
+ Log.v(TAG, "BEGIN onStart.");
+ Log.v(TAG, "END onStart.");
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected void onStop() {
+ super.onStop();
+
+ Log.v(TAG, "BEGIN onStop.");
+ Log.v(TAG, "END onStop.");
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ protected Dialog onCreateDialog(int id) {
+ Dialog dialog;
+ switch (id) {
+ case DIALOG_CREATE:
+ dialog = new CreatePrivacyList(PrivacyList.this, mPrivacyListManager).create();
+ dialog.setOnDismissListener(new OnDismissListener() {
+
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ PrivacyList.this.removeDialog(DIALOG_CREATE);
+ }
+ });
+ break;
+ case DIALOG_DELETE:
+ dialog = new DeletePrivacyList(PrivacyList.this, mPrivacyListManager, mCurrPrivacyListName).create();
+ dialog.setOnDismissListener(new OnDismissListener() {
+
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ PrivacyList.this.removeDialog(DIALOG_DELETE);
+ }
+
+ });
+ break;
+ default:
+ dialog = null;
+ }
+ return dialog;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public final boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.privacy_list, menu);
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ super.onCreateContextMenu(menu, v, menuInfo);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.privacy_list_context, menu);
+ mCurrPrivacyListName = mPrivacyListNames.get(((AdapterView.AdapterContextMenuInfo) menuInfo).position);
+ menu.setHeaderTitle(mCurrPrivacyListName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.privacy_list_context_menu_buddies_item:
+ return true;
+ case R.id.privacy_list_context_menu_groups_item:
+ return true;
+ case R.id.privacy_list_context_menu_delete_item:
+ showDialog(DIALOG_DELETE);
+ return true;
+ default:
+ return super.onContextItemSelected(item);
+ }
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.privacy_list_menu_create:
+ showDialog(DIALOG_CREATE);
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Service connection.
+ * @author jamu
+ */
+ private final class BeemServiceConnection implements ServiceConnection {
+
+ private IXmppFacade mXmppFacade;
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ Log.v(TAG, "BEGIN onServiceConnected.");
+ mXmppFacade = IXmppFacade.Stub.asInterface(service);
+ try {
+ mPrivacyListManager = mXmppFacade.getPrivacyListManager();
+ mPrivacyListManager.addPrivacyListListener(mPrivacyListListener);
+ mPrivacyListNames.clear();
+ mPrivacyListNames.addAll(mPrivacyListManager.getPrivacyLists());
+ mAdapter.notifyDataSetChanged();
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ Log.v(TAG, "END onServiceConnected.");
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ Log.v(TAG, "BEGIN onServiceDisconnected.");
+ mXmppFacade = null;
+ try {
+ mPrivacyListManager.removePrivacyListListener(mPrivacyListListener);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ Log.v(TAG, "END onServiceDisconnected.");
+ }
+ }
+
+ /**
+ * Listener.
+ * @author jamu
+ */
+ private class PrivacyListListener extends IPrivacyListListener.Stub {
+
+ @Override
+ public void setPrivacyList(String listName, List<PrivacyListItem> listItem) throws RemoteException {
+ Log.d(TAG, "BEGIN PrivacyListListener >> setPrivacyList.");
+ Log.d(TAG, "> " + listName + " has been setted.");
+ Log.d(TAG, "END PrivacyListListener >> setPrivacyList.");
+ }
+
+ @Override
+ public void updatedPrivacyList(final String listName) throws RemoteException {
+ Log.d(TAG, "BEGIN PrivacyListListener >> updatedPrivacyList.");
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ mPrivacyListNames.clear();
+ // Not that much lists and require some server queries to know if the list has been
+ // updated/deleted or set to default/active by this activity or another IM client.
+ mPrivacyListNames.addAll(mPrivacyListManager.getPrivacyLists());
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ mAdapter.notifyDataSetChanged();
+ }
+ });
+ Log.d(TAG, "END PrivacyListListener >> updatedPrivacyList.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/Settings.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,120 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.R;
+import com.beem.project.beem.ui.wizard.Account;
+
+/**
+ * This class represents an activity which allows the user to change his account or proxy parameters.
+ */
+public class Settings extends PreferenceActivity {
+
+ private static final Intent SERVICE_INTENT = new Intent();
+
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ /**
+ * Constructor.
+ */
+ public Settings() {
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.preferences);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ String accountName = getPreferenceManager().getDefaultSharedPreferences(this)
+ .getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
+ Preference account = findPreference(BeemApplication.ACCOUNT_USERNAME_KEY);
+ account.setSummary(accountName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater mInflater = getMenuInflater();
+ mInflater.inflate(R.menu.edit_settings, menu);
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ Intent i = null;
+ switch (item.getItemId()) {
+ case R.id.settings_menu_create_account:
+ i = new Intent(this, Account.class);
+ startActivity(i);
+ return true;
+ case R.id.settings_menu_privacy_lists:
+ i = new Intent(this, PrivacyList.class);
+ startActivity(i);
+ return true;
+ default:
+ return false;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/Subscription.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,208 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui;
+
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Type;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.PresenceAdapter;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.utils.BeemBroadcastReceiver;
+
+/**
+ * This activity is used to accept a subscription request.
+ * @author nikita
+ */
+public class Subscription extends Activity {
+
+ private static final Intent SERVICE_INTENT = new Intent();
+ private static final String TAG = Subscription.class.getSimpleName();
+ private IXmppFacade mService;
+ private String mContact;
+ private ServiceConnection mServConn = new BeemServiceConnection();
+ private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
+ private MyOnClickListener mClickListener = new MyOnClickListener();
+
+ static {
+ SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+ }
+
+ /**
+ * Constructor.
+ */
+ public Subscription() {
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onCreate(android.os.Bundle)
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.subscription);
+ findViewById(R.id.SubscriptionAccept).setOnClickListener(mClickListener);
+ findViewById(R.id.SubscriptionRefuse).setOnClickListener(mClickListener);
+ Contact c = new Contact(getIntent().getData());
+ mContact = c.getJID();
+ TextView tv = (TextView) findViewById(R.id.SubscriptionText);
+ String str = String.format(getString(R.string.SubscriptText), mContact);
+ tv.setText(str);
+ this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onResume()
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onPause()
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ unbindService(mServConn);
+ }
+
+ /* (non-Javadoc)
+ * @see android.app.Activity#onDestroy()
+ */
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ this.unregisterReceiver(mReceiver);
+ }
+
+ /**
+ * Send the presence stanza.
+ *
+ * @param p presence stanza
+ */
+ private void sendPresence(Presence p) {
+ PresenceAdapter preAdapt = new PresenceAdapter(p);
+ try {
+ mService.sendPresencePacket(preAdapt);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error while sending subscription response", e);
+ }
+ }
+
+ /**
+ * Event simple click on buttons.
+ */
+ private class MyOnClickListener implements OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public MyOnClickListener() {
+ }
+
+ @Override
+ public void onClick(View v) {
+ Presence presence = null;
+ switch (v.getId()) {
+ case R.id.SubscriptionAccept:
+ presence = new Presence(Type.subscribed);
+ Toast.makeText(Subscription.this, getString(R.string.SubscriptAccept), Toast.LENGTH_SHORT)
+ .show();
+ break;
+ case R.id.SubscriptionRefuse:
+ presence = new Presence(Type.unsubscribed);
+ Toast.makeText(Subscription.this, getString(R.string.SubscriptRefused), Toast.LENGTH_SHORT).show();
+ break;
+ default:
+ Toast.makeText(Subscription.this, getString(R.string.SubscriptError), Toast.LENGTH_SHORT).show();
+ }
+ if (presence != null) {
+ presence.setTo(mContact);
+ sendPresence(presence);
+ }
+ finish();
+ }
+ };
+
+ /**
+ * The ServiceConnection used to connect to the Beem service.
+ */
+ private class BeemServiceConnection implements ServiceConnection {
+
+ /**
+ * Constructor.
+ */
+ public BeemServiceConnection() {
+ }
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mService = IXmppFacade.Stub.asInterface(service);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ mService = null;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/dialogs/builders/Alias.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,121 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.dialogs.builders;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.EditText;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.aidl.IRoster;
+
+/**
+ * Create dialog alias.
+ */
+public class Alias extends AlertDialog.Builder {
+
+ private static final String TAG = "Dialogs.Builders > Alias";
+
+ private IRoster mRoster;
+ private Contact mContact;
+ private EditText mEditTextAlias;
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ * @param roster Beem roster.
+ * @param contact the contact to modify.
+ */
+ public Alias(final Context context, final IRoster roster, final Contact contact) {
+ super(context);
+
+ mRoster = roster;
+ mContact = contact;
+
+ LayoutInflater factory = LayoutInflater.from(context);
+ final View textEntryView = factory.inflate(
+ R.layout.contactdialogaliasdialog, null);
+ setTitle(mContact.getJID());
+ setView(textEntryView);
+ mEditTextAlias = (EditText) textEntryView.findViewById(
+ R.id.CDAliasDialogName);
+ mEditTextAlias.setText(mContact.getName());
+ setPositiveButton(R.string.OkButton, new DialogClickListener());
+ setNegativeButton(R.string.CancelButton, new DialogClickListener());
+ }
+
+ /**
+ * Event click listener.
+ */
+ class DialogClickListener implements DialogInterface.OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public DialogClickListener() {
+ }
+
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ String name = mEditTextAlias.getText().toString();
+ if (name.length() == 0) {
+ name = mContact.getJID();
+ }
+ try {
+ mRoster.setContactName(mContact.getJID(), name);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/dialogs/builders/ChatList.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,90 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.dialogs.builders;
+
+import java.util.List;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+
+/**
+ * Create the change chat dialog.
+ */
+public class ChatList extends AlertDialog.Builder {
+
+ //private static final String TAG = "Dialogs.Builders > Chat list";
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ * @param openedChats A list containing the JID of participants of the opened chats.
+ */
+ public ChatList(final Context context, final List<Contact> openedChats) {
+ super(context);
+
+ if (openedChats.size() > 0) {
+ CharSequence[] items = new CharSequence[openedChats.size()];
+
+ int i = 0;
+ for (Contact c : openedChats) {
+ items[i++] = c.getName();
+ }
+ setTitle(R.string.chat_dialog_change_chat_title);
+ setItems(items, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int item) {
+ Intent chatIntent = new Intent(context, com.beem.project.beem.ui.Chat.class);
+ chatIntent.setData((openedChats.get(item)).toUri());
+ context.startActivity(chatIntent);
+ }
+ });
+ } else {
+ setMessage(R.string.chat_no_more_chats);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/dialogs/builders/CreatePrivacyList.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,120 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.dialogs.builders;
+
+import java.util.ArrayList;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.EditText;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.PrivacyListItem;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
+
+/**
+ * Use this builder to build a dialog which handles a privacy list creation.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class CreatePrivacyList extends AlertDialog.Builder {
+
+ private static final String TAG = "Dialogs.Builders > CreatePrivacyList";
+
+ private final IPrivacyListManager mPrivacyListManager;
+ private final View mTextEntryView;
+ private EditText mListNameField;
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ * @param privacyListManager the privacy list manager that will be use to create our list.
+ */
+ public CreatePrivacyList(final Context context, final IPrivacyListManager privacyListManager) {
+ super(context);
+
+ LayoutInflater factory = LayoutInflater.from(context);
+
+ mTextEntryView = factory.inflate(R.layout.privacy_list_create_dialog, null);
+ setView(mTextEntryView);
+
+ mPrivacyListManager = privacyListManager;
+ mListNameField = (EditText) mTextEntryView.findViewById(R.id.privacy_list_create_dialog_list_name);
+
+ setTitle(R.string.privacy_list_create_dialog_title);
+ setPositiveButton(R.string.privacy_list_create_dialog_create_button, new DialogClickListener());
+ setNegativeButton(R.string.CancelButton, new DialogClickListener());
+ }
+
+ /**
+ * Event click listener.
+ */
+ class DialogClickListener implements DialogInterface.OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public DialogClickListener() {
+ }
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ try {
+ Log.d(TAG, "mPrivacyListManager ## " + mPrivacyListManager);
+ Log.d(TAG, "listNameField ## " + mListNameField);
+ Log.d(TAG, "listNameField.getText().toString() ## " + mListNameField.getText().toString());
+ mPrivacyListManager.createPrivacyList(mListNameField.getText().toString(),
+ new ArrayList<PrivacyListItem>());
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/dialogs/builders/DeleteContact.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,107 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.dialogs.builders;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+import android.util.Log;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.aidl.IRoster;
+
+/**
+ * Use this builder to build a dialog which allows you to delete a contact from a specific roster.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class DeleteContact extends AlertDialog.Builder {
+
+ private static final String TAG = "Dialogs.Builders > DeleteContact";
+
+ private IRoster mRoster;
+ private Contact mContact;
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ * @param roster the roster which has the contact you want to delete.
+ * @param contact the contact to delete.
+ */
+ public DeleteContact(final Context context, final IRoster roster, final Contact contact) {
+ super(context);
+
+ mContact = contact;
+ mRoster = roster;
+
+ setMessage(R.string.userinfo_sure2delete);
+ DialogClickListener dl = new DialogClickListener();
+ setPositiveButton(R.string.userinfo_yes, dl);
+ setNegativeButton(R.string.userinfo_no, dl);
+ }
+
+ /**
+ * Event click listener.
+ */
+ private class DialogClickListener implements DialogInterface.OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public DialogClickListener() {
+ }
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ try {
+ mRoster.deleteContact(mContact);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/dialogs/builders/DeletePrivacyList.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,107 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.dialogs.builders;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+import android.util.Log;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.aidl.IPrivacyListManager;
+
+/**
+ * Use this builder to build a dialog which allows you to delete a privacy list.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class DeletePrivacyList extends AlertDialog.Builder {
+
+ private static final String TAG = "Dialogs.Builders > DeletePrivacyList";
+
+ private final IPrivacyListManager mPrivacyListManager;
+ private final String mPrivacyListName;
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ * @param privacyListManager the privacy list manager managing the privacy list you want to delete.
+ * @param privacyListName the name of the privacy list you want to delete.
+ */
+ public DeletePrivacyList(final Context context, final IPrivacyListManager privacyListManager,
+ final String privacyListName) {
+ super(context);
+
+ mPrivacyListManager = privacyListManager;
+ mPrivacyListName = privacyListName;
+
+ setMessage(context.getString(R.string.privacy_list_delete_dialog_msg, privacyListName));
+ DialogClickListener dl = new DialogClickListener();
+ setPositiveButton(R.string.privacy_list_delete_dialog_yes, dl);
+ setNegativeButton(R.string.privacy_list_delete_dialog_no, dl);
+ }
+
+ /**
+ * Event click listener.
+ */
+ private class DialogClickListener implements DialogInterface.OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public DialogClickListener() {
+ }
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ try {
+ mPrivacyListManager.removePrivacyList(mPrivacyListName);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/dialogs/builders/DisplayOtrFingerprint.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,111 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.dialogs.builders;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.aidl.IChat;
+
+/**
+ * Use this builder to build a dialog which allows you to display otr fingerprints.
+ * @author nikita
+ */
+public class DisplayOtrFingerprint extends AlertDialog.Builder {
+
+ private static final String TAG = "DisplayOtrFingerprint";
+ private IChat mChat;
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ * @param chat the current chat.
+ */
+ public DisplayOtrFingerprint(final Context context, final IChat chat) {
+ super(context);
+
+ mChat = chat;
+ try {
+ setMessage(context.getString(R.string.chat_otr_verify_key, chat.getLocalOtrFingerprint(),
+ chat.getRemoteOtrFingerprint()));
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ DialogClickListener dl = new DialogClickListener();
+ setPositiveButton(R.string.userinfo_yes, dl);
+ setNegativeButton(R.string.userinfo_no, dl);
+ }
+
+ /**
+ * Event click listener.
+ */
+ private class DialogClickListener implements DialogInterface.OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ public DialogClickListener() {
+ }
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ try {
+ mChat.verifyRemoteFingerprint(true);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ } else if (which == DialogInterface.BUTTON_NEGATIVE) {
+ try {
+ mChat.verifyRemoteFingerprint(false);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/dialogs/builders/ResendSubscription.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,117 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.dialogs.builders;
+
+import org.jivesoftware.smack.packet.Presence;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.RemoteException;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.PresenceAdapter;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+
+/**
+ * Use this builder to build a dialog which allows you resend a subscription query to a contact.
+ * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
+ */
+public class ResendSubscription extends AlertDialog.Builder {
+
+ private static final String TAG = "Dialogs.Builders > ResendSubscription";
+
+ private Context mContext;
+ private IXmppFacade mXmppFacade;
+ private Contact mContact;
+
+ /**
+ * Constructor.
+ * @param context context activity.
+ * @param xmppFacade the XMPP Facade used to send the query.
+ * @param contact the receiver of the query.
+ */
+ public ResendSubscription(final Context context, final IXmppFacade xmppFacade, final Contact contact) {
+ super(context);
+
+ mContext = context;
+ mXmppFacade = xmppFacade;
+ mContact = contact;
+
+ setMessage(R.string.userinfo_sureresend);
+ DialogClickListener dl = new DialogClickListener();
+ setPositiveButton(R.string.userinfo_yes, dl);
+ setNegativeButton(R.string.userinfo_no, dl);
+ }
+
+ /**
+ * Event click listener.
+ */
+ class DialogClickListener implements DialogInterface.OnClickListener {
+
+ /**
+ * Constructor.
+ */
+ DialogClickListener() {
+ }
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
+ Presence presencePacket = new Presence(Presence.Type.subscribe);
+ presencePacket.setTo(mContact.getJID());
+ try {
+ mXmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket));
+ Toast.makeText(mContext, mContext.getString(R.string.userinfo_resend), Toast.LENGTH_SHORT).show();
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/dialogs/builders/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,48 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+/**
+ * This package contains Beem dialog builder's.
+ */
+package com.beem.project.beem.ui.dialogs.builders;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,47 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+*/
+/**
+ * This package contains the different activity displayed by BEEM and other class useful to make the UI.
+ */
+package com.beem.project.beem.ui;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/views/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,31 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+/**
+ * This package contains the custom View used by Beem to make the user interfaces.
+ */
+package com.beem.project.beem.ui.views;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/wizard/Account.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,169 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.wizard;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.RadioGroup;
+
+import com.beem.project.beem.R;
+
+/**
+ * The first activity of an user friendly wizard to configure a XMPP account.
+ */
+public class Account extends FragmentActivity {
+
+ private static final String TAG = Account.class.getSimpleName();
+
+ private FragmentManager fragmentMgr;
+
+ /**
+ * Constructor.
+ */
+ public Account() {
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ fragmentMgr = getSupportFragmentManager();
+ if (savedInstanceState == null) {
+ FragmentTransaction t = fragmentMgr.beginTransaction();
+ t.add(android.R.id.content, MainFragment.newInstance(), "Main");
+ t.commit();
+
+ }
+ }
+
+ /**
+ * Callback called when the create account option is selected.
+ *
+ */
+ public void onCreateAccountSelected() {
+ Fragment f = CreateAccountFragment.newInstance();
+ FragmentTransaction transaction = fragmentMgr.beginTransaction();
+
+ transaction.replace(android.R.id.content, f, "createAccount");
+ transaction.addToBackStack(null);
+ transaction.commit();
+ }
+
+ /**
+ * Callback called when the configure account option is selected.
+ *
+ */
+ public void onConfigureAccountSelected() {
+ Fragment f = AccountConfigureFragment.newInstance();
+ FragmentTransaction transaction = fragmentMgr.beginTransaction();
+
+ transaction.replace(android.R.id.content, f, "configureAccount");
+ transaction.addToBackStack(null);
+ transaction.commit();
+ }
+
+ /**
+ * Main fragment of the wizard account activity.
+ */
+ public static class MainFragment extends Fragment implements OnClickListener, RadioGroup.OnCheckedChangeListener {
+ private RadioGroup mConfigureGroup;
+ private Button mNextButton;
+
+ private Account activity;
+
+ /**
+ * Create a new MainFragment.
+ *
+ * @return a MainFragment
+ */
+ static MainFragment newInstance() {
+ return new MainFragment();
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View v = inflater.inflate(R.layout.wizard_account_main_fragment, container, false);
+ mNextButton = (Button) v.findViewById(R.id.next);
+ mNextButton.setOnClickListener(this);
+ mConfigureGroup = (RadioGroup) v.findViewById(R.id.configure_group);
+ mConfigureGroup.setOnCheckedChangeListener(this);
+ return v;
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ this.activity = (Account) activity;
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == mNextButton) {
+ int selectedid = mConfigureGroup.getCheckedRadioButtonId();
+ if (selectedid == R.id.configure_account) {
+ activity.onConfigureAccountSelected();
+ } else if (selectedid == R.id.create_account) {
+ activity.onCreateAccountSelected();
+ }
+ }
+ }
+
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ if (checkedId == -1)
+ mNextButton.setEnabled(false);
+ else
+ mNextButton.setEnabled(true);
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/wizard/AccountConfigureFragment.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,530 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.ui.wizard;
+
+import android.accounts.AccountManager;
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.support.v4.app.DialogFragment;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.InputFilter;
+import android.text.LoginFilter;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.R;
+import com.beem.project.beem.ui.Login;
+import com.beem.project.beem.ui.Settings;
+
+import org.jivesoftware.smack.Connection;
+import org.jivesoftware.smack.ConnectionConfiguration;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.proxy.ProxyInfo;
+import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
+import org.jivesoftware.smack.util.StringUtils;
+
+/**
+ * Fragment to enter the information required in order to configure a XMPP account.
+ *
+ */
+public class AccountConfigureFragment extends Fragment implements OnClickListener {
+
+ private static final String TAG = AccountConfigureFragment.class.getSimpleName();
+
+ private static final String GOOGLE_ACCOUNT_TYPE = "com.google";
+ private static final int SELECT_ACCOUNT_CODE = 1;
+ private static final int MANUAL_CONFIGURATION_CODE = 2;
+
+ private Button mNextButton;
+ private Button mManualConfigButton;
+ private Button mSelectAccountButton;
+ private TextView mErrorLabel;
+ private TextView mSettingsWarningLabel;
+ private EditText mAccountJID;
+ private EditText mAccountPassword;
+ private final JidTextWatcher mJidTextWatcher = new JidTextWatcher();
+ private final PasswordTextWatcher mPasswordTextWatcher = new PasswordTextWatcher();
+ private boolean mValidJid;
+ private boolean mValidPassword;
+ private String mSelectedAccountName;
+ private String mSelectedAccountType;
+ private SharedPreferences settings;
+ private boolean useSystemAccount;
+
+ private com.beem.project.beem.ui.wizard.AccountConfigureFragment.ConnectionTestTask task;
+
+ /**
+ * Create a new AccountConfigureFragment.
+ *
+ * @return a new AccountConfigureFragment
+ */
+ public static AccountConfigureFragment newInstance() {
+ return new AccountConfigureFragment();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Log.d(TAG, "onCreate");
+ setRetainInstance(true);
+
+ settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View v = inflater.inflate(R.layout.wizard_account_configure, container, false);
+ mManualConfigButton = (Button) v.findViewById(R.id.manual_setup);
+ mManualConfigButton.setOnClickListener(this);
+ mNextButton = (Button) v.findViewById(R.id.next);
+ mNextButton.setOnClickListener(this);
+ mSelectAccountButton = (Button) v.findViewById(R.id.select_account_btn);
+ mSelectAccountButton.setOnClickListener(this);
+ mErrorLabel = (TextView) v.findViewById(R.id.error_label);
+ mSettingsWarningLabel = (TextView) v.findViewById(R.id.settings_warn_label);
+ mAccountJID = (EditText) v.findViewById(R.id.account_username);
+ mAccountPassword = (EditText) v.findViewById(R.id.account_password);
+ InputFilter[] orgFilters = mAccountJID.getFilters();
+ InputFilter[] newFilters = new InputFilter[orgFilters.length + 1];
+ int i;
+ for (i = 0; i < orgFilters.length; i++)
+ newFilters[i] = orgFilters[i];
+ newFilters[i] = new LoginFilter.UsernameFilterGeneric();
+ mAccountJID.setFilters(newFilters);
+ mAccountJID.addTextChangedListener(mJidTextWatcher);
+ mAccountPassword.addTextChangedListener(mPasswordTextWatcher);
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) // true to disable the feature until ready
+ v.findViewById(R.id.account_layout).setVisibility(View.GONE);
+ return v;
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ useSystemAccount = settings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
+ // temporaly disable jid watcher
+ mAccountJID.removeTextChangedListener(mJidTextWatcher);
+ mAccountJID.setText(settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, ""));
+ if (useSystemAccount) {
+ mAccountPassword.setText("*******"); //dummy password
+ mAccountJID.setText(settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, ""));
+ mAccountPassword.setEnabled(false);
+ mNextButton.setEnabled(true);
+ }
+ mAccountJID.addTextChangedListener(mJidTextWatcher);
+ if (settings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false)
+ || settings.getBoolean(BeemApplication.PROXY_USE_KEY, false)) {
+ mSettingsWarningLabel.setVisibility(View.VISIBLE);
+ } else
+ mSettingsWarningLabel.setVisibility(View.GONE);
+
+ }
+
+ @TargetApi(14)
+ @Override
+ public void onClick(View v) {
+ if (v == mNextButton) {
+ if (useSystemAccount) {
+ onDeviceAccountSelected(settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, ""),
+ settings.getString(BeemApplication.ACCOUNT_SYSTEM_TYPE_KEY, ""));
+ } else {
+ String jid = mAccountJID.getText().toString();
+ jid = StringUtils.parseBareAddress(jid);
+ String password = mAccountPassword.getText().toString();
+ task = new ConnectionTestTask();
+ if (settings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false)) {
+ String server = settings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_HOST_KEY, "");
+ String port = settings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_PORT_KEY, "5222");
+ task.execute(jid, password, server, port);
+ } else
+ task.execute(jid, password);
+ }
+ } else if (v == mManualConfigButton) {
+ onManualConfigurationSelected();
+ } else if (v == mSelectAccountButton) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ Intent i = AccountManager.newChooseAccountIntent(null, null,
+ new String[] {GOOGLE_ACCOUNT_TYPE}, true, null, null, null, null);
+ startActivityForResult(i, SELECT_ACCOUNT_CODE);
+ }
+ }
+ }
+
+ /**
+ * Callback called when the Manual configuration button is selected.
+ *
+ */
+ public void onManualConfigurationSelected() {
+ Intent i = new Intent(getActivity(), Settings.class);
+ i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivityForResult(i, MANUAL_CONFIGURATION_CODE);
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == SELECT_ACCOUNT_CODE && resultCode == Activity.RESULT_OK) {
+ mSelectedAccountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
+ mSelectedAccountType = data.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE);
+ onDeviceAccountSelected(mSelectedAccountName, mSelectedAccountType);
+ } else if (requestCode == MANUAL_CONFIGURATION_CODE) {
+ String login = settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
+ String password = settings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
+ mAccountJID.setText(login);
+ mAccountPassword.setText(password);
+ } else {
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+ }
+
+ /**
+ * Callback called when the account was connected successfully.
+ *
+ * @param jid the jid used to connect
+ * @param password the password used to connect
+ *
+ */
+ private void onAccountConnectionSuccess(String jid, String password) {
+ Activity a = getActivity();
+ saveCredential(jid, password);
+ // launch login
+ Intent i = new Intent(a, Login.class);
+ i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ a.finish();
+ }
+
+ /**
+ * Callback called when the account connection failed.
+ *
+ */
+ private void onAccountConnectionFailed() {
+ mAccountPassword.setText("");
+ mErrorLabel.setVisibility(View.VISIBLE);
+ }
+
+ /**
+ * Callback called when the user select an account from the device (Android Account api).
+ *
+ * @param accountName the account name
+ * @param accountType the account type
+ *
+ */
+ private void onDeviceAccountSelected(String accountName, String accountType) {
+ Activity a = getActivity();
+ saveCredentialAccount(accountName, accountType);
+ // launch login
+ Intent i = new Intent(a, Login.class);
+ i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ a.finish();
+ }
+
+ /**
+ * Save the user credentials.
+ *
+ * @param jid the jid of the user
+ * @param pass the password of the user
+ *
+ */
+ private void saveCredential(String jid, String pass) {
+ SharedPreferences.Editor edit = settings.edit();
+ edit.putString(BeemApplication.ACCOUNT_USERNAME_KEY, jid);
+ edit.putString(BeemApplication.ACCOUNT_PASSWORD_KEY, pass);
+ edit.putBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
+ edit.commit();
+ }
+
+ /**
+ * Save the user credentials.
+ *
+ * @param accountName the account name of the user
+ * @param accountType the account type of the user
+ *
+ */
+ private void saveCredentialAccount(String accountName, String accountType) {
+ SharedPreferences.Editor edit = settings.edit();
+ edit.putString(BeemApplication.ACCOUNT_USERNAME_KEY, accountName);
+ edit.putString(BeemApplication.ACCOUNT_SYSTEM_TYPE_KEY, accountType);
+ edit.putBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, true);
+ edit.commit();
+ }
+
+ /**
+ * Check that the username is really a JID.
+ * @param username the username to check.
+ */
+ private void checkUsername(String username) {
+ String name = StringUtils.parseName(username);
+ String server = StringUtils.parseServer(username);
+ if (TextUtils.isEmpty(name) || TextUtils.isEmpty(server)) {
+ mValidJid = false;
+ } else {
+ mValidJid = true;
+ }
+ }
+
+ /**
+ * Check password.
+ * @param password the password to check.
+ */
+ private void checkPassword(String password) {
+ if (password.length() > 0)
+ mValidPassword = true;
+ else
+ mValidPassword = false;
+ }
+
+ /**
+ * Text watcher to test the existence of a password.
+ */
+ private class PasswordTextWatcher implements TextWatcher {
+
+ /**
+ * Constructor.
+ */
+ public PasswordTextWatcher() {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ checkPassword(s.toString());
+ mNextButton.setEnabled(mValidJid && mValidPassword);
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ }
+ }
+
+ /**
+ * TextWatcher to check the validity of a JID.
+ */
+ private class JidTextWatcher implements TextWatcher {
+
+ /**
+ * Constructor.
+ */
+ public JidTextWatcher() {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ checkUsername(s.toString());
+ mNextButton.setEnabled(mValidJid && mValidPassword);
+ if (useSystemAccount) {
+ mAccountPassword.setEnabled(true);
+ mAccountPassword.setText("");
+ }
+ useSystemAccount = false;
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ }
+ }
+
+ /**
+ * AsyncTask use to test the credentials.
+ */
+ class ConnectionTestTask extends AsyncTask<String, Void, Boolean> {
+
+ private ProgressFragment progress;
+ private ConnectionConfiguration config;
+ private XMPPException exception;
+ private String jid;
+ private String password;
+ private String server;
+
+ @Override
+ protected void onPreExecute() {
+ mErrorLabel.setVisibility(View.INVISIBLE);
+ progress = ProgressFragment.newInstance();
+ progress.show(getFragmentManager(), "progressFragment");
+ }
+
+ @Override
+ protected void onPostExecute(Boolean result) {
+ if (result) {
+ onAccountConnectionSuccess(jid, password);
+ } else {
+ onAccountConnectionFailed();
+ }
+ ProgressFragment pf = (ProgressFragment) getFragmentManager().findFragmentByTag("progressFragment");
+ if (pf != null)
+ pf.dismiss();
+ }
+
+ @Override
+ protected Boolean doInBackground(String... params) {
+ Log.d(TAG, "Xmpp login task");
+ jid = params[0];
+ password = params[1];
+
+ int port = -1;
+ if (params.length > 2) {
+ server = params[2];
+ }
+ if (params.length > 3) {
+ if (!TextUtils.isEmpty(params[3])) {
+ port = Integer.parseInt(params[3]);
+ }
+ }
+ Log.d(TAG, "jid " + jid + " server " + server + " port " + port);
+ String login = StringUtils.parseName(jid);
+ String serviceName = StringUtils.parseServer(jid);
+ Connection connection = prepareConnection(jid, server, port);
+ if (settings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false)
+ || "gmail.com".equals(serviceName)
+ || "googlemail.com".equals(serviceName)) {
+ login = jid;
+ }
+ try {
+ connection.connect();
+ connection.login(login, password);
+ } catch (XMPPException e) {
+ Log.e(TAG, "Unable to connect to Xmpp server", e);
+ exception = e;
+ return false;
+ } finally {
+ connection.disconnect();
+ }
+ return true;
+ }
+
+ /**
+ * Initialize the XMPP connection.
+ *
+ * @param jid the jid to use
+ * @param server the server to use (not using dns srv) may be null
+ * @param port the port
+ *
+ * @return the XMPPConnection prepared to connect
+ */
+ private Connection prepareConnection(String jid, String server, int port) {
+ boolean useProxy = settings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
+ ProxyInfo proxyinfo = ProxyInfo.forNoProxy();
+ if (useProxy) {
+ String stype = settings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
+ String phost = settings.getString(BeemApplication.PROXY_SERVER_KEY, "");
+ String puser = settings.getString(BeemApplication.PROXY_USERNAME_KEY, "");
+ String ppass = settings.getString(BeemApplication.PROXY_PASSWORD_KEY, "");
+ int pport = Integer.parseInt(settings.getString(BeemApplication.PROXY_PORT_KEY, "1080"));
+ ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
+ proxyinfo = new ProxyInfo(type, phost, pport, puser, ppass);
+ }
+ String serviceName = StringUtils.parseServer(jid);
+ if (port != -1 || !TextUtils.isEmpty(server)) {
+ if (port == -1)
+ port = 5222;
+ if (TextUtils.isEmpty(server))
+ server = serviceName;
+ config = new ConnectionConfiguration(server, port, serviceName, proxyinfo);
+ } else {
+ config = new ConnectionConfiguration(serviceName, proxyinfo);
+ }
+ if (settings.getBoolean(BeemApplication.SMACK_DEBUG_KEY, false))
+ config.setDebuggerEnabled(true);
+ config.setSendPresence(false);
+ config.setRosterLoadedAtLogin(false);
+ return new XMPPConnection(config);
+ }
+ }
+
+ /**
+ * A progress Fragment.
+ */
+ public static class ProgressFragment extends DialogFragment {
+
+ /**
+ * Create a new ProgressFragment.
+ *
+ * @return a ProgressFragment
+ */
+ public static ProgressFragment newInstance() {
+ return new ProgressFragment();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setCancelable(false);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ Log.d(TAG, "create progress dialog");
+ ProgressDialog p = new ProgressDialog(getActivity());
+ p.setTitle(getString(R.string.login_login_progress));
+ p.setMessage(getString(R.string.create_account_progress_message));
+ return p;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/wizard/CreateAccountFragment.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,399 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+*/
+package com.beem.project.beem.ui.wizard;
+
+import java.util.regex.Pattern;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.support.v4.app.DialogFragment;
+import android.support.v4.app.Fragment;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.AutoCompleteTextView;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.R;
+import com.beem.project.beem.ui.Login;
+
+import org.jivesoftware.smack.AccountManager;
+import org.jivesoftware.smack.Connection;
+import org.jivesoftware.smack.ConnectionConfiguration;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.XMPPError;
+import org.jivesoftware.smack.proxy.ProxyInfo;
+import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
+import org.jivesoftware.smack.util.StringUtils;
+
+
+/**
+ * Fragment used to create an account on an XMPP server.
+ */
+public class CreateAccountFragment extends Fragment implements android.view.View.OnClickListener {
+ private static final String TAG = CreateAccountFragment.class.getSimpleName();
+ private EditText username;
+ private EditText password;
+ private EditText confirmPassword;
+ private TextView errorText;
+ private TextView mSettingsWarningLabel;
+ private AutoCompleteTextView serverEdit;
+ private Button createButton;
+ private CreateAccountTask task;
+ private final NotEmptyTextWatcher mTextWatcher = new NotEmptyTextWatcher();
+ private SharedPreferences settings;
+
+ /**
+ * Create a CreateAccountFragment.
+ *
+ */
+ public CreateAccountFragment() {
+ }
+
+ /**
+ * Create a CreateAccountFragment.
+ * @return a new CreateAccountFragment
+ */
+ public static CreateAccountFragment newInstance() {
+ return new CreateAccountFragment();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setRetainInstance(true);
+ settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
+
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View v = inflater.inflate(R.layout.create_account, container, false);
+ username = (EditText) v.findViewById(R.id.create_account_username);
+ username.addTextChangedListener(mTextWatcher);
+ password = (EditText) v.findViewById(R.id.create_account_password);
+ password.addTextChangedListener(mTextWatcher);
+ confirmPassword = (EditText) v.findViewById(R.id.create_account_confirm_password);
+ confirmPassword.addTextChangedListener(mTextWatcher);
+ errorText = (TextView) v.findViewById(R.id.error_label);
+ mSettingsWarningLabel = (TextView) v.findViewById(R.id.settings_warn_label);
+ createButton = (Button) v.findViewById(R.id.next);
+ createButton.setOnClickListener(this);
+ serverEdit = (AutoCompleteTextView) v.findViewById(R.id.xmpp_server);
+ ArrayAdapter<CharSequence> completeAdapter = ArrayAdapter.createFromResource(
+ getActivity(), R.array.xmpp_server_list, R.layout.simple_combobox_item);
+
+ serverEdit.setAdapter(completeAdapter);
+ serverEdit.addTextChangedListener(mTextWatcher);
+ // show the list on second click on the text view
+ serverEdit.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ serverEdit.showDropDown();
+ }
+ });
+ return v;
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ if (settings.getBoolean(BeemApplication.PROXY_USE_KEY, false)) {
+ mSettingsWarningLabel.setVisibility(View.VISIBLE);
+ } else
+ mSettingsWarningLabel.setVisibility(View.GONE);
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == createButton) {
+ boolean create = true;
+ if (!checkUserName()) {
+ username.setError(getString(R.string.create_account_err_username));
+ create = false;
+ }
+ if (TextUtils.isEmpty(serverEdit.getText())) {
+ serverEdit.setError("Choose a server");
+ create = false;
+ }
+ if (!checkPasswords()) {
+ password.setError(getString(R.string.create_account_err_passwords));
+ confirmPassword.setError(getString(R.string.create_account_err_passwords));
+ create = false;
+ }
+ if (create) {
+ String jid = String.format("%s@%s", username.getText(), serverEdit.getText());
+ jid = StringUtils.parseBareAddress(jid);
+ String pass = password.getText().toString();
+ task = new CreateAccountTask();
+ task.execute(jid, pass);
+ }
+ }
+ }
+
+ /**
+ * Save the user credentials.
+ *
+ * @param jid the jid of the user
+ * @param pass the password of the user
+ *
+ */
+ private void saveCredential(String jid, String pass) {
+ SharedPreferences.Editor edit = settings.edit();
+ edit.putString(BeemApplication.ACCOUNT_USERNAME_KEY, jid);
+ edit.putString(BeemApplication.ACCOUNT_PASSWORD_KEY, pass);
+ edit.commit();
+ }
+
+ /**
+ * Callback called when the account is successfully created.
+ *
+ * @param jid the jid of the account.
+ * @param pass the password of the account.
+ *
+ */
+ private void onAccountCreationSuccess(String jid, String pass) {
+ Activity a = getActivity();
+ saveCredential(jid, pass);
+ // launch login
+ Intent i = new Intent(a, Login.class);
+ i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ a.finish();
+ }
+
+ /**
+ * Callback called when the account failed to create.
+ *
+ * @param e the exception which occurs
+ *
+ */
+ private void onAccountCreationFailed(XMPPException e) {
+ XMPPError error = e.getXMPPError();
+ if (error != null && XMPPError.Condition.conflict.equals(error.getCondition()))
+ errorText.setText(R.string.create_account_err_conflict);
+ else
+ errorText.setText(R.string.create_account_err_connection);
+ Log.v(TAG, "Unable to create an account on xmpp server", e);
+ }
+
+ /**
+ * Check the format of the email.
+ *
+ * @return true if the email is valid.
+ */
+ private boolean checkUserName() {
+ String email = username.getText().toString();
+ return Pattern.matches("[a-zA-Z0-9._%+-]+", email);
+ }
+
+ /**
+ * Check if the fields password and confirm password match.
+ *
+ * @return return true if password & confirm password fields match, else
+ * false
+ */
+ private boolean checkPasswords() {
+ CharSequence pass = password.getText();
+ return !TextUtils.isEmpty(pass) && TextUtils.equals(pass, confirmPassword.getText());
+ }
+
+ /**
+ * AsyncTask use to create an XMPP account on a server.
+ */
+ private class CreateAccountTask extends AsyncTask<String, Void, Boolean> {
+
+ private ProgressFragment progress;
+ private ConnectionConfiguration config;
+ private XMPPException exception;
+ private String jid;
+ private String password;
+ private String server;
+
+ @Override
+ protected void onPreExecute() {
+ progress = ProgressFragment.newInstance();
+ progress.show(getFragmentManager(), "progressFragment");
+ }
+
+ @Override
+ protected void onPostExecute(Boolean result) {
+ if (result) {
+ onAccountCreationSuccess(jid, password);
+ } else {
+ onAccountCreationFailed(exception);
+ }
+ ProgressFragment pf = (ProgressFragment) getFragmentManager().findFragmentByTag("progressFragment");
+ if (pf != null)
+ pf.dismiss();
+ }
+
+ @Override
+ protected Boolean doInBackground(String... params) {
+ Log.d(TAG, "Xmpp login task");
+ jid = params[0];
+ password = params[1];
+ Log.d(TAG, "jid " + jid + " server " + server);
+
+ int port = -1;
+ if (params.length > 2) {
+ server = params[2];
+ }
+ if (params.length > 3) {
+ if (!TextUtils.isEmpty(params[3])) {
+ port = Integer.parseInt(params[3]);
+ }
+ }
+ Connection connection = prepareConnection(jid, server, port);
+ try {
+ connection.connect();
+ AccountManager accountManager = new AccountManager(connection);
+ accountManager.createAccount(StringUtils.parseName(jid), password);
+ } catch (XMPPException e) {
+ Log.e(TAG, "Unable to create account", e);
+ exception = e;
+ return false;
+ } finally {
+ connection.disconnect();
+ }
+ return true;
+ }
+
+ /**
+ * Initialize the XMPP connection.
+ *
+ * @param jid the jid to use
+ * @param server the server to use (not using dns srv) may be null
+ * @param port the port
+ *
+ * @return the XMPPConnection prepared to connect
+ */
+ private Connection prepareConnection(String jid, String server, int port) {
+ boolean useProxy = settings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
+ ProxyInfo proxyinfo = ProxyInfo.forNoProxy();
+ if (useProxy) {
+ String stype = settings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
+ String phost = settings.getString(BeemApplication.PROXY_SERVER_KEY, "");
+ String puser = settings.getString(BeemApplication.PROXY_USERNAME_KEY, "");
+ String ppass = settings.getString(BeemApplication.PROXY_PASSWORD_KEY, "");
+ int pport = Integer.parseInt(settings.getString(BeemApplication.PROXY_PORT_KEY, "1080"));
+ ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
+ proxyinfo = new ProxyInfo(type, phost, pport, puser, ppass);
+ }
+ String serviceName = StringUtils.parseServer(jid);
+ if (port != -1 || !TextUtils.isEmpty(server)) {
+ if (port == -1)
+ port = 5222;
+ if (TextUtils.isEmpty(server))
+ server = serviceName;
+ config = new ConnectionConfiguration(server, port, serviceName, proxyinfo);
+ } else {
+ config = new ConnectionConfiguration(serviceName, proxyinfo);
+ }
+ if (settings.getBoolean(BeemApplication.SMACK_DEBUG_KEY, false))
+ config.setDebuggerEnabled(true);
+ return new XMPPConnection(config);
+ }
+ }
+
+ /**
+ * A progress Fragment.
+ */
+ public static class ProgressFragment extends DialogFragment {
+
+ /**
+ * Create a new ProgressFragment.
+ *
+ * @return a ProgressFragment
+ */
+ public static ProgressFragment newInstance() {
+ return new ProgressFragment();
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setCancelable(false);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ Log.d(TAG, "create progress dialog");
+ ProgressDialog p = new ProgressDialog(getActivity());
+ p.setTitle(getString(R.string.create_account_progress_title));
+ p.setMessage(getString(R.string.create_account_progress_message));
+ return p;
+ }
+ }
+
+ /**
+ * Text watcher to test if all fields are field.
+ */
+ private class NotEmptyTextWatcher implements TextWatcher {
+
+ /**
+ * Constructor.
+ */
+ public NotEmptyTextWatcher() {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ boolean enable = !(TextUtils.isEmpty(username.getText())
+ || TextUtils.isEmpty(serverEdit.getText())
+ || TextUtils.isEmpty(password.getText())
+ || TextUtils.isEmpty(confirmPassword.getText()));
+ createButton.setEnabled(enable);
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/ui/wizard/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,49 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+
+/**
+ * This package contains some configuration wizards.
+ */
+package com.beem.project.beem.ui.wizard;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/utils/BeemBroadcastReceiver.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,93 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.utils;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.ConnectivityManager;
+import android.widget.Toast;
+
+import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
+
+/**
+ * Manage broadcast disconnect intent.
+ * @author nikita
+ */
+public class BeemBroadcastReceiver extends BroadcastReceiver {
+
+ /** Broadcast intent type. */
+ public static final String BEEM_CONNECTION_CLOSED = "BeemConnectionClosed";
+
+ /**
+ * constructor.
+ */
+ public BeemBroadcastReceiver() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onReceive(final Context context, final Intent intent) {
+ String intentAction = intent.getAction();
+ if (intentAction.equals(BEEM_CONNECTION_CLOSED)) {
+ CharSequence message = intent.getCharSequenceExtra("message");
+ Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
+ if (context instanceof Activity) {
+ Activity act = (Activity) context;
+ act.finish();
+ // The service will be unbinded in the destroy of the activity.
+ }
+ } else if (intentAction.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
+ if (intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false)) {
+ Toast.makeText(context, context.getString(R.string.BeemBroadcastReceiverDisconnect),
+ Toast.LENGTH_SHORT).show();
+ context.stopService(new Intent(context, BeemService.class));
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/utils/BeemConnectivity.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,117 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.utils;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.NetworkInfo.DetailedState;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
+import android.telephony.TelephonyManager;
+
+/**
+ * The Class BeemConnectivity.
+ */
+public final class BeemConnectivity {
+
+ /**
+ * Private constructor to forbid instantiation.
+ */
+ private BeemConnectivity() { }
+
+ /**
+ * Checks if is connected.
+ * @param ctx the ctx
+ * @return true, if is connected
+ */
+ public static boolean isConnected(final Context ctx) {
+ ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(
+ Context.CONNECTIVITY_SERVICE);
+ NetworkInfo ni = cm.getActiveNetworkInfo();
+ return ni != null && ni.isConnected();
+ }
+
+ /**
+ * Checks if is wifi.
+ * @param ctx the ctx
+ * @return true, if is wifi
+ */
+ public static boolean isWifi(final Context ctx) {
+ WifiManager wm = (WifiManager) ctx.getSystemService(
+ Context.WIFI_SERVICE);
+ WifiInfo wi = wm.getConnectionInfo();
+ if (wi != null
+ && (WifiInfo.getDetailedStateOf(wi.getSupplicantState())
+ == DetailedState.OBTAINING_IPADDR
+ || WifiInfo.getDetailedStateOf(wi.getSupplicantState())
+ == DetailedState.CONNECTED)) {
+ return false;
+ }
+ return false;
+ }
+
+ /**
+ * Checks if is umts.
+ * @param ctx the ctx
+ * @return true, if is umts
+ */
+ public static boolean isUmts(final Context ctx) {
+ TelephonyManager tm = (TelephonyManager) ctx.getSystemService(
+ Context.TELEPHONY_SERVICE);
+ return tm.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UMTS;
+ }
+
+ /**
+ * Checks if is edge.
+ * @param ctx the ctx
+ * @return true, if is edge
+ */
+ public static boolean isEdge(final Context ctx) {
+ TelephonyManager tm = (TelephonyManager) ctx.getSystemService(
+ Context.TELEPHONY_SERVICE);
+ return tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_EDGE;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/utils/FreePort.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,92 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.utils;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+
+/**
+ * Utility class to get a free port.
+ * @author nikita
+ */
+public final class FreePort {
+
+ private static final int MAGIC_10 = 10;
+ private static final int MAGIC_10000 = 10000;
+
+ /**
+ * Private default constructor.
+ */
+ private FreePort() {
+ }
+
+ /**
+ * return a free port.
+ * @return free socket port.
+ */
+ public static int getFreePort() {
+ ServerSocket ss;
+ int freePort = 0;
+
+ for (int i = 0; i < MAGIC_10; i++) {
+ freePort = (int) (MAGIC_10000 + Math.round(Math.random() * MAGIC_10000));
+ try {
+ ss = new ServerSocket(freePort);
+ freePort = ss.getLocalPort();
+ ss.close();
+ return freePort;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ try {
+ ss = new ServerSocket(0);
+ freePort = ss.getLocalPort();
+ ss.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return freePort;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/utils/PresenceType.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,149 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.utils;
+
+import org.jivesoftware.smack.packet.Presence;
+
+/**
+ * Utility class to deal with Presence type.
+ * @author nikita
+ */
+public final class PresenceType {
+
+ /** The user is available to receive messages (default). */
+ public static final int AVAILABLE = 100;
+
+ /** The user is unavailable to receive messages. */
+ public static final int UNAVAILABLE = 200;
+
+ /** Request subscription to recipient's presence. */
+
+ public static final int SUBSCRIBE = 300;
+
+ /** Grant subscription to sender's presence. */
+ public static final int SUBSCRIBED = 400;
+
+ /** Request removal of subscription to sender's presence. */
+ public static final int UNSUBSCRIBE = 500;
+
+ /** Grant removal of subscription to sender's presence. */
+ public static final int UNSUBSCRIBED = 600;
+
+ /** The presence packet contains an error message. */
+ public static final int ERROR = 701;
+
+ /**
+ * Private default constructor.
+ */
+ private PresenceType() {
+ }
+
+ /**
+ * Get the presence type from a presence packet.
+ * @param presence the presence type
+ * @return an int representing the presence type
+ */
+ public static int getPresenceType(final Presence presence) {
+ int res = PresenceType.ERROR;
+ switch (presence.getType()) {
+ case available:
+ res = PresenceType.AVAILABLE;
+ break;
+ case unavailable:
+ res = PresenceType.UNAVAILABLE;
+ break;
+ case subscribe:
+ res = PresenceType.SUBSCRIBE;
+ break;
+ case subscribed:
+ res = PresenceType.SUBSCRIBED;
+ break;
+ case unsubscribe:
+ res = PresenceType.UNSUBSCRIBE;
+ break;
+ case unsubscribed:
+ res = PresenceType.UNSUBSCRIBED;
+ break;
+ case error:
+ default:
+ res = PresenceType.ERROR;
+ }
+ return res;
+ }
+
+ /**
+ * Get the smack presence mode for a status.
+ * @param type the status type in beem
+ * @return the presence mode to use in presence packet or null if there is no mode to use
+ */
+ public static Presence.Type getPresenceTypeFrom(final int type) {
+ Presence.Type res;
+ switch (type) {
+ case AVAILABLE:
+ res = Presence.Type.available;
+ break;
+ case UNAVAILABLE:
+ res = Presence.Type.unavailable;
+ break;
+ case SUBSCRIBE:
+ res = Presence.Type.subscribe;
+ break;
+ case SUBSCRIBED:
+ res = Presence.Type.subscribed;
+ break;
+ case UNSUBSCRIBE:
+ res = Presence.Type.unsubscribe;
+ break;
+ case UNSUBSCRIBED:
+ res = Presence.Type.unsubscribed;
+ break;
+ case ERROR:
+ res = Presence.Type.error;
+ break;
+ default:
+ return null;
+ }
+ return res;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/utils/SortedList.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,312 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+*/
+package com.beem.project.beem.utils;
+
+import java.util.List;
+import java.util.Comparator;
+import java.util.ListIterator;
+import java.util.Iterator;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * This class add a sort by insertion to a List.
+ * All methods which allow you to insert an object at a specific index
+ * will throw an UnsupportedOperationException.
+ *
+ * @author Da Risk <da_risk@beem-project.com>
+ * @param <E> the type of elements maintained by this list
+ */
+public class SortedList<E> implements List<E> {
+
+ private final List<E> mBackend;
+ private final Comparator<? super E> mComparator;
+
+ /**
+ * Create a SortedList. The existing elements will be sorted.
+ *
+ * @param list list to sort
+ * @param mComparator mComparator to use.
+ */
+ public SortedList(final List<E> list, final Comparator<? super E> mComparator) {
+ this.mComparator = mComparator;
+ this.mBackend = list;
+ Collections.sort(mBackend, mComparator);
+ }
+
+ @Override
+ public int size() {
+ return mBackend.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return mBackend.isEmpty();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return mBackend.contains(o);
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return new SortedListIterator<E>(mBackend.listIterator());
+ }
+
+ @Override
+ public Object[] toArray() {
+ return mBackend.toArray();
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return mBackend.toArray(a);
+ }
+
+ @Override
+ public boolean add(E e) {
+ for (ListIterator<E> it = mBackend.listIterator(); it.hasNext();) {
+ if (mComparator.compare(e, it.next()) < 0) {
+ if (it.hasPrevious()) {
+ it.previous();
+ }
+ it.add(e);
+ return true;
+ }
+ }
+ mBackend.add(e);
+ return true;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return mBackend.remove(o);
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return mBackend.containsAll(c);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> c) {
+ boolean result = false;
+ for (E e : c) {
+ boolean t = add(e);
+ if (t) {
+ result = t;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Add all the elements in the specified collection.
+ * The index param is ignored.
+ *
+ * @param index ignored
+ * @param c collection containing elements to be added to this list
+ * @return true if this list changed as a result of the call
+ */
+ @Override
+ public boolean addAll(int index, Collection<? extends E> c) {
+ return addAll(c);
+ }
+
+ /**
+ * Add all the elements in the specified collection.
+ * The index param is ignored.
+ *
+ * @param l collection containing elements to be added to this list
+ * @return true if this list changed as a result of the call
+ * @see addAll(Collection)
+ */
+ public boolean addAll(SortedList<? extends E> l) {
+ if (!l.isEmpty()) {
+ if (mBackend.isEmpty()) {
+ return mBackend.addAll(l);
+ }
+ boolean result = false;
+ E myfirst = mBackend.get(0);
+ E last = l.get(l.size() - 1);
+ E mylast = mBackend.get(mBackend.size() - 1);
+ E first = l.get(0);
+ if (mComparator.compare(last, myfirst) < 0) {
+ result = mBackend.addAll(0, l);
+ } else if (mComparator.compare(first, mylast) > 0) {
+ result = mBackend.addAll(l);
+ } else {
+ Collection<? extends E> c = l;
+ result = addAll(c);
+ }
+ return result;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return mBackend.removeAll(c);
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return mBackend.retainAll(c);
+ }
+
+ @Override
+ public void clear() {
+ mBackend.clear();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return mBackend.equals(o);
+ }
+
+ @Override
+ public int hashCode() {
+ return mBackend.hashCode();
+ }
+
+ @Override
+ public E get(int index) {
+ return mBackend.get(index);
+ }
+
+ @Override
+ public E set(int index, E element) {
+ throw new UnsupportedOperationException("set() is not supported in SortedList");
+ }
+
+ @Override
+ public void add(int index, E element) {
+ throw new UnsupportedOperationException("add at specific index is not supported in SortedList");
+ }
+
+ @Override
+ public E remove(int index) {
+ return mBackend.remove(index);
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return mBackend.indexOf(o);
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return mBackend.lastIndexOf(o);
+ }
+
+ @Override
+ public ListIterator<E> listIterator() {
+ return new SortedListIterator<E>(mBackend.listIterator());
+ }
+
+ @Override
+ public ListIterator<E> listIterator(int index) {
+ return new SortedListIterator<E>(mBackend.listIterator(index));
+ }
+
+ @Override
+ public List<E> subList(int fromIndex, int toIndex) {
+ return mBackend.subList(fromIndex, toIndex);
+ }
+
+ @Override
+ public String toString() {
+ return mBackend.toString();
+ }
+
+ /**
+ * A SortedList.iterator don't allow list modification.
+ * It use the mBackend iterator for the other operations.
+ */
+ private class SortedListIterator<E> implements ListIterator<E> {
+
+ private ListIterator<E> mIt;
+
+ /**
+ * Construct SortedList.Iterator.
+ *
+ * @param iterator the iterator of the backend list
+ */
+ SortedListIterator(final ListIterator<E> iterator) {
+ mIt = iterator;
+ }
+
+ @Override
+ public void add(E e) {
+ throw new UnsupportedOperationException("add() not supported in SortedList iterator");
+ }
+
+ @Override
+ public boolean hasNext() {
+ return mIt.hasNext();
+ }
+
+ @Override
+ public E next() {
+ return mIt.next();
+ }
+
+ @Override
+ public boolean hasPrevious() {
+ return mIt.hasPrevious();
+ }
+
+ @Override
+ public E previous() {
+ return mIt.previous();
+ }
+
+ @Override
+ public int nextIndex() {
+ return mIt.nextIndex();
+ }
+
+ @Override
+ public int previousIndex() {
+ return mIt.previousIndex();
+ }
+
+ @Override
+ public void remove() {
+ mIt.remove();
+ }
+
+ @Override
+ public void set(E e) {
+ throw new UnsupportedOperationException("set () not supported in SortedList iterator");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/utils/Status.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,186 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.utils;
+
+import com.beem.project.beem.R;
+
+import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.packet.Presence.Mode;
+
+/**
+ * Utility class to deal with status and presence value.
+ * @author marseille
+ */
+public final class Status {
+
+ /** Status of a disconnected contact. */
+ public static final int CONTACT_STATUS_DISCONNECT = 100;
+
+ /** Status of a unavailable (long away) contact. */
+ public static final int CONTACT_STATUS_UNAVAILABLE = 200;
+
+ /** Status of a away contact. */
+ public static final int CONTACT_STATUS_AWAY = 300;
+
+ /** Status of a busy contact. */
+ public static final int CONTACT_STATUS_BUSY = 400;
+
+ /** Status of a available contact. */
+ public static final int CONTACT_STATUS_AVAILABLE = 500;
+
+ /** Status of a available for chat contact. */
+ public static final int CONTACT_STATUS_AVAILABLE_FOR_CHAT = 600;
+
+ /**
+ * Default constructor masked.
+ */
+ private Status() {
+ }
+
+ /**
+ * Get the smack presence mode for a status.
+ * @param status the status in beem
+ * @return the presence mode to use in presence packet or null if there is no mode to use
+ */
+ public static Presence.Mode getPresenceModeFromStatus(final int status) {
+ Presence.Mode res;
+ switch (status) {
+ case CONTACT_STATUS_AVAILABLE:
+ res = Presence.Mode.available;
+ break;
+ case CONTACT_STATUS_AVAILABLE_FOR_CHAT:
+ res = Presence.Mode.chat;
+ break;
+ case CONTACT_STATUS_AWAY:
+ res = Presence.Mode.away;
+ break;
+ case CONTACT_STATUS_BUSY:
+ res = Presence.Mode.dnd;
+ break;
+ case CONTACT_STATUS_UNAVAILABLE:
+ res = Presence.Mode.xa;
+ break;
+ default:
+ return null;
+ }
+ return res;
+ }
+
+ /**
+ * Get the status of from a presence packet.
+ * @param presence the presence containing status
+ * @return an int representing the status
+ */
+ public static int getStatusFromPresence(final Presence presence) {
+ int res = Status.CONTACT_STATUS_DISCONNECT;
+ if (presence.getType().equals(Presence.Type.unavailable)) {
+ res = Status.CONTACT_STATUS_DISCONNECT;
+ } else {
+ Mode mode = presence.getMode();
+ if (mode == null) {
+ res = Status.CONTACT_STATUS_AVAILABLE;
+ } else {
+ switch (mode) {
+ case available:
+ res = Status.CONTACT_STATUS_AVAILABLE;
+ break;
+ case away:
+ res = Status.CONTACT_STATUS_AWAY;
+ break;
+ case chat:
+ res = Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
+ break;
+ case dnd:
+ res = Status.CONTACT_STATUS_BUSY;
+ break;
+ case xa:
+ res = Status.CONTACT_STATUS_UNAVAILABLE;
+ break;
+ default:
+ res = Status.CONTACT_STATUS_DISCONNECT;
+ break;
+ }
+ }
+ }
+ return res;
+ }
+
+ /**
+ * Check if contact is online by his status.
+ * @param status contact status
+ * @return is online
+ */
+ public static boolean statusOnline(final int status) {
+ return status != Status.CONTACT_STATUS_DISCONNECT;
+ }
+
+ /**
+ * Get icon resource from status.
+ * @param status the status
+ * @return the resource icon
+ */
+ public static int getIconBarFromStatus(final int status) {
+ int icon = R.drawable.beem_status_icon;
+ switch (status) {
+ case Status.CONTACT_STATUS_AVAILABLE:
+ icon = R.drawable.beem_status_icon_available;
+ break;
+ case Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
+ icon = R.drawable.beem_status_icon_available;
+ break;
+ case Status.CONTACT_STATUS_AWAY:
+ icon = R.drawable.beem_status_icon_away;
+ break;
+ case Status.CONTACT_STATUS_BUSY:
+ icon = R.drawable.beem_status_icon_busy;
+ break;
+ case Status.CONTACT_STATUS_UNAVAILABLE:
+ icon = R.drawable.beem_status_icon_gray;
+ break;
+ default:
+ icon = R.drawable.beem_status_icon;
+ }
+ return icon;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/beem/project/beem/utils/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,48 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
+/**
+ * This package contains utility class to deal with various aspect of BEEM.
+ */
+package com.beem.project.beem.utils;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/google/android/apps/iosched/util/LogUtils.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.android.apps.iosched.util;
+
+import com.beem.project.beem.BuildConfig;
+
+import android.util.Log;
+
+/**
+ * Helper methods that make logging more consistent throughout the app.
+ */
+public class LogUtils {
+ private static final String LOG_PREFIX = "Beem";
+ private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
+ private static final int MAX_LOG_TAG_LENGTH = 23;
+
+ public static String makeLogTag(String str) {
+ if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
+ return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
+ }
+
+ return LOG_PREFIX + str;
+ }
+
+ /**
+ * WARNING: Don't use this when obfuscating class names with Proguard!
+ */
+ public static String makeLogTag(Class cls) {
+ return makeLogTag(cls.getSimpleName());
+ }
+
+ public static void LOGD(final String tag, String message) {
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, message);
+ }
+ }
+
+ public static void LOGD(final String tag, String message, Throwable cause) {
+ if (Log.isLoggable(tag, Log.DEBUG)) {
+ Log.d(tag, message, cause);
+ }
+ }
+
+ public static void LOGV(final String tag, String message) {
+ //noinspection PointlessBooleanExpression,ConstantConditions
+ if (BuildConfig.DEBUG && Log.isLoggable(tag, Log.VERBOSE)) {
+ Log.v(tag, message);
+ }
+ }
+
+ public static void LOGV(final String tag, String message, Throwable cause) {
+ //noinspection PointlessBooleanExpression,ConstantConditions
+ if (BuildConfig.DEBUG && Log.isLoggable(tag, Log.VERBOSE)) {
+ Log.v(tag, message, cause);
+ }
+ }
+
+ public static void LOGI(final String tag, String message) {
+ Log.i(tag, message);
+ }
+
+ public static void LOGI(final String tag, String message, Throwable cause) {
+ Log.i(tag, message, cause);
+ }
+
+ public static void LOGW(final String tag, String message) {
+ Log.w(tag, message);
+ }
+
+ public static void LOGW(final String tag, String message, Throwable cause) {
+ Log.w(tag, message, cause);
+ }
+
+ public static void LOGE(final String tag, String message) {
+ Log.e(tag, message);
+ }
+
+ public static void LOGE(final String tag, String message, Throwable cause) {
+ Log.e(tag, message, cause);
+ }
+
+ private LogUtils() {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/isode/stroke/base/ByteArray.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+/*
+ * Copyright (c) 2010, Isode Limited, London, England.
+ * All rights reserved.
+ */
+package com.isode.stroke.base;
+
+import java.io.UnsupportedEncodingException;
+
+/**
+ *
+ */
+public class ByteArray {
+
+ public ByteArray() {
+ }
+
+ public ByteArray(String s) {
+ try {
+ fromBytes(s.getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ throw new IllegalStateException("JVM has no 'UTF-8' encoding");
+ }
+ }
+
+ public ByteArray(byte[] c) {
+ fromBytes(c);
+ }
+
+ public ByteArray(ByteArray b) {
+ fromBytes(b.getData());
+ }
+
+ private void fromBytes(final byte[] b) {
+ data_ = new byte[b.length];
+ System.arraycopy(b, 0, data_, 0, b.length);
+ }
+
+ /*public ByteArray(char[] c, int n) {
+ for (int i = 0; i < n; i++) {
+ append(c[i]);
+ }
+ }*/
+
+ /**
+ * These are the raw, modifyable data!
+ * @return
+ */
+ public byte[] getData() {
+ return data_;
+ }
+
+ public int getSize() {
+ return data_.length;
+ }
+
+ public boolean isEmpty() {
+ return getSize() == 0;
+ }
+
+ /*public void resize(size_t size) {
+ return data_.resize(size);
+ }*/
+ /** Immutable add */
+ public static ByteArray plus(ByteArray a, ByteArray b) {
+ ByteArray x = new ByteArray(a.getData());
+ x.append(b);
+ return x;
+ }
+
+ /** Immutable add */
+ /*public ByteArray plus(ByteArray a, char b) {
+ ByteArray x = new ByteArray(a.getData());
+ x.append(b);
+ return x;
+ }*/
+
+ /** Mutable add */
+ public ByteArray append(ByteArray b) {
+ append(b.getData());
+ return this;
+ }
+
+ /** Mutable add */
+ private ByteArray append(byte[] b) {
+ int newLength = data_.length + b.length;
+ byte[] newData = new byte[newLength];
+ for (int i = 0; i < data_.length; i++) {
+ newData[i] = data_[i];
+ }
+ for (int i = 0; i < b.length; i++) {
+ newData[i + data_.length] = b[i];
+ }
+ data_ = newData;
+ return this;
+ }
+
+ /** Mutable add */
+ public ByteArray append(byte b) {
+ byte[] bytes = {b};
+ append(bytes);
+ return this;
+ }
+
+ /** mutable add */
+ public ByteArray append(String s) {
+ byte[] bytes;
+ try {
+ bytes = s.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ throw new IllegalStateException("JVM has no 'UTF-8' encoding");
+ }
+ append(bytes);
+ return this;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 97 * hash + (this.data_ != null ? this.data_.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof ByteArray && toString().equals(other.toString());
+ }
+
+ /*public char charAt(int i) {
+ return data_.charAt(i);
+ }*/
+
+ /*public const_iterator begin() const {
+ return data_.begin();
+ }
+
+ public const_iterator end() const {
+ return data_.end();
+ }*/
+ @Override
+ public String toString() {
+ try {
+ return new String(data_, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ throw new IllegalStateException("JVM has no 'UTF-8' encoding");
+ }
+ }
+
+ public void readFromFile(String file) {
+ //FIXME: port
+ }
+
+ public void clear() {
+ data_ = new byte[]{};
+ }
+ private byte[] data_ = {};
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/isode/stroke/sasl/ClientAuthenticator.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2010, Remko Tronçon.
+ * All rights reserved.
+ */
+package com.isode.stroke.sasl;
+
+import com.isode.stroke.base.ByteArray;
+
+public abstract class ClientAuthenticator {
+
+ public ClientAuthenticator(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setCredentials(String authcid, String password) {
+ setCredentials(authcid, password, "");
+ }
+
+ public void setCredentials(String authcid, String password, String authzid) {
+ this.authcid = authcid;
+ this.password = password;
+ this.authzid = authzid;
+ }
+
+ public abstract ByteArray getResponse();
+
+ public abstract boolean setChallenge(ByteArray challenge);
+
+ public String getAuthenticationID() {
+ return authcid;
+ }
+
+ public String getAuthorizationID() {
+ return authzid;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+ private String name;
+ private String authcid;
+ private String password;
+ private String authzid;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/isode/stroke/sasl/SCRAMSHA1ClientAuthenticator.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2010, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2010, Remko Tronçon.
+ * All rights reserved.
+ */
+package com.isode.stroke.sasl;
+
+import com.isode.stroke.base.ByteArray;
+import com.isode.stroke.stringcodecs.Base64;
+import com.isode.stroke.stringcodecs.HMACSHA1;
+import com.isode.stroke.stringcodecs.PBKDF2;
+import com.isode.stroke.stringcodecs.SHA1;
+import java.text.Normalizer;
+import java.text.Normalizer.Form;
+import java.util.HashMap;
+import java.util.Map;
+
+public class SCRAMSHA1ClientAuthenticator extends ClientAuthenticator {
+
+ static String escape(String s) {
+ String result = "";
+ for (int i = 0; i < s.length(); ++i) {
+ if (s.charAt(i) == ',') {
+ result += "=2C";
+ } else if (s.charAt(i) == '=') {
+ result += "=3D";
+ } else {
+ result += s.charAt(i);
+ }
+ }
+ return result;
+ }
+
+ public SCRAMSHA1ClientAuthenticator(String nonce) {
+ this(nonce, false);
+ }
+ public SCRAMSHA1ClientAuthenticator(String nonce, boolean useChannelBinding) {
+ super(useChannelBinding ? "SCRAM-SHA-1-PLUS" : "SCRAM-SHA-1");
+ step = Step.Initial;
+ clientnonce = nonce;
+ this.useChannelBinding = useChannelBinding;
+ }
+
+ public void setTLSChannelBindingData(ByteArray channelBindingData) {
+ tlsChannelBindingData = channelBindingData;
+ }
+
+ public ByteArray getResponse() {
+ if (step.equals(Step.Initial)) {
+ return ByteArray.plus(getGS2Header(), getInitialBareClientMessage());
+ } else if (step.equals(Step.Proof)) {
+ ByteArray clientKey = HMACSHA1.getResult(saltedPassword, new ByteArray("Client Key"));
+ ByteArray storedKey = SHA1.getHash(clientKey);
+ ByteArray clientSignature = HMACSHA1.getResult(storedKey, authMessage);
+ ByteArray clientProof = clientKey;
+ byte[] clientProofData = clientProof.getData();
+ for (int i = 0; i < clientProofData.length; ++i) {
+ clientProofData[i] ^= clientSignature.getData()[i];
+ }
+ ByteArray result = getFinalMessageWithoutProof().append(",p=").append(Base64.encode(clientProof));
+ return result;
+ } else {
+ return null;
+ }
+ }
+
+ public boolean setChallenge(ByteArray challenge) {
+ if (step.equals(Step.Initial)) {
+ if (challenge == null) {
+ return false;
+ }
+ initialServerMessage = challenge;
+
+ Map<Character, String> keys = parseMap(initialServerMessage.toString());
+
+ // Extract the salt
+ ByteArray salt = Base64.decode(keys.get('s'));
+
+ // Extract the server nonce
+ String clientServerNonce = keys.get('r');
+ if (clientServerNonce.length() <= clientnonce.length()) {
+ return false;
+ }
+ String receivedClientNonce = clientServerNonce.substring(0, clientnonce.length());
+ if (!receivedClientNonce.equals(clientnonce)) {
+ return false;
+ }
+ serverNonce = new ByteArray(clientServerNonce.substring(clientnonce.length()));
+
+
+ // Extract the number of iterations
+ int iterations = 0;
+ try {
+ iterations = Integer.parseInt(keys.get('i'));
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ if (iterations <= 0) {
+ return false;
+ }
+
+ ByteArray channelBindData = new ByteArray();
+ if (useChannelBinding && tlsChannelBindingData != null) {
+ channelBindData = tlsChannelBindingData;
+ }
+
+ // Compute all the values needed for the server signature
+ saltedPassword = PBKDF2.encode(new ByteArray(SASLPrep(getPassword())), salt, iterations);
+ authMessage = getInitialBareClientMessage().append(",").append(initialServerMessage).append(",").append(getFinalMessageWithoutProof());
+ ByteArray serverKey = HMACSHA1.getResult(saltedPassword, new ByteArray("Server Key"));
+ serverSignature = HMACSHA1.getResult(serverKey, authMessage);
+
+ step = Step.Proof;
+ return true;
+ } else if (step.equals(step.Proof)) {
+ ByteArray result = new ByteArray("v=").append(new ByteArray(Base64.encode(serverSignature)));
+ step = Step.Final;
+ return challenge != null && challenge.equals(result);
+ } else {
+ return true;
+ }
+ }
+
+ private String SASLPrep(String source) {
+ return Normalizer.normalize(source, Form.NFKC); /* FIXME: Implement real SASLPrep */
+ }
+
+ private Map<Character, String> parseMap(String s) {
+ HashMap<Character, String> result = new HashMap<Character, String>();
+ if (s.length() > 0) {
+ char key = '~'; /* initialise so it'll compile */
+ String value = "";
+ int i = 0;
+ boolean expectKey = true;
+ while (i < s.length()) {
+ if (expectKey) {
+ key = s.charAt(i);
+ expectKey = false;
+ i++;
+ } else if (s.charAt(i) == ',') {
+ result.put(key, value);
+ value = "";
+ expectKey = true;
+ } else {
+ value += s.charAt(i);
+ }
+ i++;
+ }
+ result.put(key, value);
+ }
+ return result;
+ }
+
+ private ByteArray getInitialBareClientMessage() {
+ String authenticationID = SASLPrep(getAuthenticationID());
+ return new ByteArray("n=" + escape(authenticationID) + ",r=" + clientnonce);
+ }
+
+ private ByteArray getGS2Header() {
+
+ ByteArray channelBindingHeader = new ByteArray("n");
+ if (tlsChannelBindingData != null) {
+ if (useChannelBinding) {
+ channelBindingHeader = new ByteArray("p=tls-unique");
+ }
+ else {
+ channelBindingHeader = new ByteArray("y");
+ }
+ }
+ return new ByteArray().append(channelBindingHeader).append(",").append(getAuthorizationID().isEmpty() ? new ByteArray() : new ByteArray("a=" + escape(getAuthorizationID()))).append(",");
+ }
+
+ private ByteArray getFinalMessageWithoutProof() {
+ ByteArray channelBindData = new ByteArray();
+ if (useChannelBinding && tlsChannelBindingData != null) {
+ channelBindData = tlsChannelBindingData;
+ }
+ return new ByteArray("c=" + Base64.encode(new ByteArray(getGS2Header()).append(channelBindData)) + ",r=" + clientnonce).append(serverNonce);
+ }
+
+ private enum Step {
+
+ Initial,
+ Proof,
+ Final
+ };
+ private Step step;
+ private String clientnonce = "";
+ private ByteArray initialServerMessage = new ByteArray();
+ private ByteArray serverNonce = new ByteArray();
+ private ByteArray authMessage = new ByteArray();
+ private ByteArray saltedPassword = new ByteArray();
+ private ByteArray serverSignature = new ByteArray();
+ private boolean useChannelBinding;
+ private ByteArray tlsChannelBindingData;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/isode/stroke/stringcodecs/Base64.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+/*
+ * Copyright (c) 2010, Isode Limited, London, England.
+ * All rights reserved.
+ */
+package com.isode.stroke.stringcodecs;
+
+import com.isode.stroke.base.ByteArray;
+
+public class Base64 {
+ /* FIXME: Check license is ok (it is, it's BSD) */
+ public static ByteArray decode(String input) {
+ return new ByteArray(Base64BSD.decode(input));
+ }
+
+ public static String encode(ByteArray input) {
+ return Base64BSD.encodeToString(input.getData(), false);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/isode/stroke/stringcodecs/Base64BSD.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,575 @@
+package com.isode.stroke.stringcodecs;
+
+import java.util.Arrays;
+
+/** A very fast and memory efficient class to encode and decode to and from BASE64 in full accordance
+ * with RFC 2045.<br><br>
+ * On Windows XP sp1 with 1.4.2_04 and later ;), this encoder and decoder is about 10 times faster
+ * on small arrays (10 - 1000 bytes) and 2-3 times as fast on larger arrays (10000 - 1000000 bytes)
+ * compared to <code>sun.misc.Encoder()/Decoder()</code>.<br><br>
+ *
+ * On byte arrays the encoder is about 20% faster than Jakarta Commons Base64 Codec for encode and
+ * about 50% faster for decoding large arrays. This implementation is about twice as fast on very small
+ * arrays (< 30 bytes). If source/destination is a <code>String</code> this
+ * version is about three times as fast due to the fact that the Commons Codec result has to be recoded
+ * to a <code>String</code> from <code>byte[]</code>, which is very expensive.<br><br>
+ *
+ * This encode/decode algorithm doesn't create any temporary arrays as many other codecs do, it only
+ * allocates the resulting array. This produces less garbage and it is possible to handle arrays twice
+ * as large as algorithms that create a temporary array. (E.g. Jakarta Commons Codec). It is unknown
+ * whether Sun's <code>sun.misc.Encoder()/Decoder()</code> produce temporary arrays but since performance
+ * is quite low it probably does.<br><br>
+ *
+ * The encoder produces the same output as the Sun one except that the Sun's encoder appends
+ * a trailing line separator if the last character isn't a pad. Unclear why but it only adds to the
+ * length and is probably a side effect. Both are in conformance with RFC 2045 though.<br>
+ * Commons codec seem to always att a trailing line separator.<br><br>
+ *
+ * <b>Note!</b>
+ * The encode/decode method pairs (types) come in three versions with the <b>exact</b> same algorithm and
+ * thus a lot of code redundancy. This is to not create any temporary arrays for transcoding to/from different
+ * format types. The methods not used can simply be commented out.<br><br>
+ *
+ * There is also a "fast" version of all decode methods that works the same way as the normal ones, but
+ * har a few demands on the decoded input. Normally though, these fast verions should be used if the source if
+ * the input is known and it hasn't bee tampered with.<br><br>
+ *
+ * If you find the code useful or you find a bug, please send me a note at base64 @ miginfocom . com.
+ *
+ * Licence (BSD):
+ * ==============
+ *
+ * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (base64 @ miginfocom . com)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ * Neither the name of the MiG InfoCom AB nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * @version 2.2
+ * @author Mikael Grev
+ * Date: 2004-aug-02
+ * Time: 11:31:11
+ */
+
+public class Base64BSD
+{
+ private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
+ private static final int[] IA = new int[256];
+ static {
+ Arrays.fill(IA, -1);
+ for (int i = 0, iS = CA.length; i < iS; i++)
+ IA[CA[i]] = i;
+ IA['='] = 0;
+ }
+
+ // ****************************************************************************************
+ // * char[] version
+ // ****************************************************************************************
+
+ /** Encodes a raw byte array into a BASE64 <code>char[]</code> representation i accordance with RFC 2045.
+ * @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
+ * @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
+ * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
+ * little faster.
+ * @return A BASE64 encoded array. Never <code>null</code>.
+ */
+ public final static char[] encodeToChar(byte[] sArr, boolean lineSep)
+ {
+ // Check special case
+ int sLen = sArr != null ? sArr.length : 0;
+ if (sLen == 0)
+ return new char[0];
+
+ int eLen = (sLen / 3) * 3; // Length of even 24-bits.
+ int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count
+ int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array
+ char[] dArr = new char[dLen];
+
+ // Encode even 24-bits
+ for (int s = 0, d = 0, cc = 0; s < eLen;) {
+ // Copy next three bytes into lower 24 bits of int, paying attension to sign.
+ int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff);
+
+ // Encode the int into four chars
+ dArr[d++] = CA[(i >>> 18) & 0x3f];
+ dArr[d++] = CA[(i >>> 12) & 0x3f];
+ dArr[d++] = CA[(i >>> 6) & 0x3f];
+ dArr[d++] = CA[i & 0x3f];
+
+ // Add optional line separator
+ if (lineSep && ++cc == 19 && d < dLen - 2) {
+ dArr[d++] = '\r';
+ dArr[d++] = '\n';
+ cc = 0;
+ }
+ }
+
+ // Pad and encode last bits if source isn't even 24 bits.
+ int left = sLen - eLen; // 0 - 2.
+ if (left > 0) {
+ // Prepare the int
+ int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0);
+
+ // Set last four chars
+ dArr[dLen - 4] = CA[i >> 12];
+ dArr[dLen - 3] = CA[(i >>> 6) & 0x3f];
+ dArr[dLen - 2] = left == 2 ? CA[i & 0x3f] : '=';
+ dArr[dLen - 1] = '=';
+ }
+ return dArr;
+ }
+
+ /** Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with
+ * and without line separators.
+ * @param sArr The source array. <code>null</code> or length 0 will return an empty array.
+ * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
+ * (including '=') isn't divideable by 4. (I.e. definitely corrupted).
+ */
+ public final static byte[] decode(char[] sArr)
+ {
+ // Check special case
+ int sLen = sArr != null ? sArr.length : 0;
+ if (sLen == 0)
+ return new byte[0];
+
+ // Count illegal characters (including '\r', '\n') to know what size the returned array will be,
+ // so we don't have to reallocate & copy it later.
+ int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...)
+ for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out.
+ if (IA[sArr[i]] < 0)
+ sepCnt++;
+
+ // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045.
+ if ((sLen - sepCnt) % 4 != 0)
+ return null;
+
+ int pad = 0;
+ for (int i = sLen; i > 1 && IA[sArr[--i]] <= 0;)
+ if (sArr[i] == '=')
+ pad++;
+
+ int len = ((sLen - sepCnt) * 6 >> 3) - pad;
+
+ byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
+
+ for (int s = 0, d = 0; d < len;) {
+ // Assemble three bytes into an int from four "valid" characters.
+ int i = 0;
+ for (int j = 0; j < 4; j++) { // j only increased if a valid char was found.
+ int c = IA[sArr[s++]];
+ if (c >= 0)
+ i |= c << (18 - j * 6);
+ else
+ j--;
+ }
+ // Add the bytes
+ dArr[d++] = (byte) (i >> 16);
+ if (d < len) {
+ dArr[d++]= (byte) (i >> 8);
+ if (d < len)
+ dArr[d++] = (byte) i;
+ }
+ }
+ return dArr;
+ }
+
+ /** Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as
+ * fast as {@link #decode(char[])}. The preconditions are:<br>
+ * + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
+ * + Line separator must be "\r\n", as specified in RFC 2045
+ * + The array must not contain illegal characters within the encoded string<br>
+ * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
+ * @param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
+ * @return The decoded array of bytes. May be of length 0.
+ */
+ public final static byte[] decodeFast(char[] sArr)
+ {
+ // Check special case
+ int sLen = sArr.length;
+ if (sLen == 0)
+ return new byte[0];
+
+ int sIx = 0, eIx = sLen - 1; // Start and end index after trimming.
+
+ // Trim illegal chars from start
+ while (sIx < eIx && IA[sArr[sIx]] < 0)
+ sIx++;
+
+ // Trim illegal chars from end
+ while (eIx > 0 && IA[sArr[eIx]] < 0)
+ eIx--;
+
+ // get the padding count (=) (0, 1 or 2)
+ int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end.
+ int cCnt = eIx - sIx + 1; // Content count including possible separators
+ int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0;
+
+ int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
+ byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
+
+ // Decode all but the last 0 - 2 bytes.
+ int d = 0;
+ for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
+ // Assemble three bytes into an int from four "valid" characters.
+ int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]];
+
+ // Add the bytes
+ dArr[d++] = (byte) (i >> 16);
+ dArr[d++] = (byte) (i >> 8);
+ dArr[d++] = (byte) i;
+
+ // If line separator, jump over it.
+ if (sepCnt > 0 && ++cc == 19) {
+ sIx += 2;
+ cc = 0;
+ }
+ }
+
+ if (d < len) {
+ // Decode last 1-3 bytes (incl '=') into 1-3 bytes
+ int i = 0;
+ for (int j = 0; sIx <= eIx - pad; j++)
+ i |= IA[sArr[sIx++]] << (18 - j * 6);
+
+ for (int r = 16; d < len; r -= 8)
+ dArr[d++] = (byte) (i >> r);
+ }
+
+ return dArr;
+ }
+
+ // ****************************************************************************************
+ // * byte[] version
+ // ****************************************************************************************
+
+ /** Encodes a raw byte array into a BASE64 <code>byte[]</code> representation i accordance with RFC 2045.
+ * @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
+ * @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
+ * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
+ * little faster.
+ * @return A BASE64 encoded array. Never <code>null</code>.
+ */
+ public final static byte[] encodeToByte(byte[] sArr, boolean lineSep)
+ {
+ // Check special case
+ int sLen = sArr != null ? sArr.length : 0;
+ if (sLen == 0)
+ return new byte[0];
+
+ int eLen = (sLen / 3) * 3; // Length of even 24-bits.
+ int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count
+ int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array
+ byte[] dArr = new byte[dLen];
+
+ // Encode even 24-bits
+ for (int s = 0, d = 0, cc = 0; s < eLen;) {
+ // Copy next three bytes into lower 24 bits of int, paying attension to sign.
+ int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff);
+
+ // Encode the int into four chars
+ dArr[d++] = (byte) CA[(i >>> 18) & 0x3f];
+ dArr[d++] = (byte) CA[(i >>> 12) & 0x3f];
+ dArr[d++] = (byte) CA[(i >>> 6) & 0x3f];
+ dArr[d++] = (byte) CA[i & 0x3f];
+
+ // Add optional line separator
+ if (lineSep && ++cc == 19 && d < dLen - 2) {
+ dArr[d++] = '\r';
+ dArr[d++] = '\n';
+ cc = 0;
+ }
+ }
+
+ // Pad and encode last bits if source isn't an even 24 bits.
+ int left = sLen - eLen; // 0 - 2.
+ if (left > 0) {
+ // Prepare the int
+ int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0);
+
+ // Set last four chars
+ dArr[dLen - 4] = (byte) CA[i >> 12];
+ dArr[dLen - 3] = (byte) CA[(i >>> 6) & 0x3f];
+ dArr[dLen - 2] = left == 2 ? (byte) CA[i & 0x3f] : (byte) '=';
+ dArr[dLen - 1] = '=';
+ }
+ return dArr;
+ }
+
+ /** Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with
+ * and without line separators.
+ * @param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
+ * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
+ * (including '=') isn't divideable by 4. (I.e. definitely corrupted).
+ */
+ public final static byte[] decode(byte[] sArr)
+ {
+ // Check special case
+ int sLen = sArr.length;
+
+ // Count illegal characters (including '\r', '\n') to know what size the returned array will be,
+ // so we don't have to reallocate & copy it later.
+ int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...)
+ for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out.
+ if (IA[sArr[i] & 0xff] < 0)
+ sepCnt++;
+
+ // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045.
+ if ((sLen - sepCnt) % 4 != 0)
+ return null;
+
+ int pad = 0;
+ for (int i = sLen; i > 1 && IA[sArr[--i] & 0xff] <= 0;)
+ if (sArr[i] == '=')
+ pad++;
+
+ int len = ((sLen - sepCnt) * 6 >> 3) - pad;
+
+ byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
+
+ for (int s = 0, d = 0; d < len;) {
+ // Assemble three bytes into an int from four "valid" characters.
+ int i = 0;
+ for (int j = 0; j < 4; j++) { // j only increased if a valid char was found.
+ int c = IA[sArr[s++] & 0xff];
+ if (c >= 0)
+ i |= c << (18 - j * 6);
+ else
+ j--;
+ }
+
+ // Add the bytes
+ dArr[d++] = (byte) (i >> 16);
+ if (d < len) {
+ dArr[d++]= (byte) (i >> 8);
+ if (d < len)
+ dArr[d++] = (byte) i;
+ }
+ }
+
+ return dArr;
+ }
+
+
+ /** Decodes a BASE64 encoded byte array that is known to be resonably well formatted. The method is about twice as
+ * fast as {@link #decode(byte[])}. The preconditions are:<br>
+ * + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
+ * + Line separator must be "\r\n", as specified in RFC 2045
+ * + The array must not contain illegal characters within the encoded string<br>
+ * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
+ * @param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
+ * @return The decoded array of bytes. May be of length 0.
+ */
+ public final static byte[] decodeFast(byte[] sArr)
+ {
+ // Check special case
+ int sLen = sArr.length;
+ if (sLen == 0)
+ return new byte[0];
+
+ int sIx = 0, eIx = sLen - 1; // Start and end index after trimming.
+
+ // Trim illegal chars from start
+ while (sIx < eIx && IA[sArr[sIx] & 0xff] < 0)
+ sIx++;
+
+ // Trim illegal chars from end
+ while (eIx > 0 && IA[sArr[eIx] & 0xff] < 0)
+ eIx--;
+
+ // get the padding count (=) (0, 1 or 2)
+ int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end.
+ int cCnt = eIx - sIx + 1; // Content count including possible separators
+ int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0;
+
+ int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
+ byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
+
+ // Decode all but the last 0 - 2 bytes.
+ int d = 0;
+ for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
+ // Assemble three bytes into an int from four "valid" characters.
+ int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]];
+
+ // Add the bytes
+ dArr[d++] = (byte) (i >> 16);
+ dArr[d++] = (byte) (i >> 8);
+ dArr[d++] = (byte) i;
+
+ // If line separator, jump over it.
+ if (sepCnt > 0 && ++cc == 19) {
+ sIx += 2;
+ cc = 0;
+ }
+ }
+
+ if (d < len) {
+ // Decode last 1-3 bytes (incl '=') into 1-3 bytes
+ int i = 0;
+ for (int j = 0; sIx <= eIx - pad; j++)
+ i |= IA[sArr[sIx++]] << (18 - j * 6);
+
+ for (int r = 16; d < len; r -= 8)
+ dArr[d++] = (byte) (i >> r);
+ }
+
+ return dArr;
+ }
+
+ // ****************************************************************************************
+ // * String version
+ // ****************************************************************************************
+
+ /** Encodes a raw byte array into a BASE64 <code>String</code> representation i accordance with RFC 2045.
+ * @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
+ * @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
+ * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
+ * little faster.
+ * @return A BASE64 encoded array. Never <code>null</code>.
+ */
+ public final static String encodeToString(byte[] sArr, boolean lineSep)
+ {
+ // Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower.
+ return new String(encodeToChar(sArr, lineSep));
+ }
+
+ /** Decodes a BASE64 encoded <code>String</code>. All illegal characters will be ignored and can handle both strings with
+ * and without line separators.<br>
+ * <b>Note!</b> It can be up to about 2x the speed to call <code>decode(str.toCharArray())</code> instead. That
+ * will create a temporary array though. This version will use <code>str.charAt(i)</code> to iterate the string.
+ * @param str The source string. <code>null</code> or length 0 will return an empty array.
+ * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
+ * (including '=') isn't divideable by 4. (I.e. definitely corrupted).
+ */
+ public final static byte[] decode(String str)
+ {
+ // Check special case
+ int sLen = str != null ? str.length() : 0;
+ if (sLen == 0)
+ return new byte[0];
+
+ // Count illegal characters (including '\r', '\n') to know what size the returned array will be,
+ // so we don't have to reallocate & copy it later.
+ int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...)
+ for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out.
+ if (IA[str.charAt(i)] < 0)
+ sepCnt++;
+
+ // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045.
+ if ((sLen - sepCnt) % 4 != 0)
+ return null;
+
+ // Count '=' at end
+ int pad = 0;
+ for (int i = sLen; i > 1 && IA[str.charAt(--i)] <= 0;)
+ if (str.charAt(i) == '=')
+ pad++;
+
+ int len = ((sLen - sepCnt) * 6 >> 3) - pad;
+
+ byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
+
+ for (int s = 0, d = 0; d < len;) {
+ // Assemble three bytes into an int from four "valid" characters.
+ int i = 0;
+ for (int j = 0; j < 4; j++) { // j only increased if a valid char was found.
+ int c = IA[str.charAt(s++)];
+ if (c >= 0)
+ i |= c << (18 - j * 6);
+ else
+ j--;
+ }
+ // Add the bytes
+ dArr[d++] = (byte) (i >> 16);
+ if (d < len) {
+ dArr[d++]= (byte) (i >> 8);
+ if (d < len)
+ dArr[d++] = (byte) i;
+ }
+ }
+ return dArr;
+ }
+
+ /** Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as
+ * fast as {@link #decode(String)}. The preconditions are:<br>
+ * + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
+ * + Line separator must be "\r\n", as specified in RFC 2045
+ * + The array must not contain illegal characters within the encoded string<br>
+ * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
+ * @param s The source string. Length 0 will return an empty array. <code>null</code> will throw an exception.
+ * @return The decoded array of bytes. May be of length 0.
+ */
+ public final static byte[] decodeFast(String s)
+ {
+ // Check special case
+ int sLen = s.length();
+ if (sLen == 0)
+ return new byte[0];
+
+ int sIx = 0, eIx = sLen - 1; // Start and end index after trimming.
+
+ // Trim illegal chars from start
+ while (sIx < eIx && IA[s.charAt(sIx) & 0xff] < 0)
+ sIx++;
+
+ // Trim illegal chars from end
+ while (eIx > 0 && IA[s.charAt(eIx) & 0xff] < 0)
+ eIx--;
+
+ // get the padding count (=) (0, 1 or 2)
+ int pad = s.charAt(eIx) == '=' ? (s.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end.
+ int cCnt = eIx - sIx + 1; // Content count including possible separators
+ int sepCnt = sLen > 76 ? (s.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0;
+
+ int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
+ byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
+
+ // Decode all but the last 0 - 2 bytes.
+ int d = 0;
+ for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
+ // Assemble three bytes into an int from four "valid" characters.
+ int i = IA[s.charAt(sIx++)] << 18 | IA[s.charAt(sIx++)] << 12 | IA[s.charAt(sIx++)] << 6 | IA[s.charAt(sIx++)];
+
+ // Add the bytes
+ dArr[d++] = (byte) (i >> 16);
+ dArr[d++] = (byte) (i >> 8);
+ dArr[d++] = (byte) i;
+
+ // If line separator, jump over it.
+ if (sepCnt > 0 && ++cc == 19) {
+ sIx += 2;
+ cc = 0;
+ }
+ }
+
+ if (d < len) {
+ // Decode last 1-3 bytes (incl '=') into 1-3 bytes
+ int i = 0;
+ for (int j = 0; sIx <= eIx - pad; j++)
+ i |= IA[s.charAt(sIx++)] << (18 - j * 6);
+
+ for (int r = 16; d < len; r -= 8)
+ dArr[d++] = (byte) (i >> r);
+ }
+
+ return dArr;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/isode/stroke/stringcodecs/HMACSHA1.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2010, Remko Tronçon.
+ * All rights reserved.
+ */
+package com.isode.stroke.stringcodecs;
+
+import com.isode.stroke.base.ByteArray;
+
+public class HMACSHA1 {
+
+ private static final int B = 64;
+
+ public static ByteArray getResult(ByteArray key, ByteArray data) {
+ assert key.getSize() <= B;
+
+ /* And an assert that does something */
+ if (key.getSize() > B) {
+ throw new IllegalStateException("Invalid key size.");
+ }
+
+ // Create the padded key
+ ByteArray paddedKey = new ByteArray(key);
+ for (int i = key.getSize(); i < B; ++i) {
+ paddedKey.append((byte) 0x0);
+ }
+
+ // Create the first value
+ ByteArray x = new ByteArray(paddedKey);
+ byte[] xInner = x.getData();
+ for (int i = 0; i < xInner.length; ++i) {
+ xInner[i] ^= 0x36;
+ }
+ x.append(data);
+
+ // Create the second value
+ ByteArray y = new ByteArray(paddedKey);
+ byte[] yInner = y.getData();
+ for (int i = 0; i < yInner.length; ++i) {
+ yInner[i] ^= 0x5c;
+ }
+ y.append(SHA1.getHash(x));
+
+ return SHA1.getHash(y);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/isode/stroke/stringcodecs/PBKDF2.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2010, Remko Tronçon.
+ * All rights reserved.
+ */
+package com.isode.stroke.stringcodecs;
+
+import com.isode.stroke.base.ByteArray;
+
+public class PBKDF2 {
+
+ public static ByteArray encode(ByteArray password, ByteArray salt, int iterations) {
+ ByteArray u = HMACSHA1.getResult(password, ByteArray.plus(salt, new ByteArray("\0\0\0\1")));
+ ByteArray result = new ByteArray(u);
+ byte[] resultData = result.getData();
+ int i = 1;
+ while (i < iterations) {
+ u = HMACSHA1.getResult(password, u);
+ for (int j = 0; j < u.getSize(); ++j) {
+ resultData[j] ^= u.getData()[j];
+ }
+ ++i;
+ }
+ return result;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/com/isode/stroke/stringcodecs/SHA1.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2010, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2010, Remko Tronçon.
+ * All rights reserved.
+ */
+package com.isode.stroke.stringcodecs;
+
+import com.isode.stroke.base.ByteArray;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class SHA1 {
+
+ public static ByteArray getHash(ByteArray data) {
+ MessageDigest md;
+ try {
+ md = MessageDigest.getInstance("SHA-1");
+ } catch (NoSuchAlgorithmException ex) {
+ throw new IllegalStateException("JRE doesn't have an SHA hash function", ex);
+ }
+ md.update(data.getData());
+ return new ByteArray(md.digest());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/de/duenndns/ssl/MTMDecision.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,33 @@
+/* MemorizingTrustManager - a TrustManager which asks the user about invalid
+ * certificates and memorizes their decision.
+ *
+ * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package de.duenndns.ssl;
+
+class MTMDecision {
+ public final static int DECISION_INVALID = 0;
+ public final static int DECISION_ABORT = 1;
+ public final static int DECISION_ONCE = 2;
+ public final static int DECISION_ALWAYS = 3;
+
+ int state = DECISION_INVALID;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/de/duenndns/ssl/MemorizingActivity.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,97 @@
+/* MemorizingTrustManager - a TrustManager which asks the user about invalid
+ * certificates and memorizes their decision.
+ *
+ * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package de.duenndns.ssl;
+
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.*;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.beem.project.beem.R;
+
+public class MemorizingActivity extends Activity
+ implements OnClickListener,OnCancelListener {
+ final static String TAG = "MemorizingActivity";
+
+ int decisionId;
+ String app;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ Log.d(TAG, "onCreate");
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ Intent i = getIntent();
+ app = i.getStringExtra(MemorizingTrustManager.DECISION_INTENT_APP);
+ decisionId = i.getIntExtra(MemorizingTrustManager.DECISION_INTENT_ID, MTMDecision.DECISION_INVALID);
+ String cert = i.getStringExtra(MemorizingTrustManager.DECISION_INTENT_CERT);
+ Log.d(TAG, "onResume with " + i.getExtras() + " decId=" + decisionId);
+ Log.d(TAG, "data: " + i.getData());
+ new AlertDialog.Builder(this).setTitle(R.string.mtm_accept_cert)
+ .setMessage(cert)
+ .setPositiveButton(R.string.mtm_decision_always, this)
+ .setNeutralButton(R.string.mtm_decision_once, this)
+ .setNegativeButton(R.string.mtm_decision_abort, this)
+ .setOnCancelListener(this)
+ .create().show();
+ }
+
+ void sendDecision(int decision) {
+ Log.d(TAG, "Sending decision to " + app + ": " + decision);
+ Intent i = new Intent(MemorizingTrustManager.DECISION_INTENT + "/" + app);
+ i.putExtra(MemorizingTrustManager.DECISION_INTENT_ID, decisionId);
+ i.putExtra(MemorizingTrustManager.DECISION_INTENT_CHOICE, decision);
+ sendBroadcast(i);
+ finish();
+ }
+
+ // react on AlertDialog button press
+ public void onClick(DialogInterface dialog, int btnId) {
+ int decision;
+ dialog.dismiss();
+ switch (btnId) {
+ case DialogInterface.BUTTON_POSITIVE:
+ decision = MTMDecision.DECISION_ALWAYS;
+ break;
+ case DialogInterface.BUTTON_NEUTRAL:
+ decision = MTMDecision.DECISION_ONCE;
+ break;
+ default:
+ decision = MTMDecision.DECISION_ABORT;
+ }
+ sendDecision(decision);
+ }
+
+ public void onCancel(DialogInterface dialog) {
+ sendDecision(MTMDecision.DECISION_ABORT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/de/duenndns/ssl/MemorizingTrustManager.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,493 @@
+/* MemorizingTrustManager - a TrustManager which asks the user about invalid
+ * certificates and memorizes their decision.
+ *
+ * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
+ *
+ * MemorizingTrustManager.java contains the actual trust manager and interface
+ * code to create a MemorizingActivity and obtain the results.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package de.duenndns.ssl;
+
+import android.app.Activity;
+import android.app.Application;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.Uri;
+import android.util.Log;
+import android.os.Handler;
+
+import java.io.File;
+import java.security.cert.*;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.MessageDigest;
+import java.util.HashMap;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+import com.beem.project.beem.R;
+
+/**
+ * A X509 trust manager implementation which asks the user about invalid
+ * certificates and memorizes their decision.
+ * <p>
+ * The certificate validity is checked using the system default X509
+ * TrustManager, creating a query Dialog if the check fails.
+ * <p>
+ * <b>WARNING:</b> This only works if a dedicated thread is used for
+ * opening sockets!
+ */
+public class MemorizingTrustManager implements X509TrustManager {
+ final static String TAG = "MemorizingTrustManager";
+ public final static String INTERCEPT_DECISION_INTENT = "de.duenndns.ssl.INTERCEPT_DECISION";
+ public final static String INTERCEPT_DECISION_INTENT_LAUNCH = INTERCEPT_DECISION_INTENT + ".launch_intent";
+ final static String DECISION_INTENT = "de.duenndns.ssl.DECISION";
+ final static String DECISION_INTENT_APP = DECISION_INTENT + ".app";
+ final static String DECISION_INTENT_ID = DECISION_INTENT + ".decisionId";
+ final static String DECISION_INTENT_CERT = DECISION_INTENT + ".cert";
+ final static String DECISION_INTENT_CHOICE = DECISION_INTENT + ".decisionChoice";
+ private final static int NOTIFICATION_ID = 100509;
+
+ static String KEYSTORE_DIR = "KeyStore";
+ static String KEYSTORE_FILE = "KeyStore.bks";
+
+ Context master;
+ Activity foregroundAct;
+ NotificationManager notificationManager;
+ private static int decisionId = 0;
+ private static HashMap<Integer, MTMDecision> openDecisions = new HashMap<Integer, MTMDecision>();
+
+ Handler masterHandler;
+ private File keyStoreFile;
+ private KeyStore appKeyStore;
+ private X509TrustManager defaultTrustManager;
+ private X509TrustManager appTrustManager;
+
+ /** Creates an instance of the MemorizingTrustManager class.
+ *
+ * You need to supply the application context. This has to be one of:
+ * - Application
+ * - Activity
+ * - Service
+ *
+ * The context is used for file management, to display the dialog /
+ * notification and for obtaining translated strings.
+ *
+ * @param m Context for the application.
+ */
+ public MemorizingTrustManager(Context m) {
+ master = m;
+ masterHandler = new Handler();
+ notificationManager = (NotificationManager)master.getSystemService(Context.NOTIFICATION_SERVICE);
+
+ Application app;
+ if (m instanceof Application) {
+ app = (Application)m;
+ } else if (m instanceof Service) {
+ app = ((Service)m).getApplication();
+ } else if (m instanceof Activity) {
+ app = ((Activity)m).getApplication();
+ } else throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!");
+
+ File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE);
+ keyStoreFile = new File(dir + File.separator + KEYSTORE_FILE);
+
+ appKeyStore = loadAppKeyStore();
+ defaultTrustManager = getTrustManager(null);
+ appTrustManager = getTrustManager(appKeyStore);
+ }
+
+ /**
+ * Returns a X509TrustManager list containing a new instance of
+ * TrustManagerFactory.
+ *
+ * This function is meant for convenience only. You can use it
+ * as follows to integrate TrustManagerFactory for HTTPS sockets:
+ *
+ * <pre>
+ * SSLContext sc = SSLContext.getInstance("TLS");
+ * sc.init(null, MemorizingTrustManager.getInstanceList(this),
+ * new java.security.SecureRandom());
+ * HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+ * </pre>
+ * @param c Activity or Service to show the Dialog / Notification
+ */
+ public static X509TrustManager[] getInstanceList(Context c) {
+ return new X509TrustManager[] { new MemorizingTrustManager(c) };
+ }
+
+ /**
+ * Binds an Activity to the MTM for displaying the query dialog.
+ *
+ * This is useful if your connection is run from a service that is
+ * triggered by user interaction -- in such cases the activity is
+ * visible and the user tends to ignore the service notification.
+ *
+ * You should never have a hidden activity bound to MTM! Use this
+ * function in onResume() and @see unbindDisplayActivity in onPause().
+ *
+ * @param act Activity to be bound
+ */
+ public void bindDisplayActivity(Activity act) {
+ foregroundAct = act;
+ }
+
+ /**
+ * Removes an Activity from the MTM display stack.
+ *
+ * Always call this function when the Activity added with
+ * @see bindDisplayActivity is hidden.
+ *
+ * @param act Activity to be unbound
+ */
+ public void unbindDisplayActivity(Activity act) {
+ // do not remove if it was overridden by a different activity
+ if (foregroundAct == act)
+ foregroundAct = null;
+ }
+
+ /**
+ * Changes the path for the KeyStore file.
+ *
+ * The actual filename relative to the app's directory will be
+ * <code>app_<i>dirname</i>/<i>filename</i></code>.
+ *
+ * @param dirname directory to store the KeyStore.
+ * @param filename file name for the KeyStore.
+ */
+ public static void setKeyStoreFile(String dirname, String filename) {
+ KEYSTORE_DIR = dirname;
+ KEYSTORE_FILE = filename;
+ }
+
+ X509TrustManager getTrustManager(KeyStore ks) {
+ try {
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
+ tmf.init(ks);
+ for (TrustManager t : tmf.getTrustManagers()) {
+ if (t instanceof X509TrustManager) {
+ return (X509TrustManager)t;
+ }
+ }
+ } catch (Exception e) {
+ // Here, we are covering up errors. It might be more useful
+ // however to throw them out of the constructor so the
+ // embedding app knows something went wrong.
+ Log.e(TAG, "getTrustManager(" + ks + ")", e);
+ }
+ return null;
+ }
+
+ KeyStore loadAppKeyStore() {
+ KeyStore ks;
+ try {
+ ks = KeyStore.getInstance(KeyStore.getDefaultType());
+ } catch (KeyStoreException e) {
+ Log.e(TAG, "getAppKeyStore()", e);
+ return null;
+ }
+ try {
+ ks.load(null, null);
+ ks.load(new java.io.FileInputStream(keyStoreFile), "MTM".toCharArray());
+ } catch (java.io.FileNotFoundException e) {
+ Log.i(TAG, "getAppKeyStore(" + keyStoreFile + ") - file does not exist");
+ } catch (Exception e) {
+ Log.e(TAG, "getAppKeyStore(" + keyStoreFile + ")", e);
+ }
+ return ks;
+ }
+
+ void storeCert(X509Certificate[] chain) {
+ // add all certs from chain to appKeyStore
+ try {
+ for (X509Certificate c : chain)
+ appKeyStore.setCertificateEntry(c.getSubjectDN().toString(), c);
+ } catch (KeyStoreException e) {
+ Log.e(TAG, "storeCert(" + chain + ")", e);
+ return;
+ }
+
+ // reload appTrustManager
+ appTrustManager = getTrustManager(appKeyStore);
+
+ // store KeyStore to file
+ try {
+ java.io.FileOutputStream fos = new java.io.FileOutputStream(keyStoreFile);
+ appKeyStore.store(fos, "MTM".toCharArray());
+ fos.close();
+ } catch (Exception e) {
+ Log.e(TAG, "storeCert(" + keyStoreFile + ")", e);
+ }
+ }
+
+ // if the certificate is stored in the app key store, it is considered "known"
+ private boolean isCertKnown(X509Certificate cert) {
+ try {
+ return appKeyStore.getCertificateAlias(cert) != null;
+ } catch (KeyStoreException e) {
+ return false;
+ }
+ }
+
+ private boolean isExpiredException(Throwable e) {
+ do {
+ if (e instanceof CertificateExpiredException)
+ return true;
+ e = e.getCause();
+ } while (e != null);
+ return false;
+ }
+
+ public void checkCertTrusted(X509Certificate[] chain, String authType, boolean isServer)
+ throws CertificateException
+ {
+ Log.d(TAG, "checkCertTrusted(" + chain + ", " + authType + ", " + isServer + ")");
+ try {
+ Log.d(TAG, "checkCertTrusted: trying appTrustManager");
+ if (isServer)
+ appTrustManager.checkServerTrusted(chain, authType);
+ else
+ appTrustManager.checkClientTrusted(chain, authType);
+ } catch (CertificateException ae) {
+ // if the cert is stored in our appTrustManager, we ignore expiredness
+ ae.printStackTrace();
+ if (isExpiredException(ae)) {
+ Log.i(TAG, "checkCertTrusted: accepting expired certificate from keystore");
+ return;
+ }
+ if (isCertKnown(chain[0])) {
+ Log.i(TAG, "checkCertTrusted: accepting cert already stored in keystore");
+ return;
+ }
+ try {
+ Log.d(TAG, "checkCertTrusted: trying defaultTrustManager");
+ if (isServer)
+ defaultTrustManager.checkServerTrusted(chain, authType);
+ else
+ defaultTrustManager.checkClientTrusted(chain, authType);
+ } catch (CertificateException e) {
+ e.printStackTrace();
+ interact(chain, authType, e);
+ }
+ }
+ }
+
+ public void checkClientTrusted(X509Certificate[] chain, String authType)
+ throws CertificateException
+ {
+ checkCertTrusted(chain, authType, false);
+ }
+
+ public void checkServerTrusted(X509Certificate[] chain, String authType)
+ throws CertificateException
+ {
+ checkCertTrusted(chain, authType, true);
+ }
+
+ public X509Certificate[] getAcceptedIssuers()
+ {
+ Log.d(TAG, "getAcceptedIssuers()");
+ return defaultTrustManager.getAcceptedIssuers();
+ }
+
+ private int createDecisionId(MTMDecision d) {
+ int myId;
+ synchronized(openDecisions) {
+ myId = decisionId;
+ openDecisions.put(myId, d);
+ decisionId += 1;
+ }
+ return myId;
+ }
+
+ private static String hexString(byte[] data) {
+ StringBuffer si = new StringBuffer();
+ for (int i = 0; i < data.length; i++) {
+ si.append(String.format("%02x", data[i]));
+ if (i < data.length - 1)
+ si.append(":");
+ }
+ return si.toString();
+ }
+
+ private static String certHash(final X509Certificate cert, String digest) {
+ try {
+ MessageDigest md = MessageDigest.getInstance(digest);
+ md.update(cert.getEncoded());
+ return hexString(md.digest());
+ } catch (java.security.cert.CertificateEncodingException e) {
+ return e.getMessage();
+ } catch (java.security.NoSuchAlgorithmException e) {
+ return e.getMessage();
+ }
+ }
+
+ private String certChainMessage(final X509Certificate[] chain, CertificateException cause) {
+ Throwable e = cause;
+ Log.d(TAG, "certChainMessage for " + e);
+ StringBuffer si = new StringBuffer();
+ if (e.getCause() != null) {
+ e = e.getCause();
+ si.append(e.getLocalizedMessage());
+ //si.append("\n");
+ }
+ for (X509Certificate c : chain) {
+ si.append("\n\n");
+ si.append(c.getSubjectDN().toString());
+ si.append("\nMD5: ");
+ si.append(certHash(c, "MD5"));
+ si.append("\nSHA1: ");
+ si.append(certHash(c, "SHA-1"));
+ si.append("\nSigned by: ");
+ si.append(c.getIssuerDN().toString());
+ }
+ return si.toString();
+ }
+
+ void startActivityNotification(PendingIntent intent, String certName) {
+ Notification n = new Notification(android.R.drawable.ic_lock_lock,
+ master.getString(R.string.mtm_notification),
+ System.currentTimeMillis());
+ n.setLatestEventInfo(master.getApplicationContext(),
+ master.getString(R.string.mtm_notification),
+ certName, intent);
+ n.flags |= Notification.FLAG_AUTO_CANCEL;
+
+ notificationManager.notify(NOTIFICATION_ID, n);
+ }
+
+ /**
+ * Returns the top-most entry of the activity stack.
+ *
+ * @return the Context of the currently bound UI or the master context if none is bound
+ */
+ Context getUI() {
+ return (foregroundAct != null) ? foregroundAct : master;
+ }
+
+ BroadcastReceiver launchServiceMode(Intent activityIntent, final String certMessage) {
+ BroadcastReceiver launchNotifReceiver= new BroadcastReceiver() {
+ public void onReceive(Context ctx, Intent i) {
+ Log.i(TAG, "Interception not done by the application. Send notification");
+ PendingIntent pi = i.getParcelableExtra(INTERCEPT_DECISION_INTENT_LAUNCH);
+ startActivityNotification(pi, certMessage);
+ }
+ };
+ master.registerReceiver(launchNotifReceiver, new IntentFilter(INTERCEPT_DECISION_INTENT + "/" + master.getPackageName()));
+ PendingIntent call = PendingIntent.getActivity(master, 0, activityIntent, 0);
+ Intent ni = new Intent(INTERCEPT_DECISION_INTENT + "/" + master.getPackageName());
+ ni.putExtra(INTERCEPT_DECISION_INTENT_LAUNCH, call);
+ master.sendOrderedBroadcast(ni, null);
+ return launchNotifReceiver;
+ }
+
+ void interact(final X509Certificate[] chain, String authType, CertificateException cause)
+ throws CertificateException
+ {
+ /* prepare the MTMDecision blocker object */
+ MTMDecision choice = new MTMDecision();
+ final int myId = createDecisionId(choice);
+ final String certMessage = certChainMessage(chain, cause);
+ BroadcastReceiver decisionReceiver = new BroadcastReceiver() {
+ public void onReceive(Context ctx, Intent i) { interactResult(i); }
+ };
+ master.registerReceiver(decisionReceiver, new IntentFilter(DECISION_INTENT + "/" + master.getPackageName()));
+ LaunchRunnable lr = new LaunchRunnable(myId, certMessage);
+ masterHandler.post(lr);
+
+ Log.d(TAG, "openDecisions: " + openDecisions);
+ Log.d(TAG, "waiting on " + myId);
+ try {
+ synchronized(choice) { choice.wait(); }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ master.unregisterReceiver(decisionReceiver);
+ if (lr.launchNotifReceiver != null)
+ master.unregisterReceiver(lr.launchNotifReceiver);
+ Log.d(TAG, "finished wait on " + myId + ": " + choice.state);
+ switch (choice.state) {
+ case MTMDecision.DECISION_ALWAYS:
+ storeCert(chain);
+ case MTMDecision.DECISION_ONCE:
+ break;
+ default:
+ throw (cause);
+ }
+ }
+
+ public static void interactResult(Intent i) {
+ int decisionId = i.getIntExtra(DECISION_INTENT_ID, MTMDecision.DECISION_INVALID);
+ int choice = i.getIntExtra(DECISION_INTENT_CHOICE, MTMDecision.DECISION_INVALID);
+ Log.d(TAG, "interactResult: " + decisionId + " chose " + choice);
+ Log.d(TAG, "openDecisions: " + openDecisions);
+
+ MTMDecision d;
+ synchronized(openDecisions) {
+ d = openDecisions.get(decisionId);
+ openDecisions.remove(decisionId);
+ }
+ if (d == null) {
+ Log.e(TAG, "interactResult: aborting due to stale decision reference!");
+ return;
+ }
+ synchronized(d) {
+ d.state = choice;
+ d.notify();
+ }
+ }
+
+ private class LaunchRunnable implements Runnable {
+ private int myId;
+ private String certMessage;
+ BroadcastReceiver launchNotifReceiver;
+
+ public LaunchRunnable(final int id, final String certMsg) {
+ myId = id;
+ certMessage = certMsg;
+ }
+
+ public void run() {
+ Intent ni = new Intent(master, MemorizingActivity.class);
+ ni.setData(Uri.parse(MemorizingTrustManager.class.getName() + "/" + myId));
+ ni.putExtra(DECISION_INTENT_APP, master.getPackageName());
+ ni.putExtra(DECISION_INTENT_ID, myId);
+ ni.putExtra(DECISION_INTENT_CERT, certMessage);
+
+ // we try to directly start the activity and fall back to
+ // making a notification
+ try {
+ getUI().startActivity(ni);
+ } catch (Exception e) {
+ Log.e(TAG, "startActivity: " + e);
+ launchNotifReceiver = launchServiceMode(ni, certMessage);
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/de/duenndns/ssl/package-info.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,7 @@
+/**
+ * This package contains the MemorizingTrustManager library made by Georg.
+ * It is a "plugin" for Android Java to allow asking the user about SSL certificates
+ * https://github.com/ge0rg/MemorizingTrustManager
+ */
+package de.duenndns.ssl;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrEngine.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,84 @@
+package net.java.otr4j;
+
+import java.security.PublicKey;
+
+import net.java.otr4j.session.SessionID;
+import net.java.otr4j.session.SessionStatus;
+
+/**
+ *
+ * @author George Politis
+ *
+ */
+public interface OtrEngine {
+
+ /**
+ *
+ * @param sessionID
+ * The session identifier.
+ * @param content
+ * The message content to be transformed.
+ * @return The transformed message content.
+ * @throws OtrException
+ */
+ public abstract String transformReceiving(SessionID sessionID,
+ String content) throws OtrException;
+
+ /**
+ *
+ * @param sessionID
+ * The session identifier.
+ * @param content
+ * The message content to be transformed.
+ * @return The transformed message content.
+ * @throws OtrException
+ */
+ public abstract String transformSending(SessionID sessionID, String content) throws OtrException;
+
+ /**
+ * Starts an Off-the-Record session, if there is no active one.
+ *
+ * @param sessionID
+ * The session identifier.
+ * @throws OtrException
+ */
+ public abstract void startSession(SessionID sessionID) throws OtrException;
+
+ /**
+ * Ends the Off-the-Record session, if exists.
+ *
+ * @param sessionID
+ * The session identifier.
+ * @throws OtrException
+ */
+ public abstract void endSession(SessionID sessionID) throws OtrException;
+
+ /**
+ * Stops/Starts the Off-the-Record session.
+ *
+ * @param sessionID
+ * The session identifier.
+ * @throws OtrException
+ */
+ public abstract void refreshSession(SessionID sessionID) throws OtrException;
+
+ /**
+ *
+ * @param sessionID
+ * The session identifier.
+ * @return The status of an Off-the-Record session.
+ */
+ public abstract SessionStatus getSessionStatus(SessionID sessionID);
+
+ /**
+ *
+ * @param sessionID
+ * The session identifier.
+ * @return The remote public key.
+ */
+ public abstract PublicKey getRemotePublicKey(SessionID sessionID);
+
+ public abstract void addOtrEngineListener(OtrEngineListener l);
+
+ public abstract void removeOtrEngineListener(OtrEngineListener l);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrEngineHost.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,31 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j;
+
+import java.security.KeyPair;
+
+import net.java.otr4j.session.SessionID;
+
+/**
+ *
+ * This interface should be implemented by the host application. It is required
+ * for otr4j to work properly.
+ *
+ * @author George Politis
+ *
+ */
+public abstract interface OtrEngineHost {
+ public abstract void injectMessage(SessionID sessionID, String msg);
+
+ public abstract void showWarning(SessionID sessionID, String warning);
+
+ public abstract void showError(SessionID sessionID, String error);
+
+ public abstract OtrPolicy getSessionPolicy(SessionID sessionID);
+
+ public abstract KeyPair getKeyPair(SessionID sessionID);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrEngineImpl.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,114 @@
+/*
+ * otr4j, the open source java otr librar
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package net.java.otr4j;
+
+import java.security.PublicKey;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import net.java.otr4j.session.Session;
+import net.java.otr4j.session.SessionID;
+import net.java.otr4j.session.SessionImpl;
+import net.java.otr4j.session.SessionStatus;
+
+/**
+ *
+ * @author George Politis
+ *
+ */
+public class OtrEngineImpl implements OtrEngine {
+
+ public OtrEngineImpl(OtrEngineHost host) {
+ if (host == null)
+ throw new IllegalArgumentException("OtrEgineHost is required.");
+
+ this.setHost(host);
+ }
+
+ private OtrEngineHost host;
+ private Map<SessionID, Session> sessions;
+
+ private Session getSession(SessionID sessionID) {
+
+ if (sessionID == null || sessionID.equals(SessionID.Empty))
+ throw new IllegalArgumentException();
+
+ if (sessions == null)
+ sessions = new Hashtable<SessionID, Session>();
+
+ if (!sessions.containsKey(sessionID)) {
+ Session session = new SessionImpl(sessionID, getHost());
+ sessions.put(sessionID, session);
+
+ session.addOtrEngineListener(new OtrEngineListener() {
+
+ public void sessionStatusChanged(SessionID sessionID) {
+ for (OtrEngineListener l : listeners)
+ l.sessionStatusChanged(sessionID);
+ }
+ });
+ return session;
+ } else
+ return sessions.get(sessionID);
+ }
+
+ public SessionStatus getSessionStatus(SessionID sessionID) {
+ return this.getSession(sessionID).getSessionStatus();
+ }
+
+ public String transformReceiving(SessionID sessionID, String msgText)
+ throws OtrException {
+ return this.getSession(sessionID).transformReceiving(msgText);
+ }
+
+ public String transformSending(SessionID sessionID, String msgText)
+ throws OtrException {
+ return this.getSession(sessionID).transformSending(msgText, null);
+ }
+
+ public void endSession(SessionID sessionID) throws OtrException {
+ this.getSession(sessionID).endSession();
+ }
+
+ public void startSession(SessionID sessionID) throws OtrException {
+ this.getSession(sessionID).startSession();
+ }
+
+ private void setHost(OtrEngineHost host) {
+ this.host = host;
+ }
+
+ private OtrEngineHost getHost() {
+ return host;
+ }
+
+ public void refreshSession(SessionID sessionID) throws OtrException {
+ this.getSession(sessionID).refreshSession();
+ }
+
+ public PublicKey getRemotePublicKey(SessionID sessionID) {
+ return this.getSession(sessionID).getRemotePublicKey();
+ }
+
+ private List<OtrEngineListener> listeners = new Vector<OtrEngineListener>();
+
+ public void addOtrEngineListener(OtrEngineListener l) {
+ synchronized (listeners) {
+ if (!listeners.contains(l))
+ listeners.add(l);
+ }
+ }
+
+ public void removeOtrEngineListener(OtrEngineListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrEngineListener.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,14 @@
+package net.java.otr4j;
+
+import net.java.otr4j.session.SessionID;
+
+/**
+ * This interface should be implemented by the host application. It notifies
+ * about session status changes.
+ *
+ * @author George Politis
+ *
+ */
+public interface OtrEngineListener {
+ public abstract void sessionStatusChanged(SessionID sessionID);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrException.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,10 @@
+package net.java.otr4j;
+
+
+public class OtrException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public OtrException(Exception e){
+ super(e);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrKeyManager.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,31 @@
+package net.java.otr4j;
+
+import java.security.KeyPair;
+import java.security.PublicKey;
+
+import net.java.otr4j.session.SessionID;
+
+public abstract interface OtrKeyManager {
+
+ public abstract void addListener(OtrKeyManagerListener l);
+
+ public abstract void removeListener(OtrKeyManagerListener l);
+
+ public abstract void verify(SessionID sessionID);
+
+ public abstract void unverify(SessionID sessionID);
+
+ public abstract boolean isVerified(SessionID sessionID);
+
+ public abstract String getRemoteFingerprint(SessionID sessionID);
+
+ public abstract String getLocalFingerprint(SessionID sessionID);
+
+ public abstract void savePublicKey(SessionID sessionID, PublicKey pubKey);
+
+ public abstract PublicKey loadRemotePublicKey(SessionID sessionID);
+
+ public abstract KeyPair loadLocalKeyPair(SessionID sessionID);
+
+ public abstract void generateLocalKeyPair(SessionID sessionID);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrKeyManagerImpl.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,304 @@
+package net.java.otr4j;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.List;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.bouncycastle2.util.encoders.Base64;
+
+import net.java.otr4j.crypto.OtrCryptoEngineImpl;
+import net.java.otr4j.crypto.OtrCryptoException;
+import net.java.otr4j.session.SessionID;
+
+public class OtrKeyManagerImpl implements OtrKeyManager {
+
+ private OtrKeyManagerStore store;
+
+ public OtrKeyManagerImpl(OtrKeyManagerStore store) {
+ this.store = store;
+ }
+
+ class DefaultPropertiesStore implements OtrKeyManagerStore {
+ private final Properties properties = new Properties();
+ private String filepath;
+
+ public DefaultPropertiesStore(String filepath) throws IOException {
+ if (filepath == null || filepath.length() < 1)
+ throw new IllegalArgumentException();
+ this.filepath = filepath;
+ properties.clear();
+
+ InputStream in = new BufferedInputStream(new FileInputStream(
+ getConfigurationFile()));
+ try {
+ properties.load(in);
+ } finally {
+ in.close();
+ }
+ }
+
+ private File getConfigurationFile() throws IOException {
+ File configFile = new File(filepath);
+ if (!configFile.exists())
+ configFile.createNewFile();
+ return configFile;
+ }
+
+ public void setProperty(String id, boolean value) {
+ properties.setProperty(id, "true");
+ try {
+ this.store();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void store() throws FileNotFoundException, IOException {
+ OutputStream out = new FileOutputStream(getConfigurationFile());
+ properties.store(out, null);
+ out.close();
+ }
+
+ public void setProperty(String id, byte[] value) {
+ properties.setProperty(id, new String(Base64.encode(value)));
+ try {
+ this.store();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void removeProperty(String id) {
+ properties.remove(id);
+
+ }
+
+ public byte[] getPropertyBytes(String id) {
+ String value = properties.getProperty(id);
+ if (value == null)
+ return null;
+ return Base64.decode(value);
+ }
+
+ public boolean getPropertyBoolean(String id, boolean defaultValue) {
+ try {
+ return Boolean.valueOf(properties.get(id).toString());
+ } catch (Exception e) {
+ return defaultValue;
+ }
+ }
+ }
+
+ public OtrKeyManagerImpl(String filepath) throws IOException {
+ this.store = new DefaultPropertiesStore(filepath);
+ }
+
+ private List<OtrKeyManagerListener> listeners = new Vector<OtrKeyManagerListener>();
+
+ public void addListener(OtrKeyManagerListener l) {
+ synchronized (listeners) {
+ if (!listeners.contains(l))
+ listeners.add(l);
+ }
+ }
+
+ public void removeListener(OtrKeyManagerListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+
+ public void generateLocalKeyPair(SessionID sessionID) {
+ if (sessionID == null)
+ return;
+
+ String accountID = sessionID.getAccountID();
+ KeyPair keyPair;
+ try {
+ keyPair = KeyPairGenerator.getInstance("DSA").genKeyPair();
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ return;
+ }
+
+ // Store Public Key.
+ PublicKey pubKey = keyPair.getPublic();
+ X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(pubKey
+ .getEncoded());
+
+ this.store.setProperty(accountID + ".publicKey", x509EncodedKeySpec
+ .getEncoded());
+
+ // Store Private Key.
+ PrivateKey privKey = keyPair.getPrivate();
+ PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(
+ privKey.getEncoded());
+
+ this.store.setProperty(accountID + ".privateKey", pkcs8EncodedKeySpec
+ .getEncoded());
+ }
+
+ public String getLocalFingerprint(SessionID sessionID) {
+ KeyPair keyPair = loadLocalKeyPair(sessionID);
+
+ if (keyPair == null)
+ return null;
+
+ PublicKey pubKey = keyPair.getPublic();
+
+ try {
+ return new OtrCryptoEngineImpl().getFingerprint(pubKey);
+ } catch (OtrCryptoException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public String getRemoteFingerprint(SessionID sessionID) {
+ PublicKey remotePublicKey = loadRemotePublicKey(sessionID);
+ if (remotePublicKey == null)
+ return null;
+ try {
+ return new OtrCryptoEngineImpl().getFingerprint(remotePublicKey);
+ } catch (OtrCryptoException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public boolean isVerified(SessionID sessionID) {
+ if (sessionID == null)
+ return false;
+
+ return this.store.getPropertyBoolean(sessionID.getUserID()
+ + ".publicKey.verified", false);
+ }
+
+ public KeyPair loadLocalKeyPair(SessionID sessionID) {
+ if (sessionID == null)
+ return null;
+
+ String accountID = sessionID.getAccountID();
+ // Load Private Key.
+ byte[] b64PrivKey = this.store.getPropertyBytes(accountID
+ + ".privateKey");
+ if (b64PrivKey == null)
+ return null;
+
+ PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(b64PrivKey);
+
+ // Load Public Key.
+ byte[] b64PubKey = this.store
+ .getPropertyBytes(accountID + ".publicKey");
+ if (b64PubKey == null)
+ return null;
+
+ X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(b64PubKey);
+
+ PublicKey publicKey;
+ PrivateKey privateKey;
+
+ // Generate KeyPair.
+ KeyFactory keyFactory;
+ try {
+ keyFactory = KeyFactory.getInstance("DSA");
+ publicKey = keyFactory.generatePublic(publicKeySpec);
+ privateKey = keyFactory.generatePrivate(privateKeySpec);
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ return null;
+ } catch (InvalidKeySpecException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ return new KeyPair(publicKey, privateKey);
+ }
+
+ public PublicKey loadRemotePublicKey(SessionID sessionID) {
+ if (sessionID == null)
+ return null;
+
+ String userID = sessionID.getUserID();
+
+ byte[] b64PubKey = this.store.getPropertyBytes(userID + ".publicKey");
+ if (b64PubKey == null)
+ return null;
+
+ X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(b64PubKey);
+
+ // Generate KeyPair.
+ KeyFactory keyFactory;
+ try {
+ keyFactory = KeyFactory.getInstance("DSA");
+ return keyFactory.generatePublic(publicKeySpec);
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ return null;
+ } catch (InvalidKeySpecException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void savePublicKey(SessionID sessionID, PublicKey pubKey) {
+ if (sessionID == null)
+ return;
+
+ X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(pubKey
+ .getEncoded());
+
+ String userID = sessionID.getUserID();
+ this.store.setProperty(userID + ".publicKey", x509EncodedKeySpec
+ .getEncoded());
+
+ this.store.removeProperty(userID + ".publicKey.verified");
+ }
+
+ public void unverify(SessionID sessionID) {
+ if (sessionID == null)
+ return;
+
+ if (!isVerified(sessionID))
+ return;
+
+ this.store
+ .removeProperty(sessionID.getUserID() + ".publicKey.verified");
+
+ for (OtrKeyManagerListener l : listeners)
+ l.verificationStatusChanged(sessionID);
+
+ }
+
+ public void verify(SessionID sessionID) {
+ if (sessionID == null)
+ return;
+
+ if (this.isVerified(sessionID))
+ return;
+
+ this.store.setProperty(sessionID.getUserID() + ".publicKey.verified",
+ true);
+
+ for (OtrKeyManagerListener l : listeners)
+ l.verificationStatusChanged(sessionID);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrKeyManagerListener.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,7 @@
+package net.java.otr4j;
+
+import net.java.otr4j.session.SessionID;
+
+public interface OtrKeyManagerListener {
+ public abstract void verificationStatusChanged(SessionID session);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrKeyManagerStore.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,13 @@
+package net.java.otr4j;
+
+public interface OtrKeyManagerStore {
+ public abstract byte[] getPropertyBytes(String id);
+
+ public abstract boolean getPropertyBoolean(String id, boolean defaultValue);
+
+ public abstract void setProperty(String id, byte[] value);
+
+ public abstract void setProperty(String id, boolean value);
+
+ public abstract void removeProperty(String id);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrPolicy.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,68 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j;
+
+/**
+ *
+ * @author George Politis
+ *
+ */
+public interface OtrPolicy {
+
+ public static final int ALLOW_V1 = 0x01;
+ public static final int ALLOW_V2 = 0x02;
+ public static final int REQUIRE_ENCRYPTION = 0x04;
+ public static final int SEND_WHITESPACE_TAG = 0x08;
+ public static final int WHITESPACE_START_AKE = 0x10;
+ public static final int ERROR_START_AKE = 0x20;
+ public static final int VERSION_MASK = (ALLOW_V1 | ALLOW_V2);
+
+ // The four old version 1 policies correspond to the following combinations
+ // of flags (adding an allowance for version 2 of the protocol):
+
+ public static final int NEVER = 0x00;
+ public static final int OPPORTUNISTIC = (ALLOW_V1 | ALLOW_V2
+ | SEND_WHITESPACE_TAG | WHITESPACE_START_AKE | ERROR_START_AKE);
+ public static final int OTRL_POLICY_MANUAL = (ALLOW_V1 | ALLOW_V2);
+ public static final int OTRL_POLICY_ALWAYS = (ALLOW_V1 | ALLOW_V2
+ | REQUIRE_ENCRYPTION | WHITESPACE_START_AKE | ERROR_START_AKE);
+ public static final int OTRL_POLICY_DEFAULT = OPPORTUNISTIC;
+
+ public abstract boolean getAllowV1();
+
+ public abstract boolean getAllowV2();
+
+ public abstract boolean getRequireEncryption();
+
+ public abstract boolean getSendWhitespaceTag();
+
+ public abstract boolean getWhitespaceStartAKE();
+
+ public abstract boolean getErrorStartAKE();
+
+ public abstract int getPolicy();
+
+ public abstract void setAllowV1(boolean value);
+
+ public abstract void setAllowV2(boolean value);
+
+ public abstract void setRequireEncryption(boolean value);
+
+ public abstract void setSendWhitespaceTag(boolean value);
+
+ public abstract void setWhitespaceStartAKE(boolean value);
+
+ public abstract void setErrorStartAKE(boolean value);
+
+ public abstract void setEnableAlways(boolean value);
+
+ public abstract boolean getEnableAlways();
+
+ public abstract void setEnableManual(boolean value);
+
+ public abstract boolean getEnableManual();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/OtrPolicyImpl.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,128 @@
+package net.java.otr4j;
+
+public class OtrPolicyImpl implements OtrPolicy {
+
+ public OtrPolicyImpl() {
+ this.setPolicy(NEVER);
+ }
+
+ public OtrPolicyImpl(int policy) {
+ this.setPolicy(policy);
+ }
+
+ private int policy;
+
+ public int getPolicy() {
+ return policy;
+ }
+
+ private void setPolicy(int policy) {
+ this.policy = policy;
+ }
+
+ public boolean getAllowV1() {
+ return (policy & OtrPolicy.ALLOW_V1) != 0;
+ }
+
+ public boolean getAllowV2() {
+ return (policy & OtrPolicy.ALLOW_V2) != 0;
+ }
+
+ public boolean getErrorStartAKE() {
+ return (policy & OtrPolicy.ERROR_START_AKE) != 0;
+ }
+
+ public boolean getRequireEncryption() {
+ return getEnableManual()
+ && (policy & OtrPolicy.REQUIRE_ENCRYPTION) != 0;
+ }
+
+ public boolean getSendWhitespaceTag() {
+ return (policy & OtrPolicy.SEND_WHITESPACE_TAG) != 0;
+ }
+
+ public boolean getWhitespaceStartAKE() {
+ return (policy & OtrPolicy.WHITESPACE_START_AKE) != 0;
+ }
+
+ public void setAllowV1(boolean value) {
+ if (value)
+ policy |= ALLOW_V1;
+ else
+ policy &= ~ALLOW_V1;
+ }
+
+ public void setAllowV2(boolean value) {
+ if (value)
+ policy |= ALLOW_V2;
+ else
+ policy &= ~ALLOW_V2;
+ }
+
+ public void setErrorStartAKE(boolean value) {
+ if (value)
+ policy |= ERROR_START_AKE;
+ else
+ policy &= ~ERROR_START_AKE;
+ }
+
+ public void setRequireEncryption(boolean value) {
+ if (value)
+ policy |= REQUIRE_ENCRYPTION;
+ else
+ policy &= ~REQUIRE_ENCRYPTION;
+ }
+
+ public void setSendWhitespaceTag(boolean value) {
+ if (value)
+ policy |= SEND_WHITESPACE_TAG;
+ else
+ policy &= ~SEND_WHITESPACE_TAG;
+ }
+
+ public void setWhitespaceStartAKE(boolean value) {
+ if (value)
+ policy |= WHITESPACE_START_AKE;
+ else
+ policy &= ~WHITESPACE_START_AKE;
+ }
+
+ public boolean getEnableAlways() {
+ return getEnableManual() && getErrorStartAKE()
+ && getSendWhitespaceTag() && getWhitespaceStartAKE();
+ }
+
+ public void setEnableAlways(boolean value) {
+ if (value)
+ setEnableManual(true);
+
+ setErrorStartAKE(value);
+ setSendWhitespaceTag(value);
+ setWhitespaceStartAKE(value);
+
+ }
+
+ public boolean getEnableManual() {
+ return getAllowV1() && getAllowV2();
+ }
+
+ public void setEnableManual(boolean value) {
+ setAllowV1(value);
+ setAllowV2(value);
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (obj == null || obj.getClass() != this.getClass())
+ return false;
+
+ OtrPolicy policy = (OtrPolicy) obj;
+
+ return policy.getPolicy() == this.getPolicy();
+ }
+
+ public int hashCode() {
+ return this.getPolicy();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/crypto/OtrCryptoEngine.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,83 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package net.java.otr4j.crypto;
+
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+/**
+ *
+ * @author George Politis
+ *
+ */
+public interface OtrCryptoEngine {
+
+ public static final String MODULUS_TEXT = "00FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF";
+ public static final BigInteger MODULUS = new BigInteger(MODULUS_TEXT, 16);
+ public static final BigInteger BIGINTEGER_TWO = BigInteger.valueOf(2);
+ public static final BigInteger MODULUS_MINUS_TWO = MODULUS
+ .subtract(BIGINTEGER_TWO);
+
+ public static String GENERATOR_TEXT = "2";
+ public static BigInteger GENERATOR = new BigInteger(GENERATOR_TEXT, 10);
+
+ public static final int AES_KEY_BYTE_LENGTH = 16;
+ public static final int SHA256_HMAC_KEY_BYTE_LENGTH = 32;
+ public static final int DH_PRIVATE_KEY_MINIMUM_BIT_LENGTH = 320;
+ public static final byte[] ZERO_CTR = new byte[] { 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00 };
+
+ public static final int DSA_PUB_TYPE = 0;
+
+ public abstract KeyPair generateDHKeyPair() throws OtrCryptoException;
+
+ public abstract DHPublicKey getDHPublicKey(byte[] mpiBytes)
+ throws OtrCryptoException;
+
+ public abstract DHPublicKey getDHPublicKey(BigInteger mpi)
+ throws OtrCryptoException;
+
+ public abstract byte[] sha256Hmac(byte[] b, byte[] key)
+ throws OtrCryptoException;
+
+ public abstract byte[] sha256Hmac(byte[] b, byte[] key, int length)
+ throws OtrCryptoException;
+
+ public abstract byte[] sha1Hmac(byte[] b, byte[] key, int length)
+ throws OtrCryptoException;
+
+ public abstract byte[] sha256Hmac160(byte[] b, byte[] key)
+ throws OtrCryptoException;
+
+ public abstract byte[] sha256Hash(byte[] b) throws OtrCryptoException;
+
+ public abstract byte[] sha1Hash(byte[] b) throws OtrCryptoException;
+
+ public abstract byte[] aesDecrypt(byte[] key, byte[] ctr, byte[] b)
+ throws OtrCryptoException;
+
+ public abstract byte[] aesEncrypt(byte[] key, byte[] ctr, byte[] b)
+ throws OtrCryptoException;
+
+ public abstract BigInteger generateSecret(PrivateKey privKey,
+ PublicKey pubKey) throws OtrCryptoException;
+
+ public abstract byte[] sign(byte[] b, PrivateKey privatekey)
+ throws OtrCryptoException;
+
+ public abstract boolean verify(byte[] b, PublicKey pubKey, byte[] rs)
+ throws OtrCryptoException;
+
+ public abstract String getFingerprint(PublicKey pubKey)
+ throws OtrCryptoException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/crypto/OtrCryptoEngineImpl.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,393 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.crypto;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.security.InvalidKeyException;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.SecureRandom;
+import java.security.interfaces.DSAParams;
+import java.security.interfaces.DSAPrivateKey;
+import java.security.interfaces.DSAPublicKey;
+
+import javax.crypto.KeyAgreement;
+import javax.crypto.interfaces.DHPrivateKey;
+import javax.crypto.interfaces.DHPublicKey;
+import javax.crypto.spec.DHPrivateKeySpec;
+import javax.crypto.spec.DHPublicKeySpec;
+import javax.crypto.spec.SecretKeySpec;
+
+import net.java.otr4j.io.SerializationUtils;
+
+import org.bouncycastle2.crypto.AsymmetricCipherKeyPair;
+import org.bouncycastle2.crypto.BufferedBlockCipher;
+import org.bouncycastle2.crypto.engines.AESFastEngine;
+import org.bouncycastle2.crypto.generators.DHKeyPairGenerator;
+import org.bouncycastle2.crypto.modes.SICBlockCipher;
+import org.bouncycastle2.crypto.params.DHKeyGenerationParameters;
+import org.bouncycastle2.crypto.params.DHParameters;
+import org.bouncycastle2.crypto.params.DHPrivateKeyParameters;
+import org.bouncycastle2.crypto.params.DHPublicKeyParameters;
+import org.bouncycastle2.crypto.params.DSAParameters;
+import org.bouncycastle2.crypto.params.DSAPrivateKeyParameters;
+import org.bouncycastle2.crypto.params.DSAPublicKeyParameters;
+import org.bouncycastle2.crypto.params.KeyParameter;
+import org.bouncycastle2.crypto.params.ParametersWithIV;
+import org.bouncycastle2.crypto.signers.DSASigner;
+import org.bouncycastle2.util.BigIntegers;
+
+/**
+ *
+ * @author George Politis
+ *
+ */
+public class OtrCryptoEngineImpl implements OtrCryptoEngine {
+
+ public KeyPair generateDHKeyPair() throws OtrCryptoException {
+
+ // Generate a AsymmetricCipherKeyPair using BC.
+ DHParameters dhParams = new DHParameters(MODULUS, GENERATOR, null,
+ DH_PRIVATE_KEY_MINIMUM_BIT_LENGTH);
+ DHKeyGenerationParameters params = new DHKeyGenerationParameters(
+ new SecureRandom(), dhParams);
+ DHKeyPairGenerator kpGen = new DHKeyPairGenerator();
+
+ kpGen.init(params);
+ AsymmetricCipherKeyPair pair = kpGen.generateKeyPair();
+
+ // Convert this AsymmetricCipherKeyPair to a standard JCE KeyPair.
+ DHPublicKeyParameters pub = (DHPublicKeyParameters) pair.getPublic();
+ DHPrivateKeyParameters priv = (DHPrivateKeyParameters) pair
+ .getPrivate();
+
+ try {
+ KeyFactory keyFac = KeyFactory.getInstance("DH");
+
+ DHPublicKeySpec pubKeySpecs = new DHPublicKeySpec(pub.getY(),
+ MODULUS, GENERATOR);
+ DHPublicKey pubKey = (DHPublicKey) keyFac
+ .generatePublic(pubKeySpecs);
+
+ DHParameters dhParameters = priv.getParameters();
+ DHPrivateKeySpec privKeySpecs = new DHPrivateKeySpec(priv.getX(),
+ dhParameters.getP(), dhParameters.getG());
+ DHPrivateKey privKey = (DHPrivateKey) keyFac
+ .generatePrivate(privKeySpecs);
+
+ return new KeyPair(pubKey, privKey);
+ } catch (Exception e) {
+ throw new OtrCryptoException(e);
+ }
+ }
+
+ public DHPublicKey getDHPublicKey(byte[] mpiBytes)
+ throws OtrCryptoException {
+ return getDHPublicKey(new BigInteger(mpiBytes));
+ }
+
+ public DHPublicKey getDHPublicKey(BigInteger mpi) throws OtrCryptoException {
+ DHPublicKeySpec pubKeySpecs = new DHPublicKeySpec(mpi, MODULUS,
+ GENERATOR);
+ try {
+ KeyFactory keyFac = KeyFactory.getInstance("DH");
+ return (DHPublicKey) keyFac.generatePublic(pubKeySpecs);
+ } catch (Exception e) {
+ throw new OtrCryptoException(e);
+ }
+ }
+
+ public byte[] sha256Hmac(byte[] b, byte[] key) throws OtrCryptoException {
+ return this.sha256Hmac(b, key, 0);
+ }
+
+ public byte[] sha256Hmac(byte[] b, byte[] key, int length)
+ throws OtrCryptoException {
+
+ SecretKeySpec keyspec = new SecretKeySpec(key, "HmacSHA256");
+ javax.crypto.Mac mac;
+ try {
+ mac = javax.crypto.Mac.getInstance("HmacSHA256");
+ } catch (NoSuchAlgorithmException e) {
+ throw new OtrCryptoException(e);
+ }
+ try {
+ mac.init(keyspec);
+ } catch (InvalidKeyException e) {
+ throw new OtrCryptoException(e);
+ }
+
+ byte[] macBytes = mac.doFinal(b);
+
+ if (length > 0) {
+ byte[] bytes = new byte[length];
+ ByteBuffer buff = ByteBuffer.wrap(macBytes);
+ buff.get(bytes);
+ return bytes;
+ } else {
+ return macBytes;
+ }
+ }
+
+ public byte[] sha1Hmac(byte[] b, byte[] key, int length)
+ throws OtrCryptoException {
+
+ try {
+ SecretKeySpec keyspec = new SecretKeySpec(key, "HmacSHA1");
+ javax.crypto.Mac mac = javax.crypto.Mac.getInstance("HmacSHA1");
+ mac.init(keyspec);
+
+ byte[] macBytes = mac.doFinal(b);
+
+ if (length > 0) {
+ byte[] bytes = new byte[length];
+ ByteBuffer buff = ByteBuffer.wrap(macBytes);
+ buff.get(bytes);
+ return bytes;
+ } else {
+ return macBytes;
+ }
+ } catch (Exception e) {
+ throw new OtrCryptoException(e);
+ }
+ }
+
+ public byte[] sha256Hmac160(byte[] b, byte[] key) throws OtrCryptoException {
+ return sha256Hmac(b, key, 20);
+ }
+
+ public byte[] sha256Hash(byte[] b) throws OtrCryptoException {
+ try {
+ MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
+ sha256.update(b, 0, b.length);
+ return sha256.digest();
+ } catch (Exception e) {
+ throw new OtrCryptoException(e);
+ }
+ }
+
+ public byte[] sha1Hash(byte[] b) throws OtrCryptoException {
+ try {
+ MessageDigest sha256 = MessageDigest.getInstance("SHA-1");
+ sha256.update(b, 0, b.length);
+ return sha256.digest();
+ } catch (Exception e) {
+ throw new OtrCryptoException(e);
+ }
+ }
+
+ public byte[] aesDecrypt(byte[] key, byte[] ctr, byte[] b)
+ throws OtrCryptoException {
+
+ AESFastEngine aesDec = new AESFastEngine();
+ SICBlockCipher sicAesDec = new SICBlockCipher(aesDec);
+ BufferedBlockCipher bufSicAesDec = new BufferedBlockCipher(sicAesDec);
+
+ // Create initial counter value 0.
+ if (ctr == null)
+ ctr = ZERO_CTR;
+ bufSicAesDec.init(false, new ParametersWithIV(new KeyParameter(key),
+ ctr));
+ byte[] aesOutLwDec = new byte[b.length];
+ int done = bufSicAesDec.processBytes(b, 0, b.length, aesOutLwDec, 0);
+ try {
+ bufSicAesDec.doFinal(aesOutLwDec, done);
+ } catch (Exception e) {
+ throw new OtrCryptoException(e);
+ }
+
+ return aesOutLwDec;
+ }
+
+ public byte[] aesEncrypt(byte[] key, byte[] ctr, byte[] b)
+ throws OtrCryptoException {
+
+ AESFastEngine aesEnc = new AESFastEngine();
+ SICBlockCipher sicAesEnc = new SICBlockCipher(aesEnc);
+ BufferedBlockCipher bufSicAesEnc = new BufferedBlockCipher(sicAesEnc);
+
+ // Create initial counter value 0.
+ if (ctr == null)
+ ctr = ZERO_CTR;
+ bufSicAesEnc.init(true,
+ new ParametersWithIV(new KeyParameter(key), ctr));
+ byte[] aesOutLwEnc = new byte[b.length];
+ int done = bufSicAesEnc.processBytes(b, 0, b.length, aesOutLwEnc, 0);
+ try {
+ bufSicAesEnc.doFinal(aesOutLwEnc, done);
+ } catch (Exception e) {
+ throw new OtrCryptoException(e);
+ }
+ return aesOutLwEnc;
+ }
+
+ public BigInteger generateSecret(PrivateKey privKey, PublicKey pubKey)
+ throws OtrCryptoException {
+ try {
+ KeyAgreement ka = KeyAgreement.getInstance("DH");
+ ka.init(privKey);
+ ka.doPhase(pubKey, true);
+ byte[] sb = ka.generateSecret();
+ BigInteger s = new BigInteger(1, sb);
+ return s;
+
+ } catch (Exception e) {
+ throw new OtrCryptoException(e);
+ }
+ }
+
+ public byte[] sign(byte[] b, PrivateKey privatekey)
+ throws OtrCryptoException {
+
+ if (!(privatekey instanceof DSAPrivateKey))
+ throw new IllegalArgumentException();
+
+ DSAParams dsaParams = ((DSAPrivateKey) privatekey).getParams();
+ DSAParameters bcDSAParameters = new DSAParameters(dsaParams.getP(),
+ dsaParams.getQ(), dsaParams.getG());
+
+ DSAPrivateKey dsaPrivateKey = (DSAPrivateKey) privatekey;
+ DSAPrivateKeyParameters bcDSAPrivateKeyParms = new DSAPrivateKeyParameters(
+ dsaPrivateKey.getX(), bcDSAParameters);
+
+ DSASigner dsaSigner = new DSASigner();
+ dsaSigner.init(true, bcDSAPrivateKeyParms);
+
+ BigInteger q = dsaParams.getQ();
+
+ // Ian: Note that if you can get the standard DSA implementation you're
+ // using to not hash its input, you should be able to pass it ((256-bit
+ // value) mod q), (rather than truncating the 256-bit value) and all
+ // should be well.
+ // ref: Interop problems with libotr - DSA signature
+ BigInteger bmpi = new BigInteger(1, b);
+ BigInteger[] rs = dsaSigner.generateSignature(BigIntegers
+ .asUnsignedByteArray(bmpi.mod(q)));
+
+ int siglen = q.bitLength() / 4;
+ int rslen = siglen / 2;
+ byte[] rb = BigIntegers.asUnsignedByteArray(rs[0]);
+ byte[] sb = BigIntegers.asUnsignedByteArray(rs[1]);
+
+ // Create the final signature array, padded with zeros if necessary.
+ byte[] sig = new byte[siglen];
+ Boolean writeR = false;
+ Boolean writeS = false;
+ for (int i = 0; i < siglen; i++) {
+ if (i < rslen) {
+ if (!writeR)
+ writeR = rb.length >= rslen - i;
+ sig[i] = (writeR) ? rb[i] : (byte) 0x0;
+ } else {
+ int j = i - rslen; // Rebase.
+ if (!writeS)
+ writeS = sb.length >= rslen - j;
+ sig[i] = (writeS) ? sb[j] : (byte) 0x0;
+ }
+ }
+ return sig;
+ }
+
+ public boolean verify(byte[] b, PublicKey pubKey, byte[] rs)
+ throws OtrCryptoException {
+
+ if (!(pubKey instanceof DSAPublicKey))
+ throw new IllegalArgumentException();
+
+ DSAParams dsaParams = ((DSAPublicKey) pubKey).getParams();
+ int qlen = dsaParams.getQ().bitLength() / 8;
+ ByteBuffer buff = ByteBuffer.wrap(rs);
+ byte[] r = new byte[qlen];
+ buff.get(r);
+ byte[] s = new byte[qlen];
+ buff.get(s);
+ return verify(b, pubKey, r, s);
+ }
+
+ private Boolean verify(byte[] b, PublicKey pubKey, byte[] r, byte[] s)
+ throws OtrCryptoException {
+ Boolean result = verify(b, pubKey, new BigInteger(1, r),
+ new BigInteger(1, s));
+ return result;
+ }
+
+ private Boolean verify(byte[] b, PublicKey pubKey, BigInteger r,
+ BigInteger s) throws OtrCryptoException {
+
+ if (!(pubKey instanceof DSAPublicKey))
+ throw new IllegalArgumentException();
+
+ DSAParams dsaParams = ((DSAPublicKey) pubKey).getParams();
+
+ BigInteger q = dsaParams.getQ();
+ DSAParameters bcDSAParams = new DSAParameters(dsaParams.getP(), q,
+ dsaParams.getG());
+
+ DSAPublicKey dsaPrivateKey = (DSAPublicKey) pubKey;
+ DSAPublicKeyParameters dsaPrivParms = new DSAPublicKeyParameters(
+ dsaPrivateKey.getY(), bcDSAParams);
+
+ // Ian: Note that if you can get the standard DSA implementation you're
+ // using to not hash its input, you should be able to pass it ((256-bit
+ // value) mod q), (rather than truncating the 256-bit value) and all
+ // should be well.
+ // ref: Interop problems with libotr - DSA signature
+ DSASigner dsaSigner = new DSASigner();
+ dsaSigner.init(false, dsaPrivParms);
+
+ BigInteger bmpi = new BigInteger(1, b);
+ Boolean result = dsaSigner.verifySignature(BigIntegers
+ .asUnsignedByteArray(bmpi.mod(q)), r, s);
+ return result;
+ }
+
+ public String getFingerprint(PublicKey pubKey) throws OtrCryptoException {
+ byte[] b;
+ try {
+ byte[] bRemotePubKey = SerializationUtils.writePublicKey(pubKey);
+
+ if (pubKey.getAlgorithm().equals("DSA")) {
+ byte[] trimmed = new byte[bRemotePubKey.length - 2];
+ System.arraycopy(bRemotePubKey, 2, trimmed, 0, trimmed.length);
+ b = new OtrCryptoEngineImpl().sha1Hash(trimmed);
+ } else
+ b = new OtrCryptoEngineImpl().sha1Hash(bRemotePubKey);
+ } catch (IOException e) {
+ throw new OtrCryptoException(e);
+ }
+ return this.byteArrayToHexString(b);
+ }
+
+ private String byteArrayToHexString(byte in[]) {
+ byte ch = 0x00;
+ int i = 0;
+ if (in == null || in.length <= 0)
+ return null;
+ String pseudo[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
+ "A", "B", "C", "D", "E", "F" };
+ StringBuffer out = new StringBuffer(in.length * 2);
+ while (i < in.length) {
+ ch = (byte) (in[i] & 0xF0);
+ ch = (byte) (ch >>> 4);
+ ch = (byte) (ch & 0x0F);
+ out.append(pseudo[(int) ch]);
+ ch = (byte) (in[i] & 0x0F);
+ out.append(pseudo[(int) ch]);
+ i++;
+ }
+
+ String rslt = new String(out);
+ return rslt;
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/crypto/OtrCryptoException.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,12 @@
+package net.java.otr4j.crypto;
+
+import net.java.otr4j.OtrException;
+
+@SuppressWarnings("serial")
+public class OtrCryptoException extends OtrException {
+
+ public OtrCryptoException(Exception e) {
+ super(e);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/OtrInputStream.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,135 @@
+package net.java.otr4j.io;
+
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.PublicKey;
+import java.security.interfaces.DSAParams;
+import java.security.interfaces.DSAPublicKey;
+import java.security.spec.DSAPublicKeySpec;
+import java.security.spec.InvalidKeySpecException;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+import net.java.otr4j.crypto.OtrCryptoEngineImpl;
+import net.java.otr4j.io.messages.SignatureX;
+
+public class OtrInputStream extends FilterInputStream implements
+ SerializationConstants {
+
+ public OtrInputStream(InputStream in) {
+ super(in);
+ }
+
+ private int readNumber(int length) throws IOException {
+ byte[] b = new byte[length];
+ read(b);
+
+ int value = 0;
+ for (int i = 0; i < b.length; i++) {
+ int shift = (b.length - 1 - i) * 8;
+ value += (b[i] & 0x000000FF) << shift;
+ }
+
+ return value;
+ }
+
+ public int readByte() throws IOException {
+ return readNumber(TYPE_LEN_BYTE);
+ }
+
+ public int readInt() throws IOException {
+ return readNumber(TYPE_LEN_INT);
+ }
+
+ public int readShort() throws IOException {
+ return readNumber(TYPE_LEN_SHORT);
+ }
+
+ public byte[] readCtr() throws IOException {
+ byte[] b = new byte[TYPE_LEN_CTR];
+ read(b);
+ return b;
+ }
+
+ public byte[] readMac() throws IOException {
+ byte[] b = new byte[TYPE_LEN_MAC];
+ read(b);
+ return b;
+ }
+
+ public BigInteger readBigInt() throws IOException {
+ byte[] b = readData();
+ return new BigInteger(1, b);
+ }
+
+ public byte[] readData() throws IOException {
+ int dataLen = readNumber(DATA_LEN);
+ byte[] b = new byte[dataLen];
+ read(b);
+ return b;
+ }
+
+ public PublicKey readPublicKey() throws IOException {
+ int type = readShort();
+ switch (type) {
+ case 0:
+ BigInteger p = readBigInt();
+ BigInteger q = readBigInt();
+ BigInteger g = readBigInt();
+ BigInteger y = readBigInt();
+ DSAPublicKeySpec keySpec = new DSAPublicKeySpec(y, p, q, g);
+ KeyFactory keyFactory;
+ try {
+ keyFactory = KeyFactory.getInstance("DSA");
+ } catch (NoSuchAlgorithmException e) {
+ throw new IOException();
+ }
+ try {
+ return keyFactory.generatePublic(keySpec);
+ } catch (InvalidKeySpecException e) {
+ throw new IOException();
+ }
+ default:
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public DHPublicKey readDHPublicKey() throws IOException {
+ BigInteger gyMpi = readBigInt();
+ try {
+ return new OtrCryptoEngineImpl().getDHPublicKey(gyMpi);
+ } catch (Exception ex) {
+ throw new IOException();
+ }
+ }
+
+ public byte[] readTlvData() throws IOException {
+ int len = readNumber(TYPE_LEN_BYTE);
+
+ byte[] b = new byte[len];
+ in.read(b);
+ return b;
+ }
+
+ public byte[] readSignature(PublicKey pubKey) throws IOException {
+ if (!pubKey.getAlgorithm().equals("DSA"))
+ throw new UnsupportedOperationException();
+
+ DSAPublicKey dsaPubKey = (DSAPublicKey) pubKey;
+ DSAParams dsaParams = dsaPubKey.getParams();
+ byte[] sig = new byte[dsaParams.getQ().bitLength() / 4];
+ read(sig);
+ return sig;
+ }
+
+ public SignatureX readMysteriousX() throws IOException {
+ PublicKey pubKey = readPublicKey();
+ int dhKeyID = readInt();
+ byte[] sig = readSignature(pubKey);
+ return new SignatureX(pubKey, dhKeyID, sig);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/OtrOutputStream.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,140 @@
+package net.java.otr4j.io;
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigInteger;
+import java.security.PublicKey;
+import java.security.interfaces.DSAParams;
+import java.security.interfaces.DSAPublicKey;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+import net.java.otr4j.io.messages.SignatureM;
+import net.java.otr4j.io.messages.MysteriousT;
+import net.java.otr4j.io.messages.SignatureX;
+
+import org.bouncycastle2.util.BigIntegers;
+
+public class OtrOutputStream extends FilterOutputStream implements
+ SerializationConstants {
+
+ public OtrOutputStream(OutputStream out) {
+ super(out);
+ }
+
+ private void writeNumber(int value, int length) throws IOException {
+ byte[] b = new byte[length];
+ for (int i = 0; i < length; i++) {
+ int offset = (b.length - 1 - i) * 8;
+ b[i] = (byte) ((value >>> offset) & 0xFF);
+ }
+ write(b);
+ }
+
+ public void writeBigInt(BigInteger bi) throws IOException {
+ byte[] b = BigIntegers.asUnsignedByteArray(bi);
+ writeData(b);
+ }
+
+ public void writeByte(int b) throws IOException {
+ writeNumber(b, TYPE_LEN_BYTE);
+ }
+
+ public void writeData(byte[] b) throws IOException {
+ int len = (b == null || b.length < 0) ? 0 : b.length;
+ writeNumber(len, DATA_LEN);
+ if (len > 0)
+ write(b);
+ }
+
+ public void writeInt(int i) throws IOException {
+ writeNumber(i, TYPE_LEN_INT);
+
+ }
+
+ public void writeShort(int s) throws IOException {
+ writeNumber(s, TYPE_LEN_SHORT);
+
+ }
+
+ public void writeMac(byte[] mac) throws IOException {
+ if (mac == null || mac.length != TYPE_LEN_MAC)
+ throw new IllegalArgumentException();
+
+ write(mac);
+ }
+
+ public void writeCtr(byte[] ctr) throws IOException {
+ if (ctr == null || ctr.length < 1)
+ return;
+
+ int i = 0;
+ while (i < TYPE_LEN_CTR && i < ctr.length) {
+ write(ctr[i]);
+ i++;
+ }
+ }
+
+ public void writeDHPublicKey(DHPublicKey dhPublicKey) throws IOException {
+ byte[] b = BigIntegers.asUnsignedByteArray(dhPublicKey.getY());
+ writeData(b);
+ }
+
+ public void writePublicKey(PublicKey pubKey) throws IOException {
+ if (!(pubKey instanceof DSAPublicKey))
+ throw new UnsupportedOperationException(
+ "Key types other than DSA are not supported at the moment.");
+
+ DSAPublicKey dsaKey = (DSAPublicKey) pubKey;
+
+ writeShort(0);
+
+ DSAParams dsaParams = dsaKey.getParams();
+ writeBigInt(dsaParams.getP());
+ writeBigInt(dsaParams.getQ());
+ writeBigInt(dsaParams.getG());
+ writeBigInt(dsaKey.getY());
+
+ }
+
+ public void writeTlvData(byte[] b) throws IOException {
+ int len = (b == null || b.length < 0) ? 0 : b.length;
+ writeNumber(len, TLV_LEN);
+ if (len > 0)
+ write(b);
+ }
+
+ public void writeSignature(byte[] signature, PublicKey pubKey)
+ throws IOException {
+ if (!pubKey.getAlgorithm().equals("DSA"))
+ throw new UnsupportedOperationException();
+ out.write(signature);
+ }
+
+ public void writeMysteriousX(SignatureX x) throws IOException {
+ writePublicKey(x.longTermPublicKey);
+ writeInt(x.dhKeyID);
+ writeSignature(x.signature, x.longTermPublicKey);
+ }
+
+ public void writeMysteriousX(SignatureM m) throws IOException {
+ writeBigInt(m.localPubKey.getY());
+ writeBigInt(m.remotePubKey.getY());
+ writePublicKey(m.localLongTermPubKey);
+ writeInt(m.keyPairID);
+ }
+
+ public void writeMysteriousT(MysteriousT t) throws IOException {
+ writeShort(t.protocolVersion);
+ writeByte(t.messageType);
+ writeByte(t.flags);
+
+ writeInt(t.senderKeyID);
+ writeInt(t.recipientKeyID);
+ writeDHPublicKey(t.nextDH);
+ writeCtr(t.ctr);
+ writeData(t.encryptedMessage);
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/SerializationConstants.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,29 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io;
+
+/**
+ *
+ * @author George Politis
+ */
+public interface SerializationConstants {
+
+ public static final String HEAD = "?OTR";
+ public static final char HEAD_ENCODED = ':';
+ public static final char HEAD_ERROR = ' ';
+ public static final char HEAD_QUERY_Q = '?';
+ public static final char HEAD_QUERY_V = 'v';
+
+ public static final int TYPE_LEN_BYTE = 1;
+ public static final int TYPE_LEN_SHORT = 2;
+ public static final int TYPE_LEN_INT = 4;
+ public static final int TYPE_LEN_MAC = 20;
+ public static final int TYPE_LEN_CTR = 8;
+
+ public static final int DATA_LEN = TYPE_LEN_INT;
+ public static final int TLV_LEN = TYPE_LEN_SHORT;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/SerializationUtils.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,341 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.math.BigInteger;
+import java.security.PublicKey;
+import java.util.List;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+import org.bouncycastle2.util.encoders.Base64;
+
+import net.java.otr4j.io.messages.AbstractEncodedMessage;
+import net.java.otr4j.io.messages.AbstractMessage;
+import net.java.otr4j.io.messages.DHCommitMessage;
+import net.java.otr4j.io.messages.DHKeyMessage;
+import net.java.otr4j.io.messages.DataMessage;
+import net.java.otr4j.io.messages.ErrorMessage;
+import net.java.otr4j.io.messages.MysteriousT;
+import net.java.otr4j.io.messages.PlainTextMessage;
+import net.java.otr4j.io.messages.QueryMessage;
+import net.java.otr4j.io.messages.RevealSignatureMessage;
+import net.java.otr4j.io.messages.SignatureM;
+import net.java.otr4j.io.messages.SignatureMessage;
+import net.java.otr4j.io.messages.SignatureX;
+
+/**
+ *
+ * @author George Politis
+ */
+public class SerializationUtils {
+ // Mysterious X IO.
+ public static SignatureX toMysteriousX(byte[] b) throws IOException {
+ ByteArrayInputStream in = new ByteArrayInputStream(b);
+ OtrInputStream ois = new OtrInputStream(in);
+ SignatureX x = ois.readMysteriousX();
+ ois.close();
+ return x;
+ }
+
+ public static byte[] toByteArray(SignatureX x) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ OtrOutputStream oos = new OtrOutputStream(out);
+ oos.writeMysteriousX(x);
+ byte[] b = out.toByteArray();
+ oos.close();
+ return b;
+ }
+
+ // Mysterious M IO.
+ public static byte[] toByteArray(SignatureM m) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ OtrOutputStream oos = new OtrOutputStream(out);
+ oos.writeMysteriousX(m);
+ byte[] b = out.toByteArray();
+ oos.close();
+ return b;
+ }
+
+ // Mysterious T IO.
+ public static byte[] toByteArray(MysteriousT t) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ OtrOutputStream oos = new OtrOutputStream(out);
+ oos.writeMysteriousT(t);
+ byte[] b = out.toByteArray();
+ oos.close();
+ return b;
+ }
+
+ // Basic IO.
+ public static byte[] writeData(byte[] b) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ OtrOutputStream oos = new OtrOutputStream(out);
+ oos.writeData(b);
+ byte[] otrb = out.toByteArray();
+ oos.close();
+ return otrb;
+ }
+
+ // BigInteger IO.
+ public static byte[] writeMpi(BigInteger bigInt) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ OtrOutputStream oos = new OtrOutputStream(out);
+ oos.writeBigInt(bigInt);
+ byte[] b = out.toByteArray();
+ oos.close();
+ return b;
+ }
+
+ public static BigInteger readMpi(byte[] b) throws IOException {
+ ByteArrayInputStream in = new ByteArrayInputStream(b);
+ OtrInputStream ois = new OtrInputStream(in);
+ BigInteger bigint = ois.readBigInt();
+ ois.close();
+ return bigint;
+ }
+
+ // Public Key IO.
+ public static byte[] writePublicKey(PublicKey pubKey) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ OtrOutputStream oos = new OtrOutputStream(out);
+ oos.writePublicKey(pubKey);
+ byte[] b = out.toByteArray();
+ oos.close();
+ return b;
+ }
+
+ // Message IO.
+ public static String toString(AbstractMessage m) throws IOException {
+ StringWriter writer = new StringWriter();
+ writer.write(SerializationConstants.HEAD);
+
+ switch (m.messageType) {
+ case AbstractMessage.MESSAGE_ERROR:
+ ErrorMessage error = (ErrorMessage) m;
+ writer.write(SerializationConstants.HEAD_ERROR);
+ writer.write(error.error);
+ break;
+ case AbstractMessage.MESSAGE_PLAINTEXT:
+ PlainTextMessage plaintxt = (PlainTextMessage) m;
+ writer.write(plaintxt.cleanText);
+ if (plaintxt.versions != null && plaintxt.versions.size() > 0) {
+ writer.write(" \\t \\t\\t\\t\\t \\t \\t \\t ");
+ for (int version : plaintxt.versions) {
+ if (version == 1)
+ writer.write(" \\t\\t \\t ");
+
+ if (version == 2)
+ writer.write(" \\t \\t \\t ");
+ }
+ }
+ break;
+ case AbstractMessage.MESSAGE_QUERY:
+ QueryMessage query = (QueryMessage) m;
+ if (query.versions.size() == 1 && query.versions.get(0) == 1) {
+ writer.write(SerializationConstants.HEAD_QUERY_Q);
+ } else {
+ writer.write(SerializationConstants.HEAD_QUERY_V);
+ for (int version : query.versions)
+ writer.write(String.valueOf(version));
+
+ writer.write(SerializationConstants.HEAD_QUERY_Q);
+ }
+ break;
+ case AbstractEncodedMessage.MESSAGE_DHKEY:
+ case AbstractEncodedMessage.MESSAGE_REVEALSIG:
+ case AbstractEncodedMessage.MESSAGE_SIGNATURE:
+ case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
+ case AbstractEncodedMessage.MESSAGE_DATA:
+ ByteArrayOutputStream o = new ByteArrayOutputStream();
+ OtrOutputStream s = new OtrOutputStream(o);
+
+ switch (m.messageType) {
+ case AbstractEncodedMessage.MESSAGE_DHKEY:
+ DHKeyMessage dhkey = (DHKeyMessage) m;
+ s.writeShort(dhkey.protocolVersion);
+ s.writeByte(dhkey.messageType);
+ s.writeDHPublicKey(dhkey.dhPublicKey);
+ break;
+ case AbstractEncodedMessage.MESSAGE_REVEALSIG:
+ RevealSignatureMessage revealsig = (RevealSignatureMessage) m;
+ s.writeShort(revealsig.protocolVersion);
+ s.writeByte(revealsig.messageType);
+ s.writeData(revealsig.revealedKey);
+ s.writeData(revealsig.xEncrypted);
+ s.writeMac(revealsig.xEncryptedMAC);
+ break;
+ case AbstractEncodedMessage.MESSAGE_SIGNATURE:
+ SignatureMessage sig = (SignatureMessage) m;
+ s.writeShort(sig.protocolVersion);
+ s.writeByte(sig.messageType);
+ s.writeData(sig.xEncrypted);
+ s.writeMac(sig.xEncryptedMAC);
+ break;
+ case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
+ DHCommitMessage dhcommit = (DHCommitMessage) m;
+ s.writeShort(dhcommit.protocolVersion);
+ s.writeByte(dhcommit.messageType);
+ s.writeData(dhcommit.dhPublicKeyEncrypted);
+ s.writeData(dhcommit.dhPublicKeyHash);
+ break;
+ case AbstractEncodedMessage.MESSAGE_DATA:
+ DataMessage data = (DataMessage) m;
+ s.writeShort(data.protocolVersion);
+ s.writeByte(data.messageType);
+ s.writeByte(data.flags);
+ s.writeInt(data.senderKeyID);
+ s.writeInt(data.recipientKeyID);
+ s.writeDHPublicKey(data.nextDH);
+ s.writeCtr(data.ctr);
+ s.writeData(data.encryptedMessage);
+ s.writeMac(data.mac);
+ s.writeData(data.oldMACKeys);
+ break;
+ }
+
+ writer.write(SerializationConstants.HEAD_ENCODED);
+ writer.write(new String(Base64.encode(o.toByteArray())));
+ writer.write(".");
+ break;
+ default:
+ throw new IOException("Illegal message type.");
+ }
+
+ return writer.toString();
+ }
+
+ static final Pattern patternWhitespace = Pattern
+ .compile("( \\t \\t\\t\\t\\t \\t \\t \\t )( \\t\\t \\t )?( \\t \\t \\t )?");
+
+ public static AbstractMessage toMessage(String s) throws IOException {
+ if (s == null || s.length() <= 1)
+ return null;
+
+ if (s.indexOf(SerializationConstants.HEAD) != 0
+ || s.length() <= SerializationConstants.HEAD.length()) {
+ // Try to detect whitespace tag.
+ final Matcher matcher = patternWhitespace.matcher(s);
+
+ boolean v1 = false;
+ boolean v2 = false;
+ while (matcher.find()) {
+ if (!v1 && matcher.start(2) > -1)
+ v1 = true;
+
+ if (!v2 && matcher.start(3) > -1)
+ v2 = true;
+
+ if (v1 && v2)
+ break;
+ }
+
+ String cleanText = matcher.replaceAll("");
+ List<Integer> versions;
+ if (v1 && v2) {
+ versions = new Vector<Integer>(2);
+ versions.add(0, 1);
+ versions.add(0, 2);
+ } else if (v1) {
+ versions = new Vector<Integer>(1);
+ versions.add(0, 1);
+ } else if (v2) {
+ versions = new Vector<Integer>(1);
+ versions.add(2);
+ } else
+ versions = null;
+
+ return new PlainTextMessage(versions, cleanText);
+ } else {
+ char contentType = s.charAt(SerializationConstants.HEAD.length());
+ String content = s
+ .substring(SerializationConstants.HEAD.length() + 1);
+ switch (contentType) {
+ case SerializationConstants.HEAD_ENCODED:
+ ByteArrayInputStream bin = new ByteArrayInputStream(Base64
+ .decode(content.getBytes()));
+ OtrInputStream otr = new OtrInputStream(bin);
+ // We have an encoded message.
+ int protocolVersion = otr.readShort();
+ int messageType = otr.readByte();
+ switch (messageType) {
+ case AbstractEncodedMessage.MESSAGE_DATA:
+ int flags = otr.readByte();
+ int senderKeyID = otr.readInt();
+ int recipientKeyID = otr.readInt();
+ DHPublicKey nextDH = otr.readDHPublicKey();
+ byte[] ctr = otr.readCtr();
+ byte[] encryptedMessage = otr.readData();
+ byte[] mac = otr.readMac();
+ byte[] oldMacKeys = otr.readMac();
+ return new DataMessage(protocolVersion, flags, senderKeyID,
+ recipientKeyID, nextDH, ctr, encryptedMessage, mac,
+ oldMacKeys);
+ case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
+ byte[] dhPublicKeyEncrypted = otr.readData();
+ byte[] dhPublicKeyHash = otr.readData();
+ return new DHCommitMessage(protocolVersion,
+ dhPublicKeyHash, dhPublicKeyEncrypted);
+ case AbstractEncodedMessage.MESSAGE_DHKEY:
+ DHPublicKey dhPublicKey = otr.readDHPublicKey();
+ return new DHKeyMessage(protocolVersion, dhPublicKey);
+ case AbstractEncodedMessage.MESSAGE_REVEALSIG: {
+ byte[] revealedKey = otr.readData();
+ byte[] xEncrypted = otr.readData();
+ byte[] xEncryptedMac = otr.readMac();
+ return new RevealSignatureMessage(protocolVersion,
+ xEncrypted, xEncryptedMac, revealedKey);
+ }
+ case AbstractEncodedMessage.MESSAGE_SIGNATURE: {
+ byte[] xEncryted = otr.readData();
+ byte[] xEncryptedMac = otr.readMac();
+ return new SignatureMessage(protocolVersion, xEncryted,
+ xEncryptedMac);
+ }
+ default:
+ throw new IOException("Illegal message type.");
+ }
+ case SerializationConstants.HEAD_ERROR:
+ return new ErrorMessage(AbstractMessage.MESSAGE_ERROR, content);
+ case SerializationConstants.HEAD_QUERY_V:
+ case SerializationConstants.HEAD_QUERY_Q:
+ List<Integer> versions = new Vector<Integer>();
+ String versionString = null;
+ if (SerializationConstants.HEAD_QUERY_Q == contentType) {
+ versions.add(1);
+ if (content.charAt(0) == 'v') {
+ versionString = content.substring(1, content
+ .indexOf('?'));
+ }
+ } else if (SerializationConstants.HEAD_QUERY_V == contentType) {
+ versionString = content.substring(0, content.indexOf('?'));
+ }
+
+ if (versionString != null) {
+ StringReader sr = new StringReader(versionString);
+ int c;
+ while ((c = sr.read()) != -1)
+ if (!versions.contains(c))
+ versions.add(Integer.parseInt(String
+ .valueOf((char) c)));
+ }
+ QueryMessage query = new QueryMessage(versions);
+ return query;
+ default:
+ throw new IOException("Uknown message type.");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/AbstractEncodedMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,52 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+/**
+ *
+ * @author George Politis
+ */
+public abstract class AbstractEncodedMessage extends AbstractMessage {
+ // Fields.
+ public int protocolVersion;
+
+ // Ctor.
+ public AbstractEncodedMessage(int messageType, int protocolVersion) {
+ super(messageType);
+ this.protocolVersion = protocolVersion;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + protocolVersion;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ AbstractEncodedMessage other = (AbstractEncodedMessage) obj;
+ if (protocolVersion != other.protocolVersion)
+ return false;
+ return true;
+ }
+
+ // Encoded Message Types
+ public static final int MESSAGE_DH_COMMIT = 0x02;
+ public static final int MESSAGE_DATA = 0x03;
+ public static final int MESSAGE_DHKEY = 0x0a;
+ public static final int MESSAGE_REVEALSIG = 0x11;
+ public static final int MESSAGE_SIGNATURE = 0x12;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/AbstractMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,49 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+/**
+ *
+ * @author George Politis
+ */
+public abstract class AbstractMessage {
+ // Fields.
+ public int messageType;
+
+ // Ctor.
+ public AbstractMessage(int messageType) {
+ this.messageType = messageType;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + messageType;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ AbstractMessage other = (AbstractMessage) obj;
+ if (messageType != other.messageType)
+ return false;
+ return true;
+ }
+
+ // Unencoded
+ public static final int MESSAGE_ERROR = 0xff;
+ public static final int MESSAGE_QUERY = 0x100;
+ public static final int MESSAGE_PLAINTEXT = 0x102;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/DHCommitMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,55 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import java.util.Arrays;
+
+/**
+ *
+ * @author George Politis
+ */
+public class DHCommitMessage extends AbstractEncodedMessage {
+
+ // Fields.
+ public byte[] dhPublicKeyEncrypted;
+ public byte[] dhPublicKeyHash;
+
+ // Ctor.
+ public DHCommitMessage(int protocolVersion, byte[] dhPublicKeyHash,
+ byte[] dhPublicKeyEncrypted) {
+ super(MESSAGE_DH_COMMIT, protocolVersion);
+ this.dhPublicKeyEncrypted = dhPublicKeyEncrypted;
+ this.dhPublicKeyHash = dhPublicKeyHash;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(dhPublicKeyEncrypted);
+ result = prime * result + Arrays.hashCode(dhPublicKeyHash);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DHCommitMessage other = (DHCommitMessage) obj;
+ if (!Arrays.equals(dhPublicKeyEncrypted, other.dhPublicKeyEncrypted))
+ return false;
+ if (!Arrays.equals(dhPublicKeyHash, other.dhPublicKeyHash))
+ return false;
+ return true;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/DHKeyMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,53 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+/**
+ *
+ * @author George Politis
+ */
+public class DHKeyMessage extends AbstractEncodedMessage {
+
+ // Fields.
+ public DHPublicKey dhPublicKey;
+
+ // Ctor.
+ public DHKeyMessage(int protocolVersion, DHPublicKey dhPublicKey) {
+ super(MESSAGE_DHKEY, protocolVersion);
+ this.dhPublicKey = dhPublicKey;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ // TODO: Needs work.
+ result = prime * result
+ + ((dhPublicKey == null) ? 0 : dhPublicKey.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DHKeyMessage other = (DHKeyMessage) obj;
+ if (dhPublicKey == null) {
+ if (other.dhPublicKey != null)
+ return false;
+ } else if (dhPublicKey.getY().compareTo(other.dhPublicKey.getY()) != 0)
+ return false;
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/DataMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,103 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import java.util.Arrays;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+/**
+ *
+ * @author George Politis
+ */
+public class DataMessage extends AbstractEncodedMessage {
+
+ // Fields.
+ public byte[] mac;
+ public byte[] oldMACKeys;
+
+ public int flags;
+ public int senderKeyID;
+ public int recipientKeyID;
+ public DHPublicKey nextDH;
+ public byte[] ctr;
+ public byte[] encryptedMessage;
+
+ // Ctor.
+ public DataMessage(int protocolVersion, int flags, int senderKeyID,
+ int recipientKeyID, DHPublicKey nextDH, byte[] ctr,
+ byte[] encryptedMessage, byte[] mac, byte[] oldMacKeys) {
+ super(MESSAGE_DATA, protocolVersion);
+
+ this.flags = flags;
+ this.senderKeyID = senderKeyID;
+ this.recipientKeyID = recipientKeyID;
+ this.nextDH = nextDH;
+ this.ctr = ctr;
+ this.encryptedMessage = encryptedMessage;
+ this.mac = mac;
+ this.oldMACKeys = oldMacKeys;
+ }
+
+ public DataMessage(MysteriousT t, byte[] mac, byte[] oldMacKeys) {
+ this(t.protocolVersion, t.flags, t.senderKeyID, t.recipientKeyID,
+ t.nextDH, t.ctr, t.encryptedMessage, mac, oldMacKeys);
+ }
+
+ // Methods.
+ public MysteriousT getT() {
+ return new MysteriousT(protocolVersion, flags, senderKeyID,
+ recipientKeyID, nextDH, ctr, encryptedMessage);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(ctr);
+ result = prime * result + Arrays.hashCode(encryptedMessage);
+ result = prime * result + flags;
+ result = prime * result + Arrays.hashCode(mac);
+ // TODO: Needs work.
+ result = prime * result + ((nextDH == null) ? 0 : nextDH.hashCode());
+ result = prime * result + Arrays.hashCode(oldMACKeys);
+ result = prime * result + recipientKeyID;
+ result = prime * result + senderKeyID;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DataMessage other = (DataMessage) obj;
+ if (!Arrays.equals(ctr, other.ctr))
+ return false;
+ if (!Arrays.equals(encryptedMessage, other.encryptedMessage))
+ return false;
+ if (flags != other.flags)
+ return false;
+ if (!Arrays.equals(mac, other.mac))
+ return false;
+ if (nextDH == null) {
+ if (other.nextDH != null)
+ return false;
+ } else if (!nextDH.equals(other.nextDH))
+ return false;
+ if (!Arrays.equals(oldMACKeys, other.oldMACKeys))
+ return false;
+ if (recipientKeyID != other.recipientKeyID)
+ return false;
+ if (senderKeyID != other.senderKeyID)
+ return false;
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/ErrorMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,48 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+/**
+ *
+ * @author George Politis
+ */
+public class ErrorMessage extends AbstractMessage {
+ // Fields.
+ public String error;
+
+ // Ctor.
+ public ErrorMessage(int messageType, String error) {
+ super(messageType);
+ this.error = error;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((error == null) ? 0 : error.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ErrorMessage other = (ErrorMessage) obj;
+ if (error == null) {
+ if (other.error != null)
+ return false;
+ } else if (!error.equals(other.error))
+ return false;
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/MysteriousT.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,82 @@
+package net.java.otr4j.io.messages;
+
+import java.util.Arrays;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+public class MysteriousT {
+ // Fields.
+ public int protocolVersion;
+ public int messageType;
+ public int flags;
+ public int senderKeyID;
+ public int recipientKeyID;
+ public DHPublicKey nextDH;
+ public byte[] ctr;
+ public byte[] encryptedMessage;
+
+ // Ctor.
+ public MysteriousT(int protocolVersion, int flags, int senderKeyID,
+ int recipientKeyID, DHPublicKey nextDH, byte[] ctr,
+ byte[] encryptedMessage) {
+
+ this.protocolVersion = protocolVersion;
+ this.messageType = AbstractEncodedMessage.MESSAGE_DATA;
+ this.flags = flags;
+ this.senderKeyID = senderKeyID;
+ this.recipientKeyID = recipientKeyID;
+ this.nextDH = nextDH;
+ this.ctr = ctr;
+ this.encryptedMessage = encryptedMessage;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ // TODO: Needs work.
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Arrays.hashCode(ctr);
+ result = prime * result + Arrays.hashCode(encryptedMessage);
+ result = prime * result + flags;
+ result = prime * result + messageType;
+ result = prime * result + ((nextDH == null) ? 0 : nextDH.hashCode());
+ result = prime * result + protocolVersion;
+ result = prime * result + recipientKeyID;
+ result = prime * result + senderKeyID;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ // TODO: Needs work.
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ MysteriousT other = (MysteriousT) obj;
+ if (!Arrays.equals(ctr, other.ctr))
+ return false;
+ if (!Arrays.equals(encryptedMessage, other.encryptedMessage))
+ return false;
+ if (flags != other.flags)
+ return false;
+ if (messageType != other.messageType)
+ return false;
+ if (nextDH == null) {
+ if (other.nextDH != null)
+ return false;
+ } else if (!nextDH.equals(other.nextDH))
+ return false;
+ if (protocolVersion != other.protocolVersion)
+ return false;
+ if (recipientKeyID != other.recipientKeyID)
+ return false;
+ if (senderKeyID != other.senderKeyID)
+ return false;
+ return true;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/PlainTextMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,52 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import java.util.List;
+
+/**
+ *
+ * @author George Politis
+ */
+public class PlainTextMessage extends QueryMessage {
+ // Fields.
+ public String cleanText;
+
+ // Ctor.
+ public PlainTextMessage(List<Integer> versions, String cleanText) {
+ super(MESSAGE_PLAINTEXT, versions);
+ this.cleanText = cleanText;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result
+ + ((cleanText == null) ? 0 : cleanText.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ PlainTextMessage other = (PlainTextMessage) obj;
+ if (cleanText == null) {
+ if (other.cleanText != null)
+ return false;
+ } else if (!cleanText.equals(other.cleanText))
+ return false;
+ return true;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/QueryMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,56 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import java.util.List;
+
+/**
+ *
+ * @author George Politis
+ */
+public class QueryMessage extends AbstractMessage {
+ // Fields.
+ public List<Integer> versions;
+
+ // Ctor.
+ protected QueryMessage(int messageType, List<Integer> versions) {
+ super(messageType);
+ this.versions = versions;
+ }
+
+ public QueryMessage(List<Integer> versions) {
+ this(MESSAGE_QUERY, versions);
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result
+ + ((versions == null) ? 0 : versions.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ QueryMessage other = (QueryMessage) obj;
+ if (versions == null) {
+ if (other.versions != null)
+ return false;
+ } else if (!versions.equals(other.versions))
+ return false;
+ return true;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/RevealSignatureMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,49 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import java.util.Arrays;
+
+/**
+ *
+ * @author George Politis
+ */
+public class RevealSignatureMessage extends SignatureMessage {
+ // Fields.
+ public byte[] revealedKey;
+
+ // Ctor.
+ public RevealSignatureMessage(int protocolVersion, byte[] xEncrypted,
+ byte[] xEncryptedMAC, byte[] revealedKey) {
+ super(MESSAGE_REVEALSIG, protocolVersion, xEncrypted, xEncryptedMAC);
+
+ this.revealedKey = revealedKey;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(revealedKey);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ RevealSignatureMessage other = (RevealSignatureMessage) obj;
+ if (!Arrays.equals(revealedKey, other.revealedKey))
+ return false;
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/SignatureM.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,82 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import java.security.PublicKey;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+/**
+ *
+ * @author George Politis
+ */
+public class SignatureM {
+ // Fields.
+ public DHPublicKey localPubKey;
+ public DHPublicKey remotePubKey;
+ public PublicKey localLongTermPubKey;
+ public int keyPairID;
+
+ // Ctor.
+ public SignatureM(DHPublicKey localPubKey, DHPublicKey remotePublicKey,
+ PublicKey localLongTermPublicKey, int keyPairID) {
+
+ this.localPubKey = localPubKey;
+ this.remotePubKey = remotePublicKey;
+ this.localLongTermPubKey = localLongTermPublicKey;
+ this.keyPairID = keyPairID;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + keyPairID;
+ // TODO: Needs work.
+ result = prime
+ * result
+ + ((localLongTermPubKey == null) ? 0 : localLongTermPubKey
+ .hashCode());
+ result = prime * result
+ + ((localPubKey == null) ? 0 : localPubKey.hashCode());
+ result = prime * result
+ + ((remotePubKey == null) ? 0 : remotePubKey.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ // TODO: Needs work.
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SignatureM other = (SignatureM) obj;
+ if (keyPairID != other.keyPairID)
+ return false;
+ if (localLongTermPubKey == null) {
+ if (other.localLongTermPubKey != null)
+ return false;
+ } else if (!localLongTermPubKey.equals(other.localLongTermPubKey))
+ return false;
+ if (localPubKey == null) {
+ if (other.localPubKey != null)
+ return false;
+ } else if (!localPubKey.equals(other.localPubKey))
+ return false;
+ if (remotePubKey == null) {
+ if (other.remotePubKey != null)
+ return false;
+ } else if (!remotePubKey.equals(other.remotePubKey))
+ return false;
+ return true;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/SignatureMessage.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,82 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import net.java.otr4j.OtrException;
+import net.java.otr4j.crypto.OtrCryptoEngineImpl;
+import net.java.otr4j.io.SerializationUtils;
+
+/**
+ *
+ * @author George Politis
+ */
+public class SignatureMessage extends AbstractEncodedMessage {
+ // Fields.
+ public byte[] xEncrypted;
+ public byte[] xEncryptedMAC;
+
+ // Ctor.
+ protected SignatureMessage(int messageType, int protocolVersion,
+ byte[] xEncrypted, byte[] xEncryptedMAC) {
+ super(messageType, protocolVersion);
+ this.xEncrypted = xEncrypted;
+ this.xEncryptedMAC = xEncryptedMAC;
+ }
+
+ public SignatureMessage(int protocolVersion, byte[] xEncrypted,
+ byte[] xEncryptedMAC) {
+ this(MESSAGE_SIGNATURE, protocolVersion, xEncrypted, xEncryptedMAC);
+ }
+
+ // Memthods.
+ public byte[] decrypt(byte[] key) throws OtrException {
+ return new OtrCryptoEngineImpl().aesDecrypt(key, null, xEncrypted);
+ }
+
+ public boolean verify(byte[] key) throws OtrException {
+ // Hash the key.
+ byte[] xbEncrypted;
+ try {
+ xbEncrypted = SerializationUtils.writeData(xEncrypted);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ byte[] xEncryptedMAC = new OtrCryptoEngineImpl().sha256Hmac160(
+ xbEncrypted, key);
+ // Verify signature.
+ return Arrays.equals(xEncryptedMAC, xEncryptedMAC);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + Arrays.hashCode(xEncrypted);
+ result = prime * result + Arrays.hashCode(xEncryptedMAC);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SignatureMessage other = (SignatureMessage) obj;
+ if (!Arrays.equals(xEncrypted, other.xEncrypted))
+ return false;
+ if (!Arrays.equals(xEncryptedMAC, other.xEncryptedMAC))
+ return false;
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/io/messages/SignatureX.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,67 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.io.messages;
+
+import java.security.PublicKey;
+import java.util.Arrays;
+
+/**
+ *
+ * @author George Politis
+ */
+public class SignatureX {
+ // Fields.
+ public PublicKey longTermPublicKey;
+ public int dhKeyID;
+ public byte[] signature;
+
+ // Ctor.
+ public SignatureX(PublicKey ourLongTermPublicKey, int ourKeyID,
+ byte[] signature) {
+ this.longTermPublicKey = ourLongTermPublicKey;
+ this.dhKeyID = ourKeyID;
+ this.signature = signature;
+ }
+
+ // Methods.
+ @Override
+ public int hashCode() {
+ // TODO: Needs work.
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + dhKeyID;
+ result = prime
+ * result
+ + ((longTermPublicKey == null) ? 0 : longTermPublicKey
+ .hashCode());
+ result = prime * result + Arrays.hashCode(signature);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ // TODO: Needs work.
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SignatureX other = (SignatureX) obj;
+ if (dhKeyID != other.dhKeyID)
+ return false;
+ if (longTermPublicKey == null) {
+ if (other.longTermPublicKey != null)
+ return false;
+ } else if (!longTermPublicKey.equals(other.longTermPublicKey))
+ return false;
+ if (!Arrays.equals(signature, other.signature))
+ return false;
+ return true;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/session/AuthContext.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,55 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.session;
+
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.PublicKey;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+import net.java.otr4j.OtrException;
+import net.java.otr4j.io.messages.AbstractMessage;
+
+/**
+ *
+ * @author George Politis
+ */
+interface AuthContext {
+
+ public static final int NONE = 0;
+ public static final int AWAITING_DHKEY = 1;
+ public static final int AWAITING_REVEALSIG = 2;
+ public static final int AWAITING_SIG = 3;
+ public static final int V1_SETUP = 4;
+ public static final byte C_START = (byte) 0x01;
+ public static final byte M1_START = (byte) 0x02;
+ public static final byte M2_START = (byte) 0x03;
+ public static final byte M1p_START = (byte) 0x04;
+ public static final byte M2p_START = (byte) 0x05;
+
+ public abstract void reset();
+
+ public abstract boolean getIsSecure();
+
+ public abstract DHPublicKey getRemoteDHPublicKey();
+
+ public abstract KeyPair getLocalDHKeyPair() throws OtrException;
+
+ public abstract BigInteger getS() throws OtrException;
+
+ public abstract void handleReceivingMessage(AbstractMessage m)
+ throws OtrException;
+
+ public abstract void startV2Auth() throws OtrException;
+
+ public abstract void respondV2Auth() throws OtrException;
+
+ public abstract PublicKey getRemoteLongTermPublicKey();
+
+ public abstract KeyPair getLocalLongTermKeyPair();
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/session/AuthContextImpl.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,766 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.session;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.security.KeyPair;
+import java.security.PublicKey;
+import java.util.Arrays;
+import java.util.Random;
+import java.util.Vector;
+import java.util.logging.Logger;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+import net.java.otr4j.OtrException;
+import net.java.otr4j.crypto.OtrCryptoEngine;
+import net.java.otr4j.crypto.OtrCryptoEngineImpl;
+import net.java.otr4j.io.SerializationUtils;
+import net.java.otr4j.io.messages.DHCommitMessage;
+import net.java.otr4j.io.messages.DHKeyMessage;
+import net.java.otr4j.io.messages.AbstractEncodedMessage;
+import net.java.otr4j.io.messages.AbstractMessage;
+import net.java.otr4j.io.messages.SignatureM;
+import net.java.otr4j.io.messages.SignatureX;
+import net.java.otr4j.io.messages.QueryMessage;
+import net.java.otr4j.io.messages.RevealSignatureMessage;
+import net.java.otr4j.io.messages.SignatureMessage;
+
+/**
+ *
+ * @author George Politis
+ */
+class AuthContextImpl implements AuthContext {
+
+ public AuthContextImpl(Session session) {
+ this.setSession(session);
+ this.reset();
+ }
+
+ private Session session;
+
+ private int authenticationState;
+ private byte[] r;
+
+ private DHPublicKey remoteDHPublicKey;
+ private byte[] remoteDHPublicKeyEncrypted;
+ private byte[] remoteDHPublicKeyHash;
+
+ private KeyPair localDHKeyPair;
+ private int localDHPrivateKeyID;
+ private byte[] localDHPublicKeyBytes;
+ private byte[] localDHPublicKeyHash;
+ private byte[] localDHPublicKeyEncrypted;
+
+ private BigInteger s;
+ private byte[] c;
+ private byte[] m1;
+ private byte[] m2;
+ private byte[] cp;
+ private byte[] m1p;
+ private byte[] m2p;
+
+ private KeyPair localLongTermKeyPair;
+ private Boolean isSecure = false;
+ private int protocolVersion;
+
+ private int getProtocolVersion() {
+ return this.protocolVersion;
+ }
+
+ private void setProtocolVersion(int protoVersion) {
+ this.protocolVersion = protoVersion;
+ }
+
+ private static Logger logger = Logger.getLogger(AuthContextImpl.class
+ .getName());
+
+ class MessageFactory {
+
+ private QueryMessage getQueryMessage() {
+ Vector<Integer> versions = new Vector<Integer>();
+ versions.add(2);
+ return new QueryMessage(versions);
+ }
+
+ private DHCommitMessage getDHCommitMessage() throws OtrException {
+ return new DHCommitMessage(getProtocolVersion(),
+ getLocalDHPublicKeyHash(), getLocalDHPublicKeyEncrypted());
+ }
+
+ private DHKeyMessage getDHKeyMessage() throws OtrException {
+ return new DHKeyMessage(getProtocolVersion(),
+ (DHPublicKey) getLocalDHKeyPair().getPublic());
+ }
+
+ private RevealSignatureMessage getRevealSignatureMessage()
+ throws OtrException {
+ try {
+ SignatureM m = new SignatureM((DHPublicKey) getLocalDHKeyPair()
+ .getPublic(), getRemoteDHPublicKey(),
+ getLocalLongTermKeyPair().getPublic(),
+ getLocalDHKeyPairID());
+
+ OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
+ byte[] mhash = otrCryptoEngine.sha256Hmac(SerializationUtils
+ .toByteArray(m), getM1());
+ byte[] signature = otrCryptoEngine.sign(mhash,
+ getLocalLongTermKeyPair().getPrivate());
+
+ SignatureX mysteriousX = new SignatureX(
+ getLocalLongTermKeyPair().getPublic(),
+ getLocalDHKeyPairID(), signature);
+ byte[] xEncrypted = otrCryptoEngine.aesEncrypt(getC(), null,
+ SerializationUtils.toByteArray(mysteriousX));
+
+ byte[] tmp = SerializationUtils.writeData(xEncrypted);
+
+ byte[] xEncryptedHash = otrCryptoEngine.sha256Hmac160(tmp,
+ getM2());
+ return new RevealSignatureMessage(getProtocolVersion(),
+ xEncrypted, xEncryptedHash, getR());
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+ }
+
+ private SignatureMessage getSignatureMessage() throws OtrException {
+ SignatureM m = new SignatureM((DHPublicKey) getLocalDHKeyPair()
+ .getPublic(), getRemoteDHPublicKey(),
+ getLocalLongTermKeyPair().getPublic(),
+ getLocalDHKeyPairID());
+
+ OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
+ byte[] mhash;
+ try {
+ mhash = otrCryptoEngine.sha256Hmac(SerializationUtils
+ .toByteArray(m), getM1p());
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ byte[] signature = otrCryptoEngine.sign(mhash,
+ getLocalLongTermKeyPair().getPrivate());
+
+ SignatureX mysteriousX = new SignatureX(getLocalLongTermKeyPair()
+ .getPublic(), getLocalDHKeyPairID(), signature);
+
+ byte[] xEncrypted;
+ try {
+ xEncrypted = otrCryptoEngine.aesEncrypt(getCp(), null,
+ SerializationUtils.toByteArray(mysteriousX));
+ byte[] tmp = SerializationUtils.writeData(xEncrypted);
+ byte[] xEncryptedHash = otrCryptoEngine.sha256Hmac160(tmp,
+ getM2p());
+ return new SignatureMessage(getProtocolVersion(), xEncrypted,
+ xEncryptedHash);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+ }
+ }
+
+ private MessageFactory messageFactory = new MessageFactory();
+
+ public void reset() {
+ logger.finest("Resetting authentication state.");
+ authenticationState = AuthContext.NONE;
+ r = null;
+
+ remoteDHPublicKey = null;
+ remoteDHPublicKeyEncrypted = null;
+ remoteDHPublicKeyHash = null;
+
+ localDHKeyPair = null;
+ localDHPrivateKeyID = 1;
+ localDHPublicKeyBytes = null;
+ localDHPublicKeyHash = null;
+ localDHPublicKeyEncrypted = null;
+
+ s = null;
+ c = m1 = m2 = cp = m1p = m2p = null;
+
+ localLongTermKeyPair = null;
+ protocolVersion = 0;
+ setIsSecure(false);
+ }
+
+ private void setIsSecure(Boolean isSecure) {
+ this.isSecure = isSecure;
+ }
+
+ public boolean getIsSecure() {
+ return isSecure;
+ }
+
+ private void setAuthenticationState(int authenticationState) {
+ this.authenticationState = authenticationState;
+ }
+
+ private int getAuthenticationState() {
+ return authenticationState;
+ }
+
+ private byte[] getR() {
+ if (r == null) {
+ logger.finest("Picking random key r.");
+ r = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
+ new Random().nextBytes(r);
+ }
+ return r;
+ }
+
+ private void setRemoteDHPublicKey(DHPublicKey dhPublicKey) {
+ // Verifies that Alice's gy is a legal value (2 <= gy <= modulus-2)
+ if (dhPublicKey.getY().compareTo(OtrCryptoEngine.MODULUS_MINUS_TWO) > 0) {
+ throw new IllegalArgumentException(
+ "Illegal D-H Public Key value, Ignoring message.");
+ } else if (dhPublicKey.getY().compareTo(OtrCryptoEngine.BIGINTEGER_TWO) < 0) {
+ throw new IllegalArgumentException(
+ "Illegal D-H Public Key value, Ignoring message.");
+ }
+ logger.finest("Received D-H Public Key is a legal value.");
+
+ this.remoteDHPublicKey = dhPublicKey;
+ }
+
+ public DHPublicKey getRemoteDHPublicKey() {
+ return remoteDHPublicKey;
+ }
+
+ private void setRemoteDHPublicKeyEncrypted(byte[] remoteDHPublicKeyEncrypted) {
+ logger.finest("Storing encrypted remote public key.");
+ this.remoteDHPublicKeyEncrypted = remoteDHPublicKeyEncrypted;
+ }
+
+ private byte[] getRemoteDHPublicKeyEncrypted() {
+ return remoteDHPublicKeyEncrypted;
+ }
+
+ private void setRemoteDHPublicKeyHash(byte[] remoteDHPublicKeyHash) {
+ logger.finest("Storing encrypted remote public key hash.");
+ this.remoteDHPublicKeyHash = remoteDHPublicKeyHash;
+ }
+
+ private byte[] getRemoteDHPublicKeyHash() {
+ return remoteDHPublicKeyHash;
+ }
+
+ public KeyPair getLocalDHKeyPair() throws OtrException {
+ if (localDHKeyPair == null) {
+ localDHKeyPair = new OtrCryptoEngineImpl().generateDHKeyPair();
+ logger.finest("Generated local D-H key pair.");
+ }
+ return localDHKeyPair;
+ }
+
+ private int getLocalDHKeyPairID() {
+ return localDHPrivateKeyID;
+ }
+
+ private byte[] getLocalDHPublicKeyHash() throws OtrException {
+ if (localDHPublicKeyHash == null) {
+ localDHPublicKeyHash = new OtrCryptoEngineImpl()
+ .sha256Hash(getLocalDHPublicKeyBytes());
+ logger.finest("Hashed local D-H public key.");
+ }
+ return localDHPublicKeyHash;
+ }
+
+ private byte[] getLocalDHPublicKeyEncrypted() throws OtrException {
+ if (localDHPublicKeyEncrypted == null) {
+ localDHPublicKeyEncrypted = new OtrCryptoEngineImpl().aesEncrypt(
+ getR(), null, getLocalDHPublicKeyBytes());
+ logger.finest("Encrypted our D-H public key.");
+ }
+ return localDHPublicKeyEncrypted;
+ }
+
+ public BigInteger getS() throws OtrException {
+ if (s == null) {
+ s = new OtrCryptoEngineImpl().generateSecret(this
+ .getLocalDHKeyPair().getPrivate(), this
+ .getRemoteDHPublicKey());
+ logger.finest("Generated shared secret.");
+ }
+ return s;
+ }
+
+ private byte[] getC() throws OtrException {
+ if (c != null)
+ return c;
+
+ byte[] h2 = h2(C_START);
+ ByteBuffer buff = ByteBuffer.wrap(h2);
+ this.c = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
+ buff.get(this.c);
+ logger.finest("Computed c.");
+ return c;
+
+ }
+
+ private byte[] getM1() throws OtrException {
+ if (m1 != null)
+ return m1;
+
+ byte[] h2 = h2(M1_START);
+ ByteBuffer buff = ByteBuffer.wrap(h2);
+ byte[] m1 = new byte[OtrCryptoEngine.SHA256_HMAC_KEY_BYTE_LENGTH];
+ buff.get(m1);
+ logger.finest("Computed m1.");
+ this.m1 = m1;
+ return m1;
+ }
+
+ private byte[] getM2() throws OtrException {
+ if (m2 != null)
+ return m2;
+
+ byte[] h2 = h2(M2_START);
+ ByteBuffer buff = ByteBuffer.wrap(h2);
+ byte[] m2 = new byte[OtrCryptoEngine.SHA256_HMAC_KEY_BYTE_LENGTH];
+ buff.get(m2);
+ logger.finest("Computed m2.");
+ this.m2 = m2;
+ return m2;
+ }
+
+ private byte[] getCp() throws OtrException {
+ if (cp != null)
+ return cp;
+
+ byte[] h2 = h2(C_START);
+ ByteBuffer buff = ByteBuffer.wrap(h2);
+ byte[] cp = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
+ buff.position(OtrCryptoEngine.AES_KEY_BYTE_LENGTH);
+ buff.get(cp);
+ logger.finest("Computed c'.");
+ this.cp = cp;
+ return cp;
+ }
+
+ private byte[] getM1p() throws OtrException {
+ if (m1p != null)
+ return m1p;
+
+ byte[] h2 = h2(M1p_START);
+ ByteBuffer buff = ByteBuffer.wrap(h2);
+ byte[] m1p = new byte[OtrCryptoEngine.SHA256_HMAC_KEY_BYTE_LENGTH];
+ buff.get(m1p);
+ this.m1p = m1p;
+ logger.finest("Computed m1'.");
+ return m1p;
+ }
+
+ private byte[] getM2p() throws OtrException {
+ if (m2p != null)
+ return m2p;
+
+ byte[] h2 = h2(M2p_START);
+ ByteBuffer buff = ByteBuffer.wrap(h2);
+ byte[] m2p = new byte[OtrCryptoEngine.SHA256_HMAC_KEY_BYTE_LENGTH];
+ buff.get(m2p);
+ this.m2p = m2p;
+ logger.finest("Computed m2'.");
+ return m2p;
+ }
+
+ public KeyPair getLocalLongTermKeyPair() {
+ if (localLongTermKeyPair == null) {
+ localLongTermKeyPair = getSession().getLocalKeyPair();
+ }
+ return localLongTermKeyPair;
+ }
+
+ private byte[] h2(byte b) throws OtrException {
+ byte[] secbytes;
+ try {
+ secbytes = SerializationUtils.writeMpi(getS());
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ int len = secbytes.length + 1;
+ ByteBuffer buff = ByteBuffer.allocate(len);
+ buff.put(b);
+ buff.put(secbytes);
+ byte[] sdata = buff.array();
+ return new OtrCryptoEngineImpl().sha256Hash(sdata);
+ }
+
+ private byte[] getLocalDHPublicKeyBytes() throws OtrException {
+ if (localDHPublicKeyBytes == null) {
+ try {
+ this.localDHPublicKeyBytes = SerializationUtils
+ .writeMpi(((DHPublicKey) getLocalDHKeyPair()
+ .getPublic()).getY());
+
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ }
+ return localDHPublicKeyBytes;
+ }
+
+ public void handleReceivingMessage(AbstractMessage m) throws OtrException {
+
+ switch (m.messageType) {
+ case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
+ handleDHCommitMessage((DHCommitMessage) m);
+ break;
+ case AbstractEncodedMessage.MESSAGE_DHKEY:
+ handleDHKeyMessage((DHKeyMessage) m);
+ break;
+ case AbstractEncodedMessage.MESSAGE_REVEALSIG:
+ handleRevealSignatureMessage((RevealSignatureMessage) m);
+ break;
+ case AbstractEncodedMessage.MESSAGE_SIGNATURE:
+ handleSignatureMessage((SignatureMessage) m);
+ break;
+ default:
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private void handleSignatureMessage(SignatureMessage m) throws OtrException {
+ Session session = getSession();
+ SessionID sessionID = session.getSessionID();
+ logger.finest(sessionID.getAccountID()
+ + " received a signature message from " + sessionID.getUserID()
+ + " throught " + sessionID.getProtocolName() + ".");
+ if (!session.getSessionPolicy().getAllowV2()) {
+ logger.finest("Policy does not allow OTRv2, ignoring message.");
+ return;
+ }
+
+ switch (this.getAuthenticationState()) {
+ case AWAITING_SIG:
+ // Verify MAC.
+ if (!m.verify(this.getM2p())) {
+ logger
+ .finest("Signature MACs are not equal, ignoring message.");
+ return;
+ }
+
+ // Decrypt X.
+ byte[] remoteXDecrypted = m.decrypt(this.getCp());
+ SignatureX remoteX;
+ try {
+ remoteX = SerializationUtils.toMysteriousX(remoteXDecrypted);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+ // Compute signature.
+ PublicKey remoteLongTermPublicKey = remoteX.longTermPublicKey;
+ SignatureM remoteM = new SignatureM(this.getRemoteDHPublicKey(),
+ (DHPublicKey) this.getLocalDHKeyPair().getPublic(),
+ remoteLongTermPublicKey, remoteX.dhKeyID);
+ OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
+ // Verify signature.
+ byte[] signature;
+ try {
+ signature = otrCryptoEngine.sha256Hmac(SerializationUtils
+ .toByteArray(remoteM), this.getM1p());
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+ if (!otrCryptoEngine.verify(signature, remoteLongTermPublicKey,
+ remoteX.signature)) {
+ logger.finest("Signature verification failed.");
+ return;
+ }
+
+ this.setIsSecure(true);
+ this.setRemoteLongTermPublicKey(remoteLongTermPublicKey);
+ break;
+ default:
+ logger
+ .finest("We were not expecting a signature, ignoring message.");
+ return;
+ }
+ }
+
+ private void handleRevealSignatureMessage(RevealSignatureMessage m)
+ throws OtrException {
+ Session session = getSession();
+ SessionID sessionID = session.getSessionID();
+ logger.finest(sessionID.getAccountID()
+ + " received a reveal signature message from "
+ + sessionID.getUserID() + " throught "
+ + sessionID.getProtocolName() + ".");
+
+ if (!session.getSessionPolicy().getAllowV2()) {
+ logger.finest("Policy does not allow OTRv2, ignoring message.");
+ return;
+ }
+
+ switch (this.getAuthenticationState()) {
+ case AWAITING_REVEALSIG:
+ // Use the received value of r to decrypt the value of gx
+ // received
+ // in the D-H Commit Message, and verify the hash therein.
+ // Decrypt
+ // the encrypted signature, and verify the signature and the
+ // MACs.
+ // If everything checks out:
+
+ // * Reply with a Signature Message.
+ // * Transition authstate to AUTHSTATE_NONE.
+ // * Transition msgstate to MSGSTATE_ENCRYPTED.
+ // * TODO If there is a recent stored message, encrypt it and
+ // send
+ // it as a Data Message.
+
+ OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
+ // Uses r to decrypt the value of gx sent earlier
+ byte[] remoteDHPublicKeyDecrypted = otrCryptoEngine.aesDecrypt(
+ m.revealedKey, null, this.getRemoteDHPublicKeyEncrypted());
+
+ // Verifies that HASH(gx) matches the value sent earlier
+ byte[] remoteDHPublicKeyHash = otrCryptoEngine
+ .sha256Hash(remoteDHPublicKeyDecrypted);
+ if (!Arrays.equals(remoteDHPublicKeyHash, this
+ .getRemoteDHPublicKeyHash())) {
+ logger.finest("Hashes don't match, ignoring message.");
+ return;
+ }
+
+ // Verifies that Bob's gx is a legal value (2 <= gx <=
+ // modulus-2)
+ BigInteger remoteDHPublicKeyMpi;
+ try {
+ remoteDHPublicKeyMpi = SerializationUtils
+ .readMpi(remoteDHPublicKeyDecrypted);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ this.setRemoteDHPublicKey(otrCryptoEngine
+ .getDHPublicKey(remoteDHPublicKeyMpi));
+
+ // Verify received Data.
+ if (!m.verify(this.getM2())) {
+ logger
+ .finest("Signature MACs are not equal, ignoring message.");
+ return;
+ }
+
+ // Decrypt X.
+ byte[] remoteXDecrypted = m.decrypt(this.getC());
+ SignatureX remoteX;
+ try {
+ remoteX = SerializationUtils.toMysteriousX(remoteXDecrypted);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ // Compute signature.
+ PublicKey remoteLongTermPublicKey = remoteX.longTermPublicKey;
+ SignatureM remoteM = new SignatureM(this.getRemoteDHPublicKey(),
+ (DHPublicKey) this.getLocalDHKeyPair().getPublic(),
+ remoteLongTermPublicKey, remoteX.dhKeyID);
+
+ // Verify signature.
+ byte[] signature;
+ try {
+ signature = otrCryptoEngine.sha256Hmac(SerializationUtils
+ .toByteArray(remoteM), this.getM1());
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ if (!otrCryptoEngine.verify(signature, remoteLongTermPublicKey,
+ remoteX.signature)) {
+ logger.finest("Signature verification failed.");
+ return;
+ }
+
+ logger.finest("Signature verification succeeded.");
+
+ this.setAuthenticationState(AuthContext.NONE);
+ this.setIsSecure(true);
+ this.setRemoteLongTermPublicKey(remoteLongTermPublicKey);
+ getSession().injectMessage(messageFactory.getSignatureMessage());
+ break;
+ default:
+ logger.finest("Ignoring message.");
+ break;
+ }
+ }
+
+ private void handleDHKeyMessage(DHKeyMessage m) throws OtrException {
+ Session session = getSession();
+ SessionID sessionID = session.getSessionID();
+ logger.finest(sessionID.getAccountID()
+ + " received a D-H key message from " + sessionID.getUserID()
+ + " throught " + sessionID.getProtocolName() + ".");
+
+ if (!session.getSessionPolicy().getAllowV2()) {
+ logger.finest("If ALLOW_V2 is not set, ignore this message.");
+ return;
+ }
+
+ switch (this.getAuthenticationState()) {
+ case AWAITING_DHKEY:
+ // Reply with a Reveal Signature Message and transition
+ // authstate to
+ // AUTHSTATE_AWAITING_SIG
+ this.setRemoteDHPublicKey(m.dhPublicKey);
+ this.setAuthenticationState(AuthContext.AWAITING_SIG);
+ getSession().injectMessage(
+ messageFactory.getRevealSignatureMessage());
+ logger.finest("Sent Reveal Signature.");
+ break;
+ case AWAITING_SIG:
+
+ if (m.dhPublicKey.getY().equals(this.getRemoteDHPublicKey().getY())) {
+ // If this D-H Key message is the same the one you received
+ // earlier (when you entered AUTHSTATE_AWAITING_SIG):
+ // Retransmit
+ // your Reveal Signature Message.
+ getSession().injectMessage(
+ messageFactory.getRevealSignatureMessage());
+ logger.finest("Resent Reveal Signature.");
+ } else {
+ // Otherwise: Ignore the message.
+ logger.finest("Ignoring message.");
+ }
+ break;
+ default:
+ // Ignore the message
+ break;
+ }
+ }
+
+ private void handleDHCommitMessage(DHCommitMessage m) throws OtrException {
+ Session session = getSession();
+ SessionID sessionID = session.getSessionID();
+ logger.finest(sessionID.getAccountID()
+ + " received a D-H commit message from "
+ + sessionID.getUserID() + " throught "
+ + sessionID.getProtocolName() + ".");
+
+ if (!session.getSessionPolicy().getAllowV2()) {
+ logger.finest("ALLOW_V2 is not set, ignore this message.");
+ return;
+ }
+
+ switch (this.getAuthenticationState()) {
+ case NONE:
+ // Reply with a D-H Key Message, and transition authstate to
+ // AUTHSTATE_AWAITING_REVEALSIG.
+ this.reset();
+ this.setProtocolVersion(2);
+ this.setRemoteDHPublicKeyEncrypted(m.dhPublicKeyEncrypted);
+ this.setRemoteDHPublicKeyHash(m.dhPublicKeyHash);
+ this.setAuthenticationState(AuthContext.AWAITING_REVEALSIG);
+ getSession().injectMessage(messageFactory.getDHKeyMessage());
+ logger.finest("Sent D-H key.");
+ break;
+
+ case AWAITING_DHKEY:
+ // This is the trickiest transition in the whole protocol. It
+ // indicates that you have already sent a D-H Commit message to
+ // your
+ // correspondent, but that he either didn't receive it, or just
+ // didn't receive it yet, and has sent you one as well. The
+ // symmetry
+ // will be broken by comparing the hashed gx you sent in your
+ // D-H
+ // Commit Message with the one you received, considered as
+ // 32-byte
+ // unsigned big-endian values.
+ BigInteger ourHash = new BigInteger(1, this
+ .getLocalDHPublicKeyHash());
+ BigInteger theirHash = new BigInteger(1, m.dhPublicKeyHash);
+
+ if (theirHash.compareTo(ourHash) == -1) {
+ // Ignore the incoming D-H Commit message, but resend your
+ // D-H
+ // Commit message.
+ getSession().injectMessage(messageFactory.getDHCommitMessage());
+ logger
+ .finest("Ignored the incoming D-H Commit message, but resent our D-H Commit message.");
+ } else {
+ // *Forget* your old gx value that you sent (encrypted)
+ // earlier,
+ // and pretend you're in AUTHSTATE_NONE; i.e. reply with a
+ // D-H
+ // Key Message, and transition authstate to
+ // AUTHSTATE_AWAITING_REVEALSIG.
+ this.reset();
+ this.setProtocolVersion(2);
+ this.setRemoteDHPublicKeyEncrypted(m.dhPublicKeyEncrypted);
+ this.setRemoteDHPublicKeyHash(m.dhPublicKeyHash);
+ this.setAuthenticationState(AuthContext.AWAITING_REVEALSIG);
+ getSession().injectMessage(messageFactory.getDHKeyMessage());
+ logger
+ .finest("Forgot our old gx value that we sent (encrypted) earlier, and pretended we're in AUTHSTATE_NONE -> Sent D-H key.");
+ }
+ break;
+
+ case AWAITING_REVEALSIG:
+ // Retransmit your D-H Key Message (the same one as you sent
+ // when
+ // you entered AUTHSTATE_AWAITING_REVEALSIG). Forget the old D-H
+ // Commit message, and use this new one instead.
+ this.setRemoteDHPublicKeyEncrypted(m.dhPublicKeyEncrypted);
+ this.setRemoteDHPublicKeyHash(m.dhPublicKeyHash);
+ getSession().injectMessage(messageFactory.getDHKeyMessage());
+ logger.finest("Sent D-H key.");
+ break;
+ case AWAITING_SIG:
+ // Reply with a new D-H Key message, and transition authstate to
+ // AUTHSTATE_AWAITING_REVEALSIG
+ this.reset();
+ this.setRemoteDHPublicKeyEncrypted(m.dhPublicKeyEncrypted);
+ this.setRemoteDHPublicKeyHash(m.dhPublicKeyHash);
+ this.setAuthenticationState(AuthContext.AWAITING_REVEALSIG);
+ getSession().injectMessage(messageFactory.getDHKeyMessage());
+ logger.finest("Sent D-H key.");
+ break;
+ case V1_SETUP:
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public void startV2Auth() throws OtrException {
+ logger
+ .finest("Starting Authenticated Key Exchange, sending query message");
+ getSession().injectMessage(messageFactory.getQueryMessage());
+ }
+
+ public void respondV2Auth() throws OtrException {
+ logger.finest("Responding to Query Message");
+ this.reset();
+ this.setProtocolVersion(2);
+ this.setAuthenticationState(AuthContext.AWAITING_DHKEY);
+ logger.finest("Sending D-H Commit.");
+ getSession().injectMessage(messageFactory.getDHCommitMessage());
+ }
+
+ private void setSession(Session session) {
+ this.session = session;
+ }
+
+ private Session getSession() {
+ return session;
+ }
+
+ private PublicKey remoteLongTermPublicKey;
+
+ public PublicKey getRemoteLongTermPublicKey() {
+ return remoteLongTermPublicKey;
+ }
+
+ private void setRemoteLongTermPublicKey(PublicKey pubKey) {
+ this.remoteLongTermPublicKey = pubKey;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/session/Session.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,42 @@
+package net.java.otr4j.session;
+
+import java.security.KeyPair;
+import java.security.PublicKey;
+import java.util.List;
+
+import net.java.otr4j.OtrEngineListener;
+import net.java.otr4j.OtrException;
+import net.java.otr4j.OtrPolicy;
+import net.java.otr4j.io.messages.AbstractMessage;
+import net.java.otr4j.session.SessionImpl.TLV;
+
+public interface Session {
+
+ public abstract SessionStatus getSessionStatus();
+
+ public abstract SessionID getSessionID();
+
+ public abstract void injectMessage(AbstractMessage m) throws OtrException;
+
+ public abstract KeyPair getLocalKeyPair();
+
+ public abstract OtrPolicy getSessionPolicy();
+
+ public abstract String transformReceiving(String content)
+ throws OtrException;
+
+ public abstract String transformSending(String content, List<TLV> tlvs)
+ throws OtrException;
+
+ public abstract void startSession() throws OtrException;
+
+ public abstract void endSession() throws OtrException;
+
+ public abstract void refreshSession() throws OtrException;
+
+ public abstract PublicKey getRemotePublicKey();
+
+ public abstract void addOtrEngineListener(OtrEngineListener l);
+
+ public abstract void removeOtrEngineListener(OtrEngineListener l);
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/session/SessionID.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,70 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.session;
+
+/**
+ *
+ * @author George Politis
+ *
+ */
+public final class SessionID {
+
+ public SessionID(String accountID, String userID, String protocolName) {
+ this.setAccountID(accountID);
+ this.setUserID(userID);
+ this.setProtocolName(protocolName);
+ }
+
+ private String accountID;
+ private String userID;
+ private String protocolName;
+ public static final SessionID Empty = new SessionID(null, null, null);
+
+ public void setAccountID(String accountID) {
+ this.accountID = accountID;
+ }
+
+ public String getAccountID() {
+ return accountID;
+ }
+
+ private void setUserID(String userID) {
+ this.userID = userID;
+ }
+
+ public String getUserID() {
+ return userID;
+ }
+
+ private void setProtocolName(String protocolName) {
+ this.protocolName = protocolName;
+ }
+
+ public String getProtocolName() {
+ return protocolName;
+ }
+
+ public String toString() {
+ return this.getAccountID() + "_" + this.getProtocolName() + "_"
+ + this.getUserID();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ if (obj == null || obj.getClass() != this.getClass())
+ return false;
+
+ SessionID sessionID = (SessionID) obj;
+
+ return this.toString().equals(sessionID.toString());
+ }
+
+ public int hashCode() {
+ return this.toString().hashCode();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/session/SessionImpl.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,792 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package net.java.otr4j.session;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.security.KeyPair;
+import java.security.PublicKey;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Logger;
+import javax.crypto.interfaces.DHPublicKey;
+
+import net.java.otr4j.OtrEngineHost;
+import net.java.otr4j.OtrEngineListener;
+import net.java.otr4j.OtrException;
+import net.java.otr4j.OtrPolicy;
+import net.java.otr4j.crypto.OtrCryptoEngine;
+import net.java.otr4j.crypto.OtrCryptoEngineImpl;
+import net.java.otr4j.io.OtrInputStream;
+import net.java.otr4j.io.OtrOutputStream;
+import net.java.otr4j.io.SerializationConstants;
+import net.java.otr4j.io.SerializationUtils;
+import net.java.otr4j.io.messages.DataMessage;
+import net.java.otr4j.io.messages.AbstractEncodedMessage;
+import net.java.otr4j.io.messages.ErrorMessage;
+import net.java.otr4j.io.messages.AbstractMessage;
+import net.java.otr4j.io.messages.MysteriousT;
+import net.java.otr4j.io.messages.PlainTextMessage;
+import net.java.otr4j.io.messages.QueryMessage;
+
+/**
+ *
+ * @author George Politis
+ */
+public class SessionImpl implements Session {
+
+ class TLV {
+ public TLV(int type, byte[] value) {
+ this.setType(type);
+ this.setValue(value);
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setValue(byte[] value) {
+ this.value = value;
+ }
+
+ public byte[] getValue() {
+ return value;
+ }
+
+ private int type;
+ private byte[] value;
+ }
+
+ private SessionID sessionID;
+ private OtrEngineHost host;
+ private SessionStatus sessionStatus;
+ private AuthContext authContext;
+ private SessionKeys[][] sessionKeys;
+ private Vector<byte[]> oldMacKeys;
+ private static Logger logger = Logger
+ .getLogger(SessionImpl.class.getName());
+
+ public SessionImpl(SessionID sessionID, OtrEngineHost listener) {
+
+ this.setSessionID(sessionID);
+ this.setHost(listener);
+
+ // client application calls OtrEngine.getSessionStatus()
+ // -> create new session if it does not exist, end up here
+ // -> setSessionStatus() fires statusChangedEvent
+ // -> client application calls OtrEngine.getSessionStatus()
+ this.sessionStatus = SessionStatus.PLAINTEXT;
+ }
+
+ private SessionKeys getEncryptionSessionKeys() {
+ logger.finest("Getting encryption keys");
+ return getSessionKeysByIndex(SessionKeys.Previous, SessionKeys.Current);
+ }
+
+ private SessionKeys getMostRecentSessionKeys() {
+ logger.finest("Getting most recent keys.");
+ return getSessionKeysByIndex(SessionKeys.Current, SessionKeys.Current);
+ }
+
+ private SessionKeys getSessionKeysByID(int localKeyID, int remoteKeyID) {
+ logger
+ .finest("Searching for session keys with (localKeyID, remoteKeyID) = ("
+ + localKeyID + "," + remoteKeyID + ")");
+
+ for (int i = 0; i < getSessionKeys().length; i++) {
+ for (int j = 0; j < getSessionKeys()[i].length; j++) {
+ SessionKeys current = getSessionKeysByIndex(i, j);
+ if (current.getLocalKeyID() == localKeyID
+ && current.getRemoteKeyID() == remoteKeyID) {
+ logger.finest("Matching keys found.");
+ return current;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private SessionKeys getSessionKeysByIndex(int localKeyIndex,
+ int remoteKeyIndex) {
+ if (getSessionKeys()[localKeyIndex][remoteKeyIndex] == null)
+ getSessionKeys()[localKeyIndex][remoteKeyIndex] = new SessionKeysImpl(
+ localKeyIndex, remoteKeyIndex);
+
+ return getSessionKeys()[localKeyIndex][remoteKeyIndex];
+ }
+
+ private void rotateRemoteSessionKeys(DHPublicKey pubKey)
+ throws OtrException {
+
+ logger.finest("Rotating remote keys.");
+ SessionKeys sess1 = getSessionKeysByIndex(SessionKeys.Current,
+ SessionKeys.Previous);
+ if (sess1.getIsUsedReceivingMACKey()) {
+ logger
+ .finest("Detected used Receiving MAC key. Adding to old MAC keys to reveal it.");
+ getOldMacKeys().add(sess1.getReceivingMACKey());
+ }
+
+ SessionKeys sess2 = getSessionKeysByIndex(SessionKeys.Previous,
+ SessionKeys.Previous);
+ if (sess2.getIsUsedReceivingMACKey()) {
+ logger
+ .finest("Detected used Receiving MAC key. Adding to old MAC keys to reveal it.");
+ getOldMacKeys().add(sess2.getReceivingMACKey());
+ }
+
+ SessionKeys sess3 = getSessionKeysByIndex(SessionKeys.Current,
+ SessionKeys.Current);
+ sess1
+ .setRemoteDHPublicKey(sess3.getRemoteKey(), sess3
+ .getRemoteKeyID());
+
+ SessionKeys sess4 = getSessionKeysByIndex(SessionKeys.Previous,
+ SessionKeys.Current);
+ sess2
+ .setRemoteDHPublicKey(sess4.getRemoteKey(), sess4
+ .getRemoteKeyID());
+
+ sess3.setRemoteDHPublicKey(pubKey, sess3.getRemoteKeyID() + 1);
+ sess4.setRemoteDHPublicKey(pubKey, sess4.getRemoteKeyID() + 1);
+ }
+
+ private void rotateLocalSessionKeys() throws OtrException {
+
+ logger.finest("Rotating local keys.");
+ SessionKeys sess1 = getSessionKeysByIndex(SessionKeys.Previous,
+ SessionKeys.Current);
+ if (sess1.getIsUsedReceivingMACKey()) {
+ logger
+ .finest("Detected used Receiving MAC key. Adding to old MAC keys to reveal it.");
+ getOldMacKeys().add(sess1.getReceivingMACKey());
+ }
+
+ SessionKeys sess2 = getSessionKeysByIndex(SessionKeys.Previous,
+ SessionKeys.Previous);
+ if (sess2.getIsUsedReceivingMACKey()) {
+ logger
+ .finest("Detected used Receiving MAC key. Adding to old MAC keys to reveal it.");
+ getOldMacKeys().add(sess2.getReceivingMACKey());
+ }
+
+ SessionKeys sess3 = getSessionKeysByIndex(SessionKeys.Current,
+ SessionKeys.Current);
+ sess1.setLocalPair(sess3.getLocalPair(), sess3.getLocalKeyID());
+ SessionKeys sess4 = getSessionKeysByIndex(SessionKeys.Current,
+ SessionKeys.Previous);
+ sess2.setLocalPair(sess4.getLocalPair(), sess4.getLocalKeyID());
+
+ KeyPair newPair = new OtrCryptoEngineImpl().generateDHKeyPair();
+ sess3.setLocalPair(newPair, sess3.getLocalKeyID() + 1);
+ sess4.setLocalPair(newPair, sess4.getLocalKeyID() + 1);
+ }
+
+ private byte[] collectOldMacKeys() {
+ logger.finest("Collecting old MAC keys to be revealed.");
+ int len = 0;
+ for (int i = 0; i < getOldMacKeys().size(); i++)
+ len += getOldMacKeys().get(i).length;
+
+ ByteBuffer buff = ByteBuffer.allocate(len);
+ for (int i = 0; i < getOldMacKeys().size(); i++)
+ buff.put(getOldMacKeys().get(i));
+
+ getOldMacKeys().clear();
+ return buff.array();
+ }
+
+ private void setSessionStatus(SessionStatus sessionStatus)
+ throws OtrException {
+
+ if (sessionStatus == this.sessionStatus)
+ return;
+
+ switch (sessionStatus) {
+ case ENCRYPTED:
+ AuthContext auth = this.getAuthContext();
+ logger.finest("Setting most recent session keys from auth.");
+ for (int i = 0; i < this.getSessionKeys()[0].length; i++) {
+ SessionKeys current = getSessionKeysByIndex(0, i);
+ current.setLocalPair(auth.getLocalDHKeyPair(), 1);
+ current.setRemoteDHPublicKey(auth.getRemoteDHPublicKey(), 1);
+ current.setS(auth.getS());
+ }
+
+ KeyPair nextDH = new OtrCryptoEngineImpl().generateDHKeyPair();
+ for (int i = 0; i < this.getSessionKeys()[1].length; i++) {
+ SessionKeys current = getSessionKeysByIndex(1, i);
+ current.setRemoteDHPublicKey(auth.getRemoteDHPublicKey(), 1);
+ current.setLocalPair(nextDH, 2);
+ }
+
+ this.setRemotePublicKey(auth.getRemoteLongTermPublicKey());
+
+ auth.reset();
+ break;
+ }
+
+ this.sessionStatus = sessionStatus;
+
+ for (OtrEngineListener l : this.listeners)
+ l.sessionStatusChanged(getSessionID());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.java.otr4j.session.ISession#getSessionStatus()
+ */
+
+ public SessionStatus getSessionStatus() {
+ return sessionStatus;
+ }
+
+ private void setSessionID(SessionID sessionID) {
+ this.sessionID = sessionID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.java.otr4j.session.ISession#getSessionID()
+ */
+ public SessionID getSessionID() {
+ return sessionID;
+ }
+
+ private void setHost(OtrEngineHost host) {
+ this.host = host;
+ }
+
+ private OtrEngineHost getHost() {
+ return host;
+ }
+
+ private SessionKeys[][] getSessionKeys() {
+ if (sessionKeys == null)
+ sessionKeys = new SessionKeys[2][2];
+ return sessionKeys;
+ }
+
+ private AuthContext getAuthContext() {
+ if (authContext == null)
+ authContext = new AuthContextImpl(this);
+ return authContext;
+ }
+
+ private Vector<byte[]> getOldMacKeys() {
+ if (oldMacKeys == null)
+ oldMacKeys = new Vector<byte[]>();
+ return oldMacKeys;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.java.otr4j.session.ISession#handleReceivingMessage(java.lang.String)
+ */
+ public String transformReceiving(String msgText) throws OtrException {
+ OtrPolicy policy = getSessionPolicy();
+ if (!policy.getAllowV1() && !policy.getAllowV2()) {
+ logger
+ .finest("Policy does not allow neither V1 not V2, ignoring message.");
+ return msgText;
+ }
+
+ AbstractMessage m;
+ try {
+ m = SerializationUtils.toMessage(msgText);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ if (m == null)
+ return msgText; // Propably null or empty.
+
+ switch (m.messageType) {
+ case AbstractEncodedMessage.MESSAGE_DATA:
+ return handleDataMessage((DataMessage) m);
+ case AbstractMessage.MESSAGE_ERROR:
+ handleErrorMessage((ErrorMessage) m);
+ return null;
+ case AbstractMessage.MESSAGE_PLAINTEXT:
+ return handlePlainTextMessage((PlainTextMessage) m);
+ case AbstractMessage.MESSAGE_QUERY:
+ handleQueryMessage((QueryMessage) m);
+ return null;
+ case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
+ case AbstractEncodedMessage.MESSAGE_DHKEY:
+ case AbstractEncodedMessage.MESSAGE_REVEALSIG:
+ case AbstractEncodedMessage.MESSAGE_SIGNATURE:
+ AuthContext auth = this.getAuthContext();
+ auth.handleReceivingMessage(m);
+
+ if (auth.getIsSecure()) {
+ this.setSessionStatus(SessionStatus.ENCRYPTED);
+ logger.finest("Gone Secure.");
+ }
+ return null;
+ default:
+ throw new UnsupportedOperationException(
+ "Received an uknown message type.");
+ }
+ }
+
+ private void handleQueryMessage(QueryMessage queryMessage)
+ throws OtrException {
+ logger.finest(getSessionID().getAccountID()
+ + " received a query message from "
+ + getSessionID().getUserID() + " throught "
+ + getSessionID().getProtocolName() + ".");
+
+ setSessionStatus(SessionStatus.PLAINTEXT);
+
+ OtrPolicy policy = getSessionPolicy();
+ if (queryMessage.versions.contains(2) && policy.getAllowV2()) {
+ logger.finest("Query message with V2 support found.");
+ getAuthContext().respondV2Auth();
+ } else if (queryMessage.versions.contains(1) && policy.getAllowV1()) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private void handleErrorMessage(ErrorMessage errorMessage)
+ throws OtrException {
+ logger.finest(getSessionID().getAccountID()
+ + " received an error message from "
+ + getSessionID().getUserID() + " throught "
+ + getSessionID().getUserID() + ".");
+
+ getHost().showError(this.getSessionID(), errorMessage.error);
+
+ OtrPolicy policy = getSessionPolicy();
+ if (policy.getErrorStartAKE()) {
+ logger.finest("Error message starts AKE.");
+ Vector<Integer> versions = new Vector<Integer>();
+ if (policy.getAllowV1())
+ versions.add(1);
+
+ if (policy.getAllowV2())
+ versions.add(2);
+
+ logger.finest("Sending Query");
+ injectMessage(new QueryMessage(versions));
+ }
+ }
+
+ private String handleDataMessage(DataMessage data) throws OtrException {
+ logger.finest(getSessionID().getAccountID()
+ + " received a data message from " + getSessionID().getUserID()
+ + ".");
+
+ switch (this.getSessionStatus()) {
+ case ENCRYPTED:
+ logger
+ .finest("Message state is ENCRYPTED. Trying to decrypt message.");
+
+ // Find matching session keys.
+ int senderKeyID = data.senderKeyID;
+ int receipientKeyID = data.recipientKeyID;
+ SessionKeys matchingKeys = this.getSessionKeysByID(receipientKeyID,
+ senderKeyID);
+
+ if (matchingKeys == null) {
+ logger.finest("No matching keys found.");
+ return null;
+ }
+
+ // Verify received MAC with a locally calculated MAC.
+ logger
+ .finest("Transforming T to byte[] to calculate it's HmacSHA1.");
+
+ byte[] serializedT;
+ try {
+ serializedT = SerializationUtils.toByteArray(data.getT());
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
+
+ byte[] computedMAC = otrCryptoEngine.sha1Hmac(serializedT,
+ matchingKeys.getReceivingMACKey(),
+ SerializationConstants.TYPE_LEN_MAC);
+
+ if (!Arrays.equals(computedMAC, data.mac)) {
+ logger.finest("MAC verification failed, ignoring message");
+ return null;
+ }
+
+ logger.finest("Computed HmacSHA1 value matches sent one.");
+
+ // Mark this MAC key as old to be revealed.
+ matchingKeys.setIsUsedReceivingMACKey(true);
+
+ matchingKeys.setReceivingCtr(data.ctr);
+
+ byte[] dmc = otrCryptoEngine.aesDecrypt(matchingKeys
+ .getReceivingAESKey(), matchingKeys.getReceivingCtr(),
+ data.encryptedMessage);
+ String decryptedMsgContent;
+ try {
+ // Expect bytes to be text encoded in UTF-8.
+ decryptedMsgContent = new String(dmc, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new OtrException(e);
+ }
+
+ logger.finest("Decrypted message: \"" + decryptedMsgContent + "\"");
+
+ // Rotate keys if necessary.
+ SessionKeys mostRecent = this.getMostRecentSessionKeys();
+ if (mostRecent.getLocalKeyID() == receipientKeyID)
+ this.rotateLocalSessionKeys();
+
+ if (mostRecent.getRemoteKeyID() == senderKeyID)
+ this.rotateRemoteSessionKeys(data.nextDH);
+
+ // Handle TLVs
+ List<TLV> tlvs = null;
+ int tlvIndex = decryptedMsgContent.indexOf((char) 0x0);
+ if (tlvIndex > -1) {
+ decryptedMsgContent = decryptedMsgContent
+ .substring(0, tlvIndex);
+ tlvIndex++;
+ byte[] tlvsb = new byte[dmc.length - tlvIndex];
+ System.arraycopy(dmc, tlvIndex, tlvsb, 0, tlvsb.length);
+
+ tlvs = new Vector<TLV>();
+ ByteArrayInputStream tin = new ByteArrayInputStream(tlvsb);
+ while (tin.available() > 0) {
+ int type;
+ byte[] tdata;
+ OtrInputStream eois = new OtrInputStream(tin);
+ try {
+ type = eois.readShort();
+ tdata = eois.readTlvData();
+ eois.close();
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ tlvs.add(new TLV(type, tdata));
+ }
+ }
+ if (tlvs != null && tlvs.size() > 0) {
+ for (TLV tlv : tlvs) {
+ switch (tlv.getType()) {
+ case 1:
+ this.setSessionStatus(SessionStatus.FINISHED);
+ return null;
+ default:
+ return decryptedMsgContent;
+ }
+ }
+ }
+
+ return decryptedMsgContent;
+
+ case FINISHED:
+ case PLAINTEXT:
+ getHost().showWarning(this.getSessionID(),
+ "Unreadable encrypted message was received.");
+
+ injectMessage(new ErrorMessage(AbstractMessage.MESSAGE_ERROR,
+ "You sent me an unreadable encrypted message.."));
+ break;
+ }
+
+ return null;
+ }
+
+ public void injectMessage(AbstractMessage m) throws OtrException {
+ String msg;
+ try {
+ msg = SerializationUtils.toString(m);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+ getHost().injectMessage(getSessionID(), msg);
+ }
+
+ private String handlePlainTextMessage(PlainTextMessage plainTextMessage)
+ throws OtrException {
+ logger.finest(getSessionID().getAccountID()
+ + " received a plaintext message from "
+ + getSessionID().getUserID() + " throught "
+ + getSessionID().getProtocolName() + ".");
+
+ OtrPolicy policy = getSessionPolicy();
+ List<Integer> versions = plainTextMessage.versions;
+ if (versions == null || versions.size() < 1) {
+ logger
+ .finest("Received plaintext message without the whitespace tag.");
+ switch (this.getSessionStatus()) {
+ case ENCRYPTED:
+ case FINISHED:
+ // Display the message to the user, but warn him that the
+ // message was received unencrypted.
+ getHost().showWarning(this.getSessionID(),
+ "The message was received unencrypted.");
+ return plainTextMessage.cleanText;
+ case PLAINTEXT:
+ // Simply display the message to the user. If
+ // REQUIRE_ENCRYPTION
+ // is set, warn him that the message was received
+ // unencrypted.
+ if (policy.getRequireEncryption()) {
+ getHost().showWarning(this.getSessionID(),
+ "The message was received unencrypted.");
+ }
+ return plainTextMessage.cleanText;
+ }
+ } else {
+ logger
+ .finest("Received plaintext message with the whitespace tag.");
+ switch (this.getSessionStatus()) {
+ case ENCRYPTED:
+ case FINISHED:
+ // Remove the whitespace tag and display the message to the
+ // user, but warn him that the message was received
+ // unencrypted.
+ getHost().showWarning(this.getSessionID(),
+ "The message was received unencrypted.");
+ case PLAINTEXT:
+ // Remove the whitespace tag and display the message to the
+ // user. If REQUIRE_ENCRYPTION is set, warn him that the
+ // message
+ // was received unencrypted.
+ if (policy.getRequireEncryption())
+ getHost().showWarning(this.getSessionID(),
+ "The message was received unencrypted.");
+ }
+
+ if (policy.getWhitespaceStartAKE()) {
+ logger.finest("WHITESPACE_START_AKE is set");
+
+ if (plainTextMessage.versions.contains(2)
+ && policy.getAllowV2()) {
+ logger.finest("V2 tag found.");
+ getAuthContext().respondV2Auth();
+ } else if (plainTextMessage.versions.contains(1)
+ && policy.getAllowV1()) {
+ throw new UnsupportedOperationException();
+ }
+ }
+ }
+
+ return plainTextMessage.cleanText;
+ }
+
+ // Retransmit last sent message. Spec document does not mention where or
+ // when that should happen, must check libotr code.
+ private String lastSentMessage;
+
+ public String transformSending(String msgText, List<TLV> tlvs)
+ throws OtrException {
+
+ switch (this.getSessionStatus()) {
+ case PLAINTEXT:
+ if (getSessionPolicy().getRequireEncryption()) {
+ this.lastSentMessage = msgText;
+ this.startSession();
+ } else
+ // TODO this does not precisly behave according to
+ // specification.
+ return msgText;
+ case ENCRYPTED:
+ this.lastSentMessage = msgText;
+ logger.finest(getSessionID().getAccountID()
+ + " sends an encrypted message to "
+ + getSessionID().getUserID() + " throught "
+ + getSessionID().getProtocolName() + ".");
+
+ // Get encryption keys.
+ SessionKeys encryptionKeys = this.getEncryptionSessionKeys();
+ int senderKeyID = encryptionKeys.getLocalKeyID();
+ int receipientKeyID = encryptionKeys.getRemoteKeyID();
+
+ // Increment CTR.
+ encryptionKeys.incrementSendingCtr();
+ byte[] ctr = encryptionKeys.getSendingCtr();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ if (msgText != null && msgText.length() > 0)
+ try {
+ out.write(msgText.getBytes("UTF8"));
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ // Append tlvs
+ if (tlvs != null && tlvs.size() > 0) {
+ out.write((byte) 0x00);
+
+ OtrOutputStream eoos = new OtrOutputStream(out);
+ for (TLV tlv : tlvs) {
+ try {
+ eoos.writeShort(tlv.type);
+ eoos.writeTlvData(tlv.value);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+ }
+ }
+
+ OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
+
+ byte[] data = out.toByteArray();
+ // Encrypt message.
+ logger
+ .finest("Encrypting message with keyids (localKeyID, remoteKeyID) = ("
+ + senderKeyID + ", " + receipientKeyID + ")");
+ byte[] encryptedMsg = otrCryptoEngine.aesEncrypt(encryptionKeys
+ .getSendingAESKey(), ctr, data);
+
+ // Get most recent keys to get the next D-H public key.
+ SessionKeys mostRecentKeys = this.getMostRecentSessionKeys();
+ DHPublicKey nextDH = (DHPublicKey) mostRecentKeys.getLocalPair()
+ .getPublic();
+
+ // Calculate T.
+ MysteriousT t = new MysteriousT(2, 0, senderKeyID, receipientKeyID,
+ nextDH, ctr, encryptedMsg);
+
+ // Calculate T hash.
+ byte[] sendingMACKey = encryptionKeys.getSendingMACKey();
+
+ logger
+ .finest("Transforming T to byte[] to calculate it's HmacSHA1.");
+ byte[] serializedT;
+ try {
+ serializedT = SerializationUtils.toByteArray(t);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+
+ byte[] mac = otrCryptoEngine.sha1Hmac(serializedT, sendingMACKey,
+ SerializationConstants.TYPE_LEN_MAC);
+
+ // Get old MAC keys to be revealed.
+ byte[] oldKeys = this.collectOldMacKeys();
+ DataMessage m = new DataMessage(t, mac, oldKeys);
+
+ try {
+ return SerializationUtils.toString(m);
+ } catch (IOException e) {
+ throw new OtrException(e);
+ }
+ case FINISHED:
+ this.lastSentMessage = msgText;
+ getHost()
+ .showError(
+ sessionID,
+ "Your message to "
+ + sessionID.getUserID()
+ + " was not sent. Either end your private conversation, or restart it.");
+ return null;
+ default:
+ logger.finest("Uknown message state, not processing.");
+ return msgText;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.java.otr4j.session.ISession#startSession()
+ */
+ public void startSession() throws OtrException {
+ if (this.getSessionStatus() == SessionStatus.ENCRYPTED)
+ return;
+
+ if (!getSessionPolicy().getAllowV2())
+ throw new UnsupportedOperationException();
+
+ this.getAuthContext().startV2Auth();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.java.otr4j.session.ISession#endSession()
+ */
+ public void endSession() throws OtrException {
+ SessionStatus status = this.getSessionStatus();
+ switch (status) {
+ case ENCRYPTED:
+ Vector<TLV> tlvs = new Vector<TLV>();
+ tlvs.add(new TLV(1, null));
+
+ String msg = this.transformSending(null, tlvs);
+ getHost().injectMessage(getSessionID(), msg);
+ this.setSessionStatus(SessionStatus.PLAINTEXT);
+ break;
+ case FINISHED:
+ this.setSessionStatus(SessionStatus.PLAINTEXT);
+ break;
+ case PLAINTEXT:
+ return;
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.java.otr4j.session.ISession#refreshSession()
+ */
+ public void refreshSession() throws OtrException {
+ this.endSession();
+ this.startSession();
+ }
+
+ private PublicKey remotePublicKey;
+
+ private void setRemotePublicKey(PublicKey pubKey) {
+ this.remotePublicKey = pubKey;
+ }
+
+ public PublicKey getRemotePublicKey() {
+ return remotePublicKey;
+ }
+
+ private List<OtrEngineListener> listeners = new Vector<OtrEngineListener>();
+
+ public void addOtrEngineListener(OtrEngineListener l) {
+ synchronized (listeners) {
+ if (!listeners.contains(l))
+ listeners.add(l);
+ }
+ }
+
+ public void removeOtrEngineListener(OtrEngineListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+
+ public OtrPolicy getSessionPolicy() {
+ return getHost().getSessionPolicy(getSessionID());
+ }
+
+ public KeyPair getLocalKeyPair() {
+ return getHost().getKeyPair(this.getSessionID());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/session/SessionKeys.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,54 @@
+package net.java.otr4j.session;
+
+import java.math.BigInteger;
+import java.security.KeyPair;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+import net.java.otr4j.OtrException;
+
+interface SessionKeys {
+
+ public static final int Previous = 0;
+ public static final int Current = 1;
+ public static final byte HIGH_SEND_BYTE = (byte) 0x01;
+ public static final byte HIGH_RECEIVE_BYTE = (byte) 0x02;
+ public static final byte LOW_SEND_BYTE = (byte) 0x02;
+ public static final byte LOW_RECEIVE_BYTE = (byte) 0x01;
+
+ public abstract void setLocalPair(KeyPair keyPair, int localPairKeyID);
+
+ public abstract void setRemoteDHPublicKey(DHPublicKey pubKey,
+ int remoteKeyID);
+
+ public abstract void incrementSendingCtr();
+
+ public abstract byte[] getSendingCtr();
+
+ public abstract byte[] getReceivingCtr();
+
+ public abstract void setReceivingCtr(byte[] ctr);
+
+ public abstract byte[] getSendingAESKey() throws OtrException;
+
+ public abstract byte[] getReceivingAESKey() throws OtrException;
+
+ public abstract byte[] getSendingMACKey() throws OtrException;
+
+ public abstract byte[] getReceivingMACKey() throws OtrException;
+
+ public abstract void setS(BigInteger s);
+
+ public abstract void setIsUsedReceivingMACKey(Boolean isUsedReceivingMACKey);
+
+ public abstract Boolean getIsUsedReceivingMACKey();
+
+ public abstract int getLocalKeyID();
+
+ public abstract int getRemoteKeyID();
+
+ public abstract DHPublicKey getRemoteKey();
+
+ public abstract KeyPair getLocalPair();
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/session/SessionKeysImpl.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,240 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.session;
+
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.security.KeyPair;
+import java.util.Arrays;
+import java.util.logging.Logger;
+
+import javax.crypto.interfaces.DHPublicKey;
+
+import net.java.otr4j.OtrException;
+import net.java.otr4j.crypto.OtrCryptoEngine;
+import net.java.otr4j.crypto.OtrCryptoEngineImpl;
+import net.java.otr4j.io.SerializationUtils;
+
+/**
+ *
+ * @author George Politis
+ */
+class SessionKeysImpl implements SessionKeys {
+
+ private static Logger logger = Logger.getLogger(SessionKeysImpl.class
+ .getName());
+ private String keyDescription;
+
+ public SessionKeysImpl(int localKeyIndex, int remoteKeyIndex) {
+ if (localKeyIndex == 0)
+ keyDescription = "(Previous local, ";
+ else
+ keyDescription = "(Most recent local, ";
+
+ if (remoteKeyIndex == 0)
+ keyDescription += "Previous remote)";
+ else
+ keyDescription += "Most recent remote)";
+
+ }
+
+ public void setLocalPair(KeyPair keyPair, int localPairKeyID) {
+ this.localPair = keyPair;
+ this.setLocalKeyID(localPairKeyID);
+ logger.finest(keyDescription + " current local key ID: "
+ + this.getLocalKeyID());
+ this.reset();
+ }
+
+ public void setRemoteDHPublicKey(DHPublicKey pubKey, int remoteKeyID) {
+ this.setRemoteKey(pubKey);
+ this.setRemoteKeyID(remoteKeyID);
+ logger.finest(keyDescription + " current remote key ID: "
+ + this.getRemoteKeyID());
+ this.reset();
+ }
+
+ private byte[] sendingCtr = new byte[16];
+ private byte[] receivingCtr = new byte[16];
+
+ public void incrementSendingCtr() {
+ logger.finest("Incrementing counter for (localkeyID, remoteKeyID) = ("
+ + getLocalKeyID() + "," + getRemoteKeyID() + ")");
+ // logger.debug("Counter prior increament: " +
+ // Utils.dump(sendingCtr,
+ // true, 16));
+ for (int i = 7; i >= 0; i--)
+ if (++sendingCtr[i] != 0)
+ break;
+ // logger.debug("Counter after increament: " +
+ // Utils.dump(sendingCtr,
+ // true, 16));
+ }
+
+ public byte[] getSendingCtr() {
+ return sendingCtr;
+ }
+
+ public byte[] getReceivingCtr() {
+ return receivingCtr;
+ }
+
+ public void setReceivingCtr(byte[] ctr) {
+ for (int i = 0; i < ctr.length; i++)
+ receivingCtr[i] = ctr[i];
+ }
+
+ private void reset() {
+ logger.finest("Resetting " + keyDescription + " session keys.");
+ Arrays.fill(this.sendingCtr, (byte) 0x00);
+ Arrays.fill(this.receivingCtr, (byte) 0x00);
+ this.sendingAESKey = null;
+ this.receivingAESKey = null;
+ this.sendingMACKey = null;
+ this.receivingMACKey = null;
+ this.setIsUsedReceivingMACKey(false);
+ this.s = null;
+ if (getLocalPair() != null && getRemoteKey() != null) {
+ this.isHigh = ((DHPublicKey) getLocalPair().getPublic()).getY()
+ .abs().compareTo(getRemoteKey().getY().abs()) == 1;
+ }
+
+ }
+
+ private byte[] h1(byte b) throws OtrException {
+
+ try {
+ byte[] secbytes = SerializationUtils.writeMpi(getS());
+
+ int len = secbytes.length + 1;
+ ByteBuffer buff = ByteBuffer.allocate(len);
+ buff.put(b);
+ buff.put(secbytes);
+ byte[] result = new OtrCryptoEngineImpl().sha1Hash(buff.array());
+ return result;
+ } catch (Exception e) {
+ throw new OtrException(e);
+ }
+ }
+
+ public byte[] getSendingAESKey() throws OtrException {
+ if (sendingAESKey != null)
+ return sendingAESKey;
+
+ byte sendbyte = LOW_SEND_BYTE;
+ if (this.isHigh)
+ sendbyte = HIGH_SEND_BYTE;
+
+ byte[] h1 = h1(sendbyte);
+
+ byte[] key = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
+ ByteBuffer buff = ByteBuffer.wrap(h1);
+ buff.get(key);
+ logger.finest("Calculated sending AES key.");
+ this.sendingAESKey = key;
+ return sendingAESKey;
+ }
+
+ public byte[] getReceivingAESKey() throws OtrException {
+ if (receivingAESKey != null)
+ return receivingAESKey;
+
+ byte receivebyte = LOW_RECEIVE_BYTE;
+ if (this.isHigh)
+ receivebyte = HIGH_RECEIVE_BYTE;
+
+ byte[] h1 = h1(receivebyte);
+
+ byte[] key = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
+ ByteBuffer buff = ByteBuffer.wrap(h1);
+ buff.get(key);
+ logger.finest("Calculated receiving AES key.");
+ this.receivingAESKey = key;
+
+ return receivingAESKey;
+ }
+
+ public byte[] getSendingMACKey() throws OtrException {
+ if (sendingMACKey != null)
+ return sendingMACKey;
+
+ sendingMACKey = new OtrCryptoEngineImpl().sha1Hash(getSendingAESKey());
+ logger.finest("Calculated sending MAC key.");
+ return sendingMACKey;
+ }
+
+ public byte[] getReceivingMACKey() throws OtrException {
+ if (receivingMACKey == null) {
+ receivingMACKey = new OtrCryptoEngineImpl()
+ .sha1Hash(getReceivingAESKey());
+ logger.finest("Calculated receiving AES key.");
+ }
+ return receivingMACKey;
+ }
+
+ private BigInteger getS() throws OtrException {
+ if (s == null) {
+ s = new OtrCryptoEngineImpl().generateSecret(getLocalPair()
+ .getPrivate(), getRemoteKey());
+ logger.finest("Calculating shared secret S.");
+ }
+ return s;
+ }
+
+ public void setS(BigInteger s) {
+ this.s = s;
+ }
+
+ public void setIsUsedReceivingMACKey(Boolean isUsedReceivingMACKey) {
+ this.isUsedReceivingMACKey = isUsedReceivingMACKey;
+ }
+
+ public Boolean getIsUsedReceivingMACKey() {
+ return isUsedReceivingMACKey;
+ }
+
+ private void setLocalKeyID(int localKeyID) {
+ this.localKeyID = localKeyID;
+ }
+
+ public int getLocalKeyID() {
+ return localKeyID;
+ }
+
+ private void setRemoteKeyID(int remoteKeyID) {
+ this.remoteKeyID = remoteKeyID;
+ }
+
+ public int getRemoteKeyID() {
+ return remoteKeyID;
+ }
+
+ private void setRemoteKey(DHPublicKey remoteKey) {
+ this.remoteKey = remoteKey;
+ }
+
+ public DHPublicKey getRemoteKey() {
+ return remoteKey;
+ }
+
+ public KeyPair getLocalPair() {
+ return localPair;
+ }
+
+ private int localKeyID;
+ private int remoteKeyID;
+ private DHPublicKey remoteKey;
+ private KeyPair localPair;
+
+ private byte[] sendingAESKey;
+ private byte[] receivingAESKey;
+ private byte[] sendingMACKey;
+ private byte[] receivingMACKey;
+ private Boolean isUsedReceivingMACKey;
+ private BigInteger s;
+ private Boolean isHigh;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/java/net/java/otr4j/session/SessionStatus.java Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,17 @@
+/*
+ * otr4j, the open source java otr library.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.otr4j.session;
+
+/**
+ *
+ * @author George Politis
+ */
+public enum SessionStatus {
+ PLAINTEXT,
+ ENCRYPTED,
+ FINISHED
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/anim/rotate_and_scale.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <rotate android:fromDegrees="0" android:toDegrees="360"
+ android:pivotX="50%" android:pivotY="50%"
+ android:duration="5000"
+ android:repeatMode="restart"
+ android:repeatCount="infinite" />
+</set>
Binary file app/src/main/res/drawable-hdpi/beem_icon_launcher_color.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_angel.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_cool.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_crying.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_embarrassed.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_foot_in_mouth.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_happy.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_heart.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_kissing.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_laughing.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_lips_are_sealed.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_mad.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_money_mouth.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_pokerface.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_sad.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_smirk.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_surprised.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_tongue_sticking_out.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_undecided.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_winking.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_wtf.png has changed
Binary file app/src/main/res/drawable-hdpi/emo_im_yelling.png has changed
Binary file app/src/main/res/drawable-ldpi/beem_icon_launcher_color.png has changed
Binary file app/src/main/res/drawable-mdpi/beem_icon_launcher_color.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_angel.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_cool.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_crying.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_embarrassed.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_foot_in_mouth.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_happy.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_heart.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_kissing.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_laughing.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_lips_are_sealed.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_mad.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_money_mouth.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_pokerface.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_sad.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_smirk.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_surprised.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_tongue_sticking_out.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_undecided.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_winking.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_wtf.png has changed
Binary file app/src/main/res/drawable-mdpi/emo_im_yelling.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/drawable/avatar_status.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Layer Level list drawable for Avatar and status icon
+ See src/com/beem/project/beem/utils/Status.java
+ for level values to change the status.
+ The status icon must be resized using method
+ LayerDrawable.setLayerInset();
+ The drawable with id @id/avatar must be replace by the real
+ avatar using the method LayerDrawable.setDrawableByLayerId()
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/avatar">
+ <shape/>
+ </item>
+ <item android:drawable="@drawable/status_icon" />
+</layer-list>
Binary file app/src/main/res/drawable/beem_launcher_icon_silver.png has changed
Binary file app/src/main/res/drawable/beem_status_icon.png has changed
Binary file app/src/main/res/drawable/beem_status_icon_available.png has changed
Binary file app/src/main/res/drawable/beem_status_icon_away.png has changed
Binary file app/src/main/res/drawable/beem_status_icon_busy.png has changed
Binary file app/src/main/res/drawable/beem_status_icon_gray.png has changed
Binary file app/src/main/res/drawable/bottombar.png has changed
Binary file app/src/main/res/drawable/button_indicator_next.png has changed
Binary file app/src/main/res/drawable/button_indicator_prev.png has changed
Binary file app/src/main/res/drawable/ic_menu_add.png has changed
Binary file app/src/main/res/drawable/ic_menu_blocked_user.png has changed
Binary file app/src/main/res/drawable/ic_menu_chat_dashboard.png has changed
Binary file app/src/main/res/drawable/ic_menu_close_clear_cancel.png has changed
Binary file app/src/main/res/drawable/ic_menu_end_conversation.png has changed
Binary file app/src/main/res/drawable/ic_menu_friendslist.png has changed
Binary file app/src/main/res/drawable/ic_menu_invite.png has changed
Binary file app/src/main/res/drawable/ic_menu_login.png has changed
Binary file app/src/main/res/drawable/ic_menu_manage.png has changed
Binary file app/src/main/res/drawable/icon.png has changed
Binary file app/src/main/res/drawable/logo.png has changed
Binary file app/src/main/res/drawable/logo_encryption.png has changed
Binary file app/src/main/res/drawable/not_in_the_roster.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/drawable/scrollbar_vertical_thumb.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient android:startColor="#3333FF" android:endColor="#8080FF"
+ android:angle="0"/>
+ <corners android:radius="6dp" />
+</shape>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/drawable/scrollbar_vertical_track.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <gradient android:startColor="#505050" android:endColor="#C0C0C0"
+ android:angle="0"/>
+ <corners android:radius="0dp" />
+</shape>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/drawable/shape_border_green.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <stroke android:width="4dp" android:color="#D6F94C" />
+ <padding android:left="7dp" android:top="7dp"
+ android:right="7dp" android:bottom="7dp" />
+ <corners android:radius="4dp" />
+</shape>
Binary file app/src/main/res/drawable/status_available.png has changed
Binary file app/src/main/res/drawable/status_away.png has changed
Binary file app/src/main/res/drawable/status_blocked.png has changed
Binary file app/src/main/res/drawable/status_dnd.png has changed
Binary file app/src/main/res/drawable/status_error.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/drawable/status_icon.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Level list drawable for status icon
+ See src/com/beem/project/beem/utils/Status.java
+ for level values
+-->
+<level-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:maxLevel="100" android:drawable="@android:drawable/presence_offline" />
+ <item android:maxLevel="200" android:drawable="@drawable/status_requested" />
+ <item android:maxLevel="300" android:drawable="@android:drawable/presence_away" />
+ <item android:maxLevel="400" android:drawable="@android:drawable/presence_busy" />
+ <item android:maxLevel="600" android:drawable="@android:drawable/presence_online" />
+ </level-list>
Binary file app/src/main/res/drawable/status_idle.png has changed
Binary file app/src/main/res/drawable/status_invisible.png has changed
Binary file app/src/main/res/drawable/status_new_message.png has changed
Binary file app/src/main/res/drawable/status_offline.png has changed
Binary file app/src/main/res/drawable/status_requested.png has changed
Binary file app/src/main/res/drawable/status_typing.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout-v11/create_account.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,95 @@
+<?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="fill_parent"
+ android:orientation="vertical" >
+
+ <ScrollView android:layout_width="fill_parent" android:layout_height="0dip"
+ android:layout_weight="1" >
+ <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:orientation="vertical" >
+ <ImageView android:id="@+id/logo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_marginTop="15dp"
+ android:layout_marginBottom="30dp"
+ android:src="@drawable/logo"/>
+
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/create_account_text"
+ android:textSize="18sp"
+ android:paddingBottom="10dip"
+ android:focusable="true" />
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/create_account_username" style="@style/Label" />
+ <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <EditText android:id="@+id/create_account_username"
+ android:inputType="textEmailAddress" android:imeOptions="actionNext"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:minWidth="120dp"
+ android:hint="beem"
+ android:contentDescription="@string/create_account_username"/>
+ <TextView
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text=" @ " style="@style/Label" />
+ <AutoCompleteTextView android:id="@+id/xmpp_server"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:minWidth="160dp"
+ android:gravity="left"
+ android:hint="beem-project.com"
+ android:completionThreshold="1"
+ android:inputType="textNoSuggestions"
+ style="?android:attr/dropDownSpinnerStyle"/>
+ </LinearLayout>
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/create_account_password" style="@style/Label" />
+ <EditText android:id="@+id/create_account_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:inputType="textPassword" android:imeOptions="actionNext"
+ android:singleLine="true"
+ android:contentDescription="@string/create_account_password"/>
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/create_account_confirm_password" style="@style/Label" />
+ <EditText android:id="@+id/create_account_confirm_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:inputType="textPassword" android:imeOptions="actionNext"
+ android:singleLine="true"
+ android:contentDescription="@string/create_account_confirm_password"/>
+ <TextView android:id="@+id/settings_warn_label" style="@style/Label"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_settings_warn"
+ android:inputType="textMultiLine|textNoSuggestions"
+ android:textColor="@color/white"
+ android:textStyle="normal"
+ android:visibility="gone" />
+ <TextView android:id="@+id/error_label"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:textColor="@color/red" android:textStyle="bold"
+ android:inputType="textMultiLine"
+ style="@style/Label"/>
+ </LinearLayout>
+ </ScrollView>
+
+ <RelativeLayout
+ android:gravity="right|center_vertical"
+ android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:background="@drawable/bottombar" >
+ <Button
+ android:id="@+id/next"
+ android:text="@string/Continue"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:drawableRight="@drawable/button_indicator_next"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:enabled="false"
+ />
+ </RelativeLayout>
+
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout-v11/simple_combobox_item.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text1"
+ style="?android:attr/dropDownItemStyle"
+ android:textAppearance="?android:attr/textAppearanceSmallPopupMenu"
+ android:singleLine="true"
+ android:layout_width="match_parent"
+ android:layout_height="36dip"
+ android:ellipsize="marquee" />
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/addcontact.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent" android:layout_height="fill_parent"
+ android:orientation="vertical">
+ <LinearLayout android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:orientation="vertical"
+ android:padding="10dip">
+ <TextView android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="@string/AddCLogin"
+ style="@style/Label" />
+ <EditText android:id="@+id/addc_login" android:inputType="textEmailAddress"
+ android:imeOptions="actionNext" android:scrollHorizontally="true"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_margin="3dip"
+ android:contentDescription="@string/AddCLogin"/>
+ <TextView android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="@string/AddCAlias"
+ style="@style/Label" />
+ <EditText android:id="@+id/addc_alias" android:inputType="text"
+ android:imeOptions="actionNext"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:scrollHorizontally="true" android:layout_margin="3dip"
+ android:contentDescription="@string/AddCAlias"/>
+ <TextView android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="@string/AddCGroup"
+ style="@style/Label" />
+ <EditText android:id="@+id/addc_group" android:inputType="text"
+ android:layout_width="fill_parent"
+ android:scrollHorizontally="true" android:layout_height="wrap_content"
+ android:layout_margin="3dip"
+ android:contentDescription="@string/AddCGroup"/>
+ <View android:layout_width="fill_parent" android:layout_height="0dp"
+ android:layout_weight="1" android:layout_marginBottom="18dp" />
+ <Button android:id="@+id/addc_ok" android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/AddCOkButton" android:layout_gravity="bottom" />
+ </LinearLayout>
+</ScrollView>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/changestatus.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <RelativeLayout android:orientation="vertical"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:padding="10dip">
+ <LinearLayout android:id="@+id/avatar_panel"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:layout_alignParentTop="true"
+ android:layout_width="fill_parent" android:layout_height="fill_parent" >
+ <TextView android:text="@string/my_avatar" style="@style/Label"
+ android:layout_width="wrap_content" android:layout_height="wrap_content" />
+
+ <ImageButton android:id="@+id/avatarButton"
+ android:layout_width="120dip" android:layout_height="120dip"
+ android:scaleType="fitCenter" />
+ </LinearLayout>
+ <TextView android:id="@+id/ChangeStatusTypeLabel"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/avatar_panel"
+ android:text="@string/ChangeStatusType" style="@style/Label" />
+ <Spinner android:id="@+id/ChangeStatusSpinner"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:drawSelectorOnTop="true" android:layout_below="@id/ChangeStatusTypeLabel"
+ android:contentDescription="@string/ChangeStatusType"/>
+ <TextView android:id="@+id/ChangeStatusMessageLabel"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/ChangeStatusSpinner"
+ style="@style/Label"
+ android:selectAllOnFocus="true"
+ android:focusable="true"
+ android:text="@string/ChangeStatusMessage"
+ />
+ <EditText android:id="@+id/ChangeStatusMessage"
+ android:inputType="textShortMessage|textAutoCorrect"
+ android:imeOptions="actionDone" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:layout_below="@id/ChangeStatusMessageLabel"
+ android:layout_marginBottom="18dp" />
+ <LinearLayout android:id="@+id/ChangeStatusButtons"
+ android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:layout_below="@id/ChangeStatusMessage"
+ android:orientation="horizontal">
+ <Button android:id="@+id/ChangeStatusOk"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/UpdateButton" />
+ <Button android:id="@+id/ChangeStatusClear"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/ClearButton" />
+ </LinearLayout>
+ <Button android:id="@+id/OpenContactList" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="@string/OpenContactList"
+ android:layout_below="@+id/ChangeStatusButtons" />
+ </RelativeLayout>
+</ScrollView>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/chat.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,61 @@
+<?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="fill_parent"
+ android:orientation="vertical">
+ <LinearLayout android:id="@+id/chat_header"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:orientation="horizontal" android:gravity="center_vertical"
+ android:background="#222222"
+ android:padding="4dp">
+ <ImageView android:id="@+id/chat_contact_status_icon"
+ android:src="@drawable/avatar_status"
+ android:layout_width="48dip"
+ android:layout_height="48dip"
+ />
+ <LinearLayout android:orientation="vertical"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:paddingLeft="15sp">
+ <TextView android:id="@+id/chat_contact_name"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:lines="1" android:singleLine="true"
+ android:textStyle="bold" android:textColor="@android:color/white"
+ android:focusable="true"/>
+ <TextView android:id="@+id/chat_contact_status_msg"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:autoLink="all" android:textSize="12sp" android:textColor="@android:color/white"
+ android:textColorLink="#FFFFFF"
+ android:focusable="true"/>
+ <TextView android:id="@+id/chat_contact_chat_state"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:textStyle="italic" android:textSize="12sp"
+ android:focusable="true"/>
+ <TextView android:id="@+id/chat_contact_otr_state"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:textStyle="italic" android:textSize="12sp"
+ android:focusable="true"/>
+ </LinearLayout>
+ </LinearLayout>
+ <View android:layout_width="fill_parent" android:layout_height="2dp"
+ android:fadingEdge="horizontal" android:background="#555555" />
+ <ListView android:id="@+id/chat_messages"
+ android:layout_width="fill_parent" android:layout_height="0dip"
+ android:layout_weight="1" android:transcriptMode="normal"
+ android:stackFromBottom="true"
+ android:fadingEdge="none" android:padding="4dp"
+ android:fastScrollEnabled="true" android:smoothScrollbar="false"
+ android:focusable="true"/>
+ <LinearLayout android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:padding="4dp">
+ <EditText android:id="@+id/chat_input" android:layout_width="0dip"
+ android:layout_height="fill_parent" android:layout_weight="1"
+ android:maxLines="5"
+ android:inputType="textShortMessage|textAutoCorrect|textMultiLine|textCapSentences"
+ android:imeOptions="actionSend|flagNoExtractUi" android:cursorVisible="true"
+ android:hint="@string/chat_input_default_value" />
+ <Button android:id="@+id/chat_send_message"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@string/chat_send_message" />
+ </LinearLayout>
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/chat_compact.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,27 @@
+<?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="fill_parent"
+ android:orientation="vertical">
+ <View android:layout_width="fill_parent" android:layout_height="2dp"
+ android:fadingEdge="horizontal" android:background="#222222" />
+ <ListView android:id="@+id/chat_messages"
+ android:layout_width="fill_parent" android:layout_height="0dip"
+ android:layout_weight="1" android:transcriptMode="normal"
+ android:stackFromBottom="true"
+ android:fadingEdge="none" android:padding="4px"
+ android:fastScrollEnabled="true" android:smoothScrollbar="false"
+ android:focusable="true"/>
+ <LinearLayout android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:orientation="horizontal"
+ android:background="#222222" android:padding="8px">
+ <EditText android:id="@+id/chat_input" android:layout_width="0dip"
+ android:layout_height="fill_parent" android:layout_weight="1"
+ android:maxLines="5"
+ android:inputType="textShortMessage|textAutoCorrect|textMultiLine|textCapSentences"
+ android:imeOptions="actionSend|flagNoExtractUi" android:cursorVisible="true"
+ android:hint="@string/chat_input_default_value" />
+ <Button android:id="@+id/chat_send_message"
+ android:layout_width="wrap_content" android:layout_height="fill_parent"
+ android:text="@string/chat_send_message" />
+ </LinearLayout>
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/chat_msg_row.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+
+ <TextView android:id="@+id/chatmessagename"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
+ android:textColor="@android:color/white" android:textStyle="bold"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:paddingBottom="1dp" />
+ <TextView android:id="@+id/chatmessagedate"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:layout_alignParentTop="true" android:layout_alignParentRight="true"
+ android:autoLink="none" />
+ <TextView android:id="@+id/chatmessagetext"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true" android:layout_below="@id/chatmessagename"
+ android:autoLink="all" />
+</RelativeLayout>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/contactdialogaliasdialog.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,16 @@
+<?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:id="@+id/CDAliasDialogLabel"
+ android:layout_height="wrap_content" android:layout_width="wrap_content"
+ android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
+ android:text="@string/userinfo_label_alias"
+ android:gravity="left" style="@style/Label" />
+ <EditText android:id="@+id/CDAliasDialogName"
+ android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
+ android:scrollHorizontally="true" android:autoText="false"
+ android:capitalize="none" android:gravity="fill_horizontal"
+ android:contentDescription="@string/userinfo_label_alias"/>
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/contactlist.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,18 @@
+<?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="fill_parent"
+ android:orientation="vertical">
+
+ <android.support.v4.view.ViewPager android:id="@+id/pager"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <android.support.v4.view.PagerTabStrip android:id="@+id/tabstrip"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="@style/TitleStripTextAppearance"
+ />
+
+ </android.support.v4.view.ViewPager>
+
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/contactlistcontact.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:paddingLeft="10dp"
+ android:paddingRight="10dp" android:paddingTop="8dp"
+ android:paddingBottom="8dip" >
+ <ImageView android:id="@+id/avatar"
+ android:layout_width="48dip" android:layout_height="48dip"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ />
+ <TextView android:id="@+id/contactlistpseudo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_toRightOf="@id/avatar"
+ android:singleLine="true"
+ android:maxLines="1"
+ android:paddingLeft="10dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textStyle="bold" />
+
+ <TextView android:id="@+id/contactlistmsgperso"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_below="@id/contactlistpseudo"
+ android:layout_toRightOf="@id/avatar"
+ android:paddingLeft="10dp" android:singleLine="true"
+ android:maxLines="1" android:linksClickable="false" android:autoLink="all"
+ android:scrollHorizontally="true" android:textColorLink="@color/white"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ />
+</RelativeLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/create_account.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,95 @@
+<?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="fill_parent"
+ android:orientation="vertical" >
+
+ <ScrollView android:layout_width="fill_parent" android:layout_height="0dip"
+ android:layout_weight="1" >
+ <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:orientation="vertical" >
+ <ImageView android:id="@+id/logo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_marginTop="15dp"
+ android:layout_marginBottom="30dp"
+ android:src="@drawable/logo"/>
+
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/create_account_text"
+ android:textSize="18sp"
+ android:paddingBottom="10dip"
+ android:focusable="true" />
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/create_account_username" style="@style/Label" />
+ <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <EditText android:id="@+id/create_account_username"
+ android:inputType="textEmailAddress" android:imeOptions="actionNext"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:minWidth="120dp"
+ android:hint="beem"
+ android:contentDescription="@string/create_account_username"/>
+ <TextView
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text=" @ " style="@style/Label" />
+ <AutoCompleteTextView android:id="@+id/xmpp_server"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:minWidth="160dp"
+ android:gravity="left"
+ android:hint="beem-project.com"
+ android:completionThreshold="1"
+ android:inputType="textNoSuggestions"
+ />
+ </LinearLayout>
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/create_account_password" style="@style/Label" />
+ <EditText android:id="@+id/create_account_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:inputType="textPassword" android:imeOptions="actionNext"
+ android:singleLine="true"
+ android:contentDescription="@string/create_account_password"/>
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/create_account_confirm_password" style="@style/Label" />
+ <EditText android:id="@+id/create_account_confirm_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:inputType="textPassword" android:imeOptions="actionNext"
+ android:singleLine="true"
+ android:contentDescription="@string/create_account_confirm_password"/>
+ <TextView android:id="@+id/settings_warn_label" style="@style/Label"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_settings_warn"
+ android:inputType="textMultiLine|textNoSuggestions"
+ android:textColor="@color/white"
+ android:textStyle="normal"
+ android:visibility="gone" />
+ <TextView android:id="@+id/error_label"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:textColor="@color/red" android:textStyle="bold"
+ android:inputType="textMultiLine"
+ style="@style/Label"/>
+ </LinearLayout>
+ </ScrollView>
+
+ <RelativeLayout
+ android:gravity="right|center_vertical"
+ android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:background="@drawable/bottombar" >
+ <Button
+ android:id="@+id/next"
+ android:text="@string/Continue"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:drawableRight="@drawable/button_indicator_next"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:enabled="false"
+ />
+ </RelativeLayout>
+
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/group_list.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,16 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:layout_width="fill_parent"
+ android:layout_height="fill_parent" android:paddingLeft="8dip"
+ android:paddingRight="8dip">
+
+ <ListView android:id="@android:id/list" android:layout_width="fill_parent"
+ android:layout_height="0dip" android:layout_weight="1"
+ android:stackFromBottom="true" android:transcriptMode="normal"
+ android:focusable="true"/>
+
+ <EditText android:id="@+id/GroupListText"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:maxLength="20"
+ android:singleLine="true" />
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/jingle_call_activity.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,25 @@
+<?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:text="Jid:" android:id="@+id/jingledemocalljidlabel"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+ <EditText android:id="@+id/jingledemocalljid"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
+ <TextView android:text="Password:" android:id="@+id/jingledemocallpasswordlabel"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+ <EditText android:id="@+id/jingledemocallpassword"
+ android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textPassword" ></EditText>
+
+ <Button android:text="Connexion" android:id="@+id/jingledemocallconnectbutton"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
+ <TextView android:text="Call who :" android:id="@+id/jingledemocallreceiverlabel"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+
+<EditText android:text="" android:id="@+id/jingledemocallreceiver" android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
+
+<Button android:text="Call" android:id="@+id/jingledemocallbutton" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -->
+<ImageView android:id="@+id/log_as_logo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_marginBottom="25px" android:layout_marginTop="42px" />
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/login.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent" android:layout_height="fill_parent" >
+ <LinearLayout android:orientation="vertical"
+ android:layout_width="fill_parent" android:layout_height="wrap_content">
+ <ImageView android:id="@+id/log_as_logo" android:src="@drawable/logo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_marginBottom="25px" android:layout_marginTop="42px" />
+ <TextView android:id="@+id/log_as_msg" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:gravity="center"
+ android:textColor="#FF0000" android:textStyle="bold"
+ android:textSize="14sp" />
+ </LinearLayout>
+</ScrollView>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/login_anim.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:layout_width="fill_parent"
+ android:orientation="vertical">
+ <ImageView android:id="@+id/loginanim_logo_anim" android:src="@drawable/beem_icon_launcher_color"
+ android:layout_height="wrap_content" android:layout_width="wrap_content"
+ android:layout_gravity="center_vertical|center_horizontal|center"
+ android:layout_weight="1" />
+ <TextView android:id="@+id/loginanim_status_text"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:textSize="20sp" android:gravity="center" android:textColor="@color/vert_manu"/>
+ <Button android:id="@+id/loginanim_cancel_button"
+ android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:layout_gravity="bottom" android:text="@string/CancelButton" />
+</LinearLayout>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/privacy_list.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,12 @@
+<?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" android:padding="8dp">
+ <ListView android:id="@id/android:list" android:layout_width="fill_parent"
+ android:layout_height="fill_parent" android:layout_weight="1"
+ android:drawSelectorOnTop="false"
+ android:focusable="true"/>
+ <TextView android:id="@id/android:empty" android:layout_width="fill_parent"
+ android:layout_height="fill_parent" android:text="@string/privacy_list_no_data"
+ android:focusable="true"/>
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/privacy_list_create_dialog.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,15 @@
+<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/privacy_list_create_dialog_list_name_label"
+ android:layout_height="wrap_content" android:layout_width="wrap_content"
+ android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
+ android:text="@string/privacy_list_create_dialog_list_name_label" android:gravity="left"
+ style="@style/Label" />
+ <EditText android:id="@+id/privacy_list_create_dialog_list_name"
+ android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
+ android:scrollHorizontally="true" android:autoText="false"
+ android:capitalize="none" android:gravity="fill_horizontal"
+ android:contentDescription="@string/privacy_list_create_dialog_list_name_label"/>
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/simple_combobox_item.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text1"
+ style="?android:attr/dropDownItemStyle"
+ android:singleLine="true"
+ android:layout_width="match_parent"
+ android:layout_height="36dip"
+ android:ellipsize="marquee" />
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/subscription.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent" android:layout_height="fill_parent"
+ android:orientation="vertical">
+ <LinearLayout android:orientation="vertical"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:padding="10dip">
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:autoLink="none"
+ android:id="@+id/SubscriptionTitle" android:text="@string/SubscriptTitle"
+ android:textStyle="bold" android:textColor="@color/white"
+ android:textSize="18sp" android:layout_marginBottom="10dip" />
+
+ <TextView android:layout_width="wrap_content"
+ android:layout_height="fill_parent" android:autoLink="none"
+ android:id="@+id/SubscriptionText" android:text="@string/SubscriptText"
+ android:textColor="@color/white" android:textSize="14sp"
+ android:layout_weight="1" android:layout_marginBottom="18dp"
+ android:focusable="true"/>
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="fill_parent" android:layout_height="wrap_content">
+
+ <Button android:id="@+id/SubscriptionAccept"
+ android:layout_width="fill_parent" android:layout_height="fill_parent"
+ android:layout_weight="1" android:text="@string/AcceptButton" />
+
+ <Button android:id="@+id/SubscriptionRefuse"
+ android:layout_width="fill_parent" android:layout_height="fill_parent"
+ android:layout_weight="1" android:text="@string/RefuseButton" />
+ </LinearLayout>
+ </LinearLayout>
+</ScrollView>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/wizard_account_configure.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:layout_width="fill_parent"
+ android:orientation="vertical" >
+ <ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent"
+ android:layout_weight="1">
+ <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:orientation="vertical" >
+ <ImageView android:id="@+id/logo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_marginTop="15dp"
+ android:layout_marginBottom="30dp"
+ android:src="@drawable/logo"/>
+ <LinearLayout android:id="@+id/account_layout"
+ android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:orientation="vertical" >
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_configure_text_1"
+ android:textSize="18sp"
+ android:paddingBottom="10dip" />
+ <Button
+ android:id="@+id/select_account_btn"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:text="@string/account_wizard_select_account_btn"
+ android:minWidth="100dp"
+ />
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/account_wizard_configure_text_2"
+ android:textSize="18sp"
+ android:paddingBottom="10dip" />
+ </LinearLayout>
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_configure_text_3"
+ android:textSize="18sp"
+ android:paddingBottom="10dip" />
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/JabberID" style="@style/Label" />
+ <EditText android:id="@+id/account_username"
+ android:inputType="textEmailAddress" android:imeOptions="actionNext"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:hint="beem@beem-project.com "
+ android:contentDescription="@string/JabberID"/>
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/Password" style="@style/Label" />
+ <EditText android:id="@+id/account_password"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:inputType="textPassword" android:imeOptions="actionNext"
+ android:password="true" android:singleLine="true"
+ android:contentDescription="@string/Password"/>
+ <TextView android:id="@+id/settings_warn_label" style="@style/Label"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_settings_warn"
+ android:inputType="textMultiLine|textNoSuggestions"
+ android:textColor="@color/white"
+ android:textStyle="normal"
+ android:visibility="gone" />
+ <TextView android:id="@+id/error_label" style="@style/Label"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_connection_failed"
+ android:inputType="textMultiLine|textNoSuggestions"
+ android:textColor="@color/red"
+ android:visibility="invisible" />
+ </LinearLayout>
+ </ScrollView>
+
+ <RelativeLayout
+ android:gravity="right"
+ android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:background="@drawable/bottombar" >
+
+ <Button
+ android:id="@+id/manual_setup"
+ android:text="@string/AccountConfigureManualConfiguration"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ />
+
+ <Button
+ android:id="@+id/next"
+ android:text="@string/Continue"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:drawableRight="@drawable/button_indicator_next"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:enabled="false"
+ />
+ </RelativeLayout>
+
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/layout/wizard_account_main_fragment.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:layout_width="fill_parent"
+ android:orientation="vertical"
+ >
+ <ScrollView android:layout_height="0dip" android:layout_width="fill_parent"
+ android:layout_weight="1">
+ <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
+ android:orientation="vertical" >
+ <ImageView android:id="@+id/logo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:layout_marginTop="15dp"
+ android:layout_marginBottom="30dp"
+ android:src="@drawable/logo"/>
+ <TextView
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_text1"
+ android:textSize="18sp"
+ android:paddingBottom="10dip"
+ android:focusable="true" />
+ <RadioGroup android:id="@+id/configure_group"
+ android:layout_width="fill_parent" android:layout_height="wrap_content" >
+ <RadioButton android:id="@+id/configure_account"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_configure_account"/>
+ <RadioButton android:id="@+id/create_account"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:text="@string/account_wizard_create_account"/>
+ </RadioGroup>
+ </LinearLayout>
+ </ScrollView>
+
+ <RelativeLayout
+ android:gravity="right|center_vertical"
+ android:layout_height="wrap_content"
+ android:layout_width="fill_parent"
+ android:background="@drawable/bottombar" >
+ <Button
+ android:id="@+id/next"
+ android:text="@string/Continue"
+ android:minWidth="100dp"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:drawableRight="@drawable/button_indicator_next"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:enabled="false"
+ />
+ </RelativeLayout>
+
+</LinearLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/menu/chat.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,21 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <group>
+ <item android:id="@+id/chat_menu_contacts_list" android:visible="true"
+ android:title="@string/chat_menu_contacts_list" android:icon="@drawable/ic_menu_friendslist" />
+ <item android:id="@+id/chat_menu_change_chat" android:visible="true"
+ android:title="@string/chat_menu_change_chat" android:icon="@drawable/ic_menu_chat_dashboard" />
+ </group>
+ <item android:id="@+id/chat_menu_close_chat" android:visible="true"
+ android:title="@string/chat_menu_close_chat" android:icon="@drawable/ic_menu_end_conversation" />
+ <item android:id="@+id/chat_menu_otr_submenu" android:visible="true"
+ android:title="@string/chat_menu_otr_submenu" android:icon="@drawable/logo_encryption">
+ <menu>
+ <item android:id="@+id/chat_menu_start_otr_session"
+ android:visible="true" android:title="@string/chat_menu_start_otr_session" />
+ <item android:id="@+id/chat_menu_stop_otr_session"
+ android:visible="true" android:title="@string/chat_menu_stop_otr_session" />
+ <item android:id="@+id/chat_menu_otr_verify_key" android:visible="true"
+ android:title="@string/chat_menu_otr_verify_key" />
+ </menu>
+ </item>
+</menu>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/menu/contact_list.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,20 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/contact_list_menu_add_contact"
+ android:visible="true"
+ android:title="@string/contact_list_menu_add_contact"
+ android:icon="@drawable/ic_menu_add" />
+ <item android:id="@+id/menu_change_status"
+ android:visible="true"
+ android:title="@string/contact_list_menu_status"/>
+ <item android:id="@+id/contact_list_menu_chatlist"
+ android:visible="true" android:icon="@drawable/ic_menu_chat_dashboard"
+ android:title="@string/chat_menu_change_chat"/>
+ <item android:id="@+id/contact_list_menu_settings"
+ android:visible="true"
+ android:title="@string/contact_list_menu_settings"
+ android:icon="@drawable/ic_menu_manage" />
+ <item android:id="@+id/menu_disconnect"
+ android:visible="true"
+ android:title="@string/contact_list_menu_disconnect"
+ android:icon="@drawable/ic_menu_close_clear_cancel" />
+</menu>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/menu/contactlist_context.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,24 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/contact_list_context_menu_chat_item"
+ android:title="@string/CDChat">
+ <menu>
+ </menu>
+ </item>
+ <item android:id="@+id/contact_list_context_menu_call_item"
+ android:title="@string/CDCall" android:visible="false" />
+ <item android:id="@+id/contact_list_context_menu_user_info"
+ android:title="@string/CDInfos">
+ <menu>
+ <item android:id="@+id/contact_list_context_menu_userinfo_alias"
+ android:title="@string/userinfo_label_alias" />
+ <item android:id="@+id/contact_list_context_menu_userinfo_group"
+ android:title="@string/userinfo_label_chg_group" />
+ <item android:id="@+id/contact_list_context_menu_userinfo_subscription"
+ android:title="@string/userinfo_label_re_subscription" />
+ <item android:id="@+id/contact_list_context_menu_userinfo_block"
+ android:title="@string/userinfo_label_block" android:visible="false" />
+ <item android:id="@+id/contact_list_context_menu_userinfo_delete"
+ android:title="@string/userinfo_label_delete" />
+ </menu>
+ </item>
+</menu>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/menu/edit_settings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,10 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/settings_menu_create_account"
+ android:visible="true"
+ android:icon="@drawable/ic_menu_invite"
+ android:title="@string/settings_menu_create_account" />
+ <item android:id="@+id/settings_menu_privacy_lists"
+ android:visible="false"
+ android:title="@string/settings_menu_privacy_lists"
+ android:icon="@drawable/ic_menu_blocked_user" />
+</menu>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/menu/login.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,14 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/login_menu_login"
+ android:visible="true"
+ android:title="@string/login_menu_login"
+ android:icon="@drawable/ic_menu_login" />
+ <item android:id="@+id/login_menu_settings"
+ android:visible="true"
+ android:title="@string/login_menu_settings"
+ android:icon="@android:drawable/ic_menu_manage" />
+ <item android:id="@+id/login_menu_about"
+ android:visible="true"
+ android:title="@string/login_menu_about"
+ android:icon="@android:drawable/ic_menu_help" />
+</menu>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/menu/privacy_list.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,4 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/privacy_list_menu_create" android:visible="true"
+ android:title="@string/privacy_list_menu_create" android:icon="@android:drawable/ic_menu_add" />
+</menu>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/menu/privacy_list_context.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,8 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/privacy_list_context_menu_buddies_item"
+ android:title="@string/privacy_list_select_dialog_buddies" />
+ <item android:id="@+id/privacy_list_context_menu_groups_item"
+ android:title="@string/privacy_list_select_dialog_groups" />
+ <item android:id="@+id/privacy_list_context_menu_delete_item"
+ android:title="@string/privacy_list_select_dialog_delete" />
+</menu>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-cs/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Generic terms -->
+ <string name="app_name">Beem</string>
+ <string name="OkButton">Ok</string>
+ <string name="ClearButton">Vymazat</string>
+ <string name="CancelButton">Zrušit</string>
+ <string name="AcceptButton">Autorizovat</string>
+ <string name="RefuseButton">Odmítnout</string>
+ <string name="JabberID">Jabber ID</string>
+ <string name="Password">Heslo</string>
+ <string name="Continue">Pokračovat</string>
+
+ <!-- AccountConfigure class -->
+ <string name="AccountConfigureManualConfiguration">Ruční konfigurace</string>
+
+ <!-- BeemService class -->
+ <string name="BeemServiceDescription">Use Beem Service</string>
+
+ <!-- ContactDialog class -->
+ <string name="CDChat">Chat</string>
+ <string name="CDCall">Volání</string>
+ <string name="CDInfos">Správa uživatele</string>
+
+ <!-- AddContact class -->
+ <string name="AddCActTitle">Beem - Přidání kontaktu</string>
+
+ <string name="AddCLogin">Jméno uživatele</string>
+ <string name="AddCAlias">Přezdívka</string>
+ <string name="AddCGroup">Skupina</string>
+ <string name="AddCOkButton">Přidat</string>
+ <string name="AddCContactAdded">Kontakt přidán</string>
+ <string name="AddCContactAddedError">Chyba kontakt nebyl přidán</string>
+ <string name="AddCContactAddedLoginError">Error Login</string>
+ <string name="AddCContactAlready">Kontakt již existuje</string>
+
+ <!-- ChangeStatus class -->
+ <string name="ChangeStatusActTitle">Beem - Změna statusu</string>
+ <string name="ChangeStatusType">Můj status</string>
+ <string name="OpenContactList">Otevřít seznam kontaktů</string>
+
+ <string name="ChangeStatusOk">Aktualizuji status</string>
+ <string name="my_avatar">Můj avatar</string>
+ <string name="select_avatar">Vybrat avatar</string>
+ <string name="take_photo">Vytvořit fotografii</string>
+ <string name="pick_photo">Vybrat obrázek</string>
+ <string name="delete_avatar">Žádný avatar</string>
+ <string name="photoPickerNotFoundText">Fotoaparát nebo kamera nenalezeny</string>
+
+
+ <!-- Settings class -->
+ <string name="SettingsProxy">Proxy</string>
+ <string name="SettingsProxyProxy">Použít proxy server</string>
+ <string name="SettingsProxySummary">Připojit se přes proxy server</string>
+ <string name="SettingsProxyType">Protokol</string>
+ <string name="SettingsProxyTypeSummary">Vybrat typ proxy serveru</string>
+ <string name="SettingsProxyServer">Upravit adresu proxy serveru</string>
+ <string name="SettingsProxyPort">Upravit port proxy serveru</string>
+ <string name="SettingsProxyUser">Volitelné, uživatelské jméno pro ověření na proxy serveru</string>
+ <string name="SettingsProxyPassword">Volitelné, heslo pro ověření na proxy serveru</string>
+ <string name="SettingsAdvanced">Rozšířené</string>
+ <string name="SettingsAdvancedOptions">Specifická nastavení serveru</string>
+ <string name="SettingsAdvancedRecoDelay">Upraví prodlevu mezi pokusy o připojení</string>
+ <string name="SettingsAdvancedSpecOpt">Zaškrtněte tuto volbu pokud chcete pro připojení použít specifický server</string>
+ <string name="SettingsAdvancedAddOpt">Upravit adresu serveru</string>
+ <string name="SettingsAdvancedPortOpt">Upravit port serveru</string>
+ <string name="SettingsResourceTitle">Zdroj</string>
+ <string name="SettingsPriorityTitle">Priorita</string>
+ <string name="SettingsResourceSummary">Nastavení názvu zdroje pro XMPP klienta</string>
+ <string name="SettingsPrioritySummary">Nastavení priority klienta</string>
+ <string name="contact_list_preferences">Seznam kontaktů</string>
+ <string name="contact_list_preferences_sum">Nastavení zobrazení pro váš seznam kontaktů
+ </string>
+ <string name="CLP_hide_groups">Skrýt skupiny</string>
+ <string name="CLP_hide_groups_sum">Aktuvujte tuto volbu pro skrytí skupin</string>
+ <string name="CLP_show_jid">Zobrazit JID</string>
+ <string name="CLP_show_jid_sum">Zaškrtněte tuto volbu pokud chcete vždy zobrazovat JID kontaktu</string>
+ <string name="CLP_hidden_contact">Skrýt odpojené</string>
+ <string name="CLP_hidden_contact_sum">Zaškrtněte pro skrytí odpojených kontaktů
+ </string>
+ <string name="settings_account_username">Název účtu (JID)</string>
+ <string name="settings_account_password">Heslo</string>
+ <string name="settings_account_server">Server</string>
+ <string name="settings_account_port">Port</string>
+ <string name="settings_advanced_service_behaviour">Chování služby</string>
+ <string name="settings_advanced_sum">Nastavení voleb pro pokročilé uživatele</string>
+ <string name="settings_xmpp_server">Adresa</string>
+ <string name="comments_xmpp_server">example.com</string>
+ <string name="settings_xmpp_port">Port</string>
+ <string name="settings_xmpp_use_tls">Vyžadovat SSL/TLS</string>
+ <string name="settings_reco_delay">Prodleva opakování pokusu o připojení</string>
+ <string name="comments_xmpp_port">Výchozí: 5222</string>
+ <string name="settings_proxy_sum">Nastavení proxy</string>
+ <string name="settings_proxy_use">Připojit prostřednictvím proxy</string>
+ <string name="settings_proxy_type_prompt">Vyberte typ proxy</string>
+ <string name="settings_proxy_server">Server</string>
+ <string name="settings_proxy_port">Port</string>
+ <string name="comments_proxy_port">Výchozí: 1080</string>
+ <string name="settings_proxy_username">Uživatel</string>
+ <string name="settings_proxy_password">Heslo</string>
+ <string name="away_chk_title">Povolit automatické \"Pryč\"</string>
+ <string name="away_chk_sum">Změní status na \"Pryč\" při zhasnutí obrazovky</string>
+ <string name="away_message_title">Zpráva pro stav \"Pryč\"</string>
+ <string name="away_message_sum">Zpráva která bude zobrazována při stavu \"Pryč\"</string>
+ <string name="away_message_hint">Jsem pryč, display mého telefonu je vypnutý</string>
+ <string name="notification_preferences">Nastavení oznamování</string>
+ <string name="notification_enable_vibrate_title">Povolit vybrace</string>
+ <string name="notification_enable_vibrate_sum">Povolit vibrace při přijetí zprávy</string>
+ <string name="notification_snd_title">Vyzvánění při přijetí zprávy</string>
+ <string name="notification_snd_sum">Nastaví zvuk přehraný při přijetí zprávy</string>
+ <string name="settings_chat_compact">Kompaktní chat</string>
+ <string name="settings_chat_compact_sum">Nastaví pro okno kontaktů kompaktní zobrazení</string>
+ <string name="history">Historie</string>
+ <string name="history_sum">Zaškrtněte pro ukládání konverzací na SD kartu</string>
+ <string name="chat_preferences">Chat</string>
+ <string name="chat_preferences_sum">Historie, rozložení, velikost ...</string>
+ <string name="chat_history_path">Cesta k historii</string>
+ <string name="chat_history_path_sum">Konverzace z chatu jsou ukládány na SD kartu</string>
+ <string name="settings_smack_debug">Enable XMPP debug</string>
+ <string name="settings_full_jid_login">Použít plné JID jako jméno uživatele</string>
+ <string name="settings_full_jid_login_sum">Vyžadováno některými serveru jako například Google Talk</string>
+
+ <!-- Subscription class -->
+ <string name="SubscriptAccept">Subscription accepted</string>
+ <string name="SubscriptError">Subscription error</string>
+ <string name="SubscriptRefused">Subscription refused</string>
+ <string name="SubscriptText">%s si tě chce přidat do seznamu kontaktů. Autorizovat tento kontakt?</string>
+ <string name="SubscriptTitle">Autorizovat kontakt?</string>
+
+ <!-- BeemBroadcastReceiver class -->
+ <string name="BeemBroadcastReceiverDisconnect">BEEM: Byl jste odpojen</string>
+
+ <!-- XmppConnectionAdapter class -->
+ <string name="AcceptContactRequest">%s si tě právě přidal do seznamu kontaktů..</string>
+ <string name="AcceptContactRequestFrom">Authorizuje %s pro komunikaci s vámi.</string>
+
+ <!-- Activities -->
+ <string name="edit_settings_name">Beem - Nastavení</string>
+ <string name="create_account_name">Beem - Vytvořit účet</string>
+ <string name="contact_list_name">Beem - Kontakty</string>
+ <string name="user_info_name">Beem - Informace o uživateli</string>
+
+ <!-- LogAs Activity -->
+ <string name="login_menu_settings">Nastavení</string>
+ <string name="login_menu_about">O programu</string>
+ <string name="login_about_title">Beem %s - o programu</string>
+ <string name="login_about_msg">
+ Beem je inovativní projekt od EPITECH. Navštivte nás na
+ http://www.beem-project.com !
+ </string>
+ <string name="login_about_button">Zavřít</string>
+ <string name="login_login_progress">Připojuji se. Prosím čekejte...</string>
+ <string name="login_menu_login">Přihlášení</string>
+ <string name="login_start_msg">Settings configuration in menu</string>
+
+ <!-- LoginAnim activity -->
+ <string name="loganim_connecting">Připojování ...</string>
+ <string name="loganim_authenticating">Ověřování ...</string>
+ <string name="loganim_login_success">Úspěšně přihlášen</string>
+ <string name="loganim_login_failed">Přihlášení se nezdařilo</string>
+
+ <!-- EditSettings Activity -->
+ <string name="settings_menu_create_account">Vytvořit účet</string>
+ <string name="settings_menu_privacy_lists">Manage my privacy lists</string>
+ <string name="settings_saved_ok">Nastavení bylo úspěšně uloženo.</string>
+
+
+
+ <!-- EditSettings Activity Categories -->
+ <string name="general_preferences">Základní nastavení</string>
+ <string name="user_preferences">Účet (vyžadováno)</string>
+ <string name="user_preferences_advanced">Rozšířená nastavení uživatele (volitelné)</string>
+ <string name="network_preferences">Nastavení sítě</string>
+ <string name="proxy_proxy_settings">Nastavení proxy</string>
+ <string name="proxy_user_settings">Nastavení proxy</string>
+ <string name="history_preferences">Historie</string>
+ <string name="chat_layout_option">Rozložení chatu</string>
+
+
+ <!-- EditSettings Activity Tabs -->
+ <string name="settings_tab_tag_account">edit_settings_tab_account</string>
+ <string name="settings_tab_label_account">Account</string>
+ <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+ <string name="settings_tab_label_xmpp">XMPP</string>
+ <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+ <string name="settings_tab_label_proxy">Proxy</string>
+
+
+ <!-- wizard activities -->
+ <string name="account_wizard_text1"><b>Vítejte v aplikaci BEEM.</b>\n\nJeště nemáte nastavený žádný XMPP (Jabber) účet.\nVyberte jednu z následujících možností:</string>
+ <string name="account_wizard_configure_text_1">Použít uložiště hesel a účtů na tomto zařízení</string>
+ <string name="account_wizard_configure_text_2"><b>nebo</b></string>
+ <string name="account_wizard_configure_text_3">Vyplňte údaje pro již existující účet</string>
+ <string name="account_wizard_settings_warn"><b>Varování: </b>Vaše nastavení používají proxy server nebo specifikují jméno serveru.</string>
+ <string name="account_wizard_connection_failed"><b>Nepodařilo se ověřit váš účet. Prosím ověřte správnost jména a hesla.</b></string>
+ <string name="account_wizard_select_account_btn">Vyberte účet</string>
+
+ <string name="account_wizard_configure_account">Již mám účet a chci jej použít pro připojení</string>
+ <string name="account_wizard_create_account">Chci si zaregistrovat nový účet</string>
+
+ <!-- Create an account Activity -->
+ <string name="create_account_text">Vyplňe položky nutné pro vytvoření vašeho nového účtu</string>
+ <string name="create_account_progress_title">Vytváření účtu</string>
+ <string name="create_account_progress_message">Prosím čekejte</string>
+ <string name="create_account_err_username">Neplatné JabberID</string>
+ <string name="create_account_err_passwords">Hesla se neshodují.</string>
+ <string name="create_account_username">Uživatelské jméno</string>
+ <string name="create_account_password">Heslo</string>
+ <string name="create_account_confirm_password">Heslo (znovu)</string>
+ <string name="create_account_err_conflict">Účet s tímto jménem již existuje. Prosím zkuste jiný</string>
+ <string name="create_account_err_connection">Vybraný server není dostupný. Prosím vyberte jiný</string>
+
+
+ <!-- ContactList Activity -->
+ <string name="contact_list_menu_add_contact">Přidat kontakt</string>
+ <string name="contact_list_menu_status">Změnit status</string>
+ <string name="contact_list_menu_settings">Nastavení</string>
+ <string name="contact_list_menu_disconnect">Odpojit</string>
+ <string name="contact_list_all_contact">Všechny kontakty</string>
+ <string name="contact_list_no_group">Nezařazené</string>
+
+ <!-- UserInfo dialog -->
+ <string name="userinfo_label_alias">Přezdívka</string>
+ <string name="userinfo_label_chg_group">Spravovat skupiny</string>
+ <string name="userinfo_label_re_subscription">Znovu poslat pozvání</string>
+ <string name="userinfo_label_block">Blokovat</string>
+ <string name="userinfo_label_delete">Smazat</string>
+ <string name="userinfo_resend">Suscription resend</string>
+ <string name="userinfo_sure2delete">Jste si jist že chcete smazat tento kontakt?
+ </string>
+ <string name="userinfo_yes">Ano</string>
+ <string name="userinfo_no">Ne</string>
+ <string name="userinfo_sureresend">Opravdu chcete znovu poslat pozvánku?</string>
+
+ <string name="chat_name">Beem - Chat</string>
+ <string name="chat_input_default_value">Pište zprávu</string>
+ <string name="chat_self">Já</string>
+ <string name="chat_error">Chyba</string>
+ <string name="chat_send_message">Odeslat</string>
+ <string name="chat_menu_contacts_list">Seznam kontaktů</string>
+ <string name="chat_menu_change_chat">Přepnout chat</string>
+ <string name="chat_menu_start_otr_session">Start OTR session</string>
+ <string name="chat_menu_stop_otr_session">Stop OTR session</string>
+ <string name="chat_menu_otr_verify_key">OTR ověření klíče</string>
+ <string name="chat_menu_otr_submenu">OTR actions</string>
+ <string name="chat_dialog_change_chat_title">Otevřené chaty</string>
+ <string name="chat_menu_close_chat">Zavřít tento chat</string>
+ <string name="chat_no_more_chats">Žádné další chaty</string>
+ <string name="chat_state_composing">píše zprávu</string>
+ <string name="chat_state_gone">ukončil konverzaci</string>
+ <string name="chat_state_active">čeká na vaši odpověď</string>
+ <string name="chat_state_inactive">dělá něco jiného</string>
+ <string name="chat_otrstate_plaintext">NEŠIFROVÁNO</string>
+ <string name="chat_otrstate_encrypted">ŠIFROVÁNO</string>
+ <string name="chat_otrstate_finished">DOKONČENO</string>
+ <string name="chat_otrstate_authenticated">OVĚŘENÉ</string>
+ <string name="chat_otr_verify_key" formatted="false">
+ Ověření kontakty vám umožňuje se ujistit že osoba s kterou komunikujete je opravdu ten za koho se vydává.\n\n
+ Pro ověření fingerprintu kontaktujte druhou stranu přes nějaký <i>jiný</i> bezpečný kanál, například telefon nebo email podepsaný pomocí GPG. Měli by jste si vzájemě vyměnit fingerprint.\n\n
+ Pokud se vše shoduje, měli by jste v dialogu výše potvrdit že jste <b>ověřili</b> fingerprint.\n\n
+ Lokální fingerprint %s\n\nFingerprint vzdálené strany %s\n\nOvěřit fingerprint ?</string>
+
+ <string name="contact_status_msg_available">Dostupný</string>
+ <string name="contact_status_msg_available_chat">Dostupný a rozkecaný</string>
+ <string name="contact_status_msg_dnd">Nevyrušovat</string>
+ <string name="contact_status_msg_away">Pryč</string>
+ <string name="contact_status_msg_xa">Nedostupný</string>
+ <string name="contact_status_msg_offline">Odpojený</string>
+
+ <string name="privacy_list_name">Beem - Manage my privacy lists</string>
+ <string name="privacy_list_no_data">There aren\'t any privacy list registered.</string>
+ <string name="privacy_list_menu_create">Create a privacy list</string>
+ <string name="privacy_list_create_dialog_title">Create a privacy list</string>
+ <string name="privacy_list_create_dialog_list_name_label">Title</string>
+ <string name="privacy_list_create_dialog_create_button">Vytvořit</string>
+ <string name="privacy_list_select_dialog_buddies">Kontakty</string>
+ <string name="privacy_list_select_dialog_groups">Skupiny</string>
+ <string name="privacy_list_select_dialog_delete">Smazat</string>
+ <string name="privacy_list_delete_dialog_msg">Do you really want to delete the privacy list entitled \'%s\'?</string>
+ <string name="privacy_list_delete_dialog_yes">Ano</string>
+ <string name="privacy_list_delete_dialog_no">Ne</string>
+
+ <string name="UpdateButton">Aktualizovat</string>
+
+ <!-- MemorizingTrustManager library -->
+ <string name="mtm_accept_cert">Přijmout neznámý certifikát?</string>
+ <string name="mtm_decision_always">Vždy</string>
+ <string name="mtm_decision_once">Jednou</string>
+ <string name="mtm_decision_abort">Odmítnout</string>
+
+ <string name="mtm_notification">Ověření certifikátu</string>
+
+ <!-- Error messages -->
+
+ <string name="error_login_authentication">Chyba při ověřování, chybné jméno uživatele nebo heslo.</string>
+
+ <string name="interna_server_error">Chyba na straně serveru</string>
+ <string name="bad_request">bad-request</string>
+ <string name="forbidden">forbidden</string>
+ <string name="item_not_found">item-not-found</string>
+ <string name="conflict">conflict</string>
+ <string name="feature_not_implemented">feature-not-implemented</string>
+ <string name="gone">gone</string>
+ <string name="jid_malformed">jid-malformed</string>
+ <string name="no_acceptable">no-acceptable</string>
+ <string name="not_allowed">not-allowed</string>
+ <string name="not_authorized">not-authorized</string>
+ <string name="payment_required">payment-required</string>
+ <string name="recipient_unavailable">recipient-unavailable</string>
+ <string name="redirect">redirect</string>
+ <string name="registration_required">registration-required</string>
+ <string name="remote_server_not_found">Server nenalezen</string>
+ <string name="remote_server_timeout">Server neodpovídá</string>
+ <string name="remote_server_error">Chyba na straně serveru</string>
+ <string name="resource_constraint">resource-constraint</string>
+ <string name="service_unavailable">service-unavailable</string>
+ <string name="subscription_required">subscription-required</string>
+ <string name="undefined_condition">undefined-condition</string>
+ <string name="unexpected_condition">unexpected-condition</string>
+ <string name="request_timeout">request-timeout</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-de/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"Glücklich"</item>
+ <item msgid="1601611480575517120">"Traurig"</item>
+ <item msgid="1531181614218625881">"Zwinkern"</item>
+ <item msgid="3858808057949077894">"Frech"</item>
+ <item msgid="7835238297967185651">"Überrascht"</item>
+ <item msgid="1756223535005296033">"Kuss"</item>
+ <item msgid="1093906245140165107">"Schreien"</item>
+ <item msgid="888834839864150170">"Cool"</item>
+ <item msgid="6320683740534773967">"Dollarzeichen"</item>
+ <item msgid="6610111212478853990">"Fettnäpfchen"</item>
+ <item msgid="1706035208563940251">"Peinlich berührt"</item>
+ <item msgid="9079275787422313427">"Engel"</item>
+ <item msgid="4630490399784004880">"Unentschlossen"</item>
+ <item msgid="7002574538342357456">"Weinen"</item>
+ <item msgid="850324578089267455">"Versiegelte Lippen"</item>
+ <item msgid="6334637439528489607">"Fröhlich"</item>
+ <item msgid="7602915122893958066">"Verwirrt"</item>
+ <item msgid="3939233701582771068">"Verliebt"</item>
+ <item msgid="1414759480575851587">"Verärgert"</item>
+ <item msgid="8479809115158836070">"Grinsen"</item>
+ <item msgid="638612939305162424">"Pokergesicht"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-de/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+<!-- Generic terms -->
+<string name="app_name">Beem</string>
+<string name="OkButton">Ok</string>
+<string name="ClearButton">Löschen</string>
+<string name="CancelButton">Abbrechen</string>
+<string name="AcceptButton">Authorisieren</string>
+<string name="RefuseButton">Ablehnen</string>
+<string name="JabberID">Jabber ID</string>
+<string name="Password">Passwort</string>
+<string name="Continue">Fortfahren</string>
+
+<!-- AccountConfigure class -->
+<string name="AccountConfigureManualConfiguration">Manuelle Konfiguration</string>
+
+<!-- Beem class -->
+<string name="BeemJabberID">Jabber ID</string>
+
+<!-- BeemApplication class -->
+<string name="BeemApplicationConnect">Verbinden...</string>
+
+<!-- BeemService class -->
+<string name="BeemServiceDescription">Benutze Beem Service</string>
+<string name="BeemServiceCreated">Beem Service erstellt</string>
+<string name="BeemServiceDestroyed">Beem Service verworfen</string>
+
+<!-- ContactDialog class -->
+<string name="CDChat">Chatten</string>
+<string name="CDCall">Anrufen</string>
+<string name="CDInfos">Kontakt bearbeiten</string>
+
+<!-- AddContact class -->
+<string name="AddCActTitle">Beem - Kontakt hinzufügen</string>
+
+<string name="AddCLogin">Benutzername</string>
+<string name="AddCAlias">Alias</string>
+<string name="AddCGroup">Gruppe</string>
+<string name="AddCOkButton">Hinzufügen</string>
+<string name="AddCContactAdded">Kontakt hinzugefügt</string>
+<string name="AddCContactAddedError">Fehler, Benutzer nicht hinzugefügt</string>
+<string name="AddCContactAddedLoginError">Fehler bei der Anmeldung</string>
+<string name="AddCBadForm">Mangelhafte Form</string>
+<string name="AddCContactAlready">Kontakt existiert bereits</string>
+
+<!-- ChangeStatus class -->
+<string name="ChangeStatusActTitle">Beem - Meinen Status ändern</string>
+<string name="ChangeStatusType">Mein Status</string>
+<string name="ChangeStatusMessage">Meine persönliche Nachricht</string>
+<string name="OpenContactList">Kontaktliste öffnen</string>
+
+<string name="MenuAddContact">Kontakt hinzufügen</string>
+<string name="MenuAccountAbout">Beem Project</string>
+<string name="MenuAccountCreate">Konto erstellen</string>
+<string name="MenuConnection">Konto bearbeiten</string>
+<string name="ChangeStatusOk">Aktualisiere Status</string>
+<string name="ChangeStatusNoChange">Nichts zu ändern</string>
+<string name="my_avatar">Mein Avatar</string>
+<string name="select_avatar">Wähle Avatar</string>
+<string name="take_photo">Foto machen</string>
+<string name="pick_photo">Bild auswählen</string>
+<string name="delete_avatar">Kein Avatar</string>
+<string name="photoPickerNotFoundText">Fotoauswahl nicht gefunden</string>
+
+
+<!-- Settings class -->
+<string name="SettingsText">Benutzername bearbeiten</string>
+<string name="SettingsPassword">Passwort bearbeiten</string>
+<string name="SettingsProxy">Proxy</string>
+<string name="SettingsProxyProxy">Benutze einen Proxyserver</string>
+<string name="SettingsProxySummary">Anmeldung über einen Proxyserver</string>
+<string name="SettingsProxyType">Protokoll</string>
+<string name="SettingsProxyTypeSummary">Art des Proxyservers wählen</string>
+<string name="SettingsProxyServer">Adresse des Proxyservers bearbeiten</string>
+<string name="SettingsProxyPort">Port des Proxyservers bearbeiten</string>
+<string name="SettingsProxyUser">Optional, erlaubt das Authentifizieren mit dem Proxyserver</string>
+<string name="SettingsProxyPassword">Optional, erlaubt das Authentifizieren mit dem Proxyserver</string>
+<string name="SettingsAdvanced">Erweitert</string>
+<string name="SettingsAdvancedOptions">Spezifische Server Optionen</string>
+<string name="SettingsAdvancedRecoDelay">Bearbeite die Verzögerung bei der Wiederverbindung</string>
+<string name="SettingsAdvancedSpecOpt">Aktivieren, um einen spezifischen Server für die Verbindung zu benutzen</string>
+<string name="SettingsAdvancedAddOpt">Adresse des Servers bearbeiten</string>
+<string name="SettingsAdvancedPortOpt">Port des Servers bearbeiten</string>
+<string name="SettingsResourceTitle">Ressource</string>
+<string name="SettingsPriorityTitle">Priorität</string>
+<string name="SettingsResourceSummary">XMPP Ressource des Clients einstellen</string>
+<string name="SettingsPrioritySummary">Priorität des Clients einstellen</string>
+<string name="contact_list_preferences">Kontaktliste</string>
+<string name="contact_list_preferences_sum">A set of display options for your buddy list
+</string>
+<string name="CLP_hide_groups">Gruppen ausblenden</string>
+<string name="CLP_hide_groups_sum">Aktivieren, um Gruppen auszublenden</string>
+<string name="CLP_hidden_contact">Kontakte ausblenden</string>
+<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
+</string>
+<string name="settings_account_username">Benutzername (JID)</string>
+<string name="login_username_info_default">beem@beem-project.com</string>
+<string name="settings_account_password">Passwort</string>
+<string name="settings_account_server">Server</string>
+<string name="settings_account_port">Port</string>
+<string name="settings_advanced_service_behaviour">Verhalten des Dienstes</string>
+<string name="settings_advanced_sum">Erweiterte Einstellungen für fortgeschrittene Benutzer</string>
+<string name="settings_xmpp_server">Adresse</string>
+<string name="comments_xmpp_server">example.com</string>
+<string name="settings_xmpp_port">Port</string>
+<string name="settings_xmpp_use_tls">Verwende SSL/TLS</string>
+<string name="settings_reco_delay">Verzögerung bei der Wiederverbindung</string>
+<string name="comments_xmpp_port">Standard: 5222</string>
+<string name="settings_proxy_sum">Einstellungen für das Benutzen eines Proxyservers</string>
+<string name="settings_proxy_use">Benutze einen Proxyserver</string>
+<string name="settings_proxy_type_prompt">Art des Proxyservers wählen</string>
+<string name="settings_proxy_server">Server</string>
+<string name="settings_proxy_port">Port</string>
+<string name="comments_proxy_port">Standard: 1080</string>
+<string name="settings_proxy_username">Benutzername</string>
+<string name="settings_proxy_password">Passwort</string>
+<string name="away_chk_title">Aktiviere automatische Abwesenheit</string>
+<string name="away_chk_sum">Status auf Abwesend wenn Bildschirm aus</string>
+<string name="away_message_title">Abwesenheitsnachricht</string>
+<string name="away_message_sum">Angezeigte Abwesenheitsnachricht</string>
+<string name="away_message_hint">Ich bin abwesend, mein Telefonbildschirm ist aus</string>
+<string name="notification_preferences">Benachrichtigungseinstellungen</string>
+<string name="notification_enable_vibrate_title">Aktiviere Vibration</string>
+<string name="notification_enable_vibrate_sum">Aktiviere Vibration für eingehende Nachrichten</string>
+<string name="notification_snd_title">Nachrichtensignalton</string>
+<string name="notification_snd_sum">Lege den Signalton für eingehende Nachrichten fest</string>
+<string name="settings_chat_compact">Kompakter Chat</string>
+<string name="settings_chat_compact_sum">Benutze kompakte Chatfenster</string>
+<string name="history">Chronik</string>
+<string name="history_sum">Aktivieren, um Unterhaltungen auf die Speicherkarte zu speichern</string>
+<string name="history_mount">Die Speicherkarte muss eingehängt und beschreibbar sein, um die Chronik zu aktivieren</string>
+<string name="history_on_off">Aktiviere Nachrichtenchronik</string>
+<string name="chat_preferences">Chat</string>
+<string name="chat_preferences_sum">Chronik, Layout Größe ...</string>
+<string name="chat_history_path">Chronik Pfad</string>
+<string name="chat_history_path_sum">Unterhaltungen werden in einem Ordner auf der Speicherkarte gespeichert</string>
+<string name="settings_smack_debug">Aktiviere XMPP Debug Modus</string>
+<string name="settings_full_jid_login">Benutze meine vollständige JID als Benutzername</string>
+<string name="settings_full_jid_login_sum">Wird von einigen Servern, z.b. Google Talk, vorausgesetzt</string>
+
+<!-- Subscription class -->
+<string name="SubscriptAccept">Zustimmung angenommen</string>
+<string name="SubscriptError">Zustimmungsfehler</string>
+<string name="SubscriptRefused">Zustimmung abgelehnt</string>
+<string name="SubscriptText">%s will dich zu seiner/ihrer Kontaktliste hinzufügen. Willst du ihn/sie authorisieren?</string>
+<string name="SubscriptTitle">Kontakt authorisieren?</string>
+
+<!-- BeemChatManager -->
+<string name="BeemChatManagerNewMessage">Du hast eine neue Nachricht</string>
+
+<!-- BeemBroadcastReceiver class -->
+<string name="BeemBroadcastReceiverDisconnect">BEEM: Die Verbindung wurde getrennt</string>
+
+<!-- XmppConnectionAdapter class -->
+<string name="AcceptContactRequest">%s hat dich gerade zu seiner/ihrer Kontaktliste hinzugefügt.</string>
+<string name="AcceptContactRequestFrom">Authorisiere %s dich zu kontaktieren.</string>
+
+<!-- Activities -->
+<string name="login_tag">Beem - Anmeldung</string>
+<string name="edit_settings_name">Beem - Einstellungen</string>
+<string name="edit_settings_tag">Beem - Einstellungen bearbeiten</string>
+<string name="create_account_name">Beem - Konto erstellen</string>
+<string name="create_account_tag">Beem - Konto erstellen</string>
+<string name="contact_list_name">Beem - Kontakte</string>
+<string name="contact_list_tag">Beem - Kontaktliste</string>
+<string name="user_info_name">Beem - Benutzerinformation</string>
+
+<!-- Buttons -->
+<string name="button_create_account">Dieses Konto erstellen</string>
+<string name="button_create_login_account">Dieses Konto erstellen und benutzen</string>
+
+<!-- LogAs Activity -->
+<string name="login_username">Benutzername</string>
+<string name="login_password">Passwort</string>
+<string name="login_error_dialog_title">Anmeldung - Fehler</string>
+<string name="login_close_dialog_button">Schließen</string>
+<string name="login_menu_create_account">Konto erstellen</string>
+<string name="login_menu_settings">Einstellungen</string>
+<string name="login_menu_about">Über</string>
+<string name="login_about_title">Beem %s - Über</string>
+<string name="login_about_msg">
+Beem is an EPITECH Innovative Project. Visit us at
+http://www.beem-project.com !
+</string>
+<string name="login_about_button">Schließen</string>
+<string name="login_settings_button">Einstellungen</string>
+<string name="login_login_button">Anmelden</string>
+<string name="login_login_progress">Verbinden. Bitte warten...</string>
+<string name="login_error_msg">Unfortunately, an error occured.\n\nError
+detail:\n%s</string>
+<string name="login_menu_login">Anmelden</string>
+<string name="login_no_connectivity">Keine Internetverbindung gefunden</string>
+<string name="login_start_msg">Konfiguration der Einstellungen im Menü</string>
+
+<!-- LoginAnim activity -->
+<string name="loganim_connecting">Verbinden...</string>
+<string name="loganim_authenticating">Authentifizieren...</string>
+<string name="loganim_login_success">Erfolgreich angemeldet</string>
+<string name="loganim_login_failed">Anmeldung gescheitert</string>
+
+<!-- EditSettings Activity -->
+<string name="settings_menu_create_account">Konto erstellen</string>
+<string name="settings_menu_privacy_lists">Meine Privatsphärenliste verwalten</string>
+<string name="settings_saved_ok">Die Einstellungen wurden erfolgreich gespeichert.</string>
+
+
+
+<!-- EditSettings Activity Categories -->
+<string name="general_preferences">Allgemeine Einstellungen</string>
+<string name="user_preferences">Benutzereinstellungen (notwendig)</string>
+<string name="user_preferences_advanced">Zusätzliche Benutzereinstellungen (optional)</string>
+<string name="network_preferences">Netzwerk Einstellungen</string>
+<string name="proxy_proxy_settings">Proxy Einstellungen</string>
+<string name="proxy_user_settings">Proxy Einstellungen</string>
+<string name="history_preferences">Chronik</string>
+<string name="chat_layout_option">Chat Ansicht</string>
+
+
+<!-- EditSettings Activity Tabs -->
+<string name="settings_tab_tag_account">edit_settings_tab_account</string>
+<string name="settings_tab_label_account">Konto</string>
+<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+<string name="settings_tab_label_xmpp">XMPP</string>
+<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+<string name="settings_tab_label_proxy">Proxy</string>
+
+
+<!-- wizard activities -->
+<string name="account_wizard_text1"><b>Willkommen bei BEEM.</b>nnDu hast noch kein XMPP (Jabber) Konto konfiguriert. Wähle eine der folgenden Optionen:</string>
+<string name="account_wizard_configure_text"><b>Bitte trage die Zugangsdaten für dein vorhandenes Konto ein</b></string>
+<string name="account_wizard_configure_account">Ich habe bereits ein Konto, das ich benutzen will</string>
+<string name="account_wizard_create_account">Ich möchte ein neues Konto registrieren</string>
+
+<!-- Create an account Activity -->
+<string name="create_account_instr_dialog_title">Konto erstellen - Anweisungen</string>
+<string name="create_account_err_dialog_title">Konto erstellen - Fehler</string>
+<string name="create_account_err_dialog_settings_button">Einstellungen ändern</string>
+<string name="create_account_close_dialog_button">Schließen</string>
+<string name="create_account_successfull_after">Das Konto %s wurde erfolgreich erstellt</string>
+<string name="create_account_err_username">Mangelhafte Jabber ID</string>
+<string name="create_account_err_passwords">Passwörter stimmen nicht überein.</string>
+<string name="create_account_username">Benutzername</string>
+<string name="create_account_password">Passwort</string>
+<string name="create_account_confirm_password">Passwort bestätigen</string>
+
+<!-- ContactList Activity -->
+<string name="contact_list_menu_add_contact">Kontakt hinzufügen</string>
+<string name="contact_list_menu_status">Status ändern</string>
+<string name="contact_list_menu_settings">Einstellungen</string>
+<string name="contact_list_menu_disconnect">Verbindung trennen</string>
+<string name="contact_list_all_contact">Alle Kontakte</string>
+<string name="contact_list_no_group">Keine Gruppe</string>
+
+<!-- UserInfo dialog -->
+<string name="userinfo_label_alias">Alias</string>
+<string name="userinfo_label_chg_group">Gruppen verwalten</string>
+<string name="userinfo_label_re_subscription">Einladung erneut senden</string>
+<string name="userinfo_label_block">Sperren</string>
+<string name="userinfo_label_delete">Löschen</string>
+<string name="userinfo_resend">Zustimmung erneut senden</string>
+<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
+</string>
+<string name="userinfo_yes">Ja</string>
+<string name="userinfo_no">Nein</string>
+<string name="userinfo_sureresend">Bist du sicher, dass du die Einladung erneut senden willst?</string>
+
+<string name="chat_name">Beem - Chat</string>
+<string name="chat_input_default_value">Nachricht eingeben</string>
+<string name="chat_self">Ich</string>
+<string name="chat_error">Fehler</string>
+<string name="chat_send_message">Senden</string>
+<string name="chat_menu_contacts_list">Kontaktliste</string>
+<string name="chat_menu_change_chat">Chat wechseln</string>
+<string name="chat_menu_start_otr_session">OTR Sitzung starten</string>
+<string name="chat_menu_stop_otr_session">OTR Sitzung beenden</string>
+<string name="chat_menu_otr_verify_key">OTR Schlüssel authentifizieren</string>
+<string name="chat_menu_otr_submenu">OTR Optionen</string>
+<string name="chat_dialog_change_chat_title">Offene Chats</string>
+<string name="chat_menu_close_chat">Diesen Chat schließen</string>
+<string name="chat_no_more_chats">Keine weiteren aktiven Chats</string>
+<string name="chat_state_composing">schreibt gerade</string>
+<string name="chat_state_gone">hat die Unterhaltung verlassen</string>
+<string name="chat_state_active">verfolgt die Unterhaltung</string>
+<string name="chat_state_inactive">macht etwas anderes</string>
+<string name="chat_otrstate_plaintext">KLARTEXT</string>
+<string name="chat_otrstate_encrypted">VERSCHLÜSSELT</string>
+<string name="chat_otrstate_finished">BEENDET</string>
+<string name="chat_otrstate_authenticated">AUTHENTIFIZIERT</string>
+<string name="chat_otr_verify_key" formatted="false">
+Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
+To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
+If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
+Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
+
+<string name="contact_status_msg_available">Online</string>
+<string name="contact_status_msg_available_chat">Bereit zum Chatten</string>
+<string name="contact_status_msg_dnd">Beschäftigt</string>
+<string name="contact_status_msg_away">Abwesend</string>
+<string name="contact_status_msg_xa">N/A</string>
+<string name="contact_status_msg_offline">Offline</string>
+
+<string name="privacy_list_name">Beem - Meine Privatsphärenliste verwalten</string>
+<string name="privacy_list_no_data">Keine Privatsphärenliste vorhanden.</string>
+<string name="privacy_list_menu_create">Privatsphärenliste erstellen</string>
+<string name="privacy_list_create_dialog_title">Privatsphärenliste erstellen</string>
+<string name="privacy_list_create_dialog_list_name_label">Titel</string>
+<string name="privacy_list_create_dialog_create_button">Erstellen</string>
+<string name="privacy_list_select_dialog_buddies">Kontakte</string>
+<string name="privacy_list_select_dialog_groups">Gruppen</string>
+<string name="privacy_list_select_dialog_delete">Löschen</string>
+<string name="privacy_list_delete_dialog_msg">Bist du sicher, dass du die Privatsphärenliste mit dem Titel \'%s\' löschen willst?</string>
+<string name="privacy_list_delete_dialog_yes">Ja</string>
+<string name="privacy_list_delete_dialog_no">Nein</string>
+
+<string name="UpdateButton">Aktualisieren</string>
+
+<!-- MemorizingTrustManager library -->
+<string name="mtm_accept_cert">Unbekanntes Zertifikat akzeptieren?</string>
+<string name="mtm_decision_always">Immer</string>
+<string name="mtm_decision_once">Einmalig</string>
+<string name="mtm_decision_abort">Abbrechen</string>
+
+<string name="mtm_notification">Zertifikatprüfung</string>
+
+<!-- Error messages -->
+
+<string name="error_login_authentication">Ein Fehler ist während der Authentifizierung aufgetreten: mangelhafter Benutzername oder Passwort.</string>
+
+<string name="interna_server_error">Remoteserver Fehler</string>
+<string name="bad_request">Mangelhafte Anfrage</string>
+<string name="forbidden">Verboten</string>
+<string name="item_not_found">Eintrag nicht gefunden</string>
+<string name="conflict">Konflikt</string>
+<string name="feature_not_implemented">Feature nicht vorhanden</string>
+<string name="gone">verloren</string>
+<string name="jid_malformed">JID mangelhaft</string>
+<string name="no_acceptable">nicht akzeptabel</string>
+<string name="not_allowed">nicht erlaubt</string>
+<string name="not_authorized">nicht authorisiert</string>
+<string name="payment_required">Bezahlung erforderlich</string>
+<string name="recipient_unavailable">Empfänger unerreichbar</string>
+<string name="redirect">weiterleiten</string>
+<string name="registration_required">Anmeldung wird benötigt</string>
+<string name="remote_server_not_found">Remoteserver nicht gefunden</string>
+<string name="remote_server_timeout">Keine Antwort vom Server</string>
+<string name="remote_server_error">Remoteserver Fehler</string>
+<string name="resource_constraint">Ressourcen Einschränkung</string>
+<string name="service_unavailable">Dienst unerreichbar</string>
+<string name="subscription_required">Zustimmung wird benötigt</string>
+<string name="undefined_condition">Undefinierte Bedingung</string>
+<string name="unexpected_condition">Unerwartete Bedingung</string>
+<string name="request_timeout">Zeitüberschreitung bei der Anfrage</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-es/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"Contento"</item>
+ <item msgid="1601611480575517120">"Triste"</item>
+ <item msgid="1531181614218625881">"Guiño"</item>
+ <item msgid="3858808057949077894">"Sacando la lengua"</item>
+ <item msgid="7835238297967185651">"Sorprendido"</item>
+ <item msgid="1756223535005296033">"Besando"</item>
+ <item msgid="1093906245140165107">"Sorpresa"</item>
+ <item msgid="888834839864150170">"Atractivo"</item>
+ <item msgid="6320683740534773967">"Dinero en la boca"</item>
+ <item msgid="6610111212478853990">"Metedura de pata"</item>
+ <item msgid="1706035208563940251">"Avergonzado"</item>
+ <item msgid="9079275787422313427">"Ángel"</item>
+ <item msgid="4630490399784004880">"Indeciso"</item>
+ <item msgid="7002574538342357456">"Llorando"</item>
+ <item msgid="850324578089267455">"Labios sellados"</item>
+ <item msgid="6334637439528489607">"Riendo"</item>
+ <item msgid="7602915122893958066">"Confuso"</item>
+ <item msgid="3939233701582771068">"Corazón"</item>
+ <item msgid="1414759480575851587">"Enfadado"</item>
+ <item msgid="8479809115158836070">"No mola"</item>
+ <item msgid="638612939305162424">"Cara de póquer"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-es/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+<!-- Generic terms -->
+<string name="app_name">Beem</string>
+<string name="OkButton">Aceptar</string>
+<string name="ClearButton">Limpiar</string>
+<string name="CancelButton">Cancelar</string>
+<string name="AcceptButton">Autorizar</string>
+<string name="RefuseButton">Denegar</string>
+<string name="JabberID">Jabber ID</string>
+<string name="Password">Contraseña</string>
+<string name="Continue">Continuar</string>
+
+<!-- AccountConfigure class -->
+<string name="AccountConfigureManualConfiguration">Configuración manual</string>
+
+<!-- Beem class -->
+<string name="BeemJabberID">Jabber ID</string>
+
+<!-- BeemApplication class -->
+<string name="BeemApplicationConnect">Conectando...</string>
+
+<!-- BeemService class -->
+<string name="BeemServiceDescription">Usar el servicio Beem</string>
+<string name="BeemServiceCreated">Servicio Beem creado</string>
+<string name="BeemServiceDestroyed">Servicio Beem suprimido</string>
+
+<!-- ContactDialog class -->
+<string name="CDChat">Charla</string>
+<string name="CDCall">Llamada</string>
+<string name="CDInfos">Gestión de usuario</string>
+
+<!-- AddContact class -->
+<string name="AddCActTitle">Beem - Añadir contacto</string>
+
+<string name="AddCLogin">Usuario</string>
+<string name="AddCAlias">Alias</string>
+<string name="AddCGroup">Grupo</string>
+<string name="AddCOkButton">Añadir</string>
+<string name="AddCContactAdded">Contacto añadido</string>
+<string name="AddCContactAddedError">Error al añadir contacto</string>
+<string name="AddCContactAddedLoginError">Error en el login</string>
+<string name="AddCBadForm">Formulario incorrecto</string>
+<string name="AddCContactAlready">El contacto ya existe</string>
+
+<!-- ChangeStatus class -->
+<string name="ChangeStatusActTitle">Beem - Cambiar mi estado</string>
+<string name="ChangeStatusType">Mi estado</string>
+<string name="ChangeStatusMessage">Mi mensaje personal</string>
+<string name="OpenContactList">Abrir lista de contactos</string>
+
+<string name="MenuAddContact">Añadir contacto</string>
+<string name="MenuAccountAbout">Proyecto Beem</string>
+<string name="MenuAccountCreate">Crear cuenta</string>
+<string name="MenuConnection">Editar cuenta</string>
+<string name="ChangeStatusOk">Actualizando estado</string>
+<string name="ChangeStatusNoChange">Nada que cambiar</string>
+<string name="my_avatar">Mi avatar</string>
+<string name="select_avatar">Escoja su avatar</string>
+<string name="take_photo">Tomar una foto</string>
+<string name="pick_photo">Seleccionar una imagen</string>
+<string name="delete_avatar">Sin avatar</string>
+<string name="photoPickerNotFoundText">Seleccionador de imagen no encontrado</string>
+
+
+<!-- Settings class -->
+<string name="SettingsText">Editar su usuario</string>
+<string name="SettingsPassword">Editar su contraseña</string>
+<string name="SettingsProxy">Proxy</string>
+<string name="SettingsProxyProxy">Usar un servidor proxy</string>
+<string name="SettingsProxySummary">Iniciar a través de un servidor proxy</string>
+<string name="SettingsProxyType">Protocolo</string>
+<string name="SettingsProxyTypeSummary">Escoja el tipo de servidor proxy</string>
+<string name="SettingsProxyServer">Editar dirección del servidor proxy</string>
+<string name="SettingsProxyPort">Editar puerto del servidor proxy</string>
+<string name="SettingsProxyUser">Opcional, permitir el inicio de sesión en el server proxy.</string>
+<string name="SettingsProxyPassword">Opcional, permitir el inicio de sesión en el server proxy.</string>
+<string name="SettingsAdvanced">Avanzado</string>
+<string name="SettingsAdvancedOptions">Opciones especificas del servidor</string>
+<string name="SettingsAdvancedRecoDelay">Modificar retraso de conexión</string>
+<string name="SettingsAdvancedSpecOpt">Marca esta casilla si deseas usar un servidor especifico para esta conexión</string>
+<string name="SettingsAdvancedAddOpt">Editar dirección del servidor</string>
+<string name="SettingsAdvancedPortOpt">Editar puerto del servidor</string>
+<string name="SettingsResourceTitle">Recurso</string>
+<string name="SettingsPriorityTitle">Prioridad</string>
+<string name="SettingsResourceSummary">Establecer el recurso XMPP de tu cliente</string>
+<string name="SettingsPrioritySummary">Establecer la prioridad de tu cliente</string>
+<string name="contact_list_preferences">Lista de amigos</string>
+<string name="contact_list_preferences_sum">A set of display options for your buddy list
+</string>
+<string name="CLP_hide_groups">Ocultar grupos</string>
+<string name="CLP_hide_groups_sum">Habilita esta opción para ocultar grupos</string>
+<string name="CLP_hidden_contact">Ocultar amigos</string>
+<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
+</string>
+<string name="settings_account_username">Nombre de usuario (JID)</string>
+<string name="login_username_info_default">beem@beem-project.com</string>
+<string name="settings_account_password">Contraseña</string>
+<string name="settings_account_server">Servidor</string>
+<string name="settings_account_port">Puerto</string>
+<string name="settings_advanced_service_behaviour">Comportamiento del servicio</string>
+<string name="settings_advanced_sum">Una serie de opciones para usuarios avanzados</string>
+<string name="settings_xmpp_server">Dirección del servidor XMPP</string>
+<string name="comments_xmpp_server">Comentgarios del servidor XMPP</string>
+<string name="settings_xmpp_port">Puerto</string>
+<string name="settings_xmpp_use_tls">Requerir SSL/TTL</string>
+<string name="settings_reco_delay">Tiempo de reconexión</string>
+<string name="comments_xmpp_port">Puerto por defecto: 5222</string>
+<string name="settings_proxy_sum">Configuración del proxy</string>
+<string name="settings_proxy_use">Conectar mediante proxy</string>
+<string name="settings_proxy_type_prompt">Seleccionar tipo de proxy</string>
+<string name="settings_proxy_server">Servidor</string>
+<string name="settings_proxy_port">Puerto</string>
+<string name="comments_proxy_port">Puerto por defecto: 1080</string>
+<string name="settings_proxy_username">Nombre de usuario</string>
+<string name="settings_proxy_password">Contraseña</string>
+<string name="away_chk_title">Habilitar ausente automático</string>
+<string name="away_chk_sum">Cambiar estado a Ausente cuando la pantalla se apague</string>
+<string name="away_message_title">Mensaje de ausente</string>
+<string name="away_message_sum">El mensaje de ausente que será mostrado</string>
+<string name="away_message_hint">Estoy ausente, mi pantalla está apagada</string>
+<string name="notification_preferences">Configuración de notificaciones</string>
+<string name="notification_enable_vibrate_title">Habilitar vibración</string>
+<string name="notification_enable_vibrate_sum">Habilitar vibración en mensajes entrantes</string>
+<string name="notification_snd_title">Tono de mensaje entrante</string>
+<string name="notification_snd_sum">Configurar tono de mensaje entrante</string>
+<string name="settings_chat_compact">Charla compacta</string>
+<string name="settings_chat_compact_sum">Establecer las ventanas de charla en modo compacto</string>
+<string name="history">Historial</string>
+<string name="history_sum">Tilda esto para guardar las conversaciones en la tarjeta SD</string>
+<string name="history_mount">Se necesita una tarjeta SD montada y escribible para habilitar el historial</string>
+<string name="history_on_off">Habilitar historial de mensajes</string>
+<string name="chat_preferences">Charla</string>
+<string name="chat_preferences_sum">Historial, tamaño de la distribución visual...</string>
+<string name="chat_history_path">Ruta al historial</string>
+<string name="chat_history_path_sum">Las conversaciones se guardan en una carpeta en la tarjeta SD</string>
+<string name="settings_smack_debug">Habilitar depuración de XMPP</string>
+<string name="settings_full_jid_login">Usar el JID completo como nombre de usuario</string>
+<string name="settings_full_jid_login_sum">Necesario para algunos servidores como por ejemplo Google Talk</string>
+
+<!-- Subscription class -->
+<string name="SubscriptAccept">Suscripción aceptada</string>
+<string name="SubscriptError">Error de suscripción</string>
+<string name="SubscriptRefused">Suscripción rechazada</string>
+<string name="SubscriptText">%s desea agregarlo/a a su lista de contactos. ¿Desea autorizarlo/a ?</string>
+<string name="SubscriptTitle">¿Autorizar contacto?</string>
+
+<!-- BeemChatManager -->
+<string name="BeemChatManagerNewMessage">Tienes un nuevo mensaje</string>
+
+<!-- BeemBroadcastReceiver class -->
+<string name="BeemBroadcastReceiverDisconnect">BEEM: Ha sido desconectado</string>
+
+<!-- XmppConnectionAdapter class -->
+<string name="AcceptContactRequest">%s lo/la agregó a su lista de contactos.</string>
+<string name="AcceptContactRequestFrom">Autorice a %s para que lo contacte.</string>
+
+<!-- Activities -->
+<string name="login_tag">Beem - Actividad inicio</string>
+<string name="edit_settings_name">Beem - Configuración</string>
+<string name="edit_settings_tag">Beem - Actividad editar configuración</string>
+<string name="create_account_name">Beem - Crear una cuenta</string>
+<string name="create_account_tag">Beem - Actividad creación cuenta</string>
+<string name="contact_list_name">Beem - Contactos</string>
+<string name="contact_list_tag">Beem - Actividad lista contactos</string>
+<string name="user_info_name">Beem - Información de usuario</string>
+
+<!-- Buttons -->
+<string name="button_create_account">Crear esta cuenta</string>
+<string name="button_create_login_account">Crear y usar esta cuenta</string>
+
+<!-- LogAs Activity -->
+<string name="login_username">Usuario</string>
+<string name="login_password">Contraseña</string>
+<string name="login_error_dialog_title">Inicio sesión - Error</string>
+<string name="login_close_dialog_button">Cerrar</string>
+<string name="login_menu_create_account">Crear una cuenta</string>
+<string name="login_menu_settings">Configuración</string>
+<string name="login_menu_about">Acerca de</string>
+<string name="login_about_title">Beem %s - Acerca de</string>
+<string name="login_about_msg">
+Beem is an EPITECH Innovative Project. Visit us at
+http://www.beem-project.com !
+</string>
+<string name="login_about_button">Cerrar</string>
+<string name="login_settings_button">Configuración</string>
+<string name="login_login_button">Inicio</string>
+<string name="login_login_progress">Conectando. Espere por favor ...</string>
+<string name="login_error_msg">Unfortunately, an error occured.\n\nError
+detail:\n%s</string>
+<string name="login_menu_login">Iniciar sesión</string>
+<string name="login_no_connectivity">No se detecto una conexión a internet</string>
+<string name="login_start_msg">Configuración de parametros en menú</string>
+
+<!-- LoginAnim activity -->
+<string name="loganim_connecting">Conectando...</string>
+<string name="loganim_authenticating">Autenticando...</string>
+<string name="loganim_login_success">Inicio correcto</string>
+<string name="loganim_login_failed">Inicio fallido</string>
+
+<!-- EditSettings Activity -->
+<string name="settings_menu_create_account">Crear una cuenta</string>
+<string name="settings_menu_privacy_lists">Administrar mis listas de privacidad</string>
+<string name="settings_saved_ok">Los cambios han sido guardados correctamente.</string>
+
+
+
+<!-- EditSettings Activity Categories -->
+<string name="general_preferences">Preferencias generales</string>
+<string name="user_preferences">Configuración de usuario (requerido)</string>
+<string name="user_preferences_advanced">Configuración avanzada de usuario (opcional)</string>
+<string name="network_preferences">Opciones de red</string>
+<string name="proxy_proxy_settings">Configuración Proxy</string>
+<string name="proxy_user_settings">Configuración Proxy</string>
+<string name="history_preferences">Historial</string>
+<string name="chat_layout_option">Distribución visual de la conversación</string>
+
+
+<!-- EditSettings Activity Tabs -->
+<string name="settings_tab_tag_account">editar_configuración_pestaña_cuenta</string>
+<string name="settings_tab_label_account">Cuenta</string>
+<string name="settings_tab_tag_xmpp">editar_configuración_pestaña_xmpp</string>
+<string name="settings_tab_label_xmpp">XMPP</string>
+<string name="settings_tab_tag_proxy">editar_configuración_pestaña_proxy</string>
+<string name="settings_tab_label_proxy">Proxy</string>
+
+
+<!-- wizard activities -->
+<string name="account_wizard_text1"><b>Bienvenido a BEEM.</b>\n\nTodavía no ha configurado su cuenta XMPP (Jabber).\nEscoja una de las siguientes opciones:</string>
+<string name="account_wizard_configure_text"><b>Por favor, complete con la información de su cuenta existente</b></string>
+<string name="account_wizard_configure_account">Ya tengo una cuenta y deseo utilizarla</string>
+<string name="account_wizard_create_account">Deseo registrar una nueva cuenta</string>
+
+<!-- Create an account Activity -->
+<string name="create_account_instr_dialog_title">Crear cuenta - Instrucciones</string>
+<string name="create_account_err_dialog_title">Crear cuenta - Error</string>
+<string name="create_account_err_dialog_settings_button">Cambiar mi configuración</string>
+<string name="create_account_close_dialog_button">Cerrar</string>
+<string name="create_account_successfull_after">la cuenta %s fue creada correctamente</string>
+<string name="create_account_err_username">JabberID incorrecto </string>
+<string name="create_account_err_passwords">La clave no coincide</string>
+<string name="create_account_username">Usuario</string>
+<string name="create_account_password">Contraseña</string>
+<string name="create_account_confirm_password">Confirmar contraseña</string>
+
+<!-- ContactList Activity -->
+<string name="contact_list_menu_add_contact">Añadir un contacto</string>
+<string name="contact_list_menu_status">Cambiar estado</string>
+<string name="contact_list_menu_settings">Configuración</string>
+<string name="contact_list_menu_disconnect">Desconectar</string>
+<string name="contact_list_all_contact">Todos los contactos</string>
+<string name="contact_list_no_group">Sin grupo</string>
+
+<!-- UserInfo dialog -->
+<string name="userinfo_label_alias">Alias</string>
+<string name="userinfo_label_chg_group">Administrar grupos</string>
+<string name="userinfo_label_re_subscription">Reenviar invitación</string>
+<string name="userinfo_label_block">Bloquear</string>
+<string name="userinfo_label_delete">Borrar</string>
+<string name="userinfo_resend">Reenviar suscripción</string>
+<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
+</string>
+<string name="userinfo_yes">Sí</string>
+<string name="userinfo_no">No</string>
+<string name="userinfo_sureresend">¿Estás seguro/a de que deseas reenviar la invitación?</string>
+
+<string name="chat_name">Beem - Charla</string>
+<string name="chat_input_default_value">Escribe tu Mensaje</string>
+<string name="chat_self">Yo</string>
+<string name="chat_error">Error</string>
+<string name="chat_send_message">Enviar</string>
+<string name="chat_menu_contacts_list">Lista de Contactos</string>
+<string name="chat_menu_change_chat">Cambiar charla</string>
+<string name="chat_dialog_change_chat_title">Charlas abiertos</string>
+<string name="chat_menu_close_chat">Cerrar charla</string>
+<string name="chat_no_more_chats">No hay más charlas activas</string>
+<string name="chat_state_composing">está escribiendo un mensaje</string>
+<string name="chat_state_gone">ha dejado la conversación</string>
+<string name="chat_state_active">presta atención a la conversación</string>
+<string name="chat_state_inactive">está haciendo otra cosa</string>
+
+<string name="contact_status_msg_available">Disponible</string>
+<string name="contact_status_msg_available_chat">Disponible para chatear</string>
+<string name="contact_status_msg_dnd">No interumpir</string>
+<string name="contact_status_msg_away">Ausente</string>
+<string name="contact_status_msg_xa">No disponible</string>
+<string name="contact_status_msg_offline">Desconectado</string>
+
+<string name="privacy_list_name">Beem - Administrar mi lista de privacidad</string>
+<string name="privacy_list_no_data">No existe ninguna lista de privacidad registrada</string>
+<string name="privacy_list_menu_create">Crear una lista de privacidad</string>
+<string name="privacy_list_create_dialog_title">Crear una lista de privacidad</string>
+<string name="privacy_list_create_dialog_list_name_label">Título</string>
+<string name="privacy_list_create_dialog_create_button">Crear</string>
+<string name="privacy_list_select_dialog_buddies">Contactos</string>
+<string name="privacy_list_select_dialog_groups">Grupos</string>
+<string name="privacy_list_select_dialog_delete">Borrar</string>
+<string name="privacy_list_delete_dialog_msg">Borrar la lista privada \'%s\' ?</string>
+<string name="privacy_list_delete_dialog_yes">Sí</string>
+<string name="privacy_list_delete_dialog_no">No</string>
+
+<string name="UpdateButton">Actualizar</string>
+
+<!-- Error messages -->
+
+<string name="error_login_authentication">Error al iniciar sesión, usuario o contraseña erroneos.</string>
+
+<string name="interna_server_error">Error Servidor remoto</string>
+<string name="bad_request">pedido equivocado</string>
+<string name="forbidden">prohibido</string>
+<string name="item_not_found">elemento no encontrado</string>
+<string name="conflict">conflicto</string>
+<string name="feature_not_implemented">caracteristica no implementada</string>
+<string name="gone">ir</string>
+<string name="jid_malformed">jid malformado</string>
+<string name="no_acceptable">inaceptable</string>
+<string name="not_allowed">no permitido</string>
+<string name="not_authorized">no autorizado</string>
+<string name="payment_required">pago requerido</string>
+<string name="recipient_unavailable">receptor no disponible</string>
+<string name="redirect">redireccionar</string>
+<string name="registration_required">registro requerido</string>
+<string name="remote_server_not_found">servidor remoto no encontrado</string>
+<string name="remote_server_timeout">Sin respuesta del servidor</string>
+<string name="remote_server_error">Error en servidor remoto</string>
+<string name="resource_constraint">restricción en recurso</string>
+<string name="service_unavailable">servicio no disponible</string>
+<string name="subscription_required">suscripción requerida</string>
+<string name="undefined_condition">condición indefinida</string>
+<string name="unexpected_condition">condición inesperada</string>
+<string name="request_timeout">tiempo de espera de solicitud </string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-eu/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,322 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+<!-- Generic terms -->
+<string name="app_name">Beem</string>
+<string name="OkButton">Ados</string>
+<string name="ClearButton">Garbitu</string>
+<string name="CancelButton">Utzi</string>
+<string name="AcceptButton">Baimendu</string>
+<string name="RefuseButton">Ukatu</string>
+<string name="JabberID">Jabber ID-a</string>
+<string name="Password">Pasahitza</string>
+<string name="Continue">Jarraitu</string>
+
+<!-- AccountConfigure class -->
+<string name="AccountConfigureManualConfiguration">Eskuzko konfigurazioa</string>
+
+<!-- BeemService class -->
+<string name="BeemServiceDescription">Erabili Beem zerbitzua</string>
+
+<!-- ContactDialog class -->
+<string name="CDChat">Berriketa</string>
+<string name="CDCall">Deia</string>
+<string name="CDInfos">Kudeatu erabiltzailea</string>
+
+<!-- AddContact class -->
+<string name="AddCActTitle">Beem - Gehitu kontaktu bat</string>
+
+<string name="AddCLogin">Erabiltzaile-izena</string>
+<string name="AddCAlias">Goitizena</string>
+<string name="AddCGroup">Taldea</string>
+<string name="AddCOkButton">Gehitu</string>
+<string name="AddCContactAdded">Kontaktua gehituta</string>
+<string name="AddCContactAddedError">Errorea: Kontaktua ez da gehitu</string>
+<string name="AddCContactAddedLoginError">Errorea saioa hastean</string>
+<string name="AddCContactAlready">Kontaktua dagoeneko existitzen da</string>
+
+<!-- ChangeStatus class -->
+<string name="ChangeStatusActTitle">Beem - Aldatu nire egoera</string>
+<string name="ChangeStatusType">Nire egoera</string>
+<string name="ChangeStatusMessage">Nire mezu pertsonala</string>
+<string name="OpenContactList">Ireki kontaktu zerrenda</string>
+
+<string name="ChangeStatusOk">Egoera eguneratzen</string>
+<string name="my_avatar">Nire avatar-a</string>
+<string name="select_avatar">Aukeratu zure avatar-a</string>
+<string name="take_photo">Egin argazki bat</string>
+<string name="pick_photo">Hautatu irudi bat</string>
+<string name="delete_avatar">Avatar-ik ez</string>
+<string name="photoPickerNotFoundText">Ez da argazki hautatzailerik aurkitu</string>
+
+
+<!-- Settings class -->
+<string name="SettingsProxy">Proxy-a</string>
+<string name="SettingsProxyProxy">Erabili proxy zerbitzari bat</string>
+<string name="SettingsProxySummary">Hasi saioa proxy zerbitzari bidez</string>
+<string name="SettingsProxyType">Protokoloa</string>
+<string name="SettingsProxyTypeSummary">Aukeratu proxy zerbitzari mota</string>
+<string name="SettingsProxyServer">Editatu proxy zerbitzariaren helbidea</string>
+<string name="SettingsProxyPort">Editatu proxy zerbitzariaren ataka</string>
+<string name="SettingsProxyUser">Hautazkoa, onartu zeure burua proxy zerbitzarian autentifikatzea</string>
+<string name="SettingsProxyPassword">Hautazkoa, onartu zeure burua proxy zerbitzarian autentifikatzea</string>
+<string name="SettingsAdvanced">Aurreratua</string>
+<string name="SettingsAdvancedOptions">Zerbitzari jakin bat aukera</string>
+<string name="SettingsAdvancedRecoDelay">Aldatu birkonexio atzerapena</string>
+<string name="SettingsAdvancedSpecOpt">Hautatu hau zure konexioan zerbitzari jakin bat erabili nahi baduzu</string>
+<string name="SettingsAdvancedAddOpt">Editatu zerbitzariaren helbidea</string>
+<string name="SettingsAdvancedPortOpt">Editatu zerbitzariaren ataka</string>
+<string name="SettingsResourceTitle">Baliabidea</string>
+<string name="SettingsPriorityTitle">Lehentasuna</string>
+<string name="SettingsResourceSummary">Ezarri zure bezeroaren XMPP baliabidea</string>
+<string name="SettingsPrioritySummary">Ezarri zure bezeroaren lehentasuna</string>
+<string name="contact_list_preferences">Lagun zerrenda</string>
+<string name="contact_list_preferences_sum">A set of display options for your buddy list
+</string>
+<string name="CLP_hide_groups">Ezkutatu taldeak</string>
+<string name="CLP_hide_groups_sum">Hautatu aukera hau taldeak ezkutatzeko</string>
+<string name="CLP_show_jid">Erakutsi JID</string>
+<string name="CLP_show_jid_sum">Hautatu aukera hau kontaktuaren JIDa beti erakusteko</string>
+<string name="CLP_hidden_contact">Ezkutatu lagunak</string>
+<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
+</string>
+<string name="settings_account_username">Erabiltzaile-izena (JID)</string>
+<string name="settings_account_password">Pasahitza</string>
+<string name="settings_account_server">Zerbitzaria</string>
+<string name="settings_account_port">Ataka</string>
+<string name="settings_advanced_service_behaviour">Zerbitzuaren portaera</string>
+<string name="settings_advanced_sum">Erabiltzaile aurreratuentzako aukera sorta bat</string>
+<string name="settings_xmpp_server">Helbidea</string>
+<string name="comments_xmpp_server">adibidea.com</string>
+<string name="settings_xmpp_port">Ataka</string>
+<string name="settings_xmpp_use_tls">SSL/TLS behar du</string>
+<string name="settings_reco_delay">Birkonexio atzerapena</string>
+<string name="comments_xmpp_port">Lehenetsia: 5222</string>
+<string name="settings_proxy_sum">Proxy-aren erabilera ezarpenak</string>
+<string name="settings_proxy_use">Konektatu proxy bat erabiliz</string>
+<string name="settings_proxy_type_prompt">Aukeratu proxy mota bat</string>
+<string name="settings_proxy_server">Zerbitzaria</string>
+<string name="settings_proxy_port">Ataka</string>
+<string name="comments_proxy_port">Lehenetsia: 1080</string>
+<string name="settings_proxy_username">Erabiltzaile-izena</string>
+<string name="settings_proxy_password">Pasahitza</string>
+<string name="away_chk_title">Gaitu automatikoki aldenduta</string>
+<string name="away_chk_sum">Ezarri Aldendua egoera pantaila itzaltzean</string>
+<string name="away_message_title">Aldendua mezua</string>
+<string name="away_message_sum">Bistaratuko den Aldendua mezua</string>
+<string name="away_message_hint">Aldendua nago, nire mugikorraren pantaila itzalita dago</string>
+<string name="notification_preferences">Jakinarazpenen ezarpenak</string>
+<string name="notification_enable_vibrate_title">Gaitu bibrazioa</string>
+<string name="notification_enable_vibrate_sum">Gaitu bibrazioa sarrerako mezuetan</string>
+<string name="notification_snd_title">Mezuaren tonua</string>
+<string name="notification_snd_sum">Ezarri sarrerako mezuen tonua</string>
+<string name="settings_chat_compact">Berriketa trinkoa</string>
+<string name="settings_chat_compact_sum">Ezarri berriketa leiho trinkoa</string>
+<string name="history">Historia</string>
+<string name="history_sum">Hautatu hau berriketak SD txartelean gordetzeko</string>
+<string name="chat_preferences">Berriketa</string>
+<string name="chat_preferences_sum">Historia, diseinuaren tamaina</string>
+<string name="chat_history_path">Historia bidea</string>
+<string name="chat_history_path_sum">Berriketa elkarrizketak SD txarteleko karpeta batean gordetzen dira</string>
+<string name="settings_smack_debug">Gaitu XMPP arazketa</string>
+<string name="settings_full_jid_login">Erabili nire JID osoa erabiltzaile-izen bezala</string>
+<string name="settings_full_jid_login_sum">Google Talk bezalako zenbait zerbitzarik behar dute</string>
+
+<!-- Subscription class -->
+<string name="SubscriptAccept">Harpidetza onartuta</string>
+<string name="SubscriptError">Harpidetza errorea</string>
+<string name="SubscriptRefused">Harpidetza errefusatuta</string>
+<string name="SubscriptText">%s-(e)k bere lagun zerrendara gehitu nahi zaitu. Baimendu nahi duzu?</string>
+<string name="SubscriptTitle">Laguna baimendu?</string>
+
+<!-- BeemBroadcastReceiver class -->
+<string name="BeemBroadcastReceiverDisconnect">BEEM: Deskonektatua izan zara</string>
+
+<!-- XmppConnectionAdapter class -->
+<string name="AcceptContactRequest">%s-(e)k bere lagun zerrendara gehitu zaitu oraintxe.</string>
+<string name="AcceptContactRequestFrom">Baimendu %s-(e)k zurekin kontaktatzea.</string>
+
+<!-- Activities -->
+<string name="edit_settings_name">Beem - Ezarpenak</string>
+<string name="create_account_name">Beem - Sortu kontu bat</string>
+<string name="contact_list_name">Beem - Kontaktuak</string>
+<string name="user_info_name">Beem - Erabiltzailearen informazioa</string>
+
+<!-- LogAs Activity -->
+<string name="login_menu_settings">Ezarpenak</string>
+<string name="login_menu_about">Honi buruz</string>
+<string name="login_about_title">Beem %s - Honi buruz</string>
+<string name="login_about_msg">
+Beem is an EPITECH Innovative Project. Visit us at
+http://www.beem-project.com !
+</string>
+<string name="login_about_button">Itxi</string>
+<string name="login_login_progress">Konektatzen. Itxaron mesedez...</string>
+<string name="login_menu_login">Hasi saioa</string>
+<string name="login_start_msg">Ezarpenen konfigurazioa menuan</string>
+
+<!-- LoginAnim activity -->
+<string name="loganim_connecting">Konektatzen...</string>
+<string name="loganim_authenticating">Autentifikatzen...</string>
+<string name="loganim_login_success">Saio hasiera arrakastatsua</string>
+<string name="loganim_login_failed">Saio hasierak huts egin du</string>
+
+<!-- EditSettings Activity -->
+<string name="settings_menu_create_account">Sortu kontu bat</string>
+<string name="settings_menu_privacy_lists">Kudeatu nire pribatutasun zerrendak</string>
+<string name="settings_saved_ok">Ezarpenak behar bezala gorde dira.</string>
+
+
+
+<!-- EditSettings Activity Categories -->
+<string name="general_preferences">Hobespen orokorrak</string>
+<string name="user_preferences">Erabiltzailearen ezarpenak (beharrezkoa)</string>
+<string name="user_preferences_advanced">Erabiltzailearen ezarpen aurreratuak (hautazkoa)</string>
+<string name="network_preferences">Sarearen aukerak</string>
+<string name="proxy_proxy_settings">Proxy-aren aukerak</string>
+<string name="proxy_user_settings">Proxy-aren aukerak</string>
+<string name="history_preferences">Historia</string>
+<string name="chat_layout_option">Berriketaren diseinua</string>
+
+
+<!-- EditSettings Activity Tabs -->
+<string name="settings_tab_tag_account">editatu_ezarpenak_kontua_fitxa</string>
+<string name="settings_tab_label_account">Kontua</string>
+<string name="settings_tab_tag_xmpp">editatu_ezarpenak_xmpp_fitxa</string>
+<string name="settings_tab_label_xmpp">XMPP</string>
+<string name="settings_tab_tag_proxy">editatu_ezarpenak_proxy_fitxa</string>
+<string name="settings_tab_label_proxy">Proxy-a</string>
+
+
+<!-- wizard activities -->
+<string name="account_wizard_text1"><b>Ongietorri BEEM-era.</b>nnEz duzu XMPP (Jabber) konturik konfiguratu oraindik.nAukeratu ondorengo aukeretako bat:</string>
+<string name="account_wizard_configure_text_1">Erabili gailuan gordetako kontu bat</string>
+<string name="account_wizard_configure_text_2"><b>edo</b></string>
+<string name="account_wizard_configure_text_3">Bete existitzen den zure kontuaren datuak</string>
+<string name="account_wizard_settings_warn"><b>Abisua: </b>Zure ezarpenetan proxy-zerbitzari bat edo ostalari-izen jakin bat duen zerbitzaria erabiltzeko aukera ezarrita daukazu.</string>
+<string name="account_wizard_connection_failed"><b>Ezin izan da zure kontua autentifikatu. Mesedez egiaztatu zure kredentzialak</b></string>
+<string name="account_wizard_select_account_btn">Aukeratu kontu bat</string>
+
+<string name="account_wizard_configure_account">Dagoeneko badut erabili nahi dudan kontu bat</string>
+<string name="account_wizard_create_account">Kontu berri bat erregistratu nahi dut</string>
+
+<!-- Create an account Activity -->
+<string name="create_account_text">Sartu zure kontua sortzeko beharrezko den informazioa</string>
+<string name="create_account_progress_title">Kontua sortzen</string>
+<string name="create_account_progress_message">Mesedez itxaron</string>
+<string name="create_account_err_username">JabberID okerra</string>
+<string name="create_account_err_passwords">Pasahitzak ez datoz bat.</string>
+<string name="create_account_username">Erabiltzaile-izena</string>
+<string name="create_account_password">Pasahitza</string>
+<string name="create_account_confirm_password">Berretsi pasahitza</string>
+<string name="create_account_err_conflict">Kontu hau dagoeneko erabiltzen da. Mesedez saiatu beste batekin</string>
+<string name="create_account_err_connection">Hautatutako zerbitzaria ez dago erabilgarri. Mesedez saiatu beste batekin</string>
+
+
+<!-- ContactList Activity -->
+<string name="contact_list_menu_add_contact">Gehitu kontaktu bat</string>
+<string name="contact_list_menu_status">Aldatu egoera</string>
+<string name="contact_list_menu_settings">Ezarpenak</string>
+<string name="contact_list_menu_disconnect">Deskonektatu</string>
+<string name="contact_list_all_contact">Kontaktu guztiak</string>
+<string name="contact_list_no_group">Talderik ez</string>
+
+<!-- UserInfo dialog -->
+<string name="userinfo_label_alias">Goitizena</string>
+<string name="userinfo_label_chg_group">Kudeatu taldeak</string>
+<string name="userinfo_label_re_subscription">Birbidali gonbidapena</string>
+<string name="userinfo_label_block">Blokeatu</string>
+<string name="userinfo_label_delete">Ezabatu</string>
+<string name="userinfo_resend">Harpidetza birbidalita</string>
+<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
+</string>
+<string name="userinfo_yes">Bai</string>
+<string name="userinfo_no">Ez</string>
+<string name="userinfo_sureresend">Ziur zaude gonbidapena birbidali nahi duzula?</string>
+
+<string name="chat_name">Beem - Berriketa</string>
+<string name="chat_input_default_value">Idatzi zure mezua</string>
+<string name="chat_self">Ni</string>
+<string name="chat_error">Errorea</string>
+<string name="chat_send_message">Bidali</string>
+<string name="chat_menu_contacts_list">Kontaktu zerrenda</string>
+<string name="chat_menu_change_chat">Aldatu berriketa</string>
+<string name="chat_menu_start_otr_session">Hasi OTR saioa</string>
+<string name="chat_menu_stop_otr_session">Gelditu OTR saioa</string>
+<string name="chat_menu_otr_verify_key">OTR egiaztatu gakoa</string>
+<string name="chat_menu_otr_submenu">OTR ekintzak</string>
+<string name="chat_dialog_change_chat_title">Irekitako berriketak</string>
+<string name="chat_menu_close_chat">Itxi berriketa hau</string>
+<string name="chat_no_more_chats">Ez dago berriketa aktibo gehiago</string>
+<string name="chat_state_composing">mezu bat osatzen ari da</string>
+<string name="chat_state_gone">-(e)k elkarrizketa utzi du</string>
+<string name="chat_state_active">elkarrizketa jarraitzen ari da</string>
+<string name="chat_state_inactive">beste zerbait egiten ari da</string>
+<string name="chat_otrstate_plaintext">TESTULAUA</string>
+<string name="chat_otrstate_encrypted">ZIFRATUTA</string>
+<string name="chat_otrstate_finished">AMAITUTA</string>
+<string name="chat_otrstate_authenticated">AUTENTIFIKATUTA</string>
+<string name="chat_otr_verify_key" formatted="false">
+Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
+To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
+If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
+Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
+
+<string name="contact_status_msg_available">Eskuragarri</string>
+<string name="contact_status_msg_available_chat">Eskuragarri berriketarako</string>
+<string name="contact_status_msg_dnd">Ez eragotzi</string>
+<string name="contact_status_msg_away">Aldendua</string>
+<string name="contact_status_msg_xa">Eskuraezin</string>
+<string name="contact_status_msg_offline">Deskonektatuta</string>
+
+<string name="privacy_list_name">Beem - Kudeatu nire pribatutasun zerrendak</string>
+<string name="privacy_list_no_data">Ez dago pribatutasun zerrendarik erregistratuta.</string>
+<string name="privacy_list_menu_create">Sortu pribatutasun zerrenda bat</string>
+<string name="privacy_list_create_dialog_title">Sortu pribatutasun zerrenda bat</string>
+<string name="privacy_list_create_dialog_list_name_label">Izenburua</string>
+<string name="privacy_list_create_dialog_create_button">Sortu</string>
+<string name="privacy_list_select_dialog_buddies">Lagunak</string>
+<string name="privacy_list_select_dialog_groups">Taldeak</string>
+<string name="privacy_list_select_dialog_delete">Ezabatu</string>
+<string name="privacy_list_delete_dialog_msg">Ziur zaude \'%s\' izeneko pribatutasun zerrenda ezabatu nahi duzula?</string>
+<string name="privacy_list_delete_dialog_yes">Bai</string>
+<string name="privacy_list_delete_dialog_no">Ez</string>
+
+<string name="UpdateButton">Eguneratu</string>
+
+<!-- MemorizingTrustManager library -->
+<string name="mtm_accept_cert">Ziurtagiri ezezaguna onartu?</string>
+<string name="mtm_decision_always">Beti</string>
+<string name="mtm_decision_once">Behin</string>
+<string name="mtm_decision_abort">Abortatu</string>
+
+<string name="mtm_notification">Ziurtagiriaren egiaztapena</string>
+
+<!-- Error messages -->
+
+<string name="error_login_authentication">Errorea autentifikatzean, erabiltzaile edo pasahitz okerra</string>
+
+<string name="interna_server_error">Urruneko zerbitzariaren errorea</string>
+<string name="bad_request">eskaera-okerra</string>
+<string name="forbidden">debekatua</string>
+<string name="item_not_found">elementua-ez-da-aurkitu</string>
+<string name="conflict">gatazka</string>
+<string name="feature_not_implemented">inplementatu-gabeko-ezaugarria</string>
+<string name="gone">joana</string>
+<string name="jid_malformed">gaizki-osatutako-jid</string>
+<string name="no_acceptable">onartezina</string>
+<string name="not_allowed">ez-onartua</string>
+<string name="not_authorized">ez-baimendua</string>
+<string name="payment_required">ordainketa-beharrezkoa</string>
+<string name="recipient_unavailable">hartzaile-eskuraezina</string>
+<string name="redirect">birbideratu</string>
+<string name="registration_required">erregistratzea-beharrezkoa</string>
+<string name="remote_server_not_found">Ez da urruneko zerbitzaria aurkitu</string>
+<string name="remote_server_timeout">Zerbitzariaren erantzunik ez</string>
+<string name="remote_server_error">Urruneko zerbitzariaren errorea</string>
+<string name="resource_constraint">baliabide-mugatua</string>
+<string name="service_unavailable">zerbitzu-eskuraezina</string>
+<string name="subscription_required">harpidetza-beharrezkoa</string>
+<string name="undefined_condition">definitu-gabeko-baldintza</string>
+<string name="unexpected_condition">ustekabeko-baldintza</string>
+<string name="request_timeout">eskaeraren-denbora-muga</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-fr/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"Content"</item>
+ <item msgid="1601611480575517120">"Triste"</item>
+ <item msgid="1531181614218625881">"Clin d\'œil"</item>
+ <item msgid="3858808057949077894">"Tire la langue"</item>
+ <item msgid="7835238297967185651">"Surpris"</item>
+ <item msgid="1756223535005296033">"Bisou"</item>
+ <item msgid="1093906245140165107">"Hurle"</item>
+ <item msgid="888834839864150170">"Cool"</item>
+ <item msgid="6320683740534773967">"Argent"</item>
+ <item msgid="6610111212478853990">"Embarrassé"</item>
+ <item msgid="1706035208563940251">"Gêné"</item>
+ <item msgid="9079275787422313427">"Ange"</item>
+ <item msgid="4630490399784004880">"Indécis"</item>
+ <item msgid="7002574538342357456">"Pleure"</item>
+ <item msgid="850324578089267455">"Motus"</item>
+ <item msgid="6334637439528489607">"Rigole"</item>
+ <item msgid="7602915122893958066">"Confus"</item>
+ <item msgid="3939233701582771068">"Cœur"</item>
+ <item msgid="1414759480575851587">"Mécontent"</item>
+ <item msgid="8479809115158836070">"Sourire en coin"</item>
+ <item msgid="638612939305162424">"Impassible"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-fr/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,312 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Generic terms -->
+ <string name="app_name">Beem</string>
+ <string name="OkButton">Valider</string>
+ <string name="ClearButton">Effacer</string>
+ <string name="CancelButton">Annuler</string>
+ <string name="AcceptButton">Autoriser</string>
+ <string name="RefuseButton">Refuser</string>
+ <string name="JabberID">Jabber ID</string>
+ <string name="Password">Mot de passe</string>
+ <string name="Continue">Suivant</string>
+
+ <!-- AccountConfigure class -->
+ <string name="AccountConfigureManualConfiguration">Configuration manuelle</string>
+
+ <!-- BeemService class -->
+ <string name="BeemServiceDescription">Utilisation du service Beem</string>
+
+ <!-- ContactDialog class -->
+ <string name="CDChat">Chat</string>
+ <string name="CDCall">Appeler</string>
+ <string name="CDInfos">Gestion utilisateur</string>
+
+ <!-- AddContact class -->
+ <string name="AddCActTitle">Beem - Ajouter un contact</string>
+
+ <string name="AddCLogin">Nom d\'utilisateur</string>
+ <string name="AddCAlias">Alias</string>
+ <string name="AddCGroup">Groupe</string>
+ <string name="AddCOkButton">Ajouter</string>
+ <string name="AddCContactAdded">Contact ajouté</string>
+ <string name="AddCContactAddedError">Erreur Contact non ajouté</string>
+ <string name="AddCContactAddedLoginError">Mauvais nom d\'utilisateur</string>
+ <string name="AddCContactAlready">Contact déjà ajouté</string>
+
+ <!-- ChangeStatus class -->
+ <string name="ChangeStatusActTitle">Beem - Changer mon statut</string>
+ <string name="ChangeStatusType">Mon statut</string>
+ <string name="ChangeStatusMessage">Mon message de statut</string>
+ <string name="OpenContactList">Ouvrir la liste des contacts</string>
+
+ <string name="ChangeStatusOk">Mise à jour du statut</string>
+ <string name="my_avatar">Mon avatar</string>
+ <string name="select_avatar">Choisissez votre avatar</string>
+ <string name="take_photo">Prendre une photo</string>
+ <string name="pick_photo">Choisir une image</string>
+ <string name="delete_avatar">Pas d\'avatar</string>
+ <string name="photoPickerNotFoundText">Sélecteur d\'image non disponible</string>
+
+ <!-- Settings class -->
+ <string name="SettingsProxy">Proxy</string>
+ <string name="SettingsProxyProxy">Utiliser un proxy</string>
+ <string name="SettingsProxySummary">Connectez vous à travers un serveur proxy</string>
+ <string name="SettingsProxyType">Protocole</string>
+ <string name="SettingsProxyTypeSummary">Permet de choisir le type de proxy à utiliser</string>
+ <string name="SettingsProxyServer">Saisissez l\'adresse du serveur proxy</string>
+ <string name="SettingsProxyPort">Saisissez le numéro de port du serveur proxy</string>
+ <string name="SettingsProxyUser">Optionnel, permet de s\'authentifier sur le proxy</string>
+ <string name="SettingsProxyPassword">Optionnel, permet de s\'authentifier sur le proxy</string>
+ <string name="SettingsAdvanced">Options avancées</string>
+ <string name="SettingsAdvancedRecoDelay">Modifier le délai de reconnexion</string>
+ <string name="SettingsAdvancedOptions">Options spécifiques</string>
+ <string name="SettingsAdvancedSpecOpt">Cochez cette option pour utiliser un serveur spécifique </string>
+ <string name="SettingsAdvancedAddOpt">Saisissez l\'adresse du serveur à joindre</string>
+ <string name="SettingsAdvancedPortOpt">Saisissez le port du serveur</string>
+ <string name="SettingsResourceTitle">Ressource</string>
+ <string name="SettingsPriorityTitle">Priorité</string>
+ <string name="SettingsResourceSummary">Saisissez la resource à partir de laquelle vous vous connectez</string>
+ <string name="SettingsPrioritySummary">Saisissez la priorité de votre client</string>
+ <string name="contact_list_preferences">Liste d\'ami(e)s</string>
+ <string name="contact_list_preferences_sum">Une série d\'options d\'affichage de votre liste
+ d\'ami(e)s</string>
+ <string name="CLP_hide_groups">Cachez les groupes</string>
+ <string name="CLP_hide_groups_sum">Cochez cette option pour cacher les groupes</string>
+ <string name="CLP_show_jid">Affichez les JID</string>
+ <string name="CLP_show_jid_sum">Cochez cette option pour afficher les JIDs des contacts</string>
+ <string name="CLP_hidden_contact">Cachez les contacts déconnectés</string>
+ <string name="CLP_hidden_contact_sum">Cochez cette option pour cacher les contacts déconnectés</string>
+ <string name="settings_account_username">Nom d\'utilisateur (JID)</string>
+ <string name="settings_account_password">Mot de passe</string>
+ <string name="settings_account_server">Serveur</string>
+ <string name="settings_account_port">Port</string>
+ <string name="settings_advanced_service_behaviour">Comportement du service</string>
+ <string name="settings_advanced_sum">Une série d\'options pour les utilisateurs avertis</string>
+ <string name="settings_xmpp_server">Serveur</string>
+ <string name="comments_xmpp_server">example.com</string>
+ <string name="settings_xmpp_port">Port</string>
+ <string name="comments_xmpp_port">Default: 5222</string>
+ <string name="settings_xmpp_use_tls">SSL/TLS obligatoire</string>
+ <string name="settings_reco_delay">Délai de reconnexion</string>
+ <string name="settings_proxy_sum">Paramètrez un serveur proxy</string>
+ <string name="settings_proxy_use">Utiliser un proxy</string>
+ <string name="settings_proxy_type_prompt">Choisir un type de proxy</string>
+ <string name="settings_proxy_server">Serveur</string>
+ <string name="settings_proxy_port">Port</string>
+ <string name="comments_proxy_port">Default: 1080</string>
+ <string name="settings_proxy_username">Nom d\'utilisateur</string>
+ <string name="settings_proxy_password">Mot de passe</string>
+ <string name="away_chk_title">Activer l\'absence automatique</string>
+ <string name="away_chk_sum">Change votre status en Absent automatiquement quand l\'écran du telephone s\'éteint</string>
+ <string name="away_message_title">Message d\'absence</string>
+ <string name="away_message_sum">Votre Message d\'absence</string>
+ <string name="away_message_hint">Je suis absent car mon ecran est éteint</string>
+ <string name="notification_preferences">Paramètres des notifications</string>
+ <string name="notification_enable_vibrate_title">Activer le vibreur</string>
+ <string name="notification_enable_vibrate_sum">Activer le vibreur pour les messages entrants</string>
+ <string name="notification_snd_title">Sonnerie des messages</string>
+ <string name="notification_snd_sum">Configurer la sonnerie des messages entrants</string>
+ <string name="settings_chat_compact">Chat compact</string>
+ <string name="settings_chat_compact_sum">Activer la fenetre Chat compact</string>
+ <string name="history">Historique</string>
+ <string name="history_sum">Cochez cette option pour enregistrer les discussions sur la SDCard</string>
+ <string name="chat_preferences">Chat</string>
+ <string name="chat_preferences_sum">Historique, taille de la fenêtre ...</string>
+ <string name="chat_history_path">Répertoire d\'historique</string>
+ <string name="chat_history_path_sum">Les conversations sont enregistrées dans un dossier sur la SDCard</string>
+ <string name="settings_smack_debug">Activer le debugger XMPP</string>
+ <string name="settings_full_jid_login">Utiliser le JID entier en tant que login</string>
+ <string name="settings_full_jid_login_sum">Nécessaire pour certains serveurs (Google Talk)</string>
+
+ <!-- Subscription class -->
+ <string name="SubscriptAccept">Inscription acceptée</string>
+ <string name="SubscriptError">Erreur d\'inscription</string>
+ <string name="SubscriptRefused">Inscription refusée</string>
+ <string name="SubscriptText">%s vient de vous ajouter à sa liste de contacts. Souhaitez-vous l\'autoriser ?</string>
+ <string name="SubscriptTitle">Autoriser ce contact ?</string>
+
+ <!-- BeemBroadcastReceiver class -->
+ <string name="BeemBroadcastReceiverDisconnect">BEEM: Vous avez été déconnecté(e)</string>
+
+ <!-- XmppConnectionAdapter class -->
+ <string name="AcceptContactRequest">%s vient de vous ajouter à sa liste d\'amis.</string>
+ <string name="AcceptContactRequestFrom">Autoriser %s à vous contacter.</string>
+
+ <!--
+ Services
+ -->
+
+ <!--
+ Activities
+ -->
+ <string name="edit_settings_name">Beem - Paramètres</string>
+ <string name="create_account_name">Beem - Créer un compte</string>
+ <string name="contact_list_name">Beem - Contacts</string>
+ <string name="user_info_name">Beem - Informations</string>
+
+ <!--
+ LogAs Activity
+ -->
+ <string name="login_menu_settings">Paramètres</string>
+ <string name="login_menu_about">A propos</string>
+ <string name="login_about_title">Beem %s - A propos</string>
+ <string name="login_about_msg">
+ Beem est un EPITECH Innovative Project. Rencontrez
+ nous sur http://www.beem-project.com !
+ </string>
+ <string name="login_about_button">Fermer</string>
+ <string name="login_login_progress">Connexion en cours. Veuillez patienter...</string>
+ <string name="login_menu_login">Se connecter</string>
+ <string name="login_start_msg">Configuration des informations dans le menu</string>
+
+ <!-- LoginAnim activity -->
+ <string name="loganim_connecting">Connexion en cours ...</string>
+ <string name="loganim_authenticating">Authentification ...</string>
+ <string name="loganim_login_success">Connexion effectuée</string>
+ <string name="loganim_login_failed">Echec de la connextion</string>
+
+ <!-- EditSettings Activity -->
+ <string name="settings_menu_create_account">Créer un compte</string>
+ <string name="settings_menu_privacy_lists">Gérer mes listes privées</string>
+ <string name="settings_saved_ok">Les paramètres ont été enregistrés avec succès.</string>
+
+ <!-- EditSettings Activity Categories -->
+ <string name="general_preferences">Préférences de l\'application</string>
+ <string name="user_preferences">Compte (obligatoire)</string>
+ <string name="user_preferences_advanced">Utilisateur avancés (facultatif)</string>
+ <string name="network_preferences">Options réseau</string>
+ <string name="proxy_proxy_settings">Paramètres du proxy</string>
+ <string name="proxy_user_settings">Identifiant proxy</string>
+
+ <!-- EditSettings Activity tabs -->
+ <string name="settings_tab_tag_account">edit_settings_tab_account</string>
+ <string name="settings_tab_label_account">Compte</string>
+ <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+ <string name="settings_tab_label_xmpp">XMPP</string>
+ <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+ <string name="settings_tab_label_proxy">Proxy</string>
+ <string name="history_preferences">Historique</string>
+ <string name="chat_layout_option">Fenêtre de chat</string>
+
+
+ <!-- wizard activities -->
+ <string name="account_wizard_text1"><b>Bienvenue sur BEEM.</b>\n\nVous n\'avez pas encore configuré de compte XMPP (Jabber).\nChoisissez une des options suivantes :</string>
+ <string name="account_wizard_configure_text_1">Utilisez un compte du terminal</string>
+ <string name="account_wizard_configure_text_2"><b>ou</b></string>
+ <string name="account_wizard_configure_text_3">Remplissez les informations de votre compte</string>
+ <string name="account_wizard_settings_warn"><b>Attention : </b>Vos paramètres indique d\'utiliser un serveur proxy ou un serveur spécifique.</string>
+ <string name="account_wizard_configure_account">Je possède déjà un compte que je veux utiliser.</string>
+ <string name="account_wizard_create_account">Je veux créer un nouveau compte</string>
+
+ <!--
+ Create an account Activity
+ -->
+ <string name="create_account_text">Entrez les informations nécéssaires pour créer votre compte</string>
+ <string name="create_account_progress_title">Création du compte</string>
+ <string name="create_account_progress_message">Veuillez patientez</string>
+ <string name="create_account_err_username">Mauvais JabberID</string>
+ <string name="create_account_err_passwords">Les mots de passe ne correspondent pas</string>
+ <string name="create_account_username">Nom d\'utilisateur</string>
+ <string name="create_account_password">Mot de passe</string>
+ <string name="create_account_confirm_password">Confirmation du mot de passe</string>
+ <string name="create_account_err_conflict">Ce compte est déjà utilisé. Essayez d\'en créer un autre</string>
+ <string name="create_account_err_connection">Le serveur choisi n\'est pas disponible. Essayez en un autre</string>
+
+ <!--
+ ContactList Activity
+ -->
+ <string name="contact_list_menu_add_contact">Ajouter un contact</string>
+ <string name="contact_list_menu_status">Changer son status</string>
+ <string name="contact_list_menu_settings">Paramètres</string>
+ <string name="contact_list_menu_disconnect">Se déconnecter</string>
+ <string name="contact_list_all_contact">Tous les contacts</string>
+ <string name="contact_list_no_group">Aucun groupe</string>
+
+
+ <!--
+ UserInfo Activity
+ -->
+ <string name="userinfo_label_alias">Alias</string>
+ <string name="userinfo_label_chg_group">Modifier groupe</string>
+ <string name="userinfo_label_re_subscription">Renvoyer l\'invitation</string>
+ <string name="userinfo_label_block">Bloquer</string>
+ <string name="userinfo_label_delete">Supprimer</string>
+ <string name="userinfo_resend">Souscription réenvoyée</string>
+ <string name="userinfo_sure2delete">Etes-vous sûr de vouloir supprimer ce contact ?</string>
+ <string name="userinfo_yes">Oui</string>
+ <string name="userinfo_no">Non</string>
+ <string name="userinfo_sureresend">Etes vous sûr de vouloir renvoyer l\'invitation ?</string>
+
+ <string name="chat_input_default_value">Saisissez votre message</string>
+ <string name="chat_name">Beem - Chat</string>
+ <string name="chat_self">Moi</string>
+ <string name="chat_error">Erreur</string>
+ <string name="chat_send_message">Envoyer</string>
+ <string name="chat_menu_contacts_list">Liste de contacts</string>
+ <string name="chat_menu_change_chat">Changer de conversation</string>
+ <string name="chat_dialog_change_chat_title">Conversations en cours</string>
+ <string name="chat_menu_close_chat">Fermer cette conversation</string>
+ <string name="chat_no_more_chats">Aucune conversation en cours</string>
+ <string name="chat_state_composing">est en train d\'écrire un message</string>
+ <string name="chat_state_gone">a quitté la conversation</string>
+ <string name="chat_state_active">prête attention à la conversation</string>
+ <string name="chat_state_inactive">fait quelque chose d\'autre</string>
+
+ <string name="contact_status_msg_available">Disponible</string>
+ <string name="contact_status_msg_available_chat">Disponible pour discuter</string>
+ <string name="contact_status_msg_dnd">Occupé(e)</string>
+ <string name="contact_status_msg_away">Absent(e)</string>
+ <string name="contact_status_msg_xa">Indisponible</string>
+ <string name="contact_status_msg_offline">Hors ligne</string>
+
+ <string name="privacy_list_name">Beem - Gérer mes listes privées</string>
+ <string name="privacy_list_no_data">Il n\'existe aucune liste privée enregistrée.</string>
+ <string name="privacy_list_menu_create">Créer une liste privée</string>
+ <string name="privacy_list_create_dialog_title">Créer une liste privée</string>
+ <string name="privacy_list_create_dialog_list_name_label">Titre</string>
+ <string name="privacy_list_create_dialog_create_button">Créer</string>
+ <string name="privacy_list_select_dialog_buddies">Contacts</string>
+ <string name="privacy_list_select_dialog_groups">Groupes</string>
+ <string name="privacy_list_select_dialog_delete">Supprimer</string>
+ <string name="privacy_list_delete_dialog_msg">Souhaitez-vous vraiment supprimer la liste privée intitulée \'%s\' ?</string>
+ <string name="privacy_list_delete_dialog_yes">Oui</string>
+ <string name="privacy_list_delete_dialog_no">Non</string>
+
+ <string name="UpdateButton">Mettre à jour</string>
+
+ <!-- MemorizingTrustManager library -->
+ <string name="mtm_accept_cert">Accepter un certificat de sécurité invalide ?</string>
+ <string name="mtm_decision_always">Toujours</string>
+ <string name="mtm_decision_once">Une fois</string>
+ <string name="mtm_decision_abort">Annuler</string>
+
+ <string name="mtm_notification">Certificate Verification</string>
+
+ <!-- Error messages -->
+ <string name="error_login_authentication">Erreur lors de l\'authenfitication, mauvais login ou password</string>
+ <string name="interna_server_error">Erreur survenu sur le serveur</string>
+ <string name="bad_request">bad-request</string>
+ <string name="forbidden">forbidden</string>
+ <string name="item_not_found">item-not-found</string>
+ <string name="conflict">conflict</string>
+ <string name="feature_not_implemented">feature-not-implemented</string>
+ <string name="gone">gone</string>
+ <string name="jid_malformed">jid-malformed</string>
+ <string name="no_acceptable">no-acceptable</string>
+ <string name="not_allowed">not-allowed</string>
+ <string name="not_authorized">not-authorized</string>
+ <string name="payment_required">payment-required</string>
+ <string name="recipient_unavailable">recipient-unavailable</string>
+ <string name="redirect">redirect</string>
+ <string name="registration_required">registration-required</string>
+ <string name="remote_server_not_found">Serveur non trouvé</string>
+ <string name="remote_server_timeout">Pas de réponse du serveur</string>
+ <string name="remote_server_error">Erreur survenu sur le serveur</string>
+ <string name="resource_constraint">resource-constraint</string>
+ <string name="service_unavailable">service-unavailable</string>
+ <string name="subscription_required">subscription-required</string>
+ <string name="undefined_condition">undefined-condition</string>
+ <string name="unexpected_condition">unexpected-condition</string>
+ <string name="request_timeout">request-timeout</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-it/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"Felice"</item>
+ <item msgid="1601611480575517120">"Triste"</item>
+ <item msgid="1531181614218625881">"Occhiolino"</item>
+ <item msgid="3858808057949077894">"Linguaccia"</item>
+ <item msgid="7835238297967185651">"Sorpreso"</item>
+ <item msgid="1756223535005296033">"Bacio"</item>
+ <item msgid="1093906245140165107">"Urlo"</item>
+ <item msgid="888834839864150170">"Fico"</item>
+ <item msgid="6320683740534773967">"Fatti, non parole"</item>
+ <item msgid="6610111212478853990">"Gaffe"</item>
+ <item msgid="1706035208563940251">"Imbarazzato"</item>
+ <item msgid="9079275787422313427">"Angelo"</item>
+ <item msgid="4630490399784004880">"Indeciso"</item>
+ <item msgid="7002574538342357456">"Piango"</item>
+ <item msgid="850324578089267455">"Labbra cucite"</item>
+ <item msgid="6334637439528489607">"Risata"</item>
+ <item msgid="7602915122893958066">"Confuso"</item>
+ <item msgid="3939233701582771068">"Cuore"</item>
+ <item msgid="1414759480575851587">"Arrabbiato"</item>
+ <item msgid="8479809115158836070">"Ghigno"</item>
+ <item msgid="638612939305162424">"Impassibile"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-it/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,310 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Generic terms -->
+ <string name="app_name">Beem</string>
+ <string name="OkButton">Ok</string>
+ <string name="ClearButton">Pulisci</string>
+ <string name="CancelButton">Annulla</string>
+ <string name="AcceptButton">Autorizza</string>
+ <string name="RefuseButton">Proibisci</string>
+ <string name="JabberID">Jabber ID</string>
+ <string name="Password">Password</string>
+ <string name="Continue">Continua</string>
+
+ <!-- AccountConfigure class -->
+ <string name="AccountConfigureManualConfiguration">Configurazione Manuale</string>
+
+ <!-- Beem class -->
+ <string name="BeemJabberID">Jabber ID</string>
+
+ <!-- BeemApplication class -->
+ <string name="BeemApplicationConnect">Connessione...</string>
+
+ <!-- BeemService class -->
+ <string name="BeemServiceDescription">Usa il sservizio Beem</string>
+ <string name="BeemServiceCreated">Create il servizio Bemm</string>
+ <string name="BeemServiceDestroyed">Rimosso il servizio Beem</string>
+
+ <!-- ContactDialog class -->
+ <string name="CDChat">Chat</string>
+ <string name="CDCall">Chiamate</string>
+ <string name="CDInfos">Gestisci Utente</string>
+
+ <!-- AddContact class -->
+ <string name="AddCActTitle">Beem - Aggiungi un contatto</string>
+
+ <string name="AddCLogin">Username</string>
+ <string name="AddCAlias">Alias</string>
+ <string name="AddCGroup">Gruppo</string>
+ <string name="AddCOkButton">Aggiungi</string>
+ <string name="AddCContactAdded">Aggiunto contatto</string>
+ <string name="AddCContactAddedError">Errore Contatto non aggiunto</string>
+ <string name="AddCContactAddedLoginError">Errore di accesso</string>
+ <string name="AddCBadForm">Forma errata</string>
+ <string name="AddCContactAlready">Contatto già esistente</string>
+
+ <!-- ChangeStatus class -->
+ <string name="ChangeStatusActTitle">Beem - Cambia il mio stato</string>
+ <string name="ChangeStatusType">Il mio stato</string>
+ <string name="ChangeStatusMessage">Messaggio personale</string>
+ <string name="OpenContactList">Apri lista contatti</string>
+
+ <string name="MenuAddContact">Aggiungi un nuovo cotatto</string>
+ <string name="MenuAccountAbout">Progetto Beem</string>
+ <string name="MenuAccountCreate">Crea un account</string>
+ <string name="MenuConnection">Modifica account</string>
+ <string name="ChangeStatusOk">Aggiornamento stato</string>
+ <string name="ChangeStatusNoChange">Nessun cambiamento</string>
+
+ <!-- Settings class -->
+ <string name="SettingsText">Modifica il tuo username</string>
+ <string name="SettingsPassword">Modifica la tua password</string>
+ <string name="SettingsProxy">Proxy</string>
+ <string name="SettingsProxyProxy">Usa un server proxy</string>
+ <string name="SettingsProxySummary">Accedi attraverso un server proxy</string>
+ <string name="SettingsProxyType">Protocollo</string>
+ <string name="SettingsProxyTypeSummary">Scegli il tipo del server proxy</string>
+ <string name="SettingsProxyServer">Modifica l\'indirizzo del server proxy</string>
+ <string name="SettingsProxyPort">Modifica la porta del server proxy</string>
+ <string name="SettingsProxyUser">Opzionale, permetti l\'autenticazione di te stesso sul server proxy</string>
+ <string name="SettingsProxyPassword">Opzionale, permetti l\'autenticazione di te stesso sul server proxy</string>
+ <string name="SettingsAdvanced">Avanzate</string>
+ <string name="SettingsAdvancedOptions">Opzioni specifiche del server</string>
+ <string name="SettingsAdvancedRecoDelay">Modifica ritardo di ri-connessione</string>
+ <string name="SettingsAdvancedSpecOpt">Abilita se vuoi usare un server specifico per la tua connessione</string>
+ <string name="SettingsAdvancedAddOpt">Modifica l\'indirizzo del server</string>
+ <string name="SettingsAdvancedPortOpt">Modifica la porta del server</string>
+ <string name="SettingsResourceTitle">Risorsa</string>
+ <string name="SettingsPriorityTitle">Priorità</string>
+ <string name="SettingsResourceSummary">Imposta la risorsa XMPP del tuo client </string>
+ <string name="SettingsPrioritySummary">Imposta la priorità del tuo client</string>
+ <string name="contact_list_preferences">Lista amici</string>
+ <string name="contact_list_preferences_sum">Un insieme di opzioni di visualizzazione per la tua lista amizie
+ </string>
+ <string name="CLP_hide_groups">Nascondi gruppi</string>
+ <string name="CLP_hide_groups_sum">Abilita quest\'opzione per nascondere i gruppi</string>
+ <string name="CLP_hidden_contact">Nascondi le amizie</string>
+ <string name="CLP_hidden_contact_sum">Abilita quest\'opzione per nascondere gli amici non connessi
+ </string>
+ <string name="settings_account_username">Username</string>
+ <string name="login_username_info_default">beem@beem-project.com</string>
+ <string name="settings_account_password">Password</string>
+ <string name="settings_account_server">Server</string>
+ <string name="settings_account_port">Porta</string>
+ <string name="settings_advanced_service_behaviour">Funzionamento del servizio</string>
+ <string name="settings_advanced_sum">Un insieme di opzioni per gli utenti avanzati</string>
+ <string name="settings_xmpp_server">Indirizzo</string>
+ <string name="comments_xmpp_server">example.com</string>
+ <string name="settings_xmpp_port">Porta</string>
+ <string name="settings_xmpp_use_tls">Usa SSL/TLS</string>
+ <string name="settings_reco_delay">Ritardo di ri-connessione</string>
+ <string name="comments_xmpp_port">Predefinita: 5222</string>
+ <string name="settings_proxy_sum">Impostazioni per l\'utilizzo del proxy</string>
+ <string name="settings_proxy_use">Connetti utilizzando un proxy</string>
+ <string name="settings_proxy_type_prompt">Scegli un tipo di proxy</string>
+ <string name="settings_proxy_server">Server</string>
+ <string name="settings_proxy_port">Porta</string>
+ <string name="comments_proxy_port">Predefinita: 1080</string>
+ <string name="settings_proxy_username">Username</string>
+ <string name="settings_proxy_password">Password</string>
+ <string name="away_chk_title">Abilita Auto-away</string>
+ <string name="away_chk_sum">Cambia lo stato ad Away quando lo schermo è spento</string>
+ <string name="away_message_title">Messaggio Away</string>
+ <string name="away_message_sum">Il messaggio Away che verrà mostrato</string>
+ <string name="away_message_hint">Non sono disponibile, il mio schermo è spento</string>
+ <string name="notification_preferences">Impostazioni di notifica</string>
+ <string name="notification_enable_vibrate_title">Abilita vibrazione</string>
+ <string name="notification_enable_vibrate_sum">Abilita vibrazione per i messaggi in arrivo</string>
+ <string name="notification_snd_title">Suoneria messaggi</string>
+ <string name="notification_snd_sum">Imposta la suoneria per i messaggi in arrivo</string>
+
+
+ <!-- Subscription class -->
+ <string name="SubscriptAccept">Sottoscrizione accettata</string>
+ <string name="SubscriptError">Errore nella sottoscrizione</string>
+ <string name="SubscriptRefused">Sottoscrizione refiutata</string>
+ <string name="SubscriptText">%s desidera aggiungerti nella sua lista di amicizie. Vuoi autorizzarlo/a?</string>
+ <string name="SubscriptTitle">Autorizza amicizia ?</string>
+
+ <!-- BeemChatManager -->
+ <string name="BeemChatManagerNewMessage">Hai un nuovo messaggio</string>
+
+ <!-- BeemBroadcastReceiver class -->
+ <string name="BeemBroadcastReceiverDisconnect">BEEM: sei stato disconnesso</string>
+
+ <!-- XmppConnectionAdapter class -->
+ <string name="AcceptContactRequest">%s ti ha appena aggiunto alla sue lista di amicizie.</string>
+ <string name="AcceptContactRequestFrom">Autorizza %s a contattarti.</string>
+
+ <!-- Activities -->
+ <string name="login_tag">Beem - Login Activity</string>
+ <string name="edit_settings_name">Beem - Settings</string>
+ <string name="edit_settings_tag">Beem - EditSettings Activity</string>
+ <string name="create_account_name">Beem - Create an account</string>
+ <string name="create_account_tag">Beem - CreateAccount Activity</string>
+ <string name="contact_list_name">Beem - Contacts</string>
+ <string name="contact_list_tag">Beem - ContactList Activity</string>
+ <string name="user_info_name">Beem - User Info</string>
+
+ <!-- Buttons -->
+ <string name="button_create_account">Crea questo account</string>
+ <string name="button_create_login_account">Crea ed usa questo account</string>
+
+ <!-- LogAs Activity -->
+ <string name="login_username">Username</string>
+ <string name="login_password">Password</string>
+ <string name="login_error_dialog_title">Accesso - Errore</string>
+ <string name="login_close_dialog_button">Chiudi</string>
+ <string name="login_menu_create_account">Crea un account</string>
+ <string name="login_menu_settings">Impostazioni</string>
+ <string name="login_menu_about">Informazioni su</string>
+ <string name="login_about_title">Beem %s - Informazioni</string>
+ <string name="login_about_msg">
+ Beem è un progetto innovativo EPITECH. Visitaci su
+ http://www.beem-project.com !
+ </string>
+ <string name="login_about_button">Chiudi</string>
+ <string name="login_settings_button">Impostazioni</string>
+ <string name="login_login_button">Accedi</string>
+ <string name="login_login_progress">Connessione in corso. Attendere...</string>
+ <string name="login_error_msg">Purtroppo, si è verificato un errore.\n\nDettagli
+ errore:\n%s</string>
+ <string name="login_menu_login">Accedi</string>
+ <string name="login_no_connectivity">Non è stata trovata la connessione internet</string>
+ <string name="login_start_msg">Impostazioni di configurazione nel menuSettings configuration in menu</string>
+
+ <!-- LoginAnim activity -->
+ <string name="loganim_connecting">Connessione in corso ...</string>
+ <string name="loganim_authenticating">Autenticazione ...</string>
+ <string name="loganim_login_success">Accesso riuscito</string>
+ <string name="loganim_login_failed">Accesso fallito</string>
+
+ <!-- EditSettings Activity -->
+ <string name="settings_menu_create_account">Crea un account</string>
+ <string name="settings_menu_privacy_lists">Gestisci le mie liste di privacy</string>
+ <string name="settings_saved_ok">Le impostazioni sono state salvate con successo.</string>
+
+
+
+ <!-- EditSettings Activity Categories -->
+ <string name="general_preferences">Preferenze generali</string>
+ <string name="user_preferences">Impostazioni utente (richiste)</string>
+ <string name="user_preferences_advanced">Impostazioni utente avanzate (opzionali)</string>
+ <string name="network_preferences">Opzioni rete</string>
+ <string name="proxy_proxy_settings">Impostazioni Proxy</string>
+ <string name="proxy_user_settings">Impostazioni Proxy</string>
+
+ <!-- EditSettings Activity Tabs -->
+ <string name="settings_tab_tag_account">edit_settings_tab_account</string>
+ <string name="settings_tab_label_account">Account</string>
+ <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+ <string name="settings_tab_label_xmpp">XMPP</string>
+ <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+ <string name="settings_tab_label_proxy">Proxy</string>
+
+
+ <!-- wizard activities -->
+ <string name="account_wizard_text1"><b>Benvenuto su BEEM.</b>\n\nNon hai ancora configurato un account XMPP (Jabber).\nScegli una delle seguenti opzioni :</string>
+ <string name="account_wizard_configure_text"><b>Si prega di compilare i dati per il vostro account esistente</b></string>
+ <string name="account_wizard_configure_account">Possiedo già un account che voglio</string>
+ <string name="account_wizard_create_account">Voglio registrare un nuovo account</string>
+
+ <!-- Create an account Activity -->
+ <string name="create_account_instr_dialog_title">Crea un account - Istruzioni</string>
+ <string name="create_account_err_dialog_title">Crea un account - Errore</string>
+ <string name="create_account_err_dialog_settings_button">Cambia le mie impostazioni</string>
+ <string name="create_account_close_dialog_button">Chiudi</string>
+ <string name="create_account_successfull_after">account %s è stato creato con successo</string>
+ <string name="create_account_err_username">Errato JabberID</string>
+ <string name="create_account_err_passwords">Le password non coincidono.</string>
+ <string name="create_account_username">Username</string>
+ <string name="create_account_password">Password</string>
+ <string name="create_account_confirm_password">Conferma password</string>
+
+ <!-- ContactList Activity -->
+ <string name="contact_list_menu_add_contact">Aggiungi un contatto</string>
+ <string name="contact_list_menu_status">Cambia stato</string>
+ <string name="contact_list_menu_settings">Impsotazioni</string>
+ <string name="contact_list_menu_disconnect">Disconnetti</string>
+ <string name="contact_list_all_contact">Tutti i contatti</string>
+ <string name="contact_list_no_group">Nessun gruppo</string>
+
+ <!-- UserInfo dialog -->
+ <string name="userinfo_label_alias">Alias</string>
+ <string name="userinfo_label_chg_group">Gestisci gruppi</string>
+ <string name="userinfo_label_re_subscription">Rimanda invito</string>
+ <string name="userinfo_label_block">Blocco</string>
+ <string name="userinfo_label_delete">Elimina</string>
+ <string name="userinfo_resend">Rimanda sottoscrizione</string>
+ <string name="userinfo_sure2delete">Sei sicuro di voler eliminare questo contatto?
+ </string>
+ <string name="userinfo_yes">Sì</string>
+ <string name="userinfo_no">No</string>
+ <string name="userinfo_sureresend">Sei sicuro di voler rispedire l\'invito ?</string>
+
+ <string name="chat_name">Beem - Chat</string>
+ <string name="chat_input_default_value">Scrivi il tuo messaggio</string>
+ <string name="chat_self">Io</string>
+ <string name="chat_error">Errore</string>
+ <string name="chat_send_message">Invia</string>
+ <string name="chat_menu_contacts_list">Lista contatti</string>
+ <string name="chat_menu_change_chat">Cambia conversazione</string>
+ <string name="chat_dialog_change_chat_title">Conversazioni aperte</string>
+ <string name="chat_menu_close_chat">Chiudi questa conversazione</string>
+ <string name="chat_no_more_chats">nessuna conversazione attiva</string>
+ <string name="chat_state_composing">sta componendo un messaggio</string>
+ <string name="chat_state_gone">ha abbandonato la conversazione</string>
+ <string name="chat_state_active">presta attenzione alla conversazione</string>
+ <string name="chat_state_inactive">sta facendo qualcos\'altro</string>
+
+ <string name="contact_status_msg_available">Disponibile</string>
+ <string name="contact_status_msg_available_chat">Disponibile a conversare</string>
+ <string name="contact_status_msg_dnd">Non disturbare</string>
+ <string name="contact_status_msg_away">Away</string>
+ <string name="contact_status_msg_xa">Non disponibile</string>
+ <string name="contact_status_msg_offline">Disconnesso</string>
+
+ <string name="privacy_list_name">Beem - Gestisci le mie liste di privacy</string>
+ <string name="privacy_list_no_data">Non c\'è alcuna lista di provacy registrata.</string>
+ <string name="privacy_list_menu_create">Crea una lista di privacy</string>
+ <string name="privacy_list_create_dialog_title">Crea una lista di privacy</string>
+ <string name="privacy_list_create_dialog_list_name_label">Titolo</string>
+ <string name="privacy_list_create_dialog_create_button">Creare</string>
+ <string name="privacy_list_select_dialog_buddies">Amicizie</string>
+ <string name="privacy_list_select_dialog_groups">Gruppi</string>
+ <string name="privacy_list_select_dialog_delete">Elimina</string>
+ <string name="privacy_list_delete_dialog_msg">Sei sicuro di voler eliminare la lista di privacy intitolata \'%s\' ?</string>
+ <string name="privacy_list_delete_dialog_yes">Sì</string>
+ <string name="privacy_list_delete_dialog_no">No</string>
+
+ <string name="UpdateButton">Aggiorna</string>
+
+ <!-- Error messages -->
+
+ <string name="error_login_authentication">Errore durante l\'autenticazione, login o password errati.</string>
+
+ <string name="interna_server_error">Errore del server remoto</string>
+ <string name="bad_request">bad-request</string>
+ <string name="forbidden">forbidden</string>
+ <string name="item_not_found">item-not-found</string>
+ <string name="conflict">conflict</string>
+ <string name="feature_not_implemented">feature-not-implemented</string>
+ <string name="gone">gone</string>
+ <string name="jid_malformed">jid-malformed</string>
+ <string name="no_acceptable">no-acceptable</string>
+ <string name="not_allowed">not-allowed</string>
+ <string name="not_authorized">not-authorized</string>
+ <string name="payment_required">payment-required</string>
+ <string name="recipient_unavailable">recipient-unavailable</string>
+ <string name="redirect">redirect</string>
+ <string name="registration_required">registration-required</string>
+ <string name="remote_server_not_found">Remote server not found</string>
+ <string name="remote_server_timeout">No server response</string>
+ <string name="remote_server_error">Remote server error</string>
+ <string name="resource_constraint">resource-constraint</string>
+ <string name="service_unavailable">service-unavailable</string>
+ <string name="subscription_required">subscription-required</string>
+ <string name="undefined_condition">undefined-condition</string>
+ <string name="unexpected_condition">unexpected-condition</string>
+ <string name="request_timeout">request-timeout</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-nb/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"Glad"</item>
+ <item msgid="1601611480575517120">"Trist"</item>
+ <item msgid="1531181614218625881">"Blunker"</item>
+ <item msgid="3858808057949077894">"Rekker tunge"</item>
+ <item msgid="7835238297967185651">"Overrasket"</item>
+ <item msgid="1756223535005296033">"Kyss"</item>
+ <item msgid="1093906245140165107">"Roper"</item>
+ <item msgid="888834839864150170">"Kul"</item>
+ <item msgid="6320683740534773967">"Pengemunn"</item>
+ <item msgid="6610111212478853990">"Fot i munnen"</item>
+ <item msgid="1706035208563940251">"Flau"</item>
+ <item msgid="9079275787422313427">"Engel"</item>
+ <item msgid="4630490399784004880">"Usikker"</item>
+ <item msgid="7002574538342357456">"Gråter"</item>
+ <item msgid="850324578089267455">"Stille som graven"</item>
+ <item msgid="6334637439528489607">"Ler"</item>
+ <item msgid="7602915122893958066">"Forvirret"</item>
+ <item msgid="3939233701582771068">"Hjerte"</item>
+ <item msgid="1414759480575851587">"Sint"</item>
+ <item msgid="8479809115158836070">"Glis"</item>
+ <item msgid="638612939305162424">"Pokerfjes"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-nb/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+<!-- Generic terms -->
+<string name="app_name">Beem</string>
+<string name="OkButton">Ok</string>
+<string name="ClearButton">Tøm</string>
+<string name="CancelButton">Avbryt</string>
+<string name="AcceptButton">Godkjenn</string>
+<string name="RefuseButton">Avslå</string>
+<string name="JabberID">Jabber-ID</string>
+<string name="Password">Passord</string>
+<string name="Continue">Fortsett</string>
+
+<!-- AccountConfigure class -->
+<string name="AccountConfigureManualConfiguration">Manuelt oppsett</string>
+
+<!-- Beem class -->
+<string name="BeemJabberID">Jabber-ID</string>
+
+<!-- BeemApplication class -->
+<string name="BeemApplicationConnect">Kobler til ...</string>
+
+<!-- BeemService class -->
+<string name="BeemServiceDescription">Bruk Beem tjeneste </string>
+<string name="BeemServiceCreated">Beem tjeneste opprettet</string>
+<string name="BeemServiceDestroyed">Beem tjeneste slettet</string>
+
+<!-- ContactDialog class -->
+<string name="CDChat">Prat</string>
+<string name="CDCall">Ring</string>
+<string name="CDInfos">Behandle kontakt</string>
+
+<!-- AddContact class -->
+<string name="AddCActTitle">Beem - legg til en kontakt</string>
+
+<string name="AddCLogin">Brukernavn</string>
+<string name="AddCAlias">Alias</string>
+<string name="AddCGroup">Gruppe</string>
+<string name="AddCOkButton">Legg til</string>
+<string name="AddCContactAdded">Kontakt lagt til</string>
+<string name="AddCContactAddedError">Feil ved lagring av kontakt</string>
+<string name="AddCContactAddedLoginError">Feil ved innlogging</string>
+<string name="AddCBadForm">Feil utfylt</string>
+<string name="AddCContactAlready">Kontakten finnes allerede</string>
+
+<!-- ChangeStatus class -->
+<string name="ChangeStatusActTitle">Beem - Endre status</string>
+<string name="ChangeStatusType">Min status</string>
+<string name="ChangeStatusMessage">Min personlige melding</string>
+<string name="OpenContactList">Åpne kontaktlista</string>
+
+<string name="MenuAddContact">Legg til ny kontakt</string>
+<string name="MenuAccountAbout">Beem-prosjektet</string>
+<string name="MenuAccountCreate">Opprett konto</string>
+<string name="MenuConnection">Rediger konto</string>
+<string name="ChangeStatusOk">Oppdaterer status</string>
+<string name="ChangeStatusNoChange">Ingen endringer</string>
+<string name="my_avatar">Mitt personbilde</string>
+<string name="select_avatar">Velg ditt personbilde</string>
+<string name="take_photo">Ta et bilde</string>
+<string name="pick_photo">Velg et bilde</string>
+<string name="delete_avatar">Ingen personbilde</string>
+<string name="photoPickerNotFoundText">Bildevelger ikke funnet</string>
+
+
+<!-- Settings class -->
+<string name="SettingsText">Rediger brukernavn</string>
+<string name="SettingsPassword">Rediger passord</string>
+<string name="SettingsProxy">Mellomtjener</string>
+<string name="SettingsProxyProxy">Bruk en mellomtjener</string>
+<string name="SettingsProxySummary">Logg inn via en mellomtjener</string>
+<string name="SettingsProxyType">Protokoll</string>
+<string name="SettingsProxyTypeSummary">Velg mellomtjenertype</string>
+<string name="SettingsProxyServer">Rediger mellomtjeneradresse</string>
+<string name="SettingsProxyPort">Rediger mellomtjenerport</string>
+<string name="SettingsProxyUser">Valgfritt, tillat autentisering på mellomtjeneren</string>
+<string name="SettingsProxyPassword">Valgfritt, tillat autentisering på mellomtjeneren</string>
+<string name="SettingsAdvanced">Avansert</string>
+<string name="SettingsAdvancedOptions">Spesielle tjenerinnstilling</string>
+<string name="SettingsAdvancedRecoDelay">Endre forsinkelse ved ny tilkobling</string>
+<string name="SettingsAdvancedSpecOpt">Aktiver hvis du vil bruke en spesifikk tjener for din tilkobling</string>
+<string name="SettingsAdvancedAddOpt">Rediger tjeneradresse</string>
+<string name="SettingsAdvancedPortOpt">Rediger tjenerport</string>
+<string name="SettingsResourceTitle">Ressurs</string>
+<string name="SettingsPriorityTitle">Prioritet</string>
+<string name="SettingsResourceSummary">Velg XMPP ressurs for denne klienten</string>
+<string name="SettingsPrioritySummary">Velg prioritet for denne klienten</string>
+<string name="contact_list_preferences">Kontaktliste</string>
+<string name="contact_list_preferences_sum">A set of display options for your buddy list
+</string>
+<string name="CLP_hide_groups">Skjul grupper</string>
+<string name="CLP_hide_groups_sum">Aktiver for å skjule grupper</string>
+<string name="CLP_hidden_contact">Skjul kontakter</string>
+<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
+</string>
+<string name="settings_account_username">Brukernavn (JID)</string>
+<string name="login_username_info_default">beem@beem-project.com</string>
+<string name="settings_account_password">Passord</string>
+<string name="settings_account_server">Tjener</string>
+<string name="settings_account_port">Port</string>
+<string name="settings_advanced_service_behaviour">Tjenesteoppførsel</string>
+<string name="settings_advanced_sum">Innstillinger for avanserte brukere</string>
+<string name="settings_xmpp_server">Adresse</string>
+<string name="comments_xmpp_server">example.com</string>
+<string name="settings_xmpp_port">Port</string>
+<string name="settings_xmpp_use_tls">Krev SSL/TLS</string>
+<string name="settings_reco_delay">Forsinkelse ved ny tilkobling</string>
+<string name="comments_xmpp_port">Standard: 5222</string>
+<string name="settings_proxy_sum">Innstillinger for bruk av mellomtjener</string>
+<string name="settings_proxy_use">Koble til via en mellomtjener</string>
+<string name="settings_proxy_type_prompt">Velg mellomtjenertype</string>
+<string name="settings_proxy_server">Tjener</string>
+<string name="settings_proxy_port">Port</string>
+<string name="comments_proxy_port">Standard: 1080</string>
+<string name="settings_proxy_username">Brukernavn</string>
+<string name="settings_proxy_password">Passord</string>
+<string name="away_chk_title">Bruk auto-borte</string>
+<string name="away_chk_sum">Endre status til borte når skjermen er av</string>
+<string name="away_message_title">Borte-melding</string>
+<string name="away_message_sum">Borte-melding som vil bli vist</string>
+<string name="away_message_hint">Jeg er borte, telefonens skjerm er av</string>
+<string name="notification_preferences">Varslingsinnstillinger</string>
+<string name="notification_enable_vibrate_title">Bruk vibrasjon</string>
+<string name="notification_enable_vibrate_sum">Bruk vibrasjon ved innkommende meldinger</string>
+<string name="notification_snd_title">Meldingsringetone</string>
+<string name="notification_snd_sum">Velg ringetone for innkommende meldinger</string>
+<string name="settings_chat_compact">Kompakt pratevindu</string>
+<string name="settings_chat_compact_sum">Velg kompakt pratevindu</string>
+<string name="history">Historikk</string>
+<string name="history_sum">Aktiver for å lagre meldinger på minnekortet</string>
+<string name="history_mount">Du trenger et montert og skrivebart minnekort for å kunne aktivere historikk</string>
+<string name="history_on_off">Aktiver historikk</string>
+<string name="chat_preferences">Prat</string>
+<string name="chat_preferences_sum">Historikk, utseende ...</string>
+<string name="chat_history_path">Sti til historikk</string>
+<string name="chat_history_path_sum">Samtaler lagres i en mappe på minnekortet</string>
+<string name="settings_smack_debug">Aktiver XMPP feilsøking</string>
+<string name="settings_full_jid_login">Bruk full JID som brukernavn</string>
+<string name="settings_full_jid_login_sum">Kreves på visse tjenere slik som Google Talk</string>
+
+<!-- Subscription class -->
+<string name="SubscriptAccept">Abonnement godkjent</string>
+<string name="SubscriptError">Feil ved abonnement</string>
+<string name="SubscriptRefused">Abonnement avslått</string>
+<string name="SubscriptText">%s ønsker å legge deg til sin kontaktliste. Godkjenne forespørselen?</string>
+<string name="SubscriptTitle">Godkjenne kontakt?</string>
+
+<!-- BeemChatManager -->
+<string name="BeemChatManagerNewMessage">Du har en ny melding</string>
+
+<!-- BeemBroadcastReceiver class -->
+<string name="BeemBroadcastReceiverDisconnect">BEEM: du har koblet fra</string>
+
+<!-- XmppConnectionAdapter class -->
+<string name="AcceptContactRequest">%s har lagt deg til sin kontaktliste</string>
+<string name="AcceptContactRequestFrom">Godkjenn at %s kontakter deg</string>
+
+<!-- Activities -->
+<string name="login_tag">Beem - Aktivitet innlogging</string>
+<string name="edit_settings_name">Beem - Innstillinger</string>
+<string name="edit_settings_tag">Beem - Aktivitet innstillinger</string>
+<string name="create_account_name">Beem - Opprett konto</string>
+<string name="create_account_tag">Beem - Aktivitet opprett konto</string>
+<string name="contact_list_name">Beem - Kontakter</string>
+<string name="contact_list_tag">Beem - Aktivitet kontaktliste</string>
+<string name="user_info_name">Beem - Brukerinformasjon</string>
+
+<!-- Buttons -->
+<string name="button_create_account">Opprett kontoen</string>
+<string name="button_create_login_account">Opprett og bruk kontoen</string>
+
+<!-- LogAs Activity -->
+<string name="login_username">Brukernavn</string>
+<string name="login_password">Passord</string>
+<string name="login_error_dialog_title">Feil ved innlogging</string>
+<string name="login_close_dialog_button">Lukk</string>
+<string name="login_menu_create_account">Opprett konto</string>
+<string name="login_menu_settings">Innstillinger</string>
+<string name="login_menu_about">Om</string>
+<string name="login_about_title">Beem %s - Om</string>
+<string name="login_about_msg">
+Beem is an EPITECH Innovative Project. Visit us at
+http://www.beem-project.com !
+</string>
+<string name="login_about_button">Lukk</string>
+<string name="login_settings_button">Innstillinger</string>
+<string name="login_login_button">Logg inn</string>
+<string name="login_login_progress">Kobler til ...</string>
+<string name="login_error_msg">Unfortunately, an error occured.\n\nError
+detail:\n%s</string>
+<string name="login_menu_login">Innlogging</string>
+<string name="login_no_connectivity">Ingen nettforbindelse funnet</string>
+<string name="login_start_msg">Innstillinger i menyen</string>
+
+<!-- LoginAnim activity -->
+<string name="loganim_connecting">Kobler til ...</string>
+<string name="loganim_authenticating">Autentiserer ...</string>
+<string name="loganim_login_success">Innlogging vellykket</string>
+<string name="loganim_login_failed">Feil ved innlogging</string>
+
+<!-- EditSettings Activity -->
+<string name="settings_menu_create_account">Opprett en konto</string>
+<string name="settings_menu_privacy_lists">Behandle personvernlister</string>
+<string name="settings_saved_ok">Innstillinger lagret</string>
+
+
+
+<!-- EditSettings Activity Categories -->
+<string name="general_preferences">Generelle innstillinger</string>
+<string name="user_preferences">Brukerinnstillinger (kreves)</string>
+<string name="user_preferences_advanced">Avanserte brukerinnstillinger (valgfritt)</string>
+<string name="network_preferences">Nettverksinnstillinger</string>
+<string name="proxy_proxy_settings">Tjenerinnstillinger</string>
+<string name="proxy_user_settings">Tjenerinnstillinger</string>
+<string name="history_preferences">Historikk</string>
+<string name="chat_layout_option">Utseende</string>
+
+
+<!-- EditSettings Activity Tabs -->
+<string name="settings_tab_tag_account">edit_settings_tab_account</string>
+<string name="settings_tab_label_account">Konto</string>
+<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+<string name="settings_tab_label_xmpp">XMPP</string>
+<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+<string name="settings_tab_label_proxy">Tjener</string>
+
+
+<!-- wizard activities -->
+<string name="account_wizard_text1"><b>Velkomment til BEEM.</b>nnDu har ikke satt opp en XMPP (Jabber) konto.nVelg et av følgende alternativ :</string>
+<string name="account_wizard_configure_text"><b>Fyll inn informasjon for din eksisterende konto</b></string>
+<string name="account_wizard_configure_account">Jeg har en konto som jeg ønsker å bruke</string>
+<string name="account_wizard_create_account">Jeg ønsker å registrer en ny konto</string>
+
+<!-- Create an account Activity -->
+<string name="create_account_instr_dialog_title">Opprett en konto - Veiledning</string>
+<string name="create_account_err_dialog_title">Opprett en konto - Feil</string>
+<string name="create_account_err_dialog_settings_button">Endre innstillinger</string>
+<string name="create_account_close_dialog_button">Lukk</string>
+<string name="create_account_successfull_after">Konto %s opprettet</string>
+<string name="create_account_err_username">Ugyldig JabberID</string>
+<string name="create_account_err_passwords">Passordene er ikke like</string>
+<string name="create_account_username">Brukernavn</string>
+<string name="create_account_password">Passord</string>
+<string name="create_account_confirm_password">Bekreft passord</string>
+
+<!-- ContactList Activity -->
+<string name="contact_list_menu_add_contact">Legg til kontakt</string>
+<string name="contact_list_menu_status">Endre status</string>
+<string name="contact_list_menu_settings">Innstillinger</string>
+<string name="contact_list_menu_disconnect">Koble fra</string>
+<string name="contact_list_all_contact">Alle kontakter</string>
+<string name="contact_list_no_group">Ingen gruppe</string>
+
+<!-- UserInfo dialog -->
+<string name="userinfo_label_alias">Alias</string>
+<string name="userinfo_label_chg_group">Behandle grupper</string>
+<string name="userinfo_label_re_subscription">Send invitasjon på nytt</string>
+<string name="userinfo_label_block">Blokker</string>
+<string name="userinfo_label_delete">Slett</string>
+<string name="userinfo_resend">Send abonnement på nytt</string>
+<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
+</string>
+<string name="userinfo_yes">Ja</string>
+<string name="userinfo_no">Nei</string>
+<string name="userinfo_sureresend">Sende invitasjon på nytt?</string>
+
+<string name="chat_name">Beep - Prat</string>
+<string name="chat_input_default_value">Skriv melding</string>
+<string name="chat_self">Meg</string>
+<string name="chat_error">Feil</string>
+<string name="chat_send_message">Send</string>
+<string name="chat_menu_contacts_list">Kontaktliste</string>
+<string name="chat_menu_change_chat">Veksle prateøkt</string>
+<string name="chat_menu_start_otr_session">Start OTR-økt</string>
+<string name="chat_menu_stop_otr_session">Stopp OTR-økt</string>
+<string name="chat_menu_otr_verify_key">OTR-kontrollnøkkel</string>
+<string name="chat_menu_otr_submenu">OTR-handlinger</string>
+<string name="chat_dialog_change_chat_title">Åpne prateøkter</string>
+<string name="chat_menu_close_chat">Lukk denne prateøkten</string>
+<string name="chat_no_more_chats">Ingen flere aktive prateøkter</string>
+<string name="chat_state_composing">skriver en melding</string>
+<string name="chat_state_gone">har lukket prateøkten</string>
+<string name="chat_state_active">følger med på prateøkten</string>
+<string name="chat_state_inactive">gjør noe annet</string>
+<string name="chat_otrstate_plaintext">KLARTEKST</string>
+<string name="chat_otrstate_encrypted">KRYPTERT</string>
+<string name="chat_otrstate_finished">AVSLUTTET</string>
+<string name="chat_otrstate_authenticated">AUTENTISERT</string>
+<string name="chat_otr_verify_key" formatted="false">
+Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
+To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
+If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
+Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
+
+<string name="contact_status_msg_available">Tilgjengelig</string>
+<string name="contact_status_msg_available_chat">Tilgjengelig for prat</string>
+<string name="contact_status_msg_dnd">Ikke forstyrr</string>
+<string name="contact_status_msg_away">Borte</string>
+<string name="contact_status_msg_xa">Ikke tilgjengelig</string>
+<string name="contact_status_msg_offline">Koblet fra</string>
+
+<string name="privacy_list_name">Beem - Behandle personvernlister</string>
+<string name="privacy_list_no_data">Ingen registrerte personvernlister</string>
+<string name="privacy_list_menu_create">Opprett en personvernliste</string>
+<string name="privacy_list_create_dialog_title">Opprett en personvernliste</string>
+<string name="privacy_list_create_dialog_list_name_label">Tittel</string>
+<string name="privacy_list_create_dialog_create_button">Opprett</string>
+<string name="privacy_list_select_dialog_buddies">Kontakter</string>
+<string name="privacy_list_select_dialog_groups">Grupper</string>
+<string name="privacy_list_select_dialog_delete">Slett</string>
+<string name="privacy_list_delete_dialog_msg">Slette personvernliste \'%s\'?</string>
+<string name="privacy_list_delete_dialog_yes">Ja</string>
+<string name="privacy_list_delete_dialog_no">Nei</string>
+
+<string name="UpdateButton">Oppdater</string>
+
+<!-- MemorizingTrustManager library -->
+<string name="mtm_accept_cert">Godkjenn ukjent sertifikat</string>
+<string name="mtm_decision_always">Alltid</string>
+<string name="mtm_decision_once">Denne gangen</string>
+<string name="mtm_decision_abort">Avbryt</string>
+
+<string name="mtm_notification">Sertifikatkontroll</string>
+
+<!-- Error messages -->
+
+<string name="error_login_authentication">Feil ved innlogging, feil brukernavn eller passord</string>
+
+<string name="interna_server_error">Remote server error</string>
+<string name="bad_request">bad-request</string>
+<string name="forbidden">forbidden</string>
+<string name="item_not_found">item-not-found</string>
+<string name="conflict">conflict</string>
+<string name="feature_not_implemented">feature-not-implemented</string>
+<string name="gone">gone</string>
+<string name="jid_malformed">jid-malformed</string>
+<string name="no_acceptable">no-acceptable</string>
+<string name="not_allowed">not-allowed</string>
+<string name="not_authorized">not-authorized</string>
+<string name="payment_required">payment-required</string>
+<string name="recipient_unavailable">recipient-unavailable</string>
+<string name="redirect">redirect</string>
+<string name="registration_required">registration-required</string>
+<string name="remote_server_not_found">Remote server not found</string>
+<string name="remote_server_timeout">No server response</string>
+<string name="remote_server_error">Remote server error</string>
+<string name="resource_constraint">resource-constraint</string>
+<string name="service_unavailable">service-unavailable</string>
+<string name="subscription_required">subscription-required</string>
+<string name="undefined_condition">undefined-condition</string>
+<string name="unexpected_condition">unexpected-condition</string>
+<string name="request_timeout">request-timeout</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-pt/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"Feliz"</item>
+ <item msgid="1601611480575517120">"Triste"</item>
+ <item msgid="1531181614218625881">"Piscando"</item>
+ <item msgid="3858808057949077894">"Mostrando a língua"</item>
+ <item msgid="7835238297967185651">"Surpreso"</item>
+ <item msgid="1756223535005296033">"Beijando"</item>
+ <item msgid="1093906245140165107">"Gritando"</item>
+ <item msgid="888834839864150170">"Tranquilo"</item>
+ <item msgid="6320683740534773967">"Louco por dinheiro"</item>
+ <item msgid="6610111212478853990">"Falei besteira"</item>
+ <item msgid="1706035208563940251">"Envergonhado"</item>
+ <item msgid="9079275787422313427">"Anjo"</item>
+ <item msgid="4630490399784004880">"Indeciso"</item>
+ <item msgid="7002574538342357456">"Chorando"</item>
+ <item msgid="850324578089267455">"Boca fechada"</item>
+ <item msgid="6334637439528489607">"Rindo"</item>
+ <item msgid="7602915122893958066">"Confuso"</item>
+ <item msgid="3939233701582771068">"Coração"</item>
+ <item msgid="1414759480575851587">"Louco"</item>
+ <item msgid="8479809115158836070">"Sorriso forçado"</item>
+ <item msgid="638612939305162424">"Indiferente"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-pt/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Generic terms -->
+ <string name="app_name">Beem</string>
+ <string name="OkButton">Ok</string>
+ <string name="ClearButton">Limpar</string>
+ <string name="CancelButton">Cancelar</string>
+ <string name="AcceptButton">Autorizar</string>
+ <string name="RefuseButton">Negar</string>
+ <string name="JabberID">Jabber ID</string>
+ <string name="Password">Senha</string>
+ <string name="Continue">Continuar</string>
+
+ <!-- AccountConfigure class -->
+ <string name="AccountConfigureManualConfiguration">Configuração Manual</string>
+
+ <!-- Beem class -->
+ <string name="BeemJabberID">Jabber ID</string>
+
+ <!-- BeemApplication class -->
+ <string name="BeemApplicationConnect">Conectando...</string>
+
+ <!-- BeemService class -->
+ <string name="BeemServiceDescription">Utilizar Serviço Beem</string>
+ <string name="BeemServiceCreated">Serviço Beem Criado</string>
+ <string name="BeemServiceDestroyed">Serviço Beem Destruído</string>
+
+ <!-- ContactDialog class -->
+ <string name="CDChat">Conversa</string>
+ <string name="CDCall">Chamada</string>
+ <string name="CDInfos">Gerenciar Usuário</string>
+
+ <!-- AddContact class -->
+ <string name="AddCActTitle">Beem - Adicionar usuário</string>
+
+ <string name="AddCLogin">Login</string>
+ <string name="AddCAlias">Apelido</string>
+ <string name="AddCGroup">Grupo</string>
+ <string name="AddCOkButton">Adicionar</string>
+ <string name="AddCContactAdded">Contato Adicionado</string>
+ <string name="AddCContactAddedError">Erro: Contato não adicionado</string>
+ <string name="AddCContactAddedLoginError">Erro de login</string>
+ <string name="AddCBadForm">Jabber ID mal formado</string>
+ <string name="AddCContactAlready">Contato já existe</string>
+
+ <!-- ChangeStatus class -->
+ <string name="ChangeStatusActTitle">Beem - Alterar meu status</string>
+ <string name="ChangeStatusType">Meu status</string>
+ <string name="ChangeStatusMessage">Minha mensagem pessoal</string>
+ <string name="OpenContactList">Abrir lista de contatos</string>
+
+ <string name="MenuAddContact">Adicionar contato</string>
+ <string name="MenuAccountAbout">Projeto Beem</string>
+ <string name="MenuAccountCreate">Criar conta</string>
+ <string name="MenuConnection">Editar conta</string>
+ <string name="ChangeStatusOk">Atualizando status</string>
+ <string name="ChangeStatusNoChange">Nada a alterar</string>
+ <string name="my_avatar">Meu avatar</string>
+ <string name="select_avatar">Escolha o seu avatar</string>
+ <string name="take_photo">Tirar uma foto</string>
+ <string name="pick_photo">Selecionar imagem</string>
+ <string name="delete_avatar">Sem avatar</string>
+ <string name="photoPickerNotFoundText">Selecionador de fotos não encontrado</string>
+
+
+ <!-- Settings class -->
+ <string name="SettingsText">Editar seu login</string>
+ <string name="SettingsPassword">Editar sua senha</string>
+ <string name="SettingsProxy">Proxy</string>
+ <string name="SettingsProxyProxy">Usar um servidor de proxy</string>
+ <string name="SettingsProxySummary">Efetuar login através de um proxy</string>
+ <string name="SettingsProxyType">Protocolo</string>
+ <string name="SettingsProxyTypeSummary">Selecione um tipo de proxy</string>
+ <string name="SettingsProxyServer">Editar endereço do proxy</string>
+ <string name="SettingsProxyPort">Editar porta do proxy</string>
+ <string name="SettingsProxyUser">Opcional, permite autenticar no servidor de proxy</string>
+ <string name="SettingsProxyPassword">Optional, permite autenticar no servidor de proxy</string>
+ <string name="SettingsAdvanced">Avançado</string>
+ <string name="SettingsAdvancedOptions">Opções de servidor</string>
+ <string name="SettingsAdvancedRecoDelay">Modificar atraso de conexão</string>
+ <string name="SettingsAdvancedSpecOpt">Marque essa caixa se você quer utilizar um servidor específico para a sua conexão</string>
+ <string name="SettingsAdvancedAddOpt">Editar o endereço do servidor</string>
+ <string name="SettingsAdvancedPortOpt">Editar a porta do servidor</string>
+ <string name="SettingsResourceTitle">Recurso</string>
+ <string name="SettingsPriorityTitle">Prioridade</string>
+ <string name="SettingsResourceSummary">Configurar o recurso XMPP do seu cliente</string>
+ <string name="SettingsPrioritySummary">Configurar a prioridade do seu cliente</string>
+ <string name="contact_list_preferences">Lista de contatos</string>
+ <string name="contact_list_preferences_sum">Um conjunto de opções de visualização para a sua lista de contatos
+ </string>
+ <string name="CLP_hide_groups">Ocultar grupos</string>
+ <string name="CLP_hide_groups_sum">Marque essa opção para ocultar grupos</string>
+ <string name="CLP_hidden_contact">Ocultar contatos</string>
+ <string name="CLP_hidden_contact_sum">Marque essa opção para ocultar contatos desconectados
+ </string>
+ <string name="settings_account_username">Login (JID)</string>
+ <string name="login_username_info_default">beem@beem-project.com</string>
+ <string name="settings_account_password">Senha</string>
+ <string name="settings_account_server">Servidor</string>
+ <string name="settings_account_port">Porta</string>
+ <string name="settings_advanced_service_behaviour">Comportamento do serviço</string>
+ <string name="settings_advanced_sum">Um conjunto de opções para usuários avançados</string>
+ <string name="settings_xmpp_server">Endereço</string>
+ <string name="comments_xmpp_server">exemplo.com</string>
+ <string name="settings_xmpp_port">Porta</string>
+ <string name="settings_xmpp_use_tls">Requer SSL/TLS</string>
+ <string name="settings_reco_delay">Atraso de desconexão</string>
+ <string name="comments_xmpp_port">Padrão: 5222</string>
+ <string name="settings_proxy_sum">Configurações de uso de proxy</string>
+ <string name="settings_proxy_use">Conectar usando um proxy</string>
+ <string name="settings_proxy_type_prompt">Escolha o tipo de proxy</string>
+ <string name="settings_proxy_server">Servidor</string>
+ <string name="settings_proxy_port">Porta</string>
+ <string name="comments_proxy_port">Padrão: 1080</string>
+ <string name="settings_proxy_username">Login</string>
+ <string name="settings_proxy_password">Senha</string>
+ <string name="away_chk_title">Habilitar ausência automática</string>
+ <string name="away_chk_sum">Muda o statos para ausente quando a tela é desligada</string>
+ <string name="away_message_title">Mensagem de ausência</string>
+ <string name="away_message_sum">A mensagem de ausência que será exibida</string>
+ <string name="away_message_hint">Estou ausente, a tela do meu celular está desligada</string>
+ <string name="notification_preferences">Configurações de notificação</string>
+ <string name="notification_enable_vibrate_title">Vibrar</string>
+ <string name="notification_enable_vibrate_sum">Habilita a vibração quando receber mensagens</string>
+ <string name="notification_snd_title">Toque de mensagem</string>
+ <string name="notification_snd_sum">Configura o toque de recebimento de mensagens</string>
+ <string name="settings_chat_compact">Conversa compacta</string>
+ <string name="settings_chat_compact_sum">Habilita o modo compacto da janela de chat</string>
+ <string name="history">Histórico</string>
+ <string name="history_sum">Marque se você deseja gravar o histórico de conversas no seu cartão SD</string>
+ <string name="history_mount">Você precisa ter um cartão SD montado e com permissão de escrita para habilitar o histórico</string>
+ <string name="history_on_off">Habilita histórico de mensagens</string>
+ <string name="chat_preferences">Conversa</string>
+ <string name="chat_preferences_sum">Histórico, Tamanho do layout ...</string>
+ <string name="chat_history_path">Caminho do histórico</string>
+ <string name="chat_history_path_sum">Conversas serão gravadas em uma pasta no cartão SD</string>
+ <string name="settings_smack_debug">Habilitar debug XMPP</string>
+ <string name="settings_full_jid_login">Utilizar meu JID completo como login</string>
+ <string name="settings_full_jid_login_sum">Necessário para alguns servidores, como o Google Talk</string>
+
+ <!-- Subscription class -->
+ <string name="SubscriptAccept">Subscrição aceita</string>
+ <string name="SubscriptError">Erro de subscrição</string>
+ <string name="SubscriptRefused">Subscrição recusada</string>
+ <string name="SubscriptText">%s quer te adicionar como contato. Você autoriza?</string>
+ <string name="SubscriptTitle">Autorizar contato?</string>
+
+ <!-- BeemChatManager -->
+ <string name="BeemChatManagerNewMessage">Você tem uma nova mensagem</string>
+
+ <!-- BeemBroadcastReceiver class -->
+ <string name="BeemBroadcastReceiverDisconnect">BEEM: Você foi desconectado</string>
+
+ <!-- XmppConnectionAdapter class -->
+ <string name="AcceptContactRequest">%s te adicionou na lista de contatos.</string>
+ <string name="AcceptContactRequestFrom">Autorizar %s para contactar você.</string>
+
+ <!-- Activities -->
+ <string name="login_tag">Beem - Atividade de login</string>
+ <string name="edit_settings_name">Beem - Configurações</string>
+ <string name="edit_settings_tag">Beem - Atividade de configurações</string>
+ <string name="create_account_name">Beem - Criar uma conta</string>
+ <string name="create_account_tag">Beem - Atividade de criar conta</string>
+ <string name="contact_list_name">Beem - Lista de contatos</string>
+ <string name="contact_list_tag">Beem - Atividade de lista de contatos</string>
+ <string name="user_info_name">Beem - Informações de usuário</string>
+
+ <!-- Buttons -->
+ <string name="button_create_account">Criar conta</string>
+ <string name="button_create_login_account">Criar e utilizar conta</string>
+
+ <!-- LogAs Activity -->
+ <string name="login_username">Login</string>
+ <string name="login_password">Senha</string>
+ <string name="login_error_dialog_title">Login - Erro</string>
+ <string name="login_close_dialog_button">Fechar</string>
+ <string name="login_menu_create_account">Criar conta</string>
+ <string name="login_menu_settings">Configurações</string>
+ <string name="login_menu_about">Sobre</string>
+ <string name="login_about_title">Beem %s - Sobre</string>
+ <string name="login_about_msg">
+ Beem é um projeto da EPITECH Innovative Project. Visite
+ http://www.beem-project.com !
+ </string>
+ <string name="login_about_button">Fechar</string>
+ <string name="login_settings_button">Configurações</string>
+ <string name="login_login_button">Entrar</string>
+ <string name="login_login_progress">Conectando. Aguarde...</string>
+ <string name="login_error_msg">Infelizmente, ocorreu um erro.\n\nDetalhes
+ do erro:\n%s</string>
+ <string name="login_menu_login">Login</string>
+ <string name="login_no_connectivity">Conexão de internet não encontrada</string>
+ <string name="login_start_msg">Configurações incorretas</string>
+
+ <!-- LoginAnim activity -->
+ <string name="loganim_connecting">Conectando ...</string>
+ <string name="loganim_authenticating">Autenticando ...</string>
+ <string name="loganim_login_success">Entrou com sucesso</string>
+ <string name="loganim_login_failed">Falha no login</string>
+
+ <!-- EditSettings Activity -->
+ <string name="settings_menu_create_account">Criar conta</string>
+ <string name="settings_menu_privacy_lists">Gerenciar minha lista de privacidade</string>
+ <string name="settings_saved_ok">As configurações foram salvas com sucesso.</string>
+
+
+
+ <!-- EditSettings Activity Categories -->
+ <string name="general_preferences">Preferências gerais</string>
+ <string name="user_preferences">Configurações de usuário (requerido)</string>
+ <string name="user_preferences_advanced">Configurações avançadas de usuário (opcional)</string>
+ <string name="network_preferences">Opções de rede</string>
+ <string name="proxy_proxy_settings">Configurações de proxy</string>
+ <string name="proxy_user_settings">Configurações de proxy</string>
+ <string name="history_preferences">Histórico</string>
+ <string name="chat_layout_option">Layout da conversa</string>
+
+
+ <!-- EditSettings Activity Tabs -->
+ <string name="settings_tab_tag_account">edit_settings_tab_account</string>
+ <string name="settings_tab_label_account">Conta</string>
+ <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+ <string name="settings_tab_label_xmpp">XMPP</string>
+ <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+ <string name="settings_tab_label_proxy">Proxy</string>
+
+
+ <!-- wizard activities -->
+ <string name="account_wizard_text1"><b>Bem vindo ao BEEM.</b>\n\nVocê ainda não configurou uma conta XMPP (Jabber).\nEscolha uma das opções :</string>
+ <string name="account_wizard_configure_text"><b>Por favor, preencha os dados da sua conta</b></string>
+ <string name="account_wizard_configure_account">Eu já tenho uma conta</string>
+ <string name="account_wizard_create_account">Quero criar uma conta</string>
+
+ <!-- Create an account Activity -->
+ <string name="create_account_instr_dialog_title">Criar conta - Instruções</string>
+ <string name="create_account_err_dialog_title">Criar conta - Erro</string>
+ <string name="create_account_err_dialog_settings_button">Alterar configurações</string>
+ <string name="create_account_close_dialog_button">Fechar</string>
+ <string name="create_account_successfull_after">conta %s foi criada com sucesso</string>
+ <string name="create_account_err_username">JabberID mal formado</string>
+ <string name="create_account_err_passwords">Senha não confere.</string>
+ <string name="create_account_username">Login</string>
+ <string name="create_account_password">Senha</string>
+ <string name="create_account_confirm_password">Confirmar senha</string>
+
+ <!-- ContactList Activity -->
+ <string name="contact_list_menu_add_contact">Adicionar contato</string>
+ <string name="contact_list_menu_status">Alterar status</string>
+ <string name="contact_list_menu_settings">Configurações</string>
+ <string name="contact_list_menu_disconnect">Desconectar</string>
+ <string name="contact_list_all_contact">Todos os contatos</string>
+ <string name="contact_list_no_group">Sem grupo</string>
+
+ <!-- UserInfo dialog -->
+ <string name="userinfo_label_alias">Apelido</string>
+ <string name="userinfo_label_chg_group">Gerenciar grupos</string>
+ <string name="userinfo_label_re_subscription">Reenviar convite</string>
+ <string name="userinfo_label_block">BLoquear</string>
+ <string name="userinfo_label_delete">Apagar</string>
+ <string name="userinfo_resend">Reenviar subscrição</string>
+ <string name="userinfo_sure2delete">Tem certeza que deseja apagar esse contato?
+ </string>
+ <string name="userinfo_yes">Sim</string>
+ <string name="userinfo_no">Não</string>
+ <string name="userinfo_sureresend">Tem certeza que deseja reenviar o convite?</string>
+
+ <string name="chat_name">Beem - Conversa</string>
+ <string name="chat_input_default_value">Digite sua mensagem</string>
+ <string name="chat_self">Eu</string>
+ <string name="chat_error">Erro</string>
+ <string name="chat_send_message">Enviar</string>
+ <string name="chat_menu_contacts_list">Lista de contatos</string>
+ <string name="chat_menu_change_chat">Trocar janela de conversa</string>
+ <string name="chat_dialog_change_chat_title">Conversas abertas</string>
+ <string name="chat_menu_close_chat">Fechar essa conversa</string>
+ <string name="chat_no_more_chats">Sem outras conversas ativas</string>
+ <string name="chat_state_composing">está escrevendo uma mensagem</string>
+ <string name="chat_state_gone">deixou a conversa</string>
+ <string name="chat_state_active">presta atenção à conversa</string>
+ <string name="chat_state_inactive">está fazendo outra coisa</string>
+
+ <string name="contact_status_msg_available">Disponível</string>
+ <string name="contact_status_msg_available_chat">Disponível para conversar</string>
+ <string name="contact_status_msg_dnd">Ocupado</string>
+ <string name="contact_status_msg_away">Ausente</string>
+ <string name="contact_status_msg_xa">Indisponível</string>
+ <string name="contact_status_msg_offline">Desconectado</string>
+
+ <string name="privacy_list_name">Beem - Gerenciar minha lista de privacidade</string>
+ <string name="privacy_list_no_data">Não há nenhuma lista de privacidade registrada.</string>
+ <string name="privacy_list_menu_create">Criar lista de privacidade</string>
+ <string name="privacy_list_create_dialog_title">Criar lista de privacidade</string>
+ <string name="privacy_list_create_dialog_list_name_label">Título</string>
+ <string name="privacy_list_create_dialog_create_button">Criar</string>
+ <string name="privacy_list_select_dialog_buddies">Contatos</string>
+ <string name="privacy_list_select_dialog_groups">Grupos</string>
+ <string name="privacy_list_select_dialog_delete">Apagar</string>
+ <string name="privacy_list_delete_dialog_msg">Você realmente deseja apagar a lista de privacidade chamada \'%s\'?</string>
+ <string name="privacy_list_delete_dialog_yes">Sim</string>
+ <string name="privacy_list_delete_dialog_no">Não</string>
+
+ <string name="UpdateButton">Atualizar</string>
+
+ <!-- Error messages -->
+
+ <string name="error_login_authentication">Erro durante autenticação: login ou senha incorretos.</string>
+
+ <string name="interna_server_error">Erro interno do servidor</string>
+ <string name="bad_request">bad-request</string>
+ <string name="forbidden">forbidden</string>
+ <string name="item_not_found">item-not-found</string>
+ <string name="conflict">conflict</string>
+ <string name="feature_not_implemented">feature-not-implemented</string>
+ <string name="gone">gone</string>
+ <string name="jid_malformed">jid-malformed</string>
+ <string name="no_acceptable">no-acceptable</string>
+ <string name="not_allowed">not-allowed</string>
+ <string name="not_authorized">not-authorized</string>
+ <string name="payment_required">payment-required</string>
+ <string name="recipient_unavailable">recipient-unavailable</string>
+ <string name="redirect">redirect</string>
+ <string name="registration_required">registration-required</string>
+ <string name="remote_server_not_found">Servidor remoto não encotrado</string>
+ <string name="remote_server_timeout">Sem resposta do servidor</string>
+ <string name="remote_server_error">Erro do servidor remoto</string>
+ <string name="resource_constraint">resource-constraint</string>
+ <string name="service_unavailable">service-unavailable</string>
+ <string name="subscription_required">subscription-required</string>
+ <string name="undefined_condition">undefined-condition</string>
+ <string name="unexpected_condition">unexpected-condition</string>
+ <string name="request_timeout">request-timeout</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-ru/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"Радость"</item>
+ <item msgid="1601611480575517120">"Грустный"</item>
+ <item msgid="1531181614218625881">"Подмигивает"</item>
+ <item msgid="3858808057949077894">"Показывает язык"</item>
+ <item msgid="7835238297967185651">"Удивлен"</item>
+ <item msgid="1756223535005296033">"Поцелуй"</item>
+ <item msgid="1093906245140165107">"Кричит"</item>
+ <item msgid="888834839864150170">"Крутой"</item>
+ <item msgid="6320683740534773967">"Не болтай попусту"</item>
+ <item msgid="6610111212478853990">"В замешательстве"</item>
+ <item msgid="1706035208563940251">"Смущение"</item>
+ <item msgid="9079275787422313427">"Ангел"</item>
+ <item msgid="4630490399784004880">"Нерешительный"</item>
+ <item msgid="7002574538342357456">"Плачет"</item>
+ <item msgid="850324578089267455">"Не скажу"</item>
+ <item msgid="6334637439528489607">"Смех"</item>
+ <item msgid="7602915122893958066">"Озадаченный"</item>
+ <item msgid="3939233701582771068">"Сердце"</item>
+ <item msgid="1414759480575851587">"Злой"</item>
+ <item msgid="8479809115158836070">"Ухмылка"</item>
+ <item msgid="638612939305162424">"Невозмутимость"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-ru/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,320 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resources>
+<!-- Generic terms -->
+<string name="app_name">Beem</string>
+<string name="OkButton">ОК</string>
+<string name="ClearButton">Очистить</string>
+<string name="CancelButton">Отмена</string>
+<string name="AcceptButton">Разрешить</string>
+<string name="RefuseButton">Отказать</string>
+<string name="JabberID">Jabber ID</string>
+<string name="Password">Пароль</string>
+<string name="Continue">Продолжить</string>
+
+<!-- AccountConfigure class -->
+<string name="AccountConfigureManualConfiguration">Ручная конфигурация</string>
+
+<!-- Beem class -->
+<string name="BeemJabberID">Jabber ID</string>
+
+<!-- BeemApplication class -->
+<string name="BeemApplicationConnect">Соединение...</string>
+
+<!-- BeemService class -->
+<string name="BeemServiceDescription">Использовать сервис Beem</string>
+<string name="BeemServiceCreated">Сервис Beem создан</string>
+<string name="BeemServiceDestroyed">Сервис Beem уничтожен</string>
+
+<!-- ContactDialog class -->
+<string name="CDChat">Написать</string>
+<string name="CDCall">Повонить</string>
+<string name="CDInfos">Настройки</string>
+
+<!-- AddContact class -->
+<string name="AddCActTitle">Добавление контакта</string>
+
+<string name="AddCLogin">Имя пользователя</string>
+<string name="AddCAlias">Псевдоним</string>
+<string name="AddCGroup">Группа</string>
+<string name="AddCOkButton">Добавить</string>
+<string name="AddCContactAdded">Контакт добавлен</string>
+<string name="AddCContactAddedError">Ошибка добавления контакта</string>
+<string name="AddCContactAddedLoginError">Ошибка входа</string>
+<string name="AddCBadForm"/>
+<string name="AddCContactAlready">Контакт уже добавлен</string>
+
+<!-- ChangeStatus class -->
+<string name="ChangeStatusActTitle">Изменение статуса</string>
+<string name="ChangeStatusType">Мой статус</string>
+<string name="ChangeStatusMessage">Персональное сообщение</string>
+<string name="OpenContactList">Открыть список контактов</string>
+
+<string name="MenuAddContact">Добавить новый контакт</string>
+<string name="MenuAccountAbout">О проекте Beem</string>
+<string name="MenuAccountCreate">Создать аккаунт</string>
+<string name="MenuConnection">Изменить аккаунт</string>
+<string name="ChangeStatusOk">Обновление статуса...</string>
+<string name="ChangeStatusNoChange">Ничего не изменилось</string>
+<string name="my_avatar">Мой аватар</string>
+<string name="select_avatar">Выберите свой аватар</string>
+<string name="take_photo">Снять фото</string>
+<string name="pick_photo">Выбрать фото</string>
+<string name="delete_avatar">Нет аватара</string>
+<string name="photoPickerNotFoundText">Нельзя выбрать фото</string>
+
+ <!-- Settings class -->
+<string name="SettingsText">Имя пользователя</string>
+<string name="SettingsPassword">Пароль</string>
+<string name="SettingsProxy">Прокси</string>
+<string name="SettingsProxyProxy">Использовать прокси</string>
+<string name="SettingsProxySummary">Соединяться через прокси</string>
+<string name="SettingsProxyType">Протокол</string>
+<string name="SettingsProxyTypeSummary">Выберите тип прокси</string>
+<string name="SettingsProxyServer">Сервер</string>
+<string name="SettingsProxyPort">Порт</string>
+<string name="SettingsProxyUser">Имя пользователя прокси (необязательно)</string>
+<string name="SettingsProxyPassword">Пароль пользователя прокси (необязательно)</string>
+<string name="SettingsAdvanced">Дополнительно</string>
+<string name="SettingsAdvancedOptions">Дополнительные настройки сервера</string>
+<string name="SettingsAdvancedRecoDelay">Изменить задержку повторного соединения</string>
+<string name="SettingsAdvancedSpecOpt">Отметьте для того, чтобы указать сервер вручную</string>
+<string name="SettingsAdvancedAddOpt">Сервер</string>
+<string name="SettingsAdvancedPortOpt">Порт</string>
+<string name="SettingsResourceTitle">Метка</string>
+<string name="SettingsPriorityTitle">Приоритет</string>
+<string name="SettingsResourceSummary">Установить метку данного клиента</string>
+<string name="SettingsPrioritySummary">Установить приоритет данного клиента</string>
+<string name="contact_list_preferences">Список контактов</string>
+<string name="contact_list_preferences_sum">Опции отображения контактов</string>
+<string name="CLP_hide_groups">Скрывать группы</string>
+<string name="CLP_hide_groups_sum">Отметьте для того, чтобы спрятать группы</string>
+<string name="CLP_hidden_contact">Скрывать оффлайн-контакты</string>
+<string name="CLP_hidden_contact_sum">Отметьте, чтобы спрятать контакты, которые не в сети</string>
+<string name="settings_account_username">Имя пользователя</string>
+<string name="login_username_info_default"/>
+<string name="settings_account_password">Пароль</string>
+<string name="settings_account_server">Сервер</string>
+<string name="settings_account_port">Порт</string>
+<string name="settings_advanced_service_behaviour"/>
+<string name="settings_advanced_sum">Расширенные настройки</string>
+<string name="settings_xmpp_server">Сервер</string>
+<string name="comments_xmpp_server"/>
+<string name="settings_xmpp_port">Порт</string>
+<string name="settings_xmpp_use_tls">Требовать SSL/TLS</string>
+<string name="settings_reco_delay"/>
+<string name="comments_xmpp_port">По умолчанию 5222</string>
+<string name="settings_proxy_sum"/>
+<string name="settings_proxy_use">Соединяться через прокси</string>
+<string name="settings_proxy_type_prompt">Выберите тип проси</string>
+<string name="settings_proxy_server">Сервер</string>
+<string name="settings_proxy_port">Порт</string>
+<string name="comments_proxy_port">По умолчанию 1080</string>
+<string name="settings_proxy_username">Имя пользователя</string>
+<string name="settings_proxy_password">Пароль</string>
+<string name="away_chk_title">Включать автоматически \"Отошел\"</string>
+<string name="away_chk_sum">Устанавливать статус \"Отошел\" при отключении экрана</string>
+<string name="away_message_title">Сообщение об отсутствии</string>
+<string name="away_message_sum">Напишите сообщение об отсутствии</string>
+<string name="away_message_hint">Я отошел, экран телефона выключен</string>
+<string name="notification_preferences">Настройка оповещений</string>
+<string name="notification_enable_vibrate_title">Вибрация</string>
+<string name="notification_enable_vibrate_sum">Вибрировать при новых сообщениях</string>
+<string name="notification_snd_title">Сигнал сообщений</string>
+<string name="notification_snd_sum">Установить сигнал для пришедшего сообщения</string>
+<string name="settings_chat_compact">Компактный диалог</string>
+<string name="settings_chat_compact_sum">Сделать окно диалога компактным</string>
+<string name="history">История</string>
+<string name="history_sum">Пометьте для сохранения разговоров на SD карте</string>
+<string name="history_mount">Для сохранения истории необходима установленная SD карта с разрешённой записью</string>
+<string name="history_on_off">Разрешить сохранение истории</string>
+<string name="chat_preferences">Диалог</string>
+<string name="chat_preferences_sum">История, размер диалога...</string>
+<string name="chat_history_path">Путь к истории</string>
+<string name="chat_history_path_sum">Путь к сохраняемым диалогам на SD карте</string>
+<string name="settings_smack_debug">Разрешить отладку XMPP</string>
+<string name="settings_full_jid_login">Использовать мой полный JID как имя пользователя</string>
+<string name="settings_full_jid_login_sum">Необходимо для некоторых серверов, например для Google Talk</string>
+
+ <!-- Subscription class -->
+<string name="SubscriptAccept">Контакт авторизован</string>
+<string name="SubscriptError">Ошибка авторизации</string>
+<string name="SubscriptRefused">Авторизация отклонена</string>
+<string name="SubscriptText">%s желает добавить вас в свой контакт-лист. Авторизовать его(-е)?</string>
+<string name="SubscriptTitle">Авторизовать пользователя?</string>
+
+<!-- BeemChatManager -->
+<string name="BeemChatManagerNewMessage">Пришло новое сообщение</string>
+
+<!-- BeemBroadcastReceiver class -->
+<string name="BeemBroadcastReceiverDisconnect">Beem: Соединение разорвано</string>
+
+<!-- XmppConnectionAdapter class -->
+<string name="AcceptContactRequest">%s добавил(а) вас в свой контакт-лист.</string>
+<string name="AcceptContactRequestFrom">Авторизовать %s.</string>
+
+<!-- Activities -->
+<string name="login_tag"/>
+<string name="edit_settings_name">Настройки</string>
+<string name="edit_settings_tag"/>
+<string name="create_account_name">Создать аккаунт</string>
+<string name="create_account_tag"/>
+<string name="contact_list_name">Контакты</string>
+<string name="contact_list_tag"/>
+<string name="user_info_name">Информация о пользователе</string>
+
+<!-- Buttons -->
+<string name="button_create_account">Создать аккаунт</string>
+<string name="button_create_login_account">Создать аккаунт и подключиться</string>
+
+<!-- LogAs Activity -->
+<string name="login_username">Имя пользователя</string>
+<string name="login_password">Пароль</string>
+<string name="login_error_dialog_title">Ошибка входа</string>
+<string name="login_close_dialog_button">Закрыть</string>
+<string name="login_menu_create_account">Создать аккаунт</string>
+<string name="login_menu_settings">Настройки</string>
+<string name="login_menu_about">О программе</string>
+<string name="login_about_title">Beem %s - О программе</string>
+<string name="login_about_msg"/>
+<string name="login_about_button">Закрыть</string>
+<string name="login_settings_button">Настройки</string>
+<string name="login_login_button">Войти</string>
+<string name="login_login_progress">Соединение. Пожалуйста, подождите...</string>
+<string name="login_error_msg">К сожалению, произошла ошибка.\n\nПодробности:\n%s</string>
+<string name="login_menu_login">Войти</string>
+<string name="login_no_connectivity">Интернет соединение не найдено</string>
+<string name="login_start_msg">Настройки в меню</string>
+
+<!-- LoginAnim activity -->
+<string name="loganim_connecting">Соединение...</string>
+<string name="loganim_authenticating">Аутентификация...</string>
+<string name="loganim_login_success">Вход выполнен</string>
+<string name="loganim_login_failed">Не удалось войти</string>
+
+<!-- EditSettings Activity -->
+<string name="settings_menu_create_account">Создать аккаунт</string>
+<string name="settings_menu_privacy_lists">Настроить списки приватности</string>
+<string name="settings_saved_ok">Настройки успешно сохранены</string>
+
+<!-- EditSettings Activity Categories -->
+<string name="general_preferences">Общие настройки</string>
+<string name="user_preferences">Настройки пользователя (обязательные)</string>
+<string name="user_preferences_advanced">Расширенные настройки пользователя (дополнительные)</string>
+<string name="network_preferences">Настройки сети</string>
+<string name="proxy_proxy_settings">Настройки прокси</string>
+<string name="proxy_user_settings">Настройки прокси</string>
+<string name="history_preferences">История</string>
+<string name="chat_layout_option">Вид диалога</string>
+
+ <!-- EditSettings Activity Tabs -->
+<string name="settings_tab_tag_account"/>
+<string name="settings_tab_label_account">Аккаунт</string>
+<string name="settings_tab_tag_xmpp"/>
+<string name="settings_tab_label_xmpp">XMPP</string>
+<string name="settings_tab_tag_proxy"/>
+<string name="settings_tab_label_proxy">Прокси</string>
+
+<!-- wizard activities -->
+<string name="account_wizard_text1"><b>Добро пожаловать в Beem.</b>\n\nВы ещё не настроили аккаунт XMPP (Jabber).\nВыберите один из следующих вариантов :</string>
+<string name="account_wizard_configure_text"/>
+<string name="account_wizard_configure_account">Использовать существующий аккаунт</string>
+<string name="account_wizard_create_account">Создать новый аккаунт</string>
+
+<!-- Create an account Activity -->
+<string name="create_account_instr_dialog_title">Создание учётной записи - Инструкция</string>
+<string name="create_account_err_dialog_title">Создание учётной записи - Ошибка</string>
+<string name="create_account_err_dialog_settings_button">Изменить мои настройки</string>
+<string name="create_account_close_dialog_button">Закрыть</string>
+<string name="create_account_successfull_after">Аккаунт %s успешно создан</string>
+<string name="create_account_err_username">Неправильный JID</string>
+<string name="create_account_err_passwords">Пароли не совпадают</string>
+<string name="create_account_username">Имя пользователя</string>
+<string name="create_account_password">Пароль</string>
+<string name="create_account_confirm_password">Повторите пароль</string>
+
+<!-- ContactList Activity -->
+<string name="contact_list_menu_add_contact">Добавить контакт</string>
+<string name="contact_list_menu_status">Сменить статус</string>
+<string name="contact_list_menu_settings">Настройки</string>
+<string name="contact_list_menu_disconnect">Отключиться</string>
+<string name="contact_list_all_contact">Все контакты</string>
+<string name="contact_list_no_group">Без группы</string>
+
+<!-- UserInfo dialog -->
+<string name="userinfo_label_alias">Псевдоним</string>
+<string name="userinfo_label_chg_group">Управление группами</string>
+<string name="userinfo_label_re_subscription">Выслать приглашение ещё раз</string>
+<string name="userinfo_label_block">Заблокировать</string>
+<string name="userinfo_label_delete">Удалить</string>
+<string name="userinfo_resend"/>
+<string name="userinfo_sure2delete">Вы уверены, что хотите удалить этот контакт?</string>
+<string name="userinfo_yes">Да</string>
+<string name="userinfo_no">Нет</string>
+<string name="userinfo_sureresend">Вы уверены, что хотите повторно послать приглашение?</string>
+
+<string name="chat_name">Чат</string>
+<string name="chat_input_default_value">Введите сообщение тут</string>
+<string name="chat_self">Я</string>
+<string name="chat_error">Ошибка</string>
+<string name="chat_send_message">Отправить</string>
+<string name="chat_menu_contacts_list">Список контактов</string>
+<string name="chat_menu_change_chat">Другая беседа</string>
+<string name="chat_dialog_change_chat_title">Открытые беседы</string>
+<string name="chat_menu_close_chat">Закрыть эту беседу</string>
+<string name="chat_no_more_chats">Нет активных бесед</string>
+<string name="chat_state_composing">пишет</string>
+<string name="chat_state_gone">закрыл(а) окно беседы</string>
+<string name="chat_state_active">вникает в текст</string>
+<string name="chat_state_inactive">занимается чем-то другим</string>
+
+<string name="contact_status_msg_available">Онлайн</string>
+<string name="contact_status_msg_available_chat">Доступен для разговора</string>
+<string name="contact_status_msg_dnd">Занят</string>
+<string name="contact_status_msg_away">Отошел</string>
+<string name="contact_status_msg_xa">Недоступен</string>
+<string name="contact_status_msg_offline">Оффлайн</string>
+
+<string name="privacy_list_name">Настройки приватности</string>
+<string name="privacy_list_no_data">Нет списков приватности</string>
+<string name="privacy_list_menu_create">Создать список приватности</string>
+<string name="privacy_list_create_dialog_title">Создать список приватности</string>
+<string name="privacy_list_create_dialog_list_name_label">Название</string>
+<string name="privacy_list_create_dialog_create_button">Создать</string>
+<string name="privacy_list_select_dialog_buddies">Контакты</string>
+<string name="privacy_list_select_dialog_groups">Группы</string>
+<string name="privacy_list_select_dialog_delete">Удалить</string>
+<string name="privacy_list_delete_dialog_msg">Вы правда хотите удалить список приватности \'%s\' ?</string>
+<string name="privacy_list_delete_dialog_yes">Да</string>
+<string name="privacy_list_delete_dialog_no">Нет</string>
+
+<string name="UpdateButton">Обновить</string>
+
+<!-- Error messages -->
+
+<string name="error_login_authentication">Ошибка: неверно указан логин или пароль</string>
+
+<string name="interna_server_error">Ошибка сервера</string>
+<string name="bad_request">Ошибочный запрос</string>
+<string name="forbidden"/>
+<string name="item_not_found"/>
+<string name="conflict"/>
+<string name="feature_not_implemented">Возможность нереализована</string>
+<string name="gone"/>
+<string name="jid_malformed">Неверный JID</string>
+<string name="no_acceptable"/>
+<string name="not_allowed"/>
+<string name="not_authorized"/>
+<string name="payment_required"/>
+<string name="recipient_unavailable"/>
+<string name="redirect"/>
+<string name="registration_required"/>
+<string name="remote_server_not_found">Сервер не найден</string>
+<string name="remote_server_timeout">Сервер не отвечает</string>
+<string name="remote_server_error">Ошибка сервера</string>
+<string name="resource_constraint"/>
+<string name="service_unavailable"/>
+<string name="subscription_required"/>
+<string name="undefined_condition"/>
+<string name="unexpected_condition"/>
+<string name="request_timeout"/>
+</resources>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-sv/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"Glad"</item>
+ <item msgid="1601611480575517120">"Ledsen"</item>
+ <item msgid="1531181614218625881">"Blinkar"</item>
+ <item msgid="3858808057949077894">"Lipar"</item>
+ <item msgid="7835238297967185651">"Förvånad"</item>
+ <item msgid="1756223535005296033">"Pussar"</item>
+ <item msgid="1093906245140165107">"Skriker"</item>
+ <item msgid="888834839864150170">"Cool"</item>
+ <item msgid="6320683740534773967">"Dollarmun"</item>
+ <item msgid="6610111212478853990">"Bortgjord"</item>
+ <item msgid="1706035208563940251">"Generad"</item>
+ <item msgid="9079275787422313427">"Ängel"</item>
+ <item msgid="4630490399784004880">"Tveksam"</item>
+ <item msgid="7002574538342357456">"Gråter"</item>
+ <item msgid="850324578089267455">"Hemlis"</item>
+ <item msgid="6334637439528489607">"Skrattar"</item>
+ <item msgid="7602915122893958066">"Förvirrad"</item>
+ <item msgid="3939233701582771068">"Hjärta"</item>
+ <item msgid="1414759480575851587">"Arg"</item>
+ <item msgid="8479809115158836070">"Flinar"</item>
+ <item msgid="638612939305162424">"Pokeransikte"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-sv/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,322 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+<!-- Generic terms -->
+<string name="app_name">Beem</string>
+<string name="OkButton">Ok</string>
+<string name="ClearButton">Töm</string>
+<string name="CancelButton">Avbryt</string>
+<string name="AcceptButton">Godkänn</string>
+<string name="RefuseButton">Neka</string>
+<string name="JabberID">Jabber-ID</string>
+<string name="Password">Lösenord</string>
+<string name="Continue">Fortsätt</string>
+
+<!-- AccountConfigure class -->
+<string name="AccountConfigureManualConfiguration">Manuell inställning</string>
+
+<!-- BeemService class -->
+<string name="BeemServiceDescription">Använda tjänsten Beem</string>
+
+<!-- ContactDialog class -->
+<string name="CDChat">Chatta</string>
+<string name="CDCall">Ring</string>
+<string name="CDInfos">Hantera kontakt</string>
+
+<!-- AddContact class -->
+<string name="AddCActTitle">Beem - Lägg till kontakt</string>
+
+<string name="AddCLogin">Användarnamn</string>
+<string name="AddCAlias">Alias</string>
+<string name="AddCGroup">Grupp</string>
+<string name="AddCOkButton">Lägg till</string>
+<string name="AddCContactAdded">Kontakt tillagd</string>
+<string name="AddCContactAddedError">Fel, kontakt inte tillagd</string>
+<string name="AddCContactAddedLoginError">Fel vid inloggning</string>
+<string name="AddCContactAlready">Kontakten finns redan</string>
+
+<!-- ChangeStatus class -->
+<string name="ChangeStatusActTitle">Beem - Ändra status</string>
+<string name="ChangeStatusType">Min status</string>
+<string name="ChangeStatusMessage">Mitt personliga meddelande</string>
+<string name="OpenContactList">Öppna kontaktlista</string>
+
+<string name="ChangeStatusOk">Uppdaterar status</string>
+<string name="my_avatar">Min avatar</string>
+<string name="select_avatar">Välj avatar</string>
+<string name="take_photo">Ta ett foto</string>
+<string name="pick_photo">Välj en bild</string>
+<string name="delete_avatar">Ingen avatar</string>
+<string name="photoPickerNotFoundText">Hittar ingen fotoväljare</string>
+
+
+<!-- Settings class -->
+<string name="SettingsProxy">Proxy</string>
+<string name="SettingsProxyProxy">Använd proxyserver</string>
+<string name="SettingsProxySummary">Logga in via proxyserver</string>
+<string name="SettingsProxyType">Protokoll</string>
+<string name="SettingsProxyTypeSummary">Välj typ av proxyserver</string>
+<string name="SettingsProxyServer">Ändra proxyserveradress</string>
+<string name="SettingsProxyPort">Ändra proxyserverport</string>
+<string name="SettingsProxyUser">Valfritt, möjliggör autentisering på proxyservern</string>
+<string name="SettingsProxyPassword">Valfritt, möjliggör autentisering på proxyservern</string>
+<string name="SettingsAdvanced">Avancerat</string>
+<string name="SettingsAdvancedOptions">Specifika serverinställningar</string>
+<string name="SettingsAdvancedRecoDelay">Ändra tid mellan anslutningsförsök</string>
+<string name="SettingsAdvancedSpecOpt">Markera om du vill använda någon specifik server för anslutningen</string>
+<string name="SettingsAdvancedAddOpt">Ändra serveradress</string>
+<string name="SettingsAdvancedPortOpt">Ändra serverport</string>
+<string name="SettingsResourceTitle">Instans</string>
+<string name="SettingsPriorityTitle">Prioritet</string>
+<string name="SettingsResourceSummary">Ange XMPP-instans för denna klient</string>
+<string name="SettingsPrioritySummary">Ange prioritet för denna klient</string>
+<string name="contact_list_preferences">Kontaktlista</string>
+<string name="contact_list_preferences_sum">A set of display options for your buddy list
+</string>
+<string name="CLP_hide_groups">Dölj grupper</string>
+<string name="CLP_hide_groups_sum">Markera för att dölja grupper</string>
+<string name="CLP_show_jid">Visa JID</string>
+<string name="CLP_show_jid_sum">Markera för att alltid visa kontakters JID</string>
+<string name="CLP_hidden_contact">Dölj kontakter</string>
+<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
+</string>
+<string name="settings_account_username">Användarnamn (JID)</string>
+<string name="settings_account_password">Lösenord</string>
+<string name="settings_account_server">Server</string>
+<string name="settings_account_port">Port</string>
+<string name="settings_advanced_service_behaviour">Tjänstebeskrivning</string>
+<string name="settings_advanced_sum">Inställningar för avancerade användare</string>
+<string name="settings_xmpp_server">Adress</string>
+<string name="comments_xmpp_server">example.com</string>
+<string name="settings_xmpp_port">Port</string>
+<string name="settings_xmpp_use_tls">Kräv SSL/TLS</string>
+<string name="settings_reco_delay">Tid mellan anslutningsförsök</string>
+<string name="comments_xmpp_port">Förvalt: 5222</string>
+<string name="settings_proxy_sum">Inställningar för användning av proxy</string>
+<string name="settings_proxy_use">Anslut via proxy</string>
+<string name="settings_proxy_type_prompt">Välj typ av proxy</string>
+<string name="settings_proxy_server">Server</string>
+<string name="settings_proxy_port">Port</string>
+<string name="comments_proxy_port">Förvalt: 1080</string>
+<string name="settings_proxy_username">Användarnamn</string>
+<string name="settings_proxy_password">Lösenord</string>
+<string name="away_chk_title">Aktivera automatisk frånvaro</string>
+<string name="away_chk_sum">Ändra status till frånvarande när skärmen släcks</string>
+<string name="away_message_title">Frånvaromeddelande</string>
+<string name="away_message_sum">Frånvaromeddelandet som kommer att visas</string>
+<string name="away_message_hint">Jag är frånvarande, telefonens skärm är släckt</string>
+<string name="notification_preferences">Aviseringsinställningar</string>
+<string name="notification_enable_vibrate_title">Aktivera vibration</string>
+<string name="notification_enable_vibrate_sum">Aktivera vibration vid inkommande meddelande</string>
+<string name="notification_snd_title">Meddelandesignal</string>
+<string name="notification_snd_sum">Ange signal för inkommande meddelanden</string>
+<string name="settings_chat_compact">Kompakt chatt</string>
+<string name="settings_chat_compact_sum">Gör chattfönstret kompakt</string>
+<string name="history">Historik</string>
+<string name="history_sum">Markera för att spara chattar på SD-kort</string>
+<string name="chat_preferences">Chatt</string>
+<string name="chat_preferences_sum">Historik, utseende mm.</string>
+<string name="chat_history_path">Sökväg till historik</string>
+<string name="chat_history_path_sum">Konversationer sparas i en mapp på SD-kortet</string>
+<string name="settings_smack_debug">Aktivera XMPP-felsökning</string>
+<string name="settings_full_jid_login">Använd fullständigt JID som användarnamn</string>
+<string name="settings_full_jid_login_sum">Krävs på vissa servrar som Google Talk</string>
+
+<!-- Subscription class -->
+<string name="SubscriptAccept">Prenumeration godkänd</string>
+<string name="SubscriptError">Fel vid prenumeration</string>
+<string name="SubscriptRefused">Prenumeration nekad</string>
+<string name="SubscriptText">%s vill lägga till dig i sin kontaktlista. Godkänner du det?</string>
+<string name="SubscriptTitle">Godkänn kontakt?</string>
+
+<!-- BeemBroadcastReceiver class -->
+<string name="BeemBroadcastReceiverDisconnect">BEEM: Du är frånkopplad</string>
+
+<!-- XmppConnectionAdapter class -->
+<string name="AcceptContactRequest">%s har lagt till dig till sin kontaktlista.</string>
+<string name="AcceptContactRequestFrom">Godkänn att %s kontaktar dig.</string>
+
+<!-- Activities -->
+<string name="edit_settings_name">Beem - Inställningar</string>
+<string name="create_account_name">Beem - Skapa konto</string>
+<string name="contact_list_name">Beem - Kontakter</string>
+<string name="user_info_name">Beem - Användarinfo</string>
+
+<!-- LogAs Activity -->
+<string name="login_menu_settings">Inställningar</string>
+<string name="login_menu_about">Om</string>
+<string name="login_about_title">Beem %s - Om</string>
+<string name="login_about_msg">
+Beem is an EPITECH Innovative Project. Visit us at
+http://www.beem-project.com !
+</string>
+<string name="login_about_button">Stäng</string>
+<string name="login_login_progress">Ansluter. Vänta...</string>
+<string name="login_menu_login">Logga in</string>
+<string name="login_start_msg">Inställningar i menyn</string>
+
+<!-- LoginAnim activity -->
+<string name="loganim_connecting">Ansluter...</string>
+<string name="loganim_authenticating">Verifierar...</string>
+<string name="loganim_login_success">Inloggningen lyckades</string>
+<string name="loganim_login_failed">Inloggningen misslyckades</string>
+
+<!-- EditSettings Activity -->
+<string name="settings_menu_create_account">Skapa konto</string>
+<string name="settings_menu_privacy_lists">Hantera spärrlistor</string>
+<string name="settings_saved_ok">Inställningarna har sparats.</string>
+
+
+
+<!-- EditSettings Activity Categories -->
+<string name="general_preferences">Allmänna inställningar</string>
+<string name="user_preferences">Användaruppgifter (krävs)</string>
+<string name="user_preferences_advanced">Avancerade användarinställningar (valfritt)</string>
+<string name="network_preferences">Nätverksinställningar</string>
+<string name="proxy_proxy_settings">Proxyinställningar</string>
+<string name="proxy_user_settings">Proxyinställningar</string>
+<string name="history_preferences">Historik</string>
+<string name="chat_layout_option">Utseende</string>
+
+
+<!-- EditSettings Activity Tabs -->
+<string name="settings_tab_tag_account">edit_settings_tab_account</string>
+<string name="settings_tab_label_account">Konto</string>
+<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+<string name="settings_tab_label_xmpp">XMPP</string>
+<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+<string name="settings_tab_label_proxy">Proxy</string>
+
+
+<!-- wizard activities -->
+<string name="account_wizard_text1"><b>Välkommen till BEEM.</b>nnDu har inte konfigurerat något XMPP (Jabber)-konto än.nVälj ett av följande alternativ:</string>
+<string name="account_wizard_configure_text_1">Välj ett konto som finns lagrat på denna enhet</string>
+<string name="account_wizard_configure_text_2"><b>eller</b></string>
+<string name="account_wizard_configure_text_3">Fyll i uppgifterna för ditt befintliga konto</string>
+<string name="account_wizard_settings_warn"><b>Varning: </b>Dina inställningar anger att en proxy eller ett specifikt domännamn ska användas.</string>
+<string name="account_wizard_connection_failed"><b>Det gick inte att logga in på kontot. Se över dina inloggningsuppgifter.</b></string>
+<string name="account_wizard_select_account_btn">Välj konto</string>
+
+<string name="account_wizard_configure_account">Jag har redan ett konto som jag vill använda</string>
+<string name="account_wizard_create_account">Jag vill registrera ett nytt konto</string>
+
+<!-- Create an account Activity -->
+<string name="create_account_text">Fyll i uppgifterna för att skapa kontot</string>
+<string name="create_account_progress_title">Kontot skapas</string>
+<string name="create_account_progress_message">Vänta</string>
+<string name="create_account_err_username">Felaktigt Jabber-ID</string>
+<string name="create_account_err_passwords">Lösenorden är inte lika.</string>
+<string name="create_account_username">Användarnamn</string>
+<string name="create_account_password">Lösenord</string>
+<string name="create_account_confirm_password">Bekräfta lösenordet</string>
+<string name="create_account_err_conflict">Detta konto finns redan. Prova ett ennat.</string>
+<string name="create_account_err_connection">Servern är inte tillgänglig. Prova en annan.</string>
+
+
+<!-- ContactList Activity -->
+<string name="contact_list_menu_add_contact">Lägg till kontakt</string>
+<string name="contact_list_menu_status">Ändra status</string>
+<string name="contact_list_menu_settings">Inställningar</string>
+<string name="contact_list_menu_disconnect">Koppla från</string>
+<string name="contact_list_all_contact">Alla kontakter</string>
+<string name="contact_list_no_group">Ingen grupp</string>
+
+<!-- UserInfo dialog -->
+<string name="userinfo_label_alias">Alias</string>
+<string name="userinfo_label_chg_group">Hantera grupper</string>
+<string name="userinfo_label_re_subscription">Skicka förfrågan igen</string>
+<string name="userinfo_label_block">Spärra</string>
+<string name="userinfo_label_delete">Ta bort</string>
+<string name="userinfo_resend">Skicka prenumeration igen</string>
+<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
+</string>
+<string name="userinfo_yes">Ja</string>
+<string name="userinfo_no">Nej</string>
+<string name="userinfo_sureresend">Är du säker på att du vill skicka förfrågan igen?</string>
+
+<string name="chat_name">Beem - Chatt</string>
+<string name="chat_input_default_value">Skriv meddelande</string>
+<string name="chat_self">Jag</string>
+<string name="chat_error">Fel</string>
+<string name="chat_send_message">Skicka</string>
+<string name="chat_menu_contacts_list">Kontaktlista</string>
+<string name="chat_menu_change_chat">Byt chatt</string>
+<string name="chat_menu_start_otr_session">Aktivera OTR</string>
+<string name="chat_menu_stop_otr_session">Stoppa OTR</string>
+<string name="chat_menu_otr_verify_key">OTR-nyckel</string>
+<string name="chat_menu_otr_submenu">OTR-val</string>
+<string name="chat_dialog_change_chat_title">Öppna chattar</string>
+<string name="chat_menu_close_chat">Stäng den här chatten</string>
+<string name="chat_no_more_chats">Inga fler aktiva chattar</string>
+<string name="chat_state_composing">skriver ett meddelande</string>
+<string name="chat_state_gone">har lämnat samtalet</string>
+<string name="chat_state_active">iakttar samtalet</string>
+<string name="chat_state_inactive">gör något annat</string>
+<string name="chat_otrstate_plaintext">KLARTEXT</string>
+<string name="chat_otrstate_encrypted">KRYPTERAD</string>
+<string name="chat_otrstate_finished">AVSLUTAD</string>
+<string name="chat_otrstate_authenticated">GODKÄND</string>
+<string name="chat_otr_verify_key" formatted="false">
+Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
+To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
+If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
+Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
+
+<string name="contact_status_msg_available">Tillgänglig</string>
+<string name="contact_status_msg_available_chat">Tillgänglig för chatt</string>
+<string name="contact_status_msg_dnd">Stör ej</string>
+<string name="contact_status_msg_away">Frånvarande</string>
+<string name="contact_status_msg_xa">Inte tillgänglig</string>
+<string name="contact_status_msg_offline">Frånkopplad</string>
+
+<string name="privacy_list_name">Beem - Hantera spärrlistor</string>
+<string name="privacy_list_no_data">Det finns inga spärrlistor.</string>
+<string name="privacy_list_menu_create">Skapa spärrlista</string>
+<string name="privacy_list_create_dialog_title">Skapa spärrlista</string>
+<string name="privacy_list_create_dialog_list_name_label">Titel</string>
+<string name="privacy_list_create_dialog_create_button">Skapa</string>
+<string name="privacy_list_select_dialog_buddies">Kontakter</string>
+<string name="privacy_list_select_dialog_groups">Grupper</string>
+<string name="privacy_list_select_dialog_delete">Ta bort</string>
+<string name="privacy_list_delete_dialog_msg">Vill du verkligen ta bort spärrlistan \'%s\'?</string>
+<string name="privacy_list_delete_dialog_yes">Ja</string>
+<string name="privacy_list_delete_dialog_no">Nej</string>
+
+<string name="UpdateButton">Uppdatera</string>
+
+<!-- MemorizingTrustManager library -->
+<string name="mtm_accept_cert">Acceptera okända certifikat?</string>
+<string name="mtm_decision_always">Alltid</string>
+<string name="mtm_decision_once">Den här gången</string>
+<string name="mtm_decision_abort">Avbryt</string>
+
+<string name="mtm_notification">Certifikatkontroll</string>
+
+<!-- Error messages -->
+
+<string name="error_login_authentication">Fel vid inloggning, fel ID eller lösenord.</string>
+
+<string name="interna_server_error">Serverfel</string>
+<string name="bad_request">felaktig begäran</string>
+<string name="forbidden">otillåten</string>
+<string name="item_not_found">hittades inte</string>
+<string name="conflict">konflikt</string>
+<string name="feature_not_implemented">funktionen finns inte</string>
+<string name="gone">borta</string>
+<string name="jid_malformed">felaktigt JID</string>
+<string name="no_acceptable">accepteras inte</string>
+<string name="not_allowed">tillåts inte</string>
+<string name="not_authorized">inte godkänd</string>
+<string name="payment_required">betalning krävs</string>
+<string name="recipient_unavailable">mottagaren ej tillgänglig</string>
+<string name="redirect">vidarebefordra</string>
+<string name="registration_required">registrering krävs</string>
+<string name="remote_server_not_found">Servern hittades inte</string>
+<string name="remote_server_timeout">Servern svarar inte</string>
+<string name="remote_server_error">Serverfel</string>
+<string name="resource_constraint">begränsad instans</string>
+<string name="service_unavailable">tjänsten ej tillgänglig</string>
+<string name="subscription_required">prenumeration krävs</string>
+<string name="undefined_condition">odefinierat tillstånd</string>
+<string name="unexpected_condition">oväntat tillstånd</string>
+<string name="request_timeout">timeout för begäran</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-zh-rCN/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"开心"</item>
+ <item msgid="1601611480575517120">"忧伤"</item>
+ <item msgid="1531181614218625881">"眨眼"</item>
+ <item msgid="3858808057949077894">"吐舌"</item>
+ <item msgid="7835238297967185651">"惊讶"</item>
+ <item msgid="1756223535005296033">"亲吻"</item>
+ <item msgid="1093906245140165107">"叫喊"</item>
+ <item msgid="888834839864150170">"酷"</item>
+ <item msgid="6320683740534773967">"财迷"</item>
+ <item msgid="6610111212478853990">"说错了话"</item>
+ <item msgid="1706035208563940251">"尴尬"</item>
+ <item msgid="9079275787422313427">"天使"</item>
+ <item msgid="4630490399784004880">"犹豫"</item>
+ <item msgid="7002574538342357456">"哭泣"</item>
+ <item msgid="850324578089267455">"保密"</item>
+ <item msgid="6334637439528489607">"大笑"</item>
+ <item msgid="7602915122893958066">"困惑"</item>
+ <item msgid="3939233701582771068">"爱之心"</item>
+ <item msgid="1414759480575851587">"生气"</item>
+ <item msgid="8479809115158836070">"傻笑"</item>
+ <item msgid="638612939305162424">"一本正经"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-zh-rCN/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+<!-- Generic terms -->
+<string name="app_name">Beem</string>
+<string name="OkButton">确定</string>
+<string name="ClearButton">清除</string>
+<string name="CancelButton">取消</string>
+<string name="AcceptButton">认证</string>
+<string name="RefuseButton">拒绝</string>
+<string name="JabberID">Jabber账号 </string>
+<string name="Password">密码</string>
+<string name="Continue">继续</string>
+
+<!-- AccountConfigure class -->
+<string name="AccountConfigureManualConfiguration">手动设置</string>
+
+<!-- Beem class -->
+<string name="BeemJabberID">Jabber账号 </string>
+
+<!-- BeemApplication class -->
+<string name="BeemApplicationConnect">连接中...</string>
+
+<!-- BeemService class -->
+<string name="BeemServiceDescription">使用Beem服务</string>
+<string name="BeemServiceCreated">Beem服务已创建</string>
+<string name="BeemServiceDestroyed">Beem服务已取消</string>
+
+<!-- ContactDialog class -->
+<string name="CDChat">聊天</string>
+<string name="CDCall">呼叫</string>
+<string name="CDInfos">用户管理</string>
+
+<!-- AddContact class -->
+<string name="AddCActTitle">Beem - 添加连接</string>
+
+<string name="AddCLogin">用户名</string>
+<string name="AddCAlias">别名</string>
+<string name="AddCGroup">组</string>
+<string name="AddCOkButton">添加</string>
+<string name="AddCContactAdded">联系人已成功添加</string>
+<string name="AddCContactAddedError">联系人添加错误</string>
+<string name="AddCContactAddedLoginError">登录错误</string>
+<string name="AddCBadForm">格式错误</string>
+<string name="AddCContactAlready">联系人已存在</string>
+
+<!-- ChangeStatus class -->
+<string name="ChangeStatusActTitle">Beem - 改变我的状态</string>
+<string name="ChangeStatusType">我的状态</string>
+<string name="ChangeStatusMessage">我的个人消息</string>
+<string name="OpenContactList">打开联系人列表</string>
+
+<string name="MenuAddContact">添加心联系人</string>
+<string name="MenuAccountAbout">Beem项目</string>
+<string name="MenuAccountCreate">创建账号</string>
+<string name="MenuConnection">编辑账号</string>
+<string name="ChangeStatusOk">更新状态</string>
+<string name="ChangeStatusNoChange">没有东西需要改变</string>
+<string name="my_avatar">我的头像</string>
+<string name="select_avatar">选择头像</string>
+<string name="take_photo">照相</string>
+<string name="pick_photo">选择照片</string>
+<string name="delete_avatar">删除头像</string>
+<string name="photoPickerNotFoundText">找不到照片</string>
+
+
+<!-- Settings class -->
+<string name="SettingsText">修改用户名</string>
+<string name="SettingsPassword">修改密码</string>
+<string name="SettingsProxy">代理</string>
+<string name="SettingsProxyProxy">使用代理服务器</string>
+<string name="SettingsProxySummary">通过代理服务器登录</string>
+<string name="SettingsProxyType">协议</string>
+<string name="SettingsProxyTypeSummary">选择代理类型</string>
+<string name="SettingsProxyServer">修改代理服务器地址</string>
+<string name="SettingsProxyPort">修改地理服务器端口</string>
+<string name="SettingsProxyUser">可选,允许在代理服务器上注册</string>
+<string name="SettingsProxyPassword">可选,允许在代理服务器上注册</string>
+<string name="SettingsAdvanced">高级</string>
+<string name="SettingsAdvancedOptions">特定服务器选项</string>
+<string name="SettingsAdvancedRecoDelay">修改重连延时</string>
+<string name="SettingsAdvancedSpecOpt">勾选此选项以连接到特定的服务器.</string>
+<string name="SettingsAdvancedAddOpt">编辑服务器地址</string>
+<string name="SettingsAdvancedPortOpt">编辑服务器端口</string>
+<string name="SettingsResourceTitle">资源</string>
+<string name="SettingsPriorityTitle">优先级</string>
+<string name="SettingsResourceSummary">设定客户端XMPP资源</string>
+<string name="SettingsPrioritySummary">设定客户端优先级</string>
+<string name="contact_list_preferences">好友列表</string>
+<string name="contact_list_preferences_sum">A set of display options for your buddy list
+</string>
+<string name="CLP_hide_groups">隐藏组</string>
+<string name="CLP_hide_groups_sum">勾选此选项隐藏组</string>
+<string name="CLP_hidden_contact">隐藏好友</string>
+<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
+</string>
+<string name="settings_account_username">用户名</string>
+<string name="login_username_info_default">beem@beem-project.com</string>
+<string name="settings_account_password">密码</string>
+<string name="settings_account_server">服务器</string>
+<string name="settings_account_port">端口</string>
+<string name="settings_advanced_service_behaviour">服务器行为</string>
+<string name="settings_advanced_sum">高级用户设置</string>
+<string name="settings_xmpp_server">地址</string>
+<string name="comments_xmpp_server">example.com</string>
+<string name="settings_xmpp_port">端口</string>
+<string name="settings_xmpp_use_tls">使用SSL/TLS</string>
+<string name="settings_reco_delay">重连延时</string>
+<string name="comments_xmpp_port">默认端口:5222</string>
+<string name="settings_proxy_sum">代理设置</string>
+<string name="settings_proxy_use">使用代理连接</string>
+<string name="settings_proxy_type_prompt">选择代理类型</string>
+<string name="settings_proxy_server">服务器</string>
+<string name="settings_proxy_port">端口</string>
+<string name="comments_proxy_port">默认端口:1080</string>
+<string name="settings_proxy_username">用户名</string>
+<string name="settings_proxy_password">密码</string>
+<string name="away_chk_title">启用自动离开</string>
+<string name="away_chk_sum">当屏幕关闭是将状态改为离开</string>
+<string name="away_message_title">离开留言</string>
+<string name="away_message_sum">将会显示的离开留言</string>
+<string name="away_message_hint">我现在不在,我的手机屏幕关闭了</string>
+<string name="notification_preferences">通知设置</string>
+<string name="notification_enable_vibrate_title">允许振动</string>
+<string name="notification_enable_vibrate_sum">有消息来时振动</string>
+<string name="notification_snd_title">消息提示音</string>
+<string name="notification_snd_sum">设定消息提示音</string>
+<string name="settings_chat_compact">聊天协议</string>
+<string name="settings_chat_compact_sum">设定聊天协议</string>
+<string name="history">历史记录</string>
+<string name="history_sum">保存对话到SD卡</string>
+<string name="history_mount">你需要有已插入设备并可以写入的SD存储来允许历史记录</string>
+<string name="history_on_off">允许历史记录</string>
+<string name="chat_preferences">聊天</string>
+<string name="chat_preferences_sum"></string>
+<string name="chat_history_path">历史路径</string>
+<string name="chat_history_path_sum">对话保存在SD卡上的文件夹中</string>
+<string name="settings_smack_debug">允许XMPPP调试</string>
+<string name="settings_full_jid_login">使用我完整的Jid作为用户名</string>
+<string name="settings_full_jid_login_sum">某些例如Google Talk这样的服务器需要</string>
+
+<!-- Subscription class -->
+<string name="SubscriptAccept">订阅已经接受</string>
+<string name="SubscriptError">订阅错误</string>
+<string name="SubscriptRefused">订阅被拒绝</string>
+<string name="SubscriptText">%s 想要添加你到他/她的好友列表.批准他/她的请求吗?</string>
+<string name="SubscriptTitle">批准好友请求?</string>
+
+<!-- BeemChatManager -->
+<string name="BeemChatManagerNewMessage">你有一个新消息</string>
+
+<!-- BeemBroadcastReceiver class -->
+<string name="BeemBroadcastReceiverDisconnect">BEEM:你的连接已断开</string>
+
+<!-- XmppConnectionAdapter class -->
+<string name="AcceptContactRequest">%s刚将你添加到他/她的好友列表.</string>
+<string name="AcceptContactRequestFrom">批准%s联系你</string>
+
+<!-- Activities -->
+<string name="login_tag">Beem - 登录中</string>
+<string name="edit_settings_name">Beem - 设置</string>
+<string name="edit_settings_tag">Beem - 编制设置</string>
+<string name="create_account_name">Beem - 创建新账号 </string>
+<string name="create_account_tag">Beem - 创建新账号中</string>
+<string name="contact_list_name">Beem - 联系人</string>
+<string name="contact_list_tag">Beem - 联系人列表</string>
+<string name="user_info_name">Beem - 用户信息</string>
+
+<!-- Buttons -->
+<string name="button_create_account">创建这个账户</string>
+<string name="button_create_login_account">创建并使用这个账户</string>
+
+<!-- LogAs Activity -->
+<string name="login_username">用户名</string>
+<string name="login_password">密码</string>
+<string name="login_error_dialog_title">登录 - 错误</string>
+<string name="login_close_dialog_button">关闭</string>
+<string name="login_menu_create_account">创建一个账号</string>
+<string name="login_menu_settings">设置</string>
+<string name="login_menu_about">关于</string>
+<string name="login_about_title">Beem %s - 关于</string>
+<string name="login_about_msg">
+Beem is an EPITECH Innovative Project. Visit us at
+http://www.beem-project.com !
+</string>
+<string name="login_about_button">关闭</string>
+<string name="login_settings_button">设置</string>
+<string name="login_login_button">登录</string>
+<string name="login_login_progress">连接中,请等待...</string>
+<string name="login_error_msg">Unfortunately, an error occured.\n\nError
+detail:\n%s</string>
+<string name="login_menu_login">登陆</string>
+<string name="login_no_connectivity">没有可用连接</string>
+<string name="login_start_msg">菜单设置配置</string>
+
+<!-- LoginAnim activity -->
+<string name="loganim_connecting">连接中...</string>
+<string name="loganim_authenticating">验证中...</string>
+<string name="loganim_login_success">登录成功</string>
+<string name="loganim_login_failed">登录失败</string>
+
+<!-- EditSettings Activity -->
+<string name="settings_menu_create_account">创建一个账号</string>
+<string name="settings_menu_privacy_lists">管理隐私列表</string>
+<string name="settings_saved_ok">设置已成功保存</string>
+
+
+
+<!-- EditSettings Activity Categories -->
+<string name="general_preferences">通用选项</string>
+<string name="user_preferences">用户设置 (必须)</string>
+<string name="user_preferences_advanced">高级用户设置(可选)</string>
+<string name="network_preferences">网络选项</string>
+<string name="proxy_proxy_settings">代理选项</string>
+<string name="proxy_user_settings">代理选项</string>
+<string name="history_preferences">历史</string>
+<string name="chat_layout_option">聊天布局</string>
+
+
+<!-- EditSettings Activity Tabs -->
+<string name="settings_tab_tag_account">编辑账户设定</string>
+<string name="settings_tab_label_account">帐户</string>
+<string name="settings_tab_tag_xmpp">编辑XMPP设置</string>
+<string name="settings_tab_label_xmpp">XMPP</string>
+<string name="settings_tab_tag_proxy">编辑代理设置</string>
+<string name="settings_tab_label_proxy">代理</string>
+
+
+<!-- wizard activities -->
+<string name="account_wizard_text1"><b>欢迎使用BEEM.</b>\n\n您还没有设定XMPP (Jabber)账户.请选择下面的选项。\n请选择下面的选项:</string>
+<string name="account_wizard_configure_text"><b>请输入您已有账号的信息</b></string>
+<string name="account_wizard_configure_account">我想使用我已有的账号</string>
+<string name="account_wizard_create_account">我想创建一个新账号</string>
+
+<!-- Create an account Activity -->
+<string name="create_account_instr_dialog_title">创建新账号 - 向导</string>
+<string name="create_account_err_dialog_title">创建新账号 - 错误</string>
+<string name="create_account_err_dialog_settings_button">修改设置</string>
+<string name="create_account_close_dialog_button">关闭</string>
+<string name="create_account_successfull_after">账号%s已成功创建</string>
+<string name="create_account_err_username">错误的Jabber ID</string>
+<string name="create_account_err_passwords">密码不匹配。</string>
+<string name="create_account_username">用户名</string>
+<string name="create_account_password">密码</string>
+<string name="create_account_confirm_password">确认密码</string>
+
+<!-- ContactList Activity -->
+<string name="contact_list_menu_add_contact">添加联系人</string>
+<string name="contact_list_menu_status">改变状态</string>
+<string name="contact_list_menu_settings">设置</string>
+<string name="contact_list_menu_disconnect">断开连接</string>
+<string name="contact_list_all_contact">所有联系人</string>
+<string name="contact_list_no_group">没有组</string>
+
+<!-- UserInfo dialog -->
+<string name="userinfo_label_alias">别名</string>
+<string name="userinfo_label_chg_group">管理组</string>
+<string name="userinfo_label_re_subscription">重新发送邀请</string>
+<string name="userinfo_label_block">阻止</string>
+<string name="userinfo_label_delete">删除</string>
+<string name="userinfo_resend">重新发送订阅</string>
+<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
+</string>
+<string name="userinfo_yes">是</string>
+<string name="userinfo_no">否</string>
+<string name="userinfo_sureresend">确定要重新发送邀请吗?</string>
+
+<string name="chat_name">Beem - 聊天</string>
+<string name="chat_input_default_value">输入信息</string>
+<string name="chat_self">我</string>
+<string name="chat_error">错误</string>
+<string name="chat_send_message">发送</string>
+<string name="chat_menu_contacts_list">联系人列表</string>
+<string name="chat_menu_change_chat">切换聊天窗口</string>
+<string name="chat_dialog_change_chat_title">打开聊天窗口</string>
+<string name="chat_menu_close_chat">关闭聊天窗口</string>
+<string name="chat_no_more_chats">没有活动的聊天窗口</string>
+<string name="chat_state_composing">正在输入信息</string>
+<string name="chat_state_gone">已经离开了会话</string>
+<string name="chat_state_active">关注会话</string>
+<string name="chat_state_inactive">正在做其他事情</string>
+
+<string name="contact_status_msg_available">我有空</string>
+<string name="contact_status_msg_available_chat">我有空聊天</string>
+<string name="contact_status_msg_dnd">请勿打扰</string>
+<string name="contact_status_msg_away">离开</string>
+<string name="contact_status_msg_xa">没有空</string>
+<string name="contact_status_msg_offline">连接已断开</string>
+
+<string name="privacy_list_name">Beem - 管理我的隐私列表</string>
+<string name="privacy_list_no_data">没有隐私列表</string>
+<string name="privacy_list_menu_create">创建隐私列表</string>
+<string name="privacy_list_create_dialog_title">创建隐私列表</string>
+<string name="privacy_list_create_dialog_list_name_label">标题</string>
+<string name="privacy_list_create_dialog_create_button">创建</string>
+<string name="privacy_list_select_dialog_buddies">好友</string>
+<string name="privacy_list_select_dialog_groups">组</string>
+<string name="privacy_list_select_dialog_delete">删除</string>
+<string name="privacy_list_delete_dialog_msg">确定要删除 \'%s\'隐私列表吗 ?</string>
+<string name="privacy_list_delete_dialog_yes">是</string>
+<string name="privacy_list_delete_dialog_no">否</string>
+
+<string name="UpdateButton">更新</string>
+
+<!-- Error messages -->
+
+<string name="error_login_authentication">验证时发生错误,用户名或者密码错误.</string>
+
+<string name="interna_server_error">远程服务器错误</string>
+<string name="bad_request">错误的请求</string>
+<string name="forbidden">被拒绝</string>
+<string name="item_not_found">项目未找到</string>
+<string name="conflict">冲突</string>
+<string name="feature_not_implemented">功能未实现</string>
+<string name="gone">离开</string>
+<string name="jid_malformed">Jid畸形</string>
+<string name="no_acceptable">无法接受</string>
+<string name="not_allowed">未被允许</string>
+<string name="not_authorized">未验证</string>
+<string name="payment_required">需要付费</string>
+<string name="recipient_unavailable">接收方无响应</string>
+<string name="redirect">重定向</string>
+<string name="registration_required">需要注册</string>
+<string name="remote_server_not_found">未发现远程服务器</string>
+<string name="remote_server_timeout">远程服务器未响应</string>
+<string name="remote_server_error">远程服务器错误</string>
+<string name="resource_constraint">资源限制</string>
+<string name="service_unavailable">暂时无法提供服务</string>
+<string name="subscription_required">需要订阅</string>
+<string name="undefined_condition">未定义的情况</string>
+<string name="unexpected_condition">例外情况</string>
+<string name="request_timeout">请求超时</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-zh-rTW/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="default_smiley_names">
+ <item msgid="1831934949361041701">"開心"</item>
+ <item msgid="1601611480575517120">"傷心"</item>
+ <item msgid="1531181614218625881">"眨眼"</item>
+ <item msgid="3858808057949077894">"吐舌頭"</item>
+ <item msgid="7835238297967185651">"驚訝"</item>
+ <item msgid="1756223535005296033">"紅唇"</item>
+ <item msgid="1093906245140165107">"大喊"</item>
+ <item msgid="888834839864150170">"酷"</item>
+ <item msgid="6320683740534773967">"滿嘴錢"</item>
+ <item msgid="6610111212478853990">"說錯話"</item>
+ <item msgid="1706035208563940251">"害羞"</item>
+ <item msgid="9079275787422313427">"天使"</item>
+ <item msgid="4630490399784004880">"還沒決定"</item>
+ <item msgid="7002574538342357456">"嚎啕大哭"</item>
+ <item msgid="850324578089267455">"不要告訴別人"</item>
+ <item msgid="6334637439528489607">"開懷大笑"</item>
+ <item msgid="7602915122893958066">"疑惑"</item>
+ <item msgid="3939233701582771068">"愛心"</item>
+ <item msgid="1414759480575851587">"生氣"</item>
+ <item msgid="8479809115158836070">"傻笑"</item>
+ <item msgid="638612939305162424">"撲克臉"</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values-zh-rTW/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+<!-- Generic terms -->
+<string name="app_name">Beem</string>
+<string name="OkButton">确定</string>
+<string name="ClearButton">清除</string>
+<string name="CancelButton">取消</string>
+<string name="AcceptButton">认证</string>
+<string name="RefuseButton">拒绝</string>
+<string name="JabberID">Jabber账号 </string>
+<string name="Password">密码</string>
+<string name="Continue">继续</string>
+
+<!-- AccountConfigure class -->
+<string name="AccountConfigureManualConfiguration">手动设置</string>
+
+<!-- Beem class -->
+<string name="BeemJabberID">Jabber账号 </string>
+
+<!-- BeemApplication class -->
+<string name="BeemApplicationConnect">连接中...</string>
+
+<!-- BeemService class -->
+<string name="BeemServiceDescription">使用Beem服务</string>
+<string name="BeemServiceCreated">Beem服务已创建</string>
+<string name="BeemServiceDestroyed">Beem服务已取消</string>
+
+<!-- ContactDialog class -->
+<string name="CDChat">聊天</string>
+<string name="CDCall">呼叫</string>
+<string name="CDInfos">用户管理</string>
+
+<!-- AddContact class -->
+<string name="AddCActTitle">Beem - 添加连接</string>
+
+<string name="AddCLogin">用户名</string>
+<string name="AddCAlias">别名</string>
+<string name="AddCGroup">组</string>
+<string name="AddCOkButton">添加</string>
+<string name="AddCContactAdded">联系人已成功添加</string>
+<string name="AddCContactAddedError">联系人添加错误</string>
+<string name="AddCContactAddedLoginError">登录错误</string>
+<string name="AddCBadForm">格式错误</string>
+<string name="AddCContactAlready">联系人已存在</string>
+
+<!-- ChangeStatus class -->
+<string name="ChangeStatusActTitle">Beem - 改变我的状态</string>
+<string name="ChangeStatusType">我的状态</string>
+<string name="ChangeStatusMessage">我的个人消息</string>
+<string name="OpenContactList">打开联系人列表</string>
+
+<string name="MenuAddContact">添加心联系人</string>
+<string name="MenuAccountAbout">Beem项目</string>
+<string name="MenuAccountCreate">创建账号</string>
+<string name="MenuConnection">编辑账号</string>
+<string name="ChangeStatusOk">更新状态</string>
+<string name="ChangeStatusNoChange">没有东西需要改变</string>
+<string name="my_avatar">我的头像</string>
+<string name="select_avatar">选择头像</string>
+<string name="take_photo">照相</string>
+<string name="pick_photo">选择照片</string>
+<string name="delete_avatar">删除头像</string>
+<string name="photoPickerNotFoundText">找不到照片</string>
+
+
+<!-- Settings class -->
+<string name="SettingsText">修改用户名</string>
+<string name="SettingsPassword">修改密码</string>
+<string name="SettingsProxy">代理</string>
+<string name="SettingsProxyProxy">使用代理服务器</string>
+<string name="SettingsProxySummary">通过代理服务器登录</string>
+<string name="SettingsProxyType">协议</string>
+<string name="SettingsProxyTypeSummary">选择代理类型</string>
+<string name="SettingsProxyServer">修改代理服务器地址</string>
+<string name="SettingsProxyPort">修改地理服务器端口</string>
+<string name="SettingsProxyUser">可选,允许在代理服务器上注册</string>
+<string name="SettingsProxyPassword">可选,允许在代理服务器上注册</string>
+<string name="SettingsAdvanced">高级</string>
+<string name="SettingsAdvancedOptions">特定服务器选项</string>
+<string name="SettingsAdvancedRecoDelay">修改重连延时</string>
+<string name="SettingsAdvancedSpecOpt">勾选此选项以连接到特定的服务器.</string>
+<string name="SettingsAdvancedAddOpt">编辑服务器地址</string>
+<string name="SettingsAdvancedPortOpt">编辑服务器端口</string>
+<string name="SettingsResourceTitle">资源</string>
+<string name="SettingsPriorityTitle">优先级</string>
+<string name="SettingsResourceSummary">设定客户端XMPP资源</string>
+<string name="SettingsPrioritySummary">设定客户端优先级</string>
+<string name="contact_list_preferences">好友列表</string>
+<string name="contact_list_preferences_sum">A set of display options for your buddy list
+</string>
+<string name="CLP_hide_groups">隐藏组</string>
+<string name="CLP_hide_groups_sum">勾选此选项隐藏组</string>
+<string name="CLP_hidden_contact">隐藏好友</string>
+<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
+</string>
+<string name="settings_account_username">用户名</string>
+<string name="login_username_info_default">beem@beem-project.com</string>
+<string name="settings_account_password">密码</string>
+<string name="settings_account_server">服务器</string>
+<string name="settings_account_port">端口</string>
+<string name="settings_advanced_service_behaviour">服务器行为</string>
+<string name="settings_advanced_sum">高级用户设置</string>
+<string name="settings_xmpp_server">地址</string>
+<string name="comments_xmpp_server">example.com</string>
+<string name="settings_xmpp_port">端口</string>
+<string name="settings_xmpp_use_tls">使用SSL/TLS</string>
+<string name="settings_reco_delay">重连延时</string>
+<string name="comments_xmpp_port">默认端口:5222</string>
+<string name="settings_proxy_sum">代理设置</string>
+<string name="settings_proxy_use">使用代理连接</string>
+<string name="settings_proxy_type_prompt">选择代理类型</string>
+<string name="settings_proxy_server">服务器</string>
+<string name="settings_proxy_port">端口</string>
+<string name="comments_proxy_port">默认端口:1080</string>
+<string name="settings_proxy_username">用户名</string>
+<string name="settings_proxy_password">密码</string>
+<string name="away_chk_title">启用自动离开</string>
+<string name="away_chk_sum">当屏幕关闭是将状态改为离开</string>
+<string name="away_message_title">离开留言</string>
+<string name="away_message_sum">将会显示的离开留言</string>
+<string name="away_message_hint">我现在不在,我的手机屏幕关闭了</string>
+<string name="notification_preferences">通知设置</string>
+<string name="notification_enable_vibrate_title">允许振动</string>
+<string name="notification_enable_vibrate_sum">有消息来时振动</string>
+<string name="notification_snd_title">消息提示音</string>
+<string name="notification_snd_sum">设定消息提示音</string>
+<string name="settings_chat_compact">聊天协议</string>
+<string name="settings_chat_compact_sum">设定聊天协议</string>
+<string name="history">历史记录</string>
+<string name="history_sum">保存对话到SD卡</string>
+<string name="history_mount">你需要有已插入设备并可以写入的SD存储来允许历史记录</string>
+<string name="history_on_off">允许历史记录</string>
+<string name="chat_preferences">聊天</string>
+<string name="chat_preferences_sum"></string>
+<string name="chat_history_path">历史路径</string>
+<string name="chat_history_path_sum">对话保存在SD卡上的文件夹中</string>
+<string name="settings_smack_debug">允许XMPPP调试</string>
+<string name="settings_full_jid_login">使用我完整的Jid作为用户名</string>
+<string name="settings_full_jid_login_sum">某些例如Google Talk这样的服务器需要</string>
+
+<!-- Subscription class -->
+<string name="SubscriptAccept">订阅已经接受</string>
+<string name="SubscriptError">订阅错误</string>
+<string name="SubscriptRefused">订阅被拒绝</string>
+<string name="SubscriptText">%s 想要添加你到他/她的好友列表.批准他/她的请求吗?</string>
+<string name="SubscriptTitle">批准好友请求?</string>
+
+<!-- BeemChatManager -->
+<string name="BeemChatManagerNewMessage">你有一个新消息</string>
+
+<!-- BeemBroadcastReceiver class -->
+<string name="BeemBroadcastReceiverDisconnect">BEEM:你的连接已断开</string>
+
+<!-- XmppConnectionAdapter class -->
+<string name="AcceptContactRequest">%s刚将你添加到他/她的好友列表.</string>
+<string name="AcceptContactRequestFrom">批准%s联系你</string>
+
+<!-- Activities -->
+<string name="login_tag">Beem - 登录中</string>
+<string name="edit_settings_name">Beem - 设置</string>
+<string name="edit_settings_tag">Beem - 编制设置</string>
+<string name="create_account_name">Beem - 创建新账号 </string>
+<string name="create_account_tag">Beem - 创建新账号中</string>
+<string name="contact_list_name">Beem - 联系人</string>
+<string name="contact_list_tag">Beem - 联系人列表</string>
+<string name="user_info_name">Beem - 用户信息</string>
+
+<!-- Buttons -->
+<string name="button_create_account">创建这个账户</string>
+<string name="button_create_login_account">创建并使用这个账户</string>
+
+<!-- LogAs Activity -->
+<string name="login_username">用户名</string>
+<string name="login_password">密码</string>
+<string name="login_error_dialog_title">登录 - 错误</string>
+<string name="login_close_dialog_button">关闭</string>
+<string name="login_menu_create_account">创建一个账号</string>
+<string name="login_menu_settings">设置</string>
+<string name="login_menu_about">关于</string>
+<string name="login_about_title">Beem %s - 关于</string>
+<string name="login_about_msg">
+Beem is an EPITECH Innovative Project. Visit us at
+http://www.beem-project.com !
+</string>
+<string name="login_about_button">关闭</string>
+<string name="login_settings_button">设置</string>
+<string name="login_login_button">登录</string>
+<string name="login_login_progress">连接中,请等待...</string>
+<string name="login_error_msg">Unfortunately, an error occured.\n\nError
+detail:\n%s</string>
+<string name="login_menu_login">登陆</string>
+<string name="login_no_connectivity">没有可用连接</string>
+<string name="login_start_msg">菜单设置配置</string>
+
+<!-- LoginAnim activity -->
+<string name="loganim_connecting">连接中...</string>
+<string name="loganim_authenticating">验证中...</string>
+<string name="loganim_login_success">登录成功</string>
+<string name="loganim_login_failed">登录失败</string>
+
+<!-- EditSettings Activity -->
+<string name="settings_menu_create_account">创建一个账号</string>
+<string name="settings_menu_privacy_lists">管理隐私列表</string>
+<string name="settings_saved_ok">设置已成功保存</string>
+
+
+
+<!-- EditSettings Activity Categories -->
+<string name="general_preferences">通用选项</string>
+<string name="user_preferences">用户设置 (必须)</string>
+<string name="user_preferences_advanced">高级用户设置(可选)</string>
+<string name="network_preferences">网络选项</string>
+<string name="proxy_proxy_settings">代理选项</string>
+<string name="proxy_user_settings">代理选项</string>
+<string name="history_preferences">历史</string>
+<string name="chat_layout_option">聊天布局</string>
+
+
+<!-- EditSettings Activity Tabs -->
+<string name="settings_tab_tag_account">编辑账户设定</string>
+<string name="settings_tab_label_account">帐户</string>
+<string name="settings_tab_tag_xmpp">编辑XMPP设置</string>
+<string name="settings_tab_label_xmpp">XMPP</string>
+<string name="settings_tab_tag_proxy">编辑代理设置</string>
+<string name="settings_tab_label_proxy">代理</string>
+
+
+<!-- wizard activities -->
+<string name="account_wizard_text1"><b>欢迎使用BEEM.</b>\n\n您还没有设定XMPP (Jabber)账户.请选择下面的选项。\n请选择下面的选项:</string>
+<string name="account_wizard_configure_text"><b>请输入您已有账号的信息</b></string>
+<string name="account_wizard_configure_account">我想使用我已有的账号</string>
+<string name="account_wizard_create_account">我想创建一个新账号</string>
+
+<!-- Create an account Activity -->
+<string name="create_account_instr_dialog_title">创建新账号 - 向导</string>
+<string name="create_account_err_dialog_title">创建新账号 - 错误</string>
+<string name="create_account_err_dialog_settings_button">修改设置</string>
+<string name="create_account_close_dialog_button">关闭</string>
+<string name="create_account_successfull_after">账号%s已成功创建</string>
+<string name="create_account_err_username">错误的Jabber ID</string>
+<string name="create_account_err_passwords">密码不匹配。</string>
+<string name="create_account_username">用户名</string>
+<string name="create_account_password">密码</string>
+<string name="create_account_confirm_password">确认密码</string>
+
+<!-- ContactList Activity -->
+<string name="contact_list_menu_add_contact">添加联系人</string>
+<string name="contact_list_menu_status">改变状态</string>
+<string name="contact_list_menu_settings">设置</string>
+<string name="contact_list_menu_disconnect">断开连接</string>
+<string name="contact_list_all_contact">所有联系人</string>
+<string name="contact_list_no_group">没有组</string>
+
+<!-- UserInfo dialog -->
+<string name="userinfo_label_alias">别名</string>
+<string name="userinfo_label_chg_group">管理组</string>
+<string name="userinfo_label_re_subscription">重新发送邀请</string>
+<string name="userinfo_label_block">阻止</string>
+<string name="userinfo_label_delete">删除</string>
+<string name="userinfo_resend">重新发送订阅</string>
+<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
+</string>
+<string name="userinfo_yes">是</string>
+<string name="userinfo_no">否</string>
+<string name="userinfo_sureresend">确定要重新发送邀请吗?</string>
+
+<string name="chat_name">Beem - 聊天</string>
+<string name="chat_input_default_value">输入信息</string>
+<string name="chat_self">我</string>
+<string name="chat_error">错误</string>
+<string name="chat_send_message">发送</string>
+<string name="chat_menu_contacts_list">联系人列表</string>
+<string name="chat_menu_change_chat">切换聊天窗口</string>
+<string name="chat_dialog_change_chat_title">打开聊天窗口</string>
+<string name="chat_menu_close_chat">关闭聊天窗口</string>
+<string name="chat_no_more_chats">没有活动的聊天窗口</string>
+<string name="chat_state_composing">正在输入信息</string>
+<string name="chat_state_gone">已经离开了会话</string>
+<string name="chat_state_active">关注会话</string>
+<string name="chat_state_inactive">正在做其他事情</string>
+
+<string name="contact_status_msg_available">我有空</string>
+<string name="contact_status_msg_available_chat">我有空聊天</string>
+<string name="contact_status_msg_dnd">请勿打扰</string>
+<string name="contact_status_msg_away">离开</string>
+<string name="contact_status_msg_xa">没有空</string>
+<string name="contact_status_msg_offline">连接已断开</string>
+
+<string name="privacy_list_name">Beem - 管理我的隐私列表</string>
+<string name="privacy_list_no_data">没有隐私列表</string>
+<string name="privacy_list_menu_create">创建隐私列表</string>
+<string name="privacy_list_create_dialog_title">创建隐私列表</string>
+<string name="privacy_list_create_dialog_list_name_label">标题</string>
+<string name="privacy_list_create_dialog_create_button">创建</string>
+<string name="privacy_list_select_dialog_buddies">好友</string>
+<string name="privacy_list_select_dialog_groups">组</string>
+<string name="privacy_list_select_dialog_delete">删除</string>
+<string name="privacy_list_delete_dialog_msg">确定要删除 \'%s\'隐私列表吗 ?</string>
+<string name="privacy_list_delete_dialog_yes">是</string>
+<string name="privacy_list_delete_dialog_no">否</string>
+
+<string name="UpdateButton">更新</string>
+
+<!-- Error messages -->
+
+<string name="error_login_authentication">验证时发生错误,用户名或者密码错误.</string>
+
+<string name="interna_server_error">远程服务器错误</string>
+<string name="bad_request">错误的请求</string>
+<string name="forbidden">被拒绝</string>
+<string name="item_not_found">项目未找到</string>
+<string name="conflict">冲突</string>
+<string name="feature_not_implemented">功能未实现</string>
+<string name="gone">离开</string>
+<string name="jid_malformed">Jid畸形</string>
+<string name="no_acceptable">无法接受</string>
+<string name="not_allowed">未被允许</string>
+<string name="not_authorized">未验证</string>
+<string name="payment_required">需要付费</string>
+<string name="recipient_unavailable">接收方无响应</string>
+<string name="redirect">重定向</string>
+<string name="registration_required">需要注册</string>
+<string name="remote_server_not_found">未发现远程服务器</string>
+<string name="remote_server_timeout">远程服务器未响应</string>
+<string name="remote_server_error">远程服务器错误</string>
+<string name="resource_constraint">资源限制</string>
+<string name="service_unavailable">暂时无法提供服务</string>
+<string name="subscription_required">需要订阅</string>
+<string name="undefined_condition">未定义的情况</string>
+<string name="unexpected_condition">例外情况</string>
+<string name="request_timeout">请求超时</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values/arrays.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string-array name="proxy_types">
+ <item>HTTP</item>
+ <item>SOCKS4</item>
+ <item>SOCKS5</item>
+ </string-array>
+ <string-array name="status_types">
+ <item name="AvailableForChat">@string/contact_status_msg_available_chat</item>
+ <item name="Available">@string/contact_status_msg_available</item>
+ <item name="Busy">@string/contact_status_msg_dnd</item>
+ <item name="Away">@string/contact_status_msg_away</item>
+ <item name="Unavailable">@string/contact_status_msg_xa</item>
+ <item name="Disconnected">@string/contact_status_msg_offline</item>
+ </string-array>
+ <string-array name="pick_photo_items">
+ <item>@string/take_photo</item>
+ <item>@string/pick_photo</item>
+ <item>@string/delete_avatar</item>
+ </string-array>
+ <string-array name="loganim_state">
+ <item>@string/loganim_connecting</item>
+ <item>@string/loganim_authenticating</item>
+ <item>@string/loganim_login_success</item>
+ <item>@string/loganim_login_failed</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values/colors.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="blue_sky">#A0C8FF</color>
+ <color name="vert_manu">#CCFF00</color>
+ <color name="black">#000000</color>
+ <color name="white">#FFFFFF</color>
+ <color name="red">#FF0000</color>
+</resources>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values/smileys.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<resources>
+ <!-- NOTE: if you change anything about this array, you must make the corresponding change
+ to the array DEFAULT_SMILEY_RES_IDS in MessageListItem.java and to default_smiley_names
+ below. -->
+ <string-array name="default_smiley_texts" translatable="false">
+ <item>:-)</item> <!-- 0: Happy -->
+ <item>:-(</item> <!-- 1: Sad -->
+ <item>;-)</item> <!-- 2: Winking -->
+ <item>:-P</item> <!-- 3: Tongue sticking out -->
+ <item>=-O</item> <!-- 4: Surprised -->
+ <item>:-*</item> <!-- 5: Kissing -->
+ <item>:O</item> <!-- 6: Yelling -->
+ <item>B-)</item> <!-- 7: Cool -->
+ <item>:-$</item> <!-- 8: Money mouth -->
+ <item>:-!</item> <!-- 9: Foot in mouth -->
+ <item>:-[</item> <!-- 10: Embarrassed -->
+ <item>O:-)</item> <!-- 11: Angel -->
+ <item>:-\\</item> <!-- 12: Undecided -->
+ <item>:\'(</item> <!-- 13: Crying -->
+ <item>:-X</item> <!-- 14: Lips are sealed -->
+ <item>:-D</item> <!-- 15: Laughing -->
+ <item>o_O</item> <!-- 16: Confused -->
+ <item><3</item> <!-- 17: Heart -->
+ <item>x-(</item> <!-- 18: Mad -->
+ <item>:-/</item> <!-- 19: Smirk -->
+ <item>:-I</item> <!-- 20: Poker face -->
+ </string-array>
+
+ <!-- NOTE: if you change anything about this array, you must make the corresponding change
+ to the array DEFAULT_SMILEY_RES_IDS in SmileyParser.java and to default_smiley_texts
+ above. -->
+ <string-array name="default_smiley_names">
+ <item>Happy</item> <!-- 0: :-) -->
+ <item>Sad</item> <!-- 1: :-( -->
+ <item>Winking</item> <!-- 2: ;-) -->
+ <item>Tongue sticking out</item> <!-- 3: :-P -->
+ <item>Surprised</item> <!-- 4: =-O -->
+ <item>Kissing</item> <!-- 5: :-* -->
+ <item>Yelling</item> <!-- 6: :O -->
+ <item>Cool</item> <!-- 7: B-) -->
+ <item>Money mouth</item> <!-- 8: :-$ -->
+ <item>Foot in mouth</item> <!-- 9: :-! -->
+ <item>Embarrassed</item> <!-- 10: :-[ -->
+ <item>Angel</item> <!-- 11: O:-) -->
+ <item>Undecided</item> <!-- 12: :-\\ -->
+ <item>Crying</item> <!-- 13: :\'( -->
+ <item>Lips are sealed</item> <!-- 14: :-X -->
+ <item>Laughing</item> <!-- 15: :-D -->
+ <item>Confused</item> <!-- 16: o_O -->
+ <item>Heart</item> <!-- 17: <3 -->
+ <item>Mad</item> <!-- 18: x-( -->
+ <item>Smirk</item> <!-- 19: :-/ -->
+ <item>Poker face</item> <!-- 20: :-I -->
+ </string-array>
+
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values/strings.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,322 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Generic terms -->
+ <string name="app_name">Beem</string>
+ <string name="OkButton">Ok</string>
+ <string name="ClearButton">Clear</string>
+ <string name="CancelButton">Cancel</string>
+ <string name="AcceptButton">Authorize</string>
+ <string name="RefuseButton">Deny</string>
+ <string name="JabberID">Jabber ID</string>
+ <string name="Password">Password</string>
+ <string name="Continue">Continue</string>
+
+ <!-- AccountConfigure class -->
+ <string name="AccountConfigureManualConfiguration">Manual Configuration</string>
+
+ <!-- BeemService class -->
+ <string name="BeemServiceDescription">Use Beem Service</string>
+
+ <!-- ContactDialog class -->
+ <string name="CDChat">Chat</string>
+ <string name="CDCall">Call</string>
+ <string name="CDInfos">Manage User</string>
+
+ <!-- AddContact class -->
+ <string name="AddCActTitle">Beem - Add a contact</string>
+
+ <string name="AddCLogin">Username</string>
+ <string name="AddCAlias">Alias</string>
+ <string name="AddCGroup">Group</string>
+ <string name="AddCOkButton">Add</string>
+ <string name="AddCContactAdded">Contact added</string>
+ <string name="AddCContactAddedError">Error Contact not added</string>
+ <string name="AddCContactAddedLoginError">Error Login</string>
+ <string name="AddCContactAlready">Contact already exist</string>
+
+ <!-- ChangeStatus class -->
+ <string name="ChangeStatusActTitle">Beem - Change my status</string>
+ <string name="ChangeStatusType">My status</string>
+ <string name="ChangeStatusMessage">My status message</string>
+ <string name="OpenContactList">Open contact list</string>
+
+ <string name="ChangeStatusOk">Updating status</string>
+ <string name="my_avatar">My avatar</string>
+ <string name="select_avatar">Choose your avatar</string>
+ <string name="take_photo">Take a photo</string>
+ <string name="pick_photo">Select a picture</string>
+ <string name="delete_avatar">No avatar</string>
+ <string name="photoPickerNotFoundText">Photo picker not found</string>
+
+
+ <!-- Settings class -->
+ <string name="SettingsProxy">Proxy</string>
+ <string name="SettingsProxyProxy">Use a proxy server</string>
+ <string name="SettingsProxySummary">Login through a proxy server</string>
+ <string name="SettingsProxyType">Protocol</string>
+ <string name="SettingsProxyTypeSummary">Choose the proxy server type</string>
+ <string name="SettingsProxyServer">Edit proxy server address</string>
+ <string name="SettingsProxyPort">Edit proxy server port</string>
+ <string name="SettingsProxyUser">Optional, allow to authenticate yourself on the proxy server</string>
+ <string name="SettingsProxyPassword">Optional, allow to authenticate yourself on the proxy server</string>
+ <string name="SettingsAdvanced">Advanced</string>
+ <string name="SettingsAdvancedOptions">Specific server option</string>
+ <string name="SettingsAdvancedRecoDelay">Modify reconnection delay</string>
+ <string name="SettingsAdvancedSpecOpt">Check this box if you want to use a specific server for your connection</string>
+ <string name="SettingsAdvancedAddOpt">Edit the server address</string>
+ <string name="SettingsAdvancedPortOpt">Edit the server port</string>
+ <string name="SettingsResourceTitle">Resource</string>
+ <string name="SettingsPriorityTitle">Priority</string>
+ <string name="SettingsResourceSummary">Set the XMPP resource of your client </string>
+ <string name="SettingsPrioritySummary">Set the priority of your client</string>
+ <string name="contact_list_preferences">Buddy list</string>
+ <string name="contact_list_preferences_sum">A set of display options for your buddy list
+ </string>
+ <string name="CLP_hide_groups">Hide groups</string>
+ <string name="CLP_hide_groups_sum">Check this option to hide groups</string>
+ <string name="CLP_show_jid">Show JID</string>
+ <string name="CLP_show_jid_sum">Check this option to always show Contact\'s JID</string>
+ <string name="CLP_hidden_contact">Hide buddies</string>
+ <string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
+ </string>
+ <string name="settings_account_username">Username (JID)</string>
+ <string name="settings_account_password">Password</string>
+ <string name="settings_account_server">Server</string>
+ <string name="settings_account_port">Port</string>
+ <string name="settings_advanced_service_behaviour">Service behaviour</string>
+ <string name="settings_advanced_sum">A set of options for advanced users</string>
+ <string name="settings_xmpp_server">Address</string>
+ <string name="comments_xmpp_server">example.com</string>
+ <string name="settings_xmpp_port">Port</string>
+ <string name="settings_xmpp_use_tls">Require SSL/TLS</string>
+ <string name="settings_reco_delay">Reconnection delay</string>
+ <string name="comments_xmpp_port">Default: 5222</string>
+ <string name="settings_proxy_sum">Settings for proxy usage</string>
+ <string name="settings_proxy_use">Connect using a proxy</string>
+ <string name="settings_proxy_type_prompt">Choose a type of proxy</string>
+ <string name="settings_proxy_server">Server</string>
+ <string name="settings_proxy_port">Port</string>
+ <string name="comments_proxy_port">Default: 1080</string>
+ <string name="settings_proxy_username">Username</string>
+ <string name="settings_proxy_password">Password</string>
+ <string name="away_chk_title">Enable Auto-away</string>
+ <string name="away_chk_sum">Change status to Away when the screen is turned off</string>
+ <string name="away_message_title">Away message</string>
+ <string name="away_message_sum">The away message that will be displayed</string>
+ <string name="away_message_hint">I\'m away, my cellphone screen is off</string>
+ <string name="notification_preferences">Notification settings</string>
+ <string name="notification_enable_vibrate_title">Enable vibrate</string>
+ <string name="notification_enable_vibrate_sum">Enable vibrate on incoming messages</string>
+ <string name="notification_snd_title">Message ringtone</string>
+ <string name="notification_snd_sum">Set your incoming message ringtone</string>
+ <string name="settings_chat_compact">Chat compact</string>
+ <string name="settings_chat_compact_sum">Set the chat windows compact</string>
+ <string name="history">History</string>
+ <string name="history_sum">Check this to save chats on the SDCard</string>
+ <string name="chat_preferences">Chat</string>
+ <string name="chat_preferences_sum">History, Layout size ...</string>
+ <string name="chat_history_path">History path</string>
+ <string name="chat_history_path_sum">Chat conversations are saved in a folder on the SDCard</string>
+ <string name="settings_smack_debug">Enable XMPP debug</string>
+ <string name="settings_full_jid_login">Use my full JID as username</string>
+ <string name="settings_full_jid_login_sum">Need by some server such as Google Talk</string>
+
+ <!-- Subscription class -->
+ <string name="SubscriptAccept">Subscription accepted</string>
+ <string name="SubscriptError">Subscription error</string>
+ <string name="SubscriptRefused">Subscription refused</string>
+ <string name="SubscriptText">%s wants to add you to his/her buddy list. Do you want to authorize him/her?</string>
+ <string name="SubscriptTitle">Authorize buddy?</string>
+
+ <!-- BeemBroadcastReceiver class -->
+ <string name="BeemBroadcastReceiverDisconnect">BEEM: You have been disconnected</string>
+
+ <!-- XmppConnectionAdapter class -->
+ <string name="AcceptContactRequest">%s has just added you to his/her buddy list.</string>
+ <string name="AcceptContactRequestFrom">Authorize %s to contact you.</string>
+
+ <!-- Activities -->
+ <string name="edit_settings_name">Beem - Settings</string>
+ <string name="create_account_name">Beem - Create an account</string>
+ <string name="contact_list_name">Beem - Contacts</string>
+ <string name="user_info_name">Beem - User Info</string>
+
+ <!-- LogAs Activity -->
+ <string name="login_menu_settings">Settings</string>
+ <string name="login_menu_about">About</string>
+ <string name="login_about_title">Beem %s - About</string>
+ <string name="login_about_msg">
+ Beem is an EPITECH Innovative Project. Visit us at
+ http://www.beem-project.com !
+ </string>
+ <string name="login_about_button">Close</string>
+ <string name="login_login_progress">Connecting. Please wait...</string>
+ <string name="login_menu_login">Login</string>
+ <string name="login_start_msg">Settings configuration in menu</string>
+
+ <!-- LoginAnim activity -->
+ <string name="loganim_connecting">Connecting ...</string>
+ <string name="loganim_authenticating">Authenticating ...</string>
+ <string name="loganim_login_success">Login success</string>
+ <string name="loganim_login_failed">Login failed</string>
+
+ <!-- EditSettings Activity -->
+ <string name="settings_menu_create_account">Create an account</string>
+ <string name="settings_menu_privacy_lists">Manage my privacy lists</string>
+ <string name="settings_saved_ok">The settings have been saved successfully.</string>
+
+
+
+ <!-- EditSettings Activity Categories -->
+ <string name="general_preferences">General preferences</string>
+ <string name="user_preferences">Account (required)</string>
+ <string name="user_preferences_advanced">User settings advanced (optional)</string>
+ <string name="network_preferences">Network options</string>
+ <string name="proxy_proxy_settings">Proxy settings</string>
+ <string name="proxy_user_settings">Proxy settings</string>
+ <string name="history_preferences">History</string>
+ <string name="chat_layout_option">Chat layout</string>
+
+
+ <!-- EditSettings Activity Tabs -->
+ <string name="settings_tab_tag_account">edit_settings_tab_account</string>
+ <string name="settings_tab_label_account">Account</string>
+ <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
+ <string name="settings_tab_label_xmpp">XMPP</string>
+ <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
+ <string name="settings_tab_label_proxy">Proxy</string>
+
+
+ <!-- wizard activities -->
+ <string name="account_wizard_text1"><b>Welcome on BEEM.</b>\n\nYou have not configured an XMPP (Jabber) account yet.\nChoose one of the following options :</string>
+ <string name="account_wizard_configure_text_1">Use an account store on the device</string>
+ <string name="account_wizard_configure_text_2"><b>or</b></string>
+ <string name="account_wizard_configure_text_3">Fill in the data for your existing account</string>
+ <string name="account_wizard_settings_warn"><b>Warning: </b>Your settings are set to use a server proxy or a specific server hostname.</string>
+ <string name="account_wizard_connection_failed"><b>Unable to authenticate your account. Please verify your credentials</b></string>
+ <string name="account_wizard_select_account_btn">Choose an account</string>
+
+ <string name="account_wizard_configure_account">I already have an account I want to use</string>
+ <string name="account_wizard_create_account">I want to register for a new account</string>
+
+ <!-- Create an account Activity -->
+ <string name="create_account_text">Enter the required informations to create your account</string>
+ <string name="create_account_progress_title">Account creation</string>
+ <string name="create_account_progress_message">Please wait</string>
+ <string name="create_account_err_username">Bad JabberID</string>
+ <string name="create_account_err_passwords">Passwords do not match.</string>
+ <string name="create_account_username">Username</string>
+ <string name="create_account_password">Password</string>
+ <string name="create_account_confirm_password">Confirm password</string>
+ <string name="create_account_err_conflict">This account is already used. Please try another one</string>
+ <string name="create_account_err_connection">The selected server is not available. Please try another one</string>
+
+
+ <!-- ContactList Activity -->
+ <string name="contact_list_menu_add_contact">Add a contact</string>
+ <string name="contact_list_menu_status">Change status</string>
+ <string name="contact_list_menu_settings">Settings</string>
+ <string name="contact_list_menu_disconnect">Disconnect</string>
+ <string name="contact_list_all_contact">All contacts</string>
+ <string name="contact_list_no_group">No group</string>
+
+ <!-- UserInfo dialog -->
+ <string name="userinfo_label_alias">Alias</string>
+ <string name="userinfo_label_chg_group">Manage groups</string>
+ <string name="userinfo_label_re_subscription">Resend invit</string>
+ <string name="userinfo_label_block">Block</string>
+ <string name="userinfo_label_delete">Delete</string>
+ <string name="userinfo_resend">Suscription resend</string>
+ <string name="userinfo_sure2delete">Are you sure you want to delete this contact?
+ </string>
+ <string name="userinfo_yes">Yes</string>
+ <string name="userinfo_no">No</string>
+ <string name="userinfo_sureresend">Are you sure you want to resend invit?</string>
+
+ <string name="chat_name">Beem - Chat</string>
+ <string name="chat_input_default_value">Type your message</string>
+ <string name="chat_self">Me</string>
+ <string name="chat_error">Error</string>
+ <string name="chat_send_message">Send</string>
+ <string name="chat_menu_contacts_list">Contacts list</string>
+ <string name="chat_menu_change_chat">Switch chat</string>
+ <string name="chat_menu_start_otr_session">Start OTR session</string>
+ <string name="chat_menu_stop_otr_session">Stop OTR session</string>
+ <string name="chat_menu_otr_verify_key">OTR verify key</string>
+ <string name="chat_menu_otr_submenu">OTR actions</string>
+ <string name="chat_dialog_change_chat_title">Opened chats</string>
+ <string name="chat_menu_close_chat">Close this chat</string>
+ <string name="chat_no_more_chats">No more active chats</string>
+ <string name="chat_state_composing">is composing a message</string>
+ <string name="chat_state_gone">has left the conversation</string>
+ <string name="chat_state_active">pays attention to the conversation</string>
+ <string name="chat_state_inactive">is doing another thing</string>
+ <string name="chat_otrstate_plaintext">PLAINTEXT</string>
+ <string name="chat_otrstate_encrypted">ENCRYPTED</string>
+ <string name="chat_otrstate_finished">FINISHED</string>
+ <string name="chat_otrstate_authenticated">AUTHENTICATED</string>
+ <string name="chat_otr_verify_key" formatted="false">
+ Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
+ To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
+ If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
+ Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
+
+ <string name="contact_status_msg_available">Available</string>
+ <string name="contact_status_msg_available_chat">Available to chat</string>
+ <string name="contact_status_msg_dnd">Do not disturb</string>
+ <string name="contact_status_msg_away">Away</string>
+ <string name="contact_status_msg_xa">Unavailable</string>
+ <string name="contact_status_msg_offline">Disconnected</string>
+
+ <string name="privacy_list_name">Beem - Manage my privacy lists</string>
+ <string name="privacy_list_no_data">There aren\'t any privacy list registered.</string>
+ <string name="privacy_list_menu_create">Create a privacy list</string>
+ <string name="privacy_list_create_dialog_title">Create a privacy list</string>
+ <string name="privacy_list_create_dialog_list_name_label">Title</string>
+ <string name="privacy_list_create_dialog_create_button">Create</string>
+ <string name="privacy_list_select_dialog_buddies">Buddies</string>
+ <string name="privacy_list_select_dialog_groups">Groups</string>
+ <string name="privacy_list_select_dialog_delete">Delete</string>
+ <string name="privacy_list_delete_dialog_msg">Do you really want to delete the privacy list entitled \'%s\'?</string>
+ <string name="privacy_list_delete_dialog_yes">Yes</string>
+ <string name="privacy_list_delete_dialog_no">No</string>
+
+ <string name="UpdateButton">Update</string>
+
+ <!-- MemorizingTrustManager library -->
+ <string name="mtm_accept_cert">Accept Unknown Certificate?</string>
+ <string name="mtm_decision_always">Always</string>
+ <string name="mtm_decision_once">Once</string>
+ <string name="mtm_decision_abort">Abort</string>
+
+ <string name="mtm_notification">Certificate Verification</string>
+
+ <!-- Error messages -->
+
+ <string name="error_login_authentication">Error during authentication, bad login or password.</string>
+
+ <string name="interna_server_error">Remote server error</string>
+ <string name="bad_request">bad-request</string>
+ <string name="forbidden">forbidden</string>
+ <string name="item_not_found">item-not-found</string>
+ <string name="conflict">conflict</string>
+ <string name="feature_not_implemented">feature-not-implemented</string>
+ <string name="gone">gone</string>
+ <string name="jid_malformed">jid-malformed</string>
+ <string name="no_acceptable">no-acceptable</string>
+ <string name="not_allowed">not-allowed</string>
+ <string name="not_authorized">not-authorized</string>
+ <string name="payment_required">payment-required</string>
+ <string name="recipient_unavailable">recipient-unavailable</string>
+ <string name="redirect">redirect</string>
+ <string name="registration_required">registration-required</string>
+ <string name="remote_server_not_found">Remote server not found</string>
+ <string name="remote_server_timeout">No server response</string>
+ <string name="remote_server_error">Remote server error</string>
+ <string name="resource_constraint">resource-constraint</string>
+ <string name="service_unavailable">service-unavailable</string>
+ <string name="subscription_required">subscription-required</string>
+ <string name="undefined_condition">undefined-condition</string>
+ <string name="unexpected_condition">unexpected-condition</string>
+ <string name="request_timeout">request-timeout</string>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values/styles.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <style name="Label">
+ <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
+ <item name="android:textStyle">bold</item>
+ <item name="android:capitalize">characters</item>
+ <item name="android:focusable">false</item>
+ <item name="android:inputType">textNoSuggestions</item>
+ </style>
+ <style name="CheckBoxLabel" parent="@style/Label">
+ <item name="android:enabled">true</item>
+ </style>
+ <style name="Theme.BEEM.Default" parent="@android:style/Theme">
+<!-- <item name="android:windowBackground">@drawable/background</item>-->
+ </style>
+
+
+<!-- Old PC style -->
+
+ <style name="OldTheme">
+ <item name="android:textViewStyle" >@style/OldThemeTextView</item>
+ </style>
+ <style name="OldThemeTextView" parent="@android:style/Widget.TextView">
+ <item name="android:textColor">#ff009900</item>
+ <item name="android:background">@color/black</item>
+ </style>
+
+ <style name="TitleStripTextAppearance" parent="@android:style/TextAppearance">
+ <item name="android:textSize">18sp</item>
+ <item name="android:textStyle">bold</item>
+ </style>
+
+
+<!-- Other style -->
+
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/values/xmpp_server_list.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string-array name="xmpp_server_list">
+ <item>0nl1ne.at</item>
+ <item>blah.at</item>
+ <item>blah.im</item>
+ <item>boese-ban.de</item>
+ <item>brauchen.info</item>
+ <item>chatme.im</item>
+ <item>chrome.pl</item>
+ <item>climm.org</item>
+ <item>coderollers.com</item>
+ <item>codingteam.net</item>
+ <item>comm.unicate.me</item>
+ <item>darkdna.net</item>
+ <item>deshalbfrei.org</item>
+ <item>draugr.de</item>
+ <item>einfachjabber.de</item>
+ <item>forumanalogue.fr</item>
+ <item>im.apinc.org</item>
+ <item>im.flosoft.biz</item>
+ <item>internet-exception.de</item>
+ <item>jabb3r.net</item>
+ <item>jabber-br.org</item>
+ <item>jabber-hosting.de</item>
+ <item>jabber.at</item>
+ <item>jabber.ccc.de</item>
+ <item>jabber.chaotic.de</item>
+ <item>jabber.co.nz</item>
+ <item>jabber.cz</item>
+ <item>jabber.de</item>
+ <item>jabber.earth.li</item>
+ <item>jabber.etighichat.com</item>
+ <item>jabber.fourecks.de</item>
+ <item>jabber.gate31.net</item>
+ <item>jabber.hot-chilli.net</item>
+ <item>jabber.i-pobox.net</item>
+ <item>jabber.iitsp.com</item>
+ <item>jabber.loudas.com</item>
+ <item>jabber.me</item>
+ <item>jabber.meta.net.nz</item>
+ <item>jabber.minus273.org</item>
+ <item>jabber.no-sense.net</item>
+ <item>jabber.no</item>
+ <item>jabber.rootbash.com</item>
+ <item>jabber.rueckgr.at</item>
+ <item>jabber.scha.de</item>
+ <item>jabber.schnied.net</item>
+ <item>jabber.second-home.de</item>
+ <item>jabber.smash-net.org</item>
+ <item>jabber.sow.as</item>
+ <item>jabber.theforest.us</item>
+ <item>jabber.tmkis.com</item>
+ <item>jabber.yeahnah.co.nz</item>
+ <item>jabberd.eu</item>
+ <item>jabberes.org</item>
+ <item>jabbim.com</item>
+ <item>jabbim.cz</item>
+ <item>jabbim.pl</item>
+ <item>jabbim.sk</item>
+ <item>jabin.org</item>
+ <item>jabme.de</item>
+ <item>jabster.pl</item>
+ <item>jaim.at</item>
+ <item>jappix.com</item>
+ <item>jisshi.com</item>
+ <item>labnote.org</item>
+ <item>lightwitch.org</item>
+ <item>limun.org</item>
+ <item>macjabber.de</item>
+ <item>mayplaces.com</item>
+ <item>na-di.de</item>
+ <item>neko.im</item>
+ <item>netmindz.net</item>
+ <item>njs.netlab.cz</item>
+ <item>palita.net</item>
+ <item>pandion.im</item>
+ <item>pidgin.su</item>
+ <item>programmer-art.org</item>
+ <item>prosody.de</item>
+ <item>richim.org</item>
+ <item>rkquery.de</item>
+ <item>sss.chaoslab.ru</item>
+ <item>sternenschweif.de</item>
+ <item>swissjabber.ch</item>
+ <item>swissjabber.de</item>
+ <item>swissjabber.eu</item>
+ <item>swissjabber.li</item>
+ <item>swissjabber.org</item>
+ <item>tcweb.org</item>
+ <item>tekst.me</item>
+ <item>thiessen.im</item>
+ <item>thiessen.it</item>
+ <item>thiessen.org</item>
+ <item>tigase.im</item>
+ <item>twattle.net</item>
+ <item>ubuntu-jabber.de</item>
+ <item>ubuntu-jabber.net</item>
+ <item>univers-libre.net</item>
+ <item>verdammung.org</item>
+ <item>wtfismyip.com</item>
+ <item>xabber.de</item>
+ <item>xmpp-hosting.de</item>
+ <item>xmpp.jp</item>
+ <item>xmppnet.de</item>
+ <item>zauris.ru</item>
+ <item>zsim.de</item>
+ <item>xmpp.kz</item>
+ <item>freamware.net</item>
+ <item>gabbler.de</item>
+ <item>gabbler.eu</item>
+ <item>gabbler.org</item>
+ <item>hot-chilli.net</item>
+ <item>igniterealtime.org</item>
+ <item>is-the-shit.com</item>
+ <item>jabberheaven.com</item>
+ <item>jabberheaven.de</item>
+ <item>jabber.rückgr.at</item>
+ <item>jabber.se</item>
+ <item>jabberus.kz</item>
+ <item>jabberzac.org</item>
+ <item>vrane.com</item>
+ <item>xmpp.ru.net</item>
+ <item>gojabber.org</item>
+ <item>jabbeng.in</item>
+ <item>jabber.gnubox.net</item>
+ <item>jabberid.org</item>
+ <item>jodo.im</item>
+ <item>jsmart.web.id</item>
+ <item>linuxlovers.at</item>
+ <item>n0g.at</item>
+ <item>totalueberwachung.de</item>
+ <item>jabber.kiev.ua</item>
+ <item>jabbir.org</item>
+ <item>j-talk.me</item>
+ <item>xmppres.com</item>
+ </string-array>
+</resources>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/src/main/res/xml/preferences.xml Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
+ Nikita Kozlov,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://www.beem-project.com/
+
+-->
+<!--
+ The format of the preference key is defined in
+ src/com/beem/project/beem/BeemApplication.java
+ Basically it is just a simple name like account_username.
+ TODO: There is still a lot of keys to convert
+-->
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shouldDisableView="true" android:selectable="true">
+ <PreferenceCategory android:title="@string/general_preferences">
+ <PreferenceScreen android:key="contact_list"
+ android:title="@string/contact_list_preferences" android:summary="@string/contact_list_preferences_sum">
+ <CheckBoxPreference android:title="@string/CLP_hidden_contact"
+ android:defaultValue="false" android:summary="@string/CLP_hidden_contact_sum"
+ android:key="show_offline_contacts" />
+ <CheckBoxPreference android:title="@string/CLP_hide_groups"
+ android:defaultValue="false" android:summary="@string/CLP_hide_groups_sum"
+ android:key="hide_groups" />
+ <CheckBoxPreference android:title="@string/CLP_show_jid"
+ android:defaultValue="false" android:key="show_jid"
+ android:summary="@string/CLP_show_jid_sum"/>
+ <CheckBoxPreference android:title="@string/away_chk_title"
+ android:defaultValue="true" android:summary="@string/away_chk_sum"
+ android:key="use_auto_away" />
+ <EditTextPreference android:dependency="use_auto_away"
+ android:singleLine="true" android:summary="@string/away_message_sum"
+ android:title="@string/away_message_title" android:key="auto_away_msg"
+ android:hint="@string/away_message_hint" />
+ </PreferenceScreen>
+ <PreferenceScreen android:key="chat"
+ android:title="@string/chat_preferences" android:summary="@string/chat_preferences_sum">
+ <PreferenceCategory android:title="@string/history_preferences">
+ <CheckBoxPreference android:id="@+id/chat_history"
+ android:title="@string/history" android:summary="@string/history_sum"
+ android:defaultValue="false" android:key="settings_key_history" />
+ <EditTextPreference android:dependency="settings_key_history"
+ android:singleLine="true" android:title="@string/chat_history_path"
+ android:summary="@string/chat_history_path_sum" android:key="settings_chat_history_path"
+ android:hint="/Android/data/com.beem.project.beem/chat/" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="@string/chat_layout_option">
+ <CheckBoxPreference android:title="@string/settings_chat_compact"
+ android:defaultValue="false" android:summary="@string/settings_chat_compact_sum"
+ android:key="use_compact_chat_ui" />
+ </PreferenceCategory>
+ </PreferenceScreen>
+ <PreferenceScreen android:title="@string/notification_preferences">
+ <CheckBoxPreference android:title="@string/notification_enable_vibrate_title"
+ android:defaultValue="true" android:summary="@string/notification_enable_vibrate_sum"
+ android:key="notification_vibrate" />
+ <RingtonePreference android:title="@string/notification_snd_title"
+ android:key="notification_sound" android:summary="@string/notification_snd_sum"
+ android:defaultValue="content://settings/system/notification_sound"
+ android:ringtoneType="notification" android:showDefault="true" />
+ </PreferenceScreen>
+ </PreferenceCategory>
+ <PreferenceCategory android:title="@string/user_preferences">
+ <Preference android:key="account_username" android:title="@string/settings_account_username">
+ <intent android:targetPackage="com.beem.project.beem" android:targetClass="com.beem.project.beem.ui.wizard.Account" />
+ </Preference>
+ </PreferenceCategory>
+ <PreferenceCategory android:title="@string/user_preferences_advanced">
+ <EditTextPreference android:key="connection_resource"
+ android:title="@string/SettingsResourceTitle" android:summary="@string/SettingsResourceSummary"
+ android:defaultValue="Beem" />
+ <EditTextPreference android:key="connection_priority"
+ android:title="@string/SettingsPriorityTitle" android:summary="@string/SettingsPrioritySummary"
+ android:numeric="signed" android:defaultValue="0" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="@string/network_preferences">
+ <PreferenceScreen android:key="proxy" android:title="@string/SettingsProxy"
+ android:summary="@string/settings_proxy_sum">
+ <CheckBoxPreference android:title="@string/SettingsProxyProxy"
+ android:defaultValue="false" android:summary="@string/SettingsProxySummary"
+ android:key="proxy_use" />
+ <PreferenceCategory android:title="@string/proxy_proxy_settings">
+ <ListPreference android:dependency="proxy_use"
+ android:title="@string/SettingsProxyType" android:entries="@array/proxy_types"
+ android:summary="@string/SettingsProxyTypeSummary"
+ android:defaultValue="HTTP" android:entryValues="@array/proxy_types"
+ android:key="proxy_type" />
+ <EditTextPreference android:singleLine="true"
+ android:dependency="proxy_use" android:name="serveur"
+ android:summary="@string/SettingsProxyServer" android:title="@string/settings_proxy_server"
+ android:key="proxy_server" />
+ <EditTextPreference android:singleLine="true"
+ android:dependency="proxy_use" android:name="port"
+ android:summary="@string/SettingsProxyPort" android:title="@string/settings_proxy_port"
+ android:key="proxy_port" android:numeric="signed"
+ android:hint="@string/comments_proxy_port" />
+ </PreferenceCategory>
+ <PreferenceCategory android:title="@string/proxy_user_settings">
+ <EditTextPreference android:singleLine="true"
+ android:dependency="proxy_use" android:name="Utilisateur"
+ android:summary="@string/SettingsProxyUser" android:title="@string/settings_proxy_username"
+ android:key="proxy_username" />
+ <EditTextPreference android:singleLine="true"
+ android:dependency="proxy_use" android:name="pass_user"
+ android:password="true" android:summary="@string/SettingsProxyPassword"
+ android:title="@string/settings_proxy_password" android:key="proxy_password" />
+ </PreferenceCategory>
+ </PreferenceScreen>
+
+ <PreferenceScreen android:key="advanced"
+ android:title="@string/SettingsAdvanced" android:summary="@string/settings_advanced_sum">
+ <PreferenceCategory android:title="@string/settings_advanced_service_behaviour">
+ <CheckBoxPreference android:title="@string/settings_xmpp_use_tls"
+ android:defaultValue="false" android:key="settings_key_xmpp_tls_use" />
+ <CheckBoxPreference android:title="@string/settings_smack_debug"
+ android:defaultValue="false" android:key="smack_debug" />
+ <EditTextPreference android:singleLine="true"
+ android:title="@string/settings_reco_delay" android:name="Reconnect delay"
+ android:summary="@string/SettingsAdvancedRecoDelay" android:key="settings_key_reco_delay"
+ android:defaultValue="10" />
+ </PreferenceCategory>
+ <CheckBoxPreference android:title="@string/SettingsAdvancedOptions"
+ android:defaultValue="false" android:summary="@string/SettingsAdvancedSpecOpt"
+ android:key="account_specific_server" />
+ <EditTextPreference android:singleLine="true"
+ android:dependency="account_specific_server" android:name="adresse"
+ android:summary="@string/SettingsAdvancedAddOpt" android:title="@string/settings_xmpp_server"
+ android:key="account_specific_server_host" android:hint="@string/comments_xmpp_server" />
+ <EditTextPreference android:singleLine="true"
+ android:dependency="account_specific_server" android:name="port"
+ android:summary="@string/SettingsAdvancedPortOpt" android:title="@string/settings_xmpp_port"
+ android:defaultValue="5222" android:numeric="signed" android:key="account_specific_server_port"
+ android:hint="@string/comments_xmpp_port" />
+ <CheckBoxPreference android:title="@string/settings_full_jid_login"
+ android:defaultValue="false" android:summary="@string/settings_full_jid_login_sum"
+ android:key="full_jid_login" />
+ </PreferenceScreen>
+ </PreferenceCategory>
+</PreferenceScreen>
--- a/build.gradle Sun Mar 15 17:28:04 2015 +0100
+++ b/build.gradle Sun Mar 15 18:03:03 2015 +0100
@@ -8,54 +8,8 @@
}
}
-// application build script
-
-apply plugin: 'com.android.application'
-
-repositories {
- jcenter()
-}
-
-dependencies {
- compile files('libs/android-support-v13.jar')
- compile files('libs/asmack-android-16-beem.jar')
- compile files('libs/lcrypto-jdk16-146-20110415.jar')
-}
-
-android {
- compileSdkVersion 22
- buildToolsVersion "22"
-
- defaultConfig {
- minSdkVersion 6
- targetSdkVersion 16
- // versionCode 1
- // versionName "1.0"
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
- lintOptions {
- abortOnError false
- }
-
- // use the old android source structure (ant based)
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- resources.srcDirs = ['src']
- aidl.srcDirs = ['src']
- renderscript.srcDirs = ['src']
- res.srcDirs = ['res']
- assets.srcDirs = ['assets']
- }
-
- instrumentTest.setRoot('tests')
+allprojects {
+ repositories {
+ jcenter()
}
}
--- a/libs/README.txt Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-This directory contains the libraries used by BEEM.
-
-The principal one is asmack, a portage of the Smack library for the Android
-platform.
-
-The source of the asmack library can be downloaded at
-http://dev.beem-project.com/attachments/download/51/asmack-android-2.1-source-beem.zip
-
-See the file doc/asmack-beem/README.txt for more informations.
-
Binary file libs/android-support-v13.jar has changed
Binary file libs/asmack-android-16-beem.jar has changed
Binary file libs/lcrypto-jdk16-146-20110415.jar has changed
--- a/res/anim/rotate_and_scale.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<set xmlns:android="http://schemas.android.com/apk/res/android">
- <rotate android:fromDegrees="0" android:toDegrees="360"
- android:pivotX="50%" android:pivotY="50%"
- android:duration="5000"
- android:repeatMode="restart"
- android:repeatCount="infinite" />
-</set>
Binary file res/drawable-hdpi/beem_icon_launcher_color.png has changed
Binary file res/drawable-hdpi/emo_im_angel.png has changed
Binary file res/drawable-hdpi/emo_im_cool.png has changed
Binary file res/drawable-hdpi/emo_im_crying.png has changed
Binary file res/drawable-hdpi/emo_im_embarrassed.png has changed
Binary file res/drawable-hdpi/emo_im_foot_in_mouth.png has changed
Binary file res/drawable-hdpi/emo_im_happy.png has changed
Binary file res/drawable-hdpi/emo_im_heart.png has changed
Binary file res/drawable-hdpi/emo_im_kissing.png has changed
Binary file res/drawable-hdpi/emo_im_laughing.png has changed
Binary file res/drawable-hdpi/emo_im_lips_are_sealed.png has changed
Binary file res/drawable-hdpi/emo_im_mad.png has changed
Binary file res/drawable-hdpi/emo_im_money_mouth.png has changed
Binary file res/drawable-hdpi/emo_im_pokerface.png has changed
Binary file res/drawable-hdpi/emo_im_sad.png has changed
Binary file res/drawable-hdpi/emo_im_smirk.png has changed
Binary file res/drawable-hdpi/emo_im_surprised.png has changed
Binary file res/drawable-hdpi/emo_im_tongue_sticking_out.png has changed
Binary file res/drawable-hdpi/emo_im_undecided.png has changed
Binary file res/drawable-hdpi/emo_im_winking.png has changed
Binary file res/drawable-hdpi/emo_im_wtf.png has changed
Binary file res/drawable-hdpi/emo_im_yelling.png has changed
Binary file res/drawable-ldpi/beem_icon_launcher_color.png has changed
Binary file res/drawable-mdpi/beem_icon_launcher_color.png has changed
Binary file res/drawable-mdpi/emo_im_angel.png has changed
Binary file res/drawable-mdpi/emo_im_cool.png has changed
Binary file res/drawable-mdpi/emo_im_crying.png has changed
Binary file res/drawable-mdpi/emo_im_embarrassed.png has changed
Binary file res/drawable-mdpi/emo_im_foot_in_mouth.png has changed
Binary file res/drawable-mdpi/emo_im_happy.png has changed
Binary file res/drawable-mdpi/emo_im_heart.png has changed
Binary file res/drawable-mdpi/emo_im_kissing.png has changed
Binary file res/drawable-mdpi/emo_im_laughing.png has changed
Binary file res/drawable-mdpi/emo_im_lips_are_sealed.png has changed
Binary file res/drawable-mdpi/emo_im_mad.png has changed
Binary file res/drawable-mdpi/emo_im_money_mouth.png has changed
Binary file res/drawable-mdpi/emo_im_pokerface.png has changed
Binary file res/drawable-mdpi/emo_im_sad.png has changed
Binary file res/drawable-mdpi/emo_im_smirk.png has changed
Binary file res/drawable-mdpi/emo_im_surprised.png has changed
Binary file res/drawable-mdpi/emo_im_tongue_sticking_out.png has changed
Binary file res/drawable-mdpi/emo_im_undecided.png has changed
Binary file res/drawable-mdpi/emo_im_winking.png has changed
Binary file res/drawable-mdpi/emo_im_wtf.png has changed
Binary file res/drawable-mdpi/emo_im_yelling.png has changed
--- a/res/drawable/avatar_status.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Layer Level list drawable for Avatar and status icon
- See src/com/beem/project/beem/utils/Status.java
- for level values to change the status.
- The status icon must be resized using method
- LayerDrawable.setLayerInset();
- The drawable with id @id/avatar must be replace by the real
- avatar using the method LayerDrawable.setDrawableByLayerId()
--->
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/avatar">
- <shape/>
- </item>
- <item android:drawable="@drawable/status_icon" />
-</layer-list>
Binary file res/drawable/beem_launcher_icon_silver.png has changed
Binary file res/drawable/beem_status_icon.png has changed
Binary file res/drawable/beem_status_icon_available.png has changed
Binary file res/drawable/beem_status_icon_away.png has changed
Binary file res/drawable/beem_status_icon_busy.png has changed
Binary file res/drawable/beem_status_icon_gray.png has changed
Binary file res/drawable/bottombar.png has changed
Binary file res/drawable/button_indicator_next.png has changed
Binary file res/drawable/button_indicator_prev.png has changed
Binary file res/drawable/ic_menu_add.png has changed
Binary file res/drawable/ic_menu_blocked_user.png has changed
Binary file res/drawable/ic_menu_chat_dashboard.png has changed
Binary file res/drawable/ic_menu_close_clear_cancel.png has changed
Binary file res/drawable/ic_menu_end_conversation.png has changed
Binary file res/drawable/ic_menu_friendslist.png has changed
Binary file res/drawable/ic_menu_invite.png has changed
Binary file res/drawable/ic_menu_login.png has changed
Binary file res/drawable/ic_menu_manage.png has changed
Binary file res/drawable/icon.png has changed
Binary file res/drawable/logo.png has changed
Binary file res/drawable/logo_encryption.png has changed
Binary file res/drawable/not_in_the_roster.png has changed
--- a/res/drawable/scrollbar_vertical_thumb.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <gradient android:startColor="#3333FF" android:endColor="#8080FF"
- android:angle="0"/>
- <corners android:radius="6dp" />
-</shape>
--- a/res/drawable/scrollbar_vertical_track.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <gradient android:startColor="#505050" android:endColor="#C0C0C0"
- android:angle="0"/>
- <corners android:radius="0dp" />
-</shape>
--- a/res/drawable/shape_border_green.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <stroke android:width="4dp" android:color="#D6F94C" />
- <padding android:left="7dp" android:top="7dp"
- android:right="7dp" android:bottom="7dp" />
- <corners android:radius="4dp" />
-</shape>
Binary file res/drawable/status_available.png has changed
Binary file res/drawable/status_away.png has changed
Binary file res/drawable/status_blocked.png has changed
Binary file res/drawable/status_dnd.png has changed
Binary file res/drawable/status_error.png has changed
--- a/res/drawable/status_icon.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Level list drawable for status icon
- See src/com/beem/project/beem/utils/Status.java
- for level values
--->
-<level-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:maxLevel="100" android:drawable="@android:drawable/presence_offline" />
- <item android:maxLevel="200" android:drawable="@drawable/status_requested" />
- <item android:maxLevel="300" android:drawable="@android:drawable/presence_away" />
- <item android:maxLevel="400" android:drawable="@android:drawable/presence_busy" />
- <item android:maxLevel="600" android:drawable="@android:drawable/presence_online" />
- </level-list>
Binary file res/drawable/status_idle.png has changed
Binary file res/drawable/status_invisible.png has changed
Binary file res/drawable/status_new_message.png has changed
Binary file res/drawable/status_offline.png has changed
Binary file res/drawable/status_requested.png has changed
Binary file res/drawable/status_typing.png has changed
--- a/res/layout-v11/create_account.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-<?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="fill_parent"
- android:orientation="vertical" >
-
- <ScrollView android:layout_width="fill_parent" android:layout_height="0dip"
- android:layout_weight="1" >
- <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:orientation="vertical" >
- <ImageView android:id="@+id/logo"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_marginTop="15dp"
- android:layout_marginBottom="30dp"
- android:src="@drawable/logo"/>
-
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/create_account_text"
- android:textSize="18sp"
- android:paddingBottom="10dip"
- android:focusable="true" />
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/create_account_username" style="@style/Label" />
- <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:orientation="horizontal">
- <EditText android:id="@+id/create_account_username"
- android:inputType="textEmailAddress" android:imeOptions="actionNext"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:singleLine="true"
- android:minWidth="120dp"
- android:hint="beem"
- android:contentDescription="@string/create_account_username"/>
- <TextView
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:text=" @ " style="@style/Label" />
- <AutoCompleteTextView android:id="@+id/xmpp_server"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:minWidth="160dp"
- android:gravity="left"
- android:hint="beem-project.com"
- android:completionThreshold="1"
- android:inputType="textNoSuggestions"
- style="?android:attr/dropDownSpinnerStyle"/>
- </LinearLayout>
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/create_account_password" style="@style/Label" />
- <EditText android:id="@+id/create_account_password"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:inputType="textPassword" android:imeOptions="actionNext"
- android:singleLine="true"
- android:contentDescription="@string/create_account_password"/>
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/create_account_confirm_password" style="@style/Label" />
- <EditText android:id="@+id/create_account_confirm_password"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:inputType="textPassword" android:imeOptions="actionNext"
- android:singleLine="true"
- android:contentDescription="@string/create_account_confirm_password"/>
- <TextView android:id="@+id/settings_warn_label" style="@style/Label"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_settings_warn"
- android:inputType="textMultiLine|textNoSuggestions"
- android:textColor="@color/white"
- android:textStyle="normal"
- android:visibility="gone" />
- <TextView android:id="@+id/error_label"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:textColor="@color/red" android:textStyle="bold"
- android:inputType="textMultiLine"
- style="@style/Label"/>
- </LinearLayout>
- </ScrollView>
-
- <RelativeLayout
- android:gravity="right|center_vertical"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:background="@drawable/bottombar" >
- <Button
- android:id="@+id/next"
- android:text="@string/Continue"
- android:minWidth="100dp"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:drawableRight="@drawable/button_indicator_next"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:enabled="false"
- />
- </RelativeLayout>
-
-</LinearLayout>
--- a/res/layout-v11/simple_combobox_item.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@android:id/text1"
- style="?android:attr/dropDownItemStyle"
- android:textAppearance="?android:attr/textAppearanceSmallPopupMenu"
- android:singleLine="true"
- android:layout_width="match_parent"
- android:layout_height="36dip"
- android:ellipsize="marquee" />
--- a/res/layout/addcontact.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent" android:layout_height="fill_parent"
- android:orientation="vertical">
- <LinearLayout android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:orientation="vertical"
- android:padding="10dip">
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/AddCLogin"
- style="@style/Label" />
- <EditText android:id="@+id/addc_login" android:inputType="textEmailAddress"
- android:imeOptions="actionNext" android:scrollHorizontally="true"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_margin="3dip"
- android:contentDescription="@string/AddCLogin"/>
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/AddCAlias"
- style="@style/Label" />
- <EditText android:id="@+id/addc_alias" android:inputType="text"
- android:imeOptions="actionNext"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:scrollHorizontally="true" android:layout_margin="3dip"
- android:contentDescription="@string/AddCAlias"/>
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/AddCGroup"
- style="@style/Label" />
- <EditText android:id="@+id/addc_group" android:inputType="text"
- android:layout_width="fill_parent"
- android:scrollHorizontally="true" android:layout_height="wrap_content"
- android:layout_margin="3dip"
- android:contentDescription="@string/AddCGroup"/>
- <View android:layout_width="fill_parent" android:layout_height="0dp"
- android:layout_weight="1" android:layout_marginBottom="18dp" />
- <Button android:id="@+id/addc_ok" android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:text="@string/AddCOkButton" android:layout_gravity="bottom" />
- </LinearLayout>
-</ScrollView>
--- a/res/layout/changestatus.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:orientation="vertical">
- <RelativeLayout android:orientation="vertical"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:padding="10dip">
- <LinearLayout android:id="@+id/avatar_panel"
- android:orientation="vertical"
- android:gravity="center"
- android:layout_alignParentTop="true"
- android:layout_width="fill_parent" android:layout_height="fill_parent" >
- <TextView android:text="@string/my_avatar" style="@style/Label"
- android:layout_width="wrap_content" android:layout_height="wrap_content" />
-
- <ImageButton android:id="@+id/avatarButton"
- android:layout_width="120dip" android:layout_height="120dip"
- android:scaleType="fitCenter" />
- </LinearLayout>
- <TextView android:id="@+id/ChangeStatusTypeLabel"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_below="@id/avatar_panel"
- android:text="@string/ChangeStatusType" style="@style/Label" />
- <Spinner android:id="@+id/ChangeStatusSpinner"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:drawSelectorOnTop="true" android:layout_below="@id/ChangeStatusTypeLabel"
- android:contentDescription="@string/ChangeStatusType"/>
- <TextView android:id="@+id/ChangeStatusMessageLabel"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_below="@id/ChangeStatusSpinner"
- style="@style/Label"
- android:selectAllOnFocus="true"
- android:focusable="true"
- android:text="@string/ChangeStatusMessage"
- />
- <EditText android:id="@+id/ChangeStatusMessage"
- android:inputType="textShortMessage|textAutoCorrect"
- android:imeOptions="actionDone" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:layout_below="@id/ChangeStatusMessageLabel"
- android:layout_marginBottom="18dp" />
- <LinearLayout android:id="@+id/ChangeStatusButtons"
- android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:layout_below="@id/ChangeStatusMessage"
- android:orientation="horizontal">
- <Button android:id="@+id/ChangeStatusOk"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/UpdateButton" />
- <Button android:id="@+id/ChangeStatusClear"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/ClearButton" />
- </LinearLayout>
- <Button android:id="@+id/OpenContactList" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:text="@string/OpenContactList"
- android:layout_below="@+id/ChangeStatusButtons" />
- </RelativeLayout>
-</ScrollView>
--- a/res/layout/chat.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-<?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="fill_parent"
- android:orientation="vertical">
- <LinearLayout android:id="@+id/chat_header"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:orientation="horizontal" android:gravity="center_vertical"
- android:background="#222222"
- android:padding="4dp">
- <ImageView android:id="@+id/chat_contact_status_icon"
- android:src="@drawable/avatar_status"
- android:layout_width="48dip"
- android:layout_height="48dip"
- />
- <LinearLayout android:orientation="vertical"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:paddingLeft="15sp">
- <TextView android:id="@+id/chat_contact_name"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:lines="1" android:singleLine="true"
- android:textStyle="bold" android:textColor="@android:color/white"
- android:focusable="true"/>
- <TextView android:id="@+id/chat_contact_status_msg"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:autoLink="all" android:textSize="12sp" android:textColor="@android:color/white"
- android:textColorLink="#FFFFFF"
- android:focusable="true"/>
- <TextView android:id="@+id/chat_contact_chat_state"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:textStyle="italic" android:textSize="12sp"
- android:focusable="true"/>
- <TextView android:id="@+id/chat_contact_otr_state"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:textStyle="italic" android:textSize="12sp"
- android:focusable="true"/>
- </LinearLayout>
- </LinearLayout>
- <View android:layout_width="fill_parent" android:layout_height="2dp"
- android:fadingEdge="horizontal" android:background="#555555" />
- <ListView android:id="@+id/chat_messages"
- android:layout_width="fill_parent" android:layout_height="0dip"
- android:layout_weight="1" android:transcriptMode="normal"
- android:stackFromBottom="true"
- android:fadingEdge="none" android:padding="4dp"
- android:fastScrollEnabled="true" android:smoothScrollbar="false"
- android:focusable="true"/>
- <LinearLayout android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:orientation="horizontal"
- android:gravity="center_vertical"
- android:padding="4dp">
- <EditText android:id="@+id/chat_input" android:layout_width="0dip"
- android:layout_height="fill_parent" android:layout_weight="1"
- android:maxLines="5"
- android:inputType="textShortMessage|textAutoCorrect|textMultiLine|textCapSentences"
- android:imeOptions="actionSend|flagNoExtractUi" android:cursorVisible="true"
- android:hint="@string/chat_input_default_value" />
- <Button android:id="@+id/chat_send_message"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:text="@string/chat_send_message" />
- </LinearLayout>
-</LinearLayout>
--- a/res/layout/chat_compact.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-<?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="fill_parent"
- android:orientation="vertical">
- <View android:layout_width="fill_parent" android:layout_height="2dp"
- android:fadingEdge="horizontal" android:background="#222222" />
- <ListView android:id="@+id/chat_messages"
- android:layout_width="fill_parent" android:layout_height="0dip"
- android:layout_weight="1" android:transcriptMode="normal"
- android:stackFromBottom="true"
- android:fadingEdge="none" android:padding="4px"
- android:fastScrollEnabled="true" android:smoothScrollbar="false"
- android:focusable="true"/>
- <LinearLayout android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:orientation="horizontal"
- android:background="#222222" android:padding="8px">
- <EditText android:id="@+id/chat_input" android:layout_width="0dip"
- android:layout_height="fill_parent" android:layout_weight="1"
- android:maxLines="5"
- android:inputType="textShortMessage|textAutoCorrect|textMultiLine|textCapSentences"
- android:imeOptions="actionSend|flagNoExtractUi" android:cursorVisible="true"
- android:hint="@string/chat_input_default_value" />
- <Button android:id="@+id/chat_send_message"
- android:layout_width="wrap_content" android:layout_height="fill_parent"
- android:text="@string/chat_send_message" />
- </LinearLayout>
-</LinearLayout>
--- a/res/layout/chat_msg_row.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="wrap_content">
-
- <TextView android:id="@+id/chatmessagename"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
- android:textColor="@android:color/white" android:textStyle="bold"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:paddingBottom="1dp" />
- <TextView android:id="@+id/chatmessagedate"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:layout_alignParentTop="true" android:layout_alignParentRight="true"
- android:autoLink="none" />
- <TextView android:id="@+id/chatmessagetext"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:layout_alignParentLeft="true" android:layout_below="@id/chatmessagename"
- android:autoLink="all" />
-</RelativeLayout>
-
--- a/res/layout/contactdialogaliasdialog.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +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:id="@+id/CDAliasDialogLabel"
- android:layout_height="wrap_content" android:layout_width="wrap_content"
- android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
- android:text="@string/userinfo_label_alias"
- android:gravity="left" style="@style/Label" />
- <EditText android:id="@+id/CDAliasDialogName"
- android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
- android:scrollHorizontally="true" android:autoText="false"
- android:capitalize="none" android:gravity="fill_horizontal"
- android:contentDescription="@string/userinfo_label_alias"/>
-</LinearLayout>
--- a/res/layout/contactlist.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?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="fill_parent"
- android:orientation="vertical">
-
- <android.support.v4.view.ViewPager android:id="@+id/pager"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <android.support.v4.view.PagerTabStrip android:id="@+id/tabstrip"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textAppearance="@style/TitleStripTextAppearance"
- />
-
- </android.support.v4.view.ViewPager>
-
-</LinearLayout>
--- a/res/layout/contactlistcontact.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:paddingLeft="10dp"
- android:paddingRight="10dp" android:paddingTop="8dp"
- android:paddingBottom="8dip" >
- <ImageView android:id="@+id/avatar"
- android:layout_width="48dip" android:layout_height="48dip"
- android:layout_alignParentLeft="true"
- android:layout_alignParentTop="true"
- />
- <TextView android:id="@+id/contactlistpseudo"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_toRightOf="@id/avatar"
- android:singleLine="true"
- android:maxLines="1"
- android:paddingLeft="10dp"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textStyle="bold" />
-
- <TextView android:id="@+id/contactlistmsgperso"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_below="@id/contactlistpseudo"
- android:layout_toRightOf="@id/avatar"
- android:paddingLeft="10dp" android:singleLine="true"
- android:maxLines="1" android:linksClickable="false" android:autoLink="all"
- android:scrollHorizontally="true" android:textColorLink="@color/white"
- android:textAppearance="?android:attr/textAppearanceSmall"
- />
-</RelativeLayout>
--- a/res/layout/create_account.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-<?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="fill_parent"
- android:orientation="vertical" >
-
- <ScrollView android:layout_width="fill_parent" android:layout_height="0dip"
- android:layout_weight="1" >
- <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:orientation="vertical" >
- <ImageView android:id="@+id/logo"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_marginTop="15dp"
- android:layout_marginBottom="30dp"
- android:src="@drawable/logo"/>
-
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/create_account_text"
- android:textSize="18sp"
- android:paddingBottom="10dip"
- android:focusable="true" />
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/create_account_username" style="@style/Label" />
- <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:orientation="horizontal">
- <EditText android:id="@+id/create_account_username"
- android:inputType="textEmailAddress" android:imeOptions="actionNext"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:singleLine="true"
- android:minWidth="120dp"
- android:hint="beem"
- android:contentDescription="@string/create_account_username"/>
- <TextView
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:text=" @ " style="@style/Label" />
- <AutoCompleteTextView android:id="@+id/xmpp_server"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:minWidth="160dp"
- android:gravity="left"
- android:hint="beem-project.com"
- android:completionThreshold="1"
- android:inputType="textNoSuggestions"
- />
- </LinearLayout>
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/create_account_password" style="@style/Label" />
- <EditText android:id="@+id/create_account_password"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:inputType="textPassword" android:imeOptions="actionNext"
- android:singleLine="true"
- android:contentDescription="@string/create_account_password"/>
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/create_account_confirm_password" style="@style/Label" />
- <EditText android:id="@+id/create_account_confirm_password"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:inputType="textPassword" android:imeOptions="actionNext"
- android:singleLine="true"
- android:contentDescription="@string/create_account_confirm_password"/>
- <TextView android:id="@+id/settings_warn_label" style="@style/Label"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_settings_warn"
- android:inputType="textMultiLine|textNoSuggestions"
- android:textColor="@color/white"
- android:textStyle="normal"
- android:visibility="gone" />
- <TextView android:id="@+id/error_label"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:textColor="@color/red" android:textStyle="bold"
- android:inputType="textMultiLine"
- style="@style/Label"/>
- </LinearLayout>
- </ScrollView>
-
- <RelativeLayout
- android:gravity="right|center_vertical"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:background="@drawable/bottombar" >
- <Button
- android:id="@+id/next"
- android:text="@string/Continue"
- android:minWidth="100dp"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:drawableRight="@drawable/button_indicator_next"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:enabled="false"
- />
- </RelativeLayout>
-
-</LinearLayout>
--- a/res/layout/group_list.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:paddingLeft="8dip"
- android:paddingRight="8dip">
-
- <ListView android:id="@android:id/list" android:layout_width="fill_parent"
- android:layout_height="0dip" android:layout_weight="1"
- android:stackFromBottom="true" android:transcriptMode="normal"
- android:focusable="true"/>
-
- <EditText android:id="@+id/GroupListText"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:maxLength="20"
- android:singleLine="true" />
-</LinearLayout>
--- a/res/layout/jingle_call_activity.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-<?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:text="Jid:" android:id="@+id/jingledemocalljidlabel"
- android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
- <EditText android:id="@+id/jingledemocalljid"
- android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
- <TextView android:text="Password:" android:id="@+id/jingledemocallpasswordlabel"
- android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
- <EditText android:id="@+id/jingledemocallpassword"
- android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textPassword" ></EditText>
-
- <Button android:text="Connexion" android:id="@+id/jingledemocallconnectbutton"
- android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
- <TextView android:text="Call who :" android:id="@+id/jingledemocallreceiverlabel"
- android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-
-<EditText android:text="" android:id="@+id/jingledemocallreceiver" android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
-
-<Button android:text="Call" android:id="@+id/jingledemocallbutton" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> -->
-<ImageView android:id="@+id/log_as_logo"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_marginBottom="25px" android:layout_marginTop="42px" />
-</LinearLayout>
--- a/res/layout/login.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent" android:layout_height="fill_parent" >
- <LinearLayout android:orientation="vertical"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
- <ImageView android:id="@+id/log_as_logo" android:src="@drawable/logo"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_marginBottom="25px" android:layout_marginTop="42px" />
- <TextView android:id="@+id/log_as_msg" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:gravity="center"
- android:textColor="#FF0000" android:textStyle="bold"
- android:textSize="14sp" />
- </LinearLayout>
-</ScrollView>
--- a/res/layout/login_anim.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="fill_parent" android:layout_width="fill_parent"
- android:orientation="vertical">
- <ImageView android:id="@+id/loginanim_logo_anim" android:src="@drawable/beem_icon_launcher_color"
- android:layout_height="wrap_content" android:layout_width="wrap_content"
- android:layout_gravity="center_vertical|center_horizontal|center"
- android:layout_weight="1" />
- <TextView android:id="@+id/loginanim_status_text"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:textSize="20sp" android:gravity="center" android:textColor="@color/vert_manu"/>
- <Button android:id="@+id/loginanim_cancel_button"
- android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:layout_gravity="bottom" android:text="@string/CancelButton" />
-</LinearLayout>
-
--- a/res/layout/privacy_list.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +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" android:padding="8dp">
- <ListView android:id="@id/android:list" android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:layout_weight="1"
- android:drawSelectorOnTop="false"
- android:focusable="true"/>
- <TextView android:id="@id/android:empty" android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:text="@string/privacy_list_no_data"
- android:focusable="true"/>
-</LinearLayout>
--- a/res/layout/privacy_list_create_dialog.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<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/privacy_list_create_dialog_list_name_label"
- android:layout_height="wrap_content" android:layout_width="wrap_content"
- android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
- android:text="@string/privacy_list_create_dialog_list_name_label" android:gravity="left"
- style="@style/Label" />
- <EditText android:id="@+id/privacy_list_create_dialog_list_name"
- android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
- android:scrollHorizontally="true" android:autoText="false"
- android:capitalize="none" android:gravity="fill_horizontal"
- android:contentDescription="@string/privacy_list_create_dialog_list_name_label"/>
-</LinearLayout>
--- a/res/layout/simple_combobox_item.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@android:id/text1"
- style="?android:attr/dropDownItemStyle"
- android:singleLine="true"
- android:layout_width="match_parent"
- android:layout_height="36dip"
- android:ellipsize="marquee" />
--- a/res/layout/subscription.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent" android:layout_height="fill_parent"
- android:orientation="vertical">
- <LinearLayout android:orientation="vertical"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:padding="10dip">
-
- <TextView android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:autoLink="none"
- android:id="@+id/SubscriptionTitle" android:text="@string/SubscriptTitle"
- android:textStyle="bold" android:textColor="@color/white"
- android:textSize="18sp" android:layout_marginBottom="10dip" />
-
- <TextView android:layout_width="wrap_content"
- android:layout_height="fill_parent" android:autoLink="none"
- android:id="@+id/SubscriptionText" android:text="@string/SubscriptText"
- android:textColor="@color/white" android:textSize="14sp"
- android:layout_weight="1" android:layout_marginBottom="18dp"
- android:focusable="true"/>
-
- <LinearLayout android:orientation="horizontal"
- android:layout_width="fill_parent" android:layout_height="wrap_content">
-
- <Button android:id="@+id/SubscriptionAccept"
- android:layout_width="fill_parent" android:layout_height="fill_parent"
- android:layout_weight="1" android:text="@string/AcceptButton" />
-
- <Button android:id="@+id/SubscriptionRefuse"
- android:layout_width="fill_parent" android:layout_height="fill_parent"
- android:layout_weight="1" android:text="@string/RefuseButton" />
- </LinearLayout>
- </LinearLayout>
-</ScrollView>
--- a/res/layout/wizard_account_configure.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="fill_parent" android:layout_width="fill_parent"
- android:orientation="vertical" >
- <ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent"
- android:layout_weight="1">
- <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:orientation="vertical" >
- <ImageView android:id="@+id/logo"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_marginTop="15dp"
- android:layout_marginBottom="30dp"
- android:src="@drawable/logo"/>
- <LinearLayout android:id="@+id/account_layout"
- android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:orientation="vertical" >
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_configure_text_1"
- android:textSize="18sp"
- android:paddingBottom="10dip" />
- <Button
- android:id="@+id/select_account_btn"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:text="@string/account_wizard_select_account_btn"
- android:minWidth="100dp"
- />
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:text="@string/account_wizard_configure_text_2"
- android:textSize="18sp"
- android:paddingBottom="10dip" />
- </LinearLayout>
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_configure_text_3"
- android:textSize="18sp"
- android:paddingBottom="10dip" />
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/JabberID" style="@style/Label" />
- <EditText android:id="@+id/account_username"
- android:inputType="textEmailAddress" android:imeOptions="actionNext"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:singleLine="true"
- android:hint="beem@beem-project.com "
- android:contentDescription="@string/JabberID"/>
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/Password" style="@style/Label" />
- <EditText android:id="@+id/account_password"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:inputType="textPassword" android:imeOptions="actionNext"
- android:password="true" android:singleLine="true"
- android:contentDescription="@string/Password"/>
- <TextView android:id="@+id/settings_warn_label" style="@style/Label"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_settings_warn"
- android:inputType="textMultiLine|textNoSuggestions"
- android:textColor="@color/white"
- android:textStyle="normal"
- android:visibility="gone" />
- <TextView android:id="@+id/error_label" style="@style/Label"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_connection_failed"
- android:inputType="textMultiLine|textNoSuggestions"
- android:textColor="@color/red"
- android:visibility="invisible" />
- </LinearLayout>
- </ScrollView>
-
- <RelativeLayout
- android:gravity="right"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:background="@drawable/bottombar" >
-
- <Button
- android:id="@+id/manual_setup"
- android:text="@string/AccountConfigureManualConfiguration"
- android:minWidth="100dp"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_centerVertical="true"
- />
-
- <Button
- android:id="@+id/next"
- android:text="@string/Continue"
- android:minWidth="100dp"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:drawableRight="@drawable/button_indicator_next"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:enabled="false"
- />
- </RelativeLayout>
-
-</LinearLayout>
--- a/res/layout/wizard_account_main_fragment.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="fill_parent" android:layout_width="fill_parent"
- android:orientation="vertical"
- >
- <ScrollView android:layout_height="0dip" android:layout_width="fill_parent"
- android:layout_weight="1">
- <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent"
- android:orientation="vertical" >
- <ImageView android:id="@+id/logo"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_marginTop="15dp"
- android:layout_marginBottom="30dp"
- android:src="@drawable/logo"/>
- <TextView
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_text1"
- android:textSize="18sp"
- android:paddingBottom="10dip"
- android:focusable="true" />
- <RadioGroup android:id="@+id/configure_group"
- android:layout_width="fill_parent" android:layout_height="wrap_content" >
- <RadioButton android:id="@+id/configure_account"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_configure_account"/>
- <RadioButton android:id="@+id/create_account"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:text="@string/account_wizard_create_account"/>
- </RadioGroup>
- </LinearLayout>
- </ScrollView>
-
- <RelativeLayout
- android:gravity="right|center_vertical"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:background="@drawable/bottombar" >
- <Button
- android:id="@+id/next"
- android:text="@string/Continue"
- android:minWidth="100dp"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:drawableRight="@drawable/button_indicator_next"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:enabled="false"
- />
- </RelativeLayout>
-
-</LinearLayout>
--- a/res/menu/chat.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <group>
- <item android:id="@+id/chat_menu_contacts_list" android:visible="true"
- android:title="@string/chat_menu_contacts_list" android:icon="@drawable/ic_menu_friendslist" />
- <item android:id="@+id/chat_menu_change_chat" android:visible="true"
- android:title="@string/chat_menu_change_chat" android:icon="@drawable/ic_menu_chat_dashboard" />
- </group>
- <item android:id="@+id/chat_menu_close_chat" android:visible="true"
- android:title="@string/chat_menu_close_chat" android:icon="@drawable/ic_menu_end_conversation" />
- <item android:id="@+id/chat_menu_otr_submenu" android:visible="true"
- android:title="@string/chat_menu_otr_submenu" android:icon="@drawable/logo_encryption">
- <menu>
- <item android:id="@+id/chat_menu_start_otr_session"
- android:visible="true" android:title="@string/chat_menu_start_otr_session" />
- <item android:id="@+id/chat_menu_stop_otr_session"
- android:visible="true" android:title="@string/chat_menu_stop_otr_session" />
- <item android:id="@+id/chat_menu_otr_verify_key" android:visible="true"
- android:title="@string/chat_menu_otr_verify_key" />
- </menu>
- </item>
-</menu>
--- a/res/menu/contact_list.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/contact_list_menu_add_contact"
- android:visible="true"
- android:title="@string/contact_list_menu_add_contact"
- android:icon="@drawable/ic_menu_add" />
- <item android:id="@+id/menu_change_status"
- android:visible="true"
- android:title="@string/contact_list_menu_status"/>
- <item android:id="@+id/contact_list_menu_chatlist"
- android:visible="true" android:icon="@drawable/ic_menu_chat_dashboard"
- android:title="@string/chat_menu_change_chat"/>
- <item android:id="@+id/contact_list_menu_settings"
- android:visible="true"
- android:title="@string/contact_list_menu_settings"
- android:icon="@drawable/ic_menu_manage" />
- <item android:id="@+id/menu_disconnect"
- android:visible="true"
- android:title="@string/contact_list_menu_disconnect"
- android:icon="@drawable/ic_menu_close_clear_cancel" />
-</menu>
--- a/res/menu/contactlist_context.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/contact_list_context_menu_chat_item"
- android:title="@string/CDChat">
- <menu>
- </menu>
- </item>
- <item android:id="@+id/contact_list_context_menu_call_item"
- android:title="@string/CDCall" android:visible="false" />
- <item android:id="@+id/contact_list_context_menu_user_info"
- android:title="@string/CDInfos">
- <menu>
- <item android:id="@+id/contact_list_context_menu_userinfo_alias"
- android:title="@string/userinfo_label_alias" />
- <item android:id="@+id/contact_list_context_menu_userinfo_group"
- android:title="@string/userinfo_label_chg_group" />
- <item android:id="@+id/contact_list_context_menu_userinfo_subscription"
- android:title="@string/userinfo_label_re_subscription" />
- <item android:id="@+id/contact_list_context_menu_userinfo_block"
- android:title="@string/userinfo_label_block" android:visible="false" />
- <item android:id="@+id/contact_list_context_menu_userinfo_delete"
- android:title="@string/userinfo_label_delete" />
- </menu>
- </item>
-</menu>
--- a/res/menu/edit_settings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/settings_menu_create_account"
- android:visible="true"
- android:icon="@drawable/ic_menu_invite"
- android:title="@string/settings_menu_create_account" />
- <item android:id="@+id/settings_menu_privacy_lists"
- android:visible="false"
- android:title="@string/settings_menu_privacy_lists"
- android:icon="@drawable/ic_menu_blocked_user" />
-</menu>
--- a/res/menu/login.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/login_menu_login"
- android:visible="true"
- android:title="@string/login_menu_login"
- android:icon="@drawable/ic_menu_login" />
- <item android:id="@+id/login_menu_settings"
- android:visible="true"
- android:title="@string/login_menu_settings"
- android:icon="@android:drawable/ic_menu_manage" />
- <item android:id="@+id/login_menu_about"
- android:visible="true"
- android:title="@string/login_menu_about"
- android:icon="@android:drawable/ic_menu_help" />
-</menu>
--- a/res/menu/privacy_list.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/privacy_list_menu_create" android:visible="true"
- android:title="@string/privacy_list_menu_create" android:icon="@android:drawable/ic_menu_add" />
-</menu>
--- a/res/menu/privacy_list_context.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/privacy_list_context_menu_buddies_item"
- android:title="@string/privacy_list_select_dialog_buddies" />
- <item android:id="@+id/privacy_list_context_menu_groups_item"
- android:title="@string/privacy_list_select_dialog_groups" />
- <item android:id="@+id/privacy_list_context_menu_delete_item"
- android:title="@string/privacy_list_select_dialog_delete" />
-</menu>
--- a/res/values-cs/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,321 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- Generic terms -->
- <string name="app_name">Beem</string>
- <string name="OkButton">Ok</string>
- <string name="ClearButton">Vymazat</string>
- <string name="CancelButton">Zrušit</string>
- <string name="AcceptButton">Autorizovat</string>
- <string name="RefuseButton">Odmítnout</string>
- <string name="JabberID">Jabber ID</string>
- <string name="Password">Heslo</string>
- <string name="Continue">Pokračovat</string>
-
- <!-- AccountConfigure class -->
- <string name="AccountConfigureManualConfiguration">Ruční konfigurace</string>
-
- <!-- BeemService class -->
- <string name="BeemServiceDescription">Use Beem Service</string>
-
- <!-- ContactDialog class -->
- <string name="CDChat">Chat</string>
- <string name="CDCall">Volání</string>
- <string name="CDInfos">Správa uživatele</string>
-
- <!-- AddContact class -->
- <string name="AddCActTitle">Beem - Přidání kontaktu</string>
-
- <string name="AddCLogin">Jméno uživatele</string>
- <string name="AddCAlias">Přezdívka</string>
- <string name="AddCGroup">Skupina</string>
- <string name="AddCOkButton">Přidat</string>
- <string name="AddCContactAdded">Kontakt přidán</string>
- <string name="AddCContactAddedError">Chyba kontakt nebyl přidán</string>
- <string name="AddCContactAddedLoginError">Error Login</string>
- <string name="AddCContactAlready">Kontakt již existuje</string>
-
- <!-- ChangeStatus class -->
- <string name="ChangeStatusActTitle">Beem - Změna statusu</string>
- <string name="ChangeStatusType">Můj status</string>
- <string name="OpenContactList">Otevřít seznam kontaktů</string>
-
- <string name="ChangeStatusOk">Aktualizuji status</string>
- <string name="my_avatar">Můj avatar</string>
- <string name="select_avatar">Vybrat avatar</string>
- <string name="take_photo">Vytvořit fotografii</string>
- <string name="pick_photo">Vybrat obrázek</string>
- <string name="delete_avatar">Žádný avatar</string>
- <string name="photoPickerNotFoundText">Fotoaparát nebo kamera nenalezeny</string>
-
-
- <!-- Settings class -->
- <string name="SettingsProxy">Proxy</string>
- <string name="SettingsProxyProxy">Použít proxy server</string>
- <string name="SettingsProxySummary">Připojit se přes proxy server</string>
- <string name="SettingsProxyType">Protokol</string>
- <string name="SettingsProxyTypeSummary">Vybrat typ proxy serveru</string>
- <string name="SettingsProxyServer">Upravit adresu proxy serveru</string>
- <string name="SettingsProxyPort">Upravit port proxy serveru</string>
- <string name="SettingsProxyUser">Volitelné, uživatelské jméno pro ověření na proxy serveru</string>
- <string name="SettingsProxyPassword">Volitelné, heslo pro ověření na proxy serveru</string>
- <string name="SettingsAdvanced">Rozšířené</string>
- <string name="SettingsAdvancedOptions">Specifická nastavení serveru</string>
- <string name="SettingsAdvancedRecoDelay">Upraví prodlevu mezi pokusy o připojení</string>
- <string name="SettingsAdvancedSpecOpt">Zaškrtněte tuto volbu pokud chcete pro připojení použít specifický server</string>
- <string name="SettingsAdvancedAddOpt">Upravit adresu serveru</string>
- <string name="SettingsAdvancedPortOpt">Upravit port serveru</string>
- <string name="SettingsResourceTitle">Zdroj</string>
- <string name="SettingsPriorityTitle">Priorita</string>
- <string name="SettingsResourceSummary">Nastavení názvu zdroje pro XMPP klienta</string>
- <string name="SettingsPrioritySummary">Nastavení priority klienta</string>
- <string name="contact_list_preferences">Seznam kontaktů</string>
- <string name="contact_list_preferences_sum">Nastavení zobrazení pro váš seznam kontaktů
- </string>
- <string name="CLP_hide_groups">Skrýt skupiny</string>
- <string name="CLP_hide_groups_sum">Aktuvujte tuto volbu pro skrytí skupin</string>
- <string name="CLP_show_jid">Zobrazit JID</string>
- <string name="CLP_show_jid_sum">Zaškrtněte tuto volbu pokud chcete vždy zobrazovat JID kontaktu</string>
- <string name="CLP_hidden_contact">Skrýt odpojené</string>
- <string name="CLP_hidden_contact_sum">Zaškrtněte pro skrytí odpojených kontaktů
- </string>
- <string name="settings_account_username">Název účtu (JID)</string>
- <string name="settings_account_password">Heslo</string>
- <string name="settings_account_server">Server</string>
- <string name="settings_account_port">Port</string>
- <string name="settings_advanced_service_behaviour">Chování služby</string>
- <string name="settings_advanced_sum">Nastavení voleb pro pokročilé uživatele</string>
- <string name="settings_xmpp_server">Adresa</string>
- <string name="comments_xmpp_server">example.com</string>
- <string name="settings_xmpp_port">Port</string>
- <string name="settings_xmpp_use_tls">Vyžadovat SSL/TLS</string>
- <string name="settings_reco_delay">Prodleva opakování pokusu o připojení</string>
- <string name="comments_xmpp_port">Výchozí: 5222</string>
- <string name="settings_proxy_sum">Nastavení proxy</string>
- <string name="settings_proxy_use">Připojit prostřednictvím proxy</string>
- <string name="settings_proxy_type_prompt">Vyberte typ proxy</string>
- <string name="settings_proxy_server">Server</string>
- <string name="settings_proxy_port">Port</string>
- <string name="comments_proxy_port">Výchozí: 1080</string>
- <string name="settings_proxy_username">Uživatel</string>
- <string name="settings_proxy_password">Heslo</string>
- <string name="away_chk_title">Povolit automatické \"Pryč\"</string>
- <string name="away_chk_sum">Změní status na \"Pryč\" při zhasnutí obrazovky</string>
- <string name="away_message_title">Zpráva pro stav \"Pryč\"</string>
- <string name="away_message_sum">Zpráva která bude zobrazována při stavu \"Pryč\"</string>
- <string name="away_message_hint">Jsem pryč, display mého telefonu je vypnutý</string>
- <string name="notification_preferences">Nastavení oznamování</string>
- <string name="notification_enable_vibrate_title">Povolit vybrace</string>
- <string name="notification_enable_vibrate_sum">Povolit vibrace při přijetí zprávy</string>
- <string name="notification_snd_title">Vyzvánění při přijetí zprávy</string>
- <string name="notification_snd_sum">Nastaví zvuk přehraný při přijetí zprávy</string>
- <string name="settings_chat_compact">Kompaktní chat</string>
- <string name="settings_chat_compact_sum">Nastaví pro okno kontaktů kompaktní zobrazení</string>
- <string name="history">Historie</string>
- <string name="history_sum">Zaškrtněte pro ukládání konverzací na SD kartu</string>
- <string name="chat_preferences">Chat</string>
- <string name="chat_preferences_sum">Historie, rozložení, velikost ...</string>
- <string name="chat_history_path">Cesta k historii</string>
- <string name="chat_history_path_sum">Konverzace z chatu jsou ukládány na SD kartu</string>
- <string name="settings_smack_debug">Enable XMPP debug</string>
- <string name="settings_full_jid_login">Použít plné JID jako jméno uživatele</string>
- <string name="settings_full_jid_login_sum">Vyžadováno některými serveru jako například Google Talk</string>
-
- <!-- Subscription class -->
- <string name="SubscriptAccept">Subscription accepted</string>
- <string name="SubscriptError">Subscription error</string>
- <string name="SubscriptRefused">Subscription refused</string>
- <string name="SubscriptText">%s si tě chce přidat do seznamu kontaktů. Autorizovat tento kontakt?</string>
- <string name="SubscriptTitle">Autorizovat kontakt?</string>
-
- <!-- BeemBroadcastReceiver class -->
- <string name="BeemBroadcastReceiverDisconnect">BEEM: Byl jste odpojen</string>
-
- <!-- XmppConnectionAdapter class -->
- <string name="AcceptContactRequest">%s si tě právě přidal do seznamu kontaktů..</string>
- <string name="AcceptContactRequestFrom">Authorizuje %s pro komunikaci s vámi.</string>
-
- <!-- Activities -->
- <string name="edit_settings_name">Beem - Nastavení</string>
- <string name="create_account_name">Beem - Vytvořit účet</string>
- <string name="contact_list_name">Beem - Kontakty</string>
- <string name="user_info_name">Beem - Informace o uživateli</string>
-
- <!-- LogAs Activity -->
- <string name="login_menu_settings">Nastavení</string>
- <string name="login_menu_about">O programu</string>
- <string name="login_about_title">Beem %s - o programu</string>
- <string name="login_about_msg">
- Beem je inovativní projekt od EPITECH. Navštivte nás na
- http://www.beem-project.com !
- </string>
- <string name="login_about_button">Zavřít</string>
- <string name="login_login_progress">Připojuji se. Prosím čekejte...</string>
- <string name="login_menu_login">Přihlášení</string>
- <string name="login_start_msg">Settings configuration in menu</string>
-
- <!-- LoginAnim activity -->
- <string name="loganim_connecting">Připojování ...</string>
- <string name="loganim_authenticating">Ověřování ...</string>
- <string name="loganim_login_success">Úspěšně přihlášen</string>
- <string name="loganim_login_failed">Přihlášení se nezdařilo</string>
-
- <!-- EditSettings Activity -->
- <string name="settings_menu_create_account">Vytvořit účet</string>
- <string name="settings_menu_privacy_lists">Manage my privacy lists</string>
- <string name="settings_saved_ok">Nastavení bylo úspěšně uloženo.</string>
-
-
-
- <!-- EditSettings Activity Categories -->
- <string name="general_preferences">Základní nastavení</string>
- <string name="user_preferences">Účet (vyžadováno)</string>
- <string name="user_preferences_advanced">Rozšířená nastavení uživatele (volitelné)</string>
- <string name="network_preferences">Nastavení sítě</string>
- <string name="proxy_proxy_settings">Nastavení proxy</string>
- <string name="proxy_user_settings">Nastavení proxy</string>
- <string name="history_preferences">Historie</string>
- <string name="chat_layout_option">Rozložení chatu</string>
-
-
- <!-- EditSettings Activity Tabs -->
- <string name="settings_tab_tag_account">edit_settings_tab_account</string>
- <string name="settings_tab_label_account">Account</string>
- <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
- <string name="settings_tab_label_xmpp">XMPP</string>
- <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
- <string name="settings_tab_label_proxy">Proxy</string>
-
-
- <!-- wizard activities -->
- <string name="account_wizard_text1"><b>Vítejte v aplikaci BEEM.</b>\n\nJeště nemáte nastavený žádný XMPP (Jabber) účet.\nVyberte jednu z následujících možností:</string>
- <string name="account_wizard_configure_text_1">Použít uložiště hesel a účtů na tomto zařízení</string>
- <string name="account_wizard_configure_text_2"><b>nebo</b></string>
- <string name="account_wizard_configure_text_3">Vyplňte údaje pro již existující účet</string>
- <string name="account_wizard_settings_warn"><b>Varování: </b>Vaše nastavení používají proxy server nebo specifikují jméno serveru.</string>
- <string name="account_wizard_connection_failed"><b>Nepodařilo se ověřit váš účet. Prosím ověřte správnost jména a hesla.</b></string>
- <string name="account_wizard_select_account_btn">Vyberte účet</string>
-
- <string name="account_wizard_configure_account">Již mám účet a chci jej použít pro připojení</string>
- <string name="account_wizard_create_account">Chci si zaregistrovat nový účet</string>
-
- <!-- Create an account Activity -->
- <string name="create_account_text">Vyplňe položky nutné pro vytvoření vašeho nového účtu</string>
- <string name="create_account_progress_title">Vytváření účtu</string>
- <string name="create_account_progress_message">Prosím čekejte</string>
- <string name="create_account_err_username">Neplatné JabberID</string>
- <string name="create_account_err_passwords">Hesla se neshodují.</string>
- <string name="create_account_username">Uživatelské jméno</string>
- <string name="create_account_password">Heslo</string>
- <string name="create_account_confirm_password">Heslo (znovu)</string>
- <string name="create_account_err_conflict">Účet s tímto jménem již existuje. Prosím zkuste jiný</string>
- <string name="create_account_err_connection">Vybraný server není dostupný. Prosím vyberte jiný</string>
-
-
- <!-- ContactList Activity -->
- <string name="contact_list_menu_add_contact">Přidat kontakt</string>
- <string name="contact_list_menu_status">Změnit status</string>
- <string name="contact_list_menu_settings">Nastavení</string>
- <string name="contact_list_menu_disconnect">Odpojit</string>
- <string name="contact_list_all_contact">Všechny kontakty</string>
- <string name="contact_list_no_group">Nezařazené</string>
-
- <!-- UserInfo dialog -->
- <string name="userinfo_label_alias">Přezdívka</string>
- <string name="userinfo_label_chg_group">Spravovat skupiny</string>
- <string name="userinfo_label_re_subscription">Znovu poslat pozvání</string>
- <string name="userinfo_label_block">Blokovat</string>
- <string name="userinfo_label_delete">Smazat</string>
- <string name="userinfo_resend">Suscription resend</string>
- <string name="userinfo_sure2delete">Jste si jist že chcete smazat tento kontakt?
- </string>
- <string name="userinfo_yes">Ano</string>
- <string name="userinfo_no">Ne</string>
- <string name="userinfo_sureresend">Opravdu chcete znovu poslat pozvánku?</string>
-
- <string name="chat_name">Beem - Chat</string>
- <string name="chat_input_default_value">Pište zprávu</string>
- <string name="chat_self">Já</string>
- <string name="chat_error">Chyba</string>
- <string name="chat_send_message">Odeslat</string>
- <string name="chat_menu_contacts_list">Seznam kontaktů</string>
- <string name="chat_menu_change_chat">Přepnout chat</string>
- <string name="chat_menu_start_otr_session">Start OTR session</string>
- <string name="chat_menu_stop_otr_session">Stop OTR session</string>
- <string name="chat_menu_otr_verify_key">OTR ověření klíče</string>
- <string name="chat_menu_otr_submenu">OTR actions</string>
- <string name="chat_dialog_change_chat_title">Otevřené chaty</string>
- <string name="chat_menu_close_chat">Zavřít tento chat</string>
- <string name="chat_no_more_chats">Žádné další chaty</string>
- <string name="chat_state_composing">píše zprávu</string>
- <string name="chat_state_gone">ukončil konverzaci</string>
- <string name="chat_state_active">čeká na vaši odpověď</string>
- <string name="chat_state_inactive">dělá něco jiného</string>
- <string name="chat_otrstate_plaintext">NEŠIFROVÁNO</string>
- <string name="chat_otrstate_encrypted">ŠIFROVÁNO</string>
- <string name="chat_otrstate_finished">DOKONČENO</string>
- <string name="chat_otrstate_authenticated">OVĚŘENÉ</string>
- <string name="chat_otr_verify_key" formatted="false">
- Ověření kontakty vám umožňuje se ujistit že osoba s kterou komunikujete je opravdu ten za koho se vydává.\n\n
- Pro ověření fingerprintu kontaktujte druhou stranu přes nějaký <i>jiný</i> bezpečný kanál, například telefon nebo email podepsaný pomocí GPG. Měli by jste si vzájemě vyměnit fingerprint.\n\n
- Pokud se vše shoduje, měli by jste v dialogu výše potvrdit že jste <b>ověřili</b> fingerprint.\n\n
- Lokální fingerprint %s\n\nFingerprint vzdálené strany %s\n\nOvěřit fingerprint ?</string>
-
- <string name="contact_status_msg_available">Dostupný</string>
- <string name="contact_status_msg_available_chat">Dostupný a rozkecaný</string>
- <string name="contact_status_msg_dnd">Nevyrušovat</string>
- <string name="contact_status_msg_away">Pryč</string>
- <string name="contact_status_msg_xa">Nedostupný</string>
- <string name="contact_status_msg_offline">Odpojený</string>
-
- <string name="privacy_list_name">Beem - Manage my privacy lists</string>
- <string name="privacy_list_no_data">There aren\'t any privacy list registered.</string>
- <string name="privacy_list_menu_create">Create a privacy list</string>
- <string name="privacy_list_create_dialog_title">Create a privacy list</string>
- <string name="privacy_list_create_dialog_list_name_label">Title</string>
- <string name="privacy_list_create_dialog_create_button">Vytvořit</string>
- <string name="privacy_list_select_dialog_buddies">Kontakty</string>
- <string name="privacy_list_select_dialog_groups">Skupiny</string>
- <string name="privacy_list_select_dialog_delete">Smazat</string>
- <string name="privacy_list_delete_dialog_msg">Do you really want to delete the privacy list entitled \'%s\'?</string>
- <string name="privacy_list_delete_dialog_yes">Ano</string>
- <string name="privacy_list_delete_dialog_no">Ne</string>
-
- <string name="UpdateButton">Aktualizovat</string>
-
- <!-- MemorizingTrustManager library -->
- <string name="mtm_accept_cert">Přijmout neznámý certifikát?</string>
- <string name="mtm_decision_always">Vždy</string>
- <string name="mtm_decision_once">Jednou</string>
- <string name="mtm_decision_abort">Odmítnout</string>
-
- <string name="mtm_notification">Ověření certifikátu</string>
-
- <!-- Error messages -->
-
- <string name="error_login_authentication">Chyba při ověřování, chybné jméno uživatele nebo heslo.</string>
-
- <string name="interna_server_error">Chyba na straně serveru</string>
- <string name="bad_request">bad-request</string>
- <string name="forbidden">forbidden</string>
- <string name="item_not_found">item-not-found</string>
- <string name="conflict">conflict</string>
- <string name="feature_not_implemented">feature-not-implemented</string>
- <string name="gone">gone</string>
- <string name="jid_malformed">jid-malformed</string>
- <string name="no_acceptable">no-acceptable</string>
- <string name="not_allowed">not-allowed</string>
- <string name="not_authorized">not-authorized</string>
- <string name="payment_required">payment-required</string>
- <string name="recipient_unavailable">recipient-unavailable</string>
- <string name="redirect">redirect</string>
- <string name="registration_required">registration-required</string>
- <string name="remote_server_not_found">Server nenalezen</string>
- <string name="remote_server_timeout">Server neodpovídá</string>
- <string name="remote_server_error">Chyba na straně serveru</string>
- <string name="resource_constraint">resource-constraint</string>
- <string name="service_unavailable">service-unavailable</string>
- <string name="subscription_required">subscription-required</string>
- <string name="undefined_condition">undefined-condition</string>
- <string name="unexpected_condition">unexpected-condition</string>
- <string name="request_timeout">request-timeout</string>
-</resources>
--- a/res/values-de/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"Glücklich"</item>
- <item msgid="1601611480575517120">"Traurig"</item>
- <item msgid="1531181614218625881">"Zwinkern"</item>
- <item msgid="3858808057949077894">"Frech"</item>
- <item msgid="7835238297967185651">"Überrascht"</item>
- <item msgid="1756223535005296033">"Kuss"</item>
- <item msgid="1093906245140165107">"Schreien"</item>
- <item msgid="888834839864150170">"Cool"</item>
- <item msgid="6320683740534773967">"Dollarzeichen"</item>
- <item msgid="6610111212478853990">"Fettnäpfchen"</item>
- <item msgid="1706035208563940251">"Peinlich berührt"</item>
- <item msgid="9079275787422313427">"Engel"</item>
- <item msgid="4630490399784004880">"Unentschlossen"</item>
- <item msgid="7002574538342357456">"Weinen"</item>
- <item msgid="850324578089267455">"Versiegelte Lippen"</item>
- <item msgid="6334637439528489607">"Fröhlich"</item>
- <item msgid="7602915122893958066">"Verwirrt"</item>
- <item msgid="3939233701582771068">"Verliebt"</item>
- <item msgid="1414759480575851587">"Verärgert"</item>
- <item msgid="8479809115158836070">"Grinsen"</item>
- <item msgid="638612939305162424">"Pokergesicht"</item>
- </string-array>
-</resources>
--- a/res/values-de/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-<!-- Generic terms -->
-<string name="app_name">Beem</string>
-<string name="OkButton">Ok</string>
-<string name="ClearButton">Löschen</string>
-<string name="CancelButton">Abbrechen</string>
-<string name="AcceptButton">Authorisieren</string>
-<string name="RefuseButton">Ablehnen</string>
-<string name="JabberID">Jabber ID</string>
-<string name="Password">Passwort</string>
-<string name="Continue">Fortfahren</string>
-
-<!-- AccountConfigure class -->
-<string name="AccountConfigureManualConfiguration">Manuelle Konfiguration</string>
-
-<!-- Beem class -->
-<string name="BeemJabberID">Jabber ID</string>
-
-<!-- BeemApplication class -->
-<string name="BeemApplicationConnect">Verbinden...</string>
-
-<!-- BeemService class -->
-<string name="BeemServiceDescription">Benutze Beem Service</string>
-<string name="BeemServiceCreated">Beem Service erstellt</string>
-<string name="BeemServiceDestroyed">Beem Service verworfen</string>
-
-<!-- ContactDialog class -->
-<string name="CDChat">Chatten</string>
-<string name="CDCall">Anrufen</string>
-<string name="CDInfos">Kontakt bearbeiten</string>
-
-<!-- AddContact class -->
-<string name="AddCActTitle">Beem - Kontakt hinzufügen</string>
-
-<string name="AddCLogin">Benutzername</string>
-<string name="AddCAlias">Alias</string>
-<string name="AddCGroup">Gruppe</string>
-<string name="AddCOkButton">Hinzufügen</string>
-<string name="AddCContactAdded">Kontakt hinzugefügt</string>
-<string name="AddCContactAddedError">Fehler, Benutzer nicht hinzugefügt</string>
-<string name="AddCContactAddedLoginError">Fehler bei der Anmeldung</string>
-<string name="AddCBadForm">Mangelhafte Form</string>
-<string name="AddCContactAlready">Kontakt existiert bereits</string>
-
-<!-- ChangeStatus class -->
-<string name="ChangeStatusActTitle">Beem - Meinen Status ändern</string>
-<string name="ChangeStatusType">Mein Status</string>
-<string name="ChangeStatusMessage">Meine persönliche Nachricht</string>
-<string name="OpenContactList">Kontaktliste öffnen</string>
-
-<string name="MenuAddContact">Kontakt hinzufügen</string>
-<string name="MenuAccountAbout">Beem Project</string>
-<string name="MenuAccountCreate">Konto erstellen</string>
-<string name="MenuConnection">Konto bearbeiten</string>
-<string name="ChangeStatusOk">Aktualisiere Status</string>
-<string name="ChangeStatusNoChange">Nichts zu ändern</string>
-<string name="my_avatar">Mein Avatar</string>
-<string name="select_avatar">Wähle Avatar</string>
-<string name="take_photo">Foto machen</string>
-<string name="pick_photo">Bild auswählen</string>
-<string name="delete_avatar">Kein Avatar</string>
-<string name="photoPickerNotFoundText">Fotoauswahl nicht gefunden</string>
-
-
-<!-- Settings class -->
-<string name="SettingsText">Benutzername bearbeiten</string>
-<string name="SettingsPassword">Passwort bearbeiten</string>
-<string name="SettingsProxy">Proxy</string>
-<string name="SettingsProxyProxy">Benutze einen Proxyserver</string>
-<string name="SettingsProxySummary">Anmeldung über einen Proxyserver</string>
-<string name="SettingsProxyType">Protokoll</string>
-<string name="SettingsProxyTypeSummary">Art des Proxyservers wählen</string>
-<string name="SettingsProxyServer">Adresse des Proxyservers bearbeiten</string>
-<string name="SettingsProxyPort">Port des Proxyservers bearbeiten</string>
-<string name="SettingsProxyUser">Optional, erlaubt das Authentifizieren mit dem Proxyserver</string>
-<string name="SettingsProxyPassword">Optional, erlaubt das Authentifizieren mit dem Proxyserver</string>
-<string name="SettingsAdvanced">Erweitert</string>
-<string name="SettingsAdvancedOptions">Spezifische Server Optionen</string>
-<string name="SettingsAdvancedRecoDelay">Bearbeite die Verzögerung bei der Wiederverbindung</string>
-<string name="SettingsAdvancedSpecOpt">Aktivieren, um einen spezifischen Server für die Verbindung zu benutzen</string>
-<string name="SettingsAdvancedAddOpt">Adresse des Servers bearbeiten</string>
-<string name="SettingsAdvancedPortOpt">Port des Servers bearbeiten</string>
-<string name="SettingsResourceTitle">Ressource</string>
-<string name="SettingsPriorityTitle">Priorität</string>
-<string name="SettingsResourceSummary">XMPP Ressource des Clients einstellen</string>
-<string name="SettingsPrioritySummary">Priorität des Clients einstellen</string>
-<string name="contact_list_preferences">Kontaktliste</string>
-<string name="contact_list_preferences_sum">A set of display options for your buddy list
-</string>
-<string name="CLP_hide_groups">Gruppen ausblenden</string>
-<string name="CLP_hide_groups_sum">Aktivieren, um Gruppen auszublenden</string>
-<string name="CLP_hidden_contact">Kontakte ausblenden</string>
-<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
-</string>
-<string name="settings_account_username">Benutzername (JID)</string>
-<string name="login_username_info_default">beem@beem-project.com</string>
-<string name="settings_account_password">Passwort</string>
-<string name="settings_account_server">Server</string>
-<string name="settings_account_port">Port</string>
-<string name="settings_advanced_service_behaviour">Verhalten des Dienstes</string>
-<string name="settings_advanced_sum">Erweiterte Einstellungen für fortgeschrittene Benutzer</string>
-<string name="settings_xmpp_server">Adresse</string>
-<string name="comments_xmpp_server">example.com</string>
-<string name="settings_xmpp_port">Port</string>
-<string name="settings_xmpp_use_tls">Verwende SSL/TLS</string>
-<string name="settings_reco_delay">Verzögerung bei der Wiederverbindung</string>
-<string name="comments_xmpp_port">Standard: 5222</string>
-<string name="settings_proxy_sum">Einstellungen für das Benutzen eines Proxyservers</string>
-<string name="settings_proxy_use">Benutze einen Proxyserver</string>
-<string name="settings_proxy_type_prompt">Art des Proxyservers wählen</string>
-<string name="settings_proxy_server">Server</string>
-<string name="settings_proxy_port">Port</string>
-<string name="comments_proxy_port">Standard: 1080</string>
-<string name="settings_proxy_username">Benutzername</string>
-<string name="settings_proxy_password">Passwort</string>
-<string name="away_chk_title">Aktiviere automatische Abwesenheit</string>
-<string name="away_chk_sum">Status auf Abwesend wenn Bildschirm aus</string>
-<string name="away_message_title">Abwesenheitsnachricht</string>
-<string name="away_message_sum">Angezeigte Abwesenheitsnachricht</string>
-<string name="away_message_hint">Ich bin abwesend, mein Telefonbildschirm ist aus</string>
-<string name="notification_preferences">Benachrichtigungseinstellungen</string>
-<string name="notification_enable_vibrate_title">Aktiviere Vibration</string>
-<string name="notification_enable_vibrate_sum">Aktiviere Vibration für eingehende Nachrichten</string>
-<string name="notification_snd_title">Nachrichtensignalton</string>
-<string name="notification_snd_sum">Lege den Signalton für eingehende Nachrichten fest</string>
-<string name="settings_chat_compact">Kompakter Chat</string>
-<string name="settings_chat_compact_sum">Benutze kompakte Chatfenster</string>
-<string name="history">Chronik</string>
-<string name="history_sum">Aktivieren, um Unterhaltungen auf die Speicherkarte zu speichern</string>
-<string name="history_mount">Die Speicherkarte muss eingehängt und beschreibbar sein, um die Chronik zu aktivieren</string>
-<string name="history_on_off">Aktiviere Nachrichtenchronik</string>
-<string name="chat_preferences">Chat</string>
-<string name="chat_preferences_sum">Chronik, Layout Größe ...</string>
-<string name="chat_history_path">Chronik Pfad</string>
-<string name="chat_history_path_sum">Unterhaltungen werden in einem Ordner auf der Speicherkarte gespeichert</string>
-<string name="settings_smack_debug">Aktiviere XMPP Debug Modus</string>
-<string name="settings_full_jid_login">Benutze meine vollständige JID als Benutzername</string>
-<string name="settings_full_jid_login_sum">Wird von einigen Servern, z.b. Google Talk, vorausgesetzt</string>
-
-<!-- Subscription class -->
-<string name="SubscriptAccept">Zustimmung angenommen</string>
-<string name="SubscriptError">Zustimmungsfehler</string>
-<string name="SubscriptRefused">Zustimmung abgelehnt</string>
-<string name="SubscriptText">%s will dich zu seiner/ihrer Kontaktliste hinzufügen. Willst du ihn/sie authorisieren?</string>
-<string name="SubscriptTitle">Kontakt authorisieren?</string>
-
-<!-- BeemChatManager -->
-<string name="BeemChatManagerNewMessage">Du hast eine neue Nachricht</string>
-
-<!-- BeemBroadcastReceiver class -->
-<string name="BeemBroadcastReceiverDisconnect">BEEM: Die Verbindung wurde getrennt</string>
-
-<!-- XmppConnectionAdapter class -->
-<string name="AcceptContactRequest">%s hat dich gerade zu seiner/ihrer Kontaktliste hinzugefügt.</string>
-<string name="AcceptContactRequestFrom">Authorisiere %s dich zu kontaktieren.</string>
-
-<!-- Activities -->
-<string name="login_tag">Beem - Anmeldung</string>
-<string name="edit_settings_name">Beem - Einstellungen</string>
-<string name="edit_settings_tag">Beem - Einstellungen bearbeiten</string>
-<string name="create_account_name">Beem - Konto erstellen</string>
-<string name="create_account_tag">Beem - Konto erstellen</string>
-<string name="contact_list_name">Beem - Kontakte</string>
-<string name="contact_list_tag">Beem - Kontaktliste</string>
-<string name="user_info_name">Beem - Benutzerinformation</string>
-
-<!-- Buttons -->
-<string name="button_create_account">Dieses Konto erstellen</string>
-<string name="button_create_login_account">Dieses Konto erstellen und benutzen</string>
-
-<!-- LogAs Activity -->
-<string name="login_username">Benutzername</string>
-<string name="login_password">Passwort</string>
-<string name="login_error_dialog_title">Anmeldung - Fehler</string>
-<string name="login_close_dialog_button">Schließen</string>
-<string name="login_menu_create_account">Konto erstellen</string>
-<string name="login_menu_settings">Einstellungen</string>
-<string name="login_menu_about">Über</string>
-<string name="login_about_title">Beem %s - Über</string>
-<string name="login_about_msg">
-Beem is an EPITECH Innovative Project. Visit us at
-http://www.beem-project.com !
-</string>
-<string name="login_about_button">Schließen</string>
-<string name="login_settings_button">Einstellungen</string>
-<string name="login_login_button">Anmelden</string>
-<string name="login_login_progress">Verbinden. Bitte warten...</string>
-<string name="login_error_msg">Unfortunately, an error occured.\n\nError
-detail:\n%s</string>
-<string name="login_menu_login">Anmelden</string>
-<string name="login_no_connectivity">Keine Internetverbindung gefunden</string>
-<string name="login_start_msg">Konfiguration der Einstellungen im Menü</string>
-
-<!-- LoginAnim activity -->
-<string name="loganim_connecting">Verbinden...</string>
-<string name="loganim_authenticating">Authentifizieren...</string>
-<string name="loganim_login_success">Erfolgreich angemeldet</string>
-<string name="loganim_login_failed">Anmeldung gescheitert</string>
-
-<!-- EditSettings Activity -->
-<string name="settings_menu_create_account">Konto erstellen</string>
-<string name="settings_menu_privacy_lists">Meine Privatsphärenliste verwalten</string>
-<string name="settings_saved_ok">Die Einstellungen wurden erfolgreich gespeichert.</string>
-
-
-
-<!-- EditSettings Activity Categories -->
-<string name="general_preferences">Allgemeine Einstellungen</string>
-<string name="user_preferences">Benutzereinstellungen (notwendig)</string>
-<string name="user_preferences_advanced">Zusätzliche Benutzereinstellungen (optional)</string>
-<string name="network_preferences">Netzwerk Einstellungen</string>
-<string name="proxy_proxy_settings">Proxy Einstellungen</string>
-<string name="proxy_user_settings">Proxy Einstellungen</string>
-<string name="history_preferences">Chronik</string>
-<string name="chat_layout_option">Chat Ansicht</string>
-
-
-<!-- EditSettings Activity Tabs -->
-<string name="settings_tab_tag_account">edit_settings_tab_account</string>
-<string name="settings_tab_label_account">Konto</string>
-<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
-<string name="settings_tab_label_xmpp">XMPP</string>
-<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
-<string name="settings_tab_label_proxy">Proxy</string>
-
-
-<!-- wizard activities -->
-<string name="account_wizard_text1"><b>Willkommen bei BEEM.</b>nnDu hast noch kein XMPP (Jabber) Konto konfiguriert. Wähle eine der folgenden Optionen:</string>
-<string name="account_wizard_configure_text"><b>Bitte trage die Zugangsdaten für dein vorhandenes Konto ein</b></string>
-<string name="account_wizard_configure_account">Ich habe bereits ein Konto, das ich benutzen will</string>
-<string name="account_wizard_create_account">Ich möchte ein neues Konto registrieren</string>
-
-<!-- Create an account Activity -->
-<string name="create_account_instr_dialog_title">Konto erstellen - Anweisungen</string>
-<string name="create_account_err_dialog_title">Konto erstellen - Fehler</string>
-<string name="create_account_err_dialog_settings_button">Einstellungen ändern</string>
-<string name="create_account_close_dialog_button">Schließen</string>
-<string name="create_account_successfull_after">Das Konto %s wurde erfolgreich erstellt</string>
-<string name="create_account_err_username">Mangelhafte Jabber ID</string>
-<string name="create_account_err_passwords">Passwörter stimmen nicht überein.</string>
-<string name="create_account_username">Benutzername</string>
-<string name="create_account_password">Passwort</string>
-<string name="create_account_confirm_password">Passwort bestätigen</string>
-
-<!-- ContactList Activity -->
-<string name="contact_list_menu_add_contact">Kontakt hinzufügen</string>
-<string name="contact_list_menu_status">Status ändern</string>
-<string name="contact_list_menu_settings">Einstellungen</string>
-<string name="contact_list_menu_disconnect">Verbindung trennen</string>
-<string name="contact_list_all_contact">Alle Kontakte</string>
-<string name="contact_list_no_group">Keine Gruppe</string>
-
-<!-- UserInfo dialog -->
-<string name="userinfo_label_alias">Alias</string>
-<string name="userinfo_label_chg_group">Gruppen verwalten</string>
-<string name="userinfo_label_re_subscription">Einladung erneut senden</string>
-<string name="userinfo_label_block">Sperren</string>
-<string name="userinfo_label_delete">Löschen</string>
-<string name="userinfo_resend">Zustimmung erneut senden</string>
-<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
-</string>
-<string name="userinfo_yes">Ja</string>
-<string name="userinfo_no">Nein</string>
-<string name="userinfo_sureresend">Bist du sicher, dass du die Einladung erneut senden willst?</string>
-
-<string name="chat_name">Beem - Chat</string>
-<string name="chat_input_default_value">Nachricht eingeben</string>
-<string name="chat_self">Ich</string>
-<string name="chat_error">Fehler</string>
-<string name="chat_send_message">Senden</string>
-<string name="chat_menu_contacts_list">Kontaktliste</string>
-<string name="chat_menu_change_chat">Chat wechseln</string>
-<string name="chat_menu_start_otr_session">OTR Sitzung starten</string>
-<string name="chat_menu_stop_otr_session">OTR Sitzung beenden</string>
-<string name="chat_menu_otr_verify_key">OTR Schlüssel authentifizieren</string>
-<string name="chat_menu_otr_submenu">OTR Optionen</string>
-<string name="chat_dialog_change_chat_title">Offene Chats</string>
-<string name="chat_menu_close_chat">Diesen Chat schließen</string>
-<string name="chat_no_more_chats">Keine weiteren aktiven Chats</string>
-<string name="chat_state_composing">schreibt gerade</string>
-<string name="chat_state_gone">hat die Unterhaltung verlassen</string>
-<string name="chat_state_active">verfolgt die Unterhaltung</string>
-<string name="chat_state_inactive">macht etwas anderes</string>
-<string name="chat_otrstate_plaintext">KLARTEXT</string>
-<string name="chat_otrstate_encrypted">VERSCHLÜSSELT</string>
-<string name="chat_otrstate_finished">BEENDET</string>
-<string name="chat_otrstate_authenticated">AUTHENTIFIZIERT</string>
-<string name="chat_otr_verify_key" formatted="false">
-Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
-To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
-If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
-Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
-
-<string name="contact_status_msg_available">Online</string>
-<string name="contact_status_msg_available_chat">Bereit zum Chatten</string>
-<string name="contact_status_msg_dnd">Beschäftigt</string>
-<string name="contact_status_msg_away">Abwesend</string>
-<string name="contact_status_msg_xa">N/A</string>
-<string name="contact_status_msg_offline">Offline</string>
-
-<string name="privacy_list_name">Beem - Meine Privatsphärenliste verwalten</string>
-<string name="privacy_list_no_data">Keine Privatsphärenliste vorhanden.</string>
-<string name="privacy_list_menu_create">Privatsphärenliste erstellen</string>
-<string name="privacy_list_create_dialog_title">Privatsphärenliste erstellen</string>
-<string name="privacy_list_create_dialog_list_name_label">Titel</string>
-<string name="privacy_list_create_dialog_create_button">Erstellen</string>
-<string name="privacy_list_select_dialog_buddies">Kontakte</string>
-<string name="privacy_list_select_dialog_groups">Gruppen</string>
-<string name="privacy_list_select_dialog_delete">Löschen</string>
-<string name="privacy_list_delete_dialog_msg">Bist du sicher, dass du die Privatsphärenliste mit dem Titel \'%s\' löschen willst?</string>
-<string name="privacy_list_delete_dialog_yes">Ja</string>
-<string name="privacy_list_delete_dialog_no">Nein</string>
-
-<string name="UpdateButton">Aktualisieren</string>
-
-<!-- MemorizingTrustManager library -->
-<string name="mtm_accept_cert">Unbekanntes Zertifikat akzeptieren?</string>
-<string name="mtm_decision_always">Immer</string>
-<string name="mtm_decision_once">Einmalig</string>
-<string name="mtm_decision_abort">Abbrechen</string>
-
-<string name="mtm_notification">Zertifikatprüfung</string>
-
-<!-- Error messages -->
-
-<string name="error_login_authentication">Ein Fehler ist während der Authentifizierung aufgetreten: mangelhafter Benutzername oder Passwort.</string>
-
-<string name="interna_server_error">Remoteserver Fehler</string>
-<string name="bad_request">Mangelhafte Anfrage</string>
-<string name="forbidden">Verboten</string>
-<string name="item_not_found">Eintrag nicht gefunden</string>
-<string name="conflict">Konflikt</string>
-<string name="feature_not_implemented">Feature nicht vorhanden</string>
-<string name="gone">verloren</string>
-<string name="jid_malformed">JID mangelhaft</string>
-<string name="no_acceptable">nicht akzeptabel</string>
-<string name="not_allowed">nicht erlaubt</string>
-<string name="not_authorized">nicht authorisiert</string>
-<string name="payment_required">Bezahlung erforderlich</string>
-<string name="recipient_unavailable">Empfänger unerreichbar</string>
-<string name="redirect">weiterleiten</string>
-<string name="registration_required">Anmeldung wird benötigt</string>
-<string name="remote_server_not_found">Remoteserver nicht gefunden</string>
-<string name="remote_server_timeout">Keine Antwort vom Server</string>
-<string name="remote_server_error">Remoteserver Fehler</string>
-<string name="resource_constraint">Ressourcen Einschränkung</string>
-<string name="service_unavailable">Dienst unerreichbar</string>
-<string name="subscription_required">Zustimmung wird benötigt</string>
-<string name="undefined_condition">Undefinierte Bedingung</string>
-<string name="unexpected_condition">Unerwartete Bedingung</string>
-<string name="request_timeout">Zeitüberschreitung bei der Anfrage</string>
-</resources>
--- a/res/values-es/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"Contento"</item>
- <item msgid="1601611480575517120">"Triste"</item>
- <item msgid="1531181614218625881">"Guiño"</item>
- <item msgid="3858808057949077894">"Sacando la lengua"</item>
- <item msgid="7835238297967185651">"Sorprendido"</item>
- <item msgid="1756223535005296033">"Besando"</item>
- <item msgid="1093906245140165107">"Sorpresa"</item>
- <item msgid="888834839864150170">"Atractivo"</item>
- <item msgid="6320683740534773967">"Dinero en la boca"</item>
- <item msgid="6610111212478853990">"Metedura de pata"</item>
- <item msgid="1706035208563940251">"Avergonzado"</item>
- <item msgid="9079275787422313427">"Ángel"</item>
- <item msgid="4630490399784004880">"Indeciso"</item>
- <item msgid="7002574538342357456">"Llorando"</item>
- <item msgid="850324578089267455">"Labios sellados"</item>
- <item msgid="6334637439528489607">"Riendo"</item>
- <item msgid="7602915122893958066">"Confuso"</item>
- <item msgid="3939233701582771068">"Corazón"</item>
- <item msgid="1414759480575851587">"Enfadado"</item>
- <item msgid="8479809115158836070">"No mola"</item>
- <item msgid="638612939305162424">"Cara de póquer"</item>
- </string-array>
-</resources>
--- a/res/values-es/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-<!-- Generic terms -->
-<string name="app_name">Beem</string>
-<string name="OkButton">Aceptar</string>
-<string name="ClearButton">Limpiar</string>
-<string name="CancelButton">Cancelar</string>
-<string name="AcceptButton">Autorizar</string>
-<string name="RefuseButton">Denegar</string>
-<string name="JabberID">Jabber ID</string>
-<string name="Password">Contraseña</string>
-<string name="Continue">Continuar</string>
-
-<!-- AccountConfigure class -->
-<string name="AccountConfigureManualConfiguration">Configuración manual</string>
-
-<!-- Beem class -->
-<string name="BeemJabberID">Jabber ID</string>
-
-<!-- BeemApplication class -->
-<string name="BeemApplicationConnect">Conectando...</string>
-
-<!-- BeemService class -->
-<string name="BeemServiceDescription">Usar el servicio Beem</string>
-<string name="BeemServiceCreated">Servicio Beem creado</string>
-<string name="BeemServiceDestroyed">Servicio Beem suprimido</string>
-
-<!-- ContactDialog class -->
-<string name="CDChat">Charla</string>
-<string name="CDCall">Llamada</string>
-<string name="CDInfos">Gestión de usuario</string>
-
-<!-- AddContact class -->
-<string name="AddCActTitle">Beem - Añadir contacto</string>
-
-<string name="AddCLogin">Usuario</string>
-<string name="AddCAlias">Alias</string>
-<string name="AddCGroup">Grupo</string>
-<string name="AddCOkButton">Añadir</string>
-<string name="AddCContactAdded">Contacto añadido</string>
-<string name="AddCContactAddedError">Error al añadir contacto</string>
-<string name="AddCContactAddedLoginError">Error en el login</string>
-<string name="AddCBadForm">Formulario incorrecto</string>
-<string name="AddCContactAlready">El contacto ya existe</string>
-
-<!-- ChangeStatus class -->
-<string name="ChangeStatusActTitle">Beem - Cambiar mi estado</string>
-<string name="ChangeStatusType">Mi estado</string>
-<string name="ChangeStatusMessage">Mi mensaje personal</string>
-<string name="OpenContactList">Abrir lista de contactos</string>
-
-<string name="MenuAddContact">Añadir contacto</string>
-<string name="MenuAccountAbout">Proyecto Beem</string>
-<string name="MenuAccountCreate">Crear cuenta</string>
-<string name="MenuConnection">Editar cuenta</string>
-<string name="ChangeStatusOk">Actualizando estado</string>
-<string name="ChangeStatusNoChange">Nada que cambiar</string>
-<string name="my_avatar">Mi avatar</string>
-<string name="select_avatar">Escoja su avatar</string>
-<string name="take_photo">Tomar una foto</string>
-<string name="pick_photo">Seleccionar una imagen</string>
-<string name="delete_avatar">Sin avatar</string>
-<string name="photoPickerNotFoundText">Seleccionador de imagen no encontrado</string>
-
-
-<!-- Settings class -->
-<string name="SettingsText">Editar su usuario</string>
-<string name="SettingsPassword">Editar su contraseña</string>
-<string name="SettingsProxy">Proxy</string>
-<string name="SettingsProxyProxy">Usar un servidor proxy</string>
-<string name="SettingsProxySummary">Iniciar a través de un servidor proxy</string>
-<string name="SettingsProxyType">Protocolo</string>
-<string name="SettingsProxyTypeSummary">Escoja el tipo de servidor proxy</string>
-<string name="SettingsProxyServer">Editar dirección del servidor proxy</string>
-<string name="SettingsProxyPort">Editar puerto del servidor proxy</string>
-<string name="SettingsProxyUser">Opcional, permitir el inicio de sesión en el server proxy.</string>
-<string name="SettingsProxyPassword">Opcional, permitir el inicio de sesión en el server proxy.</string>
-<string name="SettingsAdvanced">Avanzado</string>
-<string name="SettingsAdvancedOptions">Opciones especificas del servidor</string>
-<string name="SettingsAdvancedRecoDelay">Modificar retraso de conexión</string>
-<string name="SettingsAdvancedSpecOpt">Marca esta casilla si deseas usar un servidor especifico para esta conexión</string>
-<string name="SettingsAdvancedAddOpt">Editar dirección del servidor</string>
-<string name="SettingsAdvancedPortOpt">Editar puerto del servidor</string>
-<string name="SettingsResourceTitle">Recurso</string>
-<string name="SettingsPriorityTitle">Prioridad</string>
-<string name="SettingsResourceSummary">Establecer el recurso XMPP de tu cliente</string>
-<string name="SettingsPrioritySummary">Establecer la prioridad de tu cliente</string>
-<string name="contact_list_preferences">Lista de amigos</string>
-<string name="contact_list_preferences_sum">A set of display options for your buddy list
-</string>
-<string name="CLP_hide_groups">Ocultar grupos</string>
-<string name="CLP_hide_groups_sum">Habilita esta opción para ocultar grupos</string>
-<string name="CLP_hidden_contact">Ocultar amigos</string>
-<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
-</string>
-<string name="settings_account_username">Nombre de usuario (JID)</string>
-<string name="login_username_info_default">beem@beem-project.com</string>
-<string name="settings_account_password">Contraseña</string>
-<string name="settings_account_server">Servidor</string>
-<string name="settings_account_port">Puerto</string>
-<string name="settings_advanced_service_behaviour">Comportamiento del servicio</string>
-<string name="settings_advanced_sum">Una serie de opciones para usuarios avanzados</string>
-<string name="settings_xmpp_server">Dirección del servidor XMPP</string>
-<string name="comments_xmpp_server">Comentgarios del servidor XMPP</string>
-<string name="settings_xmpp_port">Puerto</string>
-<string name="settings_xmpp_use_tls">Requerir SSL/TTL</string>
-<string name="settings_reco_delay">Tiempo de reconexión</string>
-<string name="comments_xmpp_port">Puerto por defecto: 5222</string>
-<string name="settings_proxy_sum">Configuración del proxy</string>
-<string name="settings_proxy_use">Conectar mediante proxy</string>
-<string name="settings_proxy_type_prompt">Seleccionar tipo de proxy</string>
-<string name="settings_proxy_server">Servidor</string>
-<string name="settings_proxy_port">Puerto</string>
-<string name="comments_proxy_port">Puerto por defecto: 1080</string>
-<string name="settings_proxy_username">Nombre de usuario</string>
-<string name="settings_proxy_password">Contraseña</string>
-<string name="away_chk_title">Habilitar ausente automático</string>
-<string name="away_chk_sum">Cambiar estado a Ausente cuando la pantalla se apague</string>
-<string name="away_message_title">Mensaje de ausente</string>
-<string name="away_message_sum">El mensaje de ausente que será mostrado</string>
-<string name="away_message_hint">Estoy ausente, mi pantalla está apagada</string>
-<string name="notification_preferences">Configuración de notificaciones</string>
-<string name="notification_enable_vibrate_title">Habilitar vibración</string>
-<string name="notification_enable_vibrate_sum">Habilitar vibración en mensajes entrantes</string>
-<string name="notification_snd_title">Tono de mensaje entrante</string>
-<string name="notification_snd_sum">Configurar tono de mensaje entrante</string>
-<string name="settings_chat_compact">Charla compacta</string>
-<string name="settings_chat_compact_sum">Establecer las ventanas de charla en modo compacto</string>
-<string name="history">Historial</string>
-<string name="history_sum">Tilda esto para guardar las conversaciones en la tarjeta SD</string>
-<string name="history_mount">Se necesita una tarjeta SD montada y escribible para habilitar el historial</string>
-<string name="history_on_off">Habilitar historial de mensajes</string>
-<string name="chat_preferences">Charla</string>
-<string name="chat_preferences_sum">Historial, tamaño de la distribución visual...</string>
-<string name="chat_history_path">Ruta al historial</string>
-<string name="chat_history_path_sum">Las conversaciones se guardan en una carpeta en la tarjeta SD</string>
-<string name="settings_smack_debug">Habilitar depuración de XMPP</string>
-<string name="settings_full_jid_login">Usar el JID completo como nombre de usuario</string>
-<string name="settings_full_jid_login_sum">Necesario para algunos servidores como por ejemplo Google Talk</string>
-
-<!-- Subscription class -->
-<string name="SubscriptAccept">Suscripción aceptada</string>
-<string name="SubscriptError">Error de suscripción</string>
-<string name="SubscriptRefused">Suscripción rechazada</string>
-<string name="SubscriptText">%s desea agregarlo/a a su lista de contactos. ¿Desea autorizarlo/a ?</string>
-<string name="SubscriptTitle">¿Autorizar contacto?</string>
-
-<!-- BeemChatManager -->
-<string name="BeemChatManagerNewMessage">Tienes un nuevo mensaje</string>
-
-<!-- BeemBroadcastReceiver class -->
-<string name="BeemBroadcastReceiverDisconnect">BEEM: Ha sido desconectado</string>
-
-<!-- XmppConnectionAdapter class -->
-<string name="AcceptContactRequest">%s lo/la agregó a su lista de contactos.</string>
-<string name="AcceptContactRequestFrom">Autorice a %s para que lo contacte.</string>
-
-<!-- Activities -->
-<string name="login_tag">Beem - Actividad inicio</string>
-<string name="edit_settings_name">Beem - Configuración</string>
-<string name="edit_settings_tag">Beem - Actividad editar configuración</string>
-<string name="create_account_name">Beem - Crear una cuenta</string>
-<string name="create_account_tag">Beem - Actividad creación cuenta</string>
-<string name="contact_list_name">Beem - Contactos</string>
-<string name="contact_list_tag">Beem - Actividad lista contactos</string>
-<string name="user_info_name">Beem - Información de usuario</string>
-
-<!-- Buttons -->
-<string name="button_create_account">Crear esta cuenta</string>
-<string name="button_create_login_account">Crear y usar esta cuenta</string>
-
-<!-- LogAs Activity -->
-<string name="login_username">Usuario</string>
-<string name="login_password">Contraseña</string>
-<string name="login_error_dialog_title">Inicio sesión - Error</string>
-<string name="login_close_dialog_button">Cerrar</string>
-<string name="login_menu_create_account">Crear una cuenta</string>
-<string name="login_menu_settings">Configuración</string>
-<string name="login_menu_about">Acerca de</string>
-<string name="login_about_title">Beem %s - Acerca de</string>
-<string name="login_about_msg">
-Beem is an EPITECH Innovative Project. Visit us at
-http://www.beem-project.com !
-</string>
-<string name="login_about_button">Cerrar</string>
-<string name="login_settings_button">Configuración</string>
-<string name="login_login_button">Inicio</string>
-<string name="login_login_progress">Conectando. Espere por favor ...</string>
-<string name="login_error_msg">Unfortunately, an error occured.\n\nError
-detail:\n%s</string>
-<string name="login_menu_login">Iniciar sesión</string>
-<string name="login_no_connectivity">No se detecto una conexión a internet</string>
-<string name="login_start_msg">Configuración de parametros en menú</string>
-
-<!-- LoginAnim activity -->
-<string name="loganim_connecting">Conectando...</string>
-<string name="loganim_authenticating">Autenticando...</string>
-<string name="loganim_login_success">Inicio correcto</string>
-<string name="loganim_login_failed">Inicio fallido</string>
-
-<!-- EditSettings Activity -->
-<string name="settings_menu_create_account">Crear una cuenta</string>
-<string name="settings_menu_privacy_lists">Administrar mis listas de privacidad</string>
-<string name="settings_saved_ok">Los cambios han sido guardados correctamente.</string>
-
-
-
-<!-- EditSettings Activity Categories -->
-<string name="general_preferences">Preferencias generales</string>
-<string name="user_preferences">Configuración de usuario (requerido)</string>
-<string name="user_preferences_advanced">Configuración avanzada de usuario (opcional)</string>
-<string name="network_preferences">Opciones de red</string>
-<string name="proxy_proxy_settings">Configuración Proxy</string>
-<string name="proxy_user_settings">Configuración Proxy</string>
-<string name="history_preferences">Historial</string>
-<string name="chat_layout_option">Distribución visual de la conversación</string>
-
-
-<!-- EditSettings Activity Tabs -->
-<string name="settings_tab_tag_account">editar_configuración_pestaña_cuenta</string>
-<string name="settings_tab_label_account">Cuenta</string>
-<string name="settings_tab_tag_xmpp">editar_configuración_pestaña_xmpp</string>
-<string name="settings_tab_label_xmpp">XMPP</string>
-<string name="settings_tab_tag_proxy">editar_configuración_pestaña_proxy</string>
-<string name="settings_tab_label_proxy">Proxy</string>
-
-
-<!-- wizard activities -->
-<string name="account_wizard_text1"><b>Bienvenido a BEEM.</b>\n\nTodavía no ha configurado su cuenta XMPP (Jabber).\nEscoja una de las siguientes opciones:</string>
-<string name="account_wizard_configure_text"><b>Por favor, complete con la información de su cuenta existente</b></string>
-<string name="account_wizard_configure_account">Ya tengo una cuenta y deseo utilizarla</string>
-<string name="account_wizard_create_account">Deseo registrar una nueva cuenta</string>
-
-<!-- Create an account Activity -->
-<string name="create_account_instr_dialog_title">Crear cuenta - Instrucciones</string>
-<string name="create_account_err_dialog_title">Crear cuenta - Error</string>
-<string name="create_account_err_dialog_settings_button">Cambiar mi configuración</string>
-<string name="create_account_close_dialog_button">Cerrar</string>
-<string name="create_account_successfull_after">la cuenta %s fue creada correctamente</string>
-<string name="create_account_err_username">JabberID incorrecto </string>
-<string name="create_account_err_passwords">La clave no coincide</string>
-<string name="create_account_username">Usuario</string>
-<string name="create_account_password">Contraseña</string>
-<string name="create_account_confirm_password">Confirmar contraseña</string>
-
-<!-- ContactList Activity -->
-<string name="contact_list_menu_add_contact">Añadir un contacto</string>
-<string name="contact_list_menu_status">Cambiar estado</string>
-<string name="contact_list_menu_settings">Configuración</string>
-<string name="contact_list_menu_disconnect">Desconectar</string>
-<string name="contact_list_all_contact">Todos los contactos</string>
-<string name="contact_list_no_group">Sin grupo</string>
-
-<!-- UserInfo dialog -->
-<string name="userinfo_label_alias">Alias</string>
-<string name="userinfo_label_chg_group">Administrar grupos</string>
-<string name="userinfo_label_re_subscription">Reenviar invitación</string>
-<string name="userinfo_label_block">Bloquear</string>
-<string name="userinfo_label_delete">Borrar</string>
-<string name="userinfo_resend">Reenviar suscripción</string>
-<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
-</string>
-<string name="userinfo_yes">Sí</string>
-<string name="userinfo_no">No</string>
-<string name="userinfo_sureresend">¿Estás seguro/a de que deseas reenviar la invitación?</string>
-
-<string name="chat_name">Beem - Charla</string>
-<string name="chat_input_default_value">Escribe tu Mensaje</string>
-<string name="chat_self">Yo</string>
-<string name="chat_error">Error</string>
-<string name="chat_send_message">Enviar</string>
-<string name="chat_menu_contacts_list">Lista de Contactos</string>
-<string name="chat_menu_change_chat">Cambiar charla</string>
-<string name="chat_dialog_change_chat_title">Charlas abiertos</string>
-<string name="chat_menu_close_chat">Cerrar charla</string>
-<string name="chat_no_more_chats">No hay más charlas activas</string>
-<string name="chat_state_composing">está escribiendo un mensaje</string>
-<string name="chat_state_gone">ha dejado la conversación</string>
-<string name="chat_state_active">presta atención a la conversación</string>
-<string name="chat_state_inactive">está haciendo otra cosa</string>
-
-<string name="contact_status_msg_available">Disponible</string>
-<string name="contact_status_msg_available_chat">Disponible para chatear</string>
-<string name="contact_status_msg_dnd">No interumpir</string>
-<string name="contact_status_msg_away">Ausente</string>
-<string name="contact_status_msg_xa">No disponible</string>
-<string name="contact_status_msg_offline">Desconectado</string>
-
-<string name="privacy_list_name">Beem - Administrar mi lista de privacidad</string>
-<string name="privacy_list_no_data">No existe ninguna lista de privacidad registrada</string>
-<string name="privacy_list_menu_create">Crear una lista de privacidad</string>
-<string name="privacy_list_create_dialog_title">Crear una lista de privacidad</string>
-<string name="privacy_list_create_dialog_list_name_label">Título</string>
-<string name="privacy_list_create_dialog_create_button">Crear</string>
-<string name="privacy_list_select_dialog_buddies">Contactos</string>
-<string name="privacy_list_select_dialog_groups">Grupos</string>
-<string name="privacy_list_select_dialog_delete">Borrar</string>
-<string name="privacy_list_delete_dialog_msg">Borrar la lista privada \'%s\' ?</string>
-<string name="privacy_list_delete_dialog_yes">Sí</string>
-<string name="privacy_list_delete_dialog_no">No</string>
-
-<string name="UpdateButton">Actualizar</string>
-
-<!-- Error messages -->
-
-<string name="error_login_authentication">Error al iniciar sesión, usuario o contraseña erroneos.</string>
-
-<string name="interna_server_error">Error Servidor remoto</string>
-<string name="bad_request">pedido equivocado</string>
-<string name="forbidden">prohibido</string>
-<string name="item_not_found">elemento no encontrado</string>
-<string name="conflict">conflicto</string>
-<string name="feature_not_implemented">caracteristica no implementada</string>
-<string name="gone">ir</string>
-<string name="jid_malformed">jid malformado</string>
-<string name="no_acceptable">inaceptable</string>
-<string name="not_allowed">no permitido</string>
-<string name="not_authorized">no autorizado</string>
-<string name="payment_required">pago requerido</string>
-<string name="recipient_unavailable">receptor no disponible</string>
-<string name="redirect">redireccionar</string>
-<string name="registration_required">registro requerido</string>
-<string name="remote_server_not_found">servidor remoto no encontrado</string>
-<string name="remote_server_timeout">Sin respuesta del servidor</string>
-<string name="remote_server_error">Error en servidor remoto</string>
-<string name="resource_constraint">restricción en recurso</string>
-<string name="service_unavailable">servicio no disponible</string>
-<string name="subscription_required">suscripción requerida</string>
-<string name="undefined_condition">condición indefinida</string>
-<string name="unexpected_condition">condición inesperada</string>
-<string name="request_timeout">tiempo de espera de solicitud </string>
-</resources>
--- a/res/values-eu/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-<!-- Generic terms -->
-<string name="app_name">Beem</string>
-<string name="OkButton">Ados</string>
-<string name="ClearButton">Garbitu</string>
-<string name="CancelButton">Utzi</string>
-<string name="AcceptButton">Baimendu</string>
-<string name="RefuseButton">Ukatu</string>
-<string name="JabberID">Jabber ID-a</string>
-<string name="Password">Pasahitza</string>
-<string name="Continue">Jarraitu</string>
-
-<!-- AccountConfigure class -->
-<string name="AccountConfigureManualConfiguration">Eskuzko konfigurazioa</string>
-
-<!-- BeemService class -->
-<string name="BeemServiceDescription">Erabili Beem zerbitzua</string>
-
-<!-- ContactDialog class -->
-<string name="CDChat">Berriketa</string>
-<string name="CDCall">Deia</string>
-<string name="CDInfos">Kudeatu erabiltzailea</string>
-
-<!-- AddContact class -->
-<string name="AddCActTitle">Beem - Gehitu kontaktu bat</string>
-
-<string name="AddCLogin">Erabiltzaile-izena</string>
-<string name="AddCAlias">Goitizena</string>
-<string name="AddCGroup">Taldea</string>
-<string name="AddCOkButton">Gehitu</string>
-<string name="AddCContactAdded">Kontaktua gehituta</string>
-<string name="AddCContactAddedError">Errorea: Kontaktua ez da gehitu</string>
-<string name="AddCContactAddedLoginError">Errorea saioa hastean</string>
-<string name="AddCContactAlready">Kontaktua dagoeneko existitzen da</string>
-
-<!-- ChangeStatus class -->
-<string name="ChangeStatusActTitle">Beem - Aldatu nire egoera</string>
-<string name="ChangeStatusType">Nire egoera</string>
-<string name="ChangeStatusMessage">Nire mezu pertsonala</string>
-<string name="OpenContactList">Ireki kontaktu zerrenda</string>
-
-<string name="ChangeStatusOk">Egoera eguneratzen</string>
-<string name="my_avatar">Nire avatar-a</string>
-<string name="select_avatar">Aukeratu zure avatar-a</string>
-<string name="take_photo">Egin argazki bat</string>
-<string name="pick_photo">Hautatu irudi bat</string>
-<string name="delete_avatar">Avatar-ik ez</string>
-<string name="photoPickerNotFoundText">Ez da argazki hautatzailerik aurkitu</string>
-
-
-<!-- Settings class -->
-<string name="SettingsProxy">Proxy-a</string>
-<string name="SettingsProxyProxy">Erabili proxy zerbitzari bat</string>
-<string name="SettingsProxySummary">Hasi saioa proxy zerbitzari bidez</string>
-<string name="SettingsProxyType">Protokoloa</string>
-<string name="SettingsProxyTypeSummary">Aukeratu proxy zerbitzari mota</string>
-<string name="SettingsProxyServer">Editatu proxy zerbitzariaren helbidea</string>
-<string name="SettingsProxyPort">Editatu proxy zerbitzariaren ataka</string>
-<string name="SettingsProxyUser">Hautazkoa, onartu zeure burua proxy zerbitzarian autentifikatzea</string>
-<string name="SettingsProxyPassword">Hautazkoa, onartu zeure burua proxy zerbitzarian autentifikatzea</string>
-<string name="SettingsAdvanced">Aurreratua</string>
-<string name="SettingsAdvancedOptions">Zerbitzari jakin bat aukera</string>
-<string name="SettingsAdvancedRecoDelay">Aldatu birkonexio atzerapena</string>
-<string name="SettingsAdvancedSpecOpt">Hautatu hau zure konexioan zerbitzari jakin bat erabili nahi baduzu</string>
-<string name="SettingsAdvancedAddOpt">Editatu zerbitzariaren helbidea</string>
-<string name="SettingsAdvancedPortOpt">Editatu zerbitzariaren ataka</string>
-<string name="SettingsResourceTitle">Baliabidea</string>
-<string name="SettingsPriorityTitle">Lehentasuna</string>
-<string name="SettingsResourceSummary">Ezarri zure bezeroaren XMPP baliabidea</string>
-<string name="SettingsPrioritySummary">Ezarri zure bezeroaren lehentasuna</string>
-<string name="contact_list_preferences">Lagun zerrenda</string>
-<string name="contact_list_preferences_sum">A set of display options for your buddy list
-</string>
-<string name="CLP_hide_groups">Ezkutatu taldeak</string>
-<string name="CLP_hide_groups_sum">Hautatu aukera hau taldeak ezkutatzeko</string>
-<string name="CLP_show_jid">Erakutsi JID</string>
-<string name="CLP_show_jid_sum">Hautatu aukera hau kontaktuaren JIDa beti erakusteko</string>
-<string name="CLP_hidden_contact">Ezkutatu lagunak</string>
-<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
-</string>
-<string name="settings_account_username">Erabiltzaile-izena (JID)</string>
-<string name="settings_account_password">Pasahitza</string>
-<string name="settings_account_server">Zerbitzaria</string>
-<string name="settings_account_port">Ataka</string>
-<string name="settings_advanced_service_behaviour">Zerbitzuaren portaera</string>
-<string name="settings_advanced_sum">Erabiltzaile aurreratuentzako aukera sorta bat</string>
-<string name="settings_xmpp_server">Helbidea</string>
-<string name="comments_xmpp_server">adibidea.com</string>
-<string name="settings_xmpp_port">Ataka</string>
-<string name="settings_xmpp_use_tls">SSL/TLS behar du</string>
-<string name="settings_reco_delay">Birkonexio atzerapena</string>
-<string name="comments_xmpp_port">Lehenetsia: 5222</string>
-<string name="settings_proxy_sum">Proxy-aren erabilera ezarpenak</string>
-<string name="settings_proxy_use">Konektatu proxy bat erabiliz</string>
-<string name="settings_proxy_type_prompt">Aukeratu proxy mota bat</string>
-<string name="settings_proxy_server">Zerbitzaria</string>
-<string name="settings_proxy_port">Ataka</string>
-<string name="comments_proxy_port">Lehenetsia: 1080</string>
-<string name="settings_proxy_username">Erabiltzaile-izena</string>
-<string name="settings_proxy_password">Pasahitza</string>
-<string name="away_chk_title">Gaitu automatikoki aldenduta</string>
-<string name="away_chk_sum">Ezarri Aldendua egoera pantaila itzaltzean</string>
-<string name="away_message_title">Aldendua mezua</string>
-<string name="away_message_sum">Bistaratuko den Aldendua mezua</string>
-<string name="away_message_hint">Aldendua nago, nire mugikorraren pantaila itzalita dago</string>
-<string name="notification_preferences">Jakinarazpenen ezarpenak</string>
-<string name="notification_enable_vibrate_title">Gaitu bibrazioa</string>
-<string name="notification_enable_vibrate_sum">Gaitu bibrazioa sarrerako mezuetan</string>
-<string name="notification_snd_title">Mezuaren tonua</string>
-<string name="notification_snd_sum">Ezarri sarrerako mezuen tonua</string>
-<string name="settings_chat_compact">Berriketa trinkoa</string>
-<string name="settings_chat_compact_sum">Ezarri berriketa leiho trinkoa</string>
-<string name="history">Historia</string>
-<string name="history_sum">Hautatu hau berriketak SD txartelean gordetzeko</string>
-<string name="chat_preferences">Berriketa</string>
-<string name="chat_preferences_sum">Historia, diseinuaren tamaina</string>
-<string name="chat_history_path">Historia bidea</string>
-<string name="chat_history_path_sum">Berriketa elkarrizketak SD txarteleko karpeta batean gordetzen dira</string>
-<string name="settings_smack_debug">Gaitu XMPP arazketa</string>
-<string name="settings_full_jid_login">Erabili nire JID osoa erabiltzaile-izen bezala</string>
-<string name="settings_full_jid_login_sum">Google Talk bezalako zenbait zerbitzarik behar dute</string>
-
-<!-- Subscription class -->
-<string name="SubscriptAccept">Harpidetza onartuta</string>
-<string name="SubscriptError">Harpidetza errorea</string>
-<string name="SubscriptRefused">Harpidetza errefusatuta</string>
-<string name="SubscriptText">%s-(e)k bere lagun zerrendara gehitu nahi zaitu. Baimendu nahi duzu?</string>
-<string name="SubscriptTitle">Laguna baimendu?</string>
-
-<!-- BeemBroadcastReceiver class -->
-<string name="BeemBroadcastReceiverDisconnect">BEEM: Deskonektatua izan zara</string>
-
-<!-- XmppConnectionAdapter class -->
-<string name="AcceptContactRequest">%s-(e)k bere lagun zerrendara gehitu zaitu oraintxe.</string>
-<string name="AcceptContactRequestFrom">Baimendu %s-(e)k zurekin kontaktatzea.</string>
-
-<!-- Activities -->
-<string name="edit_settings_name">Beem - Ezarpenak</string>
-<string name="create_account_name">Beem - Sortu kontu bat</string>
-<string name="contact_list_name">Beem - Kontaktuak</string>
-<string name="user_info_name">Beem - Erabiltzailearen informazioa</string>
-
-<!-- LogAs Activity -->
-<string name="login_menu_settings">Ezarpenak</string>
-<string name="login_menu_about">Honi buruz</string>
-<string name="login_about_title">Beem %s - Honi buruz</string>
-<string name="login_about_msg">
-Beem is an EPITECH Innovative Project. Visit us at
-http://www.beem-project.com !
-</string>
-<string name="login_about_button">Itxi</string>
-<string name="login_login_progress">Konektatzen. Itxaron mesedez...</string>
-<string name="login_menu_login">Hasi saioa</string>
-<string name="login_start_msg">Ezarpenen konfigurazioa menuan</string>
-
-<!-- LoginAnim activity -->
-<string name="loganim_connecting">Konektatzen...</string>
-<string name="loganim_authenticating">Autentifikatzen...</string>
-<string name="loganim_login_success">Saio hasiera arrakastatsua</string>
-<string name="loganim_login_failed">Saio hasierak huts egin du</string>
-
-<!-- EditSettings Activity -->
-<string name="settings_menu_create_account">Sortu kontu bat</string>
-<string name="settings_menu_privacy_lists">Kudeatu nire pribatutasun zerrendak</string>
-<string name="settings_saved_ok">Ezarpenak behar bezala gorde dira.</string>
-
-
-
-<!-- EditSettings Activity Categories -->
-<string name="general_preferences">Hobespen orokorrak</string>
-<string name="user_preferences">Erabiltzailearen ezarpenak (beharrezkoa)</string>
-<string name="user_preferences_advanced">Erabiltzailearen ezarpen aurreratuak (hautazkoa)</string>
-<string name="network_preferences">Sarearen aukerak</string>
-<string name="proxy_proxy_settings">Proxy-aren aukerak</string>
-<string name="proxy_user_settings">Proxy-aren aukerak</string>
-<string name="history_preferences">Historia</string>
-<string name="chat_layout_option">Berriketaren diseinua</string>
-
-
-<!-- EditSettings Activity Tabs -->
-<string name="settings_tab_tag_account">editatu_ezarpenak_kontua_fitxa</string>
-<string name="settings_tab_label_account">Kontua</string>
-<string name="settings_tab_tag_xmpp">editatu_ezarpenak_xmpp_fitxa</string>
-<string name="settings_tab_label_xmpp">XMPP</string>
-<string name="settings_tab_tag_proxy">editatu_ezarpenak_proxy_fitxa</string>
-<string name="settings_tab_label_proxy">Proxy-a</string>
-
-
-<!-- wizard activities -->
-<string name="account_wizard_text1"><b>Ongietorri BEEM-era.</b>nnEz duzu XMPP (Jabber) konturik konfiguratu oraindik.nAukeratu ondorengo aukeretako bat:</string>
-<string name="account_wizard_configure_text_1">Erabili gailuan gordetako kontu bat</string>
-<string name="account_wizard_configure_text_2"><b>edo</b></string>
-<string name="account_wizard_configure_text_3">Bete existitzen den zure kontuaren datuak</string>
-<string name="account_wizard_settings_warn"><b>Abisua: </b>Zure ezarpenetan proxy-zerbitzari bat edo ostalari-izen jakin bat duen zerbitzaria erabiltzeko aukera ezarrita daukazu.</string>
-<string name="account_wizard_connection_failed"><b>Ezin izan da zure kontua autentifikatu. Mesedez egiaztatu zure kredentzialak</b></string>
-<string name="account_wizard_select_account_btn">Aukeratu kontu bat</string>
-
-<string name="account_wizard_configure_account">Dagoeneko badut erabili nahi dudan kontu bat</string>
-<string name="account_wizard_create_account">Kontu berri bat erregistratu nahi dut</string>
-
-<!-- Create an account Activity -->
-<string name="create_account_text">Sartu zure kontua sortzeko beharrezko den informazioa</string>
-<string name="create_account_progress_title">Kontua sortzen</string>
-<string name="create_account_progress_message">Mesedez itxaron</string>
-<string name="create_account_err_username">JabberID okerra</string>
-<string name="create_account_err_passwords">Pasahitzak ez datoz bat.</string>
-<string name="create_account_username">Erabiltzaile-izena</string>
-<string name="create_account_password">Pasahitza</string>
-<string name="create_account_confirm_password">Berretsi pasahitza</string>
-<string name="create_account_err_conflict">Kontu hau dagoeneko erabiltzen da. Mesedez saiatu beste batekin</string>
-<string name="create_account_err_connection">Hautatutako zerbitzaria ez dago erabilgarri. Mesedez saiatu beste batekin</string>
-
-
-<!-- ContactList Activity -->
-<string name="contact_list_menu_add_contact">Gehitu kontaktu bat</string>
-<string name="contact_list_menu_status">Aldatu egoera</string>
-<string name="contact_list_menu_settings">Ezarpenak</string>
-<string name="contact_list_menu_disconnect">Deskonektatu</string>
-<string name="contact_list_all_contact">Kontaktu guztiak</string>
-<string name="contact_list_no_group">Talderik ez</string>
-
-<!-- UserInfo dialog -->
-<string name="userinfo_label_alias">Goitizena</string>
-<string name="userinfo_label_chg_group">Kudeatu taldeak</string>
-<string name="userinfo_label_re_subscription">Birbidali gonbidapena</string>
-<string name="userinfo_label_block">Blokeatu</string>
-<string name="userinfo_label_delete">Ezabatu</string>
-<string name="userinfo_resend">Harpidetza birbidalita</string>
-<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
-</string>
-<string name="userinfo_yes">Bai</string>
-<string name="userinfo_no">Ez</string>
-<string name="userinfo_sureresend">Ziur zaude gonbidapena birbidali nahi duzula?</string>
-
-<string name="chat_name">Beem - Berriketa</string>
-<string name="chat_input_default_value">Idatzi zure mezua</string>
-<string name="chat_self">Ni</string>
-<string name="chat_error">Errorea</string>
-<string name="chat_send_message">Bidali</string>
-<string name="chat_menu_contacts_list">Kontaktu zerrenda</string>
-<string name="chat_menu_change_chat">Aldatu berriketa</string>
-<string name="chat_menu_start_otr_session">Hasi OTR saioa</string>
-<string name="chat_menu_stop_otr_session">Gelditu OTR saioa</string>
-<string name="chat_menu_otr_verify_key">OTR egiaztatu gakoa</string>
-<string name="chat_menu_otr_submenu">OTR ekintzak</string>
-<string name="chat_dialog_change_chat_title">Irekitako berriketak</string>
-<string name="chat_menu_close_chat">Itxi berriketa hau</string>
-<string name="chat_no_more_chats">Ez dago berriketa aktibo gehiago</string>
-<string name="chat_state_composing">mezu bat osatzen ari da</string>
-<string name="chat_state_gone">-(e)k elkarrizketa utzi du</string>
-<string name="chat_state_active">elkarrizketa jarraitzen ari da</string>
-<string name="chat_state_inactive">beste zerbait egiten ari da</string>
-<string name="chat_otrstate_plaintext">TESTULAUA</string>
-<string name="chat_otrstate_encrypted">ZIFRATUTA</string>
-<string name="chat_otrstate_finished">AMAITUTA</string>
-<string name="chat_otrstate_authenticated">AUTENTIFIKATUTA</string>
-<string name="chat_otr_verify_key" formatted="false">
-Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
-To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
-If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
-Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
-
-<string name="contact_status_msg_available">Eskuragarri</string>
-<string name="contact_status_msg_available_chat">Eskuragarri berriketarako</string>
-<string name="contact_status_msg_dnd">Ez eragotzi</string>
-<string name="contact_status_msg_away">Aldendua</string>
-<string name="contact_status_msg_xa">Eskuraezin</string>
-<string name="contact_status_msg_offline">Deskonektatuta</string>
-
-<string name="privacy_list_name">Beem - Kudeatu nire pribatutasun zerrendak</string>
-<string name="privacy_list_no_data">Ez dago pribatutasun zerrendarik erregistratuta.</string>
-<string name="privacy_list_menu_create">Sortu pribatutasun zerrenda bat</string>
-<string name="privacy_list_create_dialog_title">Sortu pribatutasun zerrenda bat</string>
-<string name="privacy_list_create_dialog_list_name_label">Izenburua</string>
-<string name="privacy_list_create_dialog_create_button">Sortu</string>
-<string name="privacy_list_select_dialog_buddies">Lagunak</string>
-<string name="privacy_list_select_dialog_groups">Taldeak</string>
-<string name="privacy_list_select_dialog_delete">Ezabatu</string>
-<string name="privacy_list_delete_dialog_msg">Ziur zaude \'%s\' izeneko pribatutasun zerrenda ezabatu nahi duzula?</string>
-<string name="privacy_list_delete_dialog_yes">Bai</string>
-<string name="privacy_list_delete_dialog_no">Ez</string>
-
-<string name="UpdateButton">Eguneratu</string>
-
-<!-- MemorizingTrustManager library -->
-<string name="mtm_accept_cert">Ziurtagiri ezezaguna onartu?</string>
-<string name="mtm_decision_always">Beti</string>
-<string name="mtm_decision_once">Behin</string>
-<string name="mtm_decision_abort">Abortatu</string>
-
-<string name="mtm_notification">Ziurtagiriaren egiaztapena</string>
-
-<!-- Error messages -->
-
-<string name="error_login_authentication">Errorea autentifikatzean, erabiltzaile edo pasahitz okerra</string>
-
-<string name="interna_server_error">Urruneko zerbitzariaren errorea</string>
-<string name="bad_request">eskaera-okerra</string>
-<string name="forbidden">debekatua</string>
-<string name="item_not_found">elementua-ez-da-aurkitu</string>
-<string name="conflict">gatazka</string>
-<string name="feature_not_implemented">inplementatu-gabeko-ezaugarria</string>
-<string name="gone">joana</string>
-<string name="jid_malformed">gaizki-osatutako-jid</string>
-<string name="no_acceptable">onartezina</string>
-<string name="not_allowed">ez-onartua</string>
-<string name="not_authorized">ez-baimendua</string>
-<string name="payment_required">ordainketa-beharrezkoa</string>
-<string name="recipient_unavailable">hartzaile-eskuraezina</string>
-<string name="redirect">birbideratu</string>
-<string name="registration_required">erregistratzea-beharrezkoa</string>
-<string name="remote_server_not_found">Ez da urruneko zerbitzaria aurkitu</string>
-<string name="remote_server_timeout">Zerbitzariaren erantzunik ez</string>
-<string name="remote_server_error">Urruneko zerbitzariaren errorea</string>
-<string name="resource_constraint">baliabide-mugatua</string>
-<string name="service_unavailable">zerbitzu-eskuraezina</string>
-<string name="subscription_required">harpidetza-beharrezkoa</string>
-<string name="undefined_condition">definitu-gabeko-baldintza</string>
-<string name="unexpected_condition">ustekabeko-baldintza</string>
-<string name="request_timeout">eskaeraren-denbora-muga</string>
-</resources>
--- a/res/values-fr/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"Content"</item>
- <item msgid="1601611480575517120">"Triste"</item>
- <item msgid="1531181614218625881">"Clin d\'œil"</item>
- <item msgid="3858808057949077894">"Tire la langue"</item>
- <item msgid="7835238297967185651">"Surpris"</item>
- <item msgid="1756223535005296033">"Bisou"</item>
- <item msgid="1093906245140165107">"Hurle"</item>
- <item msgid="888834839864150170">"Cool"</item>
- <item msgid="6320683740534773967">"Argent"</item>
- <item msgid="6610111212478853990">"Embarrassé"</item>
- <item msgid="1706035208563940251">"Gêné"</item>
- <item msgid="9079275787422313427">"Ange"</item>
- <item msgid="4630490399784004880">"Indécis"</item>
- <item msgid="7002574538342357456">"Pleure"</item>
- <item msgid="850324578089267455">"Motus"</item>
- <item msgid="6334637439528489607">"Rigole"</item>
- <item msgid="7602915122893958066">"Confus"</item>
- <item msgid="3939233701582771068">"Cœur"</item>
- <item msgid="1414759480575851587">"Mécontent"</item>
- <item msgid="8479809115158836070">"Sourire en coin"</item>
- <item msgid="638612939305162424">"Impassible"</item>
- </string-array>
-</resources>
--- a/res/values-fr/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,312 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- Generic terms -->
- <string name="app_name">Beem</string>
- <string name="OkButton">Valider</string>
- <string name="ClearButton">Effacer</string>
- <string name="CancelButton">Annuler</string>
- <string name="AcceptButton">Autoriser</string>
- <string name="RefuseButton">Refuser</string>
- <string name="JabberID">Jabber ID</string>
- <string name="Password">Mot de passe</string>
- <string name="Continue">Suivant</string>
-
- <!-- AccountConfigure class -->
- <string name="AccountConfigureManualConfiguration">Configuration manuelle</string>
-
- <!-- BeemService class -->
- <string name="BeemServiceDescription">Utilisation du service Beem</string>
-
- <!-- ContactDialog class -->
- <string name="CDChat">Chat</string>
- <string name="CDCall">Appeler</string>
- <string name="CDInfos">Gestion utilisateur</string>
-
- <!-- AddContact class -->
- <string name="AddCActTitle">Beem - Ajouter un contact</string>
-
- <string name="AddCLogin">Nom d\'utilisateur</string>
- <string name="AddCAlias">Alias</string>
- <string name="AddCGroup">Groupe</string>
- <string name="AddCOkButton">Ajouter</string>
- <string name="AddCContactAdded">Contact ajouté</string>
- <string name="AddCContactAddedError">Erreur Contact non ajouté</string>
- <string name="AddCContactAddedLoginError">Mauvais nom d\'utilisateur</string>
- <string name="AddCContactAlready">Contact déjà ajouté</string>
-
- <!-- ChangeStatus class -->
- <string name="ChangeStatusActTitle">Beem - Changer mon statut</string>
- <string name="ChangeStatusType">Mon statut</string>
- <string name="ChangeStatusMessage">Mon message de statut</string>
- <string name="OpenContactList">Ouvrir la liste des contacts</string>
-
- <string name="ChangeStatusOk">Mise à jour du statut</string>
- <string name="my_avatar">Mon avatar</string>
- <string name="select_avatar">Choisissez votre avatar</string>
- <string name="take_photo">Prendre une photo</string>
- <string name="pick_photo">Choisir une image</string>
- <string name="delete_avatar">Pas d\'avatar</string>
- <string name="photoPickerNotFoundText">Sélecteur d\'image non disponible</string>
-
- <!-- Settings class -->
- <string name="SettingsProxy">Proxy</string>
- <string name="SettingsProxyProxy">Utiliser un proxy</string>
- <string name="SettingsProxySummary">Connectez vous à travers un serveur proxy</string>
- <string name="SettingsProxyType">Protocole</string>
- <string name="SettingsProxyTypeSummary">Permet de choisir le type de proxy à utiliser</string>
- <string name="SettingsProxyServer">Saisissez l\'adresse du serveur proxy</string>
- <string name="SettingsProxyPort">Saisissez le numéro de port du serveur proxy</string>
- <string name="SettingsProxyUser">Optionnel, permet de s\'authentifier sur le proxy</string>
- <string name="SettingsProxyPassword">Optionnel, permet de s\'authentifier sur le proxy</string>
- <string name="SettingsAdvanced">Options avancées</string>
- <string name="SettingsAdvancedRecoDelay">Modifier le délai de reconnexion</string>
- <string name="SettingsAdvancedOptions">Options spécifiques</string>
- <string name="SettingsAdvancedSpecOpt">Cochez cette option pour utiliser un serveur spécifique </string>
- <string name="SettingsAdvancedAddOpt">Saisissez l\'adresse du serveur à joindre</string>
- <string name="SettingsAdvancedPortOpt">Saisissez le port du serveur</string>
- <string name="SettingsResourceTitle">Ressource</string>
- <string name="SettingsPriorityTitle">Priorité</string>
- <string name="SettingsResourceSummary">Saisissez la resource à partir de laquelle vous vous connectez</string>
- <string name="SettingsPrioritySummary">Saisissez la priorité de votre client</string>
- <string name="contact_list_preferences">Liste d\'ami(e)s</string>
- <string name="contact_list_preferences_sum">Une série d\'options d\'affichage de votre liste
- d\'ami(e)s</string>
- <string name="CLP_hide_groups">Cachez les groupes</string>
- <string name="CLP_hide_groups_sum">Cochez cette option pour cacher les groupes</string>
- <string name="CLP_show_jid">Affichez les JID</string>
- <string name="CLP_show_jid_sum">Cochez cette option pour afficher les JIDs des contacts</string>
- <string name="CLP_hidden_contact">Cachez les contacts déconnectés</string>
- <string name="CLP_hidden_contact_sum">Cochez cette option pour cacher les contacts déconnectés</string>
- <string name="settings_account_username">Nom d\'utilisateur (JID)</string>
- <string name="settings_account_password">Mot de passe</string>
- <string name="settings_account_server">Serveur</string>
- <string name="settings_account_port">Port</string>
- <string name="settings_advanced_service_behaviour">Comportement du service</string>
- <string name="settings_advanced_sum">Une série d\'options pour les utilisateurs avertis</string>
- <string name="settings_xmpp_server">Serveur</string>
- <string name="comments_xmpp_server">example.com</string>
- <string name="settings_xmpp_port">Port</string>
- <string name="comments_xmpp_port">Default: 5222</string>
- <string name="settings_xmpp_use_tls">SSL/TLS obligatoire</string>
- <string name="settings_reco_delay">Délai de reconnexion</string>
- <string name="settings_proxy_sum">Paramètrez un serveur proxy</string>
- <string name="settings_proxy_use">Utiliser un proxy</string>
- <string name="settings_proxy_type_prompt">Choisir un type de proxy</string>
- <string name="settings_proxy_server">Serveur</string>
- <string name="settings_proxy_port">Port</string>
- <string name="comments_proxy_port">Default: 1080</string>
- <string name="settings_proxy_username">Nom d\'utilisateur</string>
- <string name="settings_proxy_password">Mot de passe</string>
- <string name="away_chk_title">Activer l\'absence automatique</string>
- <string name="away_chk_sum">Change votre status en Absent automatiquement quand l\'écran du telephone s\'éteint</string>
- <string name="away_message_title">Message d\'absence</string>
- <string name="away_message_sum">Votre Message d\'absence</string>
- <string name="away_message_hint">Je suis absent car mon ecran est éteint</string>
- <string name="notification_preferences">Paramètres des notifications</string>
- <string name="notification_enable_vibrate_title">Activer le vibreur</string>
- <string name="notification_enable_vibrate_sum">Activer le vibreur pour les messages entrants</string>
- <string name="notification_snd_title">Sonnerie des messages</string>
- <string name="notification_snd_sum">Configurer la sonnerie des messages entrants</string>
- <string name="settings_chat_compact">Chat compact</string>
- <string name="settings_chat_compact_sum">Activer la fenetre Chat compact</string>
- <string name="history">Historique</string>
- <string name="history_sum">Cochez cette option pour enregistrer les discussions sur la SDCard</string>
- <string name="chat_preferences">Chat</string>
- <string name="chat_preferences_sum">Historique, taille de la fenêtre ...</string>
- <string name="chat_history_path">Répertoire d\'historique</string>
- <string name="chat_history_path_sum">Les conversations sont enregistrées dans un dossier sur la SDCard</string>
- <string name="settings_smack_debug">Activer le debugger XMPP</string>
- <string name="settings_full_jid_login">Utiliser le JID entier en tant que login</string>
- <string name="settings_full_jid_login_sum">Nécessaire pour certains serveurs (Google Talk)</string>
-
- <!-- Subscription class -->
- <string name="SubscriptAccept">Inscription acceptée</string>
- <string name="SubscriptError">Erreur d\'inscription</string>
- <string name="SubscriptRefused">Inscription refusée</string>
- <string name="SubscriptText">%s vient de vous ajouter à sa liste de contacts. Souhaitez-vous l\'autoriser ?</string>
- <string name="SubscriptTitle">Autoriser ce contact ?</string>
-
- <!-- BeemBroadcastReceiver class -->
- <string name="BeemBroadcastReceiverDisconnect">BEEM: Vous avez été déconnecté(e)</string>
-
- <!-- XmppConnectionAdapter class -->
- <string name="AcceptContactRequest">%s vient de vous ajouter à sa liste d\'amis.</string>
- <string name="AcceptContactRequestFrom">Autoriser %s à vous contacter.</string>
-
- <!--
- Services
- -->
-
- <!--
- Activities
- -->
- <string name="edit_settings_name">Beem - Paramètres</string>
- <string name="create_account_name">Beem - Créer un compte</string>
- <string name="contact_list_name">Beem - Contacts</string>
- <string name="user_info_name">Beem - Informations</string>
-
- <!--
- LogAs Activity
- -->
- <string name="login_menu_settings">Paramètres</string>
- <string name="login_menu_about">A propos</string>
- <string name="login_about_title">Beem %s - A propos</string>
- <string name="login_about_msg">
- Beem est un EPITECH Innovative Project. Rencontrez
- nous sur http://www.beem-project.com !
- </string>
- <string name="login_about_button">Fermer</string>
- <string name="login_login_progress">Connexion en cours. Veuillez patienter...</string>
- <string name="login_menu_login">Se connecter</string>
- <string name="login_start_msg">Configuration des informations dans le menu</string>
-
- <!-- LoginAnim activity -->
- <string name="loganim_connecting">Connexion en cours ...</string>
- <string name="loganim_authenticating">Authentification ...</string>
- <string name="loganim_login_success">Connexion effectuée</string>
- <string name="loganim_login_failed">Echec de la connextion</string>
-
- <!-- EditSettings Activity -->
- <string name="settings_menu_create_account">Créer un compte</string>
- <string name="settings_menu_privacy_lists">Gérer mes listes privées</string>
- <string name="settings_saved_ok">Les paramètres ont été enregistrés avec succès.</string>
-
- <!-- EditSettings Activity Categories -->
- <string name="general_preferences">Préférences de l\'application</string>
- <string name="user_preferences">Compte (obligatoire)</string>
- <string name="user_preferences_advanced">Utilisateur avancés (facultatif)</string>
- <string name="network_preferences">Options réseau</string>
- <string name="proxy_proxy_settings">Paramètres du proxy</string>
- <string name="proxy_user_settings">Identifiant proxy</string>
-
- <!-- EditSettings Activity tabs -->
- <string name="settings_tab_tag_account">edit_settings_tab_account</string>
- <string name="settings_tab_label_account">Compte</string>
- <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
- <string name="settings_tab_label_xmpp">XMPP</string>
- <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
- <string name="settings_tab_label_proxy">Proxy</string>
- <string name="history_preferences">Historique</string>
- <string name="chat_layout_option">Fenêtre de chat</string>
-
-
- <!-- wizard activities -->
- <string name="account_wizard_text1"><b>Bienvenue sur BEEM.</b>\n\nVous n\'avez pas encore configuré de compte XMPP (Jabber).\nChoisissez une des options suivantes :</string>
- <string name="account_wizard_configure_text_1">Utilisez un compte du terminal</string>
- <string name="account_wizard_configure_text_2"><b>ou</b></string>
- <string name="account_wizard_configure_text_3">Remplissez les informations de votre compte</string>
- <string name="account_wizard_settings_warn"><b>Attention : </b>Vos paramètres indique d\'utiliser un serveur proxy ou un serveur spécifique.</string>
- <string name="account_wizard_configure_account">Je possède déjà un compte que je veux utiliser.</string>
- <string name="account_wizard_create_account">Je veux créer un nouveau compte</string>
-
- <!--
- Create an account Activity
- -->
- <string name="create_account_text">Entrez les informations nécéssaires pour créer votre compte</string>
- <string name="create_account_progress_title">Création du compte</string>
- <string name="create_account_progress_message">Veuillez patientez</string>
- <string name="create_account_err_username">Mauvais JabberID</string>
- <string name="create_account_err_passwords">Les mots de passe ne correspondent pas</string>
- <string name="create_account_username">Nom d\'utilisateur</string>
- <string name="create_account_password">Mot de passe</string>
- <string name="create_account_confirm_password">Confirmation du mot de passe</string>
- <string name="create_account_err_conflict">Ce compte est déjà utilisé. Essayez d\'en créer un autre</string>
- <string name="create_account_err_connection">Le serveur choisi n\'est pas disponible. Essayez en un autre</string>
-
- <!--
- ContactList Activity
- -->
- <string name="contact_list_menu_add_contact">Ajouter un contact</string>
- <string name="contact_list_menu_status">Changer son status</string>
- <string name="contact_list_menu_settings">Paramètres</string>
- <string name="contact_list_menu_disconnect">Se déconnecter</string>
- <string name="contact_list_all_contact">Tous les contacts</string>
- <string name="contact_list_no_group">Aucun groupe</string>
-
-
- <!--
- UserInfo Activity
- -->
- <string name="userinfo_label_alias">Alias</string>
- <string name="userinfo_label_chg_group">Modifier groupe</string>
- <string name="userinfo_label_re_subscription">Renvoyer l\'invitation</string>
- <string name="userinfo_label_block">Bloquer</string>
- <string name="userinfo_label_delete">Supprimer</string>
- <string name="userinfo_resend">Souscription réenvoyée</string>
- <string name="userinfo_sure2delete">Etes-vous sûr de vouloir supprimer ce contact ?</string>
- <string name="userinfo_yes">Oui</string>
- <string name="userinfo_no">Non</string>
- <string name="userinfo_sureresend">Etes vous sûr de vouloir renvoyer l\'invitation ?</string>
-
- <string name="chat_input_default_value">Saisissez votre message</string>
- <string name="chat_name">Beem - Chat</string>
- <string name="chat_self">Moi</string>
- <string name="chat_error">Erreur</string>
- <string name="chat_send_message">Envoyer</string>
- <string name="chat_menu_contacts_list">Liste de contacts</string>
- <string name="chat_menu_change_chat">Changer de conversation</string>
- <string name="chat_dialog_change_chat_title">Conversations en cours</string>
- <string name="chat_menu_close_chat">Fermer cette conversation</string>
- <string name="chat_no_more_chats">Aucune conversation en cours</string>
- <string name="chat_state_composing">est en train d\'écrire un message</string>
- <string name="chat_state_gone">a quitté la conversation</string>
- <string name="chat_state_active">prête attention à la conversation</string>
- <string name="chat_state_inactive">fait quelque chose d\'autre</string>
-
- <string name="contact_status_msg_available">Disponible</string>
- <string name="contact_status_msg_available_chat">Disponible pour discuter</string>
- <string name="contact_status_msg_dnd">Occupé(e)</string>
- <string name="contact_status_msg_away">Absent(e)</string>
- <string name="contact_status_msg_xa">Indisponible</string>
- <string name="contact_status_msg_offline">Hors ligne</string>
-
- <string name="privacy_list_name">Beem - Gérer mes listes privées</string>
- <string name="privacy_list_no_data">Il n\'existe aucune liste privée enregistrée.</string>
- <string name="privacy_list_menu_create">Créer une liste privée</string>
- <string name="privacy_list_create_dialog_title">Créer une liste privée</string>
- <string name="privacy_list_create_dialog_list_name_label">Titre</string>
- <string name="privacy_list_create_dialog_create_button">Créer</string>
- <string name="privacy_list_select_dialog_buddies">Contacts</string>
- <string name="privacy_list_select_dialog_groups">Groupes</string>
- <string name="privacy_list_select_dialog_delete">Supprimer</string>
- <string name="privacy_list_delete_dialog_msg">Souhaitez-vous vraiment supprimer la liste privée intitulée \'%s\' ?</string>
- <string name="privacy_list_delete_dialog_yes">Oui</string>
- <string name="privacy_list_delete_dialog_no">Non</string>
-
- <string name="UpdateButton">Mettre à jour</string>
-
- <!-- MemorizingTrustManager library -->
- <string name="mtm_accept_cert">Accepter un certificat de sécurité invalide ?</string>
- <string name="mtm_decision_always">Toujours</string>
- <string name="mtm_decision_once">Une fois</string>
- <string name="mtm_decision_abort">Annuler</string>
-
- <string name="mtm_notification">Certificate Verification</string>
-
- <!-- Error messages -->
- <string name="error_login_authentication">Erreur lors de l\'authenfitication, mauvais login ou password</string>
- <string name="interna_server_error">Erreur survenu sur le serveur</string>
- <string name="bad_request">bad-request</string>
- <string name="forbidden">forbidden</string>
- <string name="item_not_found">item-not-found</string>
- <string name="conflict">conflict</string>
- <string name="feature_not_implemented">feature-not-implemented</string>
- <string name="gone">gone</string>
- <string name="jid_malformed">jid-malformed</string>
- <string name="no_acceptable">no-acceptable</string>
- <string name="not_allowed">not-allowed</string>
- <string name="not_authorized">not-authorized</string>
- <string name="payment_required">payment-required</string>
- <string name="recipient_unavailable">recipient-unavailable</string>
- <string name="redirect">redirect</string>
- <string name="registration_required">registration-required</string>
- <string name="remote_server_not_found">Serveur non trouvé</string>
- <string name="remote_server_timeout">Pas de réponse du serveur</string>
- <string name="remote_server_error">Erreur survenu sur le serveur</string>
- <string name="resource_constraint">resource-constraint</string>
- <string name="service_unavailable">service-unavailable</string>
- <string name="subscription_required">subscription-required</string>
- <string name="undefined_condition">undefined-condition</string>
- <string name="unexpected_condition">unexpected-condition</string>
- <string name="request_timeout">request-timeout</string>
-</resources>
--- a/res/values-it/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"Felice"</item>
- <item msgid="1601611480575517120">"Triste"</item>
- <item msgid="1531181614218625881">"Occhiolino"</item>
- <item msgid="3858808057949077894">"Linguaccia"</item>
- <item msgid="7835238297967185651">"Sorpreso"</item>
- <item msgid="1756223535005296033">"Bacio"</item>
- <item msgid="1093906245140165107">"Urlo"</item>
- <item msgid="888834839864150170">"Fico"</item>
- <item msgid="6320683740534773967">"Fatti, non parole"</item>
- <item msgid="6610111212478853990">"Gaffe"</item>
- <item msgid="1706035208563940251">"Imbarazzato"</item>
- <item msgid="9079275787422313427">"Angelo"</item>
- <item msgid="4630490399784004880">"Indeciso"</item>
- <item msgid="7002574538342357456">"Piango"</item>
- <item msgid="850324578089267455">"Labbra cucite"</item>
- <item msgid="6334637439528489607">"Risata"</item>
- <item msgid="7602915122893958066">"Confuso"</item>
- <item msgid="3939233701582771068">"Cuore"</item>
- <item msgid="1414759480575851587">"Arrabbiato"</item>
- <item msgid="8479809115158836070">"Ghigno"</item>
- <item msgid="638612939305162424">"Impassibile"</item>
- </string-array>
-</resources>
--- a/res/values-it/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- Generic terms -->
- <string name="app_name">Beem</string>
- <string name="OkButton">Ok</string>
- <string name="ClearButton">Pulisci</string>
- <string name="CancelButton">Annulla</string>
- <string name="AcceptButton">Autorizza</string>
- <string name="RefuseButton">Proibisci</string>
- <string name="JabberID">Jabber ID</string>
- <string name="Password">Password</string>
- <string name="Continue">Continua</string>
-
- <!-- AccountConfigure class -->
- <string name="AccountConfigureManualConfiguration">Configurazione Manuale</string>
-
- <!-- Beem class -->
- <string name="BeemJabberID">Jabber ID</string>
-
- <!-- BeemApplication class -->
- <string name="BeemApplicationConnect">Connessione...</string>
-
- <!-- BeemService class -->
- <string name="BeemServiceDescription">Usa il sservizio Beem</string>
- <string name="BeemServiceCreated">Create il servizio Bemm</string>
- <string name="BeemServiceDestroyed">Rimosso il servizio Beem</string>
-
- <!-- ContactDialog class -->
- <string name="CDChat">Chat</string>
- <string name="CDCall">Chiamate</string>
- <string name="CDInfos">Gestisci Utente</string>
-
- <!-- AddContact class -->
- <string name="AddCActTitle">Beem - Aggiungi un contatto</string>
-
- <string name="AddCLogin">Username</string>
- <string name="AddCAlias">Alias</string>
- <string name="AddCGroup">Gruppo</string>
- <string name="AddCOkButton">Aggiungi</string>
- <string name="AddCContactAdded">Aggiunto contatto</string>
- <string name="AddCContactAddedError">Errore Contatto non aggiunto</string>
- <string name="AddCContactAddedLoginError">Errore di accesso</string>
- <string name="AddCBadForm">Forma errata</string>
- <string name="AddCContactAlready">Contatto già esistente</string>
-
- <!-- ChangeStatus class -->
- <string name="ChangeStatusActTitle">Beem - Cambia il mio stato</string>
- <string name="ChangeStatusType">Il mio stato</string>
- <string name="ChangeStatusMessage">Messaggio personale</string>
- <string name="OpenContactList">Apri lista contatti</string>
-
- <string name="MenuAddContact">Aggiungi un nuovo cotatto</string>
- <string name="MenuAccountAbout">Progetto Beem</string>
- <string name="MenuAccountCreate">Crea un account</string>
- <string name="MenuConnection">Modifica account</string>
- <string name="ChangeStatusOk">Aggiornamento stato</string>
- <string name="ChangeStatusNoChange">Nessun cambiamento</string>
-
- <!-- Settings class -->
- <string name="SettingsText">Modifica il tuo username</string>
- <string name="SettingsPassword">Modifica la tua password</string>
- <string name="SettingsProxy">Proxy</string>
- <string name="SettingsProxyProxy">Usa un server proxy</string>
- <string name="SettingsProxySummary">Accedi attraverso un server proxy</string>
- <string name="SettingsProxyType">Protocollo</string>
- <string name="SettingsProxyTypeSummary">Scegli il tipo del server proxy</string>
- <string name="SettingsProxyServer">Modifica l\'indirizzo del server proxy</string>
- <string name="SettingsProxyPort">Modifica la porta del server proxy</string>
- <string name="SettingsProxyUser">Opzionale, permetti l\'autenticazione di te stesso sul server proxy</string>
- <string name="SettingsProxyPassword">Opzionale, permetti l\'autenticazione di te stesso sul server proxy</string>
- <string name="SettingsAdvanced">Avanzate</string>
- <string name="SettingsAdvancedOptions">Opzioni specifiche del server</string>
- <string name="SettingsAdvancedRecoDelay">Modifica ritardo di ri-connessione</string>
- <string name="SettingsAdvancedSpecOpt">Abilita se vuoi usare un server specifico per la tua connessione</string>
- <string name="SettingsAdvancedAddOpt">Modifica l\'indirizzo del server</string>
- <string name="SettingsAdvancedPortOpt">Modifica la porta del server</string>
- <string name="SettingsResourceTitle">Risorsa</string>
- <string name="SettingsPriorityTitle">Priorità</string>
- <string name="SettingsResourceSummary">Imposta la risorsa XMPP del tuo client </string>
- <string name="SettingsPrioritySummary">Imposta la priorità del tuo client</string>
- <string name="contact_list_preferences">Lista amici</string>
- <string name="contact_list_preferences_sum">Un insieme di opzioni di visualizzazione per la tua lista amizie
- </string>
- <string name="CLP_hide_groups">Nascondi gruppi</string>
- <string name="CLP_hide_groups_sum">Abilita quest\'opzione per nascondere i gruppi</string>
- <string name="CLP_hidden_contact">Nascondi le amizie</string>
- <string name="CLP_hidden_contact_sum">Abilita quest\'opzione per nascondere gli amici non connessi
- </string>
- <string name="settings_account_username">Username</string>
- <string name="login_username_info_default">beem@beem-project.com</string>
- <string name="settings_account_password">Password</string>
- <string name="settings_account_server">Server</string>
- <string name="settings_account_port">Porta</string>
- <string name="settings_advanced_service_behaviour">Funzionamento del servizio</string>
- <string name="settings_advanced_sum">Un insieme di opzioni per gli utenti avanzati</string>
- <string name="settings_xmpp_server">Indirizzo</string>
- <string name="comments_xmpp_server">example.com</string>
- <string name="settings_xmpp_port">Porta</string>
- <string name="settings_xmpp_use_tls">Usa SSL/TLS</string>
- <string name="settings_reco_delay">Ritardo di ri-connessione</string>
- <string name="comments_xmpp_port">Predefinita: 5222</string>
- <string name="settings_proxy_sum">Impostazioni per l\'utilizzo del proxy</string>
- <string name="settings_proxy_use">Connetti utilizzando un proxy</string>
- <string name="settings_proxy_type_prompt">Scegli un tipo di proxy</string>
- <string name="settings_proxy_server">Server</string>
- <string name="settings_proxy_port">Porta</string>
- <string name="comments_proxy_port">Predefinita: 1080</string>
- <string name="settings_proxy_username">Username</string>
- <string name="settings_proxy_password">Password</string>
- <string name="away_chk_title">Abilita Auto-away</string>
- <string name="away_chk_sum">Cambia lo stato ad Away quando lo schermo è spento</string>
- <string name="away_message_title">Messaggio Away</string>
- <string name="away_message_sum">Il messaggio Away che verrà mostrato</string>
- <string name="away_message_hint">Non sono disponibile, il mio schermo è spento</string>
- <string name="notification_preferences">Impostazioni di notifica</string>
- <string name="notification_enable_vibrate_title">Abilita vibrazione</string>
- <string name="notification_enable_vibrate_sum">Abilita vibrazione per i messaggi in arrivo</string>
- <string name="notification_snd_title">Suoneria messaggi</string>
- <string name="notification_snd_sum">Imposta la suoneria per i messaggi in arrivo</string>
-
-
- <!-- Subscription class -->
- <string name="SubscriptAccept">Sottoscrizione accettata</string>
- <string name="SubscriptError">Errore nella sottoscrizione</string>
- <string name="SubscriptRefused">Sottoscrizione refiutata</string>
- <string name="SubscriptText">%s desidera aggiungerti nella sua lista di amicizie. Vuoi autorizzarlo/a?</string>
- <string name="SubscriptTitle">Autorizza amicizia ?</string>
-
- <!-- BeemChatManager -->
- <string name="BeemChatManagerNewMessage">Hai un nuovo messaggio</string>
-
- <!-- BeemBroadcastReceiver class -->
- <string name="BeemBroadcastReceiverDisconnect">BEEM: sei stato disconnesso</string>
-
- <!-- XmppConnectionAdapter class -->
- <string name="AcceptContactRequest">%s ti ha appena aggiunto alla sue lista di amicizie.</string>
- <string name="AcceptContactRequestFrom">Autorizza %s a contattarti.</string>
-
- <!-- Activities -->
- <string name="login_tag">Beem - Login Activity</string>
- <string name="edit_settings_name">Beem - Settings</string>
- <string name="edit_settings_tag">Beem - EditSettings Activity</string>
- <string name="create_account_name">Beem - Create an account</string>
- <string name="create_account_tag">Beem - CreateAccount Activity</string>
- <string name="contact_list_name">Beem - Contacts</string>
- <string name="contact_list_tag">Beem - ContactList Activity</string>
- <string name="user_info_name">Beem - User Info</string>
-
- <!-- Buttons -->
- <string name="button_create_account">Crea questo account</string>
- <string name="button_create_login_account">Crea ed usa questo account</string>
-
- <!-- LogAs Activity -->
- <string name="login_username">Username</string>
- <string name="login_password">Password</string>
- <string name="login_error_dialog_title">Accesso - Errore</string>
- <string name="login_close_dialog_button">Chiudi</string>
- <string name="login_menu_create_account">Crea un account</string>
- <string name="login_menu_settings">Impostazioni</string>
- <string name="login_menu_about">Informazioni su</string>
- <string name="login_about_title">Beem %s - Informazioni</string>
- <string name="login_about_msg">
- Beem è un progetto innovativo EPITECH. Visitaci su
- http://www.beem-project.com !
- </string>
- <string name="login_about_button">Chiudi</string>
- <string name="login_settings_button">Impostazioni</string>
- <string name="login_login_button">Accedi</string>
- <string name="login_login_progress">Connessione in corso. Attendere...</string>
- <string name="login_error_msg">Purtroppo, si è verificato un errore.\n\nDettagli
- errore:\n%s</string>
- <string name="login_menu_login">Accedi</string>
- <string name="login_no_connectivity">Non è stata trovata la connessione internet</string>
- <string name="login_start_msg">Impostazioni di configurazione nel menuSettings configuration in menu</string>
-
- <!-- LoginAnim activity -->
- <string name="loganim_connecting">Connessione in corso ...</string>
- <string name="loganim_authenticating">Autenticazione ...</string>
- <string name="loganim_login_success">Accesso riuscito</string>
- <string name="loganim_login_failed">Accesso fallito</string>
-
- <!-- EditSettings Activity -->
- <string name="settings_menu_create_account">Crea un account</string>
- <string name="settings_menu_privacy_lists">Gestisci le mie liste di privacy</string>
- <string name="settings_saved_ok">Le impostazioni sono state salvate con successo.</string>
-
-
-
- <!-- EditSettings Activity Categories -->
- <string name="general_preferences">Preferenze generali</string>
- <string name="user_preferences">Impostazioni utente (richiste)</string>
- <string name="user_preferences_advanced">Impostazioni utente avanzate (opzionali)</string>
- <string name="network_preferences">Opzioni rete</string>
- <string name="proxy_proxy_settings">Impostazioni Proxy</string>
- <string name="proxy_user_settings">Impostazioni Proxy</string>
-
- <!-- EditSettings Activity Tabs -->
- <string name="settings_tab_tag_account">edit_settings_tab_account</string>
- <string name="settings_tab_label_account">Account</string>
- <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
- <string name="settings_tab_label_xmpp">XMPP</string>
- <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
- <string name="settings_tab_label_proxy">Proxy</string>
-
-
- <!-- wizard activities -->
- <string name="account_wizard_text1"><b>Benvenuto su BEEM.</b>\n\nNon hai ancora configurato un account XMPP (Jabber).\nScegli una delle seguenti opzioni :</string>
- <string name="account_wizard_configure_text"><b>Si prega di compilare i dati per il vostro account esistente</b></string>
- <string name="account_wizard_configure_account">Possiedo già un account che voglio</string>
- <string name="account_wizard_create_account">Voglio registrare un nuovo account</string>
-
- <!-- Create an account Activity -->
- <string name="create_account_instr_dialog_title">Crea un account - Istruzioni</string>
- <string name="create_account_err_dialog_title">Crea un account - Errore</string>
- <string name="create_account_err_dialog_settings_button">Cambia le mie impostazioni</string>
- <string name="create_account_close_dialog_button">Chiudi</string>
- <string name="create_account_successfull_after">account %s è stato creato con successo</string>
- <string name="create_account_err_username">Errato JabberID</string>
- <string name="create_account_err_passwords">Le password non coincidono.</string>
- <string name="create_account_username">Username</string>
- <string name="create_account_password">Password</string>
- <string name="create_account_confirm_password">Conferma password</string>
-
- <!-- ContactList Activity -->
- <string name="contact_list_menu_add_contact">Aggiungi un contatto</string>
- <string name="contact_list_menu_status">Cambia stato</string>
- <string name="contact_list_menu_settings">Impsotazioni</string>
- <string name="contact_list_menu_disconnect">Disconnetti</string>
- <string name="contact_list_all_contact">Tutti i contatti</string>
- <string name="contact_list_no_group">Nessun gruppo</string>
-
- <!-- UserInfo dialog -->
- <string name="userinfo_label_alias">Alias</string>
- <string name="userinfo_label_chg_group">Gestisci gruppi</string>
- <string name="userinfo_label_re_subscription">Rimanda invito</string>
- <string name="userinfo_label_block">Blocco</string>
- <string name="userinfo_label_delete">Elimina</string>
- <string name="userinfo_resend">Rimanda sottoscrizione</string>
- <string name="userinfo_sure2delete">Sei sicuro di voler eliminare questo contatto?
- </string>
- <string name="userinfo_yes">Sì</string>
- <string name="userinfo_no">No</string>
- <string name="userinfo_sureresend">Sei sicuro di voler rispedire l\'invito ?</string>
-
- <string name="chat_name">Beem - Chat</string>
- <string name="chat_input_default_value">Scrivi il tuo messaggio</string>
- <string name="chat_self">Io</string>
- <string name="chat_error">Errore</string>
- <string name="chat_send_message">Invia</string>
- <string name="chat_menu_contacts_list">Lista contatti</string>
- <string name="chat_menu_change_chat">Cambia conversazione</string>
- <string name="chat_dialog_change_chat_title">Conversazioni aperte</string>
- <string name="chat_menu_close_chat">Chiudi questa conversazione</string>
- <string name="chat_no_more_chats">nessuna conversazione attiva</string>
- <string name="chat_state_composing">sta componendo un messaggio</string>
- <string name="chat_state_gone">ha abbandonato la conversazione</string>
- <string name="chat_state_active">presta attenzione alla conversazione</string>
- <string name="chat_state_inactive">sta facendo qualcos\'altro</string>
-
- <string name="contact_status_msg_available">Disponibile</string>
- <string name="contact_status_msg_available_chat">Disponibile a conversare</string>
- <string name="contact_status_msg_dnd">Non disturbare</string>
- <string name="contact_status_msg_away">Away</string>
- <string name="contact_status_msg_xa">Non disponibile</string>
- <string name="contact_status_msg_offline">Disconnesso</string>
-
- <string name="privacy_list_name">Beem - Gestisci le mie liste di privacy</string>
- <string name="privacy_list_no_data">Non c\'è alcuna lista di provacy registrata.</string>
- <string name="privacy_list_menu_create">Crea una lista di privacy</string>
- <string name="privacy_list_create_dialog_title">Crea una lista di privacy</string>
- <string name="privacy_list_create_dialog_list_name_label">Titolo</string>
- <string name="privacy_list_create_dialog_create_button">Creare</string>
- <string name="privacy_list_select_dialog_buddies">Amicizie</string>
- <string name="privacy_list_select_dialog_groups">Gruppi</string>
- <string name="privacy_list_select_dialog_delete">Elimina</string>
- <string name="privacy_list_delete_dialog_msg">Sei sicuro di voler eliminare la lista di privacy intitolata \'%s\' ?</string>
- <string name="privacy_list_delete_dialog_yes">Sì</string>
- <string name="privacy_list_delete_dialog_no">No</string>
-
- <string name="UpdateButton">Aggiorna</string>
-
- <!-- Error messages -->
-
- <string name="error_login_authentication">Errore durante l\'autenticazione, login o password errati.</string>
-
- <string name="interna_server_error">Errore del server remoto</string>
- <string name="bad_request">bad-request</string>
- <string name="forbidden">forbidden</string>
- <string name="item_not_found">item-not-found</string>
- <string name="conflict">conflict</string>
- <string name="feature_not_implemented">feature-not-implemented</string>
- <string name="gone">gone</string>
- <string name="jid_malformed">jid-malformed</string>
- <string name="no_acceptable">no-acceptable</string>
- <string name="not_allowed">not-allowed</string>
- <string name="not_authorized">not-authorized</string>
- <string name="payment_required">payment-required</string>
- <string name="recipient_unavailable">recipient-unavailable</string>
- <string name="redirect">redirect</string>
- <string name="registration_required">registration-required</string>
- <string name="remote_server_not_found">Remote server not found</string>
- <string name="remote_server_timeout">No server response</string>
- <string name="remote_server_error">Remote server error</string>
- <string name="resource_constraint">resource-constraint</string>
- <string name="service_unavailable">service-unavailable</string>
- <string name="subscription_required">subscription-required</string>
- <string name="undefined_condition">undefined-condition</string>
- <string name="unexpected_condition">unexpected-condition</string>
- <string name="request_timeout">request-timeout</string>
-</resources>
--- a/res/values-nb/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"Glad"</item>
- <item msgid="1601611480575517120">"Trist"</item>
- <item msgid="1531181614218625881">"Blunker"</item>
- <item msgid="3858808057949077894">"Rekker tunge"</item>
- <item msgid="7835238297967185651">"Overrasket"</item>
- <item msgid="1756223535005296033">"Kyss"</item>
- <item msgid="1093906245140165107">"Roper"</item>
- <item msgid="888834839864150170">"Kul"</item>
- <item msgid="6320683740534773967">"Pengemunn"</item>
- <item msgid="6610111212478853990">"Fot i munnen"</item>
- <item msgid="1706035208563940251">"Flau"</item>
- <item msgid="9079275787422313427">"Engel"</item>
- <item msgid="4630490399784004880">"Usikker"</item>
- <item msgid="7002574538342357456">"Gråter"</item>
- <item msgid="850324578089267455">"Stille som graven"</item>
- <item msgid="6334637439528489607">"Ler"</item>
- <item msgid="7602915122893958066">"Forvirret"</item>
- <item msgid="3939233701582771068">"Hjerte"</item>
- <item msgid="1414759480575851587">"Sint"</item>
- <item msgid="8479809115158836070">"Glis"</item>
- <item msgid="638612939305162424">"Pokerfjes"</item>
- </string-array>
-</resources>
--- a/res/values-nb/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-<!-- Generic terms -->
-<string name="app_name">Beem</string>
-<string name="OkButton">Ok</string>
-<string name="ClearButton">Tøm</string>
-<string name="CancelButton">Avbryt</string>
-<string name="AcceptButton">Godkjenn</string>
-<string name="RefuseButton">Avslå</string>
-<string name="JabberID">Jabber-ID</string>
-<string name="Password">Passord</string>
-<string name="Continue">Fortsett</string>
-
-<!-- AccountConfigure class -->
-<string name="AccountConfigureManualConfiguration">Manuelt oppsett</string>
-
-<!-- Beem class -->
-<string name="BeemJabberID">Jabber-ID</string>
-
-<!-- BeemApplication class -->
-<string name="BeemApplicationConnect">Kobler til ...</string>
-
-<!-- BeemService class -->
-<string name="BeemServiceDescription">Bruk Beem tjeneste </string>
-<string name="BeemServiceCreated">Beem tjeneste opprettet</string>
-<string name="BeemServiceDestroyed">Beem tjeneste slettet</string>
-
-<!-- ContactDialog class -->
-<string name="CDChat">Prat</string>
-<string name="CDCall">Ring</string>
-<string name="CDInfos">Behandle kontakt</string>
-
-<!-- AddContact class -->
-<string name="AddCActTitle">Beem - legg til en kontakt</string>
-
-<string name="AddCLogin">Brukernavn</string>
-<string name="AddCAlias">Alias</string>
-<string name="AddCGroup">Gruppe</string>
-<string name="AddCOkButton">Legg til</string>
-<string name="AddCContactAdded">Kontakt lagt til</string>
-<string name="AddCContactAddedError">Feil ved lagring av kontakt</string>
-<string name="AddCContactAddedLoginError">Feil ved innlogging</string>
-<string name="AddCBadForm">Feil utfylt</string>
-<string name="AddCContactAlready">Kontakten finnes allerede</string>
-
-<!-- ChangeStatus class -->
-<string name="ChangeStatusActTitle">Beem - Endre status</string>
-<string name="ChangeStatusType">Min status</string>
-<string name="ChangeStatusMessage">Min personlige melding</string>
-<string name="OpenContactList">Åpne kontaktlista</string>
-
-<string name="MenuAddContact">Legg til ny kontakt</string>
-<string name="MenuAccountAbout">Beem-prosjektet</string>
-<string name="MenuAccountCreate">Opprett konto</string>
-<string name="MenuConnection">Rediger konto</string>
-<string name="ChangeStatusOk">Oppdaterer status</string>
-<string name="ChangeStatusNoChange">Ingen endringer</string>
-<string name="my_avatar">Mitt personbilde</string>
-<string name="select_avatar">Velg ditt personbilde</string>
-<string name="take_photo">Ta et bilde</string>
-<string name="pick_photo">Velg et bilde</string>
-<string name="delete_avatar">Ingen personbilde</string>
-<string name="photoPickerNotFoundText">Bildevelger ikke funnet</string>
-
-
-<!-- Settings class -->
-<string name="SettingsText">Rediger brukernavn</string>
-<string name="SettingsPassword">Rediger passord</string>
-<string name="SettingsProxy">Mellomtjener</string>
-<string name="SettingsProxyProxy">Bruk en mellomtjener</string>
-<string name="SettingsProxySummary">Logg inn via en mellomtjener</string>
-<string name="SettingsProxyType">Protokoll</string>
-<string name="SettingsProxyTypeSummary">Velg mellomtjenertype</string>
-<string name="SettingsProxyServer">Rediger mellomtjeneradresse</string>
-<string name="SettingsProxyPort">Rediger mellomtjenerport</string>
-<string name="SettingsProxyUser">Valgfritt, tillat autentisering på mellomtjeneren</string>
-<string name="SettingsProxyPassword">Valgfritt, tillat autentisering på mellomtjeneren</string>
-<string name="SettingsAdvanced">Avansert</string>
-<string name="SettingsAdvancedOptions">Spesielle tjenerinnstilling</string>
-<string name="SettingsAdvancedRecoDelay">Endre forsinkelse ved ny tilkobling</string>
-<string name="SettingsAdvancedSpecOpt">Aktiver hvis du vil bruke en spesifikk tjener for din tilkobling</string>
-<string name="SettingsAdvancedAddOpt">Rediger tjeneradresse</string>
-<string name="SettingsAdvancedPortOpt">Rediger tjenerport</string>
-<string name="SettingsResourceTitle">Ressurs</string>
-<string name="SettingsPriorityTitle">Prioritet</string>
-<string name="SettingsResourceSummary">Velg XMPP ressurs for denne klienten</string>
-<string name="SettingsPrioritySummary">Velg prioritet for denne klienten</string>
-<string name="contact_list_preferences">Kontaktliste</string>
-<string name="contact_list_preferences_sum">A set of display options for your buddy list
-</string>
-<string name="CLP_hide_groups">Skjul grupper</string>
-<string name="CLP_hide_groups_sum">Aktiver for å skjule grupper</string>
-<string name="CLP_hidden_contact">Skjul kontakter</string>
-<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
-</string>
-<string name="settings_account_username">Brukernavn (JID)</string>
-<string name="login_username_info_default">beem@beem-project.com</string>
-<string name="settings_account_password">Passord</string>
-<string name="settings_account_server">Tjener</string>
-<string name="settings_account_port">Port</string>
-<string name="settings_advanced_service_behaviour">Tjenesteoppførsel</string>
-<string name="settings_advanced_sum">Innstillinger for avanserte brukere</string>
-<string name="settings_xmpp_server">Adresse</string>
-<string name="comments_xmpp_server">example.com</string>
-<string name="settings_xmpp_port">Port</string>
-<string name="settings_xmpp_use_tls">Krev SSL/TLS</string>
-<string name="settings_reco_delay">Forsinkelse ved ny tilkobling</string>
-<string name="comments_xmpp_port">Standard: 5222</string>
-<string name="settings_proxy_sum">Innstillinger for bruk av mellomtjener</string>
-<string name="settings_proxy_use">Koble til via en mellomtjener</string>
-<string name="settings_proxy_type_prompt">Velg mellomtjenertype</string>
-<string name="settings_proxy_server">Tjener</string>
-<string name="settings_proxy_port">Port</string>
-<string name="comments_proxy_port">Standard: 1080</string>
-<string name="settings_proxy_username">Brukernavn</string>
-<string name="settings_proxy_password">Passord</string>
-<string name="away_chk_title">Bruk auto-borte</string>
-<string name="away_chk_sum">Endre status til borte når skjermen er av</string>
-<string name="away_message_title">Borte-melding</string>
-<string name="away_message_sum">Borte-melding som vil bli vist</string>
-<string name="away_message_hint">Jeg er borte, telefonens skjerm er av</string>
-<string name="notification_preferences">Varslingsinnstillinger</string>
-<string name="notification_enable_vibrate_title">Bruk vibrasjon</string>
-<string name="notification_enable_vibrate_sum">Bruk vibrasjon ved innkommende meldinger</string>
-<string name="notification_snd_title">Meldingsringetone</string>
-<string name="notification_snd_sum">Velg ringetone for innkommende meldinger</string>
-<string name="settings_chat_compact">Kompakt pratevindu</string>
-<string name="settings_chat_compact_sum">Velg kompakt pratevindu</string>
-<string name="history">Historikk</string>
-<string name="history_sum">Aktiver for å lagre meldinger på minnekortet</string>
-<string name="history_mount">Du trenger et montert og skrivebart minnekort for å kunne aktivere historikk</string>
-<string name="history_on_off">Aktiver historikk</string>
-<string name="chat_preferences">Prat</string>
-<string name="chat_preferences_sum">Historikk, utseende ...</string>
-<string name="chat_history_path">Sti til historikk</string>
-<string name="chat_history_path_sum">Samtaler lagres i en mappe på minnekortet</string>
-<string name="settings_smack_debug">Aktiver XMPP feilsøking</string>
-<string name="settings_full_jid_login">Bruk full JID som brukernavn</string>
-<string name="settings_full_jid_login_sum">Kreves på visse tjenere slik som Google Talk</string>
-
-<!-- Subscription class -->
-<string name="SubscriptAccept">Abonnement godkjent</string>
-<string name="SubscriptError">Feil ved abonnement</string>
-<string name="SubscriptRefused">Abonnement avslått</string>
-<string name="SubscriptText">%s ønsker å legge deg til sin kontaktliste. Godkjenne forespørselen?</string>
-<string name="SubscriptTitle">Godkjenne kontakt?</string>
-
-<!-- BeemChatManager -->
-<string name="BeemChatManagerNewMessage">Du har en ny melding</string>
-
-<!-- BeemBroadcastReceiver class -->
-<string name="BeemBroadcastReceiverDisconnect">BEEM: du har koblet fra</string>
-
-<!-- XmppConnectionAdapter class -->
-<string name="AcceptContactRequest">%s har lagt deg til sin kontaktliste</string>
-<string name="AcceptContactRequestFrom">Godkjenn at %s kontakter deg</string>
-
-<!-- Activities -->
-<string name="login_tag">Beem - Aktivitet innlogging</string>
-<string name="edit_settings_name">Beem - Innstillinger</string>
-<string name="edit_settings_tag">Beem - Aktivitet innstillinger</string>
-<string name="create_account_name">Beem - Opprett konto</string>
-<string name="create_account_tag">Beem - Aktivitet opprett konto</string>
-<string name="contact_list_name">Beem - Kontakter</string>
-<string name="contact_list_tag">Beem - Aktivitet kontaktliste</string>
-<string name="user_info_name">Beem - Brukerinformasjon</string>
-
-<!-- Buttons -->
-<string name="button_create_account">Opprett kontoen</string>
-<string name="button_create_login_account">Opprett og bruk kontoen</string>
-
-<!-- LogAs Activity -->
-<string name="login_username">Brukernavn</string>
-<string name="login_password">Passord</string>
-<string name="login_error_dialog_title">Feil ved innlogging</string>
-<string name="login_close_dialog_button">Lukk</string>
-<string name="login_menu_create_account">Opprett konto</string>
-<string name="login_menu_settings">Innstillinger</string>
-<string name="login_menu_about">Om</string>
-<string name="login_about_title">Beem %s - Om</string>
-<string name="login_about_msg">
-Beem is an EPITECH Innovative Project. Visit us at
-http://www.beem-project.com !
-</string>
-<string name="login_about_button">Lukk</string>
-<string name="login_settings_button">Innstillinger</string>
-<string name="login_login_button">Logg inn</string>
-<string name="login_login_progress">Kobler til ...</string>
-<string name="login_error_msg">Unfortunately, an error occured.\n\nError
-detail:\n%s</string>
-<string name="login_menu_login">Innlogging</string>
-<string name="login_no_connectivity">Ingen nettforbindelse funnet</string>
-<string name="login_start_msg">Innstillinger i menyen</string>
-
-<!-- LoginAnim activity -->
-<string name="loganim_connecting">Kobler til ...</string>
-<string name="loganim_authenticating">Autentiserer ...</string>
-<string name="loganim_login_success">Innlogging vellykket</string>
-<string name="loganim_login_failed">Feil ved innlogging</string>
-
-<!-- EditSettings Activity -->
-<string name="settings_menu_create_account">Opprett en konto</string>
-<string name="settings_menu_privacy_lists">Behandle personvernlister</string>
-<string name="settings_saved_ok">Innstillinger lagret</string>
-
-
-
-<!-- EditSettings Activity Categories -->
-<string name="general_preferences">Generelle innstillinger</string>
-<string name="user_preferences">Brukerinnstillinger (kreves)</string>
-<string name="user_preferences_advanced">Avanserte brukerinnstillinger (valgfritt)</string>
-<string name="network_preferences">Nettverksinnstillinger</string>
-<string name="proxy_proxy_settings">Tjenerinnstillinger</string>
-<string name="proxy_user_settings">Tjenerinnstillinger</string>
-<string name="history_preferences">Historikk</string>
-<string name="chat_layout_option">Utseende</string>
-
-
-<!-- EditSettings Activity Tabs -->
-<string name="settings_tab_tag_account">edit_settings_tab_account</string>
-<string name="settings_tab_label_account">Konto</string>
-<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
-<string name="settings_tab_label_xmpp">XMPP</string>
-<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
-<string name="settings_tab_label_proxy">Tjener</string>
-
-
-<!-- wizard activities -->
-<string name="account_wizard_text1"><b>Velkomment til BEEM.</b>nnDu har ikke satt opp en XMPP (Jabber) konto.nVelg et av følgende alternativ :</string>
-<string name="account_wizard_configure_text"><b>Fyll inn informasjon for din eksisterende konto</b></string>
-<string name="account_wizard_configure_account">Jeg har en konto som jeg ønsker å bruke</string>
-<string name="account_wizard_create_account">Jeg ønsker å registrer en ny konto</string>
-
-<!-- Create an account Activity -->
-<string name="create_account_instr_dialog_title">Opprett en konto - Veiledning</string>
-<string name="create_account_err_dialog_title">Opprett en konto - Feil</string>
-<string name="create_account_err_dialog_settings_button">Endre innstillinger</string>
-<string name="create_account_close_dialog_button">Lukk</string>
-<string name="create_account_successfull_after">Konto %s opprettet</string>
-<string name="create_account_err_username">Ugyldig JabberID</string>
-<string name="create_account_err_passwords">Passordene er ikke like</string>
-<string name="create_account_username">Brukernavn</string>
-<string name="create_account_password">Passord</string>
-<string name="create_account_confirm_password">Bekreft passord</string>
-
-<!-- ContactList Activity -->
-<string name="contact_list_menu_add_contact">Legg til kontakt</string>
-<string name="contact_list_menu_status">Endre status</string>
-<string name="contact_list_menu_settings">Innstillinger</string>
-<string name="contact_list_menu_disconnect">Koble fra</string>
-<string name="contact_list_all_contact">Alle kontakter</string>
-<string name="contact_list_no_group">Ingen gruppe</string>
-
-<!-- UserInfo dialog -->
-<string name="userinfo_label_alias">Alias</string>
-<string name="userinfo_label_chg_group">Behandle grupper</string>
-<string name="userinfo_label_re_subscription">Send invitasjon på nytt</string>
-<string name="userinfo_label_block">Blokker</string>
-<string name="userinfo_label_delete">Slett</string>
-<string name="userinfo_resend">Send abonnement på nytt</string>
-<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
-</string>
-<string name="userinfo_yes">Ja</string>
-<string name="userinfo_no">Nei</string>
-<string name="userinfo_sureresend">Sende invitasjon på nytt?</string>
-
-<string name="chat_name">Beep - Prat</string>
-<string name="chat_input_default_value">Skriv melding</string>
-<string name="chat_self">Meg</string>
-<string name="chat_error">Feil</string>
-<string name="chat_send_message">Send</string>
-<string name="chat_menu_contacts_list">Kontaktliste</string>
-<string name="chat_menu_change_chat">Veksle prateøkt</string>
-<string name="chat_menu_start_otr_session">Start OTR-økt</string>
-<string name="chat_menu_stop_otr_session">Stopp OTR-økt</string>
-<string name="chat_menu_otr_verify_key">OTR-kontrollnøkkel</string>
-<string name="chat_menu_otr_submenu">OTR-handlinger</string>
-<string name="chat_dialog_change_chat_title">Åpne prateøkter</string>
-<string name="chat_menu_close_chat">Lukk denne prateøkten</string>
-<string name="chat_no_more_chats">Ingen flere aktive prateøkter</string>
-<string name="chat_state_composing">skriver en melding</string>
-<string name="chat_state_gone">har lukket prateøkten</string>
-<string name="chat_state_active">følger med på prateøkten</string>
-<string name="chat_state_inactive">gjør noe annet</string>
-<string name="chat_otrstate_plaintext">KLARTEKST</string>
-<string name="chat_otrstate_encrypted">KRYPTERT</string>
-<string name="chat_otrstate_finished">AVSLUTTET</string>
-<string name="chat_otrstate_authenticated">AUTENTISERT</string>
-<string name="chat_otr_verify_key" formatted="false">
-Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
-To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
-If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
-Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
-
-<string name="contact_status_msg_available">Tilgjengelig</string>
-<string name="contact_status_msg_available_chat">Tilgjengelig for prat</string>
-<string name="contact_status_msg_dnd">Ikke forstyrr</string>
-<string name="contact_status_msg_away">Borte</string>
-<string name="contact_status_msg_xa">Ikke tilgjengelig</string>
-<string name="contact_status_msg_offline">Koblet fra</string>
-
-<string name="privacy_list_name">Beem - Behandle personvernlister</string>
-<string name="privacy_list_no_data">Ingen registrerte personvernlister</string>
-<string name="privacy_list_menu_create">Opprett en personvernliste</string>
-<string name="privacy_list_create_dialog_title">Opprett en personvernliste</string>
-<string name="privacy_list_create_dialog_list_name_label">Tittel</string>
-<string name="privacy_list_create_dialog_create_button">Opprett</string>
-<string name="privacy_list_select_dialog_buddies">Kontakter</string>
-<string name="privacy_list_select_dialog_groups">Grupper</string>
-<string name="privacy_list_select_dialog_delete">Slett</string>
-<string name="privacy_list_delete_dialog_msg">Slette personvernliste \'%s\'?</string>
-<string name="privacy_list_delete_dialog_yes">Ja</string>
-<string name="privacy_list_delete_dialog_no">Nei</string>
-
-<string name="UpdateButton">Oppdater</string>
-
-<!-- MemorizingTrustManager library -->
-<string name="mtm_accept_cert">Godkjenn ukjent sertifikat</string>
-<string name="mtm_decision_always">Alltid</string>
-<string name="mtm_decision_once">Denne gangen</string>
-<string name="mtm_decision_abort">Avbryt</string>
-
-<string name="mtm_notification">Sertifikatkontroll</string>
-
-<!-- Error messages -->
-
-<string name="error_login_authentication">Feil ved innlogging, feil brukernavn eller passord</string>
-
-<string name="interna_server_error">Remote server error</string>
-<string name="bad_request">bad-request</string>
-<string name="forbidden">forbidden</string>
-<string name="item_not_found">item-not-found</string>
-<string name="conflict">conflict</string>
-<string name="feature_not_implemented">feature-not-implemented</string>
-<string name="gone">gone</string>
-<string name="jid_malformed">jid-malformed</string>
-<string name="no_acceptable">no-acceptable</string>
-<string name="not_allowed">not-allowed</string>
-<string name="not_authorized">not-authorized</string>
-<string name="payment_required">payment-required</string>
-<string name="recipient_unavailable">recipient-unavailable</string>
-<string name="redirect">redirect</string>
-<string name="registration_required">registration-required</string>
-<string name="remote_server_not_found">Remote server not found</string>
-<string name="remote_server_timeout">No server response</string>
-<string name="remote_server_error">Remote server error</string>
-<string name="resource_constraint">resource-constraint</string>
-<string name="service_unavailable">service-unavailable</string>
-<string name="subscription_required">subscription-required</string>
-<string name="undefined_condition">undefined-condition</string>
-<string name="unexpected_condition">unexpected-condition</string>
-<string name="request_timeout">request-timeout</string>
-</resources>
--- a/res/values-pt/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"Feliz"</item>
- <item msgid="1601611480575517120">"Triste"</item>
- <item msgid="1531181614218625881">"Piscando"</item>
- <item msgid="3858808057949077894">"Mostrando a língua"</item>
- <item msgid="7835238297967185651">"Surpreso"</item>
- <item msgid="1756223535005296033">"Beijando"</item>
- <item msgid="1093906245140165107">"Gritando"</item>
- <item msgid="888834839864150170">"Tranquilo"</item>
- <item msgid="6320683740534773967">"Louco por dinheiro"</item>
- <item msgid="6610111212478853990">"Falei besteira"</item>
- <item msgid="1706035208563940251">"Envergonhado"</item>
- <item msgid="9079275787422313427">"Anjo"</item>
- <item msgid="4630490399784004880">"Indeciso"</item>
- <item msgid="7002574538342357456">"Chorando"</item>
- <item msgid="850324578089267455">"Boca fechada"</item>
- <item msgid="6334637439528489607">"Rindo"</item>
- <item msgid="7602915122893958066">"Confuso"</item>
- <item msgid="3939233701582771068">"Coração"</item>
- <item msgid="1414759480575851587">"Louco"</item>
- <item msgid="8479809115158836070">"Sorriso forçado"</item>
- <item msgid="638612939305162424">"Indiferente"</item>
- </string-array>
-</resources>
--- a/res/values-pt/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- Generic terms -->
- <string name="app_name">Beem</string>
- <string name="OkButton">Ok</string>
- <string name="ClearButton">Limpar</string>
- <string name="CancelButton">Cancelar</string>
- <string name="AcceptButton">Autorizar</string>
- <string name="RefuseButton">Negar</string>
- <string name="JabberID">Jabber ID</string>
- <string name="Password">Senha</string>
- <string name="Continue">Continuar</string>
-
- <!-- AccountConfigure class -->
- <string name="AccountConfigureManualConfiguration">Configuração Manual</string>
-
- <!-- Beem class -->
- <string name="BeemJabberID">Jabber ID</string>
-
- <!-- BeemApplication class -->
- <string name="BeemApplicationConnect">Conectando...</string>
-
- <!-- BeemService class -->
- <string name="BeemServiceDescription">Utilizar Serviço Beem</string>
- <string name="BeemServiceCreated">Serviço Beem Criado</string>
- <string name="BeemServiceDestroyed">Serviço Beem Destruído</string>
-
- <!-- ContactDialog class -->
- <string name="CDChat">Conversa</string>
- <string name="CDCall">Chamada</string>
- <string name="CDInfos">Gerenciar Usuário</string>
-
- <!-- AddContact class -->
- <string name="AddCActTitle">Beem - Adicionar usuário</string>
-
- <string name="AddCLogin">Login</string>
- <string name="AddCAlias">Apelido</string>
- <string name="AddCGroup">Grupo</string>
- <string name="AddCOkButton">Adicionar</string>
- <string name="AddCContactAdded">Contato Adicionado</string>
- <string name="AddCContactAddedError">Erro: Contato não adicionado</string>
- <string name="AddCContactAddedLoginError">Erro de login</string>
- <string name="AddCBadForm">Jabber ID mal formado</string>
- <string name="AddCContactAlready">Contato já existe</string>
-
- <!-- ChangeStatus class -->
- <string name="ChangeStatusActTitle">Beem - Alterar meu status</string>
- <string name="ChangeStatusType">Meu status</string>
- <string name="ChangeStatusMessage">Minha mensagem pessoal</string>
- <string name="OpenContactList">Abrir lista de contatos</string>
-
- <string name="MenuAddContact">Adicionar contato</string>
- <string name="MenuAccountAbout">Projeto Beem</string>
- <string name="MenuAccountCreate">Criar conta</string>
- <string name="MenuConnection">Editar conta</string>
- <string name="ChangeStatusOk">Atualizando status</string>
- <string name="ChangeStatusNoChange">Nada a alterar</string>
- <string name="my_avatar">Meu avatar</string>
- <string name="select_avatar">Escolha o seu avatar</string>
- <string name="take_photo">Tirar uma foto</string>
- <string name="pick_photo">Selecionar imagem</string>
- <string name="delete_avatar">Sem avatar</string>
- <string name="photoPickerNotFoundText">Selecionador de fotos não encontrado</string>
-
-
- <!-- Settings class -->
- <string name="SettingsText">Editar seu login</string>
- <string name="SettingsPassword">Editar sua senha</string>
- <string name="SettingsProxy">Proxy</string>
- <string name="SettingsProxyProxy">Usar um servidor de proxy</string>
- <string name="SettingsProxySummary">Efetuar login através de um proxy</string>
- <string name="SettingsProxyType">Protocolo</string>
- <string name="SettingsProxyTypeSummary">Selecione um tipo de proxy</string>
- <string name="SettingsProxyServer">Editar endereço do proxy</string>
- <string name="SettingsProxyPort">Editar porta do proxy</string>
- <string name="SettingsProxyUser">Opcional, permite autenticar no servidor de proxy</string>
- <string name="SettingsProxyPassword">Optional, permite autenticar no servidor de proxy</string>
- <string name="SettingsAdvanced">Avançado</string>
- <string name="SettingsAdvancedOptions">Opções de servidor</string>
- <string name="SettingsAdvancedRecoDelay">Modificar atraso de conexão</string>
- <string name="SettingsAdvancedSpecOpt">Marque essa caixa se você quer utilizar um servidor específico para a sua conexão</string>
- <string name="SettingsAdvancedAddOpt">Editar o endereço do servidor</string>
- <string name="SettingsAdvancedPortOpt">Editar a porta do servidor</string>
- <string name="SettingsResourceTitle">Recurso</string>
- <string name="SettingsPriorityTitle">Prioridade</string>
- <string name="SettingsResourceSummary">Configurar o recurso XMPP do seu cliente</string>
- <string name="SettingsPrioritySummary">Configurar a prioridade do seu cliente</string>
- <string name="contact_list_preferences">Lista de contatos</string>
- <string name="contact_list_preferences_sum">Um conjunto de opções de visualização para a sua lista de contatos
- </string>
- <string name="CLP_hide_groups">Ocultar grupos</string>
- <string name="CLP_hide_groups_sum">Marque essa opção para ocultar grupos</string>
- <string name="CLP_hidden_contact">Ocultar contatos</string>
- <string name="CLP_hidden_contact_sum">Marque essa opção para ocultar contatos desconectados
- </string>
- <string name="settings_account_username">Login (JID)</string>
- <string name="login_username_info_default">beem@beem-project.com</string>
- <string name="settings_account_password">Senha</string>
- <string name="settings_account_server">Servidor</string>
- <string name="settings_account_port">Porta</string>
- <string name="settings_advanced_service_behaviour">Comportamento do serviço</string>
- <string name="settings_advanced_sum">Um conjunto de opções para usuários avançados</string>
- <string name="settings_xmpp_server">Endereço</string>
- <string name="comments_xmpp_server">exemplo.com</string>
- <string name="settings_xmpp_port">Porta</string>
- <string name="settings_xmpp_use_tls">Requer SSL/TLS</string>
- <string name="settings_reco_delay">Atraso de desconexão</string>
- <string name="comments_xmpp_port">Padrão: 5222</string>
- <string name="settings_proxy_sum">Configurações de uso de proxy</string>
- <string name="settings_proxy_use">Conectar usando um proxy</string>
- <string name="settings_proxy_type_prompt">Escolha o tipo de proxy</string>
- <string name="settings_proxy_server">Servidor</string>
- <string name="settings_proxy_port">Porta</string>
- <string name="comments_proxy_port">Padrão: 1080</string>
- <string name="settings_proxy_username">Login</string>
- <string name="settings_proxy_password">Senha</string>
- <string name="away_chk_title">Habilitar ausência automática</string>
- <string name="away_chk_sum">Muda o statos para ausente quando a tela é desligada</string>
- <string name="away_message_title">Mensagem de ausência</string>
- <string name="away_message_sum">A mensagem de ausência que será exibida</string>
- <string name="away_message_hint">Estou ausente, a tela do meu celular está desligada</string>
- <string name="notification_preferences">Configurações de notificação</string>
- <string name="notification_enable_vibrate_title">Vibrar</string>
- <string name="notification_enable_vibrate_sum">Habilita a vibração quando receber mensagens</string>
- <string name="notification_snd_title">Toque de mensagem</string>
- <string name="notification_snd_sum">Configura o toque de recebimento de mensagens</string>
- <string name="settings_chat_compact">Conversa compacta</string>
- <string name="settings_chat_compact_sum">Habilita o modo compacto da janela de chat</string>
- <string name="history">Histórico</string>
- <string name="history_sum">Marque se você deseja gravar o histórico de conversas no seu cartão SD</string>
- <string name="history_mount">Você precisa ter um cartão SD montado e com permissão de escrita para habilitar o histórico</string>
- <string name="history_on_off">Habilita histórico de mensagens</string>
- <string name="chat_preferences">Conversa</string>
- <string name="chat_preferences_sum">Histórico, Tamanho do layout ...</string>
- <string name="chat_history_path">Caminho do histórico</string>
- <string name="chat_history_path_sum">Conversas serão gravadas em uma pasta no cartão SD</string>
- <string name="settings_smack_debug">Habilitar debug XMPP</string>
- <string name="settings_full_jid_login">Utilizar meu JID completo como login</string>
- <string name="settings_full_jid_login_sum">Necessário para alguns servidores, como o Google Talk</string>
-
- <!-- Subscription class -->
- <string name="SubscriptAccept">Subscrição aceita</string>
- <string name="SubscriptError">Erro de subscrição</string>
- <string name="SubscriptRefused">Subscrição recusada</string>
- <string name="SubscriptText">%s quer te adicionar como contato. Você autoriza?</string>
- <string name="SubscriptTitle">Autorizar contato?</string>
-
- <!-- BeemChatManager -->
- <string name="BeemChatManagerNewMessage">Você tem uma nova mensagem</string>
-
- <!-- BeemBroadcastReceiver class -->
- <string name="BeemBroadcastReceiverDisconnect">BEEM: Você foi desconectado</string>
-
- <!-- XmppConnectionAdapter class -->
- <string name="AcceptContactRequest">%s te adicionou na lista de contatos.</string>
- <string name="AcceptContactRequestFrom">Autorizar %s para contactar você.</string>
-
- <!-- Activities -->
- <string name="login_tag">Beem - Atividade de login</string>
- <string name="edit_settings_name">Beem - Configurações</string>
- <string name="edit_settings_tag">Beem - Atividade de configurações</string>
- <string name="create_account_name">Beem - Criar uma conta</string>
- <string name="create_account_tag">Beem - Atividade de criar conta</string>
- <string name="contact_list_name">Beem - Lista de contatos</string>
- <string name="contact_list_tag">Beem - Atividade de lista de contatos</string>
- <string name="user_info_name">Beem - Informações de usuário</string>
-
- <!-- Buttons -->
- <string name="button_create_account">Criar conta</string>
- <string name="button_create_login_account">Criar e utilizar conta</string>
-
- <!-- LogAs Activity -->
- <string name="login_username">Login</string>
- <string name="login_password">Senha</string>
- <string name="login_error_dialog_title">Login - Erro</string>
- <string name="login_close_dialog_button">Fechar</string>
- <string name="login_menu_create_account">Criar conta</string>
- <string name="login_menu_settings">Configurações</string>
- <string name="login_menu_about">Sobre</string>
- <string name="login_about_title">Beem %s - Sobre</string>
- <string name="login_about_msg">
- Beem é um projeto da EPITECH Innovative Project. Visite
- http://www.beem-project.com !
- </string>
- <string name="login_about_button">Fechar</string>
- <string name="login_settings_button">Configurações</string>
- <string name="login_login_button">Entrar</string>
- <string name="login_login_progress">Conectando. Aguarde...</string>
- <string name="login_error_msg">Infelizmente, ocorreu um erro.\n\nDetalhes
- do erro:\n%s</string>
- <string name="login_menu_login">Login</string>
- <string name="login_no_connectivity">Conexão de internet não encontrada</string>
- <string name="login_start_msg">Configurações incorretas</string>
-
- <!-- LoginAnim activity -->
- <string name="loganim_connecting">Conectando ...</string>
- <string name="loganim_authenticating">Autenticando ...</string>
- <string name="loganim_login_success">Entrou com sucesso</string>
- <string name="loganim_login_failed">Falha no login</string>
-
- <!-- EditSettings Activity -->
- <string name="settings_menu_create_account">Criar conta</string>
- <string name="settings_menu_privacy_lists">Gerenciar minha lista de privacidade</string>
- <string name="settings_saved_ok">As configurações foram salvas com sucesso.</string>
-
-
-
- <!-- EditSettings Activity Categories -->
- <string name="general_preferences">Preferências gerais</string>
- <string name="user_preferences">Configurações de usuário (requerido)</string>
- <string name="user_preferences_advanced">Configurações avançadas de usuário (opcional)</string>
- <string name="network_preferences">Opções de rede</string>
- <string name="proxy_proxy_settings">Configurações de proxy</string>
- <string name="proxy_user_settings">Configurações de proxy</string>
- <string name="history_preferences">Histórico</string>
- <string name="chat_layout_option">Layout da conversa</string>
-
-
- <!-- EditSettings Activity Tabs -->
- <string name="settings_tab_tag_account">edit_settings_tab_account</string>
- <string name="settings_tab_label_account">Conta</string>
- <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
- <string name="settings_tab_label_xmpp">XMPP</string>
- <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
- <string name="settings_tab_label_proxy">Proxy</string>
-
-
- <!-- wizard activities -->
- <string name="account_wizard_text1"><b>Bem vindo ao BEEM.</b>\n\nVocê ainda não configurou uma conta XMPP (Jabber).\nEscolha uma das opções :</string>
- <string name="account_wizard_configure_text"><b>Por favor, preencha os dados da sua conta</b></string>
- <string name="account_wizard_configure_account">Eu já tenho uma conta</string>
- <string name="account_wizard_create_account">Quero criar uma conta</string>
-
- <!-- Create an account Activity -->
- <string name="create_account_instr_dialog_title">Criar conta - Instruções</string>
- <string name="create_account_err_dialog_title">Criar conta - Erro</string>
- <string name="create_account_err_dialog_settings_button">Alterar configurações</string>
- <string name="create_account_close_dialog_button">Fechar</string>
- <string name="create_account_successfull_after">conta %s foi criada com sucesso</string>
- <string name="create_account_err_username">JabberID mal formado</string>
- <string name="create_account_err_passwords">Senha não confere.</string>
- <string name="create_account_username">Login</string>
- <string name="create_account_password">Senha</string>
- <string name="create_account_confirm_password">Confirmar senha</string>
-
- <!-- ContactList Activity -->
- <string name="contact_list_menu_add_contact">Adicionar contato</string>
- <string name="contact_list_menu_status">Alterar status</string>
- <string name="contact_list_menu_settings">Configurações</string>
- <string name="contact_list_menu_disconnect">Desconectar</string>
- <string name="contact_list_all_contact">Todos os contatos</string>
- <string name="contact_list_no_group">Sem grupo</string>
-
- <!-- UserInfo dialog -->
- <string name="userinfo_label_alias">Apelido</string>
- <string name="userinfo_label_chg_group">Gerenciar grupos</string>
- <string name="userinfo_label_re_subscription">Reenviar convite</string>
- <string name="userinfo_label_block">BLoquear</string>
- <string name="userinfo_label_delete">Apagar</string>
- <string name="userinfo_resend">Reenviar subscrição</string>
- <string name="userinfo_sure2delete">Tem certeza que deseja apagar esse contato?
- </string>
- <string name="userinfo_yes">Sim</string>
- <string name="userinfo_no">Não</string>
- <string name="userinfo_sureresend">Tem certeza que deseja reenviar o convite?</string>
-
- <string name="chat_name">Beem - Conversa</string>
- <string name="chat_input_default_value">Digite sua mensagem</string>
- <string name="chat_self">Eu</string>
- <string name="chat_error">Erro</string>
- <string name="chat_send_message">Enviar</string>
- <string name="chat_menu_contacts_list">Lista de contatos</string>
- <string name="chat_menu_change_chat">Trocar janela de conversa</string>
- <string name="chat_dialog_change_chat_title">Conversas abertas</string>
- <string name="chat_menu_close_chat">Fechar essa conversa</string>
- <string name="chat_no_more_chats">Sem outras conversas ativas</string>
- <string name="chat_state_composing">está escrevendo uma mensagem</string>
- <string name="chat_state_gone">deixou a conversa</string>
- <string name="chat_state_active">presta atenção à conversa</string>
- <string name="chat_state_inactive">está fazendo outra coisa</string>
-
- <string name="contact_status_msg_available">Disponível</string>
- <string name="contact_status_msg_available_chat">Disponível para conversar</string>
- <string name="contact_status_msg_dnd">Ocupado</string>
- <string name="contact_status_msg_away">Ausente</string>
- <string name="contact_status_msg_xa">Indisponível</string>
- <string name="contact_status_msg_offline">Desconectado</string>
-
- <string name="privacy_list_name">Beem - Gerenciar minha lista de privacidade</string>
- <string name="privacy_list_no_data">Não há nenhuma lista de privacidade registrada.</string>
- <string name="privacy_list_menu_create">Criar lista de privacidade</string>
- <string name="privacy_list_create_dialog_title">Criar lista de privacidade</string>
- <string name="privacy_list_create_dialog_list_name_label">Título</string>
- <string name="privacy_list_create_dialog_create_button">Criar</string>
- <string name="privacy_list_select_dialog_buddies">Contatos</string>
- <string name="privacy_list_select_dialog_groups">Grupos</string>
- <string name="privacy_list_select_dialog_delete">Apagar</string>
- <string name="privacy_list_delete_dialog_msg">Você realmente deseja apagar a lista de privacidade chamada \'%s\'?</string>
- <string name="privacy_list_delete_dialog_yes">Sim</string>
- <string name="privacy_list_delete_dialog_no">Não</string>
-
- <string name="UpdateButton">Atualizar</string>
-
- <!-- Error messages -->
-
- <string name="error_login_authentication">Erro durante autenticação: login ou senha incorretos.</string>
-
- <string name="interna_server_error">Erro interno do servidor</string>
- <string name="bad_request">bad-request</string>
- <string name="forbidden">forbidden</string>
- <string name="item_not_found">item-not-found</string>
- <string name="conflict">conflict</string>
- <string name="feature_not_implemented">feature-not-implemented</string>
- <string name="gone">gone</string>
- <string name="jid_malformed">jid-malformed</string>
- <string name="no_acceptable">no-acceptable</string>
- <string name="not_allowed">not-allowed</string>
- <string name="not_authorized">not-authorized</string>
- <string name="payment_required">payment-required</string>
- <string name="recipient_unavailable">recipient-unavailable</string>
- <string name="redirect">redirect</string>
- <string name="registration_required">registration-required</string>
- <string name="remote_server_not_found">Servidor remoto não encotrado</string>
- <string name="remote_server_timeout">Sem resposta do servidor</string>
- <string name="remote_server_error">Erro do servidor remoto</string>
- <string name="resource_constraint">resource-constraint</string>
- <string name="service_unavailable">service-unavailable</string>
- <string name="subscription_required">subscription-required</string>
- <string name="undefined_condition">undefined-condition</string>
- <string name="unexpected_condition">unexpected-condition</string>
- <string name="request_timeout">request-timeout</string>
-</resources>
--- a/res/values-ru/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"Радость"</item>
- <item msgid="1601611480575517120">"Грустный"</item>
- <item msgid="1531181614218625881">"Подмигивает"</item>
- <item msgid="3858808057949077894">"Показывает язык"</item>
- <item msgid="7835238297967185651">"Удивлен"</item>
- <item msgid="1756223535005296033">"Поцелуй"</item>
- <item msgid="1093906245140165107">"Кричит"</item>
- <item msgid="888834839864150170">"Крутой"</item>
- <item msgid="6320683740534773967">"Не болтай попусту"</item>
- <item msgid="6610111212478853990">"В замешательстве"</item>
- <item msgid="1706035208563940251">"Смущение"</item>
- <item msgid="9079275787422313427">"Ангел"</item>
- <item msgid="4630490399784004880">"Нерешительный"</item>
- <item msgid="7002574538342357456">"Плачет"</item>
- <item msgid="850324578089267455">"Не скажу"</item>
- <item msgid="6334637439528489607">"Смех"</item>
- <item msgid="7602915122893958066">"Озадаченный"</item>
- <item msgid="3939233701582771068">"Сердце"</item>
- <item msgid="1414759480575851587">"Злой"</item>
- <item msgid="8479809115158836070">"Ухмылка"</item>
- <item msgid="638612939305162424">"Невозмутимость"</item>
- </string-array>
-</resources>
--- a/res/values-ru/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,320 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<resources>
-<!-- Generic terms -->
-<string name="app_name">Beem</string>
-<string name="OkButton">ОК</string>
-<string name="ClearButton">Очистить</string>
-<string name="CancelButton">Отмена</string>
-<string name="AcceptButton">Разрешить</string>
-<string name="RefuseButton">Отказать</string>
-<string name="JabberID">Jabber ID</string>
-<string name="Password">Пароль</string>
-<string name="Continue">Продолжить</string>
-
-<!-- AccountConfigure class -->
-<string name="AccountConfigureManualConfiguration">Ручная конфигурация</string>
-
-<!-- Beem class -->
-<string name="BeemJabberID">Jabber ID</string>
-
-<!-- BeemApplication class -->
-<string name="BeemApplicationConnect">Соединение...</string>
-
-<!-- BeemService class -->
-<string name="BeemServiceDescription">Использовать сервис Beem</string>
-<string name="BeemServiceCreated">Сервис Beem создан</string>
-<string name="BeemServiceDestroyed">Сервис Beem уничтожен</string>
-
-<!-- ContactDialog class -->
-<string name="CDChat">Написать</string>
-<string name="CDCall">Повонить</string>
-<string name="CDInfos">Настройки</string>
-
-<!-- AddContact class -->
-<string name="AddCActTitle">Добавление контакта</string>
-
-<string name="AddCLogin">Имя пользователя</string>
-<string name="AddCAlias">Псевдоним</string>
-<string name="AddCGroup">Группа</string>
-<string name="AddCOkButton">Добавить</string>
-<string name="AddCContactAdded">Контакт добавлен</string>
-<string name="AddCContactAddedError">Ошибка добавления контакта</string>
-<string name="AddCContactAddedLoginError">Ошибка входа</string>
-<string name="AddCBadForm"/>
-<string name="AddCContactAlready">Контакт уже добавлен</string>
-
-<!-- ChangeStatus class -->
-<string name="ChangeStatusActTitle">Изменение статуса</string>
-<string name="ChangeStatusType">Мой статус</string>
-<string name="ChangeStatusMessage">Персональное сообщение</string>
-<string name="OpenContactList">Открыть список контактов</string>
-
-<string name="MenuAddContact">Добавить новый контакт</string>
-<string name="MenuAccountAbout">О проекте Beem</string>
-<string name="MenuAccountCreate">Создать аккаунт</string>
-<string name="MenuConnection">Изменить аккаунт</string>
-<string name="ChangeStatusOk">Обновление статуса...</string>
-<string name="ChangeStatusNoChange">Ничего не изменилось</string>
-<string name="my_avatar">Мой аватар</string>
-<string name="select_avatar">Выберите свой аватар</string>
-<string name="take_photo">Снять фото</string>
-<string name="pick_photo">Выбрать фото</string>
-<string name="delete_avatar">Нет аватара</string>
-<string name="photoPickerNotFoundText">Нельзя выбрать фото</string>
-
- <!-- Settings class -->
-<string name="SettingsText">Имя пользователя</string>
-<string name="SettingsPassword">Пароль</string>
-<string name="SettingsProxy">Прокси</string>
-<string name="SettingsProxyProxy">Использовать прокси</string>
-<string name="SettingsProxySummary">Соединяться через прокси</string>
-<string name="SettingsProxyType">Протокол</string>
-<string name="SettingsProxyTypeSummary">Выберите тип прокси</string>
-<string name="SettingsProxyServer">Сервер</string>
-<string name="SettingsProxyPort">Порт</string>
-<string name="SettingsProxyUser">Имя пользователя прокси (необязательно)</string>
-<string name="SettingsProxyPassword">Пароль пользователя прокси (необязательно)</string>
-<string name="SettingsAdvanced">Дополнительно</string>
-<string name="SettingsAdvancedOptions">Дополнительные настройки сервера</string>
-<string name="SettingsAdvancedRecoDelay">Изменить задержку повторного соединения</string>
-<string name="SettingsAdvancedSpecOpt">Отметьте для того, чтобы указать сервер вручную</string>
-<string name="SettingsAdvancedAddOpt">Сервер</string>
-<string name="SettingsAdvancedPortOpt">Порт</string>
-<string name="SettingsResourceTitle">Метка</string>
-<string name="SettingsPriorityTitle">Приоритет</string>
-<string name="SettingsResourceSummary">Установить метку данного клиента</string>
-<string name="SettingsPrioritySummary">Установить приоритет данного клиента</string>
-<string name="contact_list_preferences">Список контактов</string>
-<string name="contact_list_preferences_sum">Опции отображения контактов</string>
-<string name="CLP_hide_groups">Скрывать группы</string>
-<string name="CLP_hide_groups_sum">Отметьте для того, чтобы спрятать группы</string>
-<string name="CLP_hidden_contact">Скрывать оффлайн-контакты</string>
-<string name="CLP_hidden_contact_sum">Отметьте, чтобы спрятать контакты, которые не в сети</string>
-<string name="settings_account_username">Имя пользователя</string>
-<string name="login_username_info_default"/>
-<string name="settings_account_password">Пароль</string>
-<string name="settings_account_server">Сервер</string>
-<string name="settings_account_port">Порт</string>
-<string name="settings_advanced_service_behaviour"/>
-<string name="settings_advanced_sum">Расширенные настройки</string>
-<string name="settings_xmpp_server">Сервер</string>
-<string name="comments_xmpp_server"/>
-<string name="settings_xmpp_port">Порт</string>
-<string name="settings_xmpp_use_tls">Требовать SSL/TLS</string>
-<string name="settings_reco_delay"/>
-<string name="comments_xmpp_port">По умолчанию 5222</string>
-<string name="settings_proxy_sum"/>
-<string name="settings_proxy_use">Соединяться через прокси</string>
-<string name="settings_proxy_type_prompt">Выберите тип проси</string>
-<string name="settings_proxy_server">Сервер</string>
-<string name="settings_proxy_port">Порт</string>
-<string name="comments_proxy_port">По умолчанию 1080</string>
-<string name="settings_proxy_username">Имя пользователя</string>
-<string name="settings_proxy_password">Пароль</string>
-<string name="away_chk_title">Включать автоматически \"Отошел\"</string>
-<string name="away_chk_sum">Устанавливать статус \"Отошел\" при отключении экрана</string>
-<string name="away_message_title">Сообщение об отсутствии</string>
-<string name="away_message_sum">Напишите сообщение об отсутствии</string>
-<string name="away_message_hint">Я отошел, экран телефона выключен</string>
-<string name="notification_preferences">Настройка оповещений</string>
-<string name="notification_enable_vibrate_title">Вибрация</string>
-<string name="notification_enable_vibrate_sum">Вибрировать при новых сообщениях</string>
-<string name="notification_snd_title">Сигнал сообщений</string>
-<string name="notification_snd_sum">Установить сигнал для пришедшего сообщения</string>
-<string name="settings_chat_compact">Компактный диалог</string>
-<string name="settings_chat_compact_sum">Сделать окно диалога компактным</string>
-<string name="history">История</string>
-<string name="history_sum">Пометьте для сохранения разговоров на SD карте</string>
-<string name="history_mount">Для сохранения истории необходима установленная SD карта с разрешённой записью</string>
-<string name="history_on_off">Разрешить сохранение истории</string>
-<string name="chat_preferences">Диалог</string>
-<string name="chat_preferences_sum">История, размер диалога...</string>
-<string name="chat_history_path">Путь к истории</string>
-<string name="chat_history_path_sum">Путь к сохраняемым диалогам на SD карте</string>
-<string name="settings_smack_debug">Разрешить отладку XMPP</string>
-<string name="settings_full_jid_login">Использовать мой полный JID как имя пользователя</string>
-<string name="settings_full_jid_login_sum">Необходимо для некоторых серверов, например для Google Talk</string>
-
- <!-- Subscription class -->
-<string name="SubscriptAccept">Контакт авторизован</string>
-<string name="SubscriptError">Ошибка авторизации</string>
-<string name="SubscriptRefused">Авторизация отклонена</string>
-<string name="SubscriptText">%s желает добавить вас в свой контакт-лист. Авторизовать его(-е)?</string>
-<string name="SubscriptTitle">Авторизовать пользователя?</string>
-
-<!-- BeemChatManager -->
-<string name="BeemChatManagerNewMessage">Пришло новое сообщение</string>
-
-<!-- BeemBroadcastReceiver class -->
-<string name="BeemBroadcastReceiverDisconnect">Beem: Соединение разорвано</string>
-
-<!-- XmppConnectionAdapter class -->
-<string name="AcceptContactRequest">%s добавил(а) вас в свой контакт-лист.</string>
-<string name="AcceptContactRequestFrom">Авторизовать %s.</string>
-
-<!-- Activities -->
-<string name="login_tag"/>
-<string name="edit_settings_name">Настройки</string>
-<string name="edit_settings_tag"/>
-<string name="create_account_name">Создать аккаунт</string>
-<string name="create_account_tag"/>
-<string name="contact_list_name">Контакты</string>
-<string name="contact_list_tag"/>
-<string name="user_info_name">Информация о пользователе</string>
-
-<!-- Buttons -->
-<string name="button_create_account">Создать аккаунт</string>
-<string name="button_create_login_account">Создать аккаунт и подключиться</string>
-
-<!-- LogAs Activity -->
-<string name="login_username">Имя пользователя</string>
-<string name="login_password">Пароль</string>
-<string name="login_error_dialog_title">Ошибка входа</string>
-<string name="login_close_dialog_button">Закрыть</string>
-<string name="login_menu_create_account">Создать аккаунт</string>
-<string name="login_menu_settings">Настройки</string>
-<string name="login_menu_about">О программе</string>
-<string name="login_about_title">Beem %s - О программе</string>
-<string name="login_about_msg"/>
-<string name="login_about_button">Закрыть</string>
-<string name="login_settings_button">Настройки</string>
-<string name="login_login_button">Войти</string>
-<string name="login_login_progress">Соединение. Пожалуйста, подождите...</string>
-<string name="login_error_msg">К сожалению, произошла ошибка.\n\nПодробности:\n%s</string>
-<string name="login_menu_login">Войти</string>
-<string name="login_no_connectivity">Интернет соединение не найдено</string>
-<string name="login_start_msg">Настройки в меню</string>
-
-<!-- LoginAnim activity -->
-<string name="loganim_connecting">Соединение...</string>
-<string name="loganim_authenticating">Аутентификация...</string>
-<string name="loganim_login_success">Вход выполнен</string>
-<string name="loganim_login_failed">Не удалось войти</string>
-
-<!-- EditSettings Activity -->
-<string name="settings_menu_create_account">Создать аккаунт</string>
-<string name="settings_menu_privacy_lists">Настроить списки приватности</string>
-<string name="settings_saved_ok">Настройки успешно сохранены</string>
-
-<!-- EditSettings Activity Categories -->
-<string name="general_preferences">Общие настройки</string>
-<string name="user_preferences">Настройки пользователя (обязательные)</string>
-<string name="user_preferences_advanced">Расширенные настройки пользователя (дополнительные)</string>
-<string name="network_preferences">Настройки сети</string>
-<string name="proxy_proxy_settings">Настройки прокси</string>
-<string name="proxy_user_settings">Настройки прокси</string>
-<string name="history_preferences">История</string>
-<string name="chat_layout_option">Вид диалога</string>
-
- <!-- EditSettings Activity Tabs -->
-<string name="settings_tab_tag_account"/>
-<string name="settings_tab_label_account">Аккаунт</string>
-<string name="settings_tab_tag_xmpp"/>
-<string name="settings_tab_label_xmpp">XMPP</string>
-<string name="settings_tab_tag_proxy"/>
-<string name="settings_tab_label_proxy">Прокси</string>
-
-<!-- wizard activities -->
-<string name="account_wizard_text1"><b>Добро пожаловать в Beem.</b>\n\nВы ещё не настроили аккаунт XMPP (Jabber).\nВыберите один из следующих вариантов :</string>
-<string name="account_wizard_configure_text"/>
-<string name="account_wizard_configure_account">Использовать существующий аккаунт</string>
-<string name="account_wizard_create_account">Создать новый аккаунт</string>
-
-<!-- Create an account Activity -->
-<string name="create_account_instr_dialog_title">Создание учётной записи - Инструкция</string>
-<string name="create_account_err_dialog_title">Создание учётной записи - Ошибка</string>
-<string name="create_account_err_dialog_settings_button">Изменить мои настройки</string>
-<string name="create_account_close_dialog_button">Закрыть</string>
-<string name="create_account_successfull_after">Аккаунт %s успешно создан</string>
-<string name="create_account_err_username">Неправильный JID</string>
-<string name="create_account_err_passwords">Пароли не совпадают</string>
-<string name="create_account_username">Имя пользователя</string>
-<string name="create_account_password">Пароль</string>
-<string name="create_account_confirm_password">Повторите пароль</string>
-
-<!-- ContactList Activity -->
-<string name="contact_list_menu_add_contact">Добавить контакт</string>
-<string name="contact_list_menu_status">Сменить статус</string>
-<string name="contact_list_menu_settings">Настройки</string>
-<string name="contact_list_menu_disconnect">Отключиться</string>
-<string name="contact_list_all_contact">Все контакты</string>
-<string name="contact_list_no_group">Без группы</string>
-
-<!-- UserInfo dialog -->
-<string name="userinfo_label_alias">Псевдоним</string>
-<string name="userinfo_label_chg_group">Управление группами</string>
-<string name="userinfo_label_re_subscription">Выслать приглашение ещё раз</string>
-<string name="userinfo_label_block">Заблокировать</string>
-<string name="userinfo_label_delete">Удалить</string>
-<string name="userinfo_resend"/>
-<string name="userinfo_sure2delete">Вы уверены, что хотите удалить этот контакт?</string>
-<string name="userinfo_yes">Да</string>
-<string name="userinfo_no">Нет</string>
-<string name="userinfo_sureresend">Вы уверены, что хотите повторно послать приглашение?</string>
-
-<string name="chat_name">Чат</string>
-<string name="chat_input_default_value">Введите сообщение тут</string>
-<string name="chat_self">Я</string>
-<string name="chat_error">Ошибка</string>
-<string name="chat_send_message">Отправить</string>
-<string name="chat_menu_contacts_list">Список контактов</string>
-<string name="chat_menu_change_chat">Другая беседа</string>
-<string name="chat_dialog_change_chat_title">Открытые беседы</string>
-<string name="chat_menu_close_chat">Закрыть эту беседу</string>
-<string name="chat_no_more_chats">Нет активных бесед</string>
-<string name="chat_state_composing">пишет</string>
-<string name="chat_state_gone">закрыл(а) окно беседы</string>
-<string name="chat_state_active">вникает в текст</string>
-<string name="chat_state_inactive">занимается чем-то другим</string>
-
-<string name="contact_status_msg_available">Онлайн</string>
-<string name="contact_status_msg_available_chat">Доступен для разговора</string>
-<string name="contact_status_msg_dnd">Занят</string>
-<string name="contact_status_msg_away">Отошел</string>
-<string name="contact_status_msg_xa">Недоступен</string>
-<string name="contact_status_msg_offline">Оффлайн</string>
-
-<string name="privacy_list_name">Настройки приватности</string>
-<string name="privacy_list_no_data">Нет списков приватности</string>
-<string name="privacy_list_menu_create">Создать список приватности</string>
-<string name="privacy_list_create_dialog_title">Создать список приватности</string>
-<string name="privacy_list_create_dialog_list_name_label">Название</string>
-<string name="privacy_list_create_dialog_create_button">Создать</string>
-<string name="privacy_list_select_dialog_buddies">Контакты</string>
-<string name="privacy_list_select_dialog_groups">Группы</string>
-<string name="privacy_list_select_dialog_delete">Удалить</string>
-<string name="privacy_list_delete_dialog_msg">Вы правда хотите удалить список приватности \'%s\' ?</string>
-<string name="privacy_list_delete_dialog_yes">Да</string>
-<string name="privacy_list_delete_dialog_no">Нет</string>
-
-<string name="UpdateButton">Обновить</string>
-
-<!-- Error messages -->
-
-<string name="error_login_authentication">Ошибка: неверно указан логин или пароль</string>
-
-<string name="interna_server_error">Ошибка сервера</string>
-<string name="bad_request">Ошибочный запрос</string>
-<string name="forbidden"/>
-<string name="item_not_found"/>
-<string name="conflict"/>
-<string name="feature_not_implemented">Возможность нереализована</string>
-<string name="gone"/>
-<string name="jid_malformed">Неверный JID</string>
-<string name="no_acceptable"/>
-<string name="not_allowed"/>
-<string name="not_authorized"/>
-<string name="payment_required"/>
-<string name="recipient_unavailable"/>
-<string name="redirect"/>
-<string name="registration_required"/>
-<string name="remote_server_not_found">Сервер не найден</string>
-<string name="remote_server_timeout">Сервер не отвечает</string>
-<string name="remote_server_error">Ошибка сервера</string>
-<string name="resource_constraint"/>
-<string name="service_unavailable"/>
-<string name="subscription_required"/>
-<string name="undefined_condition"/>
-<string name="unexpected_condition"/>
-<string name="request_timeout"/>
-</resources>
\ No newline at end of file
--- a/res/values-sv/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"Glad"</item>
- <item msgid="1601611480575517120">"Ledsen"</item>
- <item msgid="1531181614218625881">"Blinkar"</item>
- <item msgid="3858808057949077894">"Lipar"</item>
- <item msgid="7835238297967185651">"Förvånad"</item>
- <item msgid="1756223535005296033">"Pussar"</item>
- <item msgid="1093906245140165107">"Skriker"</item>
- <item msgid="888834839864150170">"Cool"</item>
- <item msgid="6320683740534773967">"Dollarmun"</item>
- <item msgid="6610111212478853990">"Bortgjord"</item>
- <item msgid="1706035208563940251">"Generad"</item>
- <item msgid="9079275787422313427">"Ängel"</item>
- <item msgid="4630490399784004880">"Tveksam"</item>
- <item msgid="7002574538342357456">"Gråter"</item>
- <item msgid="850324578089267455">"Hemlis"</item>
- <item msgid="6334637439528489607">"Skrattar"</item>
- <item msgid="7602915122893958066">"Förvirrad"</item>
- <item msgid="3939233701582771068">"Hjärta"</item>
- <item msgid="1414759480575851587">"Arg"</item>
- <item msgid="8479809115158836070">"Flinar"</item>
- <item msgid="638612939305162424">"Pokeransikte"</item>
- </string-array>
-</resources>
--- a/res/values-sv/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-<!-- Generic terms -->
-<string name="app_name">Beem</string>
-<string name="OkButton">Ok</string>
-<string name="ClearButton">Töm</string>
-<string name="CancelButton">Avbryt</string>
-<string name="AcceptButton">Godkänn</string>
-<string name="RefuseButton">Neka</string>
-<string name="JabberID">Jabber-ID</string>
-<string name="Password">Lösenord</string>
-<string name="Continue">Fortsätt</string>
-
-<!-- AccountConfigure class -->
-<string name="AccountConfigureManualConfiguration">Manuell inställning</string>
-
-<!-- BeemService class -->
-<string name="BeemServiceDescription">Använda tjänsten Beem</string>
-
-<!-- ContactDialog class -->
-<string name="CDChat">Chatta</string>
-<string name="CDCall">Ring</string>
-<string name="CDInfos">Hantera kontakt</string>
-
-<!-- AddContact class -->
-<string name="AddCActTitle">Beem - Lägg till kontakt</string>
-
-<string name="AddCLogin">Användarnamn</string>
-<string name="AddCAlias">Alias</string>
-<string name="AddCGroup">Grupp</string>
-<string name="AddCOkButton">Lägg till</string>
-<string name="AddCContactAdded">Kontakt tillagd</string>
-<string name="AddCContactAddedError">Fel, kontakt inte tillagd</string>
-<string name="AddCContactAddedLoginError">Fel vid inloggning</string>
-<string name="AddCContactAlready">Kontakten finns redan</string>
-
-<!-- ChangeStatus class -->
-<string name="ChangeStatusActTitle">Beem - Ändra status</string>
-<string name="ChangeStatusType">Min status</string>
-<string name="ChangeStatusMessage">Mitt personliga meddelande</string>
-<string name="OpenContactList">Öppna kontaktlista</string>
-
-<string name="ChangeStatusOk">Uppdaterar status</string>
-<string name="my_avatar">Min avatar</string>
-<string name="select_avatar">Välj avatar</string>
-<string name="take_photo">Ta ett foto</string>
-<string name="pick_photo">Välj en bild</string>
-<string name="delete_avatar">Ingen avatar</string>
-<string name="photoPickerNotFoundText">Hittar ingen fotoväljare</string>
-
-
-<!-- Settings class -->
-<string name="SettingsProxy">Proxy</string>
-<string name="SettingsProxyProxy">Använd proxyserver</string>
-<string name="SettingsProxySummary">Logga in via proxyserver</string>
-<string name="SettingsProxyType">Protokoll</string>
-<string name="SettingsProxyTypeSummary">Välj typ av proxyserver</string>
-<string name="SettingsProxyServer">Ändra proxyserveradress</string>
-<string name="SettingsProxyPort">Ändra proxyserverport</string>
-<string name="SettingsProxyUser">Valfritt, möjliggör autentisering på proxyservern</string>
-<string name="SettingsProxyPassword">Valfritt, möjliggör autentisering på proxyservern</string>
-<string name="SettingsAdvanced">Avancerat</string>
-<string name="SettingsAdvancedOptions">Specifika serverinställningar</string>
-<string name="SettingsAdvancedRecoDelay">Ändra tid mellan anslutningsförsök</string>
-<string name="SettingsAdvancedSpecOpt">Markera om du vill använda någon specifik server för anslutningen</string>
-<string name="SettingsAdvancedAddOpt">Ändra serveradress</string>
-<string name="SettingsAdvancedPortOpt">Ändra serverport</string>
-<string name="SettingsResourceTitle">Instans</string>
-<string name="SettingsPriorityTitle">Prioritet</string>
-<string name="SettingsResourceSummary">Ange XMPP-instans för denna klient</string>
-<string name="SettingsPrioritySummary">Ange prioritet för denna klient</string>
-<string name="contact_list_preferences">Kontaktlista</string>
-<string name="contact_list_preferences_sum">A set of display options for your buddy list
-</string>
-<string name="CLP_hide_groups">Dölj grupper</string>
-<string name="CLP_hide_groups_sum">Markera för att dölja grupper</string>
-<string name="CLP_show_jid">Visa JID</string>
-<string name="CLP_show_jid_sum">Markera för att alltid visa kontakters JID</string>
-<string name="CLP_hidden_contact">Dölj kontakter</string>
-<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
-</string>
-<string name="settings_account_username">Användarnamn (JID)</string>
-<string name="settings_account_password">Lösenord</string>
-<string name="settings_account_server">Server</string>
-<string name="settings_account_port">Port</string>
-<string name="settings_advanced_service_behaviour">Tjänstebeskrivning</string>
-<string name="settings_advanced_sum">Inställningar för avancerade användare</string>
-<string name="settings_xmpp_server">Adress</string>
-<string name="comments_xmpp_server">example.com</string>
-<string name="settings_xmpp_port">Port</string>
-<string name="settings_xmpp_use_tls">Kräv SSL/TLS</string>
-<string name="settings_reco_delay">Tid mellan anslutningsförsök</string>
-<string name="comments_xmpp_port">Förvalt: 5222</string>
-<string name="settings_proxy_sum">Inställningar för användning av proxy</string>
-<string name="settings_proxy_use">Anslut via proxy</string>
-<string name="settings_proxy_type_prompt">Välj typ av proxy</string>
-<string name="settings_proxy_server">Server</string>
-<string name="settings_proxy_port">Port</string>
-<string name="comments_proxy_port">Förvalt: 1080</string>
-<string name="settings_proxy_username">Användarnamn</string>
-<string name="settings_proxy_password">Lösenord</string>
-<string name="away_chk_title">Aktivera automatisk frånvaro</string>
-<string name="away_chk_sum">Ändra status till frånvarande när skärmen släcks</string>
-<string name="away_message_title">Frånvaromeddelande</string>
-<string name="away_message_sum">Frånvaromeddelandet som kommer att visas</string>
-<string name="away_message_hint">Jag är frånvarande, telefonens skärm är släckt</string>
-<string name="notification_preferences">Aviseringsinställningar</string>
-<string name="notification_enable_vibrate_title">Aktivera vibration</string>
-<string name="notification_enable_vibrate_sum">Aktivera vibration vid inkommande meddelande</string>
-<string name="notification_snd_title">Meddelandesignal</string>
-<string name="notification_snd_sum">Ange signal för inkommande meddelanden</string>
-<string name="settings_chat_compact">Kompakt chatt</string>
-<string name="settings_chat_compact_sum">Gör chattfönstret kompakt</string>
-<string name="history">Historik</string>
-<string name="history_sum">Markera för att spara chattar på SD-kort</string>
-<string name="chat_preferences">Chatt</string>
-<string name="chat_preferences_sum">Historik, utseende mm.</string>
-<string name="chat_history_path">Sökväg till historik</string>
-<string name="chat_history_path_sum">Konversationer sparas i en mapp på SD-kortet</string>
-<string name="settings_smack_debug">Aktivera XMPP-felsökning</string>
-<string name="settings_full_jid_login">Använd fullständigt JID som användarnamn</string>
-<string name="settings_full_jid_login_sum">Krävs på vissa servrar som Google Talk</string>
-
-<!-- Subscription class -->
-<string name="SubscriptAccept">Prenumeration godkänd</string>
-<string name="SubscriptError">Fel vid prenumeration</string>
-<string name="SubscriptRefused">Prenumeration nekad</string>
-<string name="SubscriptText">%s vill lägga till dig i sin kontaktlista. Godkänner du det?</string>
-<string name="SubscriptTitle">Godkänn kontakt?</string>
-
-<!-- BeemBroadcastReceiver class -->
-<string name="BeemBroadcastReceiverDisconnect">BEEM: Du är frånkopplad</string>
-
-<!-- XmppConnectionAdapter class -->
-<string name="AcceptContactRequest">%s har lagt till dig till sin kontaktlista.</string>
-<string name="AcceptContactRequestFrom">Godkänn att %s kontaktar dig.</string>
-
-<!-- Activities -->
-<string name="edit_settings_name">Beem - Inställningar</string>
-<string name="create_account_name">Beem - Skapa konto</string>
-<string name="contact_list_name">Beem - Kontakter</string>
-<string name="user_info_name">Beem - Användarinfo</string>
-
-<!-- LogAs Activity -->
-<string name="login_menu_settings">Inställningar</string>
-<string name="login_menu_about">Om</string>
-<string name="login_about_title">Beem %s - Om</string>
-<string name="login_about_msg">
-Beem is an EPITECH Innovative Project. Visit us at
-http://www.beem-project.com !
-</string>
-<string name="login_about_button">Stäng</string>
-<string name="login_login_progress">Ansluter. Vänta...</string>
-<string name="login_menu_login">Logga in</string>
-<string name="login_start_msg">Inställningar i menyn</string>
-
-<!-- LoginAnim activity -->
-<string name="loganim_connecting">Ansluter...</string>
-<string name="loganim_authenticating">Verifierar...</string>
-<string name="loganim_login_success">Inloggningen lyckades</string>
-<string name="loganim_login_failed">Inloggningen misslyckades</string>
-
-<!-- EditSettings Activity -->
-<string name="settings_menu_create_account">Skapa konto</string>
-<string name="settings_menu_privacy_lists">Hantera spärrlistor</string>
-<string name="settings_saved_ok">Inställningarna har sparats.</string>
-
-
-
-<!-- EditSettings Activity Categories -->
-<string name="general_preferences">Allmänna inställningar</string>
-<string name="user_preferences">Användaruppgifter (krävs)</string>
-<string name="user_preferences_advanced">Avancerade användarinställningar (valfritt)</string>
-<string name="network_preferences">Nätverksinställningar</string>
-<string name="proxy_proxy_settings">Proxyinställningar</string>
-<string name="proxy_user_settings">Proxyinställningar</string>
-<string name="history_preferences">Historik</string>
-<string name="chat_layout_option">Utseende</string>
-
-
-<!-- EditSettings Activity Tabs -->
-<string name="settings_tab_tag_account">edit_settings_tab_account</string>
-<string name="settings_tab_label_account">Konto</string>
-<string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
-<string name="settings_tab_label_xmpp">XMPP</string>
-<string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
-<string name="settings_tab_label_proxy">Proxy</string>
-
-
-<!-- wizard activities -->
-<string name="account_wizard_text1"><b>Välkommen till BEEM.</b>nnDu har inte konfigurerat något XMPP (Jabber)-konto än.nVälj ett av följande alternativ:</string>
-<string name="account_wizard_configure_text_1">Välj ett konto som finns lagrat på denna enhet</string>
-<string name="account_wizard_configure_text_2"><b>eller</b></string>
-<string name="account_wizard_configure_text_3">Fyll i uppgifterna för ditt befintliga konto</string>
-<string name="account_wizard_settings_warn"><b>Varning: </b>Dina inställningar anger att en proxy eller ett specifikt domännamn ska användas.</string>
-<string name="account_wizard_connection_failed"><b>Det gick inte att logga in på kontot. Se över dina inloggningsuppgifter.</b></string>
-<string name="account_wizard_select_account_btn">Välj konto</string>
-
-<string name="account_wizard_configure_account">Jag har redan ett konto som jag vill använda</string>
-<string name="account_wizard_create_account">Jag vill registrera ett nytt konto</string>
-
-<!-- Create an account Activity -->
-<string name="create_account_text">Fyll i uppgifterna för att skapa kontot</string>
-<string name="create_account_progress_title">Kontot skapas</string>
-<string name="create_account_progress_message">Vänta</string>
-<string name="create_account_err_username">Felaktigt Jabber-ID</string>
-<string name="create_account_err_passwords">Lösenorden är inte lika.</string>
-<string name="create_account_username">Användarnamn</string>
-<string name="create_account_password">Lösenord</string>
-<string name="create_account_confirm_password">Bekräfta lösenordet</string>
-<string name="create_account_err_conflict">Detta konto finns redan. Prova ett ennat.</string>
-<string name="create_account_err_connection">Servern är inte tillgänglig. Prova en annan.</string>
-
-
-<!-- ContactList Activity -->
-<string name="contact_list_menu_add_contact">Lägg till kontakt</string>
-<string name="contact_list_menu_status">Ändra status</string>
-<string name="contact_list_menu_settings">Inställningar</string>
-<string name="contact_list_menu_disconnect">Koppla från</string>
-<string name="contact_list_all_contact">Alla kontakter</string>
-<string name="contact_list_no_group">Ingen grupp</string>
-
-<!-- UserInfo dialog -->
-<string name="userinfo_label_alias">Alias</string>
-<string name="userinfo_label_chg_group">Hantera grupper</string>
-<string name="userinfo_label_re_subscription">Skicka förfrågan igen</string>
-<string name="userinfo_label_block">Spärra</string>
-<string name="userinfo_label_delete">Ta bort</string>
-<string name="userinfo_resend">Skicka prenumeration igen</string>
-<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
-</string>
-<string name="userinfo_yes">Ja</string>
-<string name="userinfo_no">Nej</string>
-<string name="userinfo_sureresend">Är du säker på att du vill skicka förfrågan igen?</string>
-
-<string name="chat_name">Beem - Chatt</string>
-<string name="chat_input_default_value">Skriv meddelande</string>
-<string name="chat_self">Jag</string>
-<string name="chat_error">Fel</string>
-<string name="chat_send_message">Skicka</string>
-<string name="chat_menu_contacts_list">Kontaktlista</string>
-<string name="chat_menu_change_chat">Byt chatt</string>
-<string name="chat_menu_start_otr_session">Aktivera OTR</string>
-<string name="chat_menu_stop_otr_session">Stoppa OTR</string>
-<string name="chat_menu_otr_verify_key">OTR-nyckel</string>
-<string name="chat_menu_otr_submenu">OTR-val</string>
-<string name="chat_dialog_change_chat_title">Öppna chattar</string>
-<string name="chat_menu_close_chat">Stäng den här chatten</string>
-<string name="chat_no_more_chats">Inga fler aktiva chattar</string>
-<string name="chat_state_composing">skriver ett meddelande</string>
-<string name="chat_state_gone">har lämnat samtalet</string>
-<string name="chat_state_active">iakttar samtalet</string>
-<string name="chat_state_inactive">gör något annat</string>
-<string name="chat_otrstate_plaintext">KLARTEXT</string>
-<string name="chat_otrstate_encrypted">KRYPTERAD</string>
-<string name="chat_otrstate_finished">AVSLUTAD</string>
-<string name="chat_otrstate_authenticated">GODKÄND</string>
-<string name="chat_otr_verify_key" formatted="false">
-Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
-To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
-If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
-Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
-
-<string name="contact_status_msg_available">Tillgänglig</string>
-<string name="contact_status_msg_available_chat">Tillgänglig för chatt</string>
-<string name="contact_status_msg_dnd">Stör ej</string>
-<string name="contact_status_msg_away">Frånvarande</string>
-<string name="contact_status_msg_xa">Inte tillgänglig</string>
-<string name="contact_status_msg_offline">Frånkopplad</string>
-
-<string name="privacy_list_name">Beem - Hantera spärrlistor</string>
-<string name="privacy_list_no_data">Det finns inga spärrlistor.</string>
-<string name="privacy_list_menu_create">Skapa spärrlista</string>
-<string name="privacy_list_create_dialog_title">Skapa spärrlista</string>
-<string name="privacy_list_create_dialog_list_name_label">Titel</string>
-<string name="privacy_list_create_dialog_create_button">Skapa</string>
-<string name="privacy_list_select_dialog_buddies">Kontakter</string>
-<string name="privacy_list_select_dialog_groups">Grupper</string>
-<string name="privacy_list_select_dialog_delete">Ta bort</string>
-<string name="privacy_list_delete_dialog_msg">Vill du verkligen ta bort spärrlistan \'%s\'?</string>
-<string name="privacy_list_delete_dialog_yes">Ja</string>
-<string name="privacy_list_delete_dialog_no">Nej</string>
-
-<string name="UpdateButton">Uppdatera</string>
-
-<!-- MemorizingTrustManager library -->
-<string name="mtm_accept_cert">Acceptera okända certifikat?</string>
-<string name="mtm_decision_always">Alltid</string>
-<string name="mtm_decision_once">Den här gången</string>
-<string name="mtm_decision_abort">Avbryt</string>
-
-<string name="mtm_notification">Certifikatkontroll</string>
-
-<!-- Error messages -->
-
-<string name="error_login_authentication">Fel vid inloggning, fel ID eller lösenord.</string>
-
-<string name="interna_server_error">Serverfel</string>
-<string name="bad_request">felaktig begäran</string>
-<string name="forbidden">otillåten</string>
-<string name="item_not_found">hittades inte</string>
-<string name="conflict">konflikt</string>
-<string name="feature_not_implemented">funktionen finns inte</string>
-<string name="gone">borta</string>
-<string name="jid_malformed">felaktigt JID</string>
-<string name="no_acceptable">accepteras inte</string>
-<string name="not_allowed">tillåts inte</string>
-<string name="not_authorized">inte godkänd</string>
-<string name="payment_required">betalning krävs</string>
-<string name="recipient_unavailable">mottagaren ej tillgänglig</string>
-<string name="redirect">vidarebefordra</string>
-<string name="registration_required">registrering krävs</string>
-<string name="remote_server_not_found">Servern hittades inte</string>
-<string name="remote_server_timeout">Servern svarar inte</string>
-<string name="remote_server_error">Serverfel</string>
-<string name="resource_constraint">begränsad instans</string>
-<string name="service_unavailable">tjänsten ej tillgänglig</string>
-<string name="subscription_required">prenumeration krävs</string>
-<string name="undefined_condition">odefinierat tillstånd</string>
-<string name="unexpected_condition">oväntat tillstånd</string>
-<string name="request_timeout">timeout för begäran</string>
-</resources>
--- a/res/values-zh-rCN/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"开心"</item>
- <item msgid="1601611480575517120">"忧伤"</item>
- <item msgid="1531181614218625881">"眨眼"</item>
- <item msgid="3858808057949077894">"吐舌"</item>
- <item msgid="7835238297967185651">"惊讶"</item>
- <item msgid="1756223535005296033">"亲吻"</item>
- <item msgid="1093906245140165107">"叫喊"</item>
- <item msgid="888834839864150170">"酷"</item>
- <item msgid="6320683740534773967">"财迷"</item>
- <item msgid="6610111212478853990">"说错了话"</item>
- <item msgid="1706035208563940251">"尴尬"</item>
- <item msgid="9079275787422313427">"天使"</item>
- <item msgid="4630490399784004880">"犹豫"</item>
- <item msgid="7002574538342357456">"哭泣"</item>
- <item msgid="850324578089267455">"保密"</item>
- <item msgid="6334637439528489607">"大笑"</item>
- <item msgid="7602915122893958066">"困惑"</item>
- <item msgid="3939233701582771068">"爱之心"</item>
- <item msgid="1414759480575851587">"生气"</item>
- <item msgid="8479809115158836070">"傻笑"</item>
- <item msgid="638612939305162424">"一本正经"</item>
- </string-array>
-</resources>
--- a/res/values-zh-rCN/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-<!-- Generic terms -->
-<string name="app_name">Beem</string>
-<string name="OkButton">确定</string>
-<string name="ClearButton">清除</string>
-<string name="CancelButton">取消</string>
-<string name="AcceptButton">认证</string>
-<string name="RefuseButton">拒绝</string>
-<string name="JabberID">Jabber账号 </string>
-<string name="Password">密码</string>
-<string name="Continue">继续</string>
-
-<!-- AccountConfigure class -->
-<string name="AccountConfigureManualConfiguration">手动设置</string>
-
-<!-- Beem class -->
-<string name="BeemJabberID">Jabber账号 </string>
-
-<!-- BeemApplication class -->
-<string name="BeemApplicationConnect">连接中...</string>
-
-<!-- BeemService class -->
-<string name="BeemServiceDescription">使用Beem服务</string>
-<string name="BeemServiceCreated">Beem服务已创建</string>
-<string name="BeemServiceDestroyed">Beem服务已取消</string>
-
-<!-- ContactDialog class -->
-<string name="CDChat">聊天</string>
-<string name="CDCall">呼叫</string>
-<string name="CDInfos">用户管理</string>
-
-<!-- AddContact class -->
-<string name="AddCActTitle">Beem - 添加连接</string>
-
-<string name="AddCLogin">用户名</string>
-<string name="AddCAlias">别名</string>
-<string name="AddCGroup">组</string>
-<string name="AddCOkButton">添加</string>
-<string name="AddCContactAdded">联系人已成功添加</string>
-<string name="AddCContactAddedError">联系人添加错误</string>
-<string name="AddCContactAddedLoginError">登录错误</string>
-<string name="AddCBadForm">格式错误</string>
-<string name="AddCContactAlready">联系人已存在</string>
-
-<!-- ChangeStatus class -->
-<string name="ChangeStatusActTitle">Beem - 改变我的状态</string>
-<string name="ChangeStatusType">我的状态</string>
-<string name="ChangeStatusMessage">我的个人消息</string>
-<string name="OpenContactList">打开联系人列表</string>
-
-<string name="MenuAddContact">添加心联系人</string>
-<string name="MenuAccountAbout">Beem项目</string>
-<string name="MenuAccountCreate">创建账号</string>
-<string name="MenuConnection">编辑账号</string>
-<string name="ChangeStatusOk">更新状态</string>
-<string name="ChangeStatusNoChange">没有东西需要改变</string>
-<string name="my_avatar">我的头像</string>
-<string name="select_avatar">选择头像</string>
-<string name="take_photo">照相</string>
-<string name="pick_photo">选择照片</string>
-<string name="delete_avatar">删除头像</string>
-<string name="photoPickerNotFoundText">找不到照片</string>
-
-
-<!-- Settings class -->
-<string name="SettingsText">修改用户名</string>
-<string name="SettingsPassword">修改密码</string>
-<string name="SettingsProxy">代理</string>
-<string name="SettingsProxyProxy">使用代理服务器</string>
-<string name="SettingsProxySummary">通过代理服务器登录</string>
-<string name="SettingsProxyType">协议</string>
-<string name="SettingsProxyTypeSummary">选择代理类型</string>
-<string name="SettingsProxyServer">修改代理服务器地址</string>
-<string name="SettingsProxyPort">修改地理服务器端口</string>
-<string name="SettingsProxyUser">可选,允许在代理服务器上注册</string>
-<string name="SettingsProxyPassword">可选,允许在代理服务器上注册</string>
-<string name="SettingsAdvanced">高级</string>
-<string name="SettingsAdvancedOptions">特定服务器选项</string>
-<string name="SettingsAdvancedRecoDelay">修改重连延时</string>
-<string name="SettingsAdvancedSpecOpt">勾选此选项以连接到特定的服务器.</string>
-<string name="SettingsAdvancedAddOpt">编辑服务器地址</string>
-<string name="SettingsAdvancedPortOpt">编辑服务器端口</string>
-<string name="SettingsResourceTitle">资源</string>
-<string name="SettingsPriorityTitle">优先级</string>
-<string name="SettingsResourceSummary">设定客户端XMPP资源</string>
-<string name="SettingsPrioritySummary">设定客户端优先级</string>
-<string name="contact_list_preferences">好友列表</string>
-<string name="contact_list_preferences_sum">A set of display options for your buddy list
-</string>
-<string name="CLP_hide_groups">隐藏组</string>
-<string name="CLP_hide_groups_sum">勾选此选项隐藏组</string>
-<string name="CLP_hidden_contact">隐藏好友</string>
-<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
-</string>
-<string name="settings_account_username">用户名</string>
-<string name="login_username_info_default">beem@beem-project.com</string>
-<string name="settings_account_password">密码</string>
-<string name="settings_account_server">服务器</string>
-<string name="settings_account_port">端口</string>
-<string name="settings_advanced_service_behaviour">服务器行为</string>
-<string name="settings_advanced_sum">高级用户设置</string>
-<string name="settings_xmpp_server">地址</string>
-<string name="comments_xmpp_server">example.com</string>
-<string name="settings_xmpp_port">端口</string>
-<string name="settings_xmpp_use_tls">使用SSL/TLS</string>
-<string name="settings_reco_delay">重连延时</string>
-<string name="comments_xmpp_port">默认端口:5222</string>
-<string name="settings_proxy_sum">代理设置</string>
-<string name="settings_proxy_use">使用代理连接</string>
-<string name="settings_proxy_type_prompt">选择代理类型</string>
-<string name="settings_proxy_server">服务器</string>
-<string name="settings_proxy_port">端口</string>
-<string name="comments_proxy_port">默认端口:1080</string>
-<string name="settings_proxy_username">用户名</string>
-<string name="settings_proxy_password">密码</string>
-<string name="away_chk_title">启用自动离开</string>
-<string name="away_chk_sum">当屏幕关闭是将状态改为离开</string>
-<string name="away_message_title">离开留言</string>
-<string name="away_message_sum">将会显示的离开留言</string>
-<string name="away_message_hint">我现在不在,我的手机屏幕关闭了</string>
-<string name="notification_preferences">通知设置</string>
-<string name="notification_enable_vibrate_title">允许振动</string>
-<string name="notification_enable_vibrate_sum">有消息来时振动</string>
-<string name="notification_snd_title">消息提示音</string>
-<string name="notification_snd_sum">设定消息提示音</string>
-<string name="settings_chat_compact">聊天协议</string>
-<string name="settings_chat_compact_sum">设定聊天协议</string>
-<string name="history">历史记录</string>
-<string name="history_sum">保存对话到SD卡</string>
-<string name="history_mount">你需要有已插入设备并可以写入的SD存储来允许历史记录</string>
-<string name="history_on_off">允许历史记录</string>
-<string name="chat_preferences">聊天</string>
-<string name="chat_preferences_sum"></string>
-<string name="chat_history_path">历史路径</string>
-<string name="chat_history_path_sum">对话保存在SD卡上的文件夹中</string>
-<string name="settings_smack_debug">允许XMPPP调试</string>
-<string name="settings_full_jid_login">使用我完整的Jid作为用户名</string>
-<string name="settings_full_jid_login_sum">某些例如Google Talk这样的服务器需要</string>
-
-<!-- Subscription class -->
-<string name="SubscriptAccept">订阅已经接受</string>
-<string name="SubscriptError">订阅错误</string>
-<string name="SubscriptRefused">订阅被拒绝</string>
-<string name="SubscriptText">%s 想要添加你到他/她的好友列表.批准他/她的请求吗?</string>
-<string name="SubscriptTitle">批准好友请求?</string>
-
-<!-- BeemChatManager -->
-<string name="BeemChatManagerNewMessage">你有一个新消息</string>
-
-<!-- BeemBroadcastReceiver class -->
-<string name="BeemBroadcastReceiverDisconnect">BEEM:你的连接已断开</string>
-
-<!-- XmppConnectionAdapter class -->
-<string name="AcceptContactRequest">%s刚将你添加到他/她的好友列表.</string>
-<string name="AcceptContactRequestFrom">批准%s联系你</string>
-
-<!-- Activities -->
-<string name="login_tag">Beem - 登录中</string>
-<string name="edit_settings_name">Beem - 设置</string>
-<string name="edit_settings_tag">Beem - 编制设置</string>
-<string name="create_account_name">Beem - 创建新账号 </string>
-<string name="create_account_tag">Beem - 创建新账号中</string>
-<string name="contact_list_name">Beem - 联系人</string>
-<string name="contact_list_tag">Beem - 联系人列表</string>
-<string name="user_info_name">Beem - 用户信息</string>
-
-<!-- Buttons -->
-<string name="button_create_account">创建这个账户</string>
-<string name="button_create_login_account">创建并使用这个账户</string>
-
-<!-- LogAs Activity -->
-<string name="login_username">用户名</string>
-<string name="login_password">密码</string>
-<string name="login_error_dialog_title">登录 - 错误</string>
-<string name="login_close_dialog_button">关闭</string>
-<string name="login_menu_create_account">创建一个账号</string>
-<string name="login_menu_settings">设置</string>
-<string name="login_menu_about">关于</string>
-<string name="login_about_title">Beem %s - 关于</string>
-<string name="login_about_msg">
-Beem is an EPITECH Innovative Project. Visit us at
-http://www.beem-project.com !
-</string>
-<string name="login_about_button">关闭</string>
-<string name="login_settings_button">设置</string>
-<string name="login_login_button">登录</string>
-<string name="login_login_progress">连接中,请等待...</string>
-<string name="login_error_msg">Unfortunately, an error occured.\n\nError
-detail:\n%s</string>
-<string name="login_menu_login">登陆</string>
-<string name="login_no_connectivity">没有可用连接</string>
-<string name="login_start_msg">菜单设置配置</string>
-
-<!-- LoginAnim activity -->
-<string name="loganim_connecting">连接中...</string>
-<string name="loganim_authenticating">验证中...</string>
-<string name="loganim_login_success">登录成功</string>
-<string name="loganim_login_failed">登录失败</string>
-
-<!-- EditSettings Activity -->
-<string name="settings_menu_create_account">创建一个账号</string>
-<string name="settings_menu_privacy_lists">管理隐私列表</string>
-<string name="settings_saved_ok">设置已成功保存</string>
-
-
-
-<!-- EditSettings Activity Categories -->
-<string name="general_preferences">通用选项</string>
-<string name="user_preferences">用户设置 (必须)</string>
-<string name="user_preferences_advanced">高级用户设置(可选)</string>
-<string name="network_preferences">网络选项</string>
-<string name="proxy_proxy_settings">代理选项</string>
-<string name="proxy_user_settings">代理选项</string>
-<string name="history_preferences">历史</string>
-<string name="chat_layout_option">聊天布局</string>
-
-
-<!-- EditSettings Activity Tabs -->
-<string name="settings_tab_tag_account">编辑账户设定</string>
-<string name="settings_tab_label_account">帐户</string>
-<string name="settings_tab_tag_xmpp">编辑XMPP设置</string>
-<string name="settings_tab_label_xmpp">XMPP</string>
-<string name="settings_tab_tag_proxy">编辑代理设置</string>
-<string name="settings_tab_label_proxy">代理</string>
-
-
-<!-- wizard activities -->
-<string name="account_wizard_text1"><b>欢迎使用BEEM.</b>\n\n您还没有设定XMPP (Jabber)账户.请选择下面的选项。\n请选择下面的选项:</string>
-<string name="account_wizard_configure_text"><b>请输入您已有账号的信息</b></string>
-<string name="account_wizard_configure_account">我想使用我已有的账号</string>
-<string name="account_wizard_create_account">我想创建一个新账号</string>
-
-<!-- Create an account Activity -->
-<string name="create_account_instr_dialog_title">创建新账号 - 向导</string>
-<string name="create_account_err_dialog_title">创建新账号 - 错误</string>
-<string name="create_account_err_dialog_settings_button">修改设置</string>
-<string name="create_account_close_dialog_button">关闭</string>
-<string name="create_account_successfull_after">账号%s已成功创建</string>
-<string name="create_account_err_username">错误的Jabber ID</string>
-<string name="create_account_err_passwords">密码不匹配。</string>
-<string name="create_account_username">用户名</string>
-<string name="create_account_password">密码</string>
-<string name="create_account_confirm_password">确认密码</string>
-
-<!-- ContactList Activity -->
-<string name="contact_list_menu_add_contact">添加联系人</string>
-<string name="contact_list_menu_status">改变状态</string>
-<string name="contact_list_menu_settings">设置</string>
-<string name="contact_list_menu_disconnect">断开连接</string>
-<string name="contact_list_all_contact">所有联系人</string>
-<string name="contact_list_no_group">没有组</string>
-
-<!-- UserInfo dialog -->
-<string name="userinfo_label_alias">别名</string>
-<string name="userinfo_label_chg_group">管理组</string>
-<string name="userinfo_label_re_subscription">重新发送邀请</string>
-<string name="userinfo_label_block">阻止</string>
-<string name="userinfo_label_delete">删除</string>
-<string name="userinfo_resend">重新发送订阅</string>
-<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
-</string>
-<string name="userinfo_yes">是</string>
-<string name="userinfo_no">否</string>
-<string name="userinfo_sureresend">确定要重新发送邀请吗?</string>
-
-<string name="chat_name">Beem - 聊天</string>
-<string name="chat_input_default_value">输入信息</string>
-<string name="chat_self">我</string>
-<string name="chat_error">错误</string>
-<string name="chat_send_message">发送</string>
-<string name="chat_menu_contacts_list">联系人列表</string>
-<string name="chat_menu_change_chat">切换聊天窗口</string>
-<string name="chat_dialog_change_chat_title">打开聊天窗口</string>
-<string name="chat_menu_close_chat">关闭聊天窗口</string>
-<string name="chat_no_more_chats">没有活动的聊天窗口</string>
-<string name="chat_state_composing">正在输入信息</string>
-<string name="chat_state_gone">已经离开了会话</string>
-<string name="chat_state_active">关注会话</string>
-<string name="chat_state_inactive">正在做其他事情</string>
-
-<string name="contact_status_msg_available">我有空</string>
-<string name="contact_status_msg_available_chat">我有空聊天</string>
-<string name="contact_status_msg_dnd">请勿打扰</string>
-<string name="contact_status_msg_away">离开</string>
-<string name="contact_status_msg_xa">没有空</string>
-<string name="contact_status_msg_offline">连接已断开</string>
-
-<string name="privacy_list_name">Beem - 管理我的隐私列表</string>
-<string name="privacy_list_no_data">没有隐私列表</string>
-<string name="privacy_list_menu_create">创建隐私列表</string>
-<string name="privacy_list_create_dialog_title">创建隐私列表</string>
-<string name="privacy_list_create_dialog_list_name_label">标题</string>
-<string name="privacy_list_create_dialog_create_button">创建</string>
-<string name="privacy_list_select_dialog_buddies">好友</string>
-<string name="privacy_list_select_dialog_groups">组</string>
-<string name="privacy_list_select_dialog_delete">删除</string>
-<string name="privacy_list_delete_dialog_msg">确定要删除 \'%s\'隐私列表吗 ?</string>
-<string name="privacy_list_delete_dialog_yes">是</string>
-<string name="privacy_list_delete_dialog_no">否</string>
-
-<string name="UpdateButton">更新</string>
-
-<!-- Error messages -->
-
-<string name="error_login_authentication">验证时发生错误,用户名或者密码错误.</string>
-
-<string name="interna_server_error">远程服务器错误</string>
-<string name="bad_request">错误的请求</string>
-<string name="forbidden">被拒绝</string>
-<string name="item_not_found">项目未找到</string>
-<string name="conflict">冲突</string>
-<string name="feature_not_implemented">功能未实现</string>
-<string name="gone">离开</string>
-<string name="jid_malformed">Jid畸形</string>
-<string name="no_acceptable">无法接受</string>
-<string name="not_allowed">未被允许</string>
-<string name="not_authorized">未验证</string>
-<string name="payment_required">需要付费</string>
-<string name="recipient_unavailable">接收方无响应</string>
-<string name="redirect">重定向</string>
-<string name="registration_required">需要注册</string>
-<string name="remote_server_not_found">未发现远程服务器</string>
-<string name="remote_server_timeout">远程服务器未响应</string>
-<string name="remote_server_error">远程服务器错误</string>
-<string name="resource_constraint">资源限制</string>
-<string name="service_unavailable">暂时无法提供服务</string>
-<string name="subscription_required">需要订阅</string>
-<string name="undefined_condition">未定义的情况</string>
-<string name="unexpected_condition">例外情况</string>
-<string name="request_timeout">请求超时</string>
-</resources>
--- a/res/values-zh-rTW/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string-array name="default_smiley_names">
- <item msgid="1831934949361041701">"開心"</item>
- <item msgid="1601611480575517120">"傷心"</item>
- <item msgid="1531181614218625881">"眨眼"</item>
- <item msgid="3858808057949077894">"吐舌頭"</item>
- <item msgid="7835238297967185651">"驚訝"</item>
- <item msgid="1756223535005296033">"紅唇"</item>
- <item msgid="1093906245140165107">"大喊"</item>
- <item msgid="888834839864150170">"酷"</item>
- <item msgid="6320683740534773967">"滿嘴錢"</item>
- <item msgid="6610111212478853990">"說錯話"</item>
- <item msgid="1706035208563940251">"害羞"</item>
- <item msgid="9079275787422313427">"天使"</item>
- <item msgid="4630490399784004880">"還沒決定"</item>
- <item msgid="7002574538342357456">"嚎啕大哭"</item>
- <item msgid="850324578089267455">"不要告訴別人"</item>
- <item msgid="6334637439528489607">"開懷大笑"</item>
- <item msgid="7602915122893958066">"疑惑"</item>
- <item msgid="3939233701582771068">"愛心"</item>
- <item msgid="1414759480575851587">"生氣"</item>
- <item msgid="8479809115158836070">"傻笑"</item>
- <item msgid="638612939305162424">"撲克臉"</item>
- </string-array>
-</resources>
--- a/res/values-zh-rTW/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-<!-- Generic terms -->
-<string name="app_name">Beem</string>
-<string name="OkButton">确定</string>
-<string name="ClearButton">清除</string>
-<string name="CancelButton">取消</string>
-<string name="AcceptButton">认证</string>
-<string name="RefuseButton">拒绝</string>
-<string name="JabberID">Jabber账号 </string>
-<string name="Password">密码</string>
-<string name="Continue">继续</string>
-
-<!-- AccountConfigure class -->
-<string name="AccountConfigureManualConfiguration">手动设置</string>
-
-<!-- Beem class -->
-<string name="BeemJabberID">Jabber账号 </string>
-
-<!-- BeemApplication class -->
-<string name="BeemApplicationConnect">连接中...</string>
-
-<!-- BeemService class -->
-<string name="BeemServiceDescription">使用Beem服务</string>
-<string name="BeemServiceCreated">Beem服务已创建</string>
-<string name="BeemServiceDestroyed">Beem服务已取消</string>
-
-<!-- ContactDialog class -->
-<string name="CDChat">聊天</string>
-<string name="CDCall">呼叫</string>
-<string name="CDInfos">用户管理</string>
-
-<!-- AddContact class -->
-<string name="AddCActTitle">Beem - 添加连接</string>
-
-<string name="AddCLogin">用户名</string>
-<string name="AddCAlias">别名</string>
-<string name="AddCGroup">组</string>
-<string name="AddCOkButton">添加</string>
-<string name="AddCContactAdded">联系人已成功添加</string>
-<string name="AddCContactAddedError">联系人添加错误</string>
-<string name="AddCContactAddedLoginError">登录错误</string>
-<string name="AddCBadForm">格式错误</string>
-<string name="AddCContactAlready">联系人已存在</string>
-
-<!-- ChangeStatus class -->
-<string name="ChangeStatusActTitle">Beem - 改变我的状态</string>
-<string name="ChangeStatusType">我的状态</string>
-<string name="ChangeStatusMessage">我的个人消息</string>
-<string name="OpenContactList">打开联系人列表</string>
-
-<string name="MenuAddContact">添加心联系人</string>
-<string name="MenuAccountAbout">Beem项目</string>
-<string name="MenuAccountCreate">创建账号</string>
-<string name="MenuConnection">编辑账号</string>
-<string name="ChangeStatusOk">更新状态</string>
-<string name="ChangeStatusNoChange">没有东西需要改变</string>
-<string name="my_avatar">我的头像</string>
-<string name="select_avatar">选择头像</string>
-<string name="take_photo">照相</string>
-<string name="pick_photo">选择照片</string>
-<string name="delete_avatar">删除头像</string>
-<string name="photoPickerNotFoundText">找不到照片</string>
-
-
-<!-- Settings class -->
-<string name="SettingsText">修改用户名</string>
-<string name="SettingsPassword">修改密码</string>
-<string name="SettingsProxy">代理</string>
-<string name="SettingsProxyProxy">使用代理服务器</string>
-<string name="SettingsProxySummary">通过代理服务器登录</string>
-<string name="SettingsProxyType">协议</string>
-<string name="SettingsProxyTypeSummary">选择代理类型</string>
-<string name="SettingsProxyServer">修改代理服务器地址</string>
-<string name="SettingsProxyPort">修改地理服务器端口</string>
-<string name="SettingsProxyUser">可选,允许在代理服务器上注册</string>
-<string name="SettingsProxyPassword">可选,允许在代理服务器上注册</string>
-<string name="SettingsAdvanced">高级</string>
-<string name="SettingsAdvancedOptions">特定服务器选项</string>
-<string name="SettingsAdvancedRecoDelay">修改重连延时</string>
-<string name="SettingsAdvancedSpecOpt">勾选此选项以连接到特定的服务器.</string>
-<string name="SettingsAdvancedAddOpt">编辑服务器地址</string>
-<string name="SettingsAdvancedPortOpt">编辑服务器端口</string>
-<string name="SettingsResourceTitle">资源</string>
-<string name="SettingsPriorityTitle">优先级</string>
-<string name="SettingsResourceSummary">设定客户端XMPP资源</string>
-<string name="SettingsPrioritySummary">设定客户端优先级</string>
-<string name="contact_list_preferences">好友列表</string>
-<string name="contact_list_preferences_sum">A set of display options for your buddy list
-</string>
-<string name="CLP_hide_groups">隐藏组</string>
-<string name="CLP_hide_groups_sum">勾选此选项隐藏组</string>
-<string name="CLP_hidden_contact">隐藏好友</string>
-<string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
-</string>
-<string name="settings_account_username">用户名</string>
-<string name="login_username_info_default">beem@beem-project.com</string>
-<string name="settings_account_password">密码</string>
-<string name="settings_account_server">服务器</string>
-<string name="settings_account_port">端口</string>
-<string name="settings_advanced_service_behaviour">服务器行为</string>
-<string name="settings_advanced_sum">高级用户设置</string>
-<string name="settings_xmpp_server">地址</string>
-<string name="comments_xmpp_server">example.com</string>
-<string name="settings_xmpp_port">端口</string>
-<string name="settings_xmpp_use_tls">使用SSL/TLS</string>
-<string name="settings_reco_delay">重连延时</string>
-<string name="comments_xmpp_port">默认端口:5222</string>
-<string name="settings_proxy_sum">代理设置</string>
-<string name="settings_proxy_use">使用代理连接</string>
-<string name="settings_proxy_type_prompt">选择代理类型</string>
-<string name="settings_proxy_server">服务器</string>
-<string name="settings_proxy_port">端口</string>
-<string name="comments_proxy_port">默认端口:1080</string>
-<string name="settings_proxy_username">用户名</string>
-<string name="settings_proxy_password">密码</string>
-<string name="away_chk_title">启用自动离开</string>
-<string name="away_chk_sum">当屏幕关闭是将状态改为离开</string>
-<string name="away_message_title">离开留言</string>
-<string name="away_message_sum">将会显示的离开留言</string>
-<string name="away_message_hint">我现在不在,我的手机屏幕关闭了</string>
-<string name="notification_preferences">通知设置</string>
-<string name="notification_enable_vibrate_title">允许振动</string>
-<string name="notification_enable_vibrate_sum">有消息来时振动</string>
-<string name="notification_snd_title">消息提示音</string>
-<string name="notification_snd_sum">设定消息提示音</string>
-<string name="settings_chat_compact">聊天协议</string>
-<string name="settings_chat_compact_sum">设定聊天协议</string>
-<string name="history">历史记录</string>
-<string name="history_sum">保存对话到SD卡</string>
-<string name="history_mount">你需要有已插入设备并可以写入的SD存储来允许历史记录</string>
-<string name="history_on_off">允许历史记录</string>
-<string name="chat_preferences">聊天</string>
-<string name="chat_preferences_sum"></string>
-<string name="chat_history_path">历史路径</string>
-<string name="chat_history_path_sum">对话保存在SD卡上的文件夹中</string>
-<string name="settings_smack_debug">允许XMPPP调试</string>
-<string name="settings_full_jid_login">使用我完整的Jid作为用户名</string>
-<string name="settings_full_jid_login_sum">某些例如Google Talk这样的服务器需要</string>
-
-<!-- Subscription class -->
-<string name="SubscriptAccept">订阅已经接受</string>
-<string name="SubscriptError">订阅错误</string>
-<string name="SubscriptRefused">订阅被拒绝</string>
-<string name="SubscriptText">%s 想要添加你到他/她的好友列表.批准他/她的请求吗?</string>
-<string name="SubscriptTitle">批准好友请求?</string>
-
-<!-- BeemChatManager -->
-<string name="BeemChatManagerNewMessage">你有一个新消息</string>
-
-<!-- BeemBroadcastReceiver class -->
-<string name="BeemBroadcastReceiverDisconnect">BEEM:你的连接已断开</string>
-
-<!-- XmppConnectionAdapter class -->
-<string name="AcceptContactRequest">%s刚将你添加到他/她的好友列表.</string>
-<string name="AcceptContactRequestFrom">批准%s联系你</string>
-
-<!-- Activities -->
-<string name="login_tag">Beem - 登录中</string>
-<string name="edit_settings_name">Beem - 设置</string>
-<string name="edit_settings_tag">Beem - 编制设置</string>
-<string name="create_account_name">Beem - 创建新账号 </string>
-<string name="create_account_tag">Beem - 创建新账号中</string>
-<string name="contact_list_name">Beem - 联系人</string>
-<string name="contact_list_tag">Beem - 联系人列表</string>
-<string name="user_info_name">Beem - 用户信息</string>
-
-<!-- Buttons -->
-<string name="button_create_account">创建这个账户</string>
-<string name="button_create_login_account">创建并使用这个账户</string>
-
-<!-- LogAs Activity -->
-<string name="login_username">用户名</string>
-<string name="login_password">密码</string>
-<string name="login_error_dialog_title">登录 - 错误</string>
-<string name="login_close_dialog_button">关闭</string>
-<string name="login_menu_create_account">创建一个账号</string>
-<string name="login_menu_settings">设置</string>
-<string name="login_menu_about">关于</string>
-<string name="login_about_title">Beem %s - 关于</string>
-<string name="login_about_msg">
-Beem is an EPITECH Innovative Project. Visit us at
-http://www.beem-project.com !
-</string>
-<string name="login_about_button">关闭</string>
-<string name="login_settings_button">设置</string>
-<string name="login_login_button">登录</string>
-<string name="login_login_progress">连接中,请等待...</string>
-<string name="login_error_msg">Unfortunately, an error occured.\n\nError
-detail:\n%s</string>
-<string name="login_menu_login">登陆</string>
-<string name="login_no_connectivity">没有可用连接</string>
-<string name="login_start_msg">菜单设置配置</string>
-
-<!-- LoginAnim activity -->
-<string name="loganim_connecting">连接中...</string>
-<string name="loganim_authenticating">验证中...</string>
-<string name="loganim_login_success">登录成功</string>
-<string name="loganim_login_failed">登录失败</string>
-
-<!-- EditSettings Activity -->
-<string name="settings_menu_create_account">创建一个账号</string>
-<string name="settings_menu_privacy_lists">管理隐私列表</string>
-<string name="settings_saved_ok">设置已成功保存</string>
-
-
-
-<!-- EditSettings Activity Categories -->
-<string name="general_preferences">通用选项</string>
-<string name="user_preferences">用户设置 (必须)</string>
-<string name="user_preferences_advanced">高级用户设置(可选)</string>
-<string name="network_preferences">网络选项</string>
-<string name="proxy_proxy_settings">代理选项</string>
-<string name="proxy_user_settings">代理选项</string>
-<string name="history_preferences">历史</string>
-<string name="chat_layout_option">聊天布局</string>
-
-
-<!-- EditSettings Activity Tabs -->
-<string name="settings_tab_tag_account">编辑账户设定</string>
-<string name="settings_tab_label_account">帐户</string>
-<string name="settings_tab_tag_xmpp">编辑XMPP设置</string>
-<string name="settings_tab_label_xmpp">XMPP</string>
-<string name="settings_tab_tag_proxy">编辑代理设置</string>
-<string name="settings_tab_label_proxy">代理</string>
-
-
-<!-- wizard activities -->
-<string name="account_wizard_text1"><b>欢迎使用BEEM.</b>\n\n您还没有设定XMPP (Jabber)账户.请选择下面的选项。\n请选择下面的选项:</string>
-<string name="account_wizard_configure_text"><b>请输入您已有账号的信息</b></string>
-<string name="account_wizard_configure_account">我想使用我已有的账号</string>
-<string name="account_wizard_create_account">我想创建一个新账号</string>
-
-<!-- Create an account Activity -->
-<string name="create_account_instr_dialog_title">创建新账号 - 向导</string>
-<string name="create_account_err_dialog_title">创建新账号 - 错误</string>
-<string name="create_account_err_dialog_settings_button">修改设置</string>
-<string name="create_account_close_dialog_button">关闭</string>
-<string name="create_account_successfull_after">账号%s已成功创建</string>
-<string name="create_account_err_username">错误的Jabber ID</string>
-<string name="create_account_err_passwords">密码不匹配。</string>
-<string name="create_account_username">用户名</string>
-<string name="create_account_password">密码</string>
-<string name="create_account_confirm_password">确认密码</string>
-
-<!-- ContactList Activity -->
-<string name="contact_list_menu_add_contact">添加联系人</string>
-<string name="contact_list_menu_status">改变状态</string>
-<string name="contact_list_menu_settings">设置</string>
-<string name="contact_list_menu_disconnect">断开连接</string>
-<string name="contact_list_all_contact">所有联系人</string>
-<string name="contact_list_no_group">没有组</string>
-
-<!-- UserInfo dialog -->
-<string name="userinfo_label_alias">别名</string>
-<string name="userinfo_label_chg_group">管理组</string>
-<string name="userinfo_label_re_subscription">重新发送邀请</string>
-<string name="userinfo_label_block">阻止</string>
-<string name="userinfo_label_delete">删除</string>
-<string name="userinfo_resend">重新发送订阅</string>
-<string name="userinfo_sure2delete">Are you sure you want to delete this contact?
-</string>
-<string name="userinfo_yes">是</string>
-<string name="userinfo_no">否</string>
-<string name="userinfo_sureresend">确定要重新发送邀请吗?</string>
-
-<string name="chat_name">Beem - 聊天</string>
-<string name="chat_input_default_value">输入信息</string>
-<string name="chat_self">我</string>
-<string name="chat_error">错误</string>
-<string name="chat_send_message">发送</string>
-<string name="chat_menu_contacts_list">联系人列表</string>
-<string name="chat_menu_change_chat">切换聊天窗口</string>
-<string name="chat_dialog_change_chat_title">打开聊天窗口</string>
-<string name="chat_menu_close_chat">关闭聊天窗口</string>
-<string name="chat_no_more_chats">没有活动的聊天窗口</string>
-<string name="chat_state_composing">正在输入信息</string>
-<string name="chat_state_gone">已经离开了会话</string>
-<string name="chat_state_active">关注会话</string>
-<string name="chat_state_inactive">正在做其他事情</string>
-
-<string name="contact_status_msg_available">我有空</string>
-<string name="contact_status_msg_available_chat">我有空聊天</string>
-<string name="contact_status_msg_dnd">请勿打扰</string>
-<string name="contact_status_msg_away">离开</string>
-<string name="contact_status_msg_xa">没有空</string>
-<string name="contact_status_msg_offline">连接已断开</string>
-
-<string name="privacy_list_name">Beem - 管理我的隐私列表</string>
-<string name="privacy_list_no_data">没有隐私列表</string>
-<string name="privacy_list_menu_create">创建隐私列表</string>
-<string name="privacy_list_create_dialog_title">创建隐私列表</string>
-<string name="privacy_list_create_dialog_list_name_label">标题</string>
-<string name="privacy_list_create_dialog_create_button">创建</string>
-<string name="privacy_list_select_dialog_buddies">好友</string>
-<string name="privacy_list_select_dialog_groups">组</string>
-<string name="privacy_list_select_dialog_delete">删除</string>
-<string name="privacy_list_delete_dialog_msg">确定要删除 \'%s\'隐私列表吗 ?</string>
-<string name="privacy_list_delete_dialog_yes">是</string>
-<string name="privacy_list_delete_dialog_no">否</string>
-
-<string name="UpdateButton">更新</string>
-
-<!-- Error messages -->
-
-<string name="error_login_authentication">验证时发生错误,用户名或者密码错误.</string>
-
-<string name="interna_server_error">远程服务器错误</string>
-<string name="bad_request">错误的请求</string>
-<string name="forbidden">被拒绝</string>
-<string name="item_not_found">项目未找到</string>
-<string name="conflict">冲突</string>
-<string name="feature_not_implemented">功能未实现</string>
-<string name="gone">离开</string>
-<string name="jid_malformed">Jid畸形</string>
-<string name="no_acceptable">无法接受</string>
-<string name="not_allowed">未被允许</string>
-<string name="not_authorized">未验证</string>
-<string name="payment_required">需要付费</string>
-<string name="recipient_unavailable">接收方无响应</string>
-<string name="redirect">重定向</string>
-<string name="registration_required">需要注册</string>
-<string name="remote_server_not_found">未发现远程服务器</string>
-<string name="remote_server_timeout">远程服务器未响应</string>
-<string name="remote_server_error">远程服务器错误</string>
-<string name="resource_constraint">资源限制</string>
-<string name="service_unavailable">暂时无法提供服务</string>
-<string name="subscription_required">需要订阅</string>
-<string name="undefined_condition">未定义的情况</string>
-<string name="unexpected_condition">例外情况</string>
-<string name="request_timeout">请求超时</string>
-</resources>
--- a/res/values/arrays.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string-array name="proxy_types">
- <item>HTTP</item>
- <item>SOCKS4</item>
- <item>SOCKS5</item>
- </string-array>
- <string-array name="status_types">
- <item name="AvailableForChat">@string/contact_status_msg_available_chat</item>
- <item name="Available">@string/contact_status_msg_available</item>
- <item name="Busy">@string/contact_status_msg_dnd</item>
- <item name="Away">@string/contact_status_msg_away</item>
- <item name="Unavailable">@string/contact_status_msg_xa</item>
- <item name="Disconnected">@string/contact_status_msg_offline</item>
- </string-array>
- <string-array name="pick_photo_items">
- <item>@string/take_photo</item>
- <item>@string/pick_photo</item>
- <item>@string/delete_avatar</item>
- </string-array>
- <string-array name="loganim_state">
- <item>@string/loganim_connecting</item>
- <item>@string/loganim_authenticating</item>
- <item>@string/loganim_login_success</item>
- <item>@string/loganim_login_failed</item>
- </string-array>
-</resources>
--- a/res/values/colors.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <color name="blue_sky">#A0C8FF</color>
- <color name="vert_manu">#CCFF00</color>
- <color name="black">#000000</color>
- <color name="white">#FFFFFF</color>
- <color name="red">#FF0000</color>
-</resources>
\ No newline at end of file
--- a/res/values/smileys.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2008 Esmertec AG.
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-<resources>
- <!-- NOTE: if you change anything about this array, you must make the corresponding change
- to the array DEFAULT_SMILEY_RES_IDS in MessageListItem.java and to default_smiley_names
- below. -->
- <string-array name="default_smiley_texts" translatable="false">
- <item>:-)</item> <!-- 0: Happy -->
- <item>:-(</item> <!-- 1: Sad -->
- <item>;-)</item> <!-- 2: Winking -->
- <item>:-P</item> <!-- 3: Tongue sticking out -->
- <item>=-O</item> <!-- 4: Surprised -->
- <item>:-*</item> <!-- 5: Kissing -->
- <item>:O</item> <!-- 6: Yelling -->
- <item>B-)</item> <!-- 7: Cool -->
- <item>:-$</item> <!-- 8: Money mouth -->
- <item>:-!</item> <!-- 9: Foot in mouth -->
- <item>:-[</item> <!-- 10: Embarrassed -->
- <item>O:-)</item> <!-- 11: Angel -->
- <item>:-\\</item> <!-- 12: Undecided -->
- <item>:\'(</item> <!-- 13: Crying -->
- <item>:-X</item> <!-- 14: Lips are sealed -->
- <item>:-D</item> <!-- 15: Laughing -->
- <item>o_O</item> <!-- 16: Confused -->
- <item><3</item> <!-- 17: Heart -->
- <item>x-(</item> <!-- 18: Mad -->
- <item>:-/</item> <!-- 19: Smirk -->
- <item>:-I</item> <!-- 20: Poker face -->
- </string-array>
-
- <!-- NOTE: if you change anything about this array, you must make the corresponding change
- to the array DEFAULT_SMILEY_RES_IDS in SmileyParser.java and to default_smiley_texts
- above. -->
- <string-array name="default_smiley_names">
- <item>Happy</item> <!-- 0: :-) -->
- <item>Sad</item> <!-- 1: :-( -->
- <item>Winking</item> <!-- 2: ;-) -->
- <item>Tongue sticking out</item> <!-- 3: :-P -->
- <item>Surprised</item> <!-- 4: =-O -->
- <item>Kissing</item> <!-- 5: :-* -->
- <item>Yelling</item> <!-- 6: :O -->
- <item>Cool</item> <!-- 7: B-) -->
- <item>Money mouth</item> <!-- 8: :-$ -->
- <item>Foot in mouth</item> <!-- 9: :-! -->
- <item>Embarrassed</item> <!-- 10: :-[ -->
- <item>Angel</item> <!-- 11: O:-) -->
- <item>Undecided</item> <!-- 12: :-\\ -->
- <item>Crying</item> <!-- 13: :\'( -->
- <item>Lips are sealed</item> <!-- 14: :-X -->
- <item>Laughing</item> <!-- 15: :-D -->
- <item>Confused</item> <!-- 16: o_O -->
- <item>Heart</item> <!-- 17: <3 -->
- <item>Mad</item> <!-- 18: x-( -->
- <item>Smirk</item> <!-- 19: :-/ -->
- <item>Poker face</item> <!-- 20: :-I -->
- </string-array>
-
-</resources>
--- a/res/values/strings.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- Generic terms -->
- <string name="app_name">Beem</string>
- <string name="OkButton">Ok</string>
- <string name="ClearButton">Clear</string>
- <string name="CancelButton">Cancel</string>
- <string name="AcceptButton">Authorize</string>
- <string name="RefuseButton">Deny</string>
- <string name="JabberID">Jabber ID</string>
- <string name="Password">Password</string>
- <string name="Continue">Continue</string>
-
- <!-- AccountConfigure class -->
- <string name="AccountConfigureManualConfiguration">Manual Configuration</string>
-
- <!-- BeemService class -->
- <string name="BeemServiceDescription">Use Beem Service</string>
-
- <!-- ContactDialog class -->
- <string name="CDChat">Chat</string>
- <string name="CDCall">Call</string>
- <string name="CDInfos">Manage User</string>
-
- <!-- AddContact class -->
- <string name="AddCActTitle">Beem - Add a contact</string>
-
- <string name="AddCLogin">Username</string>
- <string name="AddCAlias">Alias</string>
- <string name="AddCGroup">Group</string>
- <string name="AddCOkButton">Add</string>
- <string name="AddCContactAdded">Contact added</string>
- <string name="AddCContactAddedError">Error Contact not added</string>
- <string name="AddCContactAddedLoginError">Error Login</string>
- <string name="AddCContactAlready">Contact already exist</string>
-
- <!-- ChangeStatus class -->
- <string name="ChangeStatusActTitle">Beem - Change my status</string>
- <string name="ChangeStatusType">My status</string>
- <string name="ChangeStatusMessage">My status message</string>
- <string name="OpenContactList">Open contact list</string>
-
- <string name="ChangeStatusOk">Updating status</string>
- <string name="my_avatar">My avatar</string>
- <string name="select_avatar">Choose your avatar</string>
- <string name="take_photo">Take a photo</string>
- <string name="pick_photo">Select a picture</string>
- <string name="delete_avatar">No avatar</string>
- <string name="photoPickerNotFoundText">Photo picker not found</string>
-
-
- <!-- Settings class -->
- <string name="SettingsProxy">Proxy</string>
- <string name="SettingsProxyProxy">Use a proxy server</string>
- <string name="SettingsProxySummary">Login through a proxy server</string>
- <string name="SettingsProxyType">Protocol</string>
- <string name="SettingsProxyTypeSummary">Choose the proxy server type</string>
- <string name="SettingsProxyServer">Edit proxy server address</string>
- <string name="SettingsProxyPort">Edit proxy server port</string>
- <string name="SettingsProxyUser">Optional, allow to authenticate yourself on the proxy server</string>
- <string name="SettingsProxyPassword">Optional, allow to authenticate yourself on the proxy server</string>
- <string name="SettingsAdvanced">Advanced</string>
- <string name="SettingsAdvancedOptions">Specific server option</string>
- <string name="SettingsAdvancedRecoDelay">Modify reconnection delay</string>
- <string name="SettingsAdvancedSpecOpt">Check this box if you want to use a specific server for your connection</string>
- <string name="SettingsAdvancedAddOpt">Edit the server address</string>
- <string name="SettingsAdvancedPortOpt">Edit the server port</string>
- <string name="SettingsResourceTitle">Resource</string>
- <string name="SettingsPriorityTitle">Priority</string>
- <string name="SettingsResourceSummary">Set the XMPP resource of your client </string>
- <string name="SettingsPrioritySummary">Set the priority of your client</string>
- <string name="contact_list_preferences">Buddy list</string>
- <string name="contact_list_preferences_sum">A set of display options for your buddy list
- </string>
- <string name="CLP_hide_groups">Hide groups</string>
- <string name="CLP_hide_groups_sum">Check this option to hide groups</string>
- <string name="CLP_show_jid">Show JID</string>
- <string name="CLP_show_jid_sum">Check this option to always show Contact\'s JID</string>
- <string name="CLP_hidden_contact">Hide buddies</string>
- <string name="CLP_hidden_contact_sum">Check this option to hide unconnected buddies
- </string>
- <string name="settings_account_username">Username (JID)</string>
- <string name="settings_account_password">Password</string>
- <string name="settings_account_server">Server</string>
- <string name="settings_account_port">Port</string>
- <string name="settings_advanced_service_behaviour">Service behaviour</string>
- <string name="settings_advanced_sum">A set of options for advanced users</string>
- <string name="settings_xmpp_server">Address</string>
- <string name="comments_xmpp_server">example.com</string>
- <string name="settings_xmpp_port">Port</string>
- <string name="settings_xmpp_use_tls">Require SSL/TLS</string>
- <string name="settings_reco_delay">Reconnection delay</string>
- <string name="comments_xmpp_port">Default: 5222</string>
- <string name="settings_proxy_sum">Settings for proxy usage</string>
- <string name="settings_proxy_use">Connect using a proxy</string>
- <string name="settings_proxy_type_prompt">Choose a type of proxy</string>
- <string name="settings_proxy_server">Server</string>
- <string name="settings_proxy_port">Port</string>
- <string name="comments_proxy_port">Default: 1080</string>
- <string name="settings_proxy_username">Username</string>
- <string name="settings_proxy_password">Password</string>
- <string name="away_chk_title">Enable Auto-away</string>
- <string name="away_chk_sum">Change status to Away when the screen is turned off</string>
- <string name="away_message_title">Away message</string>
- <string name="away_message_sum">The away message that will be displayed</string>
- <string name="away_message_hint">I\'m away, my cellphone screen is off</string>
- <string name="notification_preferences">Notification settings</string>
- <string name="notification_enable_vibrate_title">Enable vibrate</string>
- <string name="notification_enable_vibrate_sum">Enable vibrate on incoming messages</string>
- <string name="notification_snd_title">Message ringtone</string>
- <string name="notification_snd_sum">Set your incoming message ringtone</string>
- <string name="settings_chat_compact">Chat compact</string>
- <string name="settings_chat_compact_sum">Set the chat windows compact</string>
- <string name="history">History</string>
- <string name="history_sum">Check this to save chats on the SDCard</string>
- <string name="chat_preferences">Chat</string>
- <string name="chat_preferences_sum">History, Layout size ...</string>
- <string name="chat_history_path">History path</string>
- <string name="chat_history_path_sum">Chat conversations are saved in a folder on the SDCard</string>
- <string name="settings_smack_debug">Enable XMPP debug</string>
- <string name="settings_full_jid_login">Use my full JID as username</string>
- <string name="settings_full_jid_login_sum">Need by some server such as Google Talk</string>
-
- <!-- Subscription class -->
- <string name="SubscriptAccept">Subscription accepted</string>
- <string name="SubscriptError">Subscription error</string>
- <string name="SubscriptRefused">Subscription refused</string>
- <string name="SubscriptText">%s wants to add you to his/her buddy list. Do you want to authorize him/her?</string>
- <string name="SubscriptTitle">Authorize buddy?</string>
-
- <!-- BeemBroadcastReceiver class -->
- <string name="BeemBroadcastReceiverDisconnect">BEEM: You have been disconnected</string>
-
- <!-- XmppConnectionAdapter class -->
- <string name="AcceptContactRequest">%s has just added you to his/her buddy list.</string>
- <string name="AcceptContactRequestFrom">Authorize %s to contact you.</string>
-
- <!-- Activities -->
- <string name="edit_settings_name">Beem - Settings</string>
- <string name="create_account_name">Beem - Create an account</string>
- <string name="contact_list_name">Beem - Contacts</string>
- <string name="user_info_name">Beem - User Info</string>
-
- <!-- LogAs Activity -->
- <string name="login_menu_settings">Settings</string>
- <string name="login_menu_about">About</string>
- <string name="login_about_title">Beem %s - About</string>
- <string name="login_about_msg">
- Beem is an EPITECH Innovative Project. Visit us at
- http://www.beem-project.com !
- </string>
- <string name="login_about_button">Close</string>
- <string name="login_login_progress">Connecting. Please wait...</string>
- <string name="login_menu_login">Login</string>
- <string name="login_start_msg">Settings configuration in menu</string>
-
- <!-- LoginAnim activity -->
- <string name="loganim_connecting">Connecting ...</string>
- <string name="loganim_authenticating">Authenticating ...</string>
- <string name="loganim_login_success">Login success</string>
- <string name="loganim_login_failed">Login failed</string>
-
- <!-- EditSettings Activity -->
- <string name="settings_menu_create_account">Create an account</string>
- <string name="settings_menu_privacy_lists">Manage my privacy lists</string>
- <string name="settings_saved_ok">The settings have been saved successfully.</string>
-
-
-
- <!-- EditSettings Activity Categories -->
- <string name="general_preferences">General preferences</string>
- <string name="user_preferences">Account (required)</string>
- <string name="user_preferences_advanced">User settings advanced (optional)</string>
- <string name="network_preferences">Network options</string>
- <string name="proxy_proxy_settings">Proxy settings</string>
- <string name="proxy_user_settings">Proxy settings</string>
- <string name="history_preferences">History</string>
- <string name="chat_layout_option">Chat layout</string>
-
-
- <!-- EditSettings Activity Tabs -->
- <string name="settings_tab_tag_account">edit_settings_tab_account</string>
- <string name="settings_tab_label_account">Account</string>
- <string name="settings_tab_tag_xmpp">edit_settings_tab_xmpp</string>
- <string name="settings_tab_label_xmpp">XMPP</string>
- <string name="settings_tab_tag_proxy">edit_settings_tab_proxy</string>
- <string name="settings_tab_label_proxy">Proxy</string>
-
-
- <!-- wizard activities -->
- <string name="account_wizard_text1"><b>Welcome on BEEM.</b>\n\nYou have not configured an XMPP (Jabber) account yet.\nChoose one of the following options :</string>
- <string name="account_wizard_configure_text_1">Use an account store on the device</string>
- <string name="account_wizard_configure_text_2"><b>or</b></string>
- <string name="account_wizard_configure_text_3">Fill in the data for your existing account</string>
- <string name="account_wizard_settings_warn"><b>Warning: </b>Your settings are set to use a server proxy or a specific server hostname.</string>
- <string name="account_wizard_connection_failed"><b>Unable to authenticate your account. Please verify your credentials</b></string>
- <string name="account_wizard_select_account_btn">Choose an account</string>
-
- <string name="account_wizard_configure_account">I already have an account I want to use</string>
- <string name="account_wizard_create_account">I want to register for a new account</string>
-
- <!-- Create an account Activity -->
- <string name="create_account_text">Enter the required informations to create your account</string>
- <string name="create_account_progress_title">Account creation</string>
- <string name="create_account_progress_message">Please wait</string>
- <string name="create_account_err_username">Bad JabberID</string>
- <string name="create_account_err_passwords">Passwords do not match.</string>
- <string name="create_account_username">Username</string>
- <string name="create_account_password">Password</string>
- <string name="create_account_confirm_password">Confirm password</string>
- <string name="create_account_err_conflict">This account is already used. Please try another one</string>
- <string name="create_account_err_connection">The selected server is not available. Please try another one</string>
-
-
- <!-- ContactList Activity -->
- <string name="contact_list_menu_add_contact">Add a contact</string>
- <string name="contact_list_menu_status">Change status</string>
- <string name="contact_list_menu_settings">Settings</string>
- <string name="contact_list_menu_disconnect">Disconnect</string>
- <string name="contact_list_all_contact">All contacts</string>
- <string name="contact_list_no_group">No group</string>
-
- <!-- UserInfo dialog -->
- <string name="userinfo_label_alias">Alias</string>
- <string name="userinfo_label_chg_group">Manage groups</string>
- <string name="userinfo_label_re_subscription">Resend invit</string>
- <string name="userinfo_label_block">Block</string>
- <string name="userinfo_label_delete">Delete</string>
- <string name="userinfo_resend">Suscription resend</string>
- <string name="userinfo_sure2delete">Are you sure you want to delete this contact?
- </string>
- <string name="userinfo_yes">Yes</string>
- <string name="userinfo_no">No</string>
- <string name="userinfo_sureresend">Are you sure you want to resend invit?</string>
-
- <string name="chat_name">Beem - Chat</string>
- <string name="chat_input_default_value">Type your message</string>
- <string name="chat_self">Me</string>
- <string name="chat_error">Error</string>
- <string name="chat_send_message">Send</string>
- <string name="chat_menu_contacts_list">Contacts list</string>
- <string name="chat_menu_change_chat">Switch chat</string>
- <string name="chat_menu_start_otr_session">Start OTR session</string>
- <string name="chat_menu_stop_otr_session">Stop OTR session</string>
- <string name="chat_menu_otr_verify_key">OTR verify key</string>
- <string name="chat_menu_otr_submenu">OTR actions</string>
- <string name="chat_dialog_change_chat_title">Opened chats</string>
- <string name="chat_menu_close_chat">Close this chat</string>
- <string name="chat_no_more_chats">No more active chats</string>
- <string name="chat_state_composing">is composing a message</string>
- <string name="chat_state_gone">has left the conversation</string>
- <string name="chat_state_active">pays attention to the conversation</string>
- <string name="chat_state_inactive">is doing another thing</string>
- <string name="chat_otrstate_plaintext">PLAINTEXT</string>
- <string name="chat_otrstate_encrypted">ENCRYPTED</string>
- <string name="chat_otrstate_finished">FINISHED</string>
- <string name="chat_otrstate_authenticated">AUTHENTICATED</string>
- <string name="chat_otr_verify_key" formatted="false">
- Authenticating a buddy helps ensure that the person you are talking to is who they claim to be.\n\n
- To verify the fingerprint, contact your buddy via some <i>other</i> authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other.\n\n
- If everything matches up, you should indicate in the above dialog that you <b>have</b> verified the fingerprint.\n\n
- Local fingerprint %s\n\nRemote fingerprint %s\n\nVerify fingerprint ?</string>
-
- <string name="contact_status_msg_available">Available</string>
- <string name="contact_status_msg_available_chat">Available to chat</string>
- <string name="contact_status_msg_dnd">Do not disturb</string>
- <string name="contact_status_msg_away">Away</string>
- <string name="contact_status_msg_xa">Unavailable</string>
- <string name="contact_status_msg_offline">Disconnected</string>
-
- <string name="privacy_list_name">Beem - Manage my privacy lists</string>
- <string name="privacy_list_no_data">There aren\'t any privacy list registered.</string>
- <string name="privacy_list_menu_create">Create a privacy list</string>
- <string name="privacy_list_create_dialog_title">Create a privacy list</string>
- <string name="privacy_list_create_dialog_list_name_label">Title</string>
- <string name="privacy_list_create_dialog_create_button">Create</string>
- <string name="privacy_list_select_dialog_buddies">Buddies</string>
- <string name="privacy_list_select_dialog_groups">Groups</string>
- <string name="privacy_list_select_dialog_delete">Delete</string>
- <string name="privacy_list_delete_dialog_msg">Do you really want to delete the privacy list entitled \'%s\'?</string>
- <string name="privacy_list_delete_dialog_yes">Yes</string>
- <string name="privacy_list_delete_dialog_no">No</string>
-
- <string name="UpdateButton">Update</string>
-
- <!-- MemorizingTrustManager library -->
- <string name="mtm_accept_cert">Accept Unknown Certificate?</string>
- <string name="mtm_decision_always">Always</string>
- <string name="mtm_decision_once">Once</string>
- <string name="mtm_decision_abort">Abort</string>
-
- <string name="mtm_notification">Certificate Verification</string>
-
- <!-- Error messages -->
-
- <string name="error_login_authentication">Error during authentication, bad login or password.</string>
-
- <string name="interna_server_error">Remote server error</string>
- <string name="bad_request">bad-request</string>
- <string name="forbidden">forbidden</string>
- <string name="item_not_found">item-not-found</string>
- <string name="conflict">conflict</string>
- <string name="feature_not_implemented">feature-not-implemented</string>
- <string name="gone">gone</string>
- <string name="jid_malformed">jid-malformed</string>
- <string name="no_acceptable">no-acceptable</string>
- <string name="not_allowed">not-allowed</string>
- <string name="not_authorized">not-authorized</string>
- <string name="payment_required">payment-required</string>
- <string name="recipient_unavailable">recipient-unavailable</string>
- <string name="redirect">redirect</string>
- <string name="registration_required">registration-required</string>
- <string name="remote_server_not_found">Remote server not found</string>
- <string name="remote_server_timeout">No server response</string>
- <string name="remote_server_error">Remote server error</string>
- <string name="resource_constraint">resource-constraint</string>
- <string name="service_unavailable">service-unavailable</string>
- <string name="subscription_required">subscription-required</string>
- <string name="undefined_condition">undefined-condition</string>
- <string name="unexpected_condition">unexpected-condition</string>
- <string name="request_timeout">request-timeout</string>
-</resources>
--- a/res/values/styles.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="Label">
- <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
- <item name="android:textStyle">bold</item>
- <item name="android:capitalize">characters</item>
- <item name="android:focusable">false</item>
- <item name="android:inputType">textNoSuggestions</item>
- </style>
- <style name="CheckBoxLabel" parent="@style/Label">
- <item name="android:enabled">true</item>
- </style>
- <style name="Theme.BEEM.Default" parent="@android:style/Theme">
-<!-- <item name="android:windowBackground">@drawable/background</item>-->
- </style>
-
-
-<!-- Old PC style -->
-
- <style name="OldTheme">
- <item name="android:textViewStyle" >@style/OldThemeTextView</item>
- </style>
- <style name="OldThemeTextView" parent="@android:style/Widget.TextView">
- <item name="android:textColor">#ff009900</item>
- <item name="android:background">@color/black</item>
- </style>
-
- <style name="TitleStripTextAppearance" parent="@android:style/TextAppearance">
- <item name="android:textSize">18sp</item>
- <item name="android:textStyle">bold</item>
- </style>
-
-
-<!-- Other style -->
-
-</resources>
--- a/res/values/xmpp_server_list.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string-array name="xmpp_server_list">
- <item>0nl1ne.at</item>
- <item>blah.at</item>
- <item>blah.im</item>
- <item>boese-ban.de</item>
- <item>brauchen.info</item>
- <item>chatme.im</item>
- <item>chrome.pl</item>
- <item>climm.org</item>
- <item>coderollers.com</item>
- <item>codingteam.net</item>
- <item>comm.unicate.me</item>
- <item>darkdna.net</item>
- <item>deshalbfrei.org</item>
- <item>draugr.de</item>
- <item>einfachjabber.de</item>
- <item>forumanalogue.fr</item>
- <item>im.apinc.org</item>
- <item>im.flosoft.biz</item>
- <item>internet-exception.de</item>
- <item>jabb3r.net</item>
- <item>jabber-br.org</item>
- <item>jabber-hosting.de</item>
- <item>jabber.at</item>
- <item>jabber.ccc.de</item>
- <item>jabber.chaotic.de</item>
- <item>jabber.co.nz</item>
- <item>jabber.cz</item>
- <item>jabber.de</item>
- <item>jabber.earth.li</item>
- <item>jabber.etighichat.com</item>
- <item>jabber.fourecks.de</item>
- <item>jabber.gate31.net</item>
- <item>jabber.hot-chilli.net</item>
- <item>jabber.i-pobox.net</item>
- <item>jabber.iitsp.com</item>
- <item>jabber.loudas.com</item>
- <item>jabber.me</item>
- <item>jabber.meta.net.nz</item>
- <item>jabber.minus273.org</item>
- <item>jabber.no-sense.net</item>
- <item>jabber.no</item>
- <item>jabber.rootbash.com</item>
- <item>jabber.rueckgr.at</item>
- <item>jabber.scha.de</item>
- <item>jabber.schnied.net</item>
- <item>jabber.second-home.de</item>
- <item>jabber.smash-net.org</item>
- <item>jabber.sow.as</item>
- <item>jabber.theforest.us</item>
- <item>jabber.tmkis.com</item>
- <item>jabber.yeahnah.co.nz</item>
- <item>jabberd.eu</item>
- <item>jabberes.org</item>
- <item>jabbim.com</item>
- <item>jabbim.cz</item>
- <item>jabbim.pl</item>
- <item>jabbim.sk</item>
- <item>jabin.org</item>
- <item>jabme.de</item>
- <item>jabster.pl</item>
- <item>jaim.at</item>
- <item>jappix.com</item>
- <item>jisshi.com</item>
- <item>labnote.org</item>
- <item>lightwitch.org</item>
- <item>limun.org</item>
- <item>macjabber.de</item>
- <item>mayplaces.com</item>
- <item>na-di.de</item>
- <item>neko.im</item>
- <item>netmindz.net</item>
- <item>njs.netlab.cz</item>
- <item>palita.net</item>
- <item>pandion.im</item>
- <item>pidgin.su</item>
- <item>programmer-art.org</item>
- <item>prosody.de</item>
- <item>richim.org</item>
- <item>rkquery.de</item>
- <item>sss.chaoslab.ru</item>
- <item>sternenschweif.de</item>
- <item>swissjabber.ch</item>
- <item>swissjabber.de</item>
- <item>swissjabber.eu</item>
- <item>swissjabber.li</item>
- <item>swissjabber.org</item>
- <item>tcweb.org</item>
- <item>tekst.me</item>
- <item>thiessen.im</item>
- <item>thiessen.it</item>
- <item>thiessen.org</item>
- <item>tigase.im</item>
- <item>twattle.net</item>
- <item>ubuntu-jabber.de</item>
- <item>ubuntu-jabber.net</item>
- <item>univers-libre.net</item>
- <item>verdammung.org</item>
- <item>wtfismyip.com</item>
- <item>xabber.de</item>
- <item>xmpp-hosting.de</item>
- <item>xmpp.jp</item>
- <item>xmppnet.de</item>
- <item>zauris.ru</item>
- <item>zsim.de</item>
- <item>xmpp.kz</item>
- <item>freamware.net</item>
- <item>gabbler.de</item>
- <item>gabbler.eu</item>
- <item>gabbler.org</item>
- <item>hot-chilli.net</item>
- <item>igniterealtime.org</item>
- <item>is-the-shit.com</item>
- <item>jabberheaven.com</item>
- <item>jabberheaven.de</item>
- <item>jabber.rückgr.at</item>
- <item>jabber.se</item>
- <item>jabberus.kz</item>
- <item>jabberzac.org</item>
- <item>vrane.com</item>
- <item>xmpp.ru.net</item>
- <item>gojabber.org</item>
- <item>jabbeng.in</item>
- <item>jabber.gnubox.net</item>
- <item>jabberid.org</item>
- <item>jodo.im</item>
- <item>jsmart.web.id</item>
- <item>linuxlovers.at</item>
- <item>n0g.at</item>
- <item>totalueberwachung.de</item>
- <item>jabber.kiev.ua</item>
- <item>jabbir.org</item>
- <item>j-talk.me</item>
- <item>xmppres.com</item>
- </string-array>
-</resources>
--- a/res/xml/preferences.xml Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
--->
-<!--
- The format of the preference key is defined in
- src/com/beem/project/beem/BeemApplication.java
- Basically it is just a simple name like account_username.
- TODO: There is still a lot of keys to convert
--->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:shouldDisableView="true" android:selectable="true">
- <PreferenceCategory android:title="@string/general_preferences">
- <PreferenceScreen android:key="contact_list"
- android:title="@string/contact_list_preferences" android:summary="@string/contact_list_preferences_sum">
- <CheckBoxPreference android:title="@string/CLP_hidden_contact"
- android:defaultValue="false" android:summary="@string/CLP_hidden_contact_sum"
- android:key="show_offline_contacts" />
- <CheckBoxPreference android:title="@string/CLP_hide_groups"
- android:defaultValue="false" android:summary="@string/CLP_hide_groups_sum"
- android:key="hide_groups" />
- <CheckBoxPreference android:title="@string/CLP_show_jid"
- android:defaultValue="false" android:key="show_jid"
- android:summary="@string/CLP_show_jid_sum"/>
- <CheckBoxPreference android:title="@string/away_chk_title"
- android:defaultValue="true" android:summary="@string/away_chk_sum"
- android:key="use_auto_away" />
- <EditTextPreference android:dependency="use_auto_away"
- android:singleLine="true" android:summary="@string/away_message_sum"
- android:title="@string/away_message_title" android:key="auto_away_msg"
- android:hint="@string/away_message_hint" />
- </PreferenceScreen>
- <PreferenceScreen android:key="chat"
- android:title="@string/chat_preferences" android:summary="@string/chat_preferences_sum">
- <PreferenceCategory android:title="@string/history_preferences">
- <CheckBoxPreference android:id="@+id/chat_history"
- android:title="@string/history" android:summary="@string/history_sum"
- android:defaultValue="false" android:key="settings_key_history" />
- <EditTextPreference android:dependency="settings_key_history"
- android:singleLine="true" android:title="@string/chat_history_path"
- android:summary="@string/chat_history_path_sum" android:key="settings_chat_history_path"
- android:hint="/Android/data/com.beem.project.beem/chat/" />
- </PreferenceCategory>
- <PreferenceCategory android:title="@string/chat_layout_option">
- <CheckBoxPreference android:title="@string/settings_chat_compact"
- android:defaultValue="false" android:summary="@string/settings_chat_compact_sum"
- android:key="use_compact_chat_ui" />
- </PreferenceCategory>
- </PreferenceScreen>
- <PreferenceScreen android:title="@string/notification_preferences">
- <CheckBoxPreference android:title="@string/notification_enable_vibrate_title"
- android:defaultValue="true" android:summary="@string/notification_enable_vibrate_sum"
- android:key="notification_vibrate" />
- <RingtonePreference android:title="@string/notification_snd_title"
- android:key="notification_sound" android:summary="@string/notification_snd_sum"
- android:defaultValue="content://settings/system/notification_sound"
- android:ringtoneType="notification" android:showDefault="true" />
- </PreferenceScreen>
- </PreferenceCategory>
- <PreferenceCategory android:title="@string/user_preferences">
- <Preference android:key="account_username" android:title="@string/settings_account_username">
- <intent android:targetPackage="com.beem.project.beem" android:targetClass="com.beem.project.beem.ui.wizard.Account" />
- </Preference>
- </PreferenceCategory>
- <PreferenceCategory android:title="@string/user_preferences_advanced">
- <EditTextPreference android:key="connection_resource"
- android:title="@string/SettingsResourceTitle" android:summary="@string/SettingsResourceSummary"
- android:defaultValue="Beem" />
- <EditTextPreference android:key="connection_priority"
- android:title="@string/SettingsPriorityTitle" android:summary="@string/SettingsPrioritySummary"
- android:numeric="signed" android:defaultValue="0" />
- </PreferenceCategory>
- <PreferenceCategory android:title="@string/network_preferences">
- <PreferenceScreen android:key="proxy" android:title="@string/SettingsProxy"
- android:summary="@string/settings_proxy_sum">
- <CheckBoxPreference android:title="@string/SettingsProxyProxy"
- android:defaultValue="false" android:summary="@string/SettingsProxySummary"
- android:key="proxy_use" />
- <PreferenceCategory android:title="@string/proxy_proxy_settings">
- <ListPreference android:dependency="proxy_use"
- android:title="@string/SettingsProxyType" android:entries="@array/proxy_types"
- android:summary="@string/SettingsProxyTypeSummary"
- android:defaultValue="HTTP" android:entryValues="@array/proxy_types"
- android:key="proxy_type" />
- <EditTextPreference android:singleLine="true"
- android:dependency="proxy_use" android:name="serveur"
- android:summary="@string/SettingsProxyServer" android:title="@string/settings_proxy_server"
- android:key="proxy_server" />
- <EditTextPreference android:singleLine="true"
- android:dependency="proxy_use" android:name="port"
- android:summary="@string/SettingsProxyPort" android:title="@string/settings_proxy_port"
- android:key="proxy_port" android:numeric="signed"
- android:hint="@string/comments_proxy_port" />
- </PreferenceCategory>
- <PreferenceCategory android:title="@string/proxy_user_settings">
- <EditTextPreference android:singleLine="true"
- android:dependency="proxy_use" android:name="Utilisateur"
- android:summary="@string/SettingsProxyUser" android:title="@string/settings_proxy_username"
- android:key="proxy_username" />
- <EditTextPreference android:singleLine="true"
- android:dependency="proxy_use" android:name="pass_user"
- android:password="true" android:summary="@string/SettingsProxyPassword"
- android:title="@string/settings_proxy_password" android:key="proxy_password" />
- </PreferenceCategory>
- </PreferenceScreen>
-
- <PreferenceScreen android:key="advanced"
- android:title="@string/SettingsAdvanced" android:summary="@string/settings_advanced_sum">
- <PreferenceCategory android:title="@string/settings_advanced_service_behaviour">
- <CheckBoxPreference android:title="@string/settings_xmpp_use_tls"
- android:defaultValue="false" android:key="settings_key_xmpp_tls_use" />
- <CheckBoxPreference android:title="@string/settings_smack_debug"
- android:defaultValue="false" android:key="smack_debug" />
- <EditTextPreference android:singleLine="true"
- android:title="@string/settings_reco_delay" android:name="Reconnect delay"
- android:summary="@string/SettingsAdvancedRecoDelay" android:key="settings_key_reco_delay"
- android:defaultValue="10" />
- </PreferenceCategory>
- <CheckBoxPreference android:title="@string/SettingsAdvancedOptions"
- android:defaultValue="false" android:summary="@string/SettingsAdvancedSpecOpt"
- android:key="account_specific_server" />
- <EditTextPreference android:singleLine="true"
- android:dependency="account_specific_server" android:name="adresse"
- android:summary="@string/SettingsAdvancedAddOpt" android:title="@string/settings_xmpp_server"
- android:key="account_specific_server_host" android:hint="@string/comments_xmpp_server" />
- <EditTextPreference android:singleLine="true"
- android:dependency="account_specific_server" android:name="port"
- android:summary="@string/SettingsAdvancedPortOpt" android:title="@string/settings_xmpp_port"
- android:defaultValue="5222" android:numeric="signed" android:key="account_specific_server_port"
- android:hint="@string/comments_xmpp_port" />
- <CheckBoxPreference android:title="@string/settings_full_jid_login"
- android:defaultValue="false" android:summary="@string/settings_full_jid_login_sum"
- android:key="full_jid_login" />
- </PreferenceScreen>
- </PreferenceCategory>
-</PreferenceScreen>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/settings.gradle Sun Mar 15 18:03:03 2015 +0100
@@ -0,0 +1,1 @@
+include ':app'
--- a/src/com/android/mms/util/SmileyParser.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mms.util;
-
-import java.util.HashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import android.content.Context;
-import android.text.Spannable;
-import android.text.SpannableStringBuilder;
-import android.text.style.ImageSpan;
-
-import com.beem.project.beem.R;
-
-/**
- * A class for annotating a CharSequence with spans to convert textual emoticons
- * to graphical ones.
- */
-public class SmileyParser {
- // Singleton stuff
- private static SmileyParser sInstance;
- public static SmileyParser getInstance() { return sInstance; }
- public static void init(Context context) {
- sInstance = new SmileyParser(context);
- }
-
- private final Context mContext;
- private final String[] mSmileyTexts;
- private final Pattern mPattern;
- private final HashMap<String, Integer> mSmileyToRes;
-
- private SmileyParser(Context context) {
- mContext = context;
- mSmileyTexts = mContext.getResources().getStringArray(DEFAULT_SMILEY_TEXTS);
- mSmileyToRes = buildSmileyToRes();
- mPattern = buildPattern();
- }
-
- static class Smileys {
- private static final int[] sIconIds = {
- R.drawable.emo_im_happy,
- R.drawable.emo_im_sad,
- R.drawable.emo_im_winking,
- R.drawable.emo_im_tongue_sticking_out,
- R.drawable.emo_im_surprised,
- R.drawable.emo_im_kissing,
- R.drawable.emo_im_yelling,
- R.drawable.emo_im_cool,
- R.drawable.emo_im_money_mouth,
- R.drawable.emo_im_foot_in_mouth,
- R.drawable.emo_im_embarrassed,
- R.drawable.emo_im_angel,
- R.drawable.emo_im_undecided,
- R.drawable.emo_im_crying,
- R.drawable.emo_im_lips_are_sealed,
- R.drawable.emo_im_laughing,
- R.drawable.emo_im_wtf,
- R.drawable.emo_im_heart,
- R.drawable.emo_im_mad,
- R.drawable.emo_im_smirk,
- R.drawable.emo_im_pokerface
- };
-
- public static int HAPPY = 0;
- public static int SAD = 1;
- public static int WINKING = 2;
- public static int TONGUE_STICKING_OUT = 3;
- public static int SURPRISED = 4;
- public static int KISSING = 5;
- public static int YELLING = 6;
- public static int COOL = 7;
- public static int MONEY_MOUTH = 8;
- public static int FOOT_IN_MOUTH = 9;
- public static int EMBARRASSED = 10;
- public static int ANGEL = 11;
- public static int UNDECIDED = 12;
- public static int CRYING = 13;
- public static int LIPS_ARE_SEALED = 14;
- public static int LAUGHING = 15;
- public static int WTF = 16;
- public static int MAD = 17;
- public static int HEART = 18;
- public static int SMIRK = 19;
- public static int POKERFACE = 20;
-
- public static int getSmileyResource(int which) {
- return sIconIds[which];
- }
- }
-
- // NOTE: if you change anything about this array, you must make the corresponding change
- // to the string arrays: default_smiley_texts and default_smiley_names in res/values/arrays.xml
- public static final int[] DEFAULT_SMILEY_RES_IDS = {
- Smileys.getSmileyResource(Smileys.HAPPY), // 0
- Smileys.getSmileyResource(Smileys.SAD), // 1
- Smileys.getSmileyResource(Smileys.WINKING), // 2
- Smileys.getSmileyResource(Smileys.TONGUE_STICKING_OUT), // 3
- Smileys.getSmileyResource(Smileys.SURPRISED), // 4
- Smileys.getSmileyResource(Smileys.KISSING), // 5
- Smileys.getSmileyResource(Smileys.YELLING), // 6
- Smileys.getSmileyResource(Smileys.COOL), // 7
- Smileys.getSmileyResource(Smileys.MONEY_MOUTH), // 8
- Smileys.getSmileyResource(Smileys.FOOT_IN_MOUTH), // 9
- Smileys.getSmileyResource(Smileys.EMBARRASSED), // 10
- Smileys.getSmileyResource(Smileys.ANGEL), // 11
- Smileys.getSmileyResource(Smileys.UNDECIDED), // 12
- Smileys.getSmileyResource(Smileys.CRYING), // 13
- Smileys.getSmileyResource(Smileys.LIPS_ARE_SEALED), // 14
- Smileys.getSmileyResource(Smileys.LAUGHING), // 15
- Smileys.getSmileyResource(Smileys.WTF), // 16
- Smileys.getSmileyResource(Smileys.MAD), // 17
- Smileys.getSmileyResource(Smileys.HEART), // 18
- Smileys.getSmileyResource(Smileys.SMIRK), // 19
- Smileys.getSmileyResource(Smileys.POKERFACE), // 20
- };
-
- public static final int DEFAULT_SMILEY_TEXTS = R.array.default_smiley_texts;
- public static final int DEFAULT_SMILEY_NAMES = R.array.default_smiley_names;
-
- /**
- * Builds the hashtable we use for mapping the string version
- * of a smiley (e.g. ":-)") to a resource ID for the icon version.
- */
- private HashMap<String, Integer> buildSmileyToRes() {
- if (DEFAULT_SMILEY_RES_IDS.length != mSmileyTexts.length) {
- // Throw an exception if someone updated DEFAULT_SMILEY_RES_IDS
- // and failed to update arrays.xml
- throw new IllegalStateException("Smiley resource ID/text mismatch");
- }
-
- HashMap<String, Integer> smileyToRes =
- new HashMap<String, Integer>(mSmileyTexts.length);
- for (int i = 0; i < mSmileyTexts.length; i++) {
- smileyToRes.put(mSmileyTexts[i], DEFAULT_SMILEY_RES_IDS[i]);
- }
-
- return smileyToRes;
- }
-
- /**
- * Builds the regular expression we use to find smileys in {@link #addSmileySpans}.
- */
- private Pattern buildPattern() {
- // Set the StringBuilder capacity with the assumption that the average
- // smiley is 3 characters long.
- StringBuilder patternString = new StringBuilder(mSmileyTexts.length * 3);
-
- // Build a regex that looks like (:-)|:-(|...), but escaping the smilies
- // properly so they will be interpreted literally by the regex matcher.
- patternString.append('(');
- for (String s : mSmileyTexts) {
- patternString.append(Pattern.quote(s));
- patternString.append('|');
- }
- // Replace the extra '|' with a ')'
- patternString.replace(patternString.length() - 1, patternString.length(), ")");
-
- return Pattern.compile(patternString.toString());
- }
-
-
- /**
- * Adds ImageSpans to a CharSequence that replace textual emoticons such
- * as :-) with a graphical version.
- *
- * @param text A CharSequence possibly containing emoticons
- * @return A CharSequence annotated with ImageSpans covering any
- * recognized emoticons.
- */
- public CharSequence addSmileySpans(CharSequence text) {
- SpannableStringBuilder builder = new SpannableStringBuilder(text);
-
- Matcher matcher = mPattern.matcher(text);
- while (matcher.find()) {
- int resId = mSmileyToRes.get(matcher.group());
- builder.setSpan(new ImageSpan(mContext, resId),
- matcher.start(), matcher.end(),
- Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- }
-
- return builder;
- }
-}
-
-
--- a/src/com/beem/project/beem/BeemApplication.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-
-package com.beem.project.beem;
-
-import android.app.Application;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.text.TextUtils;
-
-import com.android.mms.util.SmileyParser;
-
-/**
- * This class contains informations that needs to be global in the application.
- * Theses informations must be necessary for the activities and the service.
- * @author Da Risk <darisk972@gmail.com>
- */
-public class BeemApplication extends Application {
-
- /* Constants for PREFERENCE_KEY
- * The format of the Preference key is :
- * $name_KEY = "$name"
- */
- /** Preference key for account username. */
- public static final String ACCOUNT_USERNAME_KEY = "account_username";
- /** Preference key for account password. */
- public static final String ACCOUNT_PASSWORD_KEY = "account_password";
- /** Preference key set to true if using an Android account . */
- public static final String USE_SYSTEM_ACCOUNT_KEY = "use_system_account";
-
- /** Preference key for Android account type . */
- public static final String ACCOUNT_SYSTEM_TYPE_KEY = "account_system_type";
-
- /** Preference key set to true if using specific server details. */
- public static final String ACCOUNT_SPECIFIC_SERVER_KEY = "account_specific_server";
-
- /** Preference key for specific server hostname. */
- public static final String ACCOUNT_SPECIFIC_SERVER_HOST_KEY = "account_specific_server_host";
-
- /** Preference key for specific server port. */
- public static final String ACCOUNT_SPECIFIC_SERVER_PORT_KEY = "account_specific_server_port";
-
- /** Preference key for status (available, busy, away, ...). */
- public static final String STATUS_KEY = "status";
- /** Preference key for status message. */
- public static final String STATUS_TEXT_KEY = "status_text";
- /** Preference key for connection resource . */
- public static final String CONNECTION_RESOURCE_KEY = "connection_resource";
- /** Preference key for connection priority. */
- public static final String CONNECTION_PRIORITY_KEY = "connection_priority";
- /** Preference key for the use of a proxy. */
- public static final String PROXY_USE_KEY = "proxy_use";
- /** Preference key for the type of proxy. */
- public static final String PROXY_TYPE_KEY = "proxy_type";
- /** Preference key for the proxy server. */
- public static final String PROXY_SERVER_KEY = "proxy_server";
- /** Preference key for the proxy port. */
- public static final String PROXY_PORT_KEY = "proxy_port";
- /** Preference key for the proxy username. */
- public static final String PROXY_USERNAME_KEY = "proxy_username";
- /** Preference key for the proxy password. */
- public static final String PROXY_PASSWORD_KEY = "proxy_password";
- /** Preference key for vibrate on notification. */
- public static final String NOTIFICATION_VIBRATE_KEY = "notification_vibrate";
- /** Preference key for notification sound. */
- public static final String NOTIFICATION_SOUND_KEY = "notification_sound";
- /** Preference key for smack debugging. */
- public static final String SMACK_DEBUG_KEY = "smack_debug";
- /** Preference key for full Jid for login. */
- public static final String FULL_JID_LOGIN_KEY = "full_jid_login";
- /** Preference key for display offline contact. */
- public static final String SHOW_OFFLINE_CONTACTS_KEY = "show_offline_contacts";
- /** Preference key for hide the groups. */
- public static final String HIDE_GROUPS_KEY = "hide_groups";
- /** Preference key for auto away enable. */
- public static final String USE_AUTO_AWAY_KEY = "use_auto_away";
- /** Preference key for auto away message. */
- public static final String AUTO_AWAY_MSG_KEY = "auto_away_msg";
- /** Preference key for compact chat ui. */
- public static final String USE_COMPACT_CHAT_UI_KEY = "use_compact_chat_ui";
- /** Preference key for history path on the SDCard. */
- public static final String CHAT_HISTORY_KEY = "settings_chat_history_path";
- /** Preference key to show the jid in the contact list. */
- public static final String SHOW_JID = "show_jid";
-
- //TODO add the other one
-
- private boolean mIsConnected;
- private boolean mIsAccountConfigured;
- private boolean mPepEnabled;
- private SharedPreferences mSettings;
- private final PreferenceListener mPreferenceListener = new PreferenceListener();
-
- /**
- * Constructor.
- */
- public BeemApplication() {
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- mSettings = PreferenceManager.getDefaultSharedPreferences(this);
- String login = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
- String password = mSettings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
- boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
- mIsAccountConfigured = !TextUtils.isEmpty(login) && (useSystemAccount || !TextUtils.isEmpty((password)));
- mSettings.registerOnSharedPreferenceChangeListener(mPreferenceListener);
- SmileyParser.init(this);
- }
-
- @Override
- public void onTerminate() {
- super.onTerminate();
- mSettings.unregisterOnSharedPreferenceChangeListener(mPreferenceListener);
- }
-
- /**
- * Tell if Beem is connected to a XMPP server.
- * @return false if not connected.
- */
- public boolean isConnected() {
- return mIsConnected;
- }
-
- /**
- * Set the status of the connection to a XMPP server of BEEM.
- * @param isConnected set for the state of the connection.
- */
- public void setConnected(boolean isConnected) {
- mIsConnected = isConnected;
- }
-
- /**
- * Tell if a XMPP account is configured.
- * @return false if there is no account configured.
- */
- public boolean isAccountConfigured() {
- return mIsAccountConfigured;
- }
-
- /**
- * Enable Pep in the application context.
- *
- * @param enabled true to enable pep
- */
- public void setPepEnabled(boolean enabled) {
- mPepEnabled = enabled;
- }
-
- /**
- * Check if Pep is enabled.
- *
- * @return true if enabled
- */
- public boolean isPepEnabled() {
- return mPepEnabled;
- }
-
- /**
- * A listener for all the change in the preference file. It is used to maintain the global state of the application.
- */
- private class PreferenceListener implements SharedPreferences.OnSharedPreferenceChangeListener {
-
- /**
- * Constructor.
- */
- public PreferenceListener() {
- }
-
- @Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
- if (BeemApplication.ACCOUNT_USERNAME_KEY.equals(key) || BeemApplication.ACCOUNT_PASSWORD_KEY.equals(key) || BeemApplication.USE_SYSTEM_ACCOUNT_KEY.equals(key)) {
- String login = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
- String password = mSettings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
- boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
- mIsAccountConfigured = !TextUtils.isEmpty(login) && (useSystemAccount || !TextUtils.isEmpty((password)));
- }
- }
- }
-}
--- a/src/com/beem/project/beem/BeemService.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,657 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem;
-
-import java.io.File;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-
-import javax.net.ssl.SSLContext;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.Service;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.net.ConnectivityManager;
-import android.net.Uri;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.preference.PreferenceManager;
-import android.provider.Settings;
-import android.util.Log;
-
-import com.beem.project.beem.service.XmppConnectionAdapter;
-import com.beem.project.beem.service.XmppFacade;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.service.auth.AccountAuthenticator;
-import com.beem.project.beem.service.auth.PreferenceAuthenticator;
-import com.beem.project.beem.smack.avatar.AvatarMetadataProvider;
-import com.beem.project.beem.smack.avatar.AvatarProvider;
-import com.beem.project.beem.smack.ping.PingExtension;
-import com.beem.project.beem.smack.sasl.SASLGoogleOAuth2Mechanism;
-import com.beem.project.beem.smack.sasl.ScramSaslMechanism;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-import com.beem.project.beem.utils.BeemConnectivity;
-import com.beem.project.beem.utils.Status;
-
-import de.duenndns.ssl.MemorizingTrustManager;
-
-import org.jivesoftware.smack.ConnectionConfiguration;
-import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
-import org.jivesoftware.smack.Roster;
-import org.jivesoftware.smack.Roster.SubscriptionMode;
-import org.jivesoftware.smack.SASLAuthentication;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.provider.ProviderManager;
-import org.jivesoftware.smack.proxy.ProxyInfo;
-import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
-import org.jivesoftware.smack.util.StringUtils;
-import org.jivesoftware.smackx.entitycaps.EntityCapsManager;
-import org.jivesoftware.smackx.entitycaps.SimpleDirectoryPersistentCache;
-import org.jivesoftware.smackx.entitycaps.packet.CapsExtension;
-import org.jivesoftware.smackx.packet.ChatStateExtension;
-import org.jivesoftware.smackx.provider.CapsExtensionProvider;
-import org.jivesoftware.smackx.provider.DelayInfoProvider;
-import org.jivesoftware.smackx.provider.DiscoverInfoProvider;
-import org.jivesoftware.smackx.provider.DiscoverItemsProvider;
-import org.jivesoftware.smackx.pubsub.provider.EventProvider;
-import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
-import org.jivesoftware.smackx.pubsub.provider.ItemsProvider;
-import org.jivesoftware.smackx.pubsub.provider.PubSubProvider;
-
-/**
- * This class is for the Beem service.
- * It must contains every global informations needed to maintain the background service.
- * The connection to the xmpp server will be made asynchronously when the service
- * will start.
- * @author darisk
- */
-public class BeemService extends Service {
-
- /** The id to use for status notification. */
- public static final int NOTIFICATION_STATUS_ID = 100;
-
- private static final String TAG = "BeemService";
- private static final int DEFAULT_XMPP_PORT = 5222;
-
- private NotificationManager mNotificationManager;
- private XmppConnectionAdapter mConnection;
- private SharedPreferences mSettings;
- private String mLogin;
- private String mHost;
- private String mService;
- private int mPort;
- private ConnectionConfiguration mConnectionConfiguration;
- private IXmppFacade.Stub mBind;
-
- private BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
- private BeemServiceBroadcastReceiver mOnOffReceiver = new BeemServiceBroadcastReceiver();
- private BeemServicePreferenceListener mPreferenceListener = new BeemServicePreferenceListener();
-
- private boolean mOnOffReceiverIsRegistered;
-
- private SSLContext sslContext;
-
- /**
- * Constructor.
- */
- public BeemService() {
- }
-
- /**
- * Initialize the connection.
- */
- private void initConnectionConfig() {
- // TODO add an option for this ?
-// SmackConfiguration.setPacketReplyTimeout(30000);
- ProxyInfo proxyInfo = getProxyConfiguration();
- boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
- if (useSystemAccount) {
- // when using system account, using SPECIFIC_SERVER settings is not a supported configuration.
- SASLAuthentication.supportSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME);
- String accountType = mSettings.getString(BeemApplication.ACCOUNT_SYSTEM_TYPE_KEY, "");
- String accountName = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
- Account account = getAccount(accountName, accountType);
- if (account == null) {
- mSettings.edit().putString(BeemApplication.ACCOUNT_USERNAME_KEY, "").commit();
- } else
- mConnectionConfiguration = getConnectionConfigurationForAccount(account, proxyInfo);
- }
- if (!useSystemAccount || mConnectionConfiguration == null) {
- SASLAuthentication.unsupportSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME);
- if (mSettings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false))
- mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mService, proxyInfo);
- else
- mConnectionConfiguration = new ConnectionConfiguration(mService, proxyInfo);
- mConnectionConfiguration.setCallbackHandler(new PreferenceAuthenticator(this));
- }
-
- if (mSettings.getBoolean("settings_key_xmpp_tls_use", false)
- || mSettings.getBoolean("settings_key_gmail", false)) {
- mConnectionConfiguration.setSecurityMode(SecurityMode.required);
- }
- if (mSettings.getBoolean(BeemApplication.SMACK_DEBUG_KEY, false))
- mConnectionConfiguration.setDebuggerEnabled(true);
- mConnectionConfiguration.setSendPresence(false);
- mConnectionConfiguration.setRosterLoadedAtLogin(false);
- // maybe not the universal path, but it works on most devices (Samsung Galaxy, Google Nexus One)
- mConnectionConfiguration.setTruststoreType("BKS");
- mConnectionConfiguration.setTruststorePath("/system/etc/security/cacerts.bks");
- if (sslContext != null)
- mConnectionConfiguration.setCustomSSLContext(sslContext);
- }
-
- /**
- * Get the save proxy configuration.
- *
- * @return the proxy configuration
- */
- private ProxyInfo getProxyConfiguration() {
- boolean useProxy = mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
- if (useProxy) {
- String stype = mSettings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
- String phost = mSettings.getString(BeemApplication.PROXY_SERVER_KEY, "");
- String puser = mSettings.getString(BeemApplication.PROXY_USERNAME_KEY, "");
- String ppass = mSettings.getString(BeemApplication.PROXY_PASSWORD_KEY, "");
- int pport = Integer.parseInt(mSettings.getString(BeemApplication.PROXY_PORT_KEY, "1080"));
- ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
- return new ProxyInfo(type, phost, pport, puser, ppass);
- } else {
- return ProxyInfo.forNoProxy();
- }
- }
-
- /**
- * Get the connection configuration for an Android system account.
- *
- * @param account the Android account
- * @param proxy the proxy to use
- * @return the ConnectionConfiguration or null if the account is not supported
- */
- private ConnectionConfiguration getConnectionConfigurationForAccount(Account account, ProxyInfo proxy) {
- ConnectionConfiguration result = null;
- if ("com.google".equals(account.type)) {
- result = new ConnectionConfiguration("talk.google.com", DEFAULT_XMPP_PORT, proxy);
- result.setServiceName(StringUtils.parseServer(account.name));
- result.setCallbackHandler(new AccountAuthenticator(this, account));
- result.setSecurityMode(SecurityMode.required);
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IBinder onBind(Intent intent) {
- Log.d(TAG, "ONBIND()");
- return mBind;
- }
-
- @Override
- public boolean onUnbind(Intent intent) {
- Log.d(TAG, "ONUNBIND()");
- if (mConnection != null && !mConnection.getAdaptee().isConnected()) {
- this.stopSelf();
- }
- return true;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onCreate() {
- super.onCreate();
- registerReceiver(mReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
- mSettings = PreferenceManager.getDefaultSharedPreferences(this);
- mSettings.registerOnSharedPreferenceChangeListener(mPreferenceListener);
- if (mSettings.getBoolean(BeemApplication.USE_AUTO_AWAY_KEY, false)) {
- mOnOffReceiverIsRegistered = true;
- registerReceiver(mOnOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
- registerReceiver(mOnOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_ON));
- }
- String tmpJid = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "").trim();
- mLogin = StringUtils.parseName(tmpJid);
- boolean useSystemAccount = mSettings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
- mPort = DEFAULT_XMPP_PORT;
- mService = StringUtils.parseServer(tmpJid);
- mHost = mService;
- initMemorizingTrustManager();
-
- if (mSettings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false)) {
- mHost = mSettings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_HOST_KEY, "").trim();
- if ("".equals(mHost))
- mHost = mService;
- String tmpPort = mSettings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_PORT_KEY, "5222");
- if (!"".equals(tmpPort))
- mPort = Integer.parseInt(tmpPort);
- }
- if (mSettings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false)
- || "gmail.com".equals(mService) || "googlemail.com".equals(mService)
- || useSystemAccount) {
- mLogin = tmpJid;
- }
-
- configure(ProviderManager.getInstance());
-
- mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
-
- Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
- mBind = new XmppFacade(this);
- Log.d(TAG, "Create BeemService");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onDestroy() {
- super.onDestroy();
- mNotificationManager.cancelAll();
- unregisterReceiver(mReceiver);
- mSettings.unregisterOnSharedPreferenceChangeListener(mPreferenceListener);
- if (mOnOffReceiverIsRegistered)
- unregisterReceiver(mOnOffReceiver);
- if (mConnection.isAuthentificated() && BeemConnectivity.isConnected(this))
- mConnection.disconnect();
- Log.i(TAG, "Stopping the service");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onStart(Intent intent, int startId) {
- super.onStart(intent, startId);
- Log.d(TAG, "onStart");
- createConnectAsync();
- }
-
- /**
- * Create the XmppConnectionAdapter.
- * This method makes a network request so it must not be called on the main thread.
- * @return the connection
- */
- public XmppConnectionAdapter createConnection() {
- if (mConnection == null) {
- initConnectionConfig();
- mConnection = new XmppConnectionAdapter(mConnectionConfiguration, mLogin, null, this);
- }
- return mConnection;
- }
-
- /**
- * Show a notification using the preference of the user.
- * @param id the id of the notification.
- * @param notif the notification to show
- */
- public void sendNotification(int id, Notification notif) {
- if (mSettings.getBoolean(BeemApplication.NOTIFICATION_VIBRATE_KEY, true))
- notif.defaults |= Notification.DEFAULT_VIBRATE;
- notif.ledARGB = 0xff0000ff; // Blue color
- notif.ledOnMS = 1000;
- notif.ledOffMS = 1000;
- notif.flags |= Notification.FLAG_SHOW_LIGHTS;
- String ringtoneStr = mSettings.getString(BeemApplication.NOTIFICATION_SOUND_KEY,
- Settings.System.DEFAULT_NOTIFICATION_URI.toString());
- notif.sound = Uri.parse(ringtoneStr);
- mNotificationManager.notify(id, notif);
- }
-
- /**
- * Delete a notification.
- * @param id the id of the notification
- */
- public void deleteNotification(int id) {
- mNotificationManager.cancel(id);
- }
-
- /**
- * Reset the status to online after a disconnect.
- */
- public void resetStatus() {
- Editor edit = mSettings.edit();
- edit.putInt(BeemApplication.STATUS_KEY, 1);
- edit.commit();
- }
-
- /**
- * Initialize Jingle from an XmppConnectionAdapter.
- * @param adaptee XmppConnection used for jingle.
- */
- public void initJingle(XMPPConnection adaptee) {
- }
-
- /**
- * Return a bind to an XmppFacade instance.
- * @return IXmppFacade a bind to an XmppFacade instance
- */
- public IXmppFacade getBind() {
- return mBind;
- }
-
- /**
- * Get the preference of the service.
- * @return the preference
- */
- public SharedPreferences getServicePreference() {
- return mSettings;
- }
-
- /**
- * Get the notification manager system service.
- * @return the notification manager service.
- */
- public NotificationManager getNotificationManager() {
- return mNotificationManager;
- }
-
- /**
- * Utility method to create and make a connection asynchronously.
- */
- private synchronized void createConnectAsync() {
- if (mConnection == null) {
- new Thread(new Runnable() {
-
- @Override
- public void run() {
- createConnection();
- connectAsync();
- }
- }).start();
- } else
- connectAsync();
- }
-
- /**
- * Utility method to connect asynchronously.
- */
- private void connectAsync() {
- try {
- mConnection.connectAsync();
- } catch (RemoteException e) {
- Log.w(TAG, "unable to connect", e);
- }
- }
-
- /**
- * Get the specified Android account.
- *
- * @param accountName the account name
- * @param accountType the account type
- *
- * @return the account or null if it does not exist
- */
- private Account getAccount(String accountName, String accountType) {
- AccountManager am = AccountManager.get(this);
- for (Account a : am.getAccountsByType(accountType)) {
- if (a.name.equals(accountName)) {
- return a;
- }
- }
- return null;
- }
-
- /**
- * Install the MemorizingTrustManager in the ConnectionConfiguration of Smack.
- */
- private void initMemorizingTrustManager() {
- try {
- sslContext = SSLContext.getInstance("TLS");
- sslContext.init(null, MemorizingTrustManager.getInstanceList(this),
- new java.security.SecureRandom());
- } catch (GeneralSecurityException e) {
- Log.w(TAG, "Unable to use MemorizingTrustManager", e);
- }
- }
-
- /**
- * A sort of patch from this thread: http://www.igniterealtime.org/community/thread/31118. Avoid ClassCastException
- * by bypassing the classloading shit of Smack.
- * @param pm The ProviderManager.
- */
- private void configure(ProviderManager pm) {
- Log.d(TAG, "configure");
- // Service Discovery # Items
- pm.addIQProvider("query", "http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
- // Service Discovery # Info
- pm.addIQProvider("query", "http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
-
- // Privacy
- //pm.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider());
- // Delayed Delivery only the new version
- pm.addExtensionProvider("delay", "urn:xmpp:delay", new DelayInfoProvider());
-
- // Service Discovery # Items
- pm.addIQProvider("query", "http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
- // Service Discovery # Info
- pm.addIQProvider("query", "http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
-
- // Chat State
- ChatStateExtension.Provider chatState = new ChatStateExtension.Provider();
- pm.addExtensionProvider("active", "http://jabber.org/protocol/chatstates", chatState);
- pm.addExtensionProvider("composing", "http://jabber.org/protocol/chatstates",
- chatState);
- pm.addExtensionProvider("paused", "http://jabber.org/protocol/chatstates", chatState);
- pm.addExtensionProvider("inactive", "http://jabber.org/protocol/chatstates", chatState);
- pm.addExtensionProvider("gone", "http://jabber.org/protocol/chatstates", chatState);
- // capabilities
- pm.addExtensionProvider(CapsExtension.NODE_NAME, CapsExtension.XMLNS, new CapsExtensionProvider());
-
- //Pubsub
- pm.addIQProvider("pubsub", "http://jabber.org/protocol/pubsub", new PubSubProvider());
- pm.addExtensionProvider("items", "http://jabber.org/protocol/pubsub", new ItemsProvider());
- pm.addExtensionProvider("items", "http://jabber.org/protocol/pubsub", new ItemsProvider());
- pm.addExtensionProvider("item", "http://jabber.org/protocol/pubsub", new ItemProvider());
-
- pm.addExtensionProvider("items", "http://jabber.org/protocol/pubsub#event", new ItemsProvider());
- pm.addExtensionProvider("item", "http://jabber.org/protocol/pubsub#event", new ItemProvider());
- pm.addExtensionProvider("event", "http://jabber.org/protocol/pubsub#event", new EventProvider());
- //TODO rajouter les manquants pour du full pubsub
-
-
- //PEP avatar
- pm.addExtensionProvider("metadata", "urn:xmpp:avatar:metadata", new AvatarMetadataProvider());
- pm.addExtensionProvider("data", "urn:xmpp:avatar:data", new AvatarProvider());
-
-// PEPProvider pep = new PEPProvider();
-// AvatarMetadataProvider avaMeta = new AvatarMetadataProvider();
-// pep.registerPEPParserExtension("urn:xmpp:avatar:metadata", avaMeta);
-// pm.addExtensionProvider("event", "http://jabber.org/protocol/pubsub#event", pep);
-
- // ping
- pm.addIQProvider(PingExtension.ELEMENT, PingExtension.NAMESPACE, PingExtension.class);
-
- /*
- // Private Data Storage
- pm.addIQProvider("query", "jabber:iq:private", new PrivateDataManager.PrivateDataIQProvider());
- // Time
- try {
- pm.addIQProvider("query", "jabber:iq:time", Class.forName("org.jivesoftware.smackx.packet.Time"));
- } catch (ClassNotFoundException e) {
- Log.w("TestClient", "Can't load class for org.jivesoftware.smackx.packet.Time");
- }
- // Roster Exchange
- pm.addExtensionProvider("x", "jabber:x:roster", new RosterExchangeProvider());
- // Message Events
- pm.addExtensionProvider("x", "jabber:x:event", new MessageEventProvider());
- // XHTML
- pm.addExtensionProvider("html", "http://jabber.org/protocol/xhtml-im", new XHTMLExtensionProvider());
- // Group Chat Invitations
- pm.addExtensionProvider("x", "jabber:x:conference", new GroupChatInvitation.Provider());
- // Data Forms
- pm.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());
- // MUC User
- pm.addExtensionProvider("x", "http://jabber.org/protocol/muc#user", new MUCUserProvider());
- // MUC Admin
- pm.addIQProvider("query", "http://jabber.org/protocol/muc#admin", new MUCAdminProvider());
- // MUC Owner
- pm.addIQProvider("query", "http://jabber.org/protocol/muc#owner", new MUCOwnerProvider());
- // Version
- try {
- pm.addIQProvider("query", "jabber:iq:version", Class.forName("org.jivesoftware.smackx.packet.Version"));
- } catch (ClassNotFoundException e) {
- // Not sure what's happening here.
- Log.w("TestClient", "Can't load class for org.jivesoftware.smackx.packet.Version");
- }
- // VCard
- pm.addIQProvider("vCard", "vcard-temp", new VCardProvider());
- // Offline Message Requests
- pm.addIQProvider("offline", "http://jabber.org/protocol/offline", new OfflineMessageRequest.Provider());
- // Offline Message Indicator
- pm.addExtensionProvider("offline", "http://jabber.org/protocol/offline", new OfflineMessageInfo.Provider());
- // Last Activity
- pm.addIQProvider("query", "jabber:iq:last", new LastActivity.Provider());
- // User Search
- pm.addIQProvider("query", "jabber:iq:search", new UserSearch.Provider());
- // SharedGroupsInfo
- pm.addIQProvider("sharedgroup", "http://www.jivesoftware.org/protocol/sharedgroup",
- new SharedGroupsInfo.Provider());
- // JEP-33: Extended Stanza Addressing
- pm.addExtensionProvider("addresses", "http://jabber.org/protocol/address", new MultipleAddressesProvider());
- // FileTransfer
- pm.addIQProvider("si", "http://jabber.org/protocol/si", new StreamInitiationProvider());
- pm.addIQProvider("query", "http://jabber.org/protocol/bytestreams", new BytestreamsProvider());
- pm.addIQProvider("open", "http://jabber.org/protocol/ibb", new IBBProviders.Open());
- pm.addIQProvider("close", "http://jabber.org/protocol/ibb", new IBBProviders.Close());
- pm.addExtensionProvider("data", "http://jabber.org/protocol/ibb", new IBBProviders.Data());
-
- pm.addIQProvider("command", COMMAND_NAMESPACE, new AdHocCommandDataProvider());
- pm.addExtensionProvider("malformed-action", COMMAND_NAMESPACE,
- new AdHocCommandDataProvider.MalformedActionError());
- pm.addExtensionProvider("bad-locale", COMMAND_NAMESPACE,
- new AdHocCommandDataProvider.BadLocaleError());
- pm.addExtensionProvider("bad-payload", COMMAND_NAMESPACE,
- new AdHocCommandDataProvider.BadPayloadError());
- pm.addExtensionProvider("bad-sessionid", COMMAND_NAMESPACE,
- new AdHocCommandDataProvider.BadSessionIDError());
- pm.addExtensionProvider("session-expired", COMMAND_NAMESPACE,
- new AdHocCommandDataProvider.SessionExpiredError());
- */
-
- /* register additionnals sasl mechanisms */
- SASLAuthentication.registerSASLMechanism(SASLGoogleOAuth2Mechanism.MECHANISM_NAME,
- SASLGoogleOAuth2Mechanism.class);
- SASLAuthentication.registerSASLMechanism(ScramSaslMechanism.MECHANISM_NAME,
- ScramSaslMechanism.class);
-
- SASLAuthentication.supportSASLMechanism(ScramSaslMechanism.MECHANISM_NAME);
- // Configure entity caps manager. This must be done only once
- File f = new File(getCacheDir(), "entityCaps");
- f.mkdirs();
- try {
- EntityCapsManager.setPersistentCache(new SimpleDirectoryPersistentCache(f));
- } catch (IllegalStateException e) {
- Log.v(TAG, "EntityCapsManager already initialized", e);
- } catch (IOException e) {
- Log.w(TAG, "EntityCapsManager not able to reuse persistent cache");
- }
- }
-
- /**
- * Listen on preference changes.
- */
- private class BeemServicePreferenceListener implements SharedPreferences.OnSharedPreferenceChangeListener {
-
- /**
- * ctor.
- */
- public BeemServicePreferenceListener() {
- }
-
- @Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
- if (BeemApplication.USE_AUTO_AWAY_KEY.equals(key)) {
- if (sharedPreferences.getBoolean(BeemApplication.USE_AUTO_AWAY_KEY, false)) {
- mOnOffReceiverIsRegistered = true;
- registerReceiver(mOnOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
- registerReceiver(mOnOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_ON));
- } else {
- mOnOffReceiverIsRegistered = false;
- unregisterReceiver(mOnOffReceiver);
- }
- }
- }
- }
-
- /**
- * Listen on some Intent broadcast, ScreenOn and ScreenOff.
- */
- private class BeemServiceBroadcastReceiver extends BroadcastReceiver {
-
- private String mOldStatus;
- private int mOldMode;
-
- /**
- * Constructor.
- */
- public BeemServiceBroadcastReceiver() {
- }
-
- @Override
- public void onReceive(final Context context, final Intent intent) {
- String intentAction = intent.getAction();
- if (intentAction.equals(Intent.ACTION_SCREEN_OFF)) {
- mOldMode = mConnection.getPreviousMode();
- mOldStatus = mConnection.getPreviousStatus();
- if (mConnection.isAuthentificated())
- mConnection.changeStatus(Status.CONTACT_STATUS_AWAY,
- mSettings.getString(BeemApplication.AUTO_AWAY_MSG_KEY, "Away"));
- } else if (intentAction.equals(Intent.ACTION_SCREEN_ON)) {
- if (mConnection.isAuthentificated())
- mConnection.changeStatus(mOldMode, mOldStatus);
- }
- }
- }
-}
-
--- a/src/com/beem/project/beem/otr/BeemOtrManager.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.otr;
-
-import java.io.IOException;
-import java.security.KeyPair;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.java.otr4j.OtrEngine;
-import net.java.otr4j.OtrEngineHost;
-import net.java.otr4j.OtrEngineImpl;
-import net.java.otr4j.OtrEngineListener;
-import net.java.otr4j.OtrException;
-import net.java.otr4j.OtrKeyManagerImpl;
-import net.java.otr4j.OtrPolicy;
-import net.java.otr4j.OtrPolicyImpl;
-import net.java.otr4j.session.SessionID;
-import net.java.otr4j.session.SessionStatus;
-import android.util.Log;
-
-import com.beem.project.beem.service.ChatAdapter;
-
-/**
- * BeemOtrManager.
- */
-public class BeemOtrManager implements OtrEngineHost {
-
- private static final String TAG = "BeemOtrEngineHostImpl";
- private static BeemOtrManager INSTANCE;
- //We will have a global policy for Beem as long as we won't need to modify the policy per chat.
- private static final OtrPolicy mGlobalPolicy = new OtrPolicyImpl(OtrPolicy.ALLOW_V2 | OtrPolicy.ERROR_START_AKE);
-
- private OtrEngine mOtrEngine;
- private OtrKeyManagerImpl mOtrKeyManager;
-
- //Map of chat, needed because of the message injection
- private final Map<SessionID, ChatAdapter> mChats = new HashMap<SessionID, ChatAdapter>();
-
- /**
- * Private constructor prevents instantiation from other classes.
- */
- private BeemOtrManager() {
- mOtrEngine = new OtrEngineImpl(this);
- mOtrEngine.addOtrEngineListener(new BeemOtrListener());
- try {
- mOtrKeyManager = new OtrKeyManagerImpl("/sdcard/beem.keystore");
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * getOtrManager.
- * @return OtrEngine
- */
- public OtrEngine getOtrManager() {
- return mOtrEngine;
- }
-
- /**
- * BeemOtrManager.getInstance.
- * @return BeemOtrManager
- */
- public static BeemOtrManager getInstance() {
- if (INSTANCE == null)
- INSTANCE = new BeemOtrManager();
- return INSTANCE;
- }
-
- /**
- * We must call addChat before stating a new otr session because we will need the chat instance for message
- * injection.
- * @param sessionID the otr sessionID.
- * @param chat instance.
- */
- public void addChat(final SessionID sessionID, final ChatAdapter chat) {
- mChats.put(sessionID, chat);
- Log.d(TAG, "adding new OTR session " + sessionID);
- }
-
- /**
- * We must remove the chat from the map after we ended the corresponding otr session.
- * @param sessionID the otr sessionID to remove.
- */
- public void removeChat(final SessionID sessionID) {
- mChats.remove(sessionID);
- }
-
- /**
- * get the fingerprint of the remote part.
- * @param sessionID the otr session
- * @return a string containing the fingerprint
- */
- public String getRemoteFingerprint(final SessionID sessionID) {
- return mOtrKeyManager.getRemoteFingerprint(sessionID);
- }
-
- /**
- * set the remote fingerprint as verified.
- * @param sessionId the current otr session
- */
- public void verifyRemoteFingerprint(final SessionID sessionId) {
- mOtrKeyManager.verify(sessionId);
- }
-
- /**
- * unsetthe remote fingerprint as verified.
- * @param sessionId the current otr session
- */
- public void unverifyRemoteFingerprint(final SessionID sessionId) {
- mOtrKeyManager.unverify(sessionId);
- }
-
- /**
- * get the local fingerprint.
- * @param sessionID the otr session
- * @return a string containing the fingerprint
- */
- public String getLocalFingerprint(final SessionID sessionID) {
- return mOtrKeyManager.getLocalFingerprint(sessionID);
- }
-
- @Override
- public void injectMessage(SessionID sessionID, String msg) {
- ChatAdapter chat = mChats.get(sessionID);
- chat.injectMessage(msg);
- }
-
- @Override
- public void showWarning(SessionID sessionID, String warning) {
- Log.d(TAG, "Warning for " + sessionID + " : " + warning);
- }
-
- @Override
- public void showError(SessionID sessionID, String error) {
- Log.d(TAG, "Error for " + sessionID + " : " + error);
- }
-
- @Override
- public OtrPolicy getSessionPolicy(SessionID sessionID) {
- return mGlobalPolicy;
- }
-
- @Override
- public KeyPair getKeyPair(SessionID sessionID) {
- KeyPair kp = mOtrKeyManager.loadLocalKeyPair(sessionID);
-
- if (kp != null)
- return kp;
-
- mOtrKeyManager.generateLocalKeyPair(sessionID);
- return mOtrKeyManager.loadLocalKeyPair(sessionID);
- }
-
- /**
- * BeemOtrListener.
- */
- private class BeemOtrListener implements OtrEngineListener {
-
- @Override
- public void sessionStatusChanged(final SessionID sessionID) {
- Log.d(TAG, "OTR Status changed for " + sessionID + " : " + mOtrEngine.getSessionStatus(sessionID));
- if (mOtrKeyManager.loadRemotePublicKey(sessionID) == null) {
- mOtrKeyManager.savePublicKey(sessionID, mOtrEngine.getRemotePublicKey(sessionID));
- }
-
- SessionStatus status = mOtrEngine.getSessionStatus(sessionID);
-
- if (status.equals(SessionStatus.ENCRYPTED) && mOtrKeyManager.isVerified(sessionID)) {
- mChats.get(sessionID).otrStateChanged("AUTHENTICATED");
- } else {
- if (status.equals(SessionStatus.FINISHED)) {
- try {
- mChats.get(sessionID).localEndOtrSession();
- } catch (OtrException e) {
- Log.w(TAG, "error when closing local otr session", e);
- }
- }
- else {
- mChats.get(sessionID).otrStateChanged(status.toString());
- }
- }
- }
- }
-}
--- a/src/com/beem/project/beem/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-
-/**
- * This package contains BEEM's entry points.
- */
-package com.beem.project.beem;
-
--- a/src/com/beem/project/beem/providers/AvatarProvider.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,270 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.providers;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-import android.content.ContentProvider;
-import android.content.ContentValues;
-import android.content.UriMatcher;
-import android.database.Cursor;
-import android.database.MatrixCursor;
-import android.net.Uri;
-import android.os.Environment;
-import android.os.ParcelFileDescriptor;
-import android.util.Log;
-
-
-/**
- * A simple content provider we expose the differents avatar downloaded.
- *
- */
-public class AvatarProvider extends ContentProvider {
-
- /** The content uri of this provider. */
- public static final Uri CONTENT_URI =
- Uri.parse("content://com.beem.project.beem.providers.avatarprovider");
-
- /** The MIME type of a CONTENT_URI directory of Beem avatars. */
- public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.com.beem.project.beem.avatar";
-
- /** The MIME type of a CONTENT_URI subdirectory of a single Beem avatar. */
- public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.com.beem.project.beem.avatar";
-
- /**
- * Id of the user avatar.
- */
- public static final String MY_AVATAR_ID = "my_avatar";
-
-
- private static final String TAG = AvatarProvider.class.getSimpleName();
- private static final String AUTHORITY = "com.beem.project.beem.providers.avatarprovider";
-
- private static String[] columnNames = new String[] {Columns.ID, Columns.DATA};
-
- private static final int AVATAR = 1;
- private static final int AVATAR_ID = 2;
- private static final UriMatcher URIMATCHER = new UriMatcher(AVATAR);
-
- static
- {
- URIMATCHER.addURI(AUTHORITY, "*", AVATAR_ID);
- // should not be needed if we pass AVATAR on the constructor but it does not work
- URIMATCHER.addURI(AUTHORITY, null, AVATAR);
- }
-
- private String mDataPath;
-
- /**
- * Create an AvatarProvider.
- */
- public AvatarProvider() {
- }
-
- @Override
- public boolean onCreate() {
- File cacheDir = Environment.getExternalStorageDirectory();
- File dataPath = new File(cacheDir, "/Android/data/com.beem.project.beem/cache/avatar");
- dataPath.mkdirs();
- mDataPath = dataPath.getAbsolutePath();
- return true;
- }
-
- @Override
- public ParcelFileDescriptor openFile(Uri uri, String mode)
- throws FileNotFoundException {
- return openFileHelper(uri, mode);
- }
-
- @Override
- public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
- MatrixCursor c = new MatrixCursor(columnNames);
- int match = URIMATCHER.match(uri);
- switch (match) {
- case AVATAR:
- File[] files = new File(mDataPath).listFiles();
- if (files != null) {
- for (File f : files) {
- c.newRow().add(f.getName()).add(f.getAbsolutePath());
- }
- }
- break;
- case AVATAR_ID:
- String id = uri.getPathSegments().get(0);
- File f = new File(mDataPath, id);
- if (f.exists() || MY_AVATAR_ID.equals(f.getName()))
- c.newRow().add(f.getName()).add(f.getAbsolutePath());
- break;
- default:
- Log.w(TAG, "Unsupported uri for query match = " + match);
- }
- if (c != null)
- c.setNotificationUri(getContext().getContentResolver(), uri);
- return c;
- }
-
- @Override
- public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
- int match = URIMATCHER.match(uri);
- String id = null;
- switch (match) {
- case AVATAR_ID:
- id = uri.getPathSegments().get(0);
- break;
- default:
- Log.w(TAG, "Unsupported uri for query match = " + match);
- }
-
- if (id == null)
- return 0;
-
- File f = new File(mDataPath, id);
- try {
- f.createNewFile();
- getContext().getContentResolver().notifyChange(uri, null);
- return 1;
- } catch (IOException e) {
- Log.e(TAG, "Error while creating file", e);
- }
- return 0;
- }
-
- @Override
- public int delete(Uri uri, String selection, String[] selectionArgs) {
- int res = 0;
- boolean all = false;
- String id = null;
- int match = URIMATCHER.match(uri);
- switch (match) {
- case AVATAR_ID:
- id = uri.getPathSegments().get(0);
- break;
- case AVATAR:
- all = true;
- break;
- default:
- Log.w(TAG, "Unsupported uri for query match = " + match);
- }
- File[] list = null;
- if (id != null) {
- list = new File[] {new File(mDataPath, id) };
- } else if (all) {
- list = new File(mDataPath).listFiles();
- }
-
- if (list == null)
- return res;
- for (File data : list) {
- if (data.exists() && data.delete())
- res++;
- }
- if (res > 0)
- getContext().getContentResolver().notifyChange(uri, null);
- return res;
- }
-
- @Override
- public Uri insert(Uri uri, ContentValues values) {
- int match = URIMATCHER.match(uri);
- String id = null;
- Uri result = null;
- switch (match) {
- case AVATAR:
- id = values.getAsString(Columns.ID);
- result = Uri.withAppendedPath(uri, id);
- break;
- case AVATAR_ID:
- id = uri.getPathSegments().get(0);
- result = uri;
- break;
- default:
- Log.w(TAG, "Unsupported uri for query match = " + match);
- }
- if (id == null)
- return null;
-
- File f = new File(mDataPath, id);
- try {
- f.createNewFile();
- if (result != null)
- getContext().getContentResolver().notifyChange(result, null);
- return result;
- } catch (IOException e) {
- Log.e(TAG, "Error while creating file", e);
- }
- return null;
- }
-
- @Override
- public String getType(Uri uri) {
- int match = URIMATCHER.match(uri);
- switch (match) {
- case AVATAR:
- return CONTENT_TYPE;
- case AVATAR_ID:
- return CONTENT_ITEM_TYPE;
- default:
- Log.w(TAG, "Unsupported uri for query match = " + match);
- }
- return null;
- }
-
- /**
- * The differents columns available in the AvatarProvider.
- */
- public interface Columns {
-
- /** The id of the avatar.
- * type: string */
- String ID = "_id";
-
- /** The path of the avatar file.
- * type: string
- * This field is readonly */
- String DATA = "_data";
- }
-
-}
--- a/src/com/beem/project/beem/providers/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-
-
-/**
- * ContentProviders for Beem.
- */
-package com.beem.project.beem.providers;
--- a/src/com/beem/project/beem/service/BeemAvatarCache.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import android.content.ContentResolver;
-import android.content.Context;
-
-import android.database.Cursor;
-
-import android.net.Uri;
-
-import com.beem.project.beem.providers.AvatarProvider;
-import com.beem.project.beem.smack.avatar.AvatarCache;
-
-
-/**
- * An implementation of an AvatarCache which store the data of the filesystem.
- */
-public class BeemAvatarCache implements AvatarCache {
-
- private static final String TAG = BeemAvatarCache.class.getSimpleName();
-
- private Context mContext;
- private ContentResolver mContentResolver;
-
- /**
- * Create a BeemAvatarCache.
- *
- * @param ctx The android context of the cache.
- */
- public BeemAvatarCache(final Context ctx) {
- mContext = ctx;
- mContentResolver = mContext.getContentResolver();
- }
-
-
- @Override
- public void put(String key, byte[] data) throws IOException {
- Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
- mContentResolver.insert(uri, null);
- OutputStream os = new BufferedOutputStream(mContentResolver.openOutputStream(uri));
- try {
- os.write(data);
- } finally {
- os.close();
- }
- }
-
- @Override
- public void put(String key, InputStream in) throws IOException {
- Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
- mContentResolver.insert(uri, null);
- OutputStream os = new BufferedOutputStream(mContentResolver.openOutputStream(uri));
- try {
- byte[] data = new byte[1024];
- int nbread;
- while ((nbread = in.read(data)) != -1)
- os.write(data, 0, nbread);
- } finally {
- in.close();
- os.close();
- }
- }
-
- @Override
- public byte[] get(String key) throws IOException {
- Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
- InputStream is = new BufferedInputStream(mContentResolver.openInputStream(uri));
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- byte[] data = new byte[1024];
- is.read(data);
- bos.write(data);
- } finally {
- is.close();
- }
- return bos.toByteArray();
- }
-
- @Override
- public boolean contains(String key) {
- Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
- Cursor c = mContentResolver.query(uri, null, null, null, null);
- boolean res = c.getCount() > 0;
- c.close();
- return res;
- }
-}
--- a/src/com/beem/project/beem/service/BeemAvatarManager.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-
-package com.beem.project.beem.service;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.net.Uri;
-import android.provider.MediaStore;
-import android.util.Log;
-
-import com.beem.project.beem.smack.avatar.AvatarManager;
-import com.beem.project.beem.smack.avatar.AvatarCache;
-import com.beem.project.beem.smack.avatar.AvatarMetadataExtension;
-
-import java.security.NoSuchAlgorithmException;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import com.beem.project.beem.smack.pep.PepSubManager;
-import org.jivesoftware.smack.Connection;
-
-/**
- * An AvatarManager for Beem.
- * It allows to publish avatar on the Android platform.
- */
-public class BeemAvatarManager extends AvatarManager {
- private static final String TAG = BeemAvatarManager.class.getSimpleName();
- private static final int JPEG_QUALITY = 100;
-
- private Context mContext;
-
- /**
- * Create a BeemAvatarManager.
- *
- * @param ctx the Android context
- * @param con the connection
- * @param pepMgr the PepSubManager of the connection
- * @param cache the cache which will store the avatars
- * @param autoDownload tre to enable auto download of avatars
- */
- public BeemAvatarManager(final Context ctx, final Connection con, final PepSubManager pepMgr,
- final AvatarCache cache, final boolean autoDownload) {
- super(con, pepMgr, cache, autoDownload);
- mContext = ctx;
- }
-
- /**
- * Publish an avatar.
- *
- * @param avatarUri the uri of the avatar
- * @return true if the avatar was successfully published
- */
- public boolean publishAvatar(Uri avatarUri) {
- try {
- Bitmap bmp = MediaStore.Images.Media.getBitmap(mContext.getContentResolver(), avatarUri);
- return publishAvatar(bmp);
- } catch (IOException e) {
- Log.d(TAG, "Error while publishing avatar " + avatarUri, e);
- }
- return false;
- }
-
- /**
- * Publish an avatar.
- * This will send the XMPP stanza to enable the publication of an avatar.
- *
- * @param bitmap the avatar to publish
- * @return true on success false otherwise
- */
- private boolean publishAvatar(Bitmap bitmap) {
- //TODO use the metadata available in the mediastore
- AvatarMetadataExtension meta = new AvatarMetadataExtension();
- // Probably a bug on prosody but only the last data sent is kept
- // and in beem we retrieve the first info
- AvatarMetadataExtension.Info jpeg = publishBitmap(bitmap, Bitmap.CompressFormat.JPEG, JPEG_QUALITY);
- // The png format is mandatory for interoperability
- AvatarMetadataExtension.Info png = publishBitmap(bitmap, Bitmap.CompressFormat.PNG, JPEG_QUALITY);
- if (png == null)
- return false;
- meta.addInfo(png);
- if (jpeg != null)
- meta.addInfo(jpeg);
- publishAvatarMetaData(png.getId(), meta);
- return true;
- }
-
- /**
- * Send this bitmap to the avatar data node of the pep server.
- *
- * @param bmp the avatar bitmap
- * @param format the image format to publish this data
- * @param quality the compression quality use for JPEG compression
- * @return the resulting info associate with this bitmap. null if the operation failed
- */
- private AvatarMetadataExtension.Info publishBitmap(Bitmap bmp, Bitmap.CompressFormat format, int quality) {
- try {
- byte[] data = getBitmapByte(bmp, format, quality);
- String dataid = getAvatarId(data);
- if (!publishAvatarData(data))
- return null;
- String mimetype = "image/png";
- if (Bitmap.CompressFormat.JPEG == format)
- mimetype = "image/jpeg";
- AvatarMetadataExtension.Info info = new AvatarMetadataExtension.Info(dataid, mimetype, data.length);
- info.setHeight(bmp.getHeight());
- info.setWidth(bmp.getWidth());
- return info;
- } catch (NoSuchAlgorithmException ex) {
- return null;
- }
- }
-
- /**
- * Convert the bitmap to a byte array.
- *
- * @param bitmap the avatar bitmap
- * @param format the resulting image format
- * @param quality the compression quality use for JPEG compression
- * @return the bitmap data or a array of 0 element on error
- */
- private byte[] getBitmapByte(Bitmap bitmap, Bitmap.CompressFormat format, int quality) {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- if (bitmap.compress(format, quality, bos))
- return bos.toByteArray();
- else
- return new byte[0];
- }
-
-}
--- a/src/com/beem/project/beem/service/BeemChatManager.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,410 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import android.app.PendingIntent;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.Environment;
-import android.os.RemoteCallbackList;
-import android.os.RemoteException;
-import android.preference.PreferenceManager;
-import android.support.v4.app.NotificationCompat;
-import android.util.Log;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
-import com.beem.project.beem.providers.AvatarProvider;
-import com.beem.project.beem.service.aidl.IChat;
-import com.beem.project.beem.service.aidl.IChatManager;
-import com.beem.project.beem.service.aidl.IChatManagerListener;
-import com.beem.project.beem.service.aidl.IMessageListener;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.utils.Status;
-
-import net.java.otr4j.OtrException;
-
-import org.jivesoftware.smack.Chat;
-import org.jivesoftware.smack.ChatManager;
-import org.jivesoftware.smack.ChatManagerListener;
-import org.jivesoftware.smack.Roster;
-import org.jivesoftware.smack.RosterListener;
-import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.util.StringUtils;
-
-/**
- * An adapter for smack's ChatManager. This class provides functionnality to handle chats.
- * @author darisk
- */
-public class BeemChatManager extends IChatManager.Stub {
-
- private static final String TAG = "BeemChatManager";
- private final ChatManager mAdaptee;
- private final Map<String, ChatAdapter> mChats = new HashMap<String, ChatAdapter>();
- private final ChatListener mChatListener = new ChatListener();
- private final RemoteCallbackList<IChatManagerListener> mRemoteChatCreationListeners =
- new RemoteCallbackList<IChatManagerListener>();
- private final BeemService mService;
- private final Roster mRoster;
- private final ChatRosterListener mChatRosterListn = new ChatRosterListener();
-
- /**
- * Constructor.
- * @param chatManager the smack ChatManager to adapt
- * @param service the service which runs the chat manager
- * @param roster roster used to get presences changes
- */
- public BeemChatManager(final ChatManager chatManager, final BeemService service, final Roster roster) {
- mService = service;
- mAdaptee = chatManager;
- mRoster = roster;
- mRoster.addRosterListener(mChatRosterListn);
- mAdaptee.addChatListener(mChatListener);
- }
-
- @Override
- public void addChatCreationListener(IChatManagerListener listener) throws RemoteException {
- if (listener != null)
- mRemoteChatCreationListeners.register(listener);
- }
-
- /**
- * Create a chat session.
- * @param contact the contact you want to chat with
- * @param listener listener to use for chat events on this chat session
- * @return the chat session
- */
- @Override
- public IChat createChat(Contact contact, IMessageListener listener) {
- String jid = contact.getJIDWithRes();
- return createChat(jid, listener);
- }
-
- /**
- * Create a chat session.
- * @param jid the jid of the contact you want to chat with
- * @param listener listener to use for chat events on this chat session
- * @return the chat session
- */
- public IChat createChat(String jid, IMessageListener listener) {
- String key = jid;
- ChatAdapter result;
- if (mChats.containsKey(key)) {
- result = mChats.get(key);
- result.addMessageListener(listener);
- return result;
- }
- Chat c = mAdaptee.createChat(key, null);
- // maybe a little probleme of thread synchronization
- // if so use an HashTable instead of a HashMap for mChats
- result = getChat(c);
- result.addMessageListener(listener);
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void destroyChat(IChat chat) throws RemoteException {
- // Can't remove it. otherwise we will lose all futur message in this chat
- // chat.removeMessageListener(mChatListener);
- if (chat == null)
- return;
- deleteChatNotification(chat);
- mChats.remove(chat.getParticipant().getJID());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void deleteChatNotification(IChat chat) {
- try {
- mService.deleteNotification(chat.getParticipant().getJID().hashCode());
- } catch (RemoteException e) {
- Log.v(TAG, "Remote exception ", e);
- }
- }
-
- /**
- * Get an existing ChatAdapter or create it if necessary.
- * @param chat The real instance of smack chat
- * @return a chat adapter register in the manager
- */
- private ChatAdapter getChat(Chat chat) {
- String key = chat.getParticipant();
- if (mChats.containsKey(key)) {
- return mChats.get(key);
- }
- ChatAdapter res = new ChatAdapter(chat);
- boolean history = PreferenceManager.getDefaultSharedPreferences(mService.getBaseContext()).getBoolean(
- "settings_key_history", false);
- String accountUser = PreferenceManager.getDefaultSharedPreferences(mService.getBaseContext()).getString(
- BeemApplication.ACCOUNT_USERNAME_KEY, "");
- String historyPath = PreferenceManager.getDefaultSharedPreferences(mService.getBaseContext()).getString(
- BeemApplication.CHAT_HISTORY_KEY, "");
- if ("".equals(historyPath)) historyPath = "/Android/data/com.beem.project.beem/chat/";
- res.setHistory(history);
- res.setAccountUser(accountUser);
- res.listenOtrSession();
- res.setHistoryPath(new File(Environment.getExternalStorageDirectory(), historyPath));
- Log.d(TAG, "getChat put " + key);
- mChats.put(key, res);
- return res;
- }
-
- @Override
- public ChatAdapter getChat(Contact contact) {
- String key = contact.getJIDWithRes();
- return mChats.get(key);
- }
-
- /**
- * This methods permits to retrieve the list of contacts who have an opened chat session with us.
- * @return An List containing Contact instances.
- * @throws RemoteException If a Binder remote-invocation error occurred.
- */
- public List<Contact> getOpenedChatList() throws RemoteException {
- List<Contact> openedChats = new ArrayList<Contact>();
- IRoster r = mService.getBind().getRoster();
- for (ChatAdapter chat : mChats.values()) {
- if (chat.getMessages().size() > 0) {
- Contact t = r.getContact(chat.getParticipant().getJID());
- if (t == null)
- t = new Contact(chat.getParticipant().getJID());
- openedChats.add(t);
- }
- }
- return openedChats;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeChatCreationListener(IChatManagerListener listener) throws RemoteException {
- if (listener != null)
- mRemoteChatCreationListeners.unregister(listener);
- }
-
- /**
- * A listener for all the chat creation event that happens on the connection.
- * @author darisk
- */
- private class ChatListener extends IMessageListener.Stub implements ChatManagerListener {
-
- /**
- * Constructor.
- */
- public ChatListener() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void chatCreated(Chat chat, boolean locally) {
- IChat newchat = getChat(chat);
- Log.d(TAG, "Chat" + chat.toString() + " created locally " + locally + " with " + chat.getParticipant());
- try {
- newchat.addMessageListener(mChatListener);
- final int n = mRemoteChatCreationListeners.beginBroadcast();
-
- for (int i = 0; i < n; i++) {
- IChatManagerListener listener = mRemoteChatCreationListeners.getBroadcastItem(i);
- listener.chatCreated(newchat, locally);
- }
- mRemoteChatCreationListeners.finishBroadcast();
- } catch (RemoteException e) {
- // The RemoteCallbackList will take care of removing the
- // dead listeners.
- Log.w(TAG, " Error while triggering remote connection listeners in chat creation", e);
- }
- }
-
- /**
- * Create the PendingIntent to launch our activity if the user select this chat notification.
- * @param chat A ChatAdapter instance
- * @return A Chat activity PendingIntent
- */
- private PendingIntent makeChatIntent(IChat chat) {
- Intent chatIntent = new Intent(mService, com.beem.project.beem.ui.Chat.class);
- chatIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP
- | Intent.FLAG_ACTIVITY_NEW_TASK);
- try {
- chatIntent.setData(chat.getParticipant().toUri());
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- PendingIntent contentIntent = PendingIntent.getActivity(mService, 0, chatIntent,
- PendingIntent.FLAG_UPDATE_CURRENT);
- return contentIntent;
- }
-
- /**
- * Set a notification of a new chat.
- * @param chat The chat to access by the notification
- * @param msgBody the body of the new message
- */
- private void notifyNewChat(IChat chat, String msgBody) {
- NotificationCompat.Builder notif = new NotificationCompat.Builder(mService);
- try {
- String contactJid = chat.getParticipant().getJID();
- Contact c = mService.getBind().getRoster().getContact(contactJid);
- String contactName = contactJid;
- if (c != null) {
- contactName = c.getName();
- Bitmap avatar = getAvatar(c);
- notif.setLargeIcon(avatar);
- }
- notif.setTicker(contactName).setContentTitle(contactName);
- notif.setContentText(msgBody);
- notif.setSmallIcon(R.drawable.beem_status_icon_gray);
- notif.setNumber(chat.getUnreadMessageCount());
- notif.setContentIntent(makeChatIntent(chat));
- notif.setAutoCancel(true).setWhen(System.currentTimeMillis());
- mService.sendNotification(chat.getParticipant().getJID().hashCode(), notif.getNotification());
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- /**
- * Get the avatar of a contact.
- * @param c the contact
- * @return the avatar of c or null if avatar is not defined
- */
- private Bitmap getAvatar(Contact c) {
- String id = c.getAvatarId();
- if (id == null)
- id = "";
- Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(id).build();
- try {
- InputStream in = mService.getContentResolver().openInputStream(uri);
- return BitmapFactory.decodeStream(in);
- } catch (FileNotFoundException e) {
- Log.d(TAG, "Error loading avatar id: " + id, e);
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void processMessage(final IChat chat, Message message) {
- try {
- String body = message.getBody();
- if (!chat.isOpen() && body != null) {
- if (chat instanceof ChatAdapter) {
- mChats.put(chat.getParticipant().getJID(), (ChatAdapter) chat);
- }
- notifyNewChat(chat, body);
- }
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- @Override
- public void stateChanged(final IChat chat) {
- }
-
- @Override
- public void otrStateChanged(String otrState) throws RemoteException {
- // TODO Auto-generated method stub
-
- }
- }
-
- /**
- * implement a roster listener, is used to detect and close otr chats.
- * @author nikita
- *
- */
- private class ChatRosterListener implements RosterListener {
-
- @Override
- public void entriesAdded(Collection<String> arg0) {
- }
-
- @Override
- public void entriesDeleted(Collection<String> arg0) {
- }
-
- @Override
- public void entriesUpdated(Collection<String> arg0) {
- }
-
- @Override
- public void presenceChanged(Presence presence) {
- String key = StringUtils.parseBareAddress(presence.getFrom());
- if (!mChats.containsKey(key)) {
- return;
- }
-
- if (Status.getStatusFromPresence(presence) >= Status.CONTACT_STATUS_DISCONNECT) {
- try {
- mChats.get(key).localEndOtrSession();
- } catch (OtrException e) {
- e.printStackTrace();
- }
- }
- }
-
- }
-}
--- a/src/com/beem/project/beem/service/ChatAdapter.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,522 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import android.os.Environment;
-import android.os.RemoteCallbackList;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.beem.project.beem.otr.BeemOtrManager;
-import com.beem.project.beem.service.aidl.IChat;
-import com.beem.project.beem.service.aidl.IMessageListener;
-
-import net.java.otr4j.OtrException;
-import net.java.otr4j.session.SessionID;
-
-import org.jivesoftware.smack.Chat;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.util.StringUtils;
-import org.jivesoftware.smackx.ChatState;
-import org.jivesoftware.smackx.ChatStateListener;
-
-/**
- * An adapter for smack's Chat class.
- * @author darisk
- */
-public class ChatAdapter extends IChat.Stub {
- private static final int HISTORY_MAX_SIZE = 50;
- private static final String TAG = "ChatAdapter";
- private static final String PROTOCOL = "XMPP";
-
- private final Chat mAdaptee;
- private final Contact mParticipant;
- private String mState;
- private boolean mIsOpen;
- private final List<Message> mMessages;
- private final RemoteCallbackList<IMessageListener> mRemoteListeners = new RemoteCallbackList<IMessageListener>();
- private final MsgListener mMsgListener = new MsgListener();
- private SessionID mOtrSessionId;
- private boolean mIsHistory;
- private File mHistoryPath;
- private String mAccountUser;
- private int mUnreadMsgCount;
-
- /**
- * Constructor.
- * @param chat The chat to adapt
- */
- public ChatAdapter(final Chat chat) {
- mAdaptee = chat;
- mParticipant = new Contact(chat.getParticipant());
- mMessages = new LinkedList<Message>();
- mAdaptee.addMessageListener(mMsgListener);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Contact getParticipant() throws RemoteException {
- return mParticipant;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void sendMessage(com.beem.project.beem.service.Message message) throws RemoteException {
- com.beem.project.beem.service.Message encrypted = otrEncryptMessage(message);
- if (encrypted != null) {
- transferMessage(encrypted);
- } else {
- transferMessage(message);
- }
- addMessage(message);
- }
-
- /**
- * private method for sending message.
- * @param message the message to send
- */
- private void transferMessage(com.beem.project.beem.service.Message message) {
- org.jivesoftware.smack.packet.Message send = new org.jivesoftware.smack.packet.Message();
- String msgBody = message.getBody();
- send.setTo(message.getTo());
- Log.w(TAG, "message to " + message.getTo());
- send.setBody(msgBody);
-
- send.setThread(message.getThread());
- send.setSubject(message.getSubject());
- send.setType(org.jivesoftware.smack.packet.Message.Type.chat);
- // TODO gerer les messages contenant des XMPPError
- // send.set
- try {
- mAdaptee.sendMessage(send);
- } catch (XMPPException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * send message.
- * @param msg to send.
- */
- public void injectMessage(String msg) {
- Message msgToSend = new Message(mParticipant.getJIDWithRes(), Message.MSG_TYPE_CHAT);
- msgToSend.setBody(msg);
- transferMessage(msgToSend);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addMessageListener(IMessageListener listen) {
- if (listen != null)
- mRemoteListeners.register(listen);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeMessageListener(IMessageListener listen) {
- if (listen != null) {
- mRemoteListeners.unregister(listen);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getState() throws RemoteException {
- return mState;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setState(String state) throws RemoteException {
- mState = state;
- }
-
- /**
- * Get the adaptee for the Chat.
- * @return The real chat object
- */
- public Chat getAdaptee() {
- return mAdaptee;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setOpen(boolean isOpen) {
- this.mIsOpen = isOpen;
- if (isOpen)
- mUnreadMsgCount = 0;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isOpen() {
- return mIsOpen;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<Message> getMessages() throws RemoteException {
- return Collections.unmodifiableList(mMessages);
- }
-
- /**
- * Add a message in the chat history.
- * @param msg the message to add
- */
- private void addMessage(Message msg) {
- if (mMessages.size() == HISTORY_MAX_SIZE)
- mMessages.remove(0);
- mMessages.add(msg);
- if (!isOpen())
- mUnreadMsgCount++;
- if (!"".equals(msg.getBody()) && msg.getBody() != null) {
- logMessage(msg);
- }
- }
-
- /**
- * Save message in SDCard.
- * @param msg the message receive
- * @param contactName the name of the contact
- */
- public void saveHistory(Message msg, String contactName) {
- File path = getHistoryPath();
- File filepath;
- if (contactName.equals(msg.getFrom()))
- filepath = new File(path, StringUtils.parseBareAddress(contactName));
- else
- filepath = new File(path, StringUtils.parseBareAddress(msg.getTo()));
- path.mkdirs();
- try {
- FileWriter file = new FileWriter(filepath, true);
- String log = msg.getTimestamp() + " " + contactName + " " + msg.getBody()
- + System.getProperty("line.separator");
- file.write(log);
- file.close();
- } catch (IOException e) {
- Log.e(TAG, "Error writing chat history", e);
- }
- }
-
- /**
- * set History enable/disable.
- * @param isHisory history state
- */
- public void setHistory(boolean isHisory) {
- this.mIsHistory = isHisory;
- }
-
- /**
- * get History state.
- * @return mIsHistory
- */
- public boolean getHistory() {
- return mIsHistory;
- }
-
- /**
- * Set Account user name.
- * @param accountUser user name
- */
- public void setAccountUser(String accountUser) {
- mAccountUser = accountUser;
- }
-
- /**
- * get Account user name.
- * @return mAccountUser
- */
- public String getAccountUser() {
- return mAccountUser;
- }
-
- /**
- * set History path.
- * @param historyPath history path
- */
- public void setHistoryPath(File historyPath) {
- this.mHistoryPath = historyPath;
- }
-
- /**
- * get History path.
- * @return mHistoryPath;
- */
- public File getHistoryPath() {
- return mHistoryPath;
- }
-
- /**
- * log a message.
- * @param message message to log
- */
- private void logMessage(com.beem.project.beem.service.Message message) {
- String state = Environment.getExternalStorageState();
- if (mIsHistory && Environment.MEDIA_MOUNTED.equals(state))
- saveHistory(message, mAccountUser);
-
- }
-
- /**
- * encrypt a message with an otr session.
- * @param unencrypted message with cleartext body
- * @return message with encrypted body
- */
- private com.beem.project.beem.service.Message otrEncryptMessage(com.beem.project.beem.service.Message unencrypted) {
-
- if (mOtrSessionId != null && unencrypted != null && unencrypted.getBody() != null) {
- try {
- String body = BeemOtrManager.getInstance().getOtrManager()
- .transformSending(mOtrSessionId, unencrypted.getBody());
- Message result = new Message(unencrypted.getTo(), unencrypted.getType());
- result.setBody(body);
- return result;
- } catch (OtrException e) {
- Log.e(TAG, "OTR: Unable to encrypt message", e);
- }
- }
- return null;
- }
-
- /**
- * This method is executed when the otr session status change.
- * @param otrState the new state of otr session.
- */
- public void otrStateChanged(final String otrState) {
- Message m = new Message(null, Message.MSG_TYPE_INFO);
- m.setBody(otrState);
- addMessage(m);
- final int n = mRemoteListeners.beginBroadcast();
-
- for (int i = 0; i < n; i++) {
- IMessageListener listener = mRemoteListeners.getBroadcastItem(i);
- try {
- listener.otrStateChanged(otrState);
- } catch (RemoteException e) {
- Log.w(TAG, e.getMessage());
- }
- }
- mRemoteListeners.finishBroadcast();
- }
-
- @Override
- public void startOtrSession() throws RemoteException {
- if (mOtrSessionId == null) {
- mOtrSessionId = new SessionID(mAccountUser, mParticipant.getJIDWithRes(), PROTOCOL);
- BeemOtrManager.getInstance().addChat(mOtrSessionId, this);
- }
-
- try {
- BeemOtrManager.getInstance().getOtrManager().startSession(mOtrSessionId);
- } catch (OtrException e) {
- mOtrSessionId = null;
- e.printStackTrace();
- throw new RemoteException();
- }
- }
-
- @Override
- public void endOtrSession() throws RemoteException {
- try {
- localEndOtrSession();
- } catch (OtrException e) {
- e.printStackTrace();
- throw new RemoteException();
- }
- }
-
- /**
- * end an Otr session.
- * @return false if something bad happened.
- * @throws OtrException an exception from otr
- */
- public boolean localEndOtrSession() throws OtrException {
- if (mOtrSessionId == null)
- return true;
-
- BeemOtrManager.getInstance().getOtrManager().endSession(mOtrSessionId);
- BeemOtrManager.getInstance().removeChat(mOtrSessionId);
- mOtrSessionId = null;
- listenOtrSession();
- return true;
- }
-
- /**
- * Start listenning to an OTR session.
- */
- public void listenOtrSession() {
- if (mOtrSessionId != null)
- return;
-
- mOtrSessionId = new SessionID(mAccountUser, mParticipant.getJIDWithRes(), PROTOCOL);
- BeemOtrManager.getInstance().addChat(mOtrSessionId, this);
- //OtrEngineImpl will make a call to "this.getSession(sessionID)" which will instantiate our session.
- BeemOtrManager.getInstance().getOtrManager().getSessionStatus(mOtrSessionId);
- }
-
- @Override
- public String getLocalOtrFingerprint() throws RemoteException {
- if (mOtrSessionId == null)
- return null;
-
- return BeemOtrManager.getInstance().getLocalFingerprint(mOtrSessionId);
- }
-
- @Override
- public String getRemoteOtrFingerprint() throws RemoteException {
- if (mOtrSessionId == null)
- return null;
-
- return BeemOtrManager.getInstance().getRemoteFingerprint(mOtrSessionId);
- }
-
- @Override
- public void verifyRemoteFingerprint(boolean ok) {
- if (mOtrSessionId != null) {
- if (ok)
- BeemOtrManager.getInstance().verifyRemoteFingerprint(mOtrSessionId);
- else
- BeemOtrManager.getInstance().unverifyRemoteFingerprint(mOtrSessionId);
- }
- }
-
- @Override
- public String getOtrStatus() throws RemoteException {
- if (mOtrSessionId == null)
- return null;
- return BeemOtrManager.getInstance().getOtrManager().getSessionStatus(mOtrSessionId).toString();
- }
-
- @Override
- public int getUnreadMessageCount() throws RemoteException {
- return mUnreadMsgCount;
- }
-
- /**
- * Listener.
- */
- private class MsgListener implements ChatStateListener {
- /**
- * Constructor.
- */
- public MsgListener() {
- }
-
- @Override
- public void processMessage(Chat chat, org.jivesoftware.smack.packet.Message message) {
- Message msg = new Message(message);
- Log.d(TAG, "new msg " + msg.getBody());
- String body;
-
- if (mOtrSessionId != null) {
- try {
- body = BeemOtrManager.getInstance().getOtrManager()
- .transformReceiving(mOtrSessionId, msg.getBody());
- msg.setBody(body);
- } catch (OtrException e) {
- Log.w(TAG, "Unable to decrypt OTR message", e);
- }
- }
- //TODO add que les message pas de type errors
- ChatAdapter.this.addMessage(msg);
- final int n = mRemoteListeners.beginBroadcast();
- for (int i = 0; i < n; i++) {
- IMessageListener listener = mRemoteListeners.getBroadcastItem(i);
- try {
- if (listener != null)
- listener.processMessage(ChatAdapter.this, msg);
- } catch (RemoteException e) {
- Log.w(TAG, "Error while diffusing message to listener", e);
- }
- }
- mRemoteListeners.finishBroadcast();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void stateChanged(Chat chat, ChatState state) {
- mState = state.name();
- final int n = mRemoteListeners.beginBroadcast();
-
- for (int i = 0; i < n; i++) {
- IMessageListener listener = mRemoteListeners.getBroadcastItem(i);
- try {
- listener.stateChanged(ChatAdapter.this);
- } catch (RemoteException e) {
- Log.w(TAG, e.getMessage());
- }
- }
- mRemoteListeners.finishBroadcast();
- }
-
- }
-
-}
--- a/src/com/beem/project/beem/service/Contact.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-parcelable Contact;
--- a/src/com/beem/project/beem/service/Contact.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,461 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.jivesoftware.smack.RosterGroup;
-import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.util.StringUtils;
-
-import android.net.Uri;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.beem.project.beem.utils.Status;
-
-/**
- * This class contains informations on a jabber contact.
- * @author darisk
- */
-public class Contact implements Parcelable {
-
- /** Parcelable.Creator needs by Android. */
- public static final Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
-
- @Override
- public Contact createFromParcel(Parcel source) {
- return new Contact(source);
- }
-
- @Override
- public Contact[] newArray(int size) {
- return new Contact[size];
- }
- };
-
- private int mID;
- private int mStatus;
- private final String mJID;
- private String mSelectedRes;
- private String mMsgState;
- private List<String> mRes;
- private final List<String> mGroups = new ArrayList<String>();
- private String mName;
- private String mAvatarId;
-
- /**
- * Construct a contact from a parcel.
- * @param in parcel to use for construction
- */
- private Contact(final Parcel in) {
- mID = in.readInt();
- mStatus = in.readInt();
- mJID = in.readString();
- mSelectedRes = in.readString();
- mName = in.readString();
- mMsgState = in.readString();
- mAvatarId = in.readString();
- mRes = new ArrayList<String>();
- in.readStringList(mRes);
- in.readStringList(mGroups);
- }
-
- /**
- * Constructor.
- * @param jid JID of the contact
- */
- public Contact(final String jid) {
- mJID = StringUtils.parseBareAddress(jid);
- mName = mJID;
- mStatus = Status.CONTACT_STATUS_DISCONNECT;
- mMsgState = null;
- mRes = new ArrayList<String>();
- String res = StringUtils.parseResource(jid);
- mSelectedRes = res;
- if (!"".equals(res))
- mRes.add(res);
- }
-
- /**
- * Create a contact from a Uri.
- * @param uri an uri for the contact
- * @throws IllegalArgumentException if it is not a xmpp uri
- */
- public Contact(final Uri uri) {
- if (!"xmpp".equals(uri.getScheme()))
- throw new IllegalArgumentException();
- String enduri = uri.getEncodedSchemeSpecificPart();
- mJID = StringUtils.parseBareAddress(enduri);
- mName = mJID;
- mStatus = Status.CONTACT_STATUS_DISCONNECT;
- mMsgState = null;
- mRes = new ArrayList<String>();
- String res = StringUtils.parseResource(enduri);
- mSelectedRes = res;
- mRes.add(res);
- }
-
- /**
- * Make an xmpp uri for a spcific jid.
- *
- * @param jid the jid to represent as an uri
- * @return an uri representing this jid.
- */
- public static Uri makeXmppUri(String jid) {
- StringBuilder build = new StringBuilder("xmpp:");
- String name = StringUtils.parseName(jid);
- build.append(name);
- if (!"".equals(name))
- build.append('@');
- build.append(StringUtils.parseServer(jid));
- String resource = StringUtils.parseResource(jid);
- if (!"".equals(resource)) {
- build.append('/');
- build.append(resource);
- }
- Uri u = Uri.parse(build.toString());
- return u;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mID);
- dest.writeInt(mStatus);
- dest.writeString(mJID);
- dest.writeString(mSelectedRes);
- dest.writeString(mName);
- dest.writeString(mMsgState);
- dest.writeString(mAvatarId);
- dest.writeStringList(getMRes());
- dest.writeStringList(getGroups());
- }
-
- /**
- * Add a group for the contact.
- * @param group the group
- */
- public void addGroup(String group) {
- if (!mGroups.contains(group))
- mGroups.add(group);
- }
-
- /**
- * Remove the contact from a group.
- * @param group the group to delete the contact from.
- */
- public void delGroup(String group) {
- mGroups.remove(group);
- }
-
- /**
- * Add a resource for this contact.
- * @param res the resource to add
- */
- public void addRes(String res) {
- if (!mRes.contains(res))
- mRes.add(res);
- }
-
- /**
- * Delete a resource for this contact.
- * @param res the resource de delete
- */
- public void delRes(String res) {
- mRes.remove(res);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * Get the groups the contact is in.
- * @return the mGroups
- */
- public List<String> getGroups() {
- return mGroups;
- }
-
- /**
- * Get the id of the contact on the phone contact list.
- * @return the mID
- */
- public int getID() {
- return mID;
- }
-
- /**
- * Get the Jabber ID of the contact.
- * @return the Jabber ID
- */
- public String getJID() {
- return mJID;
- }
-
- /**
- * Get selected resource.
- * @return the selected resource.
- */
- public String getSelectedRes() {
- return mSelectedRes;
- }
-
- /**
- * Get the list of resource for the contact.
- * @return the mRes
- */
- public List<String> getMRes() {
- return mRes;
- }
-
- /**
- * Get the message status of the contact.
- * @return the message status of the contact.
- */
- public String getMsgState() {
- return mMsgState;
- }
-
- /**
- * Get the name of the contact.
- * @return the mName
- */
- public String getName() {
- return mName;
- }
-
- /**
- * Get the status of the contact.
- * @return the mStatus
- */
- public int getStatus() {
- return mStatus;
- }
-
- /**
- * Get the avatar id of the contact.
- *
- * @return the avatar id or null if there is not
- */
- public String getAvatarId() {
- return mAvatarId;
- }
-
- /**
- * Set the groups the contact is in.
- * @param groups list of groups
- */
- public void setGroups(Collection<RosterGroup> groups) {
- this.mGroups.clear();
- for (RosterGroup rosterGroup : groups) {
- mGroups.add(rosterGroup.getName());
- }
- }
-
- /**
- * Set the groups the contact is in.
- * @param groups the mGroups to set
- */
- public void setGroups(List<String> groups) {
- mGroups.clear();
- mGroups.addAll(groups);
- }
-
- /**
- * set the id of te contact on the phone contact list.
- * @param mid the mID to set
- */
- public void setID(int mid) {
- mID = mid;
- }
-
- /**
- * Set the avatar id of the contact.
- *
- * @param avatarId the avatar id
- */
- public void setAvatarId(String avatarId) {
- mAvatarId = avatarId;
- }
-
- /**
- * Set the resource of the contact.
- * @param resource to set.
- */
- public void setSelectedRes(String resource) {
- mSelectedRes = resource;
- }
-
- /**
- * Set a list of resource for the contact.
- * @param mRes the mRes to set
- */
- public void setMRes(List<String> mRes) {
- this.mRes = mRes;
- }
-
- /**
- * Set the message status of the contact.
- * @param msgState the message status of the contact to set
- */
- public void setMsgState(String msgState) {
- mMsgState = msgState;
- }
-
- /**
- * Set the name of the contact.
- * @param name the mName to set
- */
- public void setName(String name) {
- if (name == null || "".equals(name)) {
- this.mName = this.mJID;
- this.mName = StringUtils.parseName(this.mName);
- if (this.mName == null || "".equals(this.mName))
- this.mName = this.mJID;
- } else {
- this.mName = name;
- }
- }
-
- /**
- * Set the status of the contact.
- * @param status the mStatus to set
- */
- public void setStatus(int status) {
- mStatus = status;
- }
-
- /**
- * Set the status of the contact using a presence packet.
- * @param presence the presence containing status
- */
- public void setStatus(Presence presence) {
- mStatus = Status.getStatusFromPresence(presence);
- mMsgState = presence.getStatus();
- }
-
- /**
- * Set status for the contact.
- * @param presence The presence packet which contains the status
- */
- public void setStatus(PresenceAdapter presence) {
- mStatus = presence.getStatus();
- mMsgState = presence.getStatusText();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- if (mJID != null)
- return mJID + "/[" + mRes + "]";
- return super.toString();
- }
-
- /**
- * Get a URI to access the contact.
- * @return the URI
- */
- public Uri toUri() {
- return makeXmppUri(mJID);
- }
-
- /**
- * Get a URI to access the specific contact on this resource.
- * @param resource the resource of the contact
- * @return the URI
- */
- public Uri toUri(String resource) {
- StringBuilder build = new StringBuilder("xmpp:");
- String name = StringUtils.parseName(mJID);
- build.append(name);
- if (!"".equals(name))
- build.append('@');
- build.append(StringUtils.parseServer(mJID));
- if (!"".equals(resource)) {
- build.append('/');
- build.append(resource);
- }
- Uri u = Uri.parse(build.toString());
- return u;
- }
-
- /**
- * Get a JID to access the specific contact on this resource.
- * @return the JID.
- */
- public String getJIDWithRes() {
- StringBuilder build = new StringBuilder(mJID);
- if (!"".equals(mSelectedRes))
- build.append('/').append(mSelectedRes);
- return build.toString();
- }
-
- @Override
- public boolean equals(Object other) {
- if (!(other instanceof Contact))
- return false;
- if (other == this)
- return true;
- Contact c = (Contact) other;
- return c.getJID().equals(getJID());
- }
-
- @Override
- public int hashCode() {
- return mJID.hashCode();
- }
-
-}
--- a/src/com/beem/project/beem/service/LoginAsyncTask.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import android.os.AsyncTask;
-import android.os.RemoteException;
-import android.util.Log;
-import com.beem.project.beem.service.aidl.IXmppConnection;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-
-/**
- * This is an asynchronous task that will launch a connection to the XMPP server.
- * @see android.os.AsyncTask
- * @author Da Risk <da_risk@elyzion.net>
- */
-public class LoginAsyncTask extends AsyncTask<IXmppFacade, Integer, Boolean> {
-
- /**
- * State of a running connection.
- */
- public static final int STATE_CONNECTION_RUNNING = 0;
- /**
- * State of an already connected connection but authentication is running.
- */
- public static final int STATE_LOGIN_RUNNING = 1;
- /**
- * State of a connected and authenticated succesfully.
- */
- public static final int STATE_LOGIN_SUCCESS = 2;
- /**
- * State of a connected but failed authentication.
- */
- public static final int STATE_LOGIN_FAILED = 3;
-
- private static final String TAG = "BeemLoginTask";
-
- private IXmppConnection mConnection;
- private String mErrorMessage;
-
- /**
- * Constructor.
- */
- public LoginAsyncTask() {
- }
-
- @Override
- protected Boolean doInBackground(IXmppFacade... params) {
- boolean result = true;
- IXmppFacade facade = params[0];
- try {
- publishProgress(STATE_CONNECTION_RUNNING);
- mConnection = facade.createConnection();
- if (!mConnection.connect()) {
- mErrorMessage = mConnection.getErrorMessage();
- return false;
- }
- publishProgress(STATE_LOGIN_RUNNING);
-
- if (!mConnection.login()) {
- mErrorMessage = mConnection.getErrorMessage();
- publishProgress(STATE_LOGIN_FAILED);
- return false;
- }
- publishProgress(STATE_LOGIN_SUCCESS);
- } catch (RemoteException e) {
- mErrorMessage = "Exception during connection :" + e;
- result = false;
- }
- return result;
- }
-
- /**
- * Make sur to call the parent method when overriding this method.
- */
- @Override
- protected void onCancelled() {
- try {
- if (mConnection != null && mConnection.isAuthentificated()) {
- mConnection.disconnect();
- }
- } catch (RemoteException e) {
- Log.d(TAG, "Remote exception", e);
- }
- }
-
- /**
- * Get the error Message.
- * @return the error message. null if no error
- */
- public String getErrorMessage() {
- return mErrorMessage;
- }
-}
--- a/src/com/beem/project/beem/service/Message.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-parcelable Message;
--- a/src/com/beem/project/beem/service/Message.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import org.jivesoftware.smack.packet.XMPPError;
-import org.jivesoftware.smackx.packet.DelayInformation;
-import org.jivesoftware.smack.packet.PacketExtension;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import java.util.Date;
-
-/**
- * This class represents a instant message.
- * @author darisk
- */
-public class Message implements Parcelable {
-
- /** Normal message type. Theese messages are like an email, with subject. */
- public static final int MSG_TYPE_NORMAL = 100;
-
- /** Chat message type. */
- public static final int MSG_TYPE_CHAT = 200;
-
- /** Group chat message type. */
- public static final int MSG_TYPE_GROUP_CHAT = 300;
-
- /** Error message type. */
- public static final int MSG_TYPE_ERROR = 400;
-
- /** Informational message type. */
- public static final int MSG_TYPE_INFO = 500;
-
- /** Parcelable.Creator needs by Android. */
- public static final Parcelable.Creator<Message> CREATOR = new Parcelable.Creator<Message>() {
-
- @Override
- public Message createFromParcel(Parcel source) {
- return new Message(source);
- }
-
- @Override
- public Message[] newArray(int size) {
- return new Message[size];
- }
- };
-
- private int mType;
- private String mBody;
- private String mSubject;
- private String mTo;
- private String mFrom;
- private String mThread;
- private Date mTimestamp;
-
- // TODO ajouter l'erreur
-
- /**
- * Constructor.
- * @param to the destinataire of the message
- * @param type the message type
- */
- public Message(final String to, final int type) {
- mTo = to;
- mType = type;
- mBody = "";
- mSubject = "";
- mThread = "";
- mFrom = null;
- mTimestamp = new Date();
- }
-
- /**
- * Constructor a message of type chat.
- * @param to the destinataire of the message
- */
- public Message(final String to) {
- this(to, MSG_TYPE_CHAT);
- }
-
- /**
- * Construct a message from a smack message packet.
- * @param smackMsg Smack message packet
- */
- public Message(final org.jivesoftware.smack.packet.Message smackMsg) {
- this(smackMsg.getTo());
- switch (smackMsg.getType()) {
- case chat:
- mType = MSG_TYPE_CHAT;
- break;
- case groupchat:
- mType = MSG_TYPE_GROUP_CHAT;
- break;
- case normal:
- mType = MSG_TYPE_NORMAL;
- break;
- // TODO gerer les message de type error
- // this a little work around waiting for a better handling of error
- // messages
- case error:
- mType = MSG_TYPE_ERROR;
- break;
- default:
- mType = MSG_TYPE_NORMAL;
- break;
- }
- this.mFrom = smackMsg.getFrom();
- //TODO better handling of error messages
- if (mType == MSG_TYPE_ERROR) {
- XMPPError er = smackMsg.getError();
- String msg = er.getMessage();
- if (msg != null)
- mBody = msg;
- else
- mBody = er.getCondition();
- } else {
- mBody = smackMsg.getBody();
- mSubject = smackMsg.getSubject();
- mThread = smackMsg.getThread();
- }
- PacketExtension pTime = smackMsg.getExtension("delay", "urn:xmpp:delay");
- if (pTime instanceof DelayInformation) {
- mTimestamp = ((DelayInformation) pTime).getStamp();
- } else {
- mTimestamp = new Date();
- }
- }
-
- /**
- * Construct a message from a parcel.
- * @param in parcel to use for construction
- */
- private Message(final Parcel in) {
- mType = in.readInt();
- mTo = in.readString();
- mBody = in.readString();
- mSubject = in.readString();
- mThread = in.readString();
- mFrom = in.readString();
- mTimestamp = new Date(in.readLong());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- // TODO Auto-generated method stub
- dest.writeInt(mType);
- dest.writeString(mTo);
- dest.writeString(mBody);
- dest.writeString(mSubject);
- dest.writeString(mThread);
- dest.writeString(mFrom);
- dest.writeLong(mTimestamp.getTime());
- }
-
- /**
- * Get the type of the message.
- * @return the type of the message.
- */
- public int getType() {
- return mType;
- }
-
- /**
- * Set the type of the message.
- * @param type the type to set
- */
- public void setType(int type) {
- mType = type;
- }
-
- /**
- * Get the body of the message.
- * @return the Body of the message
- */
- public String getBody() {
- return mBody;
- }
-
- /**
- * Set the body of the message.
- * @param body the body to set
- */
- public void setBody(String body) {
- mBody = body;
- }
-
- /**
- * Get the subject of the message.
- * @return the subject
- */
- public String getSubject() {
- return mSubject;
- }
-
- /**
- * Set the subject of the message.
- * @param subject the subject to set
- */
- public void setSubject(String subject) {
- mSubject = subject;
- }
-
- /**
- * Get the destinataire of the message.
- * @return the destinataire of the message
- */
- public String getTo() {
- return mTo;
- }
-
- /**
- * Set the destinataire of the message.
- * @param to the destinataire to set
- */
- public void setTo(String to) {
- mTo = to;
- }
-
- /**
- * Set the from field of the message.
- * @param from the mFrom to set
- */
- public void setFrom(String from) {
- this.mFrom = from;
- }
-
- /**
- * Get the from field of the message.
- * @return the mFrom
- */
- public String getFrom() {
- return mFrom;
- }
-
- /**
- * Get the thread of the message.
- * @return the thread
- */
- public String getThread() {
- return mThread;
- }
-
- /**
- * Set the thread of the message.
- * @param thread the thread to set
- */
- public void setThread(String thread) {
- mThread = thread;
- }
-
- /**
- * Set the Date of the message.
- *
- * @param date date of the message.
- */
- public void setTimestamp(Date date) {
- mTimestamp = date;
- }
-
- /**
- * Get the Date of the message.
- *
- * @return if it is a delayed message get the date the message was sended.
- */
- public Date getTimestamp() {
- return mTimestamp;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int describeContents() {
- // TODO Auto-generated method stub
- return 0;
- }
-
-}
--- a/src/com/beem/project/beem/service/PresenceAdapter.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-parcelable PresenceAdapter;
--- a/src/com/beem/project/beem/service/PresenceAdapter.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import org.jivesoftware.smack.packet.Presence;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import com.beem.project.beem.utils.PresenceType;
-import com.beem.project.beem.utils.Status;
-
-/**
- * this class contain contact presence informations.
- * @author nikita
- */
-public class PresenceAdapter implements Parcelable {
-
- /** Parcelable.Creator needs by Android. */
- public static final Parcelable.Creator<PresenceAdapter> CREATOR = new Parcelable.Creator<PresenceAdapter>() {
-
- @Override
- public PresenceAdapter createFromParcel(Parcel source) {
- return new PresenceAdapter(source);
- }
-
- @Override
- public PresenceAdapter[] newArray(int size) {
- return new PresenceAdapter[size];
- }
- };
-
- private int mType;
- private int mStatus;
- private String mTo;
- private String mFrom;
- private String mStatusText;
-
- /**
- * constructor from Parcel.
- * @param source parcelable presence.
- */
- public PresenceAdapter(final Parcel source) {
- mType = source.readInt();
- mStatus = source.readInt();
- mTo = source.readString();
- mFrom = source.readString();
- mStatusText = source.readString();
- }
-
- /**
- * constructor from smack Presence.
- * @param presence smack presence.
- */
- public PresenceAdapter(final Presence presence) {
- mType = PresenceType.getPresenceType(presence);
- mStatus = Status.getStatusFromPresence(presence);
- mTo = presence.getTo();
- mFrom = presence.getFrom();
- mStatusText = presence.getStatus();
- }
-
- /* (non-Javadoc)
- * @see android.os.Parcelable#describeContents()
- */
- @Override
- public int describeContents() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /**
- * mFrom getter.
- * @return the mFrom
- */
- public String getFrom() {
- return mFrom;
- }
-
- /**
- * mStatus getter.
- * @return the mStatus
- */
- public int getStatus() {
- return mStatus;
- }
-
- /**
- * mStatusText getter.
- * @return the mStatusText
- */
- public String getStatusText() {
- return mStatusText;
- }
-
- /**
- * mTo getter.
- * @return the mTo
- */
- public String getTo() {
- return mTo;
- }
-
- /**
- * mType getter.
- * @return the mType
- */
- public int getType() {
- return mType;
- }
-
- /**
- * mFrom setter.
- * @param from the mFrom to set
- */
- public void setFrom(final String from) {
- this.mFrom = from;
- }
-
- /**
- * mStatus setter.
- * @param status the mStatus to set
- */
- public void setStatus(final int status) {
- this.mStatus = status;
- }
-
- /**
- * mStatusText setter.
- * @param statusText the mStatusText to set
- */
- public void setStatusText(final String statusText) {
- this.mStatusText = statusText;
- }
-
- /**
- * mTo setter.
- * @param to the mTo to set
- */
- public void setTo(final String to) {
- this.mTo = to;
- }
-
- /**
- * mType setter.
- * @param type the type to set
- */
- public void setType(int type) {
- this.mType = type;
- }
-
- /* (non-Javadoc)
- * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mType);
- dest.writeInt(mStatus);
- dest.writeString(mTo);
- dest.writeString(mFrom);
- dest.writeString(mStatusText);
- }
-}
--- a/src/com/beem/project/beem/service/PrivacyListItem.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-parcelable PrivacyListItem;
--- a/src/com/beem/project/beem/service/PrivacyListItem.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * A simplified version of the Smack PrivacyItem class.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
-public class PrivacyListItem implements Parcelable {
-
- /**
- * Constructor. Needed to implements the Parcelable.Creator interface. Generates instances of PrivacyListItem from a
- * Parcel.
- */
- public static final Parcelable.Creator<PrivacyListItem> CREATOR = new Parcelable.Creator<PrivacyListItem>() {
- public PrivacyListItem createFromParcel(Parcel in) {
- return new PrivacyListItem(in);
- }
-
- public PrivacyListItem[] newArray(int size) {
- return new PrivacyListItem[size];
- }
- };
-
- private int mType;
- private String mValue;
-
- /**
- * Constructor.
- */
- public PrivacyListItem() {
- }
-
- /**
- * Constructor. Generates instances of PrivacyListItem from a Parcel.
- * @param in The Parcel used to initialize object's attributes.
- */
- public PrivacyListItem(final Parcel in) {
- readFromParcel(in);
- }
-
- /**
- * Constructor.
- * @param type The type of the item.
- * @param value The value of the item.
- */
- public PrivacyListItem(final int type, final String value) {
- mType = type;
- mValue = value;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * Initialize object's attributes from a Parcel.
- * @param in The Parcel used to initialize object's attributes.
- */
- public void readFromParcel(Parcel in) {
- mType = in.readInt();
- mValue = in.readString();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mType);
- dest.writeString(mValue);
- }
-
- /**
- * PrivacyListItem type accessor.
- * @return The type of the PrivacyListItem.
- */
- public int getType() {
- return mType;
- }
-
- /**
- * PrivacyListItem value accessor.
- * @return The value of the PrivacyListItem.
- */
- public String getValue() {
- return mValue;
- }
-
- /**
- * PrivacyListItem type mutator.
- * @param type The type of the PrivacyListItem.
- */
- public void setType(final int type) {
- mType = type;
- }
-
- /**
- * PrivacyListItem value mutator.
- * @param value The value of the PrivacyListItem.
- */
- public void setValue(final String value) {
- mValue = value;
- }
-}
--- a/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,358 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jivesoftware.smack.PrivacyList;
-import org.jivesoftware.smack.PrivacyListListener;
-import org.jivesoftware.smack.PrivacyListManager;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.packet.PrivacyItem;
-import org.jivesoftware.smack.packet.PrivacyItem.PrivacyRule;
-
-import android.os.RemoteCallbackList;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.beem.project.beem.service.aidl.IPrivacyListListener;
-import com.beem.project.beem.service.aidl.IPrivacyListManager;
-
-/**
- * An adapter for the Smack's PrivacyListManager.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
-public class PrivacyListManagerAdapter extends IPrivacyListManager.Stub {
-
- /** Class's Tag. */
- public static final String TAG = "PrivacyListManagerAdapter";
-
- private final PrivacyListManager mPrivacyListManager;
-
- private final RemoteCallbackList<IPrivacyListListener> mPrivacyListListeners =
- new RemoteCallbackList<IPrivacyListListener>();
- private final PrivacyListListenerAdapter mPrivacyListListener = new PrivacyListListenerAdapter();
-
- /**
- * Constructor.
- * @param privacyListManager the privacy list manager
- */
- public PrivacyListManagerAdapter(final PrivacyListManager privacyListManager) {
- mPrivacyListManager = privacyListManager;
- mPrivacyListManager.addListener(mPrivacyListListener);
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#blockUser(java.lang.String, java.lang.String)
- */
- @Override
- public void blockUser(String listName, String jid) throws RemoteException {
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#createPrivacyList(java.lang.String, java.util.List)
- */
- @Override
- public void createPrivacyList(String listName, List<PrivacyListItem> items) throws RemoteException {
- Log.d(TAG, "BEGIN createPrivacyList.");
- try {
- List<PrivacyItem> privacyItems = new ArrayList<PrivacyItem>();
-
- PrivacyItem item = new PrivacyItem(PrivacyItem.Type.subscription.name(), true, 2);
- item.setValue(PrivacyRule.SUBSCRIPTION_BOTH);
- privacyItems.add(item);
-
- mPrivacyListManager.createPrivacyList(listName, privacyItems);
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- Log.d(TAG, "END createPrivacyList.");
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#declineActivePrivacyList()
- */
- @Override
- public void declineActivePrivacyList() throws RemoteException {
- try {
- mPrivacyListManager.declineActiveList();
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#declineDefaultPrivacyList()
- */
- @Override
- public void declineDefaultPrivacyList() throws RemoteException {
- try {
- mPrivacyListManager.declineDefaultList();
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#editPrivacyList(java.lang.String, java.util.List)
- */
- @Override
- public void editPrivacyList(String listName, List<PrivacyListItem> items) throws RemoteException {
- Log.d(TAG, "BEGIN editPrivacyList.");
- try {
- mPrivacyListManager.updatePrivacyList(listName, tranformPrivacyListItemsToPrivacyItems(items));
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- Log.d(TAG, "END editPrivacyList.");
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getActivePrivacyList()
- */
- @Override
- public String getActivePrivacyList() throws RemoteException {
- try {
- PrivacyList activePrivacyList = mPrivacyListManager.getActiveList();
- return activePrivacyList.toString();
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getBlockedGroupsByList(java.lang.String)
- */
- @Override
- public List<String> getBlockedGroupsByList(String listName) throws RemoteException {
- List<String> blockedGroups = new ArrayList<String>();
- try {
- PrivacyList pL = mPrivacyListManager.getPrivacyList(listName);
- for (PrivacyItem pI : pL.getItems()) {
- if (pI.getType().equals(PrivacyItem.Type.group) && !pI.isAllow())
- blockedGroups.add(pI.getValue());
- }
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- return blockedGroups;
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getBlockedUsersByList(java.lang.String)
- */
- @Override
- public List<String> getBlockedUsersByList(String listName) throws RemoteException {
- List<String> blockedUsers = new ArrayList<String>();
- try {
- PrivacyList pL = mPrivacyListManager.getPrivacyList(listName);
- for (PrivacyItem pI : pL.getItems()) {
- if (pI.getType().equals(PrivacyItem.Type.jid) && !pI.isAllow())
- blockedUsers.add(pI.getValue());
- }
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- return blockedUsers;
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getDefaultPrivacyList()
- */
- @Override
- public String getDefaultPrivacyList() throws RemoteException {
- try {
- PrivacyList defaultPrivacyList = mPrivacyListManager.getDefaultList();
- return defaultPrivacyList.toString();
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#removePrivacyList(java.lang.String)
- */
- @Override
- public void removePrivacyList(String listName) throws RemoteException {
- try {
- mPrivacyListManager.deletePrivacyList(listName);
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#setActivePrivacyList(java.lang.String)
- */
- @Override
- public void setActivePrivacyList(String listName) throws RemoteException {
- try {
- mPrivacyListManager.setActiveListName(listName);
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#setDefaultPrivacyList(java.lang.String)
- */
- @Override
- public void setDefaultPrivacyList(String listName) throws RemoteException {
- try {
- mPrivacyListManager.setDefaultListName(listName);
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- /**
- * From a List of PrivacyListItem get a List of PrivacyItem.
- * @param items The List of PrivacyListItem.
- * @return A list of PrivacyItem.
- */
- private List<PrivacyItem> tranformPrivacyListItemsToPrivacyItems(List<PrivacyListItem> items) {
- List<PrivacyItem> rItems = new ArrayList<PrivacyItem>();
- PrivacyItem.Type[] itemTypes = PrivacyItem.Type.values();
-
- for (int i = 0; i < items.size(); i++) {
- rItems.add(new PrivacyItem(itemTypes[items.get(i).getType()].name(), false, i));
- }
-
- return rItems;
- }
-
- /**
- * From a List of PrivacyItem get a List of PrivacyListItem.
- * @param items The List of PrivacyItem.
- * @return A list of PrivacyListItem.
- */
- private List<PrivacyListItem> tranformPrivacyItemsToPrivacyListItems(List<PrivacyItem> items) {
- List<PrivacyListItem> rItems = new ArrayList<PrivacyListItem>();
-
- for (int i = 0; i < items.size(); i++) {
- rItems.add(new PrivacyListItem(items.get(i).getType().ordinal(), items.get(i).getValue()));
- }
- return rItems;
- }
-
- /**
- * An adapter for the Smack's PrivacyListListener.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
- private class PrivacyListListenerAdapter implements PrivacyListListener {
- /**
- * Constructor.
- */
- public PrivacyListListenerAdapter() { }
-
- @Override
- public void setPrivacyList(final String listName, final List<PrivacyItem> listItem) {
- int i = mPrivacyListListeners.beginBroadcast();
- while (i > 0) {
- i--;
- try {
- mPrivacyListListeners.getBroadcastItem(i).setPrivacyList(listName,
- tranformPrivacyItemsToPrivacyListItems(listItem));
- } catch (RemoteException e) {
- Log.w(TAG, e.getMessage());
- }
- }
- mPrivacyListListeners.finishBroadcast();
- }
-
- @Override
- public void updatedPrivacyList(final String listName) {
- Log.d(TAG, "BEGIN updatedPrivacyList.");
- int i = mPrivacyListListeners.beginBroadcast();
- while (i > 0) {
- i--;
- try {
- mPrivacyListListeners.getBroadcastItem(i).updatedPrivacyList(listName);
- } catch (RemoteException e) {
- Log.w(TAG, e.getMessage());
- }
- }
- mPrivacyListListeners.finishBroadcast();
- Log.d(TAG, "END updatedPrivacyList.");
- }
- }
-
- @Override
- public void addPrivacyListListener(IPrivacyListListener listener) throws RemoteException {
- if (listener != null)
- mPrivacyListListeners.register(listener);
- }
-
- @Override
- public void removePrivacyListListener(IPrivacyListListener listener) throws RemoteException {
- if (listener != null)
- mPrivacyListListeners.unregister(listener);
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IPrivacyListManager#getPrivacyLists()
- */
- @Override
- public List<String> getPrivacyLists() throws RemoteException {
- Log.d(TAG, "BEGIN getPrivacyLists.");
- List<String> res = new ArrayList<String>();
- try {
- PrivacyList[] registeredPrivacyLists = mPrivacyListManager.getPrivacyLists();
- Log.d(TAG, "> registeredPrivacyLists size: " + registeredPrivacyLists.length);
- if (registeredPrivacyLists.length > 0) {
- for (int i = 0; i < registeredPrivacyLists.length; i++) {
- res.add(registeredPrivacyLists[i].toString());
- Log.d(TAG, "> " + res.get(i) + " added.");
- }
- }
- } catch (XMPPException e) {
- Log.e(TAG, e.getMessage());
- }
- Log.d(TAG, "END getPrivacyLists.");
- return res;
- }
-}
--- a/src/com/beem/project/beem/service/RosterAdapter.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,416 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import android.content.Context;
-import android.os.RemoteCallbackList;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.aidl.IBeemRosterListener;
-import com.beem.project.beem.smack.avatar.AvatarListener;
-import com.beem.project.beem.smack.avatar.AvatarManager;
-import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
-import com.beem.project.beem.utils.Status;
-
-import org.jivesoftware.smack.Roster;
-import org.jivesoftware.smack.RosterEntry;
-import org.jivesoftware.smack.RosterGroup;
-import org.jivesoftware.smack.RosterListener;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.util.StringUtils;
-
-
-/**
- * This class implement a Roster adapter for BEEM.
- */
-public class RosterAdapter extends com.beem.project.beem.service.aidl.IRoster.Stub {
-
- private static final String TAG = "RosterAdapter";
- private final Roster mAdaptee;
- private final RemoteCallbackList<IBeemRosterListener> mRemoteRosListeners =
- new RemoteCallbackList<IBeemRosterListener>();
- private final Map<Integer, String> mDefaultStatusMessages;
- private final RosterListenerAdapter mRosterListener = new RosterListenerAdapter();
- private Map<String, String> mAvatarIdmap = new HashMap<String, String>();
- private AvatarManager mAvatarManager;
-
- /**
- * Constructor.
- * @param roster The roster to adapt.
- * @param context The context of the RosterAdapter.
- */
- public RosterAdapter(final Roster roster, final Context context) {
- mAdaptee = roster;
- roster.addRosterListener(mRosterListener);
- mDefaultStatusMessages = createDefaultStatusMessagesMap(context);
- }
-
- /**
- * Constructor.
- * @param roster The roster to adapt.
- * @param context The context of the RosterAdapter.
- * @param avatarMgr The AvatarManager of the connection
- */
- public RosterAdapter(final Roster roster, final Context context, final AvatarManager avatarMgr) {
- mAdaptee = roster;
- roster.addRosterListener(mRosterListener);
- mDefaultStatusMessages = createDefaultStatusMessagesMap(context);
- mAvatarManager = avatarMgr;
- if (mAvatarManager != null)
- mAvatarManager.addAvatarListener(new AvatarEventListener());
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addRosterListener(IBeemRosterListener listen) throws RemoteException {
- if (listen != null)
- mRemoteRosListeners.register(listen);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean addContact(String user, String name, String[] groups) throws RemoteException {
- RosterEntry contact = mAdaptee.getEntry(user);
- try {
- mAdaptee.createEntry(user, name, groups);
- contact = mAdaptee.getEntry(user);
- } catch (XMPPException e) {
- Log.e(TAG, "Error while adding new contact", e);
- return false;
- }
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void deleteContact(Contact contact) throws RemoteException {
- try {
- RosterEntry entry = mAdaptee.getEntry(contact.getJID());
- mAdaptee.removeEntry(entry);
- } catch (XMPPException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createGroup(String groupname) throws RemoteException {
- if (mAdaptee.getGroup(groupname) == null)
- mAdaptee.createGroup(groupname);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Contact getContact(String jid) throws RemoteException {
- if (mAdaptee.contains(jid))
- return getContactFromRosterEntry(mAdaptee.getEntry(jid));
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<Contact> getContactList() throws RemoteException {
- boolean add = true;
- Collection<RosterEntry> list = mAdaptee.getEntries();
- List<Contact> coList = new ArrayList<Contact>(list.size());
- for (RosterEntry entry : list) {
- coList.add(getContactFromRosterEntry(entry));
- }
- return coList;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List<String> getGroupsNames() throws RemoteException {
- Collection<RosterGroup> groups = mAdaptee.getGroups();
- List<String> result = new ArrayList<String>(groups.size());
- for (RosterGroup rosterGroup : groups) {
- result.add(rosterGroup.getName());
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeRosterListener(IBeemRosterListener listen) throws RemoteException {
- if (listen != null)
- mRemoteRosListeners.unregister(listen);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setContactName(String jid, String name) throws RemoteException {
- mAdaptee.getEntry(jid).setName(name);
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IRoster#getPresence(java.lang.String)
- */
- @Override
- public PresenceAdapter getPresence(String jid) throws RemoteException {
- return new PresenceAdapter(mAdaptee.getPresence(jid));
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IRoster#addContactToGroup(java.lang.String, java.lang.String)
- */
- @Override
- public void addContactToGroup(String groupName, String jid) throws RemoteException {
- createGroup(groupName);
- RosterGroup group = mAdaptee.getGroup(groupName);
- try {
- group.addEntry(mAdaptee.getEntry(jid));
- } catch (XMPPException e) {
- e.printStackTrace();
- }
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IRoster#removeContactFromGroup(java.lang.String, java.lang.String)
- */
- @Override
- public void removeContactFromGroup(String groupName, String jid) throws RemoteException {
- RosterGroup group = mAdaptee.getGroup(groupName);
- try {
- group.removeEntry(mAdaptee.getEntry(jid));
- } catch (XMPPException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Get a contact from a RosterEntry.
- * @param entry a roster entry containing information for the contact.
- * @return a contact for this entry.
- */
- private Contact getContactFromRosterEntry(RosterEntry entry) {
- String user = entry.getUser();
- Contact c = new Contact(user);
- Presence p = mAdaptee.getPresence(user);
-
- if (p.getStatus() == null || "".equals(p.getStatus()))
- p.setStatus(mDefaultStatusMessages.get(Status.getStatusFromPresence(p)));
- c.setStatus(p);
- try {
- c.setGroups(entry.getGroups());
- } catch (NullPointerException e) {
- Log.d(TAG, "Group list not ready", e);
- }
- Iterator<Presence> iPres = mAdaptee.getPresences(user);
- while (iPres.hasNext()) {
- p = iPres.next();
- if (!p.getType().equals(Presence.Type.unavailable))
- c.addRes(StringUtils.parseResource(p.getFrom()));
- }
- c.setName(entry.getName());
- c.setAvatarId(mAvatarIdmap.get(user));
- return c;
- }
-
- /**
- * Create a map which contains default status messages.
- * @param context The context of the roster adapter.
- * @return A Map<Integer, String> which assigns a status to a message.
- */
- private Map<Integer, String> createDefaultStatusMessagesMap(Context context) {
- Map<Integer, String> defaultStatusMessages = new HashMap<Integer, String>();
- defaultStatusMessages.put(Status.CONTACT_STATUS_AVAILABLE, context
- .getString(R.string.contact_status_msg_available));
- defaultStatusMessages.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT, context
- .getString(R.string.contact_status_msg_available_chat));
- defaultStatusMessages.put(Status.CONTACT_STATUS_AWAY, context.getString(R.string.contact_status_msg_away));
- defaultStatusMessages.put(Status.CONTACT_STATUS_BUSY, context.getString(R.string.contact_status_msg_dnd));
- defaultStatusMessages.put(Status.CONTACT_STATUS_DISCONNECT, context
- .getString(R.string.contact_status_msg_offline));
- defaultStatusMessages.put(Status.CONTACT_STATUS_UNAVAILABLE, context.getString(R.string.contact_status_msg_xa));
-
- return defaultStatusMessages;
- }
-
- /**
- * Listener for the roster events. It will call the remote listeners registered.
- * @author darisk
- */
- private class RosterListenerAdapter implements RosterListener {
-
- /**
- * Constructor.
- */
- public RosterListenerAdapter() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void entriesAdded(Collection<String> addresses) {
- final int n = mRemoteRosListeners.beginBroadcast();
-
- List<String> tab = new ArrayList<String>();
- tab.addAll(addresses);
- for (int i = 0; i < n; i++) {
- IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
- try {
- listener.onEntriesAdded(tab);
- } catch (RemoteException e) {
- Log.w(TAG, "Error while adding roster entries", e);
- }
- }
- mRemoteRosListeners.finishBroadcast();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void entriesDeleted(Collection<String> addresses) {
- final int n = mRemoteRosListeners.beginBroadcast();
-
- List<String> tab = new ArrayList<String>();
- tab.addAll(addresses);
- for (int i = 0; i < n; i++) {
- IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
- try {
- listener.onEntriesDeleted(tab);
- } catch (RemoteException e) {
- Log.w(TAG, "Error while deleting roster entries", e);
- }
- }
- mRemoteRosListeners.finishBroadcast();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void entriesUpdated(Collection<String> addresses) {
- final int n = mRemoteRosListeners.beginBroadcast();
-
- List<String> tab = new ArrayList<String>();
- tab.addAll(addresses);
- for (int i = 0; i < n; i++) {
- IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
- try {
- listener.onEntriesUpdated(tab);
- } catch (RemoteException e) {
- Log.w(TAG, "Error while updating roster entries", e);
- }
- }
- mRemoteRosListeners.finishBroadcast();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void presenceChanged(Presence presence) {
- final int n = mRemoteRosListeners.beginBroadcast();
- Log.v(TAG, ">>> Presence changed for " + presence.getFrom());
-
- for (int i = 0; i < n; i++) {
- IBeemRosterListener listener = mRemoteRosListeners.getBroadcastItem(i);
- try {
- if (presence.getStatus() == null || "".equals(presence.getStatus())) {
- presence.setStatus(mDefaultStatusMessages.get(Status.getStatusFromPresence(presence)));
- }
- listener.onPresenceChanged(new PresenceAdapter(presence));
- } catch (RemoteException e) {
- Log.w(TAG, "Error while updating roster presence entries", e);
- }
- }
- mRemoteRosListeners.finishBroadcast();
- }
- }
-
- /**
- * Listener on avatar metadata event.
- *
- */
- private class AvatarEventListener implements AvatarListener {
-
- /**
- * Constructor.
- */
- public AvatarEventListener() { }
-
- @Override
- public void onAvatarChange(String from, String avatarId, List<Info> avatarInfos) {
- String bare = StringUtils.parseBareAddress(from);
- if (avatarId == null)
- mAvatarIdmap.remove(bare);
- else if (avatarInfos.size() > 0) {
- mAvatarIdmap.put(bare, avatarId);
- }
- }
- }
-}
--- a/src/com/beem/project/beem/service/UserInfo.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-parcelable UserInfo;
--- a/src/com/beem/project/beem/service/UserInfo.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * This class contains information about the user of the connection.
- * These informations are sent by the connection.
- *
- */
-public class UserInfo implements Parcelable {
-
- /** Parcelable.Creator needs by Android. */
- public static final Parcelable.Creator<UserInfo> CREATOR = new Parcelable.Creator<UserInfo>() {
-
- @Override
- public UserInfo createFromParcel(Parcel source) {
- return new UserInfo(source);
- }
-
- @Override
- public UserInfo[] newArray(int size) {
- return new UserInfo[size];
- }
- };
-
- private final String mFullJid;
- private String mAvatarId;
-
- /**
- * Construct a UserInfo from a parcel.
- * @param in parcel to use for construction
- */
- private UserInfo(final Parcel in) {
- mFullJid = in.readString();
- mAvatarId = in.readString();
- }
-
- /**
- * Constructor.
- * @param jid jid of the user
- */
- public UserInfo(final String jid) {
- // the jid is case insensitive
- mFullJid = jid;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(mFullJid);
- dest.writeString(mAvatarId);
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- /**
- * Get the avatar id of the user.
- *
- * @return the avatar id
- */
- public String getAvatarId() {
- return mAvatarId;
- }
-
- /**
- * Set the avater id of the user.
- *
- * @param avatarId the avatar id
- */
- public void setAvatarId(String avatarId) {
- mAvatarId = avatarId;
- }
-
- /**
- * Get the full jid of the user.
- *
- * @return the jid
- */
- public String getJid() {
- return mFullJid;
- }
-}
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,773 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
- */
-package com.beem.project.beem.service;
-
-import java.util.Iterator;
-import java.util.List;
-
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.RemoteCallbackList;
-import android.os.RemoteException;
-import android.support.v4.app.NotificationCompat;
-import android.util.Log;
-
-import com.beem.project.beem.BeemApplication;
-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.IChatManager;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IXmppConnection;
-import com.beem.project.beem.smack.avatar.AvatarCache;
-import com.beem.project.beem.smack.avatar.AvatarListener;
-import com.beem.project.beem.smack.avatar.AvatarMetadataExtension;
-import com.beem.project.beem.smack.pep.PepSubManager;
-import com.beem.project.beem.smack.ping.PingExtension;
-import com.beem.project.beem.ui.ChangeStatus;
-import com.beem.project.beem.ui.Subscription;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-import com.beem.project.beem.utils.Status;
-
-import org.jivesoftware.smack.ConnectionConfiguration;
-import org.jivesoftware.smack.ConnectionListener;
-import org.jivesoftware.smack.PacketListener;
-import org.jivesoftware.smack.PrivacyListManager;
-import org.jivesoftware.smack.Roster;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.filter.PacketFilter;
-import org.jivesoftware.smack.filter.PacketTypeFilter;
-import org.jivesoftware.smack.packet.IQ;
-import org.jivesoftware.smack.packet.Packet;
-import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.util.StringUtils;
-import org.jivesoftware.smackx.ChatStateManager;
-import org.jivesoftware.smackx.ServiceDiscoveryManager;
-import org.jivesoftware.smackx.entitycaps.EntityCapsManager;
-import org.jivesoftware.smackx.packet.DiscoverInfo;
-
-/**
- * This class implements an adapter for XMPPConnection.
- * @author darisk
- */
-public class XmppConnectionAdapter extends IXmppConnection.Stub {
-
- /**
- * Beem connection closed Intent name.
- */
-
- private static final int SMACK_PRIORITY_MIN = -128;
- private static final int SMACK_PRIORITY_MAX = 128;
- private static final String TAG = "XMPPConnectionAdapter";
- private final XMPPConnection mAdaptee;
- private IChatManager mChatManager;
- private final String mLogin;
- private final String mPassword;
- private String mResource;
- private String mErrorMsg;
- private RosterAdapter mRoster;
- private int mPreviousPriority;
- private int mPreviousMode;
- private String mPreviousStatus;
- private PrivacyListManagerAdapter mPrivacyListManager;
- private ChatStateManager mChatStateManager;
- private final BeemService mService;
- private BeemApplication mApplication;
- private BeemAvatarManager mAvatarManager;
- private PepSubManager mPepManager;
- private SharedPreferences mPref;
- private final RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners =
- new RemoteCallbackList<IBeemConnectionListener>();
- private final SubscribePacketListener mSubscribePacketListener = new SubscribePacketListener();
- private final PingListener mPingListener = new PingListener();
-
- private final ConnexionListenerAdapter mConListener = new ConnexionListenerAdapter();
-
- private UserInfo mUserInfo;
- private final UserInfoManager mUserInfoManager = new UserInfoManager();
-
- /**
- * Constructor.
- * @param config Configuration to use in order to connect
- * @param login login to use on connect
- * @param password password to use on connect
- * @param service the background service associated with the connection.
- */
- public XmppConnectionAdapter(final ConnectionConfiguration config, final String login, final String password,
- final BeemService service) {
- this(new XMPPConnection(config), login, password, service);
- }
-
- /**
- * Constructor.
- * @param serviceName name of the service to connect to
- * @param login login to use on connect
- * @param password password to use on connect
- * @param service the background service associated with the connection.
- */
- public XmppConnectionAdapter(final String serviceName, final String login, final String password,
- final BeemService service) {
- this(new XMPPConnection(serviceName), login, password, service);
- }
-
- /**
- * Constructor.
- * @param con The connection to adapt
- * @param login The login to use
- * @param password The password to use
- * @param service the background service associated with the connection.
- */
- public XmppConnectionAdapter(final XMPPConnection con, final String login, final String password,
- final BeemService service) {
- mAdaptee = con;
- PrivacyListManager.getInstanceFor(mAdaptee);
- mLogin = login;
- mPassword = password;
- mService = service;
- Context ctx = mService.getApplicationContext();
- if (ctx instanceof BeemApplication) {
- mApplication = (BeemApplication) ctx;
- }
- mPref = mService.getServicePreference();
- try {
- mPreviousPriority = Integer.parseInt(mPref.getString(BeemApplication.CONNECTION_PRIORITY_KEY, "0"));
- } catch (NumberFormatException ex) {
- mPreviousPriority = 0;
- }
- mResource = mPref.getString(BeemApplication.CONNECTION_RESOURCE_KEY, "Beem");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void addConnectionListener(IBeemConnectionListener listen) throws RemoteException {
- if (listen != null)
- mRemoteConnListeners.register(listen);
- }
-
- @Override
- public boolean connect() throws RemoteException {
- if (mAdaptee.isConnected())
- return true;
- else {
- try {
- mAdaptee.connect();
- mAdaptee.addConnectionListener(mConListener);
- return true;
- } catch (XMPPException e) {
- Log.e(TAG, "Error while connecting", e);
- try {
- //TODO NIKITA DOES SOME SHIT !!! Fix this monstruosity
- String str = mService.getResources().getString(
- mService.getResources().getIdentifier(e.getXMPPError().getCondition().replace("-", "_"),
- "string", "com.beem.project.beem"));
- mErrorMsg = str;
- } catch (NullPointerException e2) {
- if (!"".equals(e.getMessage()))
- mErrorMsg = e.getMessage();
- else
- mErrorMsg = e.toString();
- }
- }
- return false;
- }
- }
-
- @Override
- public boolean login() throws RemoteException {
- if (mAdaptee.isAuthenticated())
- return true;
- if (!mAdaptee.isConnected())
- return false;
- try {
-
- this.initFeatures(); // pour declarer les features xmpp qu'on
- // supporte
-
- PacketFilter filter = new PacketFilter() {
-
- @Override
- public boolean accept(Packet packet) {
- if (packet instanceof Presence) {
- Presence pres = (Presence) packet;
- if (pres.getType() == Presence.Type.subscribe)
- return true;
- }
- return false;
- }
- };
-
- mAdaptee.addPacketListener(mSubscribePacketListener, filter);
-
- filter = new PacketTypeFilter(PingExtension.class);
- mAdaptee.addPacketListener(mPingListener, filter);
-
- mAdaptee.login(mLogin, mPassword, mResource);
- mUserInfo = new UserInfo(mAdaptee.getUser());
- discoverServerFeatures();
-
- mChatManager = new BeemChatManager(mAdaptee.getChatManager(), mService, mAdaptee.getRoster());
- //nikita: I commented this line because of the logs provided in http://www.beem-project.com/issues/321
- //Also, since the privacylistmanager isn't finished and used, it will be safer to not initialize it
- //mPrivacyListManager = new PrivacyListManagerAdapter(PrivacyListManager.getInstanceFor(mAdaptee));
- mService.initJingle(mAdaptee);
-
- mApplication.setConnected(true);
- int mode = mPref.getInt(BeemApplication.STATUS_KEY, 0);
- String status = mPref.getString(BeemApplication.STATUS_TEXT_KEY, "");
- changeStatus(mode, status);
- return true;
- } catch (XMPPException e) {
- Log.e(TAG, "Error while connecting", e);
- mErrorMsg = mService.getString(R.string.error_login_authentication);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public final void connectAsync() throws RemoteException {
- if (mAdaptee.isConnected() || mAdaptee.isAuthenticated())
- return;
- Thread t = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- connectSync();
- } catch (RemoteException e) {
- Log.e(TAG, "Error while connecting asynchronously", e);
- }
- }
- });
- t.start();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean connectSync() throws RemoteException {
- if (connect())
- return login();
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void changeStatusAndPriority(int status, String msg, int priority) {
- Presence pres = new Presence(Presence.Type.available);
- String m;
- if (msg != null)
- m = msg;
- else
- m = mPreviousStatus;
- pres.setStatus(m);
- mPreviousStatus = m;
- Presence.Mode mode = Status.getPresenceModeFromStatus(status);
- if (mode != null) {
- pres.setMode(mode);
- mPreviousMode = status;
- } else {
- pres.setMode(Status.getPresenceModeFromStatus(mPreviousMode));
- }
- int p = priority;
- if (priority < SMACK_PRIORITY_MIN)
- p = SMACK_PRIORITY_MIN;
- if (priority > SMACK_PRIORITY_MAX)
- p = SMACK_PRIORITY_MAX;
- mPreviousPriority = p;
- pres.setPriority(p);
- mAdaptee.sendPacket(pres);
- updateNotification(Status.getStatusFromPresence(pres), m);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void changeStatus(int status, String msg) {
- changeStatusAndPriority(status, msg, mPreviousPriority);
- }
-
- /**
- * Get the AvatarManager of this connection.
- * @return the AvatarManager or null if there is not
- */
- public BeemAvatarManager getAvatarManager() {
- return mAvatarManager;
- }
-
- /**
- * get the previous status.
- * @return previous status.
- */
- public String getPreviousStatus() {
- return mPreviousStatus;
- }
-
- /**
- * get the previous mode.
- * @return previous mode.
- */
- public int getPreviousMode() {
- return mPreviousMode;
- }
-
- /**
- * Update the notification for the Beem status.
- * @param status the status to display.
- * @param text the text to display.
- */
- private void updateNotification(int status, String text) {
- Notification mStatusNotification;
- mStatusNotification = new Notification(Status.getIconBarFromStatus(status), text, System.currentTimeMillis());
- mStatusNotification.defaults = Notification.DEFAULT_LIGHTS;
- mStatusNotification.flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
-
- mStatusNotification.setLatestEventInfo(mService, "Beem Status", text,
- PendingIntent.getActivity(mService, 0, new Intent(mService, ChangeStatus.class), 0));
- // bypass the preferences for notification
- mService.getNotificationManager().notify(BeemService.NOTIFICATION_STATUS_ID, mStatusNotification);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean disconnect() {
- if (mAdaptee != null && mAdaptee.isConnected())
- mAdaptee.disconnect();
- return true;
- }
-
- /**
- * Get the Smack XmppConnection.
- * @return Smack XmppConnection
- */
- public XMPPConnection getAdaptee() {
- return mAdaptee;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IChatManager getChatManager() throws RemoteException {
- return mChatManager;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IRoster getRoster() throws RemoteException {
- if (mRoster != null)
- return mRoster;
- Roster adap = mAdaptee.getRoster();
- if (adap == null)
- return null;
- mRoster = new RosterAdapter(adap, mService, mAvatarManager);
- return mRoster;
- }
-
- /**
- * Get the user informations.
- * @return the user infos or null if not logged
- */
- public UserInfo getUserInfo() {
- return mUserInfo;
- }
-
- /**
- * Returns true if currently authenticated by successfully calling the login method.
- * @return true when successfully authenticated
- */
- public boolean isAuthentificated() {
- return mAdaptee.isAuthenticated();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeConnectionListener(IBeemConnectionListener listen) throws RemoteException {
- if (listen != null)
- mRemoteConnListeners.unregister(listen);
- }
-
- /**
- * PrivacyListManagerAdapter mutator.
- * @param privacyListManager the privacy list manager
- */
- public void setPrivacyListManager(PrivacyListManagerAdapter privacyListManager) {
- this.mPrivacyListManager = privacyListManager;
- }
-
- /**
- * PrivacyListManagerAdapter accessor.
- * @return the mPrivacyList
- */
- public PrivacyListManagerAdapter getPrivacyListManager() {
- return mPrivacyListManager;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getErrorMessage() {
- return mErrorMsg;
- }
-
- /**
- * Initialize the features provided by beem.
- */
- private void initFeatures() {
- ServiceDiscoveryManager.setIdentityName("Beem");
- ServiceDiscoveryManager.setIdentityType("phone");
- ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
- if (sdm == null)
- sdm = new ServiceDiscoveryManager(mAdaptee);
-
- sdm.addFeature("http://jabber.org/protocol/disco#info");
- //nikita: must be uncommented when the feature will be enabled
- //sdm.addFeature("jabber:iq:privacy");
- sdm.addFeature("http://jabber.org/protocol/caps");
- sdm.addFeature("urn:xmpp:avatar:metadata");
- sdm.addFeature("urn:xmpp:avatar:metadata+notify");
- sdm.addFeature("urn:xmpp:avatar:data");
- sdm.addFeature("http://jabber.org/protocol/nick");
- sdm.addFeature("http://jabber.org/protocol/nick+notify");
- sdm.addFeature(PingExtension.NAMESPACE);
-
- mChatStateManager = ChatStateManager.getInstance(mAdaptee);
-
- EntityCapsManager em = sdm.getEntityCapsManager();
- em.setNode("http://www.beem-project.com");
- }
-
- /**
- * Discover the features provided by the server.
- */
- private void discoverServerFeatures() {
- try {
- // jid et server
- ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mAdaptee);
- DiscoverInfo info = sdm.discoverInfo(mAdaptee.getServiceName());
- Iterator<DiscoverInfo.Identity> it = info.getIdentities();
- while (it.hasNext()) {
- DiscoverInfo.Identity identity = it.next();
- if ("pubsub".equals(identity.getCategory()) && "pep".equals(identity.getType())) {
- initPEP();
- }
- }
- } catch (XMPPException e) {
- Log.w(TAG, "Unable to discover server features", e);
- }
- }
-
- /**
- * Initialize PEP.
- */
- private void initPEP() {
- // Enable pep sending
- Log.d(TAG, "Pep enabled");
- // API 8
- // mService.getExternalCacheDir()
- mPepManager = new PepSubManager(mAdaptee, StringUtils.parseBareAddress(mAdaptee.getUser()));
- AvatarCache avatarCache = new BeemAvatarCache(mService);
- mAvatarManager = new BeemAvatarManager(mService, mAdaptee, mPepManager, avatarCache, true);
- mAvatarManager.addAvatarListener(mUserInfoManager);
- mApplication.setPepEnabled(true);
- }
-
- /**
- * Reset the application state.
- */
- private void resetApplication() {
- mApplication.setConnected(false);
- mApplication.setPepEnabled(false);
- }
-
- /**
- * Listener for XMPP connection events. It will calls the remote listeners for connection events.
- */
- private class ConnexionListenerAdapter implements ConnectionListener {
-
- /**
- * Defaut constructor.
- */
- public ConnexionListenerAdapter() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void connectionClosed() {
- Log.d(TAG, "closing connection");
- mRoster = null;
- Intent intent = new Intent(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED);
- intent.putExtra("message", mService.getString(R.string.BeemBroadcastReceiverDisconnect));
- intent.putExtra("normally", true);
- mService.sendBroadcast(intent);
- mService.stopSelf();
- resetApplication();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void connectionClosedOnError(Exception exception) {
- Log.d(TAG, "connectionClosedOnError");
- mRoster = null;
- Intent intent = new Intent(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED);
- intent.putExtra("message", exception.getMessage());
- mService.sendBroadcast(intent);
- mService.stopSelf();
- resetApplication();
- }
-
- /**
- * Connection failed callback.
- * @param errorMsg smack failure message
- */
- public void connectionFailed(String errorMsg) {
- Log.d(TAG, "Connection Failed");
- final int n = mRemoteConnListeners.beginBroadcast();
-
- for (int i = 0; i < n; i++) {
- IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
- try {
- if (listener != null)
- listener.connectionFailed(errorMsg);
- } catch (RemoteException e) {
- // The RemoteCallbackList will take care of removing the
- // dead listeners.
- Log.w(TAG, "Error while triggering remote connection listeners", e);
- }
- }
- mRemoteConnListeners.finishBroadcast();
- mService.stopSelf();
- resetApplication();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void reconnectingIn(int arg0) {
- Log.d(TAG, "reconnectingIn");
- final int n = mRemoteConnListeners.beginBroadcast();
-
- for (int i = 0; i < n; i++) {
- IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
- try {
- if (listener != null)
- listener.reconnectingIn(arg0);
- } catch (RemoteException e) {
- // The RemoteCallbackList will take care of removing the
- // dead listeners.
- Log.w(TAG, "Error while triggering remote connection listeners", e);
- }
- }
- mRemoteConnListeners.finishBroadcast();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void reconnectionFailed(Exception arg0) {
- Log.d(TAG, "reconnectionFailed");
- final int r = mRemoteConnListeners.beginBroadcast();
-
- for (int i = 0; i < r; i++) {
- IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
- try {
- if (listener != null)
- listener.reconnectionFailed();
- } catch (RemoteException e) {
- // The RemoteCallbackList will take care of removing the
- // dead listeners.
- Log.w(TAG, "Error while triggering remote connection listeners", e);
- }
- }
- mRemoteConnListeners.finishBroadcast();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void reconnectionSuccessful() {
- Log.d(TAG, "reconnectionSuccessful");
- mApplication.setConnected(true);
- PacketFilter filter = new PacketFilter() {
-
- @Override
- public boolean accept(Packet packet) {
- if (packet instanceof Presence) {
- Presence pres = (Presence) packet;
- if (pres.getType() == Presence.Type.subscribe)
- return true;
- }
- return false;
- }
- };
-
- mAdaptee.addPacketListener(mSubscribePacketListener, filter);
-
- final int n = mRemoteConnListeners.beginBroadcast();
-
- for (int i = 0; i < n; i++) {
- IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
- try {
- if (listener != null)
- listener.reconnectionSuccessful();
- } catch (RemoteException e) {
- // The RemoteCallbackList will take care of removing the
- // dead listeners.
- Log.w(TAG, "Error while triggering remote connection listeners", e);
- }
- }
- mRemoteConnListeners.finishBroadcast();
- }
- }
-
- /**
- * This PacketListener will set a notification when you got a subscribtion request.
- * @author Da Risk <da_risk@elyzion.net>
- */
- private class SubscribePacketListener implements PacketListener {
-
- /**
- * Constructor.
- */
- public SubscribePacketListener() {
- }
-
- @Override
- public void processPacket(Packet packet) {
- String from = packet.getFrom();
-
- NotificationCompat.Builder notif = new NotificationCompat.Builder(mService);
- String title = mService.getString(R.string.AcceptContactRequest, from);
- String text = mService.getString(R.string.AcceptContactRequestFrom, from);
- notif.setTicker(title).setContentTitle(title);
- notif.setContentText(text);
- notif.setSmallIcon(R.drawable.beem_status_icon_gray);
- notif.setAutoCancel(true).setWhen(System.currentTimeMillis());
-
- Intent intent = new Intent(mService, Subscription.class);
- intent.setData(Contact.makeXmppUri(from));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- PendingIntent notifIntent = PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT);
- notif.setContentIntent(notifIntent);
-
- int id = packet.hashCode();
- mService.sendNotification(id, notif.getNotification());
- }
- }
-
- /**
- * The UserInfoManager listen to XMPP events and update the user information accoldingly.
- */
- private class UserInfoManager implements AvatarListener {
-
- /**
- * Constructor.
- */
- public UserInfoManager() {
- }
-
- @Override
- public void onAvatarChange(String from, String avatarId, List<AvatarMetadataExtension.Info> avatarInfos) {
- String jid = StringUtils.parseBareAddress(mUserInfo.getJid());
- String mfrom = StringUtils.parseBareAddress(from);
- if (jid.equalsIgnoreCase(mfrom)) {
- mUserInfo.setAvatarId(avatarId);
- }
- }
- }
-
- /**
- * Listener for Ping request. It will respond with a Pong.
- */
- private class PingListener implements PacketListener {
-
- /**
- * Constructor.
- */
- public PingListener() {
-
- }
-
- @Override
- public void processPacket(Packet packet) {
- if (!(packet instanceof PingExtension))
- return;
- PingExtension p = (PingExtension) packet;
- if (p.getType() == IQ.Type.GET) {
- PingExtension pong = new PingExtension();
- pong.setType(IQ.Type.RESULT);
- pong.setTo(p.getFrom());
- pong.setPacketID(p.getPacketID());
- mAdaptee.sendPacket(pong);
- }
- }
- }
-
-}
--- a/src/com/beem/project/beem/service/XmppFacade.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service;
-
-import android.net.Uri;
-import android.os.RemoteException;
-
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.service.aidl.IChatManager;
-import com.beem.project.beem.service.aidl.IPrivacyListManager;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IXmppConnection;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.utils.PresenceType;
-
-import org.jivesoftware.smack.packet.Presence;
-
-/**
- * This class is a facade for the Beem Service.
- * @author darisk
- */
-public class XmppFacade extends IXmppFacade.Stub {
-
- private XmppConnectionAdapter mConnexion;
- private final BeemService service;
-
- /**
- * Create an XmppFacade.
- *
- * @param service the service providing the facade
- */
- public XmppFacade(final BeemService service) {
- this.service = service;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void changeStatus(int status, String msg) {
- initConnection();
- mConnexion.changeStatus(status, msg);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void connectAsync() throws RemoteException {
- initConnection();
- mConnexion.connectAsync();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void connectSync() throws RemoteException {
- initConnection();
- mConnexion.connectSync();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IXmppConnection createConnection() throws RemoteException {
- initConnection();
- return mConnexion;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void disconnect() throws RemoteException {
- initConnection();
- mConnexion.disconnect();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IChatManager getChatManager() throws RemoteException {
- initConnection();
- return mConnexion.getChatManager();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IRoster getRoster() throws RemoteException {
- initConnection();
- return mConnexion.getRoster();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public IPrivacyListManager getPrivacyListManager() {
- initConnection();
- return mConnexion.getPrivacyListManager();
- }
-
- @Override
- public void sendPresencePacket(PresenceAdapter presence) throws RemoteException {
- initConnection();
- Presence presence2 = new Presence(PresenceType.getPresenceTypeFrom(presence.getType()));
- presence2.setTo(presence.getTo());
- mConnexion.getAdaptee().sendPacket(presence2);
- }
-
- /* (non-Javadoc)
- * @see com.beem.project.beem.service.aidl.IXmppFacade#call(java.lang.String)
- */
- @Override
- public void call(String jid) throws RemoteException {
- }
-
- @Override
- public boolean publishAvatar(Uri avatarUri) throws RemoteException {
- initConnection();
- BeemAvatarManager mgr = mConnexion.getAvatarManager();
- if (mgr == null)
- return false;
-
- return mgr.publishAvatar(avatarUri);
- }
-
- @Override
- public void disableAvatarPublishing() throws RemoteException {
- initConnection();
- BeemAvatarManager mgr = mConnexion.getAvatarManager();
- if (mgr != null)
- mgr.disableAvatarPublishing();
- }
-
- @Override
- public UserInfo getUserInfo() throws RemoteException {
- initConnection();
- return mConnexion.getUserInfo();
- }
-
- /**
- * Initialize the connection.
- */
- private void initConnection() {
- if (mConnexion == null) {
- mConnexion = service.createConnection();
- }
- }
-}
--- a/src/com/beem/project/beem/service/aidl/IBeemConnectionListener.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-/**
- * Interface to listen for connection events
- * @author Da Risk <barthe_f@epitech.eu>
- */
-interface IBeemConnectionListener {
-
- /**
- * Callback to call when the connection is closed
- */
- void connectionClosed();
-
- /**
- * Callback to call when the connection occurs
- * @Deprecated
- */
- //void onConnect();
-
- //void connectionClosedOnError(in Exception e);
- /**
- * Callback to call when the connection is closed on error
- */
- void connectionClosedOnError();
-
- /**
- * Callback to call when trying to reconnecting
- */
- void reconnectingIn(in int seconds);
-
- /**
- * Callback to call when the reconnection has failed
- */
- void reconnectionFailed();
-
- /**
- * Callback to call when the reconnection is successfull
- */
- void reconnectionSuccessful();
-
- /**
- * Callback to call when the connection Failed
- */
- void connectionFailed(in String errorMsg);
-}
--- a/src/com/beem/project/beem/service/aidl/IBeemRosterListener.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.PresenceAdapter;
-
-interface IBeemRosterListener {
- void onEntriesAdded(in List<String> addresses);
- void onEntriesUpdated(in List<String> addresses);
- void onEntriesDeleted(in List<String> addresses);
- void onPresenceChanged(in PresenceAdapter presence);
-}
--- a/src/com/beem/project/beem/service/aidl/IChat.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.Message;
-import com.beem.project.beem.service.aidl.IMessageListener;
-
-/**
- * An aidl interface for Chat session.
- */
-interface IChat {
-
- /**
- * Send a message.
- * @param message the message to send
- */
- void sendMessage(in com.beem.project.beem.service.Message message);
-
- /**
- * Get the participant of the chat
- * @return the participant
- */
- Contact getParticipant();
-
- /**
- * Add a message listener.
- * @param listener the listener to add.
- */
- void addMessageListener(in IMessageListener listener);
-
- /**
- * Remove a message listener.
- * @param listener the listener to remove.
- */
- void removeMessageListener(in IMessageListener listener);
-
- String getState();
-
- void setOpen(in boolean isOpen);
-
- boolean isOpen();
-
- int getUnreadMessageCount();
-
- void setState(in String state);
-
- List<com.beem.project.beem.service.Message> getMessages();
-
- /**
- * Try to start an OTR session.
- */
- void startOtrSession();
-
- /**
- * Stop the OTR session.
- */
- void endOtrSession();
-
- /**
- * get local OTR key fingerprints.
- */
- String getLocalOtrFingerprint();
-
-
- /**
- * get remote OTR key fingerprints.
- */
- String getRemoteOtrFingerprint();
-
- void verifyRemoteFingerprint(in boolean ok);
-
-
- /**
- * get current OTR status.
- */
- String getOtrStatus();
-
-
-}
--- a/src/com/beem/project/beem/service/aidl/IChatManager.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.aidl.IChat;
-import com.beem.project.beem.service.aidl.IMessageListener;
-import com.beem.project.beem.service.aidl.IChatManagerListener;
-
-/**
- * Aidl interface for a chat manager.
- * The chat manager will manage all the chat sessions.
- */
-interface IChatManager {
-
- /**
- * Create a chat session with a contact.
- * @param contact the contact to chat with
- * @param listener the callback to call when a new message comes from this chat session
- * @return the chat session
- */
- IChat createChat(in Contact contact, in IMessageListener listener);
-
- /**
- * Get an existing Chat session with a contact.
- * @return null if the chat session does not exist.
- */
- IChat getChat(in Contact contact);
-
- /**
- * Destroy a chat session with a contact.
- * @param chat the chat session
- */
- void destroyChat(in IChat chat);
-
- /**
- * @param chat the chat.
- */
- void deleteChatNotification(in IChat chat);
-
- /**
- * Register a callback to call when a new chat session is created.
- * @param listener the callback to add
- */
- void addChatCreationListener(in IChatManagerListener listener);
-
- /**
- * Remove a callback for the creation of new chat session.
- * @param listener the callback to remove.
- */
- void removeChatCreationListener(in IChatManagerListener listener);
-
- /**
- * Get a list of contact which we are currently chatting.
- * @return list of contact.
- */
- List<Contact> getOpenedChatList();
-}
--- a/src/com/beem/project/beem/service/aidl/IChatManagerListener.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.aidl.IChat;
-
-/**
- * Aidl interface for ChatManager listener.
- * This listener will execute on events like creation of chat session.
- */
-interface IChatManagerListener {
-
- /**
- * Call when a new chat session is created.
- * @param chat the created chat session
- * @param locally true if the session is create by a chat manager.
- */
- void chatCreated(IChat chat, boolean locally);
-
-}
--- a/src/com/beem/project/beem/service/aidl/IContact.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-interface IContact {
-
- String getJID();
-
- void setJID(String mjid);
-
-}
-
--- a/src/com/beem/project/beem/service/aidl/IMessageListener.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.Message;
-import com.beem.project.beem.service.aidl.IChat;
-
-interface IMessageListener {
-
- /**
- * This method is executed when a chat receive a message.
- * @param chat the chat receiving the message.
- * @param msg the message received in the chat.
- */
- void processMessage(in IChat chat, in com.beem.project.beem.service.Message msg);
-
- /**
- * This method is executed when a new ChatState is received by the chat.
- * You can use IChat.getState() in order to get the new state.
- * @param chat the chat changed.
- */
- void stateChanged(in IChat chat);
- /**
- * This method is executed when the otr session status change.
- * @param otrState the new state of otr session.
- */
- void otrStateChanged(in String otrState);
-}
--- a/src/com/beem/project/beem/service/aidl/IPrivacyListListener.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.PrivacyListItem;
-
-interface IPrivacyListListener {
- void updatedPrivacyList(in String listName);
- void setPrivacyList(in String listName, in List<PrivacyListItem> listItem);
-}
--- a/src/com/beem/project/beem/service/aidl/IPrivacyListManager.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.PrivacyListItem;
-import com.beem.project.beem.service.aidl.IPrivacyListListener;
-
-interface IPrivacyListManager {
- void createPrivacyList(in String listName, in List<PrivacyListItem> items);
- void removePrivacyList(in String listName);
- void editPrivacyList(in String listName, in List<PrivacyListItem> items);
- String getActivePrivacyList();
- String getDefaultPrivacyList();
- void setActivePrivacyList(in String listName);
- void setDefaultPrivacyList(in String listName);
- void declineActivePrivacyList();
- void declineDefaultPrivacyList();
- List<String> getPrivacyLists();
- void blockUser(in String listName, in String jid);
- List<String> getBlockedUsersByList(in String listName);
- List<String> getBlockedGroupsByList(in String listName);
- void addPrivacyListListener(in IPrivacyListListener listener);
- void removePrivacyListListener(in IPrivacyListListener listener);
-}
-
--- a/src/com/beem/project/beem/service/aidl/IRoster.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.aidl.IBeemRosterListener;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.PresenceAdapter;
-
-interface IRoster {
-
- boolean addContact(in String user, in String name, in String[] groups);
-
- void deleteContact(in Contact contact);
-
- Contact getContact(in String jid);
- void setContactName(in String jid, in String name);
-
- void createGroup(in String groupname);
-
- void addContactToGroup(in String groupName, in String jid);
-
- void removeContactFromGroup(in String groupName, in String jid);
-
- List<Contact> getContactList();
-
- List<String> getGroupsNames();
-
- PresenceAdapter getPresence(in String jid);
-
- void addRosterListener(in IBeemRosterListener listen);
- void removeRosterListener(in IBeemRosterListener listen);
-
-}
--- a/src/com/beem/project/beem/service/aidl/IXmppConnection.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IBeemConnectionListener;
-import com.beem.project.beem.service.aidl.IChatManager;
-import com.beem.project.beem.service.aidl.IPrivacyListManager;
-
-interface IXmppConnection {
-
- boolean connect();
-
- boolean login();
-
- boolean connectSync();
-
- void connectAsync();
-
- boolean disconnect();
-
- IRoster getRoster();
-
- void addConnectionListener(in IBeemConnectionListener listen);
- void removeConnectionListener(in IBeemConnectionListener listen);
-
- boolean isAuthentificated();
-
- IChatManager getChatManager();
-
- void changeStatusAndPriority(in int status, in String msg, in int priority);
-
- void changeStatus(in int status, in String msg);
-
- IPrivacyListManager getPrivacyListManager();
-
- String getErrorMessage();
-}
--- a/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.service.aidl;
-
-import com.beem.project.beem.service.aidl.IXmppConnection;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IChatManager;
-import com.beem.project.beem.service.aidl.IPrivacyListManager;
-import com.beem.project.beem.service.PresenceAdapter;
-import com.beem.project.beem.service.UserInfo;
-
-import android.net.Uri;
-
-interface IXmppFacade {
-
- /**
- * Get the XmppConnection of the facade.
- */
- IXmppConnection createConnection();
-
- /**
- * Get the roster of the user
- */
- IRoster getRoster();
-
- /**
- * Connect and login synchronously on the server.
- */
- void connectSync();
-
- /**
- * Connect and login asynchronously on the server.
- */
- void connectAsync();
-
- /**
- * Disconnect from the server
- */
- void disconnect();
-
- /**
- * Get the chat manager.
- */
- IChatManager getChatManager();
-
- /**
- * Change the status of the user.
- * @param status the status to set
- * @param msg the message state to set
- */
- void changeStatus(in int status, in String msg);
-
- void sendPresencePacket(in PresenceAdapter presence);
-
- /**
- * make a jingle audio call
- * @param jid the receiver id
- */
- void call(in String jid);
-
- boolean publishAvatar(in Uri avatarUri);
-
- void disableAvatarPublishing();
-
- /**
- * Get the user informations.
- * @return null if not connected
- */
- UserInfo getUserInfo();
-
- IPrivacyListManager getPrivacyListManager();
-}
--- a/src/com/beem/project/beem/service/auth/AccountAuthenticator.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.service.auth;
-
-import java.io.IOException;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AuthenticatorException;
-import android.accounts.OperationCanceledException;
-import android.content.Context;
-import android.util.Log;
-
-import org.apache.harmony.javax.security.auth.callback.Callback;
-import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
-import org.apache.harmony.javax.security.auth.callback.NameCallback;
-import org.apache.harmony.javax.security.auth.callback.PasswordCallback;
-import org.apache.harmony.javax.security.auth.callback.UnsupportedCallbackException;
-import org.apache.harmony.javax.security.sasl.RealmCallback;
-import org.jivesoftware.smack.util.StringUtils;
-
-/**
- * The AccountAuthenticator use an Android Account to authenticate.
- */
-public class AccountAuthenticator implements CallbackHandler {
- private static final String GOOGLE_TOKEN_TYPE = "oauth2:https://www.googleapis.com/auth/googletalk";
- private static final String TAG = AccountAuthenticator.class.getSimpleName();
-
- private AccountManager accountMgr;
- private Account account;
-
- /**
- * Create an AccountAuthenticator.
- *
- * @param context the Android context
- * @param account the account to use
- *
- */
- public AccountAuthenticator(final Context context, final Account account) {
- accountMgr = AccountManager.get(context);
- this.account = account;
- }
-
- @Override
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- String tmpJid = account.name;
- String service = StringUtils.parseServer(tmpJid);
-
- for (int i = 0; i < callbacks.length; i++) {
- if (callbacks[i] instanceof NameCallback) {
- String authenticationId = StringUtils.parseName(tmpJid);
- if (useFullJid(account)) {
- authenticationId = tmpJid;
- }
- NameCallback ncb = (NameCallback) callbacks[i];
- ncb.setName(authenticationId);
- } else if (callbacks[i] instanceof PasswordCallback) {
- PasswordCallback pcb = (PasswordCallback) callbacks[i];
- // skip if password is asked for PKCS11 (SSL keystore)
- String prompt = pcb.getPrompt();
- if (prompt != null && prompt.startsWith("PKCS11 Password:"))
- continue;
- String password;
- if (useToken(account))
- password = getToken();
- else
- password = accountMgr.getPassword(account);
- if (password == null)
- password = "";
- pcb.setPassword(password.toCharArray());
- } else if (callbacks[i] instanceof RealmCallback) {
- RealmCallback rcb = (RealmCallback) callbacks[i];
- rcb.setText(service);
- } else {
- throw new UnsupportedCallbackException(callbacks[i]);
- }
- }
- }
-
- /**
- * Test if the accout use the full jid to authenticate.
- *
- * @param accountt the account to test
- *
- * @return true if the account use full jid false otherwise
- */
- private boolean useFullJid(Account accountt) {
- String type = accountt.type;
- return "com.google".equals(type);
- }
-
- /**
- * Test if the account use authentication token.
- *
- * @param accountt the account to test
- *
- * @return true if the account use token false otherwise
- */
- private boolean useToken(Account accountt) {
- String type = accountt.type;
- return "com.google".equals(type);
- }
-
- /**
- * Get a authentication token from the Account.
- *
- * @return the token or en empty string if an error occurs
- */
- private String getToken() {
- try {
- return accountMgr.blockingGetAuthToken(account, GOOGLE_TOKEN_TYPE, true);
- } catch (OperationCanceledException e) {
- Log.v(TAG, "Token request canceled", e);
- } catch (AuthenticatorException e) {
- Log.d(TAG, "Unable to get token", e);
- } catch (IOException e) {
- Log.d(TAG, "Unable to get token", e);
- }
- return "";
- }
-}
--- a/src/com/beem/project/beem/service/auth/PreferenceAuthenticator.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.service.auth;
-
-import java.io.IOException;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-
-import com.beem.project.beem.BeemApplication;
-
-import org.apache.harmony.javax.security.auth.callback.Callback;
-import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
-import org.apache.harmony.javax.security.auth.callback.NameCallback;
-import org.apache.harmony.javax.security.auth.callback.PasswordCallback;
-import org.apache.harmony.javax.security.auth.callback.UnsupportedCallbackException;
-import org.apache.harmony.javax.security.sasl.RealmCallback;
-import org.jivesoftware.smack.util.StringUtils;
-
-/**
- * An Authenticator which look for credentials stored in preferences.
- */
-public class PreferenceAuthenticator implements CallbackHandler {
-
- private final SharedPreferences settings;
-
- /**
- * Create a PreferenceAuthenticator.
- *
- * @param context the Android context.
- */
- public PreferenceAuthenticator(final Context context) {
- settings = PreferenceManager.getDefaultSharedPreferences(context);
- }
-
- @Override
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- String tmpJid = settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "").trim();
- String service = StringUtils.parseServer(tmpJid);
-
- for (int i = 0; i < callbacks.length; i++) {
- if (callbacks[i] instanceof NameCallback) {
- String authenticationId = StringUtils.parseName(tmpJid);
- if (settings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false)
- || "gmail.com".equals(service) || "googlemail.com".equals(service)) {
- authenticationId = tmpJid;
- }
- NameCallback ncb = (NameCallback) callbacks[i];
- ncb.setName(authenticationId);
- } else if (callbacks[i] instanceof PasswordCallback) {
- PasswordCallback pcb = (PasswordCallback) callbacks[i];
- // skip if password is asked for PKCS11 (SSL keystore)
- String prompt = pcb.getPrompt();
- if (prompt != null && prompt.startsWith("PKCS11 Password:"))
- continue;
- String password = settings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
- pcb.setPassword(password.toCharArray());
- } else if (callbacks[i] instanceof RealmCallback) {
- RealmCallback rcb = (RealmCallback) callbacks[i];
- rcb.setText(service);
- } else {
- throw new UnsupportedCallbackException(callbacks[i]);
- }
- }
- }
-
-}
--- a/src/com/beem/project/beem/service/auth/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-
-/**
- * This package contains different Authenticator used to login.
- */
-package com.beem.project.beem.service.auth;
--- a/src/com/beem/project/beem/service/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-*/
-/**
- * This package contains all the class use by the service.
- */
-package com.beem.project.beem.service;
-
--- a/src/com/beem/project/beem/smack/avatar/AvatarCache.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Interface for an AvatarCache.
- * This can be improved to a generic cache.
- *
- */
-public interface AvatarCache {
-
- /**
- * Put some datas in cache.
- *
- * @param id the key id of the data
- * @param data the data to cache
- * @throws IOException if an IO error occurs while caching the data
- */
- void put(String id, byte[] data) throws IOException;
-
- /**
- * Put some datas in cache.
- *
- * @param id the key id of the data
- * @param data an InputStream to the data to cache
- * @throws IOException if an IO error occurs while caching the data
- */
- void put(String id, InputStream data) throws IOException;
-
- /**
- * Get some data from the cache.
- *
- * @param id the id of the data to get
- * @return the cached data
- * @throws IOException if an IO error occurs while geting the data
- */
- byte[] get(String id) throws IOException;
-
- /**
- * Test if a data is in cache.
- *
- * @param id the id of the data
- * @return true if data is in cache false otherwise
- */
- boolean contains(String id);
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarExtension.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import org.jivesoftware.smack.util.Base64;
-import org.jivesoftware.smack.packet.PacketExtension;
-
-/**
- * PacketExtension to represent the Avatar data.
- * XML namespace urn:xmpp:avatar:data
- *
- */
-public class AvatarExtension implements PacketExtension {
-
- private String mData;
-
- /**
- * Create an AvatarExtension.
- * @param base64 the data of the avatar as a base64 string
- */
- public AvatarExtension(final String base64) {
- mData = base64;
- }
-
- /**
- * Create an AvatarExtension.
- * @param data the data of the avatar
- */
- public AvatarExtension(final byte[] data) {
- mData = Base64.encodeBytes(data);
- }
-
- /**
- * Get the avatar data as a Base64 string.
- *
- * @return a base64 string.
- */
- public String getBase64() {
- return mData;
- }
-
- /**
- * Get the avatar data.
- *
- * @return the decoded data
- */
- public byte[] getData() {
- return Base64.decode(mData);
- }
-
- @Override
- public String getElementName() {
- return "data";
- }
-
- @Override
- public String getNamespace() {
- return "urn:xmpp:avatar:data";
- }
-
- @Override
- public String toXML() {
- StringBuilder builder = new StringBuilder("<data xmlns=\"");
- builder.append(getNamespace()).append("\">");
- builder.append(mData);
- builder.append("</data>");
- return builder.toString();
- }
-
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarListener.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.util.List;
-import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
-
-/**
- * A listener for avatar changes event.
- *
- */
-public interface AvatarListener {
-
- /**
- * Event which is fired when a contact change avatar.
- *
- * @param from the contact who change his avatar
- * @param avatarId the new avatar id, may be null if the contact set no avatar
- * @param avatarInfos the metadata infos of the avatar, may be empty if the contact set no avatar
- */
- void onAvatarChange(String from, String avatarId, List<Info> avatarInfos);
-
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarManager.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.io.IOException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.LinkedList;
-import java.util.List;
-
-import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
-import com.beem.project.beem.smack.pep.PEPListener;
-import com.beem.project.beem.smack.pep.PepSubManager;
-
-import org.jivesoftware.smack.Connection;
-import org.jivesoftware.smack.packet.PacketExtension;
-import org.jivesoftware.smack.util.StringUtils;
-import org.jivesoftware.smackx.pubsub.Item;
-import org.jivesoftware.smackx.pubsub.LeafNode;
-import org.jivesoftware.smackx.pubsub.PayloadItem;
-
-/**
- * This class deals with the avatar data.
- * It can be configured to auto retrieve the avatar and put it in cache.
- *
- */
-public class AvatarManager {
-
- /** The pubsub node for avatar data. */
- public static final String AVATARDATA_NODE = "urn:xmpp:avatar:data";
- /** The pubsub node for avatar metadata. */
- public static final String AVATARMETADATA_NODE = "urn:xmpp:avatar:metadata";
-
- private PepSubManager mPep;
- private Connection mCon;
- private boolean mAutoDownload;
- private AvatarCache mCache;
- private final List<AvatarListener> mListeners = new LinkedList<AvatarListener>();
-
- /**
- * Create an AvatarManager.
- *
- * @param con the connection
- * @param pepMgr the PepSubManager of the Connection
- * @param cache the cache which will store the avatars
- * @param autoDownload true to enable auto download of avatars
- */
- public AvatarManager(final Connection con, final PepSubManager pepMgr,
- final AvatarCache cache, final boolean autoDownload) {
- mCon = con;
- mPep = pepMgr;
- mAutoDownload = autoDownload;
- mCache = cache;
- mPep.addPEPListener(new Listener());
- }
-
- /**
- * Create an AvatarManager.
- *
- * @param con the connection
- * @param pepMgr the PepSubManager of the Connection
- * @param autoDownload true to enable auto download of avatars
- */
- protected AvatarManager(final Connection con, final PepSubManager pepMgr, final boolean autoDownload) {
- mCon = con;
- mPep = pepMgr;
- mAutoDownload = autoDownload;
- mPep.addPEPListener(new Listener());
- mCache = new MemoryAvatarCache(100, 1800000);
- }
-
- /**
- * Get an avatar from the cache.
- *
- * @param avatarId the id of the avatar
- * @return the avatar or null if it cannot be retrieved from the cache
- */
- public byte[] getAvatar(String avatarId) {
- if (avatarId == null)
- return null;
- try {
- return mCache.get(avatarId);
- } catch (IOException e) {
- return null;
- }
- }
-
- /**
- * Add an AvatarListener.
- *
- * @param listener the AvatarListener to add
- */
- public void addAvatarListener(AvatarListener listener) {
- if (!mListeners.contains(listener))
- mListeners.add(listener);
- }
-
- /**
- * Remove an AvatarListener.
- *
- * @param listener the AvatarListener to remove
- */
- public void removeAvatarListener(AvatarListener listener) {
- mListeners.remove(listener);
- }
-
- /**
- * Download an avatar.
- *
- * @param from The jid of the user
- * @param avatarId the id of the avatar
- * @param info the metadata information of the avatar to download
- * @return true if the download was successfull
- */
- public boolean downloadAvatar(String from, String avatarId, Info info) {
- try {
- AvatarRetriever retriever = AvatarRetrieverFactory.getRetriever(mCon, from, info);
- byte[] avatar = retriever.getAvatar();
- mCache.put(avatarId, avatar);
- return true;
- } catch (IOException e) {
- System.err.println("Error while downloading avatar");
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * Disable the diffusion of your avatar.
- */
- public void disableAvatarPublishing() {
- AvatarMetadataExtension metadata = new AvatarMetadataExtension();
- publishAvatarMetaData(null, metadata);
- }
-
- /**
- * Send an avatar image to the pep server.
- *
- * @param data the image data.
- * @return true if the image where successfully sent. false otherwise
- */
- public boolean publishAvatarData(byte[] data) {
- try {
- String id = getAvatarId(data);
- publishAvatarData(id, data);
- return true;
- } catch (NoSuchAlgorithmException e) {
- System.err.println("Security error while publishing avatar data : " + e.getMessage());
- return false;
- }
- }
-
- /**
- * Send the metadata of the avatar you want to publish.
- * By sending this metadata, you publish an avatar.
- *
- * @param id the id of the metadata item
- * @param metadata the metadata to publish
- */
- public void publishAvatarMetaData(String id, AvatarMetadataExtension metadata) {
- PayloadItem<AvatarMetadataExtension> item = new PayloadItem<AvatarMetadataExtension>(id, metadata);
- LeafNode node = mPep.getPEPNode(AVATARMETADATA_NODE);
- node.publish(item);
- }
-
- /**
- * Select the avatar to download.
- * Subclass should override this method to take control over the selection process.
- * This implementation select the first element.
- *
- * @param available list of the avatar metadata information
- * @return the metadata of the avatar to download
- */
- protected Info selectAvatar(List<Info> available) {
- return available.get(0);
- }
-
-
- /**
- * Get the id corresponding to this avatar data.
- *
- * @param data the avatar data
- * @return the id
- * @throws NoSuchAlgorithmException if the sha-1 algorithm is unavailable
- */
- protected String getAvatarId(byte[] data) throws NoSuchAlgorithmException {
- MessageDigest md = MessageDigest.getInstance("sha-1");
- byte[] hash = md.digest(data);
- return StringUtils.encodeHex(hash);
- }
-
- /**
- * Publish an avatar data.
- *
- * @param id the id of the avatar data
- * @param data the data of the avatar
- */
- private void publishAvatarData(String id, byte[] data) {
- AvatarExtension avatar = new AvatarExtension(data);
- PayloadItem<AvatarExtension> item = new PayloadItem<AvatarExtension>(id, avatar);
- LeafNode node = mPep.getPEPNode(AVATARDATA_NODE);
- node.publish(item);
- }
-
- /**
- * Fire the listeners for avatar change.
- *
- * @param from the jid of the contact
- * @param avatarId the new avatar id
- * @param avatarInfos the metadata infos of the avatar
- */
- private void fireListeners(String from, String avatarId, List<Info> avatarInfos) {
- for (AvatarListener l : mListeners)
- l.onAvatarChange(from, avatarId, avatarInfos);
- }
-
-
- /**
- * A listener to PEPEevent.
- */
- private class Listener implements PEPListener {
-
- /**
- * Create a listener.
- */
- public Listener() {
- }
-
- @Override
- public void eventReceived(String from, String node, List<Item> items) {
- if (!"urn:xmpp:avatar:metadata".equals(node))
- return;
- Item i = items.get(0);
- if (i instanceof PayloadItem) {
- PayloadItem<PacketExtension> pi = (PayloadItem<PacketExtension>) i;
- PacketExtension ex = pi.getPayload();
- if (ex instanceof AvatarMetadataExtension) {
- AvatarMetadataExtension ext = (AvatarMetadataExtension) ex;
- String id = i.getId();
- List<Info> infos = ext.getInfos();
- if (infos.size() > 0 && mAutoDownload) {
- Info info = selectAvatar(infos);
- if (!mCache.contains(id))
- downloadAvatar(from, id, info);
- }
- fireListeners(from, id, infos);
- }
- }
- }
- }
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarMetadataExtension.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.jivesoftware.smack.packet.PacketExtension;
-
-/**
- * PacketExtension to represent the Avatar metadata.
- * XML namespace urn:xmpp:avatar:metadata
- *
- */
-public class AvatarMetadataExtension implements PacketExtension {
- private List<Info> mInfos = new LinkedList<Info>();
-
- /**
- * Create an AvatarMetadataExtension.
- */
- public AvatarMetadataExtension() {
- }
-
- /**
- * Get the metadata informations.
- *
- * @return a list of informations
- */
- public List<Info> getInfos() {
- return mInfos;
- }
-
- /**
- * Add a metadate information.
- *
- * @param info the metadata information to add
- */
- public void addInfo(Info info) {
- mInfos.add(info);
- }
-
- @Override
- public String getElementName() {
- return "metadata";
- }
-
- @Override
- public String getNamespace() {
- return "urn:xmpp:avatar:metadata";
- }
-
- @Override
- public String toXML() {
- StringBuilder builder = new StringBuilder("<metadata xmlns=\"");
- builder.append(getNamespace()).append("\">");
- for (Info info : mInfos) {
- builder.append(info.toXML());
- }
- builder.append("</metadata>");
- return builder.toString();
- }
-
- /**
- * A metadata information element.
- */
- public static class Info {
- private int mBytes;
- private int mHeight;
- private int mWidth;
- private String mId;
- private String mType;
- private String mUrl;
-
- /**
- * Create an Info.
- *
- * @param id the id of the info
- * @param type the MIME type of the avatar
- * @param bytes the size of the avatar in bytes
- */
- public Info(final String id, final String type, final int bytes) {
- mId = id;
- mType = type;
- mBytes = bytes;
- }
-
- /**
- * Set the size of the avatar in bytes.
- *
- * @param bytes the size
- */
- public void setBytes(int bytes) {
- this.mBytes = bytes;
- }
-
- /**
- * Set the size of the avatar in bytes.
- *
- * @return the size
- */
- public int getBytes() {
- return mBytes;
- }
-
- /**
- * Set the height.
- *
- * @param height the height
- */
- public void setHeight(int height) {
- this.mHeight = height;
- }
-
- /**
- * Get the height.
- *
- * @return the height
- */
- public int getHeight() {
- return mHeight;
- }
-
- /**
- * Set the width.
- *
- * @param width the width
- */
- public void setWidth(int width) {
- this.mWidth = width;
- }
-
- /**
- * Get the width.
- *
- * @return the width
- */
- public int getWidth() {
- return mWidth;
- }
-
- /**
- * Set the url.
- *
- * @param url the url
- */
- public void setUrl(String url) {
- this.mUrl = url;
- }
-
- /**
- * Get the url.
- *
- * @return the url, null if no url is present
- */
- public String getUrl() {
- return mUrl;
- }
-
- /**
- * Get the id.
- *
- * @return the id
- */
- public String getId() {
- return mId;
- }
-
- /**
- * Set the id.
- *
- * @param id the id
- */
- public void setId(String id) {
- this.mId = id;
- }
-
- /**
- * Set the MIME type of the avatar.
- *
- * @param type the type
- */
- public void setType(String type) {
- this.mType = type;
- }
-
- /**
- * Get the MIME type of the avatar.
- *
- * @return the type, null if no type is present
- */
- public String getType() {
- return mType;
- }
-
- /**
- * Return this information as an xml element.
- *
- * @return an xml element representing this information
- */
- public String toXML() {
- StringBuilder builder = new StringBuilder("<info ");
- builder.append("id=\"" + mId + "\"");
- builder.append(" type=\"" + mType + "\"");
- builder.append(" bytes=\"" + mBytes + "\"");
-
- if (mHeight > 0)
- builder.append(" height=\"" + mHeight + "\"");
- if (mWidth > 0)
- builder.append(" width=\"" + mWidth + "\"");
- if (mUrl != null)
- builder.append(" url=\"" + mUrl + "\"");
- builder.append(" />");
- return builder.toString();
- }
- }
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarMetadataProvider.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import org.jivesoftware.smack.packet.PacketExtension;
-import org.jivesoftware.smack.provider.PacketExtensionProvider;
-import org.xmlpull.v1.XmlPullParser;
-
-/**
- * A PacketExtensionProvider to parse the Avatar metadata.
- * XML namespace urn:xmpp:avatar:metadata
- */
-public class AvatarMetadataProvider implements PacketExtensionProvider {
-
- /**
- * Creates a new AvatarMetadataProvider.
- * ProviderManager requires that every PacketExtensionProvider has a public, no-argument constructor
- */
- public AvatarMetadataProvider() {
- }
-
- @Override
- public PacketExtension parseExtension(XmlPullParser parser)
- throws Exception {
- AvatarMetadataExtension metadata = new AvatarMetadataExtension();
- boolean done = false;
- while (!done) {
- int eventType = parser.next();
- if (eventType == XmlPullParser.START_TAG) {
- if ("info".equals(parser.getName())) {
- String id = parser.getAttributeValue(null, "id");
- String type = parser.getAttributeValue(null, "type");
- String sbytes = parser.getAttributeValue(null, "bytes");
- String sheight = parser.getAttributeValue(null, "height");
- String swidth = parser.getAttributeValue(null, "width");
- int bytes = 0;
- AvatarMetadataExtension.Info info = null;
- try {
- if (sbytes != null)
- bytes = Integer.parseInt(sbytes);
- } catch (NumberFormatException e) { }
- if (bytes != 0 && id != null && type != null)
- info = new AvatarMetadataExtension.Info(id, type, bytes);
- else // invalid info
- continue;
-
- String url = parser.getAttributeValue(null, "url");
- info.setUrl(url);
- try {
- int height = 0;
- int width = 0;
- if (sheight != null)
- height = Integer.parseInt(parser.getAttributeValue(null, "height"));
- if (swidth != null)
- width = Integer.parseInt(parser.getAttributeValue(null, "width"));
- info.setHeight(height);
- info.setWidth(width);
- } catch (NumberFormatException e) { }
- metadata.addInfo(info);
- }
- } else if (eventType == XmlPullParser.END_TAG) {
- if (parser.getName().equals(metadata.getElementName())) {
- done = true;
- }
- }
- }
- return metadata;
- }
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarProvider.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import org.jivesoftware.smack.packet.PacketExtension;
-import org.jivesoftware.smack.provider.PacketExtensionProvider;
-import org.xmlpull.v1.XmlPullParser;
-
-/**
- * A PacketExtensionProvider to parse the Avatar data.
- * XML namespace urn:xmpp:avatar:data
- */
-public class AvatarProvider implements PacketExtensionProvider {
-
- /**
- * Creates a new AvatarProvider.
- * ProviderManager requires that every PacketExtensionProvider has a public, no-argument constructor
- */
- public AvatarProvider() {
- }
-
- @Override
- public PacketExtension parseExtension(XmlPullParser parser)
- throws Exception {
- boolean done = false;
- while (!done) {
- int eventType = parser.getEventType();
- if (eventType == XmlPullParser.START_TAG) {
- if ("data".equals(parser.getName())) {
- String data = parser.nextText();
- AvatarExtension avatar = new AvatarExtension(data);
- return avatar;
- }
- }
- parser.next();
- }
- return null;
- }
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarRetriever.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.io.IOException;
-
-/**
- * Interface for an AvatarRetriever.
- */
-public interface AvatarRetriever {
-
- /**
- * Retrieve the avatar.
- *
- * @return the avatar
- * @throws IOException if an IO error occurs while retrieving the avatar
- */
- byte[] getAvatar() throws IOException;
-}
--- a/src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
-import org.jivesoftware.smack.Connection;
-// API level 8
-//import android.net.http.AndroidHttpClient;
-//import org.apache.http.client.HttpClient;
-
-/**
- * A factory for AvatarRetriever.
- */
-public final class AvatarRetrieverFactory {
-
- /**
- * Private constructor.
- */
- private AvatarRetrieverFactory() {
- }
-
- /**
- * Get a AvatarRetriever to retrieve this avatar.
- *
- * @param con the connection
- * @param from the user which own the avatar
- * @param info the metadata information of the avatar to retrieve
- * @return an AvatarRetriever null if none can retrieve this avatar
- */
- public static AvatarRetriever getRetriever(Connection con, String from, Info info) {
- String url = info.getUrl();
- if (url != null) {
- // return new HttpAvatarRetriever(url);
- // HttpClient client = AndroidHttpClient.newInstance("Beem");
- return new HttpClientAvatarRetriever(url);
- }
- return new XmppAvatarRetriever(con, from, info.getId());
- }
-}
--- a/src/com/beem/project/beem/smack/avatar/FileAvatarCache.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * An implementation of an AvatarCache which store the data of the filesystem.
- */
-public class FileAvatarCache implements AvatarCache {
-
- private File mStoreDir;
-
- /**
- * Create a FileAvatarCache.
- *
- * @param storedir The directory used to store the data.
- */
- public FileAvatarCache(final File storedir) {
- if (storedir.exists() && !storedir.isDirectory())
- throw new IllegalArgumentException("The store directory must be a directory");
- mStoreDir = storedir;
- mStoreDir.mkdirs();
- }
-
- @Override
- public void put(String key, byte[] data) throws IOException {
- File f = new File(mStoreDir, key);
- OutputStream os = new BufferedOutputStream(new FileOutputStream(f));
- try {
- os.write(data);
- } finally {
- os.close();
- }
- }
-
- @Override
- public void put(String key, InputStream in) throws IOException {
- File f = new File(mStoreDir, key);
- OutputStream os = new BufferedOutputStream(new FileOutputStream(f));
- try {
- byte[] data = new byte[1024];
- int nbread;
- while ((nbread = in.read(data)) != -1)
- os.write(data, 0, nbread);
- } finally {
- in.close();
- os.close();
- }
- }
-
- @Override
- public byte[] get(String key) throws IOException {
- File f = new File(mStoreDir, key);
- InputStream is = new BufferedInputStream(new FileInputStream(f));
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- byte[] data = new byte[1024];
- is.read(data);
- bos.write(data);
- } finally {
- is.close();
- }
- return bos.toByteArray();
- }
-
- @Override
- public boolean contains(String key) {
- File f = new File(mStoreDir, key);
- return f.exists();
- }
-}
--- a/src/com/beem/project/beem/smack/avatar/HttpAvatarRetriever.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-
-/**
- * An AvatarRetriever which retrieve the avatar over HTTP.
- */
-public class HttpAvatarRetriever implements AvatarRetriever {
-
- private URL mUrl;
- private String mUrlString;
-
- /**
- * Create a HttpAvatarRetriever.
- *
- * @param url the url of the avatar to download.
- */
- public HttpAvatarRetriever(final URL url) {
- mUrl = url;
- }
-
- /**
- * Create a HttpAvatarRetriever.
- *
- * @param url the url of the avatar to download.
- */
- public HttpAvatarRetriever(final String url) {
- mUrlString = url;
- }
-
- @Override
- public byte[] getAvatar() throws IOException {
- if (mUrl == null)
- mUrl = new URL(mUrlString);
- InputStream in = mUrl.openStream();
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- try {
- byte[] data = new byte[1024];
- int nbread;
- while ((nbread = in.read(data)) != -1) {
- os.write(data, 0, nbread);
- }
- } finally {
- in.close();
- os.close();
- }
- return os.toByteArray();
- }
-
-}
--- a/src/com/beem/project/beem/smack/avatar/HttpClientAvatarRetriever.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import org.apache.http.client.HttpClient;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpEntity;
-
-/**
- * An AvatarRetriever which retrieve the avatar over HTTP using the Apache HttpClient.
- */
-public class HttpClientAvatarRetriever implements AvatarRetriever {
-
- private String mUrl;
- private HttpClient mClient;
-
- /**
- * Create a HttpAvatarRetriever.
- *
- * @param client the custom HttpClient to use to downlowad
- * @param url the url of the avatar to download.
- */
- public HttpClientAvatarRetriever(final HttpClient client, final String url) {
- mUrl = url;
- mClient = client;
- }
-
- /**
- * Create a HttpAvatarRetriever.
- *
- * @param url the url of the avatar to download.
- */
- public HttpClientAvatarRetriever(final String url) {
- mUrl = url;
- mClient = new DefaultHttpClient();
- }
-
- @Override
- public byte[] getAvatar() throws IOException {
- HttpUriRequest request;
- try {
- request = new HttpGet(mUrl);
- } catch (IllegalArgumentException e) {
- IOException ioe = new IOException("Invalid url " + mUrl);
- ioe.initCause(e);
- throw ioe;
- }
- HttpResponse response = mClient.execute(request);
- HttpEntity entity = response.getEntity();
- InputStream in = entity.getContent();
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- try {
- byte[] data = new byte[1024];
- int nbread;
- while ((nbread = in.read(data)) != -1) {
- os.write(data, 0, nbread);
- }
- } finally {
- in.close();
- os.close();
- }
- return os.toByteArray();
- }
-
-}
--- a/src/com/beem/project/beem/smack/avatar/MemoryAvatarCache.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.jivesoftware.smack.util.Cache;
-
-/**
- * An avatar cache which store the avatars in memory.
- */
-public class MemoryAvatarCache implements AvatarCache {
- private static final int BUFFER_SIZE = 1024;
- private Cache<String, byte[]> mCache;
-
- /**
- * Create a MemoryAvatarCache.
- *
- * @param maxSize the maximum number of objects the cache will hold. -1 means the cache has no max size.
- * @param maxlifetime the maximum amount of time (in ms) objects can exist in cache before being deleted.
- * -1 means objects never expire.
- */
- public MemoryAvatarCache(final int maxSize, final long maxlifetime) {
- mCache = new Cache<String, byte[]>(maxSize, maxlifetime);
- }
-
- @Override
- public void put(String key, byte[] data) throws IOException {
- mCache.put(key, data);
- }
-
- @Override
- public void put(String key, InputStream in) throws IOException {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- try {
- byte[] data = new byte[BUFFER_SIZE];
- int nbread;
- while ((nbread = in.read(data)) != -1)
- os.write(data, 0, nbread);
- } finally {
- in.close();
- os.close();
- }
- mCache.put(key, os.toByteArray());
- }
-
- @Override
- public byte[] get(String key) throws IOException {
- return mCache.get(key);
- }
-
- @Override
- public boolean contains(String key) {
- return mCache.containsKey(key);
- }
-}
--- a/src/com/beem/project/beem/smack/avatar/XmppAvatarRetriever.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.avatar;
-
-import java.util.List;
-import java.util.Arrays;
-import org.jivesoftware.smack.Connection;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smackx.pubsub.LeafNode;
-import org.jivesoftware.smackx.pubsub.Item;
-import org.jivesoftware.smackx.pubsub.PayloadItem;
-
-import com.beem.project.beem.smack.pep.PepSubManager;
-
-/**
- * An AvatarRetriever which retrieve the avatar over the XMPP connection.
- */
-public class XmppAvatarRetriever implements AvatarRetriever {
-
- private static String AVATARDATANODE = "urn:xmpp:avatar:data";
- private PepSubManager mPubsub;
- private String mFrom;
- private String mId;
-
- /**
- * Create an XmppAvatarRetriever.
- *
- * @param con the xmpp connection
- * @param from the contact from which we retrieve the avatar
- * @param id the id of the avatar to retrieve
- */
- public XmppAvatarRetriever(final Connection con, final String from, final String id) {
- mPubsub = new PepSubManager(con, from);
- mFrom = from;
- mId = id;
- }
-
- @Override
- public byte[] getAvatar() {
- try {
- LeafNode node = mPubsub.getPEPNode(AVATARDATANODE);
- List<Item> items = node.getItems(Arrays.asList(mId));
- PayloadItem<AvatarExtension> item = (PayloadItem<AvatarExtension>) items.get(0);
- AvatarExtension avatar = item.getPayload();
- return avatar.getData();
- } catch (XMPPException e) {
- return null;
- }
- }
-
-}
--- a/src/com/beem/project/beem/smack/avatar/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-
-/**
- * This package contains implementation of XEP-0084 User Avatar.
- */
-package com.beem.project.beem.smack.avatar;
--- a/src/com/beem/project/beem/smack/pep/PEPListener.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.pep;
-
-import org.jivesoftware.smackx.pubsub.Item;
-import java.util.List;
-
-/**
- * A listener that is fired anytime a PEP event message is received.
- */
-public interface PEPListener {
-
- /**
- * Called when PEP events are received.
- *
- * @param from the JID of the user who send the event
- * @param node the node of the items in the event
- * @param items the different items of the event
- */
- void eventReceived(String from, String node, List<Item> items);
-
-}
--- a/src/com/beem/project/beem/smack/pep/PepSubManager.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.smack.pep;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jivesoftware.smack.Connection;
-import org.jivesoftware.smack.filter.PacketExtensionFilter;
-import org.jivesoftware.smack.filter.PacketFilter;
-import org.jivesoftware.smack.PacketListener;
-import org.jivesoftware.smack.packet.Packet;
-import org.jivesoftware.smackx.pubsub.EventElement;
-import org.jivesoftware.smackx.pubsub.EventElementType;
-import org.jivesoftware.smackx.pubsub.Item;
-import org.jivesoftware.smackx.pubsub.ItemsExtension;
-import org.jivesoftware.smackx.pubsub.PubSubManager;
-import org.jivesoftware.smackx.pubsub.LeafNode;
-
-/**
- * Little extension of {@link PubSubManager} which allows to add {@link PEPListener}.
- *
- */
-public class PepSubManager extends PubSubManager {
- private List<PEPListener> mPepListeners = new ArrayList<PEPListener>();
- private PacketFilter mPacketFilter = new PacketExtensionFilter("event", "http://jabber.org/protocol/pubsub#event");
-
- /**
- * Create a PepSubManager.
- *
- * @param connection the connection
- */
- public PepSubManager(final Connection connection) {
- super(connection);
- init(connection);
- }
-
- /**
- * Create a PepSubManager associated to the specified connection where the pubsub
- * requests require a specific to address for packets.
- *
- * @param connection the connection
- * @param toAddress The pubsub specific to address (required for some servers)
- */
- public PepSubManager(final Connection connection, final String toAddress) {
- super(connection, toAddress);
- init(connection);
- }
-
- /**
- * Add a listener to PEP event.
- *
- * @param listener the listener
- */
- public void addPEPListener(PEPListener listener) {
- if (!mPepListeners.contains(listener))
- mPepListeners.add(listener);
- }
-
- /**
- * Remove a listener to PEP event.
- *
- * @param listener the listener
- */
- public void removePEPListener(PEPListener listener) {
- mPepListeners.remove(listener);
- }
-
- /**
- * Get a PepNode.
- * This node is obtain without checking its existence as PEP should auto create it.
- *
- * @param nodeName the node name
- * @return the node
- */
- public LeafNode getPEPNode(String nodeName) {
- LeafNode node = new LeafNode(con, nodeName);
- node.setTo(to);
- return node;
- }
-
- /**
- * Initialize the PepSubManager.
- *
- * @param con the connection
- */
- private void init(Connection con) {
- PacketListener packetListener = new PacketListener() {
-
- @Override
- public void processPacket(Packet packet) {
- EventElement e = (EventElement) packet.getExtension("event", "http://jabber.org/protocol/pubsub#event");
- if (e.getEventType() != EventElementType.items)
- return;
- ItemsExtension it = (ItemsExtension) e.getEvent();
- if (it.getItemsElementType() != ItemsExtension.ItemsElementType.items)
- return;
- List<Item> items = (List<Item>) it.getItems();
- firePEPListeners(packet.getFrom(), it.getNode(), items);
- }
- };
- con.addPacketListener(packetListener, mPacketFilter);
- }
-
- /**
- * Fire the PEP listeners.
- *
- * @param from the JID of the user who send the event
- * @param node the node of the items in the event
- * @param items the different items of the event
- */
- private void firePEPListeners(String from, String node, List<Item> items) {
- for (PEPListener listener : mPepListeners) {
- listener.eventReceived(from, node, items);
- }
- }
-}
--- a/src/com/beem/project/beem/smack/pep/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-
-/**
- * This package contains an implementation of XEP-0163 Personnal Eventing Protocol based on the pubsub implementation.
- */
-package com.beem.project.beem.smack.pep;
-
--- a/src/com/beem/project/beem/smack/ping/PingExtension.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
-*/
-
-package com.beem.project.beem.smack.ping;
-
-import org.jivesoftware.smack.packet.IQ;
-
-/**
- * This extension represents a iq ping.
- *
- */
-public class PingExtension extends IQ {
-
- /** Namespace of the Ping XEP. */
- public static final String NAMESPACE = "urn:xmpp:ping";
-
- /** Xml element name for the ping. */
- public static final String ELEMENT = "ping";
-
-
- /**
- * Create a ping iq packet.
- */
- public PingExtension() {
- }
-
- @Override
- public String getChildElementXML() {
- if (getType() == IQ.Type.RESULT)
- return null;
- return "<" + ELEMENT + " xmlns=\"" + NAMESPACE + "\" />";
- }
-
-}
--- a/src/com/beem/project/beem/smack/ping/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
-*/
-
-/**
- * This package contains implementation of XEP-0199 XMPP Ping.
- */
-package com.beem.project.beem.smack.ping;
--- a/src/com/beem/project/beem/smack/sasl/SASLGoogleOAuth2Mechanism.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.smack.sasl;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import de.measite.smack.Sasl;
-
-import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
-import org.apache.harmony.javax.security.sasl.SaslException;
-import org.jivesoftware.smack.SASLAuthentication;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.packet.Packet;
-import org.jivesoftware.smack.sasl.SASLMechanism;
-import org.jivesoftware.smack.util.Base64;
-
-/**
- * An implementation of the SASL OAuth2 mechanism made by Google.
- * The extension is described here :
- * https://developers.google.com/talk/jep_extensions/oauth
- */
-public class SASLGoogleOAuth2Mechanism extends SASLMechanism {
-
- /**
- * The name of the Google Oauth mechanism.
- */
- public static final String MECHANISM_NAME = "X-OAUTH2";
-
- /**
- * Create a SASLGoogleOAuth2Mechanism.
- *
- * @param saslAuthentication the smack SASLAuthentication.
- *
- */
- public SASLGoogleOAuth2Mechanism(final SASLAuthentication saslAuthentication) {
- super(saslAuthentication);
- }
-
- @Override
- public void authenticate(String username, String host, String password) throws IOException, XMPPException {
- //Since we were not provided with a CallbackHandler, we will use our own with the given
- //information
-
- //Set the authenticationID as the username, since they must be the same in this case.
- this.authenticationId = username;
- this.password = password;
- this.hostname = host;
-
- String[] mechanisms = {"PLAIN" };
- Map<String, String> props = new HashMap<String, String>();
- sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
- authenticate();
- }
-
- @Override
- public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
- String[] mechanisms = {"PLAIN" };
- Map<String, String> props = new HashMap<String, String>();
- sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
- authenticate();
- }
-
- @Override
- protected void authenticate() throws IOException, XMPPException {
- String authenticationText = null;
- try {
- if (sc.hasInitialResponse()) {
- byte[] response = sc.evaluateChallenge(new byte[0]);
- authenticationText = Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
- }
- } catch (SaslException e) {
- throw new XMPPException("SASL authentication failed", e);
- }
-
- // Send the authentication to the server
- getSASLAuthentication().send(new GoogleOAuthMechanism(authenticationText));
- }
-
- @Override
- protected String getName() {
- return MECHANISM_NAME;
- }
-
- /**
- * Initiating SASL authentication by select a mechanism.
- */
- public static class GoogleOAuthMechanism extends Packet {
- private final String authenticationText;
-
- /**
- * Create a GoogleOAuthMechanism.
- *
- * @param authenticationText the authentification token
- *
- */
- public GoogleOAuthMechanism(final String authenticationText) {
- this.authenticationText = authenticationText;
- }
-
- @Override
- public String toXML() {
- StringBuilder stanza = new StringBuilder();
- stanza.append("<auth mechanism=\"").append(MECHANISM_NAME);
- stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" "
- + "auth:service=\"oauth2\" "
- + "xmlns:auth=\"http://www.google.com/talk/protocol/auth\">");
- if (authenticationText != null
- && authenticationText.trim().length() > 0) {
- stanza.append(authenticationText);
- }
- stanza.append("</auth>");
- return stanza.toString();
- }
- }
-}
--- a/src/com/beem/project/beem/smack/sasl/ScramSaslClient.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,302 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.smack.sasl;
-
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-
-import com.isode.stroke.base.ByteArray;
-import com.isode.stroke.sasl.SCRAMSHA1ClientAuthenticator;
-
-import org.apache.harmony.javax.security.auth.callback.Callback;
-import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
-import org.apache.harmony.javax.security.auth.callback.NameCallback;
-import org.apache.harmony.javax.security.auth.callback.PasswordCallback;
-import org.apache.harmony.javax.security.auth.callback.UnsupportedCallbackException;
-import org.apache.harmony.javax.security.sasl.SaslClient;
-import org.apache.harmony.javax.security.sasl.SaslException;
-
-/**
- * A SaslClient which uses the SCRAM-SHA-! mechanism.
- * This implementation is based on Stroke (http://swift.im/git/stroke)
- */
-public class ScramSaslClient implements SaslClient {
-
- private static final int NONCE_BYTE_COUNT = 32;
- private static final int NONCE_HEX_COUNT = 2 * NONCE_BYTE_COUNT;
- private static final char[] hexChars = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
- private SCRAMSHA1ClientAuthenticator clientAuthenticator;
- private CallbackHandler cbh;
- private String authzid;
-
- /**
- * Create a ScramSaslClient.
- * @param authorizationId the authorizationId uses by the client
- * @param cbh a CallbackHandler to get more informations
- */
- public ScramSaslClient(final String authorizationId, final CallbackHandler cbh) {
- this.cbh = cbh;
- this.authzid = authorizationId;
- }
-
- /**
- * Disposes of any system resources or security-sensitive information the
- * SaslClient might be using. Invoking this method invalidates the
- * SaslClient instance. This method is idempotent.
- *
- * @exception SaslException if a problem was encountered while disposing
- * of the resources
- */
- @Override
- public void dispose() throws SaslException {
- }
-
- /**
- * Evaluates the challenge data and generates a response. If a challenge
- * is received from the server during the authentication process, this
- * method is called to prepare an appropriate next response to submit to
- * the server.
- *
- * @param challenge The non-null challenge sent from the server. The
- * challenge array may have zero length.
- *
- * @return The possibly null reponse to send to the server. It is null
- * if the challenge accompanied a "SUCCESS" status and the
- * challenge only contains data for the client to update its
- * state and no response needs to be sent to the server.
- * The response is a zero-length byte array if the client is to
- * send a response with no data.
- *
- * @exception SaslException If an error occurred while processing the
- * challenge or generating a response.
- */
- @Override
- public byte[] evaluateChallenge(byte[] challenge) throws SaslException {
- if (clientAuthenticator == null) {
- Object[] userInfo = getUserInfo();
- String authcid = (String) userInfo[0];
- byte[] passwdBytes = (byte[]) userInfo[1];
- String passwd = new String(passwdBytes);
- String nonce = getClientNonce();
- clientAuthenticator = new SCRAMSHA1ClientAuthenticator(nonce);
- // some servers (ejabberd) reject the challenge if the
- // scram attributes a (authzid) and n (authcid) are equals
- // or they just don't handle the authzid
- // So we just don't send it if they are the same
- if (authcid != null && authcid.equals(authzid))
- authzid = "";
- clientAuthenticator.setCredentials(authcid, passwd, authzid);
- return clientAuthenticator.getResponse().getData();
- }
- clientAuthenticator.setChallenge(new ByteArray(challenge));
- return clientAuthenticator.getResponse().getData();
- }
-
- /**
- * Returns the IANA-registered mechanism name of this SASL client.
- * (e.g. "CRAM-MD5", "GSSAPI")
- *
- * @return "SCRAM-SHA-!" the IANA-registered mechanism name of this SASL
- * client.
- */
- @Override
- public String getMechanismName() {
- return "SCRAM-SHA-1";
- }
-
- /**
- * Retrieves the negotiated property. This method can be called only after
- * the authentication exchange has completed (i.e., when isComplete()
- * returns true); otherwise, an IllegalStateException is thrown.
- *
- *
- * @param propName The non-null property name
- *
- * @return The value of the negotiated property. If null, the property was
- * not negotiated or is not applicable to this mechanism. This
- * implementation allways returns null.
- *
- * @exception IllegalStateException if this authentication exchange has
- * not completed
- */
- @Override
- public Object getNegotiatedProperty(String propName) {
- return null;
- }
-
- /**
- * Determines if this mechanism has an optional initial response. If true,
- * caller should call evaluateChallenge() with an empty array to get the
- * initial response.
- *
- * @return true if this mechanism has an initial response. This
- * implementation always return true.
- */
- @Override
- public boolean hasInitialResponse() {
- return true;
- }
-
- /**
- * Determines if the authentication exchange has completed. This method
- * may be called at any time, but typically, it will not be called until
- * the caller has received indication from the server (in a protocol-
- * specific manner) that the exchange has completed.
- *
- * @return true if the authentication exchange has completed;
- * false otherwise.
- */
- @Override
- public boolean isComplete() {
- if (clientAuthenticator == null)
- return false;
- return clientAuthenticator.getResponse() == null;
- }
-
- /**
- * Unwraps a byte array received from the server. This method can be called
- * only after the authentication exchange has completed (i.e., when
- * isComplete() returns true) and only if the authentication exchange has
- * negotiated integrity and/or privacy as the quality of protection;
- * otherwise, an IllegalStateException is thrown.
- *
- * This implementation always throw an IllegalStateException.
- *
- * incoming is the contents of the SASL buffer as defined in RFC 2222
- * without the leading four octet field that represents the length.
- * offset and len specify the portion of incoming to use.
- *
- * @param incoming A non-null byte array containing the encoded bytes
- * from the server
- * @param offset The starting position at incoming of the bytes to use
- *
- * @param len The number of bytes from incoming to use
- *
- * @return A non-null byte array containing the decoded bytes
- * @throws SaslException if an error occurs
- *
- */
- @Override
- public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
- throw new IllegalStateException("SCRAM-SHA-1: this mechanism supports "
- + "neither integrity nor privacy");
- }
-
- /**
- * Wraps a byte array to be sent to the server. This method can be called
- * only after the authentication exchange has completed (i.e., when
- * isComplete() returns true) and only if the authentication exchange has
- * negotiated integrity and/or privacy as the quality of protection;
- * otherwise, an IllegalStateException is thrown.
- *
- * This implementation always throw an IllegalStateException.
- *
- * The result of this method will make up the contents of the SASL buffer as
- * defined in RFC 2222 without the leading four octet field that represents
- * the length. offset and len specify the portion of outgoing to use.
- *
- * @param outgoing A non-null byte array containing the bytes to encode
- * @param offset The starting position at outgoing of the bytes to use
- * @param len The number of bytes from outgoing to use
- *
- * @return A non-null byte array containing the encoded bytes
- *
- * @exception SaslException if incoming cannot be successfully unwrapped.
- *
- * @exception IllegalStateException if the authentication exchange has
- * not completed, or if the negotiated quality of
- * protection has neither integrity nor privacy.
- */
- @Override
- public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
- throw new IllegalStateException("SCRAM-SHA-1: this mechanism supports "
- + "neither integrity nor privacy");
- }
-
-
- /**
- * Calculates the Nonce value of the Client.
- *
- * @return Nonce value of the client
- *
- * @exception SaslException If an error Occurs
- */
- private String getClientNonce() throws SaslException {
- byte[] nonceBytes = new byte[NONCE_BYTE_COUNT];
- SecureRandom prng;
- char[] hexNonce = new char[NONCE_HEX_COUNT];
-
- try {
- prng = SecureRandom.getInstance("SHA1PRNG");
- prng.nextBytes(nonceBytes);
- for (int i = 0; i < NONCE_BYTE_COUNT; i++) {
- final int val = nonceBytes[i] & 0xff;
- //low nibble
- hexNonce[i * 2] = hexChars[val / 0x10];
- //high nibble
- hexNonce[(i * 2) + 1] = hexChars[val % 0x10];
- }
- return new String(hexNonce);
- } catch (NoSuchAlgorithmException e) {
- throw new SaslException("No random number generator available", e);
- }
- }
-
- /**
- * Get informations supplied by the user of the SaslClient.
- * These informations are retrived by using the CallbackHandler.
- *
- * @return an array of object
- * @throws SaslException if the informations cannot be retrieved
- */
- private Object[] getUserInfo() throws SaslException {
- try {
- final String userPrompt = "Authentication id: ";
- final String pwPrompt = "Password: ";
- NameCallback nameCb = new NameCallback(userPrompt);
- PasswordCallback passwordCb = new PasswordCallback(pwPrompt, false);
- cbh.handle(new Callback[] {nameCb, passwordCb });
- String userid = nameCb.getName();
- char[] pwchars = passwordCb.getPassword();
- byte[] pwbytes;
- if (pwchars != null) {
- pwbytes = (new String(pwchars)).getBytes("UTF8");
- passwordCb.clearPassword();
- } else {
- pwbytes = null;
- }
- return new Object[] {userid, pwbytes };
- } catch (IOException e) {
- throw new SaslException("Cannot get password", e);
- } catch (UnsupportedCallbackException e) {
- throw new SaslException("Cannot get userid/password", e);
- }
- }
-}
--- a/src/com/beem/project/beem/smack/sasl/ScramSaslMechanism.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.smack.sasl;
-
-import java.io.IOException;
-
-
-import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
-import org.jivesoftware.smack.SASLAuthentication;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.sasl.SASLMechanism;
-
-/**
- * An implementation of the SCRAM-SHA-1 SASL mechanism.
- * This implementation is based on Stroke http://swift.im/git/stroke.
- */
-public class ScramSaslMechanism extends SASLMechanism {
-
- /**
- * The name of the SASL mechanism.
- */
- public static final String MECHANISM_NAME = "SCRAM-SHA-1";
-
- /**
- * Create a ScramSaslMechanism.
- *
- * @param saslAuthentication the smack SASLAuthentication.
- *
- */
- public ScramSaslMechanism(final SASLAuthentication saslAuthentication) {
- super(saslAuthentication);
- }
-
- @Override
- public void authenticate(String username, String host, String password) throws IOException, XMPPException {
- this.authenticationId = username;
- this.password = password;
- this.hostname = host;
-
- sc = new ScramSaslClient(username, this);
- authenticate();
- }
-
- @Override
- public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
- this.authenticationId = username;
- this.hostname = host;
- sc = new ScramSaslClient(username, cbh);
- authenticate();
- }
-
- @Override
- protected String getName() {
- return MECHANISM_NAME;
- }
-
-}
--- a/src/com/beem/project/beem/smack/sasl/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-
-/**
- * This package contains implementations of different SASL mechanism.
- */
-package com.beem.project.beem.smack.sasl;
--- a/src/com/beem/project/beem/ui/AddContact.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.Toast;
-
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-
-/**
- * This activity is used to add a contact.
- * @author nikita
- */
-public class AddContact extends Activity {
-
- private static final Intent SERVICE_INTENT = new Intent();
- private static final String TAG = "AddContact";
- private final List<String> mGroup = new ArrayList<String>();
- private IXmppFacade mXmppFacade;
- private final ServiceConnection mServConn = new BeemServiceConnection();
- private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
- private final OkListener mOkListener = new OkListener();
-
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
-
- /**
- * Constructor.
- */
- public AddContact() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.addcontact);
- Button ok = (Button) findViewById(R.id.addc_ok);
- ok.setOnClickListener(mOkListener);
- this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onStart()
- */
- @Override
- protected void onStart() {
- super.onStart();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onResume() {
- super.onResume();
- bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onPause() {
- super.onPause();
- unbindService(mServConn);
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onDestroy()
- */
- @Override
- protected void onDestroy() {
- super.onDestroy();
- this.unregisterReceiver(mReceiver);
- }
-
- /**
- * Get the text of a widget.
- * @param id the id of the widget.
- * @return the text of the widget.
- */
- private String getWidgetText(int id) {
- EditText widget = (EditText) this.findViewById(id);
- return widget.getText().toString();
- }
-
- /**
- * The ServiceConnection used to connect to the Beem service.
- */
- private class BeemServiceConnection implements ServiceConnection {
-
- /**
- * Constructor.
- */
- public BeemServiceConnection() {
- }
-
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mXmppFacade = IXmppFacade.Stub.asInterface(service);
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- mXmppFacade = null;
- }
- }
-
- /**
- * Listener.
- */
- private class OkListener implements OnClickListener {
-
- /**
- * Constructor.
- */
- public OkListener() { }
-
- @Override
- public void onClick(View v) {
- String login;
- login = getWidgetText(R.id.addc_login);
- if (TextUtils.isEmpty(login)) {
- Toast.makeText(AddContact.this, getString(R.string.AddCContactAddedLoginError), Toast.LENGTH_SHORT)
- .show();
- return;
- }
- String alias;
- alias = getWidgetText(R.id.addc_alias);
- if (getWidgetText(R.id.addc_group).length() != 0)
- mGroup.add(getWidgetText(R.id.addc_group));
- try {
- if (mXmppFacade != null) {
- IRoster roster = mXmppFacade.getRoster();
- if (roster.getContact(login) != null) {
- mGroup.addAll(roster.getContact(login).getGroups());
- Toast.makeText(AddContact.this, getString(R.string.AddCContactAlready), Toast.LENGTH_SHORT)
- .show();
- return;
- }
- if (!roster.addContact(login, alias, mGroup.toArray(new String[mGroup.size()]))) {
- Toast.makeText(AddContact.this, getString(R.string.AddCContactAddedError), Toast.LENGTH_SHORT)
- .show();
- return;
- } else {
- Toast.makeText(AddContact.this, getString(R.string.AddCContactAdded), Toast.LENGTH_SHORT)
- .show();
- finish();
- }
- }
- } catch (RemoteException e) {
- Toast.makeText(AddContact.this, e.getMessage(), Toast.LENGTH_SHORT).show();
- Log.e(TAG, "Problem adding contact", e);
- }
-
- }
- };
-}
--- a/src/com/beem/project/beem/ui/ChangeStatus.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,602 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-
-package com.beem.project.beem.ui;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.ActivityNotFoundException;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.preference.PreferenceManager;
-import android.provider.MediaStore;
-import android.util.Log;
-import android.view.ContextThemeWrapper;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.ListAdapter;
-import android.widget.Spinner;
-import android.widget.Toast;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
-import com.beem.project.beem.providers.AvatarProvider;
-import com.beem.project.beem.service.UserInfo;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-import com.beem.project.beem.utils.BeemConnectivity;
-import com.beem.project.beem.utils.Status;
-
-/**
- * This Activity is used to change the status.
- * @author nikita
- */
-public class ChangeStatus extends Activity {
-
- private static final Intent SERVICE_INTENT = new Intent();
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
-
- private static final String TAG = ChangeStatus.class.getSimpleName();
- private static final int AVAILABLE_FOR_CHAT_IDX = 0;
- private static final int AVAILABLE_IDX = 1;
- private static final int BUSY_IDX = 2;
- private static final int AWAY_IDX = 3;
- private static final int UNAVAILABLE_IDX = 4;
- private static final int DISCONNECTED_IDX = 5;
-
- private static final int ICON_SIZE = 80;
-
- private static final int SELECT_PHOTO_DLG = 0;
-
- private static final int CAMERA_WITH_DATA = 0;
- private static final int PHOTO_PICKED_WITH_DATA = 1;
-
- private static final File PHOTO_DIR = new File(
- Environment.getExternalStorageDirectory() + "/DCIM/Camera");
-
- private static final String KEY_CURRENT_PHOTO_FILE = "currentphotofile";
-
- private static final Uri MY_AVATAR_URI = Uri.parse(AvatarProvider.CONTENT_URI + "/my_avatar");
-
- private EditText mStatusMessageEditText;
- private Toast mToast;
- private Button mOk;
- private Button mClear;
- private Button mContact;
- private Spinner mSpinner;
- private ImageButton mAvatar;
- private Uri mAvatarUri;
-
- private SharedPreferences mSettings;
- private ArrayAdapter<CharSequence> mAdapter;
- private IXmppFacade mXmppFacade;
- private final ServiceConnection mServConn = new BeemServiceConnection();
- private final OnClickListener mOnClickOk = new MyOnClickListener();
- private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
- private boolean mShowCurrentAvatar = true;
- private boolean mDisableAvatar;
- private File mCurrentPhotoFile;
-
- /**
- * Constructor.
- */
- public ChangeStatus() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- Log.d(TAG, "oncreate");
- setContentView(R.layout.changestatus);
-
- mOk = (Button) findViewById(R.id.ChangeStatusOk);
- mOk.setOnClickListener(mOnClickOk);
-
- mClear = (Button) findViewById(R.id.ChangeStatusClear);
- mClear.setOnClickListener(mOnClickOk);
-
- mContact = (Button) findViewById(R.id.OpenContactList);
- mContact.setOnClickListener(mOnClickOk);
-
- BeemApplication app = (BeemApplication) getApplication();
- mAvatar = (ImageButton) findViewById(R.id.avatarButton);
- mAvatar.setOnClickListener(mOnClickOk);
- if (!app.isPepEnabled()) {
- View avatarPanel = findViewById(R.id.avatar_panel);
- avatarPanel.setVisibility(View.GONE);
- }
-
-
- mSettings = PreferenceManager.getDefaultSharedPreferences(this);
- mStatusMessageEditText = (EditText) findViewById(R.id.ChangeStatusMessage);
- mStatusMessageEditText.setText(mSettings.getString(BeemApplication.STATUS_TEXT_KEY, ""));
-
- mSpinner = (Spinner) findViewById(R.id.ChangeStatusSpinner);
- mAdapter = ArrayAdapter.createFromResource(this, R.array.status_types, android.R.layout.simple_spinner_item);
- mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- mSpinner.setAdapter(mAdapter);
-
- mToast = Toast.makeText(this, R.string.ChangeStatusOk, Toast.LENGTH_LONG);
- mSpinner.setSelection(getPreferenceStatusIndex());
-
- this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onResume() {
- super.onResume();
- if (!BeemConnectivity.isConnected(getApplicationContext())) {
- Intent i = new Intent(this, Login.class);
- startActivity(i);
- finish();
- }
- bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onPause() {
- super.onPause();
- unbindService(mServConn);
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onDestroy()
- */
- @Override
- protected void onDestroy() {
- super.onDestroy();
- this.unregisterReceiver(mReceiver);
- }
-
- /*
- * The activity is often reclaimed by the system memory.
- */
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- if (mCurrentPhotoFile != null) {
- outState.putString(KEY_CURRENT_PHOTO_FILE, mCurrentPhotoFile.toString());
- }
- super.onSaveInstanceState(outState);
- }
-
- @Override
- protected void onRestoreInstanceState(Bundle savedInstanceState) {
- String fileName = savedInstanceState.getString(KEY_CURRENT_PHOTO_FILE);
- if (fileName != null) {
- mCurrentPhotoFile = new File(fileName);
- }
- super.onRestoreInstanceState(savedInstanceState);
- }
-
-
-
- @Override
- protected Dialog onCreateDialog(int id) {
- if (id == SELECT_PHOTO_DLG)
- return createPickPhotoDialog();
- return null;
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- // Ignore failed requests
- if (resultCode != RESULT_OK) return;
-
- switch (requestCode) {
- case PHOTO_PICKED_WITH_DATA:
- // We tell the activity to put the result in MY_AVATAR_URI
- mAvatarUri = MY_AVATAR_URI;
- Log.d(TAG, "selected avatar uri " + mAvatarUri);
- if (mAvatarUri != null) {
- // force reload of image even it is the same uri
- mAvatar.setImageURI(null);
- mAvatar.setImageURI(mAvatarUri);
- mDisableAvatar = false;
- mShowCurrentAvatar = false;
- }
- break;
-
- case CAMERA_WITH_DATA:
- doCropPhoto(mCurrentPhotoFile);
- break;
- default:
- Log.w(TAG, "onActivityResult : invalid request code");
-
- }
- }
-
- /**
- * Return the status index from status the settings.
- * @return the status index from status the settings.
- */
- private int getPreferenceStatusIndex() {
- return mSettings.getInt(BeemApplication.STATUS_KEY, AVAILABLE_IDX);
- }
-
- /**
- * Return the status text from status the settings.
- * @param id status text id.
- * @return the status text from status the settings.
- */
- private String getPreferenceString(int id) {
- return mSettings.getString(getString(id), "");
- }
-
- /**
- * convert status text to.
- * @param item selected item text.
- * @return item position in the array.
- */
- private int getStatusForService(String item) {
- int result;
- switch (mAdapter.getPosition(item)) {
- case ChangeStatus.DISCONNECTED_IDX:
- result = Status.CONTACT_STATUS_DISCONNECT;
- break;
- case ChangeStatus.AVAILABLE_FOR_CHAT_IDX:
- result = Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
- break;
- case ChangeStatus.AVAILABLE_IDX:
- result = Status.CONTACT_STATUS_AVAILABLE;
- break;
- case ChangeStatus.AWAY_IDX:
- result = Status.CONTACT_STATUS_AWAY;
- break;
- case ChangeStatus.BUSY_IDX:
- result = Status.CONTACT_STATUS_BUSY;
- break;
- case ChangeStatus.UNAVAILABLE_IDX:
- result = Status.CONTACT_STATUS_UNAVAILABLE;
- break;
- default:
- result = Status.CONTACT_STATUS_AVAILABLE;
- break;
- }
- return result;
- }
-
- /**
- * ClickListener for the avatarButton.
- *
- * @param button the avatar button
- */
- private void onAvatarButton(View button) {
- showDialog(SELECT_PHOTO_DLG);
- }
-
- /**
- * Publish the selected avatar.
- */
- private void publishAvatar() {
- try {
- if (mDisableAvatar)
- mXmppFacade.disableAvatarPublishing();
- else if (mAvatarUri != null)
- mXmppFacade.publishAvatar(mAvatarUri);
- } catch (RemoteException e) {
- Log.e(TAG, "Error while publishing avatar", e);
- }
- }
-
- /**
- * Display the current avatar in the button.
- */
- private void displayCurrentAvatar() {
- try {
- UserInfo ui = mXmppFacade.getUserInfo();
- if (ui == null)
- return;
- String avatarId = ui.getAvatarId();
- Log.d(TAG, "User info : avatar id " + avatarId);
- if (avatarId != null) {
- Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(avatarId).build();
- mAvatar.setImageURI(uri);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Error while displaying current avatar", e);
- }
- mShowCurrentAvatar = false;
- }
-
- /*
- * Some codes from AOSP (platform/packages/apps/Contacts)
- * to select and crop an image.
- */
-
- /**
- * Creates a dialog offering two options: take a photo or pick a photo from the gallery.
- * @return the dialog
- */
- private Dialog createPickPhotoDialog() {
- // Wrap our context to inflate list items using correct theme
- final Context dialogContext = new ContextThemeWrapper(this,
- android.R.style.Theme_Light);
-
- final ListAdapter adapter = ArrayAdapter.createFromResource(dialogContext,
- R.array.pick_photo_items,
- android.R.layout.simple_list_item_1);
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(dialogContext);
- builder.setTitle(R.string.select_avatar);
- builder.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- switch(which) {
- case 0:
- doTakePhoto();
- break;
- case 1:
- doPickPhotoFromGallery();
- break;
- case 2:
- mDisableAvatar = true;
- mAvatar.setImageURI(null);
- break;
- default:
- Log.w(TAG, "DialogInterface onClick : invalid which code");
- }
- }
- });
- return builder.create();
- }
-
- /**
- * Create a file name for the icon photo using current time.
- * @return the filename
- */
- private String getPhotoFileName() {
- Date date = new Date(System.currentTimeMillis());
- SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyyMMdd_HHmmss");
- return dateFormat.format(date) + ".jpg";
- }
-
- /**
- * Launches Camera to take a picture and store it in a file.
- */
- protected void doTakePhoto() {
- try {
- // Launch camera to take photo for selected contact
- PHOTO_DIR.mkdirs();
- mCurrentPhotoFile = new File(PHOTO_DIR, getPhotoFileName());
- final Intent intent = getTakePickIntent(mCurrentPhotoFile);
- startActivityForResult(intent, CAMERA_WITH_DATA);
- } catch (ActivityNotFoundException e) {
- Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
- }
- }
-
- /**
- * Constructs an intent for capturing a photo and storing it in a temporary file.
- * @param f the temporary file to use to store the picture
- * @return the intent
- */
- public static Intent getTakePickIntent(File f) {
- Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
- intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
- return intent;
- }
-
- /**
- * Sends a newly acquired photo to Gallery for cropping.
- * @param f the image file to crop
- */
- protected void doCropPhoto(final File f) {
- try {
-
- // Add the image to the media store
- // level 8
- /*
- MediaScannerConnection.scanFile(
- this,
- new String[] { f.getAbsolutePath() },
- new String[] { null },
- null);
- */
-
- // Launch gallery to crop the photo
- final Intent intent = getCropImageIntent(Uri.fromFile(f));
- startActivityForResult(intent, PHOTO_PICKED_WITH_DATA);
- } catch (ActivityNotFoundException e) {
- Log.e(TAG, "Cannot crop image", e);
- Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
- }
- }
-
- /**
- * Constructs an intent for image cropping.
- * @param photoUri the uri of the photo to crop
- * @return the intent
- */
- public static Intent getCropImageIntent(Uri photoUri) {
- Intent intent = new Intent("com.android.camera.action.CROP");
- intent.setDataAndType(photoUri, "image/*");
- intent.putExtra("crop", "true");
- intent.putExtra("aspectX", 1);
- intent.putExtra("aspectY", 1);
- intent.putExtra("outputX", ICON_SIZE);
- intent.putExtra("outputY", ICON_SIZE);
- intent.putExtra(MediaStore.EXTRA_OUTPUT, MY_AVATAR_URI);
- return intent;
- }
-
- /**
- * Launches Gallery to pick a photo.
- */
- protected void doPickPhotoFromGallery() {
- try {
- // Launch picker to choose photo for selected contact
- final Intent intent = getPhotoPickIntent();
- startActivityForResult(intent, PHOTO_PICKED_WITH_DATA);
- } catch (ActivityNotFoundException e) {
- Toast.makeText(this, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
- }
- }
-
- /**
- * Constructs an intent for picking a photo from Gallery, cropping it and returning the bitmap.
- * @return the intent
- */
- public static Intent getPhotoPickIntent() {
- Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
- intent.setType("image/*");
- intent.putExtra("crop", "true");
- intent.putExtra("aspectX", 1);
- intent.putExtra("aspectY", 1);
- intent.putExtra("outputX", ICON_SIZE);
- intent.putExtra("outputY", ICON_SIZE);
- intent.putExtra(MediaStore.EXTRA_OUTPUT, MY_AVATAR_URI);
- // use this to get the bitmap in the intent
-// intent.putExtra("return-data", true);
- return intent;
- }
-
-
-
- /**
- * connection to service.
- * @author nikita
- */
- private class BeemServiceConnection implements ServiceConnection {
-
- /**
- * constructor.
- */
- public BeemServiceConnection() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mXmppFacade = IXmppFacade.Stub.asInterface(service);
- if (mShowCurrentAvatar)
- displayCurrentAvatar();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onServiceDisconnected(ComponentName name) {
- mXmppFacade = null;
- }
- }
-
- /**
- * User have clicked on ok.
- * @author nikita
- */
- private class MyOnClickListener implements OnClickListener {
-
- /**
- * constructor.
- */
- public MyOnClickListener() {
- }
-
- @Override
- public void onClick(View v) {
- if (v == mOk) {
- String msg = mStatusMessageEditText.getText().toString();
- int status = getStatusForService((String) mSpinner.getSelectedItem());
- Editor edit = mSettings.edit();
- edit.putString(BeemApplication.STATUS_TEXT_KEY, msg);
- if (status == Status.CONTACT_STATUS_DISCONNECT) {
- stopService(new Intent(ChangeStatus.this, BeemService.class));
- } else {
- try {
- mXmppFacade.changeStatus(status, msg.toString());
- edit.putInt(BeemApplication.STATUS_KEY, mSpinner.getSelectedItemPosition());
- publishAvatar();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- mToast.show();
- }
- edit.commit();
- ChangeStatus.this.finish();
- } else if (v == mClear) {
- mStatusMessageEditText.setText(null);
- } else if (v == mContact) {
- startActivity(new Intent(ChangeStatus.this, ContactList.class));
- ChangeStatus.this.finish();
- } else if (v == mAvatar)
- onAvatarButton(v);
- }
- }
-}
--- a/src/com/beem/project/beem/ui/Chat.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1049 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.preference.PreferenceManager;
-import android.text.util.Linkify;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.view.WindowManager;
-import android.view.inputmethod.EditorInfo;
-import android.widget.BaseAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import com.android.mms.util.SmileyParser;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.R;
-import com.beem.project.beem.providers.AvatarProvider;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.Message;
-import com.beem.project.beem.service.PresenceAdapter;
-import com.beem.project.beem.service.aidl.IBeemRosterListener;
-import com.beem.project.beem.service.aidl.IChat;
-import com.beem.project.beem.service.aidl.IChatManager;
-import com.beem.project.beem.service.aidl.IChatManagerListener;
-import com.beem.project.beem.service.aidl.IMessageListener;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.ui.dialogs.builders.ChatList;
-import com.beem.project.beem.ui.dialogs.builders.DisplayOtrFingerprint;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-import com.beem.project.beem.utils.Status;
-
-import org.jivesoftware.smack.packet.Presence.Mode;
-import org.jivesoftware.smack.util.StringUtils;
-
-
-/**
- * This class represents an activity which allows the user to chat with his/her contacts.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
-public class Chat extends Activity implements TextView.OnEditorActionListener {
-
- private static final String TAG = "Chat";
- private static final Intent SERVICE_INTENT = new Intent();
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
- private Handler mHandler = new Handler();
-
- private IRoster mRoster;
- private Contact mContact;
-
- private TextView mContactNameTextView;
- private TextView mContactStatusMsgTextView;
- private TextView mContactChatState;
- private TextView mContactOtrState;
- private ImageView mContactStatusIcon;
- private LayerDrawable mAvatarStatusDrawable;
- private ListView mMessagesListView;
- private EditText mInputField;
- private Button mSendButton;
- private final Map<Integer, Bitmap> mStatusIconsMap = new HashMap<Integer, Bitmap>();
-
- private final List<MessageText> mListMessages = new ArrayList<MessageText>();
-
- private IChat mChat;
- private IChatManager mChatManager;
- private final IMessageListener mMessageListener = new OnMessageListener();
- private final IChatManagerListener mChatManagerListener = new ChatManagerListener();
- private MessagesListAdapter mMessagesListAdapter = new MessagesListAdapter();
-
- private final ServiceConnection mConn = new BeemServiceConnection();
- private final BeemBroadcastReceiver mBroadcastReceiver = new BeemBroadcastReceiver();
- private final BeemRosterListener mBeemRosterListener = new BeemRosterListener();
- private IXmppFacade mXmppFacade;
- private String mCurrentAvatarId;
- private boolean mBinded;
- private boolean mCompact;
-
- /**
- * Constructor.
- */
- public Chat() {
- super();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onCreate(Bundle savedBundle) {
- super.onCreate(savedBundle);
- this.registerReceiver(mBroadcastReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
- SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
-
- if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
- getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
- }
-
- mCompact = settings.getBoolean(BeemApplication.USE_COMPACT_CHAT_UI_KEY, false);
- // UI
- if (!mCompact) {
- setContentView(R.layout.chat);
- mContactNameTextView = (TextView) findViewById(R.id.chat_contact_name);
- mContactStatusMsgTextView = (TextView) findViewById(R.id.chat_contact_status_msg);
- mContactChatState = (TextView) findViewById(R.id.chat_contact_chat_state);
- mContactStatusIcon = (ImageView) findViewById(R.id.chat_contact_status_icon);
- mAvatarStatusDrawable = (LayerDrawable) mContactStatusIcon.getDrawable();
- mAvatarStatusDrawable.setLayerInset(1, 36, 36, 0, 0);
- } else {
- setContentView(R.layout.chat_compact);
- }
- mContactOtrState = (TextView) findViewById(R.id.chat_contact_otr_state);
- mMessagesListView = (ListView) findViewById(R.id.chat_messages);
- mMessagesListView.setAdapter(mMessagesListAdapter);
- mInputField = (EditText) findViewById(R.id.chat_input);
- mInputField.setOnEditorActionListener(this);
- mInputField.requestFocus();
- mSendButton = (Button) findViewById(R.id.chat_send_message);
- mSendButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- sendMessage();
- }
- });
-
- prepareIconsStatus();
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mContact = new Contact(getIntent().getData());
- if (!mBinded) {
- bindService(SERVICE_INTENT, mConn, BIND_AUTO_CREATE);
- mBinded = true;
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onDestroy() {
- super.onDestroy();
- this.unregisterReceiver(mBroadcastReceiver);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onPause() {
- super.onPause();
- try {
- if (mChat != null) {
- mChat.setOpen(false);
- mChat.removeMessageListener(mMessageListener);
- }
- if (mRoster != null)
- mRoster.removeRosterListener(mBeemRosterListener);
- if (mChatManager != null)
- mChatManager.removeChatCreationListener(mChatManagerListener);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- if (mBinded) {
- unbindService(mConn);
- mBinded = false;
- }
- mXmppFacade = null;
- mRoster = null;
- mChat = null;
- mChatManager = null;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onNewIntent(Intent intent) {
- super.onNewIntent(intent);
- setIntent(intent);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onSaveInstanceState(Bundle savedInstanceState) {
- super.onSaveInstanceState(savedInstanceState);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onRestoreInstanceState(Bundle savedInstanceState) {
- super.onRestoreInstanceState(savedInstanceState);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public final boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.chat, menu);
- return true;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public final boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.chat_menu_contacts_list:
- Intent contactListIntent = new Intent(this, ContactList.class);
- contactListIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
- startActivity(contactListIntent);
- break;
- case R.id.chat_menu_change_chat:
- try {
- final List<Contact> openedChats = mChatManager.getOpenedChatList();
- Dialog chatList = new ChatList(Chat.this, openedChats).create();
- chatList.show();
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- break;
- case R.id.chat_menu_close_chat:
- try {
- mChatManager.destroyChat(mChat);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- this.finish();
- break;
- case R.id.chat_menu_start_otr_session:
- try {
- if (mChat == null) {
- mChat = mChatManager.createChat(mContact, mMessageListener);
- if (mChat != null) {
- mChat.setOpen(true);
- }
- }
- mChat.startOtrSession();
- } catch (RemoteException e) {
- Log.e(TAG, "start otr chats failed " + mChat, e);
- }
- break;
- case R.id.chat_menu_stop_otr_session:
- try {
- if (mChat == null) {
- mChat = mChatManager.createChat(mContact, mMessageListener);
- if (mChat != null) {
- mChat.setOpen(true);
- }
- }
- mChat.endOtrSession();
- } catch (RemoteException e) {
- Log.e(TAG, "close otr chats failed " + mChat, e);
- }
- break;
- case R.id.chat_menu_otr_verify_key:
- try {
- if (mChat == null) {
- mChat = mChatManager.createChat(mContact, mMessageListener);
- if (mChat != null) {
- mChat.setOpen(true);
- }
- }
- Dialog otrDialog = new DisplayOtrFingerprint(this, mChat).create();
- otrDialog.show();
- } catch (RemoteException e) {
- Log.e(TAG, "getting local otr key failed " + mChat, e);
- }
- break;
- default:
- return false;
- }
- return true;
- }
-
- /**
- * Change the displayed chat.
- * @param contact the targeted contact of the new chat
- * @throws RemoteException If a Binder remote-invocation error occurred.
- */
- private void changeCurrentChat(Contact contact) throws RemoteException {
- if (mChat != null) {
- mChat.setOpen(false);
- mChat.removeMessageListener(mMessageListener);
- }
- mChat = mChatManager.getChat(contact);
- if (mChat != null) {
- mChat.setOpen(true);
- mChat.addMessageListener(mMessageListener);
- mChatManager.deleteChatNotification(mChat);
- updateOtrInformations(mChat.getOtrStatus());
- }
- mContact = mRoster.getContact(contact.getJID());
- String res = contact.getSelectedRes();
- if (mContact == null)
- mContact = contact;
- if (!"".equals(res)) {
- mContact.setSelectedRes(res);
- }
- updateContactInformations();
- updateContactStatusIcon();
-
- playRegisteredTranscript();
- }
-
- /**
- * Get all messages from the current chat and refresh the activity with them.
- * @throws RemoteException If a Binder remote-invocation error occurred.
- */
- private void playRegisteredTranscript() throws RemoteException {
- mListMessages.clear();
- if (mChat != null) {
- List<MessageText> msgList = convertMessagesList(mChat.getMessages());
- mListMessages.addAll(msgList);
- mMessagesListAdapter.notifyDataSetChanged();
- }
- }
-
- /**
- * Convert a list of Message coming from the service to a list of MessageText that can be displayed in UI.
- * @param chatMessages the list of Message
- * @return a list of message that can be displayed.
- */
- private List<MessageText> convertMessagesList(List<Message> chatMessages) {
- List<MessageText> result = new ArrayList<MessageText>(chatMessages.size());
- String remoteName = mContact.getName();
- String localName = getString(R.string.chat_self);
- MessageText lastMessage = null;
-
- for (Message m : chatMessages) {
- String name = remoteName;
- String fromBareJid = StringUtils.parseBareAddress(m.getFrom());
- if (m.getType() == Message.MSG_TYPE_ERROR) {
- lastMessage = null;
- result.add(new MessageText(fromBareJid, name, m.getBody(), true, m.getTimestamp()));
- } else if (m.getType() == Message.MSG_TYPE_INFO) {
- lastMessage = new MessageText("", "", m.getBody(), false);
- result.add(lastMessage);
-
- } else if (m.getType() == Message.MSG_TYPE_CHAT) {
- if (fromBareJid == null) { //nofrom or from == yours
- name = localName;
- fromBareJid = "";
- }
-
- if (m.getBody() != null) {
- if (lastMessage == null || !fromBareJid.equals(lastMessage.getBareJid())) {
- lastMessage = new MessageText(fromBareJid, name, m.getBody(), false, m.getTimestamp());
- result.add(lastMessage);
- } else {
- lastMessage.setMessage(lastMessage.getMessage().concat("\n" + m.getBody()));
- }
- }
- }
- }
- return result;
- }
-
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if (v == mInputField && actionId == EditorInfo.IME_ACTION_SEND) {
- sendMessage();
- return true;
- }
- return false;
- }
-
- /**
- * Send an XMPP message.
- */
- private void sendMessage() {
- final String inputContent = mInputField.getText().toString();
-
- if (!"".equals(inputContent)) {
- Message msgToSend = new Message(mContact.getJIDWithRes(), Message.MSG_TYPE_CHAT);
- msgToSend.setBody(inputContent);
-
- try {
- if (mChat == null) {
- mChat = mChatManager.createChat(mContact, mMessageListener);
- mChat.setOpen(true);
- }
- mChat.sendMessage(msgToSend);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
-
- final String self = getString(R.string.chat_self);
- MessageText lastMessage = null;
- if (mListMessages.size() != 0)
- lastMessage = mListMessages.get(mListMessages.size() - 1);
-
- if (lastMessage != null && lastMessage.getName().equals(self)) {
- lastMessage.setMessage(lastMessage.getMessage().concat("\n" + inputContent));
- lastMessage.setTimestamp(new Date());
- } else
- mListMessages.add(new MessageText(self, self, inputContent, false, new Date()));
- mMessagesListAdapter.notifyDataSetChanged();
- mInputField.setText(null);
- }
- }
-
-
- /**
- * Update the contact informations.
- */
- private void updateContactInformations() {
- // Check for a contact name update
- String name = mContact.getName();
- String res = mContact.getSelectedRes();
- if (!"".equals(res))
- name += "(" + res + ")";
- if (!mCompact) {
- if (!(mContactNameTextView.getText().toString().equals(name)))
- mContactNameTextView.setText(name);
- //Check for a contact status message update
- if (!(mContactStatusMsgTextView.getText().toString().equals(mContact.getMsgState()))) {
- mContactStatusMsgTextView.setText(mContact.getMsgState());
- Linkify.addLinks(mContactStatusMsgTextView, Linkify.WEB_URLS);
- }
- } else {
- Mode m = Status.getPresenceModeFromStatus(mContact.getStatus());
- if (m == null)
- setTitle(getString(R.string.chat_name) + " " + name + " ("
- + getString(R.string.contact_status_msg_offline) + ")");
- else
- setTitle(getString(R.string.chat_name) + " " + name + " (" + m.name() + ")");
- }
- }
-
- /**
- * Update the OTR informations.
- * @param otrState the otr state
- */
- private void updateOtrInformations(final String otrState) {
- String text = null;
- if ("ENCRYPTED".equals(otrState)) {
- text = Chat.this.getString(R.string.chat_otrstate_encrypted);
- } else if ("FINISHED".equals(otrState)) {
- text = Chat.this.getString(R.string.chat_otrstate_finished);
- } else if ("AUTHENTICATED".equals(otrState)) {
- text = Chat.this.getString(R.string.chat_otrstate_authenticated);
- } else {
- text = Chat.this.getString(R.string.chat_otrstate_plaintext);
- }
- if (mContactOtrState != null)
- mContactOtrState.setText(text);
- }
-
- /**
- * Update the contact status icon.
- */
- private void updateContactStatusIcon() {
- if (mCompact)
- return;
- String id = mContact.getAvatarId();
- if (id == null)
- id = "";
- Log.d(TAG, "update contact icon : " + id);
- if (!id.equals(mCurrentAvatarId)) {
- Drawable avatar = getAvatarDrawable(mContact.getAvatarId());
- mAvatarStatusDrawable.setDrawableByLayerId(R.id.avatar, avatar);
- mCurrentAvatarId = id;
- }
- mContactStatusIcon.setImageLevel(mContact.getStatus());
- }
-
- /**
- * Get a Drawable containing the avatar icon.
- * @param avatarId the avatar id to retrieve or null to get default
- * @return a Drawable
- */
- private Drawable getAvatarDrawable(String avatarId) {
- Drawable avatarDrawable = null;
- if (avatarId != null) {
- Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(avatarId).build();
- InputStream in = null;
- try {
- try {
- in = getContentResolver().openInputStream(uri);
- avatarDrawable = Drawable.createFromStream(in, avatarId);
- } finally {
- if (in != null)
- in.close();
- }
- } catch (IOException e) {
- Log.w(TAG, "Error while setting the avatar", e);
- }
- }
- if (avatarDrawable == null)
- avatarDrawable = getResources().getDrawable(R.drawable.beem_launcher_icon_silver);
- return avatarDrawable;
- }
-
- /**
- * Prepare the status icons map.
- */
- private void prepareIconsStatus() {
- mStatusIconsMap.put(Status.CONTACT_STATUS_AVAILABLE,
- BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online));
- mStatusIconsMap.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT,
- BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online));
- mStatusIconsMap.put(Status.CONTACT_STATUS_AWAY,
- BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_away));
- mStatusIconsMap.put(Status.CONTACT_STATUS_BUSY,
- BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_busy));
- mStatusIconsMap.put(Status.CONTACT_STATUS_DISCONNECT,
- BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_offline));
- mStatusIconsMap.put(Status.CONTACT_STATUS_UNAVAILABLE,
- BitmapFactory.decodeResource(getResources(), R.drawable.status_requested));
- }
-
- /**
- * Add smileys Spannable to a message string.
- *
- * @param msg the message containing optional smileys strings
- * @return the message with smileys spannable
- */
- private CharSequence addSmileysToMessage(String msg) {
- SmileyParser parser = SmileyParser.getInstance();
- return parser.addSmileySpans(msg);
- }
-
- /**
- * {@inheritDoc}.
- */
- private final class BeemServiceConnection implements ServiceConnection {
-
- /**
- * Constructor.
- */
- public BeemServiceConnection() {
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mXmppFacade = IXmppFacade.Stub.asInterface(service);
- try {
- mRoster = mXmppFacade.getRoster();
- if (mRoster != null)
- mRoster.addRosterListener(mBeemRosterListener);
- mChatManager = mXmppFacade.getChatManager();
- if (mChatManager != null) {
- mChatManager.addChatCreationListener(mChatManagerListener);
- changeCurrentChat(mContact);
- }
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void onServiceDisconnected(ComponentName name) {
- mXmppFacade = null;
- try {
- mRoster.removeRosterListener(mBeemRosterListener);
- mChatManager.removeChatCreationListener(mChatManagerListener);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- private class BeemRosterListener extends IBeemRosterListener.Stub {
-
- /**
- * Constructor.
- */
- public BeemRosterListener() {
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void onEntriesAdded(List<String> addresses) throws RemoteException {
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void onEntriesDeleted(List<String> addresses) throws RemoteException {
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void onEntriesUpdated(List<String> addresses) throws RemoteException {
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void onPresenceChanged(final PresenceAdapter presence) throws RemoteException {
- if (mContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- mContact.setStatus(presence.getStatus());
- mContact.setMsgState(presence.getStatusText());
- updateContactInformations();
- updateContactStatusIcon();
- }
- });
- }
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- private class OnMessageListener extends IMessageListener.Stub {
-
- /**
- * Constructor.
- */
- public OnMessageListener() {
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void processMessage(IChat chat, final Message msg) throws RemoteException {
- final String fromBareJid = StringUtils.parseBareAddress(msg.getFrom());
-
- if (mContact.getJID().equals(fromBareJid)) {
- mHandler.post(new Runnable() {
-
- @Override
- public void run() {
- if (msg.getType() == Message.MSG_TYPE_ERROR) {
- mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(), true, msg
- .getTimestamp()));
- mMessagesListAdapter.notifyDataSetChanged();
- } else if (msg.getBody() != null) {
- MessageText lastMessage = null;
- if (mListMessages.size() != 0)
- lastMessage = mListMessages.get(mListMessages.size() - 1);
-
- if (lastMessage != null && lastMessage.getBareJid().equals(fromBareJid)) {
- lastMessage.setMessage(lastMessage.getMessage().concat("\n" + msg.getBody()));
- lastMessage.setTimestamp(msg.getTimestamp());
- mListMessages.set(mListMessages.size() - 1, lastMessage);
- } else if (msg.getBody() != null)
- mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(),
- false, msg.getTimestamp()));
- mMessagesListAdapter.notifyDataSetChanged();
- }
- }
- });
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void stateChanged(IChat chat) throws RemoteException {
- final String state = chat.getState();
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- String text = null;
- if ("active".equals(state)) {
- text = Chat.this.getString(R.string.chat_state_active);
- } else if ("composing".equals(state)) {
- text = Chat.this.getString(R.string.chat_state_composing);
- } else if ("gone".equals(state)) {
- text = Chat.this.getString(R.string.chat_state_gone);
- } else if ("inactive".equals(state)) {
- text = Chat.this.getString(R.string.chat_state_inactive);
- } else if ("paused".equals(state)) {
- text = Chat.this.getString(R.string.chat_state_active);
- }
- if (!mCompact)
- mContactChatState.setText(text);
- }
- });
-
- }
-
- @Override
- public void otrStateChanged(final String otrState) throws RemoteException {
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- updateOtrInformations(otrState);
- mListMessages.add(new MessageText("", "", otrState, false));
- mMessagesListAdapter.notifyDataSetChanged();
- }
- });
-
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- private class MessagesListAdapter extends BaseAdapter {
-
- /**
- * Constructor.
- */
- public MessagesListAdapter() {
- }
-
- /**
- * Returns the number of messages contained in the messages list.
- * @return The number of messages contained in the messages list.
- */
- @Override
- public int getCount() {
- return mListMessages.size();
- }
-
- /**
- * Return an item from the messages list that is positioned at the position passed by parameter.
- * @param position The position of the requested item.
- * @return The item from the messages list at the requested position.
- */
- @Override
- public Object getItem(int position) {
- return mListMessages.get(position);
- }
-
- /**
- * Return the id of an item from the messages list that is positioned at the position passed by parameter.
- * @param position The position of the requested item.
- * @return The id of an item from the messages list at the requested position.
- */
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- /**
- * Return the view of an item from the messages list.
- * @param position The position of the requested item.
- * @param convertView The old view to reuse if possible.
- * @param parent The parent that this view will eventually be attached to.
- * @return A View corresponding to the data at the specified position.
- */
- public View getView(int position, View convertView, ViewGroup parent) {
- View sv;
- if (convertView == null) {
- LayoutInflater inflater = Chat.this.getLayoutInflater();
- sv = inflater.inflate(R.layout.chat_msg_row, null);
- } else {
- sv = convertView;
- }
- DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
- MessageText msg = mListMessages.get(position);
- TextView msgName = (TextView) sv.findViewById(R.id.chatmessagename);
- msgName.setText(msg.getName());
- msgName.setTextColor(Color.WHITE);
- msgName.setError(null);
- TextView msgText = (TextView) sv.findViewById(R.id.chatmessagetext);
- CharSequence msgBody = addSmileysToMessage(msg.getMessage());
- msgText.setText(msgBody);
- registerForContextMenu(msgText);
- TextView msgDate = (TextView) sv.findViewById(R.id.chatmessagedate);
- if (msg.getTimestamp() != null) {
- String date = df.format(msg.getTimestamp());
- msgDate.setText(date);
- }
- if (msg.isError()) {
- String err = getString(R.string.chat_error);
- msgName.setText(err);
- msgName.setTextColor(Color.RED);
- msgName.setError(err);
- }
- return sv;
- }
- }
-
- /**
- * Class which simplify an Xmpp text message.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
- private class MessageText {
- private String mBareJid;
- private String mName;
- private String mMessage;
- private boolean mIsError;
- private Date mTimestamp;
-
- /**
- * Constructor.
- * @param bareJid A String containing the bare JID of the message's author.
- * @param name A String containing the name of the message's author.
- * @param message A String containing the message.
- */
- public MessageText(final String bareJid, final String name, final String message) {
- mBareJid = bareJid;
- mName = name;
- mMessage = message;
- mIsError = false;
- }
-
- /**
- * Constructor.
- * @param bareJid A String containing the bare JID of the message's author.
- * @param name A String containing the name of the message's author.
- * @param message A String containing the message.
- * @param isError if the message is an error message.
- */
- public MessageText(final String bareJid, final String name, final String message, final boolean isError) {
- mBareJid = bareJid;
- mName = name;
- mMessage = message;
- mIsError = isError;
- }
-
- /**
- * Constructor.
- * @param bareJid A String containing the bare JID of the message's author.
- * @param name A String containing the name of the message's author.
- * @param message A String containing the message.
- * @param isError if the message is an error message.
- * @param date the time of the message.
- */
- public MessageText(final String bareJid, final String name, final String message, final boolean isError,
- final Date date) {
- mBareJid = bareJid;
- mName = name;
- mMessage = message;
- mIsError = isError;
- mTimestamp = date;
- }
-
- /**
- * JID attribute accessor.
- * @return A String containing the bare JID of the message's author.
- */
- public String getBareJid() {
- return mBareJid;
- }
-
- /**
- * Name attribute accessor.
- * @return A String containing the name of the message's author.
- */
- public String getName() {
- return mName;
- }
-
- /**
- * Message attribute accessor.
- * @return A String containing the message.
- */
- public String getMessage() {
- return mMessage;
- }
-
- /**
- * JID attribute mutator.
- * @param bareJid A String containing the author's bare JID of the message.
- */
- @SuppressWarnings("unused")
- public void setBareJid(String bareJid) {
- mBareJid = bareJid;
- }
-
- /**
- * Name attribute mutator.
- * @param name A String containing the author's name of the message.
- */
- @SuppressWarnings("unused")
- public void setName(String name) {
- mName = name;
- }
-
- /**
- * Message attribute mutator.
- * @param message A String containing a message.
- */
- public void setMessage(String message) {
- mMessage = message;
- }
-
- /**
- * Get the message type.
- * @return true if the message is an error message.
- */
- public boolean isError() {
- return mIsError;
- }
-
- /**
- * Set the Date of the message.
- * @param date date of the message.
- */
- public void setTimestamp(Date date) {
- mTimestamp = date;
- }
-
- /**
- * Get the Date of the message.
- * @return if it is a delayed message get the date the message was sended.
- */
- public Date getTimestamp() {
- return mTimestamp;
- }
-
- }
-
- /**
- * This class is in charge of getting the new chat in the activity if someone talk to you.
- */
- private class ChatManagerListener extends IChatManagerListener.Stub {
-
- /**
- * Constructor.
- */
- public ChatManagerListener() {
- }
-
- @Override
- public void chatCreated(IChat chat, boolean locally) {
- if (locally)
- return;
- try {
- String contactJid = mContact.getJIDWithRes();
- String chatJid = chat.getParticipant().getJIDWithRes();
- if (chatJid.equals(contactJid)) {
- // This should not be happened but to be sure
- if (mChat != null) {
- mChat.setOpen(false);
- mChat.removeMessageListener(mMessageListener);
- }
- mChat = chat;
- mChat.setOpen(true);
- mChat.addMessageListener(mMessageListener);
- mChatManager.deleteChatNotification(mChat);
- }
- } catch (RemoteException ex) {
- Log.e(TAG, "A remote exception occurs during the creation of a chat", ex);
- }
- }
- }
-}
--- a/src/com/beem/project/beem/ui/ContactList.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,590 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
-
-*/
-package com.beem.project.beem.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import android.app.Dialog;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.preference.PreferenceManager;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
-import android.support.v4.view.PagerTabStrip;
-import android.support.v4.view.ViewPager;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.PresenceAdapter;
-import com.beem.project.beem.service.aidl.IBeemRosterListener;
-import com.beem.project.beem.service.aidl.IChatManager;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.ui.dialogs.builders.Alias;
-import com.beem.project.beem.ui.dialogs.builders.ChatList;
-import com.beem.project.beem.ui.dialogs.builders.DeleteContact;
-import com.beem.project.beem.ui.dialogs.builders.ResendSubscription;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-
-import org.jivesoftware.smack.util.StringUtils;
-
-import static com.google.android.apps.iosched.util.LogUtils.*;
-
-/**
- * The contact list activity displays the roster of the user.
- */
-public class ContactList extends FragmentActivity {
-
- private static final Intent SERVICE_INTENT = new Intent();
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
-
- private static final String TAG = makeLogTag(ContactList.class);
- private static final float PAGER_TAB_SECONDARY_ALPHA = 0.5f;
- private final List<String> mListGroup = new ArrayList<String>();
-
- /** Map containing a list of the different contacts of a given group.
- * Each list is a @{link SortedList} so there is no need to sort it again.
- * */
- private final Map<String, List<Contact>> mContactOnGroup = new HashMap<String, List<Contact>>();
- private final ServiceConnection mServConn = new BeemServiceConnection();
- private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
- private final Map<String, ContactListAdapter> contactListAdapters = new HashMap<String, ContactListAdapter>();
-
- private final BeemRosterListener mBeemRosterListener = new BeemRosterListener();
- private IRoster mRoster;
- private IXmppFacade mXmppFacade;
- private IChatManager mChatManager;
- private SharedPreferences mSettings;
- private boolean mBinded;
- private ViewPager viewPager;
- private ListPagerAdapter groupsPagesAdapter;
- private PagerTabStrip pagerTabs;
-
- /**
- * Constructor.
- */
- public ContactList() {
- }
-
- /**
- * 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.contact_list, menu);
- return true;
- }
-
- @Override
- public final boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.contact_list_menu_settings:
- startActivity(new Intent(this, Settings.class));
- return true;
- case R.id.contact_list_menu_add_contact:
- startActivity(new Intent(ContactList.this, AddContact.class));
- return true;
- case R.id.menu_change_status:
- startActivity(new Intent(ContactList.this, ChangeStatus.class));
- return true;
- case R.id.contact_list_menu_chatlist:
- List<Contact> openedChats;
- try {
- openedChats = mChatManager.getOpenedChatList();
- LOGD(TAG, "opened chats = " + openedChats);
- Dialog chatList = new ChatList(ContactList.this, openedChats).create();
- chatList.show();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- return true;
- case R.id.menu_disconnect:
- stopService(SERVICE_INTENT);
- finish();
- return true;
- default:
- return false;
- }
- }
-
-
- @Override
- protected void onCreate(Bundle saveBundle) {
- super.onCreate(saveBundle);
- mSettings = PreferenceManager.getDefaultSharedPreferences(this);
- setContentView(R.layout.contactlist);
-
- this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
-
- viewPager = (ViewPager) findViewById(R.id.pager);
- groupsPagesAdapter = new ListPagerAdapter(getSupportFragmentManager(), viewPager);
- pagerTabs = (PagerTabStrip) findViewById(R.id.tabstrip);
- pagerTabs.setTabIndicatorColorResource(R.color.vert_manu);
- pagerTabs.setNonPrimaryAlpha(PAGER_TAB_SECONDARY_ALPHA);
-
- mListGroup.add(getString(R.string.contact_list_all_contact));
- mListGroup.add(getString(R.string.contact_list_no_group));
- groupsPagesAdapter.notifyDataSetChanged();
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (!mSettings.getBoolean(BeemApplication.HIDE_GROUPS_KEY, false))
- showGroups();
- else
- hideGroups();
-
- if (!mBinded)
- mBinded = bindService(SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onPause() {
- super.onPause();
- try {
- if (mRoster != null) {
- mRoster.removeRosterListener(mBeemRosterListener);
- mRoster = null;
- }
- } catch (RemoteException e) {
- LOGD("ContactList", "Remote exception", e);
- }
- if (mBinded) {
- unbindService(mServConn);
- mBinded = false;
- }
- mXmppFacade = null;
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- this.unregisterReceiver(mReceiver);
- LOGV(TAG, "onDestroy activity");
- }
-
- /**
- * Get a {@link ContactListAdapter} for a group.
- * The {@link ContactListAdapter} will be created if it is not exist.
- * @param group the group
- * @return the adapter
- */
- ContactListAdapter getContactListAdapter(String group) {
- synchronized (contactListAdapters) {
- ContactListAdapter contactListAdapter = contactListAdapters.get(group);
- if (contactListAdapter == null) {
- contactListAdapter = new ContactListAdapter(ContactList.this);
- contactListAdapters.put(group, contactListAdapter);
- }
- boolean hideDisconnected = mSettings.getBoolean(BeemApplication.SHOW_OFFLINE_CONTACTS_KEY, false);
- contactListAdapter.setOnlineOnly(hideDisconnected);
- return contactListAdapter;
- }
- }
-
- /**
- * Exectute a context menu action on a specified contact.
- * @param itemId the id of the menu action
- * @param contact the contact
- */
- void doContextMenuAction(int itemId, Contact contact) {
- switch (itemId) {
- case R.id.contact_list_context_menu_call_item:
- try {
- mXmppFacade.call(contact.getJID() + "/psi");
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- break;
- case R.id.contact_list_context_menu_userinfo_alias:
- Dialog alias = new Alias(ContactList.this, mRoster, contact).create();
- alias.show();
- break;
- case R.id.contact_list_context_menu_userinfo_subscription:
- Dialog subscription = new ResendSubscription(ContactList.this,
- mXmppFacade, contact).create();
- subscription.show();
- break;
- case R.id.contact_list_context_menu_userinfo_delete:
- Dialog delete = new DeleteContact(ContactList.this, mRoster, contact).create();
- delete.show();
- break;
- default:
- LOGW(TAG, "Context menu action not supported" + itemId);
- break;
- }
-
- }
-
- /**
- * Show the groups view.
- */
- private void showGroups() {
- pagerTabs.setVisibility(View.VISIBLE);
- }
-
- /**
- * Hide the groups view.
- */
- private void hideGroups() {
- pagerTabs.setVisibility(View.GONE);
- }
-
- /**
- * Remove old groups on the banner.
- * @throws RemoteException if an error occur when communicating with the service
- */
- private void cleanBannerGroup() throws RemoteException {
- if (mListGroup.size() <= 2)
- return;
- List<String> rosterGroups = mRoster.getGroupsNames();
- Collections.sort(rosterGroups);
- List<String> realGroups = mListGroup.subList(1, mListGroup.size() - 1);
- realGroups.clear();
- realGroups.addAll(rosterGroups);
- groupsPagesAdapter.notifyDataSetChanged();
- }
-
- /**
- * Add a contact to the special list No Group and All contacts.
- * The contact will be added if the list is not the current list otherwise
- * the list must be modified in a Handler.
- *
- * @param contact the contact to add.
- */
- private void addToSpecialList(Contact contact) {
- List<String> groups = contact.getGroups();
-
- ContactListAdapter adapter = getContactListAdapter(getString(R.string.contact_list_all_contact));
- adapter.put(contact);
- if (groups.isEmpty()) {
- adapter = getContactListAdapter(getString(R.string.contact_list_no_group));
- adapter.put(contact);
- }
- }
-
- /**
- * Add a new group in the GroupBanner.
- *
- * @param group the group to add
- */
- private void addGroupInBanner(String group) {
- List<String> realGroups = mListGroup.subList(1, mListGroup.size() - 1);
- if (!mListGroup.contains(group)) {
- boolean added = false;
- // insert group in sorted list
- for (ListIterator<String> iterator = realGroups.listIterator(); iterator.hasNext();) {
- String currentGroup = (String) iterator.next();
- if (currentGroup.compareTo(group) > 0) {
- iterator.previous();
- iterator.add(group);
- added = true;
- break;
- }
- }
- if (!added)
- realGroups.add(group);
- groupsPagesAdapter.notifyDataSetChanged();
- }
- }
-
- /**
- * Listener on service event.
- */
- private class BeemRosterListener extends IBeemRosterListener.Stub {
- /**
- * Constructor.
- */
- public BeemRosterListener() {
- }
-
- /**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesAdded event.
- * if contact has to be shown :
- * <ul>
- * <li> add him to his groups</li>
- * <li> add him to the specials groups</>
- * </ul>
- */
- @Override
- public void onEntriesAdded(final List<String> addresses) throws RemoteException {
- for (String newName : addresses) {
- final Contact contact = mRoster.getContact(StringUtils.parseBareAddress(newName));
- putContactInList(contact);
- }
- }
-
- /**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesDeleted event.
- * <ul>
- * <li> Remove the contact from all groups</li>
- * </ul>
- */
- @Override
- public void onEntriesDeleted(final List<String> addresses) throws RemoteException {
- LOGD(TAG, "onEntries deleted " + addresses);
- for (String cToDelete : addresses) {
- final Contact contact = new Contact(cToDelete);
- for (final ContactListAdapter adapter : contactListAdapters.values()) {
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- adapter.remove(contact);
- }
- });
- }
- }
- cleanBannerGroup();
-
- }
-
- /**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesUpdated event.
- * <ul>
- * <li> Remove the contact from all groups</li>
- * <li> if contact has to be shown add it to his groups</li>
- * <li> if contact has to be shown add it to the specials groups</li>
- * </ul>
- */
- @Override
- public void onEntriesUpdated(final List<String> addresses) throws RemoteException {
- LOGD(TAG, "onEntries updated " + addresses);
- for (String cToDelete : addresses) {
- Contact contact = new Contact(cToDelete);
- for (ContactListAdapter adapter : contactListAdapters.values()) {
- adapter.remove(contact);
- }
- }
- for (String newName : addresses) {
- final Contact contact = mRoster.getContact(StringUtils.parseBareAddress(newName));
- putContactInList(contact);
- }
- cleanBannerGroup();
- }
-
- /**
- * {@inheritDoc}
- * Simple stategy to handle the onPresenceChanged event.
- * <ul>
- * <li> Remove the contact from all groups</li>
- * <li> if contact has to be shown add it to his groups</li>
- * <li> if contact has to be shown add it to the specials groups</li>
- * </ul>
- */
- @Override
- public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
- String from = presence.getFrom();
- final Contact contact = mRoster.getContact(StringUtils.parseBareAddress(from));
- putContactInList(contact);
- }
-
- /**
- * Put a contact in the different group list.
- * @param contact the contact
- */
- private void putContactInList(final Contact contact) {
- List<String> groups = contact.getGroups();
- for (final String group : groups) {
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- addGroupInBanner(group);
- ContactListAdapter contactListAdapter = getContactListAdapter(group);
- contactListAdapter.put(contact);
- }
- });
- }
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- addToSpecialList(contact);
- }
- });
- }
- }
-
- /**
- * The service connection used to connect to the Beem service.
- */
- private class BeemServiceConnection implements ServiceConnection {
-
- /**
- * Constructor.
- */
- public BeemServiceConnection() {
- }
-
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mXmppFacade = IXmppFacade.Stub.asInterface(service);
- try {
- mRoster = mXmppFacade.getRoster();
- if (mRoster != null) {
- List<String> tmpGroupList = mRoster.getGroupsNames();
- cleanBannerGroup();
- synchronized (contactListAdapters) {
- for (ContactListAdapter ca : contactListAdapters.values()) {
- ca.clear();
- }
- }
- assignContactToGroups(mRoster.getContactList(), tmpGroupList);
-
- mRoster.addRosterListener(mBeemRosterListener);
- LOGD(TAG, "add roster listener");
- mChatManager = mXmppFacade.getChatManager();
- }
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- try {
- mRoster.removeRosterListener(mBeemRosterListener);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- mXmppFacade = null;
- mChatManager = null;
- mRoster = null;
- mListGroup.clear();
- mContactOnGroup.clear();
- mBinded = false;
-
- }
-
- /**
- * Assign the differents contact to their groups.
- * This methods will fill the mContactOnGroup map.
- *
- * @param contacts list of contacts
- * @param groupNames list of existing groups
- */
- private void assignContactToGroups(List<Contact> contacts, List<String> groupNames) {
- for (Contact c : contacts) {
- addToSpecialList(c);
-
- List<String> groups = c.getGroups();
-
- for (String currentGroup : groups) {
- addGroupInBanner(currentGroup);
- ContactListAdapter cl = getContactListAdapter(currentGroup);
- cl.put(c);
- }
- }
- }
-
- }
-
- /**
- * PagerAdapter for the contact list.
- */
- private class ListPagerAdapter extends FragmentPagerAdapter {
-
- /**
- * Create a {@link ListPagerAdapter}.
- * @param fm the {@link FragmentManager}
- * @param viewPager the {@link ViewPager} associate with this adapter
- */
- public ListPagerAdapter(final FragmentManager fm, final ViewPager viewPager) {
- super(fm);
- viewPager.setAdapter(this);
- }
-
- @Override
- public Fragment getItem(int position) {
- String group = mListGroup.get(position);
- ContactListFragment f = ContactListFragment.newInstance(group);
- f.setListAdapter(getContactListAdapter(group));
- return f;
- }
-
- @Override
- public int getCount() {
- return mListGroup.size();
- }
-
- @Override
- public String getPageTitle(int position) {
- return mListGroup.get(position);
- }
-
- }
-
-}
--- a/src/com/beem/project/beem/ui/ContactListAdapter.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,294 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.ui;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
-import android.net.Uri;
-import android.preference.PreferenceManager;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.Filter;
-import android.widget.Filterable;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.R;
-import com.beem.project.beem.providers.AvatarProvider;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.utils.SortedList;
-import com.beem.project.beem.utils.Status;
-
-/**
- * An Adapter for the contact list.
- * It displays a list of contact in a particular group.
- *
- */
-public class ContactListAdapter extends BaseAdapter implements Filterable {
- private static final String TAG = ContactListAdapter.class.getSimpleName();
- private final ComparatorContactListByStatusAndName<Contact> mComparator =
- new ComparatorContactListByStatusAndName<Contact>();
- private List<Contact> mCurrentList;
- private final List<Contact> allContacts = new SortedList<Contact>(new LinkedList<Contact>(), mComparator);
- private final List<Contact> onlineContacts = new SortedList<Contact>(new LinkedList<Contact>(), mComparator);
- private final Filter mFilter = new ContactFilter();
- private final Context context;
- private LayoutInflater mInflater;
-
- private boolean showOnlineOnly;
-
- /**
- * Create a ContactListAdapter.
- * @param c the android context
- */
- public ContactListAdapter(final Context c) {
- mCurrentList = allContacts;
- context = c;
- mInflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- }
-
- @Override
- public int getCount() {
- return mCurrentList.size();
- }
-
- @Override
- public Object getItem(int position) {
- return mCurrentList.get(position);
- }
-
- @Override
- public long getItemId(int position) {
- return mCurrentList.get(position).hashCode();
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View v = convertView;
- if (convertView == null) {
- v = mInflater.inflate(R.layout.contactlistcontact, null);
- }
- Contact c = mCurrentList.get(position);
- bindView(v, c);
- return v;
- }
-
- /**
- * Put a contact in the list.
- * @param c the contact
- */
- public void put(Contact c) {
- put(c, allContacts);
- if (Status.statusOnline(c.getStatus()))
- put(c, onlineContacts);
- notifyDataSetChanged();
- }
-
- /**
- * Remove a contact from the list.
- *
- * @param c the contact
- */
- public void remove(Contact c) {
- allContacts.remove(c);
- onlineContacts.remove(c);
- notifyDataSetChanged();
- }
-
- /**
- * Clear the contact list.
- */
- public void clear() {
- allContacts.clear();
- onlineContacts.clear();
- notifyDataSetChanged();
- }
-
- @Override
- public Filter getFilter() {
- return mFilter;
- }
-
- /**
- * Bind a contact to the view.
- * @param view the row view.
- * @param curContact the contact.
- */
- private void bindView(View view, Contact curContact) {
- if (curContact != null) {
- TextView v = (TextView) view.findViewById(R.id.contactlistpseudo);
- SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- if (settings.getBoolean(BeemApplication.SHOW_JID, false))
- v.setText(curContact.getJID());
- else
- v.setText(curContact.getName());
- v = (TextView) view.findViewById(R.id.contactlistmsgperso);
- v.setText(curContact.getMsgState());
- ImageView img = (ImageView) view.findViewById(R.id.avatar);
- String avatarId = curContact.getAvatarId();
- int contactStatus = curContact.getStatus();
- Drawable avatar = getAvatarStatusDrawable(avatarId);
- img.setImageDrawable(avatar);
- img.setImageLevel(contactStatus);
- }
- }
-
- /**
- * Get a LayerDrawable containing the avatar and the status icon.
- * The status icon will change with the level of the drawable.
- * @param avatarId the avatar id to retrieve or null to get default
- * @return a LayerDrawable
- */
- private Drawable getAvatarStatusDrawable(String avatarId) {
- Drawable avatarDrawable = null;
- if (avatarId != null) {
- Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(avatarId).build();
- InputStream in = null;
- try {
- try {
- in = context.getContentResolver().openInputStream(uri);
- avatarDrawable = Drawable.createFromStream(in, avatarId);
- } finally {
- if (in != null)
- in.close();
- }
- } catch (IOException e) {
- Log.w(TAG, "Error while setting the avatar " + avatarId, e);
- }
- }
- if (avatarDrawable == null)
- avatarDrawable = context.getResources().getDrawable(R.drawable.beem_launcher_icon_silver);
- LayerDrawable ld = (LayerDrawable) context.getResources().getDrawable(R.drawable.avatar_status);
- ld.setLayerInset(1, 36, 36, 0, 0);
- ld.setDrawableByLayerId(R.id.avatar, avatarDrawable);
- return ld;
- }
-
- /**
- * Put a contact in a list.
- * Helper method.
- *
- * @param c the contact
- * @param list the list
- */
- private void put(Contact c, List<Contact> list) {
- list.remove(c);
- list.add(c);
- }
-
- /**
- * Tell if the list display only online contacts.
- *
- * @return true if only online contacts are shown
- */
- public boolean isOnlineOnly() {
- return showOnlineOnly;
- }
-
- /**
- * Set the list to display only the online contacts.
- *
- * @param online true to display only online contacts
- */
- public void setOnlineOnly(boolean online) {
- if (online != showOnlineOnly) {
- showOnlineOnly = online;
- mCurrentList = showOnlineOnly ? onlineContacts : allContacts;
- notifyDataSetChanged();
- }
- }
-
- /**
- * A Filter which select Contact to display by searching in ther Jid.
- */
- private class ContactFilter extends Filter {
-
- /**
- * Create a ContactFilter.
- */
- public ContactFilter() { }
-
- @Override
- protected Filter.FilterResults performFiltering(CharSequence constraint) {
- Log.d(TAG, "performFiltering");
- List<Contact> result = mCurrentList;
- if (constraint.length() > 0) {
- result = new LinkedList<Contact>();
- for (Contact c : mCurrentList) {
- if (c.getJID().contains(constraint))
- result.add(c);
- }
- }
- Filter.FilterResults fr = new Filter.FilterResults();
- fr.values = result;
- fr.count = result.size();
- return fr;
- }
-
- @Override
- protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
- Log.d(TAG, "publishResults");
- List<Contact> contacts = (List<Contact>) results.values;
- mCurrentList = contacts;
- notifyDataSetChanged();
- }
- }
-
- /**
- * Comparator Contact by status and name.
- */
- private static class ComparatorContactListByStatusAndName<T> implements Comparator<T> {
- /**
- * Constructor.
- */
- public ComparatorContactListByStatusAndName() {
- }
-
- @Override
- public int compare(T c1, T c2) {
- if (((Contact) c1).getStatus() < ((Contact) c2).getStatus()) {
- return 1;
- } else if (((Contact) c1).getStatus() > ((Contact) c2).getStatus()) {
- return -1;
- } else
- return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName());
- }
- }
-
-}
--- a/src/com/beem/project/beem/ui/ContactListFragment.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.ui;
-
-import java.util.List;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.ListFragment;
-import android.view.ContextMenu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.AdapterView.AdapterContextMenuInfo;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-
-/**
- * A Fragment which display a list of contacts.
- */
-public class ContactListFragment extends ListFragment {
- private String group;
- private ContactList hostActivity;
- private Contact mSelectedContact;
-
- /**
- * Create a ContactListFragment.
- * @param group the group name
- * @return the ContactListFragment
- */
- public static ContactListFragment newInstance(String group) {
- ContactListFragment f = new ContactListFragment();
- Bundle b = new Bundle();
- b.putString("group", group);
- f.setArguments(b);
- return f;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- parseArguments();
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- hostActivity = (ContactList) activity;
- }
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
- ListAdapter adapter = hostActivity.getContactListAdapter(group);
- setListAdapter(adapter);
- registerForContextMenu(getListView());
- }
-
- @Override
- public void onListItemClick(ListView l, View v, int position, long id) {
- ContactListAdapter a = (ContactListAdapter) getListAdapter();
- Contact c = (Contact) a.getItem(position);
- Intent i = new Intent(getActivity(), Chat.class);
- i.setData(c.toUri());
- startActivity(i);
- }
-
- @Override
- public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
- super.onCreateContextMenu(menu, v, menuInfo);
- MenuInflater inflater = hostActivity.getMenuInflater();
- inflater.inflate(R.menu.contactlist_context, menu);
- AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
- mSelectedContact = (Contact) getListAdapter().getItem(info.position);
- menu.setHeaderTitle(mSelectedContact.getJID());
- }
-
- /**
- * Parse the arguments submit to the Fragment.
- */
- private void parseArguments() {
- Bundle b = getArguments();
- if (b == null)
- return;
- group = b.getString("group");
- }
-
- @Override
- public boolean onContextItemSelected(MenuItem item) {
- Intent in;
- boolean result = false;
- if (mSelectedContact != null) {
- switch (item.getItemId()) {
- case R.id.contact_list_context_menu_chat_item:
- List<String> res = mSelectedContact.getMRes();
- if (res.isEmpty()) {
- break;
- }
- for (String resv : res) {
- in = new Intent(hostActivity, Chat.class);
- in.setData(mSelectedContact.toUri(resv));
- item.getSubMenu().add(resv).setIntent(in);
- }
- result = true;
- break;
- case R.id.contact_list_context_menu_call_item:
- hostActivity.doContextMenuAction(item.getItemId(), mSelectedContact);
- break;
- case R.id.contact_list_context_menu_user_info:
- item.getSubMenu().setHeaderTitle(mSelectedContact.getJID());
- result = true;
- break;
- case R.id.contact_list_context_menu_userinfo_alias:
- hostActivity.doContextMenuAction(item.getItemId(), mSelectedContact);
- result = true;
- break;
- case R.id.contact_list_context_menu_userinfo_group:
- in = new Intent(hostActivity, GroupList.class);
- in.putExtra("contact", mSelectedContact);
- startActivity(in);
- result = true;
- break;
- case R.id.contact_list_context_menu_userinfo_subscription:
- hostActivity.doContextMenuAction(item.getItemId(), mSelectedContact);
- result = true;
- break;
- case R.id.contact_list_context_menu_userinfo_block:
- result = true;
- break;
- case R.id.contact_list_context_menu_userinfo_delete:
- hostActivity.doContextMenuAction(item.getItemId(), mSelectedContact);
- result = true;
- break;
- default:
- result = super.onContextItemSelected(item);
- break;
- }
- return result;
- }
- return super.onContextItemSelected(item);
- }
-
-}
--- a/src/com/beem/project/beem/ui/GroupList.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.ListActivity;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.View.OnKeyListener;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.CheckedTextView;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemClickListener;
-
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.aidl.IRoster;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-
-/**
- * That activity permit to manage user groups.
- * @author nikita
- */
-public class GroupList extends ListActivity {
-
- private static final Intent SERVICE_INTENT = new Intent();
-
- private final ServiceConnection mServConn = new BeemServiceConnection();
- private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
- private IXmppFacade mXmppFacade;
- private IRoster mRoster;
- private String mJID;
- private ArrayAdapter<String> mGroups;
- private Contact mContact;
- private TextView mText;
- private final List<String> mStrings = new ArrayList<String>();
-
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
-
- /**
- * Constructor.
- */
- public GroupList() {
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onCreate(android.os.Bundle)
- */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.group_list);
- mContact = getIntent().getParcelableExtra("contact");
- mJID = mContact.getJID();
- final ListView listView = getListView();
-
- listView.setItemsCanFocus(false);
- listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
- listView.setOnItemClickListener(new GroupOnItemClickListener());
-
- mText = (TextView) findViewById(R.id.GroupListText);
- mText.setOnKeyListener(new GroupListOnKeyListener());
- this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onResume() {
- super.onResume();
- bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onPause() {
- super.onPause();
- unbindService(mServConn);
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onDestroy()
- */
- @Override
- protected void onDestroy() {
- super.onDestroy();
- this.unregisterReceiver(mReceiver);
- }
-
- /**
- * init activity list adapter.
- */
- private void setAdapter() {
- try {
- for (String group : mRoster.getGroupsNames()) {
- mStrings.add(group);
- }
- mGroups = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, mStrings);
- setListAdapter(mGroups);
- mContact = mRoster.getContact(mJID);
- for (String group : mContact.getGroups()) {
- getListView().setItemChecked(mGroups.getPosition(group), true);
- }
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Event when group is added.
- */
- private class GroupListOnKeyListener implements OnKeyListener {
-
- /**
- * Constructor.
- */
- public GroupListOnKeyListener() {
- }
-
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- boolean result = false;
- if (event.getAction() == KeyEvent.ACTION_DOWN) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_DPAD_CENTER:
- case KeyEvent.KEYCODE_ENTER:
- if (mText.getText().length() == 0)
- return false;
- String groupname = mText.getText().toString();
- mGroups.add(groupname);
- mText.setText(null);
- result = true;
- break;
- default:
- result = false;
- }
- }
- return result;
- }
-
- }
-
- /**
- * Event click on list group contact.
- */
- private class GroupOnItemClickListener implements OnItemClickListener {
-
- /**
- * Constructor.
- */
- public GroupOnItemClickListener() {
- }
-
- @Override
- public void onItemClick(AdapterView<?> arg0, View v, int arg2, long arg3) {
- CheckedTextView textView = (CheckedTextView) v;
- if (!textView.isChecked()) {
- try {
- mRoster.addContactToGroup(textView.getText().toString(), mJID);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- } else {
- try {
- mRoster.removeContactFromGroup(textView.getText().toString(), mJID);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-
- }
-
- }
-
- /**
- * The ServiceConnection used to connect to the Beem service.
- */
- private class BeemServiceConnection implements ServiceConnection {
-
- /**
- * Constructor.
- */
- public BeemServiceConnection() {
- }
-
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mXmppFacade = IXmppFacade.Stub.asInterface(service);
- try {
- mRoster = mXmppFacade.getRoster();
- setAdapter();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- mXmppFacade = null;
- mRoster = null;
- }
- }
-
-}
--- a/src/com/beem/project/beem/ui/Login.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Application;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.R;
-import com.beem.project.beem.ui.wizard.Account;
-import com.beem.project.beem.utils.BeemConnectivity;
-
-/**
- * This class is the main Activity for the Beem project.
- * @author Da Risk <darisk@beem-project.com>
- */
-public class Login extends Activity {
-
- private static final int LOGIN_REQUEST_CODE = 1;
- private TextView mTextView;
- private boolean mIsResult;
- private BeemApplication mBeemApplication;
-
- /**
- * Constructor.
- */
- public Login() {
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- Application app = getApplication();
- if (app instanceof BeemApplication) {
- mBeemApplication = (BeemApplication) app;
- if (mBeemApplication.isConnected()) {
- startActivity(new Intent(this, ContactList.class));
- finish();
- } else if (!mBeemApplication.isAccountConfigured()) {
- startActivity(new Intent(this, Account.class));
- finish();
- }
- }
- setContentView(R.layout.login);
- mTextView = (TextView) findViewById(R.id.log_as_msg);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- if (mBeemApplication.isAccountConfigured() && !mIsResult
- && BeemConnectivity.isConnected(getApplicationContext())) {
- mTextView.setText("");
- Intent i = new Intent(this, LoginAnim.class);
- startActivityForResult(i, LOGIN_REQUEST_CODE);
- mIsResult = false;
- } else {
- mTextView.setText(R.string.login_start_msg);
- }
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == LOGIN_REQUEST_CODE) {
- mIsResult = true;
- if (resultCode == Activity.RESULT_OK) {
- startActivity(new Intent(this, ContactList.class));
- finish();
- } else if (resultCode == Activity.RESULT_CANCELED) {
- if (data != null) {
- String tmp = data.getExtras().getString("message");
- Toast.makeText(Login.this, tmp, Toast.LENGTH_SHORT).show();
- mTextView.setText(tmp);
- }
- }
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.login, menu);
- return true;
- }
-
- @Override
- public final boolean onOptionsItemSelected(MenuItem item) {
- boolean result;
- switch (item.getItemId()) {
- case R.id.login_menu_settings:
- mTextView.setText("");
- startActivity(new Intent(Login.this, Settings.class));
- result = true;
- break;
- case R.id.login_menu_about:
- createAboutDialog();
- result = true;
- break;
- case R.id.login_menu_login:
- if (mBeemApplication.isAccountConfigured()) {
- Intent i = new Intent(this, LoginAnim.class);
- startActivityForResult(i, LOGIN_REQUEST_CODE);
- }
- result = true;
- break;
- default:
- result = false;
- break;
- }
- return result;
- }
-
- /**
- * Create an about "BEEM" dialog.
- */
- private void createAboutDialog() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- String versionname;
- try {
- PackageManager pm = getPackageManager();
- PackageInfo pi = pm.getPackageInfo("com.beem.project.beem", 0);
- versionname = pi.versionName;
- } catch (PackageManager.NameNotFoundException e) {
- versionname = "";
- }
- String title = getString(R.string.login_about_title, versionname);
- builder.setTitle(title).setMessage(R.string.login_about_msg).setCancelable(false);
- builder.setNeutralButton(R.string.login_about_button, new DialogInterface.OnClickListener() {
-
- public void onClick(DialogInterface dialog, int whichButton) {
- dialog.cancel();
- }
- });
- AlertDialog aboutDialog = builder.create();
- aboutDialog.show();
- }
-}
--- a/src/com/beem/project/beem/ui/LoginAnim.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,269 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui;
-
-import android.app.Activity;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.LoginAsyncTask;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-
-import de.duenndns.ssl.MemorizingTrustManager;
-
-/**
- * This class is an activity which display an animation during the connection with the server.
- * @author Da Risk <darisk972@gmail.com>
- */
-public class LoginAnim extends Activity {
-
- private static final String TAG = "LoginAnim";
- private static final Intent SERVICE_INTENT = new Intent();
- private static final int RECEIVER_PRIORITY = 50;
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
- private ImageView mLogo;
- private Animation mRotateAnim;
- private final ServiceConnection mServConn = new LoginServiceConnection();
- private IXmppFacade mXmppFacade;
- private AsyncTask<IXmppFacade, Integer, Boolean> mTask;
- private Button mCancelBt;
- private TextView mLoginState;
- private boolean mBinded;
- private BroadcastReceiver mSslReceiver;
-
- /**
- * Constructor.
- */
- public LoginAnim() {
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onCreate(android.os.Bundle)
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.login_anim);
- mLoginState = (TextView) findViewById(R.id.loginanim_status_text);
- mLogo = (ImageView) findViewById(R.id.loginanim_logo_anim);
- mRotateAnim = AnimationUtils.loadAnimation(this, R.anim.rotate_and_scale);
- mCancelBt = (Button) findViewById(R.id.loginanim_cancel_button);
- mCancelBt.setOnClickListener(new ClickListener());
- mSslReceiver = new BroadcastReceiver() {
- public void onReceive(Context ctx, Intent i) {
- try {
- Log.i(TAG, "Interception the SSL notification");
- PendingIntent pi = i.getParcelableExtra(MemorizingTrustManager.INTERCEPT_DECISION_INTENT_LAUNCH);
- pi.send();
- abortBroadcast();
- } catch (PendingIntent.CanceledException e) {
- Log.e(TAG, "Error while displaying the SSL dialog", e);
- }
- }
- };
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onStart()
- */
- @Override
- protected void onStart() {
- super.onStart();
- mLogo.startAnimation(mRotateAnim);
- if (mTask == null)
- mTask = new LoginTask();
- if (!mBinded)
- mBinded = bindService(LoginAnim.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
- IntentFilter filter = new IntentFilter(MemorizingTrustManager.INTERCEPT_DECISION_INTENT
- + "/" + getPackageName());
- filter.setPriority(RECEIVER_PRIORITY);
- registerReceiver(mSslReceiver, filter);
-
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onPause()
- */
- @Override
- protected void onStop() {
- super.onStop();
- if (mBinded && mTask.getStatus() != AsyncTask.Status.RUNNING) {
- unbindService(mServConn);
- mXmppFacade = null;
- mBinded = false;
- }
- unregisterReceiver(mSslReceiver);
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onKeyDown(int, android.view.KeyEvent)
- */
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- // TODO use onBackPressed on Eclair (2.0)
- if (keyCode == KeyEvent.KEYCODE_BACK && mTask.getStatus() != AsyncTask.Status.FINISHED) {
- if (!mTask.cancel(true)) {
- Log.d(TAG, "Can't interrupt the connection");
- }
- setResult(Activity.RESULT_CANCELED);
- }
- return super.onKeyDown(keyCode, event);
- }
-
- /**
- * Click event listener on cancel button.
- */
- private class ClickListener implements OnClickListener {
-
- /**
- * Constructor.
- */
- ClickListener() {
- }
-
- @Override
- public void onClick(View v) {
- if (v == mCancelBt) {
- if (!mTask.cancel(true)) {
- Log.d(TAG, "Can't interrupt the connection");
- }
- setResult(Activity.RESULT_CANCELED);
- finish();
- }
- }
- }
-
- /**
- * Asynchronous class for connection.
- */
- private class LoginTask extends LoginAsyncTask {
-
- /**
- * Constructor.
- */
- LoginTask() {
- }
-
- /* (non-Javadoc)
- * @see android.os.AsyncTask#onPostExecute(java.lang.Object)
- */
- @Override
- protected void onPostExecute(Boolean result) {
-
- if (result == null || !result) { // Task cancelled or exception
- if (!result) {
- Intent i = new Intent();
- i.putExtra("message", getErrorMessage());
- LoginAnim.this.setResult(Activity.RESULT_CANCELED, i);
- } else
- LoginAnim.this.setResult(Activity.RESULT_CANCELED);
- LoginAnim.this.finish();
- } else {
- mCancelBt.setEnabled(false);
- LoginAnim.this.startService(LoginAnim.SERVICE_INTENT);
- LoginAnim.this.setResult(Activity.RESULT_OK);
- LoginAnim.this.finish();
- }
- }
-
- @Override
- protected void onProgressUpdate(Integer ... values) {
- mLoginState.setText(getResources().getStringArray(R.array.loganim_state)[values[0]]);
- }
-
- /* (non-Javadoc)
- * @see android.os.AsyncTask#onCancelled()
- */
- @Override
- protected void onCancelled() {
- super.onCancelled();
- LoginAnim.this.stopService(LoginAnim.SERVICE_INTENT);
- }
-
- }
-
- /**
- * The service connection used to connect to the Beem service.
- */
- private class LoginServiceConnection implements ServiceConnection {
-
- /**
- * Constructor.
- */
- public LoginServiceConnection() {
- }
-
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mXmppFacade = IXmppFacade.Stub.asInterface(service);
- if (mTask.getStatus() == AsyncTask.Status.PENDING)
- mTask = mTask.execute(mXmppFacade);
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- mXmppFacade = null;
- }
- }
-}
--- a/src/com/beem/project/beem/ui/PrivacyList.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,361 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.Dialog;
-import android.app.ListActivity;
-import android.content.ComponentName;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.content.DialogInterface.OnDismissListener;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.ContextMenu;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.PrivacyListItem;
-import com.beem.project.beem.service.aidl.IPrivacyListListener;
-import com.beem.project.beem.service.aidl.IPrivacyListManager;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.ui.dialogs.builders.CreatePrivacyList;
-import com.beem.project.beem.ui.dialogs.builders.DeletePrivacyList;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-
-/**
- * This class represents an activity which allows the user to manage his privacy lists.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
-public class PrivacyList extends ListActivity {
-
- private static final String TAG = "PrivacyList";
- private static final Intent SERVICE_INTENT = new Intent();
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
-
- private static final int DIALOG_CREATE = 0;
- private static final int DIALOG_UPDATE_BUDDIES = 1;
- private static final int DIALOG_UPDATE_GROUPS = 2;
- private static final int DIALOG_DELETE = 3;
-
- private static final String SAVED_INSTANCE_KEY_PRIVACY_LISTS = "PRIVACY_LISTS";
-
- private Handler mHandler = new Handler();
-
- private ArrayAdapter<String> mAdapter;
- private final List<String> mPrivacyListNames = new ArrayList<String>();
- private String mCurrPrivacyListName;
-
- private final ServiceConnection mConn = new BeemServiceConnection();
- private final BeemBroadcastReceiver mBroadcastReceiver = new BeemBroadcastReceiver();
-
- private IPrivacyListManager mPrivacyListManager;
- private IPrivacyListListener mPrivacyListListener;
-
- /**
- * Constructor.
- */
- public PrivacyList() {
- super();
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onSaveInstanceState(Bundle savedInstanceState) {
- Log.d(TAG, "BEGIN onSaveInstanceState.");
- savedInstanceState.putStringArrayList(SAVED_INSTANCE_KEY_PRIVACY_LISTS, (ArrayList<String>) mPrivacyListNames);
- Log.d(TAG, "END onSaveInstanceState.");
- super.onSaveInstanceState(savedInstanceState);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Log.d(TAG, "BEGIN onCreate.");
-
- setContentView(R.layout.privacy_list);
- registerForContextMenu(this.getListView());
-
- mHandler = new Handler();
-
- if (savedInstanceState != null && !savedInstanceState.isEmpty()) {
- mPrivacyListNames.addAll(savedInstanceState.getStringArrayList(SAVED_INSTANCE_KEY_PRIVACY_LISTS));
- }
-
- mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mPrivacyListNames);
- setListAdapter(mAdapter);
-
- bindService(SERVICE_INTENT, mConn, BIND_AUTO_CREATE);
-
- mPrivacyListListener = new PrivacyListListener();
- this.registerReceiver(mBroadcastReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
-
- Log.d(TAG, "END onCreate.");
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onDestroy() {
- super.onDestroy();
-
- Log.v(TAG, "BEGIN onDestroy.");
-
- if (mPrivacyListManager != null) {
- try {
- mPrivacyListManager.removePrivacyListListener(mPrivacyListListener);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- this.unregisterReceiver(mBroadcastReceiver);
- unbindService(mConn);
-
- Log.v(TAG, "END onDestroy.");
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onStart() {
- super.onStart();
-
- Log.v(TAG, "BEGIN onStart.");
- Log.v(TAG, "END onStart.");
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected void onStop() {
- super.onStop();
-
- Log.v(TAG, "BEGIN onStop.");
- Log.v(TAG, "END onStop.");
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- protected Dialog onCreateDialog(int id) {
- Dialog dialog;
- switch (id) {
- case DIALOG_CREATE:
- dialog = new CreatePrivacyList(PrivacyList.this, mPrivacyListManager).create();
- dialog.setOnDismissListener(new OnDismissListener() {
-
- @Override
- public void onDismiss(DialogInterface dialog) {
- PrivacyList.this.removeDialog(DIALOG_CREATE);
- }
- });
- break;
- case DIALOG_DELETE:
- dialog = new DeletePrivacyList(PrivacyList.this, mPrivacyListManager, mCurrPrivacyListName).create();
- dialog.setOnDismissListener(new OnDismissListener() {
-
- @Override
- public void onDismiss(DialogInterface dialog) {
- PrivacyList.this.removeDialog(DIALOG_DELETE);
- }
-
- });
- break;
- default:
- dialog = null;
- }
- return dialog;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public final boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
-
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.privacy_list, menu);
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
- super.onCreateContextMenu(menu, v, menuInfo);
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.privacy_list_context, menu);
- mCurrPrivacyListName = mPrivacyListNames.get(((AdapterView.AdapterContextMenuInfo) menuInfo).position);
- menu.setHeaderTitle(mCurrPrivacyListName);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onContextItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.privacy_list_context_menu_buddies_item:
- return true;
- case R.id.privacy_list_context_menu_groups_item:
- return true;
- case R.id.privacy_list_context_menu_delete_item:
- showDialog(DIALOG_DELETE);
- return true;
- default:
- return super.onContextItemSelected(item);
- }
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public final boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.privacy_list_menu_create:
- showDialog(DIALOG_CREATE);
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Service connection.
- * @author jamu
- */
- private final class BeemServiceConnection implements ServiceConnection {
-
- private IXmppFacade mXmppFacade;
-
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- Log.v(TAG, "BEGIN onServiceConnected.");
- mXmppFacade = IXmppFacade.Stub.asInterface(service);
- try {
- mPrivacyListManager = mXmppFacade.getPrivacyListManager();
- mPrivacyListManager.addPrivacyListListener(mPrivacyListListener);
- mPrivacyListNames.clear();
- mPrivacyListNames.addAll(mPrivacyListManager.getPrivacyLists());
- mAdapter.notifyDataSetChanged();
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- Log.v(TAG, "END onServiceConnected.");
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- Log.v(TAG, "BEGIN onServiceDisconnected.");
- mXmppFacade = null;
- try {
- mPrivacyListManager.removePrivacyListListener(mPrivacyListListener);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- Log.v(TAG, "END onServiceDisconnected.");
- }
- }
-
- /**
- * Listener.
- * @author jamu
- */
- private class PrivacyListListener extends IPrivacyListListener.Stub {
-
- @Override
- public void setPrivacyList(String listName, List<PrivacyListItem> listItem) throws RemoteException {
- Log.d(TAG, "BEGIN PrivacyListListener >> setPrivacyList.");
- Log.d(TAG, "> " + listName + " has been setted.");
- Log.d(TAG, "END PrivacyListListener >> setPrivacyList.");
- }
-
- @Override
- public void updatedPrivacyList(final String listName) throws RemoteException {
- Log.d(TAG, "BEGIN PrivacyListListener >> updatedPrivacyList.");
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- try {
- mPrivacyListNames.clear();
- // Not that much lists and require some server queries to know if the list has been
- // updated/deleted or set to default/active by this activity or another IM client.
- mPrivacyListNames.addAll(mPrivacyListManager.getPrivacyLists());
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- mAdapter.notifyDataSetChanged();
- }
- });
- Log.d(TAG, "END PrivacyListListener >> updatedPrivacyList.");
- }
- }
-}
--- a/src/com/beem/project/beem/ui/Settings.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.R;
-import com.beem.project.beem.ui.wizard.Account;
-
-/**
- * This class represents an activity which allows the user to change his account or proxy parameters.
- */
-public class Settings extends PreferenceActivity {
-
- private static final Intent SERVICE_INTENT = new Intent();
-
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
-
- /**
- * Constructor.
- */
- public Settings() {
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.preferences);
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- String accountName = getPreferenceManager().getDefaultSharedPreferences(this)
- .getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
- Preference account = findPreference(BeemApplication.ACCOUNT_USERNAME_KEY);
- account.setSummary(accountName);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater mInflater = getMenuInflater();
- mInflater.inflate(R.menu.edit_settings, menu);
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- Intent i = null;
- switch (item.getItemId()) {
- case R.id.settings_menu_create_account:
- i = new Intent(this, Account.class);
- startActivity(i);
- return true;
- case R.id.settings_menu_privacy_lists:
- i = new Intent(this, PrivacyList.class);
- startActivity(i);
- return true;
- default:
- return false;
- }
- }
-}
--- a/src/com/beem/project/beem/ui/Subscription.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui;
-
-import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.packet.Presence.Type;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.PresenceAdapter;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.utils.BeemBroadcastReceiver;
-
-/**
- * This activity is used to accept a subscription request.
- * @author nikita
- */
-public class Subscription extends Activity {
-
- private static final Intent SERVICE_INTENT = new Intent();
- private static final String TAG = Subscription.class.getSimpleName();
- private IXmppFacade mService;
- private String mContact;
- private ServiceConnection mServConn = new BeemServiceConnection();
- private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
- private MyOnClickListener mClickListener = new MyOnClickListener();
-
- static {
- SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
- }
-
- /**
- * Constructor.
- */
- public Subscription() {
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onCreate(android.os.Bundle)
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.subscription);
- findViewById(R.id.SubscriptionAccept).setOnClickListener(mClickListener);
- findViewById(R.id.SubscriptionRefuse).setOnClickListener(mClickListener);
- Contact c = new Contact(getIntent().getData());
- mContact = c.getJID();
- TextView tv = (TextView) findViewById(R.id.SubscriptionText);
- String str = String.format(getString(R.string.SubscriptText), mContact);
- tv.setText(str);
- this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onResume()
- */
- @Override
- protected void onResume() {
- super.onResume();
- bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onPause()
- */
- @Override
- protected void onPause() {
- super.onPause();
- unbindService(mServConn);
- }
-
- /* (non-Javadoc)
- * @see android.app.Activity#onDestroy()
- */
- @Override
- protected void onDestroy() {
- super.onDestroy();
- this.unregisterReceiver(mReceiver);
- }
-
- /**
- * Send the presence stanza.
- *
- * @param p presence stanza
- */
- private void sendPresence(Presence p) {
- PresenceAdapter preAdapt = new PresenceAdapter(p);
- try {
- mService.sendPresencePacket(preAdapt);
- } catch (RemoteException e) {
- Log.e(TAG, "Error while sending subscription response", e);
- }
- }
-
- /**
- * Event simple click on buttons.
- */
- private class MyOnClickListener implements OnClickListener {
-
- /**
- * Constructor.
- */
- public MyOnClickListener() {
- }
-
- @Override
- public void onClick(View v) {
- Presence presence = null;
- switch (v.getId()) {
- case R.id.SubscriptionAccept:
- presence = new Presence(Type.subscribed);
- Toast.makeText(Subscription.this, getString(R.string.SubscriptAccept), Toast.LENGTH_SHORT)
- .show();
- break;
- case R.id.SubscriptionRefuse:
- presence = new Presence(Type.unsubscribed);
- Toast.makeText(Subscription.this, getString(R.string.SubscriptRefused), Toast.LENGTH_SHORT).show();
- break;
- default:
- Toast.makeText(Subscription.this, getString(R.string.SubscriptError), Toast.LENGTH_SHORT).show();
- }
- if (presence != null) {
- presence.setTo(mContact);
- sendPresence(presence);
- }
- finish();
- }
- };
-
- /**
- * The ServiceConnection used to connect to the Beem service.
- */
- private class BeemServiceConnection implements ServiceConnection {
-
- /**
- * Constructor.
- */
- public BeemServiceConnection() {
- }
-
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- mService = IXmppFacade.Stub.asInterface(service);
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- mService = null;
- }
- }
-}
--- a/src/com/beem/project/beem/ui/dialogs/builders/Alias.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.dialogs.builders;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.EditText;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.aidl.IRoster;
-
-/**
- * Create dialog alias.
- */
-public class Alias extends AlertDialog.Builder {
-
- private static final String TAG = "Dialogs.Builders > Alias";
-
- private IRoster mRoster;
- private Contact mContact;
- private EditText mEditTextAlias;
-
- /**
- * Constructor.
- * @param context context activity.
- * @param roster Beem roster.
- * @param contact the contact to modify.
- */
- public Alias(final Context context, final IRoster roster, final Contact contact) {
- super(context);
-
- mRoster = roster;
- mContact = contact;
-
- LayoutInflater factory = LayoutInflater.from(context);
- final View textEntryView = factory.inflate(
- R.layout.contactdialogaliasdialog, null);
- setTitle(mContact.getJID());
- setView(textEntryView);
- mEditTextAlias = (EditText) textEntryView.findViewById(
- R.id.CDAliasDialogName);
- mEditTextAlias.setText(mContact.getName());
- setPositiveButton(R.string.OkButton, new DialogClickListener());
- setNegativeButton(R.string.CancelButton, new DialogClickListener());
- }
-
- /**
- * Event click listener.
- */
- class DialogClickListener implements DialogInterface.OnClickListener {
-
- /**
- * Constructor.
- */
- public DialogClickListener() {
- }
-
-
- @Override
- public void onClick(final DialogInterface dialog, final int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- String name = mEditTextAlias.getText().toString();
- if (name.length() == 0) {
- name = mContact.getJID();
- }
- try {
- mRoster.setContactName(mContact.getJID(), name);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
- }
- }
-}
--- a/src/com/beem/project/beem/ui/dialogs/builders/ChatList.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.dialogs.builders;
-
-import java.util.List;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-
-/**
- * Create the change chat dialog.
- */
-public class ChatList extends AlertDialog.Builder {
-
- //private static final String TAG = "Dialogs.Builders > Chat list";
-
- /**
- * Constructor.
- * @param context context activity.
- * @param openedChats A list containing the JID of participants of the opened chats.
- */
- public ChatList(final Context context, final List<Contact> openedChats) {
- super(context);
-
- if (openedChats.size() > 0) {
- CharSequence[] items = new CharSequence[openedChats.size()];
-
- int i = 0;
- for (Contact c : openedChats) {
- items[i++] = c.getName();
- }
- setTitle(R.string.chat_dialog_change_chat_title);
- setItems(items, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int item) {
- Intent chatIntent = new Intent(context, com.beem.project.beem.ui.Chat.class);
- chatIntent.setData((openedChats.get(item)).toUri());
- context.startActivity(chatIntent);
- }
- });
- } else {
- setMessage(R.string.chat_no_more_chats);
- }
- }
-}
--- a/src/com/beem/project/beem/ui/dialogs/builders/CreatePrivacyList.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.dialogs.builders;
-
-import java.util.ArrayList;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.EditText;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.PrivacyListItem;
-import com.beem.project.beem.service.aidl.IPrivacyListManager;
-
-/**
- * Use this builder to build a dialog which handles a privacy list creation.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
-public class CreatePrivacyList extends AlertDialog.Builder {
-
- private static final String TAG = "Dialogs.Builders > CreatePrivacyList";
-
- private final IPrivacyListManager mPrivacyListManager;
- private final View mTextEntryView;
- private EditText mListNameField;
-
- /**
- * Constructor.
- * @param context context activity.
- * @param privacyListManager the privacy list manager that will be use to create our list.
- */
- public CreatePrivacyList(final Context context, final IPrivacyListManager privacyListManager) {
- super(context);
-
- LayoutInflater factory = LayoutInflater.from(context);
-
- mTextEntryView = factory.inflate(R.layout.privacy_list_create_dialog, null);
- setView(mTextEntryView);
-
- mPrivacyListManager = privacyListManager;
- mListNameField = (EditText) mTextEntryView.findViewById(R.id.privacy_list_create_dialog_list_name);
-
- setTitle(R.string.privacy_list_create_dialog_title);
- setPositiveButton(R.string.privacy_list_create_dialog_create_button, new DialogClickListener());
- setNegativeButton(R.string.CancelButton, new DialogClickListener());
- }
-
- /**
- * Event click listener.
- */
- class DialogClickListener implements DialogInterface.OnClickListener {
-
- /**
- * Constructor.
- */
- public DialogClickListener() {
- }
-
- @Override
- public void onClick(final DialogInterface dialog, final int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- try {
- Log.d(TAG, "mPrivacyListManager ## " + mPrivacyListManager);
- Log.d(TAG, "listNameField ## " + mListNameField);
- Log.d(TAG, "listNameField.getText().toString() ## " + mListNameField.getText().toString());
- mPrivacyListManager.createPrivacyList(mListNameField.getText().toString(),
- new ArrayList<PrivacyListItem>());
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
- }
- }
-}
--- a/src/com/beem/project/beem/ui/dialogs/builders/DeleteContact.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.dialogs.builders;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.aidl.IRoster;
-
-/**
- * Use this builder to build a dialog which allows you to delete a contact from a specific roster.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
-public class DeleteContact extends AlertDialog.Builder {
-
- private static final String TAG = "Dialogs.Builders > DeleteContact";
-
- private IRoster mRoster;
- private Contact mContact;
-
- /**
- * Constructor.
- * @param context context activity.
- * @param roster the roster which has the contact you want to delete.
- * @param contact the contact to delete.
- */
- public DeleteContact(final Context context, final IRoster roster, final Contact contact) {
- super(context);
-
- mContact = contact;
- mRoster = roster;
-
- setMessage(R.string.userinfo_sure2delete);
- DialogClickListener dl = new DialogClickListener();
- setPositiveButton(R.string.userinfo_yes, dl);
- setNegativeButton(R.string.userinfo_no, dl);
- }
-
- /**
- * Event click listener.
- */
- private class DialogClickListener implements DialogInterface.OnClickListener {
-
- /**
- * Constructor.
- */
- public DialogClickListener() {
- }
-
- @Override
- public void onClick(final DialogInterface dialog, final int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- try {
- mRoster.deleteContact(mContact);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
- }
- }
-}
--- a/src/com/beem/project/beem/ui/dialogs/builders/DeletePrivacyList.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.dialogs.builders;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.aidl.IPrivacyListManager;
-
-/**
- * Use this builder to build a dialog which allows you to delete a privacy list.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
-public class DeletePrivacyList extends AlertDialog.Builder {
-
- private static final String TAG = "Dialogs.Builders > DeletePrivacyList";
-
- private final IPrivacyListManager mPrivacyListManager;
- private final String mPrivacyListName;
-
- /**
- * Constructor.
- * @param context context activity.
- * @param privacyListManager the privacy list manager managing the privacy list you want to delete.
- * @param privacyListName the name of the privacy list you want to delete.
- */
- public DeletePrivacyList(final Context context, final IPrivacyListManager privacyListManager,
- final String privacyListName) {
- super(context);
-
- mPrivacyListManager = privacyListManager;
- mPrivacyListName = privacyListName;
-
- setMessage(context.getString(R.string.privacy_list_delete_dialog_msg, privacyListName));
- DialogClickListener dl = new DialogClickListener();
- setPositiveButton(R.string.privacy_list_delete_dialog_yes, dl);
- setNegativeButton(R.string.privacy_list_delete_dialog_no, dl);
- }
-
- /**
- * Event click listener.
- */
- private class DialogClickListener implements DialogInterface.OnClickListener {
-
- /**
- * Constructor.
- */
- public DialogClickListener() {
- }
-
- @Override
- public void onClick(final DialogInterface dialog, final int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- try {
- mPrivacyListManager.removePrivacyList(mPrivacyListName);
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
- }
- }
-}
--- a/src/com/beem/project/beem/ui/dialogs/builders/DisplayOtrFingerprint.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.dialogs.builders;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.RemoteException;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.aidl.IChat;
-
-/**
- * Use this builder to build a dialog which allows you to display otr fingerprints.
- * @author nikita
- */
-public class DisplayOtrFingerprint extends AlertDialog.Builder {
-
- private static final String TAG = "DisplayOtrFingerprint";
- private IChat mChat;
-
- /**
- * Constructor.
- * @param context context activity.
- * @param chat the current chat.
- */
- public DisplayOtrFingerprint(final Context context, final IChat chat) {
- super(context);
-
- mChat = chat;
- try {
- setMessage(context.getString(R.string.chat_otr_verify_key, chat.getLocalOtrFingerprint(),
- chat.getRemoteOtrFingerprint()));
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- DialogClickListener dl = new DialogClickListener();
- setPositiveButton(R.string.userinfo_yes, dl);
- setNegativeButton(R.string.userinfo_no, dl);
- }
-
- /**
- * Event click listener.
- */
- private class DialogClickListener implements DialogInterface.OnClickListener {
-
- /**
- * Constructor.
- */
- public DialogClickListener() {
- }
-
- @Override
- public void onClick(final DialogInterface dialog, final int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- try {
- mChat.verifyRemoteFingerprint(true);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- } else if (which == DialogInterface.BUTTON_NEGATIVE) {
- try {
- mChat.verifyRemoteFingerprint(false);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
- }
-}
--- a/src/com/beem/project/beem/ui/dialogs/builders/ResendSubscription.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.dialogs.builders;
-
-import org.jivesoftware.smack.packet.Presence;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.RemoteException;
-import android.util.Log;
-import android.widget.Toast;
-
-import com.beem.project.beem.R;
-import com.beem.project.beem.service.Contact;
-import com.beem.project.beem.service.PresenceAdapter;
-import com.beem.project.beem.service.aidl.IXmppFacade;
-
-/**
- * Use this builder to build a dialog which allows you resend a subscription query to a contact.
- * @author Jean-Manuel Da Silva <dasilvj at beem-project dot com>
- */
-public class ResendSubscription extends AlertDialog.Builder {
-
- private static final String TAG = "Dialogs.Builders > ResendSubscription";
-
- private Context mContext;
- private IXmppFacade mXmppFacade;
- private Contact mContact;
-
- /**
- * Constructor.
- * @param context context activity.
- * @param xmppFacade the XMPP Facade used to send the query.
- * @param contact the receiver of the query.
- */
- public ResendSubscription(final Context context, final IXmppFacade xmppFacade, final Contact contact) {
- super(context);
-
- mContext = context;
- mXmppFacade = xmppFacade;
- mContact = contact;
-
- setMessage(R.string.userinfo_sureresend);
- DialogClickListener dl = new DialogClickListener();
- setPositiveButton(R.string.userinfo_yes, dl);
- setNegativeButton(R.string.userinfo_no, dl);
- }
-
- /**
- * Event click listener.
- */
- class DialogClickListener implements DialogInterface.OnClickListener {
-
- /**
- * Constructor.
- */
- DialogClickListener() {
- }
-
- @Override
- public void onClick(final DialogInterface dialog, final int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- Presence presencePacket = new Presence(Presence.Type.subscribe);
- presencePacket.setTo(mContact.getJID());
- try {
- mXmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket));
- Toast.makeText(mContext, mContext.getString(R.string.userinfo_resend), Toast.LENGTH_SHORT).show();
- } catch (RemoteException e) {
- Log.e(TAG, e.getMessage());
- }
- }
- }
-
- }
-}
--- a/src/com/beem/project/beem/ui/dialogs/builders/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-/**
- * This package contains Beem dialog builder's.
- */
-package com.beem.project.beem.ui.dialogs.builders;
-
--- a/src/com/beem/project/beem/ui/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-*/
-/**
- * This package contains the different activity displayed by BEEM and other class useful to make the UI.
- */
-package com.beem.project.beem.ui;
-
--- a/src/com/beem/project/beem/ui/views/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2011 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-/**
- * This package contains the custom View used by Beem to make the user interfaces.
- */
-package com.beem.project.beem.ui.views;
-
--- a/src/com/beem/project/beem/ui/wizard/Account.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.wizard;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.RadioGroup;
-
-import com.beem.project.beem.R;
-
-/**
- * The first activity of an user friendly wizard to configure a XMPP account.
- */
-public class Account extends FragmentActivity {
-
- private static final String TAG = Account.class.getSimpleName();
-
- private FragmentManager fragmentMgr;
-
- /**
- * Constructor.
- */
- public Account() {
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- fragmentMgr = getSupportFragmentManager();
- if (savedInstanceState == null) {
- FragmentTransaction t = fragmentMgr.beginTransaction();
- t.add(android.R.id.content, MainFragment.newInstance(), "Main");
- t.commit();
-
- }
- }
-
- /**
- * Callback called when the create account option is selected.
- *
- */
- public void onCreateAccountSelected() {
- Fragment f = CreateAccountFragment.newInstance();
- FragmentTransaction transaction = fragmentMgr.beginTransaction();
-
- transaction.replace(android.R.id.content, f, "createAccount");
- transaction.addToBackStack(null);
- transaction.commit();
- }
-
- /**
- * Callback called when the configure account option is selected.
- *
- */
- public void onConfigureAccountSelected() {
- Fragment f = AccountConfigureFragment.newInstance();
- FragmentTransaction transaction = fragmentMgr.beginTransaction();
-
- transaction.replace(android.R.id.content, f, "configureAccount");
- transaction.addToBackStack(null);
- transaction.commit();
- }
-
- /**
- * Main fragment of the wizard account activity.
- */
- public static class MainFragment extends Fragment implements OnClickListener, RadioGroup.OnCheckedChangeListener {
- private RadioGroup mConfigureGroup;
- private Button mNextButton;
-
- private Account activity;
-
- /**
- * Create a new MainFragment.
- *
- * @return a MainFragment
- */
- static MainFragment newInstance() {
- return new MainFragment();
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View v = inflater.inflate(R.layout.wizard_account_main_fragment, container, false);
- mNextButton = (Button) v.findViewById(R.id.next);
- mNextButton.setOnClickListener(this);
- mConfigureGroup = (RadioGroup) v.findViewById(R.id.configure_group);
- mConfigureGroup.setOnCheckedChangeListener(this);
- return v;
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- this.activity = (Account) activity;
- }
-
- @Override
- public void onClick(View v) {
- if (v == mNextButton) {
- int selectedid = mConfigureGroup.getCheckedRadioButtonId();
- if (selectedid == R.id.configure_account) {
- activity.onConfigureAccountSelected();
- } else if (selectedid == R.id.create_account) {
- activity.onCreateAccountSelected();
- }
- }
- }
-
- @Override
- public void onCheckedChanged(RadioGroup group, int checkedId) {
- if (checkedId == -1)
- mNextButton.setEnabled(false);
- else
- mNextButton.setEnabled(true);
- }
-
- }
-}
--- a/src/com/beem/project/beem/ui/wizard/AccountConfigureFragment.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,530 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.ui.wizard;
-
-import android.accounts.AccountManager;
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.support.v4.app.DialogFragment;
-import android.support.v4.app.Fragment;
-import android.text.Editable;
-import android.text.InputFilter;
-import android.text.LoginFilter;
-import android.text.TextUtils;
-import android.text.TextWatcher;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.R;
-import com.beem.project.beem.ui.Login;
-import com.beem.project.beem.ui.Settings;
-
-import org.jivesoftware.smack.Connection;
-import org.jivesoftware.smack.ConnectionConfiguration;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.proxy.ProxyInfo;
-import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
-import org.jivesoftware.smack.util.StringUtils;
-
-/**
- * Fragment to enter the information required in order to configure a XMPP account.
- *
- */
-public class AccountConfigureFragment extends Fragment implements OnClickListener {
-
- private static final String TAG = AccountConfigureFragment.class.getSimpleName();
-
- private static final String GOOGLE_ACCOUNT_TYPE = "com.google";
- private static final int SELECT_ACCOUNT_CODE = 1;
- private static final int MANUAL_CONFIGURATION_CODE = 2;
-
- private Button mNextButton;
- private Button mManualConfigButton;
- private Button mSelectAccountButton;
- private TextView mErrorLabel;
- private TextView mSettingsWarningLabel;
- private EditText mAccountJID;
- private EditText mAccountPassword;
- private final JidTextWatcher mJidTextWatcher = new JidTextWatcher();
- private final PasswordTextWatcher mPasswordTextWatcher = new PasswordTextWatcher();
- private boolean mValidJid;
- private boolean mValidPassword;
- private String mSelectedAccountName;
- private String mSelectedAccountType;
- private SharedPreferences settings;
- private boolean useSystemAccount;
-
- private com.beem.project.beem.ui.wizard.AccountConfigureFragment.ConnectionTestTask task;
-
- /**
- * Create a new AccountConfigureFragment.
- *
- * @return a new AccountConfigureFragment
- */
- public static AccountConfigureFragment newInstance() {
- return new AccountConfigureFragment();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Log.d(TAG, "onCreate");
- setRetainInstance(true);
-
- settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View v = inflater.inflate(R.layout.wizard_account_configure, container, false);
- mManualConfigButton = (Button) v.findViewById(R.id.manual_setup);
- mManualConfigButton.setOnClickListener(this);
- mNextButton = (Button) v.findViewById(R.id.next);
- mNextButton.setOnClickListener(this);
- mSelectAccountButton = (Button) v.findViewById(R.id.select_account_btn);
- mSelectAccountButton.setOnClickListener(this);
- mErrorLabel = (TextView) v.findViewById(R.id.error_label);
- mSettingsWarningLabel = (TextView) v.findViewById(R.id.settings_warn_label);
- mAccountJID = (EditText) v.findViewById(R.id.account_username);
- mAccountPassword = (EditText) v.findViewById(R.id.account_password);
- InputFilter[] orgFilters = mAccountJID.getFilters();
- InputFilter[] newFilters = new InputFilter[orgFilters.length + 1];
- int i;
- for (i = 0; i < orgFilters.length; i++)
- newFilters[i] = orgFilters[i];
- newFilters[i] = new LoginFilter.UsernameFilterGeneric();
- mAccountJID.setFilters(newFilters);
- mAccountJID.addTextChangedListener(mJidTextWatcher);
- mAccountPassword.addTextChangedListener(mPasswordTextWatcher);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) // true to disable the feature until ready
- v.findViewById(R.id.account_layout).setVisibility(View.GONE);
- return v;
- }
-
- @Override
- public void onStart() {
- super.onStart();
- useSystemAccount = settings.getBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
- // temporaly disable jid watcher
- mAccountJID.removeTextChangedListener(mJidTextWatcher);
- mAccountJID.setText(settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, ""));
- if (useSystemAccount) {
- mAccountPassword.setText("*******"); //dummy password
- mAccountJID.setText(settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, ""));
- mAccountPassword.setEnabled(false);
- mNextButton.setEnabled(true);
- }
- mAccountJID.addTextChangedListener(mJidTextWatcher);
- if (settings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false)
- || settings.getBoolean(BeemApplication.PROXY_USE_KEY, false)) {
- mSettingsWarningLabel.setVisibility(View.VISIBLE);
- } else
- mSettingsWarningLabel.setVisibility(View.GONE);
-
- }
-
- @TargetApi(14)
- @Override
- public void onClick(View v) {
- if (v == mNextButton) {
- if (useSystemAccount) {
- onDeviceAccountSelected(settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, ""),
- settings.getString(BeemApplication.ACCOUNT_SYSTEM_TYPE_KEY, ""));
- } else {
- String jid = mAccountJID.getText().toString();
- jid = StringUtils.parseBareAddress(jid);
- String password = mAccountPassword.getText().toString();
- task = new ConnectionTestTask();
- if (settings.getBoolean(BeemApplication.ACCOUNT_SPECIFIC_SERVER_KEY, false)) {
- String server = settings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_HOST_KEY, "");
- String port = settings.getString(BeemApplication.ACCOUNT_SPECIFIC_SERVER_PORT_KEY, "5222");
- task.execute(jid, password, server, port);
- } else
- task.execute(jid, password);
- }
- } else if (v == mManualConfigButton) {
- onManualConfigurationSelected();
- } else if (v == mSelectAccountButton) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- Intent i = AccountManager.newChooseAccountIntent(null, null,
- new String[] {GOOGLE_ACCOUNT_TYPE}, true, null, null, null, null);
- startActivityForResult(i, SELECT_ACCOUNT_CODE);
- }
- }
- }
-
- /**
- * Callback called when the Manual configuration button is selected.
- *
- */
- public void onManualConfigurationSelected() {
- Intent i = new Intent(getActivity(), Settings.class);
- i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivityForResult(i, MANUAL_CONFIGURATION_CODE);
- }
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == SELECT_ACCOUNT_CODE && resultCode == Activity.RESULT_OK) {
- mSelectedAccountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
- mSelectedAccountType = data.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE);
- onDeviceAccountSelected(mSelectedAccountName, mSelectedAccountType);
- } else if (requestCode == MANUAL_CONFIGURATION_CODE) {
- String login = settings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
- String password = settings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
- mAccountJID.setText(login);
- mAccountPassword.setText(password);
- } else {
- super.onActivityResult(requestCode, resultCode, data);
- }
- }
-
- /**
- * Callback called when the account was connected successfully.
- *
- * @param jid the jid used to connect
- * @param password the password used to connect
- *
- */
- private void onAccountConnectionSuccess(String jid, String password) {
- Activity a = getActivity();
- saveCredential(jid, password);
- // launch login
- Intent i = new Intent(a, Login.class);
- i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(i);
- a.finish();
- }
-
- /**
- * Callback called when the account connection failed.
- *
- */
- private void onAccountConnectionFailed() {
- mAccountPassword.setText("");
- mErrorLabel.setVisibility(View.VISIBLE);
- }
-
- /**
- * Callback called when the user select an account from the device (Android Account api).
- *
- * @param accountName the account name
- * @param accountType the account type
- *
- */
- private void onDeviceAccountSelected(String accountName, String accountType) {
- Activity a = getActivity();
- saveCredentialAccount(accountName, accountType);
- // launch login
- Intent i = new Intent(a, Login.class);
- i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(i);
- a.finish();
- }
-
- /**
- * Save the user credentials.
- *
- * @param jid the jid of the user
- * @param pass the password of the user
- *
- */
- private void saveCredential(String jid, String pass) {
- SharedPreferences.Editor edit = settings.edit();
- edit.putString(BeemApplication.ACCOUNT_USERNAME_KEY, jid);
- edit.putString(BeemApplication.ACCOUNT_PASSWORD_KEY, pass);
- edit.putBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, false);
- edit.commit();
- }
-
- /**
- * Save the user credentials.
- *
- * @param accountName the account name of the user
- * @param accountType the account type of the user
- *
- */
- private void saveCredentialAccount(String accountName, String accountType) {
- SharedPreferences.Editor edit = settings.edit();
- edit.putString(BeemApplication.ACCOUNT_USERNAME_KEY, accountName);
- edit.putString(BeemApplication.ACCOUNT_SYSTEM_TYPE_KEY, accountType);
- edit.putBoolean(BeemApplication.USE_SYSTEM_ACCOUNT_KEY, true);
- edit.commit();
- }
-
- /**
- * Check that the username is really a JID.
- * @param username the username to check.
- */
- private void checkUsername(String username) {
- String name = StringUtils.parseName(username);
- String server = StringUtils.parseServer(username);
- if (TextUtils.isEmpty(name) || TextUtils.isEmpty(server)) {
- mValidJid = false;
- } else {
- mValidJid = true;
- }
- }
-
- /**
- * Check password.
- * @param password the password to check.
- */
- private void checkPassword(String password) {
- if (password.length() > 0)
- mValidPassword = true;
- else
- mValidPassword = false;
- }
-
- /**
- * Text watcher to test the existence of a password.
- */
- private class PasswordTextWatcher implements TextWatcher {
-
- /**
- * Constructor.
- */
- public PasswordTextWatcher() {
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- checkPassword(s.toString());
- mNextButton.setEnabled(mValidJid && mValidPassword);
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- }
-
- /**
- * TextWatcher to check the validity of a JID.
- */
- private class JidTextWatcher implements TextWatcher {
-
- /**
- * Constructor.
- */
- public JidTextWatcher() {
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- checkUsername(s.toString());
- mNextButton.setEnabled(mValidJid && mValidPassword);
- if (useSystemAccount) {
- mAccountPassword.setEnabled(true);
- mAccountPassword.setText("");
- }
- useSystemAccount = false;
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- }
-
- /**
- * AsyncTask use to test the credentials.
- */
- class ConnectionTestTask extends AsyncTask<String, Void, Boolean> {
-
- private ProgressFragment progress;
- private ConnectionConfiguration config;
- private XMPPException exception;
- private String jid;
- private String password;
- private String server;
-
- @Override
- protected void onPreExecute() {
- mErrorLabel.setVisibility(View.INVISIBLE);
- progress = ProgressFragment.newInstance();
- progress.show(getFragmentManager(), "progressFragment");
- }
-
- @Override
- protected void onPostExecute(Boolean result) {
- if (result) {
- onAccountConnectionSuccess(jid, password);
- } else {
- onAccountConnectionFailed();
- }
- ProgressFragment pf = (ProgressFragment) getFragmentManager().findFragmentByTag("progressFragment");
- if (pf != null)
- pf.dismiss();
- }
-
- @Override
- protected Boolean doInBackground(String... params) {
- Log.d(TAG, "Xmpp login task");
- jid = params[0];
- password = params[1];
-
- int port = -1;
- if (params.length > 2) {
- server = params[2];
- }
- if (params.length > 3) {
- if (!TextUtils.isEmpty(params[3])) {
- port = Integer.parseInt(params[3]);
- }
- }
- Log.d(TAG, "jid " + jid + " server " + server + " port " + port);
- String login = StringUtils.parseName(jid);
- String serviceName = StringUtils.parseServer(jid);
- Connection connection = prepareConnection(jid, server, port);
- if (settings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false)
- || "gmail.com".equals(serviceName)
- || "googlemail.com".equals(serviceName)) {
- login = jid;
- }
- try {
- connection.connect();
- connection.login(login, password);
- } catch (XMPPException e) {
- Log.e(TAG, "Unable to connect to Xmpp server", e);
- exception = e;
- return false;
- } finally {
- connection.disconnect();
- }
- return true;
- }
-
- /**
- * Initialize the XMPP connection.
- *
- * @param jid the jid to use
- * @param server the server to use (not using dns srv) may be null
- * @param port the port
- *
- * @return the XMPPConnection prepared to connect
- */
- private Connection prepareConnection(String jid, String server, int port) {
- boolean useProxy = settings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
- ProxyInfo proxyinfo = ProxyInfo.forNoProxy();
- if (useProxy) {
- String stype = settings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
- String phost = settings.getString(BeemApplication.PROXY_SERVER_KEY, "");
- String puser = settings.getString(BeemApplication.PROXY_USERNAME_KEY, "");
- String ppass = settings.getString(BeemApplication.PROXY_PASSWORD_KEY, "");
- int pport = Integer.parseInt(settings.getString(BeemApplication.PROXY_PORT_KEY, "1080"));
- ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
- proxyinfo = new ProxyInfo(type, phost, pport, puser, ppass);
- }
- String serviceName = StringUtils.parseServer(jid);
- if (port != -1 || !TextUtils.isEmpty(server)) {
- if (port == -1)
- port = 5222;
- if (TextUtils.isEmpty(server))
- server = serviceName;
- config = new ConnectionConfiguration(server, port, serviceName, proxyinfo);
- } else {
- config = new ConnectionConfiguration(serviceName, proxyinfo);
- }
- if (settings.getBoolean(BeemApplication.SMACK_DEBUG_KEY, false))
- config.setDebuggerEnabled(true);
- config.setSendPresence(false);
- config.setRosterLoadedAtLogin(false);
- return new XMPPConnection(config);
- }
- }
-
- /**
- * A progress Fragment.
- */
- public static class ProgressFragment extends DialogFragment {
-
- /**
- * Create a new ProgressFragment.
- *
- * @return a ProgressFragment
- */
- public static ProgressFragment newInstance() {
- return new ProgressFragment();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setCancelable(false);
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- Log.d(TAG, "create progress dialog");
- ProgressDialog p = new ProgressDialog(getActivity());
- p.setTitle(getString(R.string.login_login_progress));
- p.setMessage(getString(R.string.create_account_progress_message));
- return p;
- }
- }
-}
--- a/src/com/beem/project/beem/ui/wizard/CreateAccountFragment.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,399 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009-2012 by Frederic-Charles Barthelery,
- Nikita Kozlov,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://www.beem-project.com/
-
-*/
-package com.beem.project.beem.ui.wizard;
-
-import java.util.regex.Pattern;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.support.v4.app.DialogFragment;
-import android.support.v4.app.Fragment;
-import android.text.Editable;
-import android.text.TextUtils;
-import android.text.TextWatcher;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.AutoCompleteTextView;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import com.beem.project.beem.BeemApplication;
-import com.beem.project.beem.R;
-import com.beem.project.beem.ui.Login;
-
-import org.jivesoftware.smack.AccountManager;
-import org.jivesoftware.smack.Connection;
-import org.jivesoftware.smack.ConnectionConfiguration;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.packet.XMPPError;
-import org.jivesoftware.smack.proxy.ProxyInfo;
-import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
-import org.jivesoftware.smack.util.StringUtils;
-
-
-/**
- * Fragment used to create an account on an XMPP server.
- */
-public class CreateAccountFragment extends Fragment implements android.view.View.OnClickListener {
- private static final String TAG = CreateAccountFragment.class.getSimpleName();
- private EditText username;
- private EditText password;
- private EditText confirmPassword;
- private TextView errorText;
- private TextView mSettingsWarningLabel;
- private AutoCompleteTextView serverEdit;
- private Button createButton;
- private CreateAccountTask task;
- private final NotEmptyTextWatcher mTextWatcher = new NotEmptyTextWatcher();
- private SharedPreferences settings;
-
- /**
- * Create a CreateAccountFragment.
- *
- */
- public CreateAccountFragment() {
- }
-
- /**
- * Create a CreateAccountFragment.
- * @return a new CreateAccountFragment
- */
- public static CreateAccountFragment newInstance() {
- return new CreateAccountFragment();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setRetainInstance(true);
- settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
-
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View v = inflater.inflate(R.layout.create_account, container, false);
- username = (EditText) v.findViewById(R.id.create_account_username);
- username.addTextChangedListener(mTextWatcher);
- password = (EditText) v.findViewById(R.id.create_account_password);
- password.addTextChangedListener(mTextWatcher);
- confirmPassword = (EditText) v.findViewById(R.id.create_account_confirm_password);
- confirmPassword.addTextChangedListener(mTextWatcher);
- errorText = (TextView) v.findViewById(R.id.error_label);
- mSettingsWarningLabel = (TextView) v.findViewById(R.id.settings_warn_label);
- createButton = (Button) v.findViewById(R.id.next);
- createButton.setOnClickListener(this);
- serverEdit = (AutoCompleteTextView) v.findViewById(R.id.xmpp_server);
- ArrayAdapter<CharSequence> completeAdapter = ArrayAdapter.createFromResource(
- getActivity(), R.array.xmpp_server_list, R.layout.simple_combobox_item);
-
- serverEdit.setAdapter(completeAdapter);
- serverEdit.addTextChangedListener(mTextWatcher);
- // show the list on second click on the text view
- serverEdit.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- serverEdit.showDropDown();
- }
- });
- return v;
- }
-
- @Override
- public void onStart() {
- super.onStart();
- if (settings.getBoolean(BeemApplication.PROXY_USE_KEY, false)) {
- mSettingsWarningLabel.setVisibility(View.VISIBLE);
- } else
- mSettingsWarningLabel.setVisibility(View.GONE);
- }
-
- @Override
- public void onClick(View v) {
- if (v == createButton) {
- boolean create = true;
- if (!checkUserName()) {
- username.setError(getString(R.string.create_account_err_username));
- create = false;
- }
- if (TextUtils.isEmpty(serverEdit.getText())) {
- serverEdit.setError("Choose a server");
- create = false;
- }
- if (!checkPasswords()) {
- password.setError(getString(R.string.create_account_err_passwords));
- confirmPassword.setError(getString(R.string.create_account_err_passwords));
- create = false;
- }
- if (create) {
- String jid = String.format("%s@%s", username.getText(), serverEdit.getText());
- jid = StringUtils.parseBareAddress(jid);
- String pass = password.getText().toString();
- task = new CreateAccountTask();
- task.execute(jid, pass);
- }
- }
- }
-
- /**
- * Save the user credentials.
- *
- * @param jid the jid of the user
- * @param pass the password of the user
- *
- */
- private void saveCredential(String jid, String pass) {
- SharedPreferences.Editor edit = settings.edit();
- edit.putString(BeemApplication.ACCOUNT_USERNAME_KEY, jid);
- edit.putString(BeemApplication.ACCOUNT_PASSWORD_KEY, pass);
- edit.commit();
- }
-
- /**
- * Callback called when the account is successfully created.
- *
- * @param jid the jid of the account.
- * @param pass the password of the account.
- *
- */
- private void onAccountCreationSuccess(String jid, String pass) {
- Activity a = getActivity();
- saveCredential(jid, pass);
- // launch login
- Intent i = new Intent(a, Login.class);
- i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(i);
- a.finish();
- }
-
- /**
- * Callback called when the account failed to create.
- *
- * @param e the exception which occurs
- *
- */
- private void onAccountCreationFailed(XMPPException e) {
- XMPPError error = e.getXMPPError();
- if (error != null && XMPPError.Condition.conflict.equals(error.getCondition()))
- errorText.setText(R.string.create_account_err_conflict);
- else
- errorText.setText(R.string.create_account_err_connection);
- Log.v(TAG, "Unable to create an account on xmpp server", e);
- }
-
- /**
- * Check the format of the email.
- *
- * @return true if the email is valid.
- */
- private boolean checkUserName() {
- String email = username.getText().toString();
- return Pattern.matches("[a-zA-Z0-9._%+-]+", email);
- }
-
- /**
- * Check if the fields password and confirm password match.
- *
- * @return return true if password & confirm password fields match, else
- * false
- */
- private boolean checkPasswords() {
- CharSequence pass = password.getText();
- return !TextUtils.isEmpty(pass) && TextUtils.equals(pass, confirmPassword.getText());
- }
-
- /**
- * AsyncTask use to create an XMPP account on a server.
- */
- private class CreateAccountTask extends AsyncTask<String, Void, Boolean> {
-
- private ProgressFragment progress;
- private ConnectionConfiguration config;
- private XMPPException exception;
- private String jid;
- private String password;
- private String server;
-
- @Override
- protected void onPreExecute() {
- progress = ProgressFragment.newInstance();
- progress.show(getFragmentManager(), "progressFragment");
- }
-
- @Override
- protected void onPostExecute(Boolean result) {
- if (result) {
- onAccountCreationSuccess(jid, password);
- } else {
- onAccountCreationFailed(exception);
- }
- ProgressFragment pf = (ProgressFragment) getFragmentManager().findFragmentByTag("progressFragment");
- if (pf != null)
- pf.dismiss();
- }
-
- @Override
- protected Boolean doInBackground(String... params) {
- Log.d(TAG, "Xmpp login task");
- jid = params[0];
- password = params[1];
- Log.d(TAG, "jid " + jid + " server " + server);
-
- int port = -1;
- if (params.length > 2) {
- server = params[2];
- }
- if (params.length > 3) {
- if (!TextUtils.isEmpty(params[3])) {
- port = Integer.parseInt(params[3]);
- }
- }
- Connection connection = prepareConnection(jid, server, port);
- try {
- connection.connect();
- AccountManager accountManager = new AccountManager(connection);
- accountManager.createAccount(StringUtils.parseName(jid), password);
- } catch (XMPPException e) {
- Log.e(TAG, "Unable to create account", e);
- exception = e;
- return false;
- } finally {
- connection.disconnect();
- }
- return true;
- }
-
- /**
- * Initialize the XMPP connection.
- *
- * @param jid the jid to use
- * @param server the server to use (not using dns srv) may be null
- * @param port the port
- *
- * @return the XMPPConnection prepared to connect
- */
- private Connection prepareConnection(String jid, String server, int port) {
- boolean useProxy = settings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
- ProxyInfo proxyinfo = ProxyInfo.forNoProxy();
- if (useProxy) {
- String stype = settings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
- String phost = settings.getString(BeemApplication.PROXY_SERVER_KEY, "");
- String puser = settings.getString(BeemApplication.PROXY_USERNAME_KEY, "");
- String ppass = settings.getString(BeemApplication.PROXY_PASSWORD_KEY, "");
- int pport = Integer.parseInt(settings.getString(BeemApplication.PROXY_PORT_KEY, "1080"));
- ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
- proxyinfo = new ProxyInfo(type, phost, pport, puser, ppass);
- }
- String serviceName = StringUtils.parseServer(jid);
- if (port != -1 || !TextUtils.isEmpty(server)) {
- if (port == -1)
- port = 5222;
- if (TextUtils.isEmpty(server))
- server = serviceName;
- config = new ConnectionConfiguration(server, port, serviceName, proxyinfo);
- } else {
- config = new ConnectionConfiguration(serviceName, proxyinfo);
- }
- if (settings.getBoolean(BeemApplication.SMACK_DEBUG_KEY, false))
- config.setDebuggerEnabled(true);
- return new XMPPConnection(config);
- }
- }
-
- /**
- * A progress Fragment.
- */
- public static class ProgressFragment extends DialogFragment {
-
- /**
- * Create a new ProgressFragment.
- *
- * @return a ProgressFragment
- */
- public static ProgressFragment newInstance() {
- return new ProgressFragment();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setCancelable(false);
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- Log.d(TAG, "create progress dialog");
- ProgressDialog p = new ProgressDialog(getActivity());
- p.setTitle(getString(R.string.create_account_progress_title));
- p.setMessage(getString(R.string.create_account_progress_message));
- return p;
- }
- }
-
- /**
- * Text watcher to test if all fields are field.
- */
- private class NotEmptyTextWatcher implements TextWatcher {
-
- /**
- * Constructor.
- */
- public NotEmptyTextWatcher() {
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- boolean enable = !(TextUtils.isEmpty(username.getText())
- || TextUtils.isEmpty(serverEdit.getText())
- || TextUtils.isEmpty(password.getText())
- || TextUtils.isEmpty(confirmPassword.getText()));
- createButton.setEnabled(enable);
- }
-
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- }
-
-}
--- a/src/com/beem/project/beem/ui/wizard/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-
-/**
- * This package contains some configuration wizards.
- */
-package com.beem.project.beem.ui.wizard;
-
--- a/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.utils;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.widget.Toast;
-
-import com.beem.project.beem.BeemService;
-import com.beem.project.beem.R;
-
-/**
- * Manage broadcast disconnect intent.
- * @author nikita
- */
-public class BeemBroadcastReceiver extends BroadcastReceiver {
-
- /** Broadcast intent type. */
- public static final String BEEM_CONNECTION_CLOSED = "BeemConnectionClosed";
-
- /**
- * constructor.
- */
- public BeemBroadcastReceiver() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onReceive(final Context context, final Intent intent) {
- String intentAction = intent.getAction();
- if (intentAction.equals(BEEM_CONNECTION_CLOSED)) {
- CharSequence message = intent.getCharSequenceExtra("message");
- Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
- if (context instanceof Activity) {
- Activity act = (Activity) context;
- act.finish();
- // The service will be unbinded in the destroy of the activity.
- }
- } else if (intentAction.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
- if (intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false)) {
- Toast.makeText(context, context.getString(R.string.BeemBroadcastReceiverDisconnect),
- Toast.LENGTH_SHORT).show();
- context.stopService(new Intent(context, BeemService.class));
- }
- }
- }
-}
--- a/src/com/beem/project/beem/utils/BeemConnectivity.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.utils;
-
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.net.NetworkInfo.DetailedState;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
-import android.telephony.TelephonyManager;
-
-/**
- * The Class BeemConnectivity.
- */
-public final class BeemConnectivity {
-
- /**
- * Private constructor to forbid instantiation.
- */
- private BeemConnectivity() { }
-
- /**
- * Checks if is connected.
- * @param ctx the ctx
- * @return true, if is connected
- */
- public static boolean isConnected(final Context ctx) {
- ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(
- Context.CONNECTIVITY_SERVICE);
- NetworkInfo ni = cm.getActiveNetworkInfo();
- return ni != null && ni.isConnected();
- }
-
- /**
- * Checks if is wifi.
- * @param ctx the ctx
- * @return true, if is wifi
- */
- public static boolean isWifi(final Context ctx) {
- WifiManager wm = (WifiManager) ctx.getSystemService(
- Context.WIFI_SERVICE);
- WifiInfo wi = wm.getConnectionInfo();
- if (wi != null
- && (WifiInfo.getDetailedStateOf(wi.getSupplicantState())
- == DetailedState.OBTAINING_IPADDR
- || WifiInfo.getDetailedStateOf(wi.getSupplicantState())
- == DetailedState.CONNECTED)) {
- return false;
- }
- return false;
- }
-
- /**
- * Checks if is umts.
- * @param ctx the ctx
- * @return true, if is umts
- */
- public static boolean isUmts(final Context ctx) {
- TelephonyManager tm = (TelephonyManager) ctx.getSystemService(
- Context.TELEPHONY_SERVICE);
- return tm.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UMTS;
- }
-
- /**
- * Checks if is edge.
- * @param ctx the ctx
- * @return true, if is edge
- */
- public static boolean isEdge(final Context ctx) {
- TelephonyManager tm = (TelephonyManager) ctx.getSystemService(
- Context.TELEPHONY_SERVICE);
- return tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_EDGE;
- }
-
-}
--- a/src/com/beem/project/beem/utils/FreePort.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.utils;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-
-/**
- * Utility class to get a free port.
- * @author nikita
- */
-public final class FreePort {
-
- private static final int MAGIC_10 = 10;
- private static final int MAGIC_10000 = 10000;
-
- /**
- * Private default constructor.
- */
- private FreePort() {
- }
-
- /**
- * return a free port.
- * @return free socket port.
- */
- public static int getFreePort() {
- ServerSocket ss;
- int freePort = 0;
-
- for (int i = 0; i < MAGIC_10; i++) {
- freePort = (int) (MAGIC_10000 + Math.round(Math.random() * MAGIC_10000));
- try {
- ss = new ServerSocket(freePort);
- freePort = ss.getLocalPort();
- ss.close();
- return freePort;
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- try {
- ss = new ServerSocket(0);
- freePort = ss.getLocalPort();
- ss.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return freePort;
- }
-}
--- a/src/com/beem/project/beem/utils/PresenceType.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.utils;
-
-import org.jivesoftware.smack.packet.Presence;
-
-/**
- * Utility class to deal with Presence type.
- * @author nikita
- */
-public final class PresenceType {
-
- /** The user is available to receive messages (default). */
- public static final int AVAILABLE = 100;
-
- /** The user is unavailable to receive messages. */
- public static final int UNAVAILABLE = 200;
-
- /** Request subscription to recipient's presence. */
-
- public static final int SUBSCRIBE = 300;
-
- /** Grant subscription to sender's presence. */
- public static final int SUBSCRIBED = 400;
-
- /** Request removal of subscription to sender's presence. */
- public static final int UNSUBSCRIBE = 500;
-
- /** Grant removal of subscription to sender's presence. */
- public static final int UNSUBSCRIBED = 600;
-
- /** The presence packet contains an error message. */
- public static final int ERROR = 701;
-
- /**
- * Private default constructor.
- */
- private PresenceType() {
- }
-
- /**
- * Get the presence type from a presence packet.
- * @param presence the presence type
- * @return an int representing the presence type
- */
- public static int getPresenceType(final Presence presence) {
- int res = PresenceType.ERROR;
- switch (presence.getType()) {
- case available:
- res = PresenceType.AVAILABLE;
- break;
- case unavailable:
- res = PresenceType.UNAVAILABLE;
- break;
- case subscribe:
- res = PresenceType.SUBSCRIBE;
- break;
- case subscribed:
- res = PresenceType.SUBSCRIBED;
- break;
- case unsubscribe:
- res = PresenceType.UNSUBSCRIBE;
- break;
- case unsubscribed:
- res = PresenceType.UNSUBSCRIBED;
- break;
- case error:
- default:
- res = PresenceType.ERROR;
- }
- return res;
- }
-
- /**
- * Get the smack presence mode for a status.
- * @param type the status type in beem
- * @return the presence mode to use in presence packet or null if there is no mode to use
- */
- public static Presence.Type getPresenceTypeFrom(final int type) {
- Presence.Type res;
- switch (type) {
- case AVAILABLE:
- res = Presence.Type.available;
- break;
- case UNAVAILABLE:
- res = Presence.Type.unavailable;
- break;
- case SUBSCRIBE:
- res = Presence.Type.subscribe;
- break;
- case SUBSCRIBED:
- res = Presence.Type.subscribed;
- break;
- case UNSUBSCRIBE:
- res = Presence.Type.unsubscribe;
- break;
- case UNSUBSCRIBED:
- res = Presence.Type.unsubscribed;
- break;
- case ERROR:
- res = Presence.Type.error;
- break;
- default:
- return null;
- }
- return res;
- }
-}
--- a/src/com/beem/project/beem/utils/SortedList.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,312 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
-*/
-package com.beem.project.beem.utils;
-
-import java.util.List;
-import java.util.Comparator;
-import java.util.ListIterator;
-import java.util.Iterator;
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * This class add a sort by insertion to a List.
- * All methods which allow you to insert an object at a specific index
- * will throw an UnsupportedOperationException.
- *
- * @author Da Risk <da_risk@beem-project.com>
- * @param <E> the type of elements maintained by this list
- */
-public class SortedList<E> implements List<E> {
-
- private final List<E> mBackend;
- private final Comparator<? super E> mComparator;
-
- /**
- * Create a SortedList. The existing elements will be sorted.
- *
- * @param list list to sort
- * @param mComparator mComparator to use.
- */
- public SortedList(final List<E> list, final Comparator<? super E> mComparator) {
- this.mComparator = mComparator;
- this.mBackend = list;
- Collections.sort(mBackend, mComparator);
- }
-
- @Override
- public int size() {
- return mBackend.size();
- }
-
- @Override
- public boolean isEmpty() {
- return mBackend.isEmpty();
- }
-
- @Override
- public boolean contains(Object o) {
- return mBackend.contains(o);
- }
-
- @Override
- public Iterator<E> iterator() {
- return new SortedListIterator<E>(mBackend.listIterator());
- }
-
- @Override
- public Object[] toArray() {
- return mBackend.toArray();
- }
-
- @Override
- public <T> T[] toArray(T[] a) {
- return mBackend.toArray(a);
- }
-
- @Override
- public boolean add(E e) {
- for (ListIterator<E> it = mBackend.listIterator(); it.hasNext();) {
- if (mComparator.compare(e, it.next()) < 0) {
- if (it.hasPrevious()) {
- it.previous();
- }
- it.add(e);
- return true;
- }
- }
- mBackend.add(e);
- return true;
- }
-
- @Override
- public boolean remove(Object o) {
- return mBackend.remove(o);
- }
-
- @Override
- public boolean containsAll(Collection<?> c) {
- return mBackend.containsAll(c);
- }
-
- @Override
- public boolean addAll(Collection<? extends E> c) {
- boolean result = false;
- for (E e : c) {
- boolean t = add(e);
- if (t) {
- result = t;
- }
- }
- return result;
- }
-
- /**
- * Add all the elements in the specified collection.
- * The index param is ignored.
- *
- * @param index ignored
- * @param c collection containing elements to be added to this list
- * @return true if this list changed as a result of the call
- */
- @Override
- public boolean addAll(int index, Collection<? extends E> c) {
- return addAll(c);
- }
-
- /**
- * Add all the elements in the specified collection.
- * The index param is ignored.
- *
- * @param l collection containing elements to be added to this list
- * @return true if this list changed as a result of the call
- * @see addAll(Collection)
- */
- public boolean addAll(SortedList<? extends E> l) {
- if (!l.isEmpty()) {
- if (mBackend.isEmpty()) {
- return mBackend.addAll(l);
- }
- boolean result = false;
- E myfirst = mBackend.get(0);
- E last = l.get(l.size() - 1);
- E mylast = mBackend.get(mBackend.size() - 1);
- E first = l.get(0);
- if (mComparator.compare(last, myfirst) < 0) {
- result = mBackend.addAll(0, l);
- } else if (mComparator.compare(first, mylast) > 0) {
- result = mBackend.addAll(l);
- } else {
- Collection<? extends E> c = l;
- result = addAll(c);
- }
- return result;
- }
- return false;
- }
-
- @Override
- public boolean removeAll(Collection<?> c) {
- return mBackend.removeAll(c);
- }
-
- @Override
- public boolean retainAll(Collection<?> c) {
- return mBackend.retainAll(c);
- }
-
- @Override
- public void clear() {
- mBackend.clear();
- }
-
- @Override
- public boolean equals(Object o) {
- return mBackend.equals(o);
- }
-
- @Override
- public int hashCode() {
- return mBackend.hashCode();
- }
-
- @Override
- public E get(int index) {
- return mBackend.get(index);
- }
-
- @Override
- public E set(int index, E element) {
- throw new UnsupportedOperationException("set() is not supported in SortedList");
- }
-
- @Override
- public void add(int index, E element) {
- throw new UnsupportedOperationException("add at specific index is not supported in SortedList");
- }
-
- @Override
- public E remove(int index) {
- return mBackend.remove(index);
- }
-
- @Override
- public int indexOf(Object o) {
- return mBackend.indexOf(o);
- }
-
- @Override
- public int lastIndexOf(Object o) {
- return mBackend.lastIndexOf(o);
- }
-
- @Override
- public ListIterator<E> listIterator() {
- return new SortedListIterator<E>(mBackend.listIterator());
- }
-
- @Override
- public ListIterator<E> listIterator(int index) {
- return new SortedListIterator<E>(mBackend.listIterator(index));
- }
-
- @Override
- public List<E> subList(int fromIndex, int toIndex) {
- return mBackend.subList(fromIndex, toIndex);
- }
-
- @Override
- public String toString() {
- return mBackend.toString();
- }
-
- /**
- * A SortedList.iterator don't allow list modification.
- * It use the mBackend iterator for the other operations.
- */
- private class SortedListIterator<E> implements ListIterator<E> {
-
- private ListIterator<E> mIt;
-
- /**
- * Construct SortedList.Iterator.
- *
- * @param iterator the iterator of the backend list
- */
- SortedListIterator(final ListIterator<E> iterator) {
- mIt = iterator;
- }
-
- @Override
- public void add(E e) {
- throw new UnsupportedOperationException("add() not supported in SortedList iterator");
- }
-
- @Override
- public boolean hasNext() {
- return mIt.hasNext();
- }
-
- @Override
- public E next() {
- return mIt.next();
- }
-
- @Override
- public boolean hasPrevious() {
- return mIt.hasPrevious();
- }
-
- @Override
- public E previous() {
- return mIt.previous();
- }
-
- @Override
- public int nextIndex() {
- return mIt.nextIndex();
- }
-
- @Override
- public int previousIndex() {
- return mIt.previousIndex();
- }
-
- @Override
- public void remove() {
- mIt.remove();
- }
-
- @Override
- public void set(E e) {
- throw new UnsupportedOperationException("set () not supported in SortedList iterator");
- }
- }
-}
--- a/src/com/beem/project/beem/utils/Status.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-package com.beem.project.beem.utils;
-
-import com.beem.project.beem.R;
-
-import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.packet.Presence.Mode;
-
-/**
- * Utility class to deal with status and presence value.
- * @author marseille
- */
-public final class Status {
-
- /** Status of a disconnected contact. */
- public static final int CONTACT_STATUS_DISCONNECT = 100;
-
- /** Status of a unavailable (long away) contact. */
- public static final int CONTACT_STATUS_UNAVAILABLE = 200;
-
- /** Status of a away contact. */
- public static final int CONTACT_STATUS_AWAY = 300;
-
- /** Status of a busy contact. */
- public static final int CONTACT_STATUS_BUSY = 400;
-
- /** Status of a available contact. */
- public static final int CONTACT_STATUS_AVAILABLE = 500;
-
- /** Status of a available for chat contact. */
- public static final int CONTACT_STATUS_AVAILABLE_FOR_CHAT = 600;
-
- /**
- * Default constructor masked.
- */
- private Status() {
- }
-
- /**
- * Get the smack presence mode for a status.
- * @param status the status in beem
- * @return the presence mode to use in presence packet or null if there is no mode to use
- */
- public static Presence.Mode getPresenceModeFromStatus(final int status) {
- Presence.Mode res;
- switch (status) {
- case CONTACT_STATUS_AVAILABLE:
- res = Presence.Mode.available;
- break;
- case CONTACT_STATUS_AVAILABLE_FOR_CHAT:
- res = Presence.Mode.chat;
- break;
- case CONTACT_STATUS_AWAY:
- res = Presence.Mode.away;
- break;
- case CONTACT_STATUS_BUSY:
- res = Presence.Mode.dnd;
- break;
- case CONTACT_STATUS_UNAVAILABLE:
- res = Presence.Mode.xa;
- break;
- default:
- return null;
- }
- return res;
- }
-
- /**
- * Get the status of from a presence packet.
- * @param presence the presence containing status
- * @return an int representing the status
- */
- public static int getStatusFromPresence(final Presence presence) {
- int res = Status.CONTACT_STATUS_DISCONNECT;
- if (presence.getType().equals(Presence.Type.unavailable)) {
- res = Status.CONTACT_STATUS_DISCONNECT;
- } else {
- Mode mode = presence.getMode();
- if (mode == null) {
- res = Status.CONTACT_STATUS_AVAILABLE;
- } else {
- switch (mode) {
- case available:
- res = Status.CONTACT_STATUS_AVAILABLE;
- break;
- case away:
- res = Status.CONTACT_STATUS_AWAY;
- break;
- case chat:
- res = Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
- break;
- case dnd:
- res = Status.CONTACT_STATUS_BUSY;
- break;
- case xa:
- res = Status.CONTACT_STATUS_UNAVAILABLE;
- break;
- default:
- res = Status.CONTACT_STATUS_DISCONNECT;
- break;
- }
- }
- }
- return res;
- }
-
- /**
- * Check if contact is online by his status.
- * @param status contact status
- * @return is online
- */
- public static boolean statusOnline(final int status) {
- return status != Status.CONTACT_STATUS_DISCONNECT;
- }
-
- /**
- * Get icon resource from status.
- * @param status the status
- * @return the resource icon
- */
- public static int getIconBarFromStatus(final int status) {
- int icon = R.drawable.beem_status_icon;
- switch (status) {
- case Status.CONTACT_STATUS_AVAILABLE:
- icon = R.drawable.beem_status_icon_available;
- break;
- case Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
- icon = R.drawable.beem_status_icon_available;
- break;
- case Status.CONTACT_STATUS_AWAY:
- icon = R.drawable.beem_status_icon_away;
- break;
- case Status.CONTACT_STATUS_BUSY:
- icon = R.drawable.beem_status_icon_busy;
- break;
- case Status.CONTACT_STATUS_UNAVAILABLE:
- icon = R.drawable.beem_status_icon_gray;
- break;
- default:
- icon = R.drawable.beem_status_icon;
- }
- return icon;
- }
-}
--- a/src/com/beem/project/beem/utils/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- BEEM is a videoconference application on the Android Platform.
-
- Copyright (C) 2009 by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- This file is part of BEEM.
-
- BEEM is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BEEM is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BEEM. If not, see <http://www.gnu.org/licenses/>.
-
- Please send bug reports with examples or suggestions to
- contact@beem-project.com or http://dev.beem-project.com/
-
- Epitech, hereby disclaims all copyright interest in the program "Beem"
- written by Frederic-Charles Barthelery,
- Jean-Manuel Da Silva,
- Nikita Kozlov,
- Philippe Lago,
- Jean Baptiste Vergely,
- Vincent Veronis.
-
- Nicolas Sadirac, November 26, 2009
- President of Epitech.
-
- Flavien Astraud, November 26, 2009
- Head of the EIP Laboratory.
-
-*/
-/**
- * This package contains utility class to deal with various aspect of BEEM.
- */
-package com.beem.project.beem.utils;
-
--- a/src/com/google/android/apps/iosched/util/LogUtils.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.apps.iosched.util;
-
-import com.beem.project.beem.BuildConfig;
-
-import android.util.Log;
-
-/**
- * Helper methods that make logging more consistent throughout the app.
- */
-public class LogUtils {
- private static final String LOG_PREFIX = "Beem";
- private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
- private static final int MAX_LOG_TAG_LENGTH = 23;
-
- public static String makeLogTag(String str) {
- if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
- return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
- }
-
- return LOG_PREFIX + str;
- }
-
- /**
- * WARNING: Don't use this when obfuscating class names with Proguard!
- */
- public static String makeLogTag(Class cls) {
- return makeLogTag(cls.getSimpleName());
- }
-
- public static void LOGD(final String tag, String message) {
- if (Log.isLoggable(tag, Log.DEBUG)) {
- Log.d(tag, message);
- }
- }
-
- public static void LOGD(final String tag, String message, Throwable cause) {
- if (Log.isLoggable(tag, Log.DEBUG)) {
- Log.d(tag, message, cause);
- }
- }
-
- public static void LOGV(final String tag, String message) {
- //noinspection PointlessBooleanExpression,ConstantConditions
- if (BuildConfig.DEBUG && Log.isLoggable(tag, Log.VERBOSE)) {
- Log.v(tag, message);
- }
- }
-
- public static void LOGV(final String tag, String message, Throwable cause) {
- //noinspection PointlessBooleanExpression,ConstantConditions
- if (BuildConfig.DEBUG && Log.isLoggable(tag, Log.VERBOSE)) {
- Log.v(tag, message, cause);
- }
- }
-
- public static void LOGI(final String tag, String message) {
- Log.i(tag, message);
- }
-
- public static void LOGI(final String tag, String message, Throwable cause) {
- Log.i(tag, message, cause);
- }
-
- public static void LOGW(final String tag, String message) {
- Log.w(tag, message);
- }
-
- public static void LOGW(final String tag, String message, Throwable cause) {
- Log.w(tag, message, cause);
- }
-
- public static void LOGE(final String tag, String message) {
- Log.e(tag, message);
- }
-
- public static void LOGE(final String tag, String message, Throwable cause) {
- Log.e(tag, message, cause);
- }
-
- private LogUtils() {
- }
-}
--- a/src/com/isode/stroke/base/ByteArray.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2010 Remko Tronçon
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
- */
-/*
- * Copyright (c) 2010, Isode Limited, London, England.
- * All rights reserved.
- */
-package com.isode.stroke.base;
-
-import java.io.UnsupportedEncodingException;
-
-/**
- *
- */
-public class ByteArray {
-
- public ByteArray() {
- }
-
- public ByteArray(String s) {
- try {
- fromBytes(s.getBytes("UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- throw new IllegalStateException("JVM has no 'UTF-8' encoding");
- }
- }
-
- public ByteArray(byte[] c) {
- fromBytes(c);
- }
-
- public ByteArray(ByteArray b) {
- fromBytes(b.getData());
- }
-
- private void fromBytes(final byte[] b) {
- data_ = new byte[b.length];
- System.arraycopy(b, 0, data_, 0, b.length);
- }
-
- /*public ByteArray(char[] c, int n) {
- for (int i = 0; i < n; i++) {
- append(c[i]);
- }
- }*/
-
- /**
- * These are the raw, modifyable data!
- * @return
- */
- public byte[] getData() {
- return data_;
- }
-
- public int getSize() {
- return data_.length;
- }
-
- public boolean isEmpty() {
- return getSize() == 0;
- }
-
- /*public void resize(size_t size) {
- return data_.resize(size);
- }*/
- /** Immutable add */
- public static ByteArray plus(ByteArray a, ByteArray b) {
- ByteArray x = new ByteArray(a.getData());
- x.append(b);
- return x;
- }
-
- /** Immutable add */
- /*public ByteArray plus(ByteArray a, char b) {
- ByteArray x = new ByteArray(a.getData());
- x.append(b);
- return x;
- }*/
-
- /** Mutable add */
- public ByteArray append(ByteArray b) {
- append(b.getData());
- return this;
- }
-
- /** Mutable add */
- private ByteArray append(byte[] b) {
- int newLength = data_.length + b.length;
- byte[] newData = new byte[newLength];
- for (int i = 0; i < data_.length; i++) {
- newData[i] = data_[i];
- }
- for (int i = 0; i < b.length; i++) {
- newData[i + data_.length] = b[i];
- }
- data_ = newData;
- return this;
- }
-
- /** Mutable add */
- public ByteArray append(byte b) {
- byte[] bytes = {b};
- append(bytes);
- return this;
- }
-
- /** mutable add */
- public ByteArray append(String s) {
- byte[] bytes;
- try {
- bytes = s.getBytes("UTF-8");
- } catch (UnsupportedEncodingException ex) {
- throw new IllegalStateException("JVM has no 'UTF-8' encoding");
- }
- append(bytes);
- return this;
- }
-
- @Override
- public int hashCode() {
- int hash = 3;
- hash = 97 * hash + (this.data_ != null ? this.data_.hashCode() : 0);
- return hash;
- }
-
- @Override
- public boolean equals(Object other) {
- return other instanceof ByteArray && toString().equals(other.toString());
- }
-
- /*public char charAt(int i) {
- return data_.charAt(i);
- }*/
-
- /*public const_iterator begin() const {
- return data_.begin();
- }
-
- public const_iterator end() const {
- return data_.end();
- }*/
- @Override
- public String toString() {
- try {
- return new String(data_, "UTF-8");
- } catch (UnsupportedEncodingException ex) {
- throw new IllegalStateException("JVM has no 'UTF-8' encoding");
- }
- }
-
- public void readFromFile(String file) {
- //FIXME: port
- }
-
- public void clear() {
- data_ = new byte[]{};
- }
- private byte[] data_ = {};
-
-}
--- a/src/com/isode/stroke/sasl/ClientAuthenticator.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2010, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2010, Remko Tronçon.
- * All rights reserved.
- */
-package com.isode.stroke.sasl;
-
-import com.isode.stroke.base.ByteArray;
-
-public abstract class ClientAuthenticator {
-
- public ClientAuthenticator(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setCredentials(String authcid, String password) {
- setCredentials(authcid, password, "");
- }
-
- public void setCredentials(String authcid, String password, String authzid) {
- this.authcid = authcid;
- this.password = password;
- this.authzid = authzid;
- }
-
- public abstract ByteArray getResponse();
-
- public abstract boolean setChallenge(ByteArray challenge);
-
- public String getAuthenticationID() {
- return authcid;
- }
-
- public String getAuthorizationID() {
- return authzid;
- }
-
- public String getPassword() {
- return password;
- }
- private String name;
- private String authcid;
- private String password;
- private String authzid;
-}
--- a/src/com/isode/stroke/sasl/SCRAMSHA1ClientAuthenticator.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2010, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2010, Remko Tronçon.
- * All rights reserved.
- */
-package com.isode.stroke.sasl;
-
-import com.isode.stroke.base.ByteArray;
-import com.isode.stroke.stringcodecs.Base64;
-import com.isode.stroke.stringcodecs.HMACSHA1;
-import com.isode.stroke.stringcodecs.PBKDF2;
-import com.isode.stroke.stringcodecs.SHA1;
-import java.text.Normalizer;
-import java.text.Normalizer.Form;
-import java.util.HashMap;
-import java.util.Map;
-
-public class SCRAMSHA1ClientAuthenticator extends ClientAuthenticator {
-
- static String escape(String s) {
- String result = "";
- for (int i = 0; i < s.length(); ++i) {
- if (s.charAt(i) == ',') {
- result += "=2C";
- } else if (s.charAt(i) == '=') {
- result += "=3D";
- } else {
- result += s.charAt(i);
- }
- }
- return result;
- }
-
- public SCRAMSHA1ClientAuthenticator(String nonce) {
- this(nonce, false);
- }
- public SCRAMSHA1ClientAuthenticator(String nonce, boolean useChannelBinding) {
- super(useChannelBinding ? "SCRAM-SHA-1-PLUS" : "SCRAM-SHA-1");
- step = Step.Initial;
- clientnonce = nonce;
- this.useChannelBinding = useChannelBinding;
- }
-
- public void setTLSChannelBindingData(ByteArray channelBindingData) {
- tlsChannelBindingData = channelBindingData;
- }
-
- public ByteArray getResponse() {
- if (step.equals(Step.Initial)) {
- return ByteArray.plus(getGS2Header(), getInitialBareClientMessage());
- } else if (step.equals(Step.Proof)) {
- ByteArray clientKey = HMACSHA1.getResult(saltedPassword, new ByteArray("Client Key"));
- ByteArray storedKey = SHA1.getHash(clientKey);
- ByteArray clientSignature = HMACSHA1.getResult(storedKey, authMessage);
- ByteArray clientProof = clientKey;
- byte[] clientProofData = clientProof.getData();
- for (int i = 0; i < clientProofData.length; ++i) {
- clientProofData[i] ^= clientSignature.getData()[i];
- }
- ByteArray result = getFinalMessageWithoutProof().append(",p=").append(Base64.encode(clientProof));
- return result;
- } else {
- return null;
- }
- }
-
- public boolean setChallenge(ByteArray challenge) {
- if (step.equals(Step.Initial)) {
- if (challenge == null) {
- return false;
- }
- initialServerMessage = challenge;
-
- Map<Character, String> keys = parseMap(initialServerMessage.toString());
-
- // Extract the salt
- ByteArray salt = Base64.decode(keys.get('s'));
-
- // Extract the server nonce
- String clientServerNonce = keys.get('r');
- if (clientServerNonce.length() <= clientnonce.length()) {
- return false;
- }
- String receivedClientNonce = clientServerNonce.substring(0, clientnonce.length());
- if (!receivedClientNonce.equals(clientnonce)) {
- return false;
- }
- serverNonce = new ByteArray(clientServerNonce.substring(clientnonce.length()));
-
-
- // Extract the number of iterations
- int iterations = 0;
- try {
- iterations = Integer.parseInt(keys.get('i'));
- } catch (NumberFormatException e) {
- return false;
- }
- if (iterations <= 0) {
- return false;
- }
-
- ByteArray channelBindData = new ByteArray();
- if (useChannelBinding && tlsChannelBindingData != null) {
- channelBindData = tlsChannelBindingData;
- }
-
- // Compute all the values needed for the server signature
- saltedPassword = PBKDF2.encode(new ByteArray(SASLPrep(getPassword())), salt, iterations);
- authMessage = getInitialBareClientMessage().append(",").append(initialServerMessage).append(",").append(getFinalMessageWithoutProof());
- ByteArray serverKey = HMACSHA1.getResult(saltedPassword, new ByteArray("Server Key"));
- serverSignature = HMACSHA1.getResult(serverKey, authMessage);
-
- step = Step.Proof;
- return true;
- } else if (step.equals(step.Proof)) {
- ByteArray result = new ByteArray("v=").append(new ByteArray(Base64.encode(serverSignature)));
- step = Step.Final;
- return challenge != null && challenge.equals(result);
- } else {
- return true;
- }
- }
-
- private String SASLPrep(String source) {
- return Normalizer.normalize(source, Form.NFKC); /* FIXME: Implement real SASLPrep */
- }
-
- private Map<Character, String> parseMap(String s) {
- HashMap<Character, String> result = new HashMap<Character, String>();
- if (s.length() > 0) {
- char key = '~'; /* initialise so it'll compile */
- String value = "";
- int i = 0;
- boolean expectKey = true;
- while (i < s.length()) {
- if (expectKey) {
- key = s.charAt(i);
- expectKey = false;
- i++;
- } else if (s.charAt(i) == ',') {
- result.put(key, value);
- value = "";
- expectKey = true;
- } else {
- value += s.charAt(i);
- }
- i++;
- }
- result.put(key, value);
- }
- return result;
- }
-
- private ByteArray getInitialBareClientMessage() {
- String authenticationID = SASLPrep(getAuthenticationID());
- return new ByteArray("n=" + escape(authenticationID) + ",r=" + clientnonce);
- }
-
- private ByteArray getGS2Header() {
-
- ByteArray channelBindingHeader = new ByteArray("n");
- if (tlsChannelBindingData != null) {
- if (useChannelBinding) {
- channelBindingHeader = new ByteArray("p=tls-unique");
- }
- else {
- channelBindingHeader = new ByteArray("y");
- }
- }
- return new ByteArray().append(channelBindingHeader).append(",").append(getAuthorizationID().isEmpty() ? new ByteArray() : new ByteArray("a=" + escape(getAuthorizationID()))).append(",");
- }
-
- private ByteArray getFinalMessageWithoutProof() {
- ByteArray channelBindData = new ByteArray();
- if (useChannelBinding && tlsChannelBindingData != null) {
- channelBindData = tlsChannelBindingData;
- }
- return new ByteArray("c=" + Base64.encode(new ByteArray(getGS2Header()).append(channelBindData)) + ",r=" + clientnonce).append(serverNonce);
- }
-
- private enum Step {
-
- Initial,
- Proof,
- Final
- };
- private Step step;
- private String clientnonce = "";
- private ByteArray initialServerMessage = new ByteArray();
- private ByteArray serverNonce = new ByteArray();
- private ByteArray authMessage = new ByteArray();
- private ByteArray saltedPassword = new ByteArray();
- private ByteArray serverSignature = new ByteArray();
- private boolean useChannelBinding;
- private ByteArray tlsChannelBindingData;
-}
--- a/src/com/isode/stroke/stringcodecs/Base64.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2010 Remko Tronçon
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
- */
-/*
- * Copyright (c) 2010, Isode Limited, London, England.
- * All rights reserved.
- */
-package com.isode.stroke.stringcodecs;
-
-import com.isode.stroke.base.ByteArray;
-
-public class Base64 {
- /* FIXME: Check license is ok (it is, it's BSD) */
- public static ByteArray decode(String input) {
- return new ByteArray(Base64BSD.decode(input));
- }
-
- public static String encode(ByteArray input) {
- return Base64BSD.encodeToString(input.getData(), false);
- }
-}
--- a/src/com/isode/stroke/stringcodecs/Base64BSD.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,575 +0,0 @@
-package com.isode.stroke.stringcodecs;
-
-import java.util.Arrays;
-
-/** A very fast and memory efficient class to encode and decode to and from BASE64 in full accordance
- * with RFC 2045.<br><br>
- * On Windows XP sp1 with 1.4.2_04 and later ;), this encoder and decoder is about 10 times faster
- * on small arrays (10 - 1000 bytes) and 2-3 times as fast on larger arrays (10000 - 1000000 bytes)
- * compared to <code>sun.misc.Encoder()/Decoder()</code>.<br><br>
- *
- * On byte arrays the encoder is about 20% faster than Jakarta Commons Base64 Codec for encode and
- * about 50% faster for decoding large arrays. This implementation is about twice as fast on very small
- * arrays (< 30 bytes). If source/destination is a <code>String</code> this
- * version is about three times as fast due to the fact that the Commons Codec result has to be recoded
- * to a <code>String</code> from <code>byte[]</code>, which is very expensive.<br><br>
- *
- * This encode/decode algorithm doesn't create any temporary arrays as many other codecs do, it only
- * allocates the resulting array. This produces less garbage and it is possible to handle arrays twice
- * as large as algorithms that create a temporary array. (E.g. Jakarta Commons Codec). It is unknown
- * whether Sun's <code>sun.misc.Encoder()/Decoder()</code> produce temporary arrays but since performance
- * is quite low it probably does.<br><br>
- *
- * The encoder produces the same output as the Sun one except that the Sun's encoder appends
- * a trailing line separator if the last character isn't a pad. Unclear why but it only adds to the
- * length and is probably a side effect. Both are in conformance with RFC 2045 though.<br>
- * Commons codec seem to always att a trailing line separator.<br><br>
- *
- * <b>Note!</b>
- * The encode/decode method pairs (types) come in three versions with the <b>exact</b> same algorithm and
- * thus a lot of code redundancy. This is to not create any temporary arrays for transcoding to/from different
- * format types. The methods not used can simply be commented out.<br><br>
- *
- * There is also a "fast" version of all decode methods that works the same way as the normal ones, but
- * har a few demands on the decoded input. Normally though, these fast verions should be used if the source if
- * the input is known and it hasn't bee tampered with.<br><br>
- *
- * If you find the code useful or you find a bug, please send me a note at base64 @ miginfocom . com.
- *
- * Licence (BSD):
- * ==============
- *
- * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (base64 @ miginfocom . com)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this list
- * of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- * Neither the name of the MiG InfoCom AB nor the names of its contributors may be
- * used to endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * @version 2.2
- * @author Mikael Grev
- * Date: 2004-aug-02
- * Time: 11:31:11
- */
-
-public class Base64BSD
-{
- private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
- private static final int[] IA = new int[256];
- static {
- Arrays.fill(IA, -1);
- for (int i = 0, iS = CA.length; i < iS; i++)
- IA[CA[i]] = i;
- IA['='] = 0;
- }
-
- // ****************************************************************************************
- // * char[] version
- // ****************************************************************************************
-
- /** Encodes a raw byte array into a BASE64 <code>char[]</code> representation i accordance with RFC 2045.
- * @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
- * @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
- * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
- * little faster.
- * @return A BASE64 encoded array. Never <code>null</code>.
- */
- public final static char[] encodeToChar(byte[] sArr, boolean lineSep)
- {
- // Check special case
- int sLen = sArr != null ? sArr.length : 0;
- if (sLen == 0)
- return new char[0];
-
- int eLen = (sLen / 3) * 3; // Length of even 24-bits.
- int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count
- int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array
- char[] dArr = new char[dLen];
-
- // Encode even 24-bits
- for (int s = 0, d = 0, cc = 0; s < eLen;) {
- // Copy next three bytes into lower 24 bits of int, paying attension to sign.
- int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff);
-
- // Encode the int into four chars
- dArr[d++] = CA[(i >>> 18) & 0x3f];
- dArr[d++] = CA[(i >>> 12) & 0x3f];
- dArr[d++] = CA[(i >>> 6) & 0x3f];
- dArr[d++] = CA[i & 0x3f];
-
- // Add optional line separator
- if (lineSep && ++cc == 19 && d < dLen - 2) {
- dArr[d++] = '\r';
- dArr[d++] = '\n';
- cc = 0;
- }
- }
-
- // Pad and encode last bits if source isn't even 24 bits.
- int left = sLen - eLen; // 0 - 2.
- if (left > 0) {
- // Prepare the int
- int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0);
-
- // Set last four chars
- dArr[dLen - 4] = CA[i >> 12];
- dArr[dLen - 3] = CA[(i >>> 6) & 0x3f];
- dArr[dLen - 2] = left == 2 ? CA[i & 0x3f] : '=';
- dArr[dLen - 1] = '=';
- }
- return dArr;
- }
-
- /** Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with
- * and without line separators.
- * @param sArr The source array. <code>null</code> or length 0 will return an empty array.
- * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
- * (including '=') isn't divideable by 4. (I.e. definitely corrupted).
- */
- public final static byte[] decode(char[] sArr)
- {
- // Check special case
- int sLen = sArr != null ? sArr.length : 0;
- if (sLen == 0)
- return new byte[0];
-
- // Count illegal characters (including '\r', '\n') to know what size the returned array will be,
- // so we don't have to reallocate & copy it later.
- int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...)
- for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out.
- if (IA[sArr[i]] < 0)
- sepCnt++;
-
- // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045.
- if ((sLen - sepCnt) % 4 != 0)
- return null;
-
- int pad = 0;
- for (int i = sLen; i > 1 && IA[sArr[--i]] <= 0;)
- if (sArr[i] == '=')
- pad++;
-
- int len = ((sLen - sepCnt) * 6 >> 3) - pad;
-
- byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
-
- for (int s = 0, d = 0; d < len;) {
- // Assemble three bytes into an int from four "valid" characters.
- int i = 0;
- for (int j = 0; j < 4; j++) { // j only increased if a valid char was found.
- int c = IA[sArr[s++]];
- if (c >= 0)
- i |= c << (18 - j * 6);
- else
- j--;
- }
- // Add the bytes
- dArr[d++] = (byte) (i >> 16);
- if (d < len) {
- dArr[d++]= (byte) (i >> 8);
- if (d < len)
- dArr[d++] = (byte) i;
- }
- }
- return dArr;
- }
-
- /** Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as
- * fast as {@link #decode(char[])}. The preconditions are:<br>
- * + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
- * + Line separator must be "\r\n", as specified in RFC 2045
- * + The array must not contain illegal characters within the encoded string<br>
- * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
- * @param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
- * @return The decoded array of bytes. May be of length 0.
- */
- public final static byte[] decodeFast(char[] sArr)
- {
- // Check special case
- int sLen = sArr.length;
- if (sLen == 0)
- return new byte[0];
-
- int sIx = 0, eIx = sLen - 1; // Start and end index after trimming.
-
- // Trim illegal chars from start
- while (sIx < eIx && IA[sArr[sIx]] < 0)
- sIx++;
-
- // Trim illegal chars from end
- while (eIx > 0 && IA[sArr[eIx]] < 0)
- eIx--;
-
- // get the padding count (=) (0, 1 or 2)
- int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end.
- int cCnt = eIx - sIx + 1; // Content count including possible separators
- int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0;
-
- int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
- byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
-
- // Decode all but the last 0 - 2 bytes.
- int d = 0;
- for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
- // Assemble three bytes into an int from four "valid" characters.
- int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]];
-
- // Add the bytes
- dArr[d++] = (byte) (i >> 16);
- dArr[d++] = (byte) (i >> 8);
- dArr[d++] = (byte) i;
-
- // If line separator, jump over it.
- if (sepCnt > 0 && ++cc == 19) {
- sIx += 2;
- cc = 0;
- }
- }
-
- if (d < len) {
- // Decode last 1-3 bytes (incl '=') into 1-3 bytes
- int i = 0;
- for (int j = 0; sIx <= eIx - pad; j++)
- i |= IA[sArr[sIx++]] << (18 - j * 6);
-
- for (int r = 16; d < len; r -= 8)
- dArr[d++] = (byte) (i >> r);
- }
-
- return dArr;
- }
-
- // ****************************************************************************************
- // * byte[] version
- // ****************************************************************************************
-
- /** Encodes a raw byte array into a BASE64 <code>byte[]</code> representation i accordance with RFC 2045.
- * @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
- * @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
- * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
- * little faster.
- * @return A BASE64 encoded array. Never <code>null</code>.
- */
- public final static byte[] encodeToByte(byte[] sArr, boolean lineSep)
- {
- // Check special case
- int sLen = sArr != null ? sArr.length : 0;
- if (sLen == 0)
- return new byte[0];
-
- int eLen = (sLen / 3) * 3; // Length of even 24-bits.
- int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count
- int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array
- byte[] dArr = new byte[dLen];
-
- // Encode even 24-bits
- for (int s = 0, d = 0, cc = 0; s < eLen;) {
- // Copy next three bytes into lower 24 bits of int, paying attension to sign.
- int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff);
-
- // Encode the int into four chars
- dArr[d++] = (byte) CA[(i >>> 18) & 0x3f];
- dArr[d++] = (byte) CA[(i >>> 12) & 0x3f];
- dArr[d++] = (byte) CA[(i >>> 6) & 0x3f];
- dArr[d++] = (byte) CA[i & 0x3f];
-
- // Add optional line separator
- if (lineSep && ++cc == 19 && d < dLen - 2) {
- dArr[d++] = '\r';
- dArr[d++] = '\n';
- cc = 0;
- }
- }
-
- // Pad and encode last bits if source isn't an even 24 bits.
- int left = sLen - eLen; // 0 - 2.
- if (left > 0) {
- // Prepare the int
- int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0);
-
- // Set last four chars
- dArr[dLen - 4] = (byte) CA[i >> 12];
- dArr[dLen - 3] = (byte) CA[(i >>> 6) & 0x3f];
- dArr[dLen - 2] = left == 2 ? (byte) CA[i & 0x3f] : (byte) '=';
- dArr[dLen - 1] = '=';
- }
- return dArr;
- }
-
- /** Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with
- * and without line separators.
- * @param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
- * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
- * (including '=') isn't divideable by 4. (I.e. definitely corrupted).
- */
- public final static byte[] decode(byte[] sArr)
- {
- // Check special case
- int sLen = sArr.length;
-
- // Count illegal characters (including '\r', '\n') to know what size the returned array will be,
- // so we don't have to reallocate & copy it later.
- int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...)
- for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out.
- if (IA[sArr[i] & 0xff] < 0)
- sepCnt++;
-
- // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045.
- if ((sLen - sepCnt) % 4 != 0)
- return null;
-
- int pad = 0;
- for (int i = sLen; i > 1 && IA[sArr[--i] & 0xff] <= 0;)
- if (sArr[i] == '=')
- pad++;
-
- int len = ((sLen - sepCnt) * 6 >> 3) - pad;
-
- byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
-
- for (int s = 0, d = 0; d < len;) {
- // Assemble three bytes into an int from four "valid" characters.
- int i = 0;
- for (int j = 0; j < 4; j++) { // j only increased if a valid char was found.
- int c = IA[sArr[s++] & 0xff];
- if (c >= 0)
- i |= c << (18 - j * 6);
- else
- j--;
- }
-
- // Add the bytes
- dArr[d++] = (byte) (i >> 16);
- if (d < len) {
- dArr[d++]= (byte) (i >> 8);
- if (d < len)
- dArr[d++] = (byte) i;
- }
- }
-
- return dArr;
- }
-
-
- /** Decodes a BASE64 encoded byte array that is known to be resonably well formatted. The method is about twice as
- * fast as {@link #decode(byte[])}. The preconditions are:<br>
- * + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
- * + Line separator must be "\r\n", as specified in RFC 2045
- * + The array must not contain illegal characters within the encoded string<br>
- * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
- * @param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
- * @return The decoded array of bytes. May be of length 0.
- */
- public final static byte[] decodeFast(byte[] sArr)
- {
- // Check special case
- int sLen = sArr.length;
- if (sLen == 0)
- return new byte[0];
-
- int sIx = 0, eIx = sLen - 1; // Start and end index after trimming.
-
- // Trim illegal chars from start
- while (sIx < eIx && IA[sArr[sIx] & 0xff] < 0)
- sIx++;
-
- // Trim illegal chars from end
- while (eIx > 0 && IA[sArr[eIx] & 0xff] < 0)
- eIx--;
-
- // get the padding count (=) (0, 1 or 2)
- int pad = sArr[eIx] == '=' ? (sArr[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end.
- int cCnt = eIx - sIx + 1; // Content count including possible separators
- int sepCnt = sLen > 76 ? (sArr[76] == '\r' ? cCnt / 78 : 0) << 1 : 0;
-
- int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
- byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
-
- // Decode all but the last 0 - 2 bytes.
- int d = 0;
- for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
- // Assemble three bytes into an int from four "valid" characters.
- int i = IA[sArr[sIx++]] << 18 | IA[sArr[sIx++]] << 12 | IA[sArr[sIx++]] << 6 | IA[sArr[sIx++]];
-
- // Add the bytes
- dArr[d++] = (byte) (i >> 16);
- dArr[d++] = (byte) (i >> 8);
- dArr[d++] = (byte) i;
-
- // If line separator, jump over it.
- if (sepCnt > 0 && ++cc == 19) {
- sIx += 2;
- cc = 0;
- }
- }
-
- if (d < len) {
- // Decode last 1-3 bytes (incl '=') into 1-3 bytes
- int i = 0;
- for (int j = 0; sIx <= eIx - pad; j++)
- i |= IA[sArr[sIx++]] << (18 - j * 6);
-
- for (int r = 16; d < len; r -= 8)
- dArr[d++] = (byte) (i >> r);
- }
-
- return dArr;
- }
-
- // ****************************************************************************************
- // * String version
- // ****************************************************************************************
-
- /** Encodes a raw byte array into a BASE64 <code>String</code> representation i accordance with RFC 2045.
- * @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
- * @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
- * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
- * little faster.
- * @return A BASE64 encoded array. Never <code>null</code>.
- */
- public final static String encodeToString(byte[] sArr, boolean lineSep)
- {
- // Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower.
- return new String(encodeToChar(sArr, lineSep));
- }
-
- /** Decodes a BASE64 encoded <code>String</code>. All illegal characters will be ignored and can handle both strings with
- * and without line separators.<br>
- * <b>Note!</b> It can be up to about 2x the speed to call <code>decode(str.toCharArray())</code> instead. That
- * will create a temporary array though. This version will use <code>str.charAt(i)</code> to iterate the string.
- * @param str The source string. <code>null</code> or length 0 will return an empty array.
- * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
- * (including '=') isn't divideable by 4. (I.e. definitely corrupted).
- */
- public final static byte[] decode(String str)
- {
- // Check special case
- int sLen = str != null ? str.length() : 0;
- if (sLen == 0)
- return new byte[0];
-
- // Count illegal characters (including '\r', '\n') to know what size the returned array will be,
- // so we don't have to reallocate & copy it later.
- int sepCnt = 0; // Number of separator characters. (Actually illegal characters, but that's a bonus...)
- for (int i = 0; i < sLen; i++) // If input is "pure" (I.e. no line separators or illegal chars) base64 this loop can be commented out.
- if (IA[str.charAt(i)] < 0)
- sepCnt++;
-
- // Check so that legal chars (including '=') are evenly divideable by 4 as specified in RFC 2045.
- if ((sLen - sepCnt) % 4 != 0)
- return null;
-
- // Count '=' at end
- int pad = 0;
- for (int i = sLen; i > 1 && IA[str.charAt(--i)] <= 0;)
- if (str.charAt(i) == '=')
- pad++;
-
- int len = ((sLen - sepCnt) * 6 >> 3) - pad;
-
- byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
-
- for (int s = 0, d = 0; d < len;) {
- // Assemble three bytes into an int from four "valid" characters.
- int i = 0;
- for (int j = 0; j < 4; j++) { // j only increased if a valid char was found.
- int c = IA[str.charAt(s++)];
- if (c >= 0)
- i |= c << (18 - j * 6);
- else
- j--;
- }
- // Add the bytes
- dArr[d++] = (byte) (i >> 16);
- if (d < len) {
- dArr[d++]= (byte) (i >> 8);
- if (d < len)
- dArr[d++] = (byte) i;
- }
- }
- return dArr;
- }
-
- /** Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as
- * fast as {@link #decode(String)}. The preconditions are:<br>
- * + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
- * + Line separator must be "\r\n", as specified in RFC 2045
- * + The array must not contain illegal characters within the encoded string<br>
- * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
- * @param s The source string. Length 0 will return an empty array. <code>null</code> will throw an exception.
- * @return The decoded array of bytes. May be of length 0.
- */
- public final static byte[] decodeFast(String s)
- {
- // Check special case
- int sLen = s.length();
- if (sLen == 0)
- return new byte[0];
-
- int sIx = 0, eIx = sLen - 1; // Start and end index after trimming.
-
- // Trim illegal chars from start
- while (sIx < eIx && IA[s.charAt(sIx) & 0xff] < 0)
- sIx++;
-
- // Trim illegal chars from end
- while (eIx > 0 && IA[s.charAt(eIx) & 0xff] < 0)
- eIx--;
-
- // get the padding count (=) (0, 1 or 2)
- int pad = s.charAt(eIx) == '=' ? (s.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end.
- int cCnt = eIx - sIx + 1; // Content count including possible separators
- int sepCnt = sLen > 76 ? (s.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0;
-
- int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
- byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
-
- // Decode all but the last 0 - 2 bytes.
- int d = 0;
- for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
- // Assemble three bytes into an int from four "valid" characters.
- int i = IA[s.charAt(sIx++)] << 18 | IA[s.charAt(sIx++)] << 12 | IA[s.charAt(sIx++)] << 6 | IA[s.charAt(sIx++)];
-
- // Add the bytes
- dArr[d++] = (byte) (i >> 16);
- dArr[d++] = (byte) (i >> 8);
- dArr[d++] = (byte) i;
-
- // If line separator, jump over it.
- if (sepCnt > 0 && ++cc == 19) {
- sIx += 2;
- cc = 0;
- }
- }
-
- if (d < len) {
- // Decode last 1-3 bytes (incl '=') into 1-3 bytes
- int i = 0;
- for (int j = 0; sIx <= eIx - pad; j++)
- i |= IA[s.charAt(sIx++)] << (18 - j * 6);
-
- for (int r = 16; d < len; r -= 8)
- dArr[d++] = (byte) (i >> r);
- }
-
- return dArr;
- }
-}
\ No newline at end of file
--- a/src/com/isode/stroke/stringcodecs/HMACSHA1.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2010, Remko Tronçon.
- * All rights reserved.
- */
-package com.isode.stroke.stringcodecs;
-
-import com.isode.stroke.base.ByteArray;
-
-public class HMACSHA1 {
-
- private static final int B = 64;
-
- public static ByteArray getResult(ByteArray key, ByteArray data) {
- assert key.getSize() <= B;
-
- /* And an assert that does something */
- if (key.getSize() > B) {
- throw new IllegalStateException("Invalid key size.");
- }
-
- // Create the padded key
- ByteArray paddedKey = new ByteArray(key);
- for (int i = key.getSize(); i < B; ++i) {
- paddedKey.append((byte) 0x0);
- }
-
- // Create the first value
- ByteArray x = new ByteArray(paddedKey);
- byte[] xInner = x.getData();
- for (int i = 0; i < xInner.length; ++i) {
- xInner[i] ^= 0x36;
- }
- x.append(data);
-
- // Create the second value
- ByteArray y = new ByteArray(paddedKey);
- byte[] yInner = y.getData();
- for (int i = 0; i < yInner.length; ++i) {
- yInner[i] ^= 0x5c;
- }
- y.append(SHA1.getHash(x));
-
- return SHA1.getHash(y);
- }
-}
--- a/src/com/isode/stroke/stringcodecs/PBKDF2.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2010, Remko Tronçon.
- * All rights reserved.
- */
-package com.isode.stroke.stringcodecs;
-
-import com.isode.stroke.base.ByteArray;
-
-public class PBKDF2 {
-
- public static ByteArray encode(ByteArray password, ByteArray salt, int iterations) {
- ByteArray u = HMACSHA1.getResult(password, ByteArray.plus(salt, new ByteArray("\0\0\0\1")));
- ByteArray result = new ByteArray(u);
- byte[] resultData = result.getData();
- int i = 1;
- while (i < iterations) {
- u = HMACSHA1.getResult(password, u);
- for (int j = 0; j < u.getSize(); ++j) {
- resultData[j] ^= u.getData()[j];
- }
- ++i;
- }
- return result;
- }
-}
--- a/src/com/isode/stroke/stringcodecs/SHA1.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2010, Remko Tronçon.
- * All rights reserved.
- */
-package com.isode.stroke.stringcodecs;
-
-import com.isode.stroke.base.ByteArray;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class SHA1 {
-
- public static ByteArray getHash(ByteArray data) {
- MessageDigest md;
- try {
- md = MessageDigest.getInstance("SHA-1");
- } catch (NoSuchAlgorithmException ex) {
- throw new IllegalStateException("JRE doesn't have an SHA hash function", ex);
- }
- md.update(data.getData());
- return new ByteArray(md.digest());
- }
-}
--- a/src/de/duenndns/ssl/MTMDecision.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/* MemorizingTrustManager - a TrustManager which asks the user about invalid
- * certificates and memorizes their decision.
- *
- * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package de.duenndns.ssl;
-
-class MTMDecision {
- public final static int DECISION_INVALID = 0;
- public final static int DECISION_ABORT = 1;
- public final static int DECISION_ONCE = 2;
- public final static int DECISION_ALWAYS = 3;
-
- int state = DECISION_INVALID;
-}
--- a/src/de/duenndns/ssl/MemorizingActivity.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/* MemorizingTrustManager - a TrustManager which asks the user about invalid
- * certificates and memorizes their decision.
- *
- * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package de.duenndns.ssl;
-
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.DialogInterface.*;
-import android.content.Intent;
-import android.os.Bundle;
-import android.util.Log;
-
-import com.beem.project.beem.R;
-
-public class MemorizingActivity extends Activity
- implements OnClickListener,OnCancelListener {
- final static String TAG = "MemorizingActivity";
-
- int decisionId;
- String app;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- Log.d(TAG, "onCreate");
- super.onCreate(savedInstanceState);
- }
-
- @Override
- public void onResume() {
- super.onResume();
- Intent i = getIntent();
- app = i.getStringExtra(MemorizingTrustManager.DECISION_INTENT_APP);
- decisionId = i.getIntExtra(MemorizingTrustManager.DECISION_INTENT_ID, MTMDecision.DECISION_INVALID);
- String cert = i.getStringExtra(MemorizingTrustManager.DECISION_INTENT_CERT);
- Log.d(TAG, "onResume with " + i.getExtras() + " decId=" + decisionId);
- Log.d(TAG, "data: " + i.getData());
- new AlertDialog.Builder(this).setTitle(R.string.mtm_accept_cert)
- .setMessage(cert)
- .setPositiveButton(R.string.mtm_decision_always, this)
- .setNeutralButton(R.string.mtm_decision_once, this)
- .setNegativeButton(R.string.mtm_decision_abort, this)
- .setOnCancelListener(this)
- .create().show();
- }
-
- void sendDecision(int decision) {
- Log.d(TAG, "Sending decision to " + app + ": " + decision);
- Intent i = new Intent(MemorizingTrustManager.DECISION_INTENT + "/" + app);
- i.putExtra(MemorizingTrustManager.DECISION_INTENT_ID, decisionId);
- i.putExtra(MemorizingTrustManager.DECISION_INTENT_CHOICE, decision);
- sendBroadcast(i);
- finish();
- }
-
- // react on AlertDialog button press
- public void onClick(DialogInterface dialog, int btnId) {
- int decision;
- dialog.dismiss();
- switch (btnId) {
- case DialogInterface.BUTTON_POSITIVE:
- decision = MTMDecision.DECISION_ALWAYS;
- break;
- case DialogInterface.BUTTON_NEUTRAL:
- decision = MTMDecision.DECISION_ONCE;
- break;
- default:
- decision = MTMDecision.DECISION_ABORT;
- }
- sendDecision(decision);
- }
-
- public void onCancel(DialogInterface dialog) {
- sendDecision(MTMDecision.DECISION_ABORT);
- }
-}
--- a/src/de/duenndns/ssl/MemorizingTrustManager.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,493 +0,0 @@
-/* MemorizingTrustManager - a TrustManager which asks the user about invalid
- * certificates and memorizes their decision.
- *
- * Copyright (c) 2010 Georg Lukas <georg@op-co.de>
- *
- * MemorizingTrustManager.java contains the actual trust manager and interface
- * code to create a MemorizingActivity and obtain the results.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package de.duenndns.ssl;
-
-import android.app.Activity;
-import android.app.Application;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.Service;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.Uri;
-import android.util.Log;
-import android.os.Handler;
-
-import java.io.File;
-import java.security.cert.*;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.MessageDigest;
-import java.util.HashMap;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-
-import com.beem.project.beem.R;
-
-/**
- * A X509 trust manager implementation which asks the user about invalid
- * certificates and memorizes their decision.
- * <p>
- * The certificate validity is checked using the system default X509
- * TrustManager, creating a query Dialog if the check fails.
- * <p>
- * <b>WARNING:</b> This only works if a dedicated thread is used for
- * opening sockets!
- */
-public class MemorizingTrustManager implements X509TrustManager {
- final static String TAG = "MemorizingTrustManager";
- public final static String INTERCEPT_DECISION_INTENT = "de.duenndns.ssl.INTERCEPT_DECISION";
- public final static String INTERCEPT_DECISION_INTENT_LAUNCH = INTERCEPT_DECISION_INTENT + ".launch_intent";
- final static String DECISION_INTENT = "de.duenndns.ssl.DECISION";
- final static String DECISION_INTENT_APP = DECISION_INTENT + ".app";
- final static String DECISION_INTENT_ID = DECISION_INTENT + ".decisionId";
- final static String DECISION_INTENT_CERT = DECISION_INTENT + ".cert";
- final static String DECISION_INTENT_CHOICE = DECISION_INTENT + ".decisionChoice";
- private final static int NOTIFICATION_ID = 100509;
-
- static String KEYSTORE_DIR = "KeyStore";
- static String KEYSTORE_FILE = "KeyStore.bks";
-
- Context master;
- Activity foregroundAct;
- NotificationManager notificationManager;
- private static int decisionId = 0;
- private static HashMap<Integer, MTMDecision> openDecisions = new HashMap<Integer, MTMDecision>();
-
- Handler masterHandler;
- private File keyStoreFile;
- private KeyStore appKeyStore;
- private X509TrustManager defaultTrustManager;
- private X509TrustManager appTrustManager;
-
- /** Creates an instance of the MemorizingTrustManager class.
- *
- * You need to supply the application context. This has to be one of:
- * - Application
- * - Activity
- * - Service
- *
- * The context is used for file management, to display the dialog /
- * notification and for obtaining translated strings.
- *
- * @param m Context for the application.
- */
- public MemorizingTrustManager(Context m) {
- master = m;
- masterHandler = new Handler();
- notificationManager = (NotificationManager)master.getSystemService(Context.NOTIFICATION_SERVICE);
-
- Application app;
- if (m instanceof Application) {
- app = (Application)m;
- } else if (m instanceof Service) {
- app = ((Service)m).getApplication();
- } else if (m instanceof Activity) {
- app = ((Activity)m).getApplication();
- } else throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!");
-
- File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE);
- keyStoreFile = new File(dir + File.separator + KEYSTORE_FILE);
-
- appKeyStore = loadAppKeyStore();
- defaultTrustManager = getTrustManager(null);
- appTrustManager = getTrustManager(appKeyStore);
- }
-
- /**
- * Returns a X509TrustManager list containing a new instance of
- * TrustManagerFactory.
- *
- * This function is meant for convenience only. You can use it
- * as follows to integrate TrustManagerFactory for HTTPS sockets:
- *
- * <pre>
- * SSLContext sc = SSLContext.getInstance("TLS");
- * sc.init(null, MemorizingTrustManager.getInstanceList(this),
- * new java.security.SecureRandom());
- * HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- * </pre>
- * @param c Activity or Service to show the Dialog / Notification
- */
- public static X509TrustManager[] getInstanceList(Context c) {
- return new X509TrustManager[] { new MemorizingTrustManager(c) };
- }
-
- /**
- * Binds an Activity to the MTM for displaying the query dialog.
- *
- * This is useful if your connection is run from a service that is
- * triggered by user interaction -- in such cases the activity is
- * visible and the user tends to ignore the service notification.
- *
- * You should never have a hidden activity bound to MTM! Use this
- * function in onResume() and @see unbindDisplayActivity in onPause().
- *
- * @param act Activity to be bound
- */
- public void bindDisplayActivity(Activity act) {
- foregroundAct = act;
- }
-
- /**
- * Removes an Activity from the MTM display stack.
- *
- * Always call this function when the Activity added with
- * @see bindDisplayActivity is hidden.
- *
- * @param act Activity to be unbound
- */
- public void unbindDisplayActivity(Activity act) {
- // do not remove if it was overridden by a different activity
- if (foregroundAct == act)
- foregroundAct = null;
- }
-
- /**
- * Changes the path for the KeyStore file.
- *
- * The actual filename relative to the app's directory will be
- * <code>app_<i>dirname</i>/<i>filename</i></code>.
- *
- * @param dirname directory to store the KeyStore.
- * @param filename file name for the KeyStore.
- */
- public static void setKeyStoreFile(String dirname, String filename) {
- KEYSTORE_DIR = dirname;
- KEYSTORE_FILE = filename;
- }
-
- X509TrustManager getTrustManager(KeyStore ks) {
- try {
- TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
- tmf.init(ks);
- for (TrustManager t : tmf.getTrustManagers()) {
- if (t instanceof X509TrustManager) {
- return (X509TrustManager)t;
- }
- }
- } catch (Exception e) {
- // Here, we are covering up errors. It might be more useful
- // however to throw them out of the constructor so the
- // embedding app knows something went wrong.
- Log.e(TAG, "getTrustManager(" + ks + ")", e);
- }
- return null;
- }
-
- KeyStore loadAppKeyStore() {
- KeyStore ks;
- try {
- ks = KeyStore.getInstance(KeyStore.getDefaultType());
- } catch (KeyStoreException e) {
- Log.e(TAG, "getAppKeyStore()", e);
- return null;
- }
- try {
- ks.load(null, null);
- ks.load(new java.io.FileInputStream(keyStoreFile), "MTM".toCharArray());
- } catch (java.io.FileNotFoundException e) {
- Log.i(TAG, "getAppKeyStore(" + keyStoreFile + ") - file does not exist");
- } catch (Exception e) {
- Log.e(TAG, "getAppKeyStore(" + keyStoreFile + ")", e);
- }
- return ks;
- }
-
- void storeCert(X509Certificate[] chain) {
- // add all certs from chain to appKeyStore
- try {
- for (X509Certificate c : chain)
- appKeyStore.setCertificateEntry(c.getSubjectDN().toString(), c);
- } catch (KeyStoreException e) {
- Log.e(TAG, "storeCert(" + chain + ")", e);
- return;
- }
-
- // reload appTrustManager
- appTrustManager = getTrustManager(appKeyStore);
-
- // store KeyStore to file
- try {
- java.io.FileOutputStream fos = new java.io.FileOutputStream(keyStoreFile);
- appKeyStore.store(fos, "MTM".toCharArray());
- fos.close();
- } catch (Exception e) {
- Log.e(TAG, "storeCert(" + keyStoreFile + ")", e);
- }
- }
-
- // if the certificate is stored in the app key store, it is considered "known"
- private boolean isCertKnown(X509Certificate cert) {
- try {
- return appKeyStore.getCertificateAlias(cert) != null;
- } catch (KeyStoreException e) {
- return false;
- }
- }
-
- private boolean isExpiredException(Throwable e) {
- do {
- if (e instanceof CertificateExpiredException)
- return true;
- e = e.getCause();
- } while (e != null);
- return false;
- }
-
- public void checkCertTrusted(X509Certificate[] chain, String authType, boolean isServer)
- throws CertificateException
- {
- Log.d(TAG, "checkCertTrusted(" + chain + ", " + authType + ", " + isServer + ")");
- try {
- Log.d(TAG, "checkCertTrusted: trying appTrustManager");
- if (isServer)
- appTrustManager.checkServerTrusted(chain, authType);
- else
- appTrustManager.checkClientTrusted(chain, authType);
- } catch (CertificateException ae) {
- // if the cert is stored in our appTrustManager, we ignore expiredness
- ae.printStackTrace();
- if (isExpiredException(ae)) {
- Log.i(TAG, "checkCertTrusted: accepting expired certificate from keystore");
- return;
- }
- if (isCertKnown(chain[0])) {
- Log.i(TAG, "checkCertTrusted: accepting cert already stored in keystore");
- return;
- }
- try {
- Log.d(TAG, "checkCertTrusted: trying defaultTrustManager");
- if (isServer)
- defaultTrustManager.checkServerTrusted(chain, authType);
- else
- defaultTrustManager.checkClientTrusted(chain, authType);
- } catch (CertificateException e) {
- e.printStackTrace();
- interact(chain, authType, e);
- }
- }
- }
-
- public void checkClientTrusted(X509Certificate[] chain, String authType)
- throws CertificateException
- {
- checkCertTrusted(chain, authType, false);
- }
-
- public void checkServerTrusted(X509Certificate[] chain, String authType)
- throws CertificateException
- {
- checkCertTrusted(chain, authType, true);
- }
-
- public X509Certificate[] getAcceptedIssuers()
- {
- Log.d(TAG, "getAcceptedIssuers()");
- return defaultTrustManager.getAcceptedIssuers();
- }
-
- private int createDecisionId(MTMDecision d) {
- int myId;
- synchronized(openDecisions) {
- myId = decisionId;
- openDecisions.put(myId, d);
- decisionId += 1;
- }
- return myId;
- }
-
- private static String hexString(byte[] data) {
- StringBuffer si = new StringBuffer();
- for (int i = 0; i < data.length; i++) {
- si.append(String.format("%02x", data[i]));
- if (i < data.length - 1)
- si.append(":");
- }
- return si.toString();
- }
-
- private static String certHash(final X509Certificate cert, String digest) {
- try {
- MessageDigest md = MessageDigest.getInstance(digest);
- md.update(cert.getEncoded());
- return hexString(md.digest());
- } catch (java.security.cert.CertificateEncodingException e) {
- return e.getMessage();
- } catch (java.security.NoSuchAlgorithmException e) {
- return e.getMessage();
- }
- }
-
- private String certChainMessage(final X509Certificate[] chain, CertificateException cause) {
- Throwable e = cause;
- Log.d(TAG, "certChainMessage for " + e);
- StringBuffer si = new StringBuffer();
- if (e.getCause() != null) {
- e = e.getCause();
- si.append(e.getLocalizedMessage());
- //si.append("\n");
- }
- for (X509Certificate c : chain) {
- si.append("\n\n");
- si.append(c.getSubjectDN().toString());
- si.append("\nMD5: ");
- si.append(certHash(c, "MD5"));
- si.append("\nSHA1: ");
- si.append(certHash(c, "SHA-1"));
- si.append("\nSigned by: ");
- si.append(c.getIssuerDN().toString());
- }
- return si.toString();
- }
-
- void startActivityNotification(PendingIntent intent, String certName) {
- Notification n = new Notification(android.R.drawable.ic_lock_lock,
- master.getString(R.string.mtm_notification),
- System.currentTimeMillis());
- n.setLatestEventInfo(master.getApplicationContext(),
- master.getString(R.string.mtm_notification),
- certName, intent);
- n.flags |= Notification.FLAG_AUTO_CANCEL;
-
- notificationManager.notify(NOTIFICATION_ID, n);
- }
-
- /**
- * Returns the top-most entry of the activity stack.
- *
- * @return the Context of the currently bound UI or the master context if none is bound
- */
- Context getUI() {
- return (foregroundAct != null) ? foregroundAct : master;
- }
-
- BroadcastReceiver launchServiceMode(Intent activityIntent, final String certMessage) {
- BroadcastReceiver launchNotifReceiver= new BroadcastReceiver() {
- public void onReceive(Context ctx, Intent i) {
- Log.i(TAG, "Interception not done by the application. Send notification");
- PendingIntent pi = i.getParcelableExtra(INTERCEPT_DECISION_INTENT_LAUNCH);
- startActivityNotification(pi, certMessage);
- }
- };
- master.registerReceiver(launchNotifReceiver, new IntentFilter(INTERCEPT_DECISION_INTENT + "/" + master.getPackageName()));
- PendingIntent call = PendingIntent.getActivity(master, 0, activityIntent, 0);
- Intent ni = new Intent(INTERCEPT_DECISION_INTENT + "/" + master.getPackageName());
- ni.putExtra(INTERCEPT_DECISION_INTENT_LAUNCH, call);
- master.sendOrderedBroadcast(ni, null);
- return launchNotifReceiver;
- }
-
- void interact(final X509Certificate[] chain, String authType, CertificateException cause)
- throws CertificateException
- {
- /* prepare the MTMDecision blocker object */
- MTMDecision choice = new MTMDecision();
- final int myId = createDecisionId(choice);
- final String certMessage = certChainMessage(chain, cause);
- BroadcastReceiver decisionReceiver = new BroadcastReceiver() {
- public void onReceive(Context ctx, Intent i) { interactResult(i); }
- };
- master.registerReceiver(decisionReceiver, new IntentFilter(DECISION_INTENT + "/" + master.getPackageName()));
- LaunchRunnable lr = new LaunchRunnable(myId, certMessage);
- masterHandler.post(lr);
-
- Log.d(TAG, "openDecisions: " + openDecisions);
- Log.d(TAG, "waiting on " + myId);
- try {
- synchronized(choice) { choice.wait(); }
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- master.unregisterReceiver(decisionReceiver);
- if (lr.launchNotifReceiver != null)
- master.unregisterReceiver(lr.launchNotifReceiver);
- Log.d(TAG, "finished wait on " + myId + ": " + choice.state);
- switch (choice.state) {
- case MTMDecision.DECISION_ALWAYS:
- storeCert(chain);
- case MTMDecision.DECISION_ONCE:
- break;
- default:
- throw (cause);
- }
- }
-
- public static void interactResult(Intent i) {
- int decisionId = i.getIntExtra(DECISION_INTENT_ID, MTMDecision.DECISION_INVALID);
- int choice = i.getIntExtra(DECISION_INTENT_CHOICE, MTMDecision.DECISION_INVALID);
- Log.d(TAG, "interactResult: " + decisionId + " chose " + choice);
- Log.d(TAG, "openDecisions: " + openDecisions);
-
- MTMDecision d;
- synchronized(openDecisions) {
- d = openDecisions.get(decisionId);
- openDecisions.remove(decisionId);
- }
- if (d == null) {
- Log.e(TAG, "interactResult: aborting due to stale decision reference!");
- return;
- }
- synchronized(d) {
- d.state = choice;
- d.notify();
- }
- }
-
- private class LaunchRunnable implements Runnable {
- private int myId;
- private String certMessage;
- BroadcastReceiver launchNotifReceiver;
-
- public LaunchRunnable(final int id, final String certMsg) {
- myId = id;
- certMessage = certMsg;
- }
-
- public void run() {
- Intent ni = new Intent(master, MemorizingActivity.class);
- ni.setData(Uri.parse(MemorizingTrustManager.class.getName() + "/" + myId));
- ni.putExtra(DECISION_INTENT_APP, master.getPackageName());
- ni.putExtra(DECISION_INTENT_ID, myId);
- ni.putExtra(DECISION_INTENT_CERT, certMessage);
-
- // we try to directly start the activity and fall back to
- // making a notification
- try {
- getUI().startActivity(ni);
- } catch (Exception e) {
- Log.e(TAG, "startActivity: " + e);
- launchNotifReceiver = launchServiceMode(ni, certMessage);
- }
- }
- }
-
-}
--- a/src/de/duenndns/ssl/package-info.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-/**
- * This package contains the MemorizingTrustManager library made by Georg.
- * It is a "plugin" for Android Java to allow asking the user about SSL certificates
- * https://github.com/ge0rg/MemorizingTrustManager
- */
-package de.duenndns.ssl;
-
--- a/src/net/java/otr4j/OtrEngine.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-package net.java.otr4j;
-
-import java.security.PublicKey;
-
-import net.java.otr4j.session.SessionID;
-import net.java.otr4j.session.SessionStatus;
-
-/**
- *
- * @author George Politis
- *
- */
-public interface OtrEngine {
-
- /**
- *
- * @param sessionID
- * The session identifier.
- * @param content
- * The message content to be transformed.
- * @return The transformed message content.
- * @throws OtrException
- */
- public abstract String transformReceiving(SessionID sessionID,
- String content) throws OtrException;
-
- /**
- *
- * @param sessionID
- * The session identifier.
- * @param content
- * The message content to be transformed.
- * @return The transformed message content.
- * @throws OtrException
- */
- public abstract String transformSending(SessionID sessionID, String content) throws OtrException;
-
- /**
- * Starts an Off-the-Record session, if there is no active one.
- *
- * @param sessionID
- * The session identifier.
- * @throws OtrException
- */
- public abstract void startSession(SessionID sessionID) throws OtrException;
-
- /**
- * Ends the Off-the-Record session, if exists.
- *
- * @param sessionID
- * The session identifier.
- * @throws OtrException
- */
- public abstract void endSession(SessionID sessionID) throws OtrException;
-
- /**
- * Stops/Starts the Off-the-Record session.
- *
- * @param sessionID
- * The session identifier.
- * @throws OtrException
- */
- public abstract void refreshSession(SessionID sessionID) throws OtrException;
-
- /**
- *
- * @param sessionID
- * The session identifier.
- * @return The status of an Off-the-Record session.
- */
- public abstract SessionStatus getSessionStatus(SessionID sessionID);
-
- /**
- *
- * @param sessionID
- * The session identifier.
- * @return The remote public key.
- */
- public abstract PublicKey getRemotePublicKey(SessionID sessionID);
-
- public abstract void addOtrEngineListener(OtrEngineListener l);
-
- public abstract void removeOtrEngineListener(OtrEngineListener l);
-}
--- a/src/net/java/otr4j/OtrEngineHost.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j;
-
-import java.security.KeyPair;
-
-import net.java.otr4j.session.SessionID;
-
-/**
- *
- * This interface should be implemented by the host application. It is required
- * for otr4j to work properly.
- *
- * @author George Politis
- *
- */
-public abstract interface OtrEngineHost {
- public abstract void injectMessage(SessionID sessionID, String msg);
-
- public abstract void showWarning(SessionID sessionID, String warning);
-
- public abstract void showError(SessionID sessionID, String error);
-
- public abstract OtrPolicy getSessionPolicy(SessionID sessionID);
-
- public abstract KeyPair getKeyPair(SessionID sessionID);
-}
--- a/src/net/java/otr4j/OtrEngineImpl.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * otr4j, the open source java otr librar
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package net.java.otr4j;
-
-import java.security.PublicKey;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import net.java.otr4j.session.Session;
-import net.java.otr4j.session.SessionID;
-import net.java.otr4j.session.SessionImpl;
-import net.java.otr4j.session.SessionStatus;
-
-/**
- *
- * @author George Politis
- *
- */
-public class OtrEngineImpl implements OtrEngine {
-
- public OtrEngineImpl(OtrEngineHost host) {
- if (host == null)
- throw new IllegalArgumentException("OtrEgineHost is required.");
-
- this.setHost(host);
- }
-
- private OtrEngineHost host;
- private Map<SessionID, Session> sessions;
-
- private Session getSession(SessionID sessionID) {
-
- if (sessionID == null || sessionID.equals(SessionID.Empty))
- throw new IllegalArgumentException();
-
- if (sessions == null)
- sessions = new Hashtable<SessionID, Session>();
-
- if (!sessions.containsKey(sessionID)) {
- Session session = new SessionImpl(sessionID, getHost());
- sessions.put(sessionID, session);
-
- session.addOtrEngineListener(new OtrEngineListener() {
-
- public void sessionStatusChanged(SessionID sessionID) {
- for (OtrEngineListener l : listeners)
- l.sessionStatusChanged(sessionID);
- }
- });
- return session;
- } else
- return sessions.get(sessionID);
- }
-
- public SessionStatus getSessionStatus(SessionID sessionID) {
- return this.getSession(sessionID).getSessionStatus();
- }
-
- public String transformReceiving(SessionID sessionID, String msgText)
- throws OtrException {
- return this.getSession(sessionID).transformReceiving(msgText);
- }
-
- public String transformSending(SessionID sessionID, String msgText)
- throws OtrException {
- return this.getSession(sessionID).transformSending(msgText, null);
- }
-
- public void endSession(SessionID sessionID) throws OtrException {
- this.getSession(sessionID).endSession();
- }
-
- public void startSession(SessionID sessionID) throws OtrException {
- this.getSession(sessionID).startSession();
- }
-
- private void setHost(OtrEngineHost host) {
- this.host = host;
- }
-
- private OtrEngineHost getHost() {
- return host;
- }
-
- public void refreshSession(SessionID sessionID) throws OtrException {
- this.getSession(sessionID).refreshSession();
- }
-
- public PublicKey getRemotePublicKey(SessionID sessionID) {
- return this.getSession(sessionID).getRemotePublicKey();
- }
-
- private List<OtrEngineListener> listeners = new Vector<OtrEngineListener>();
-
- public void addOtrEngineListener(OtrEngineListener l) {
- synchronized (listeners) {
- if (!listeners.contains(l))
- listeners.add(l);
- }
- }
-
- public void removeOtrEngineListener(OtrEngineListener l) {
- synchronized (listeners) {
- listeners.remove(l);
- }
- }
-}
--- a/src/net/java/otr4j/OtrEngineListener.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-package net.java.otr4j;
-
-import net.java.otr4j.session.SessionID;
-
-/**
- * This interface should be implemented by the host application. It notifies
- * about session status changes.
- *
- * @author George Politis
- *
- */
-public interface OtrEngineListener {
- public abstract void sessionStatusChanged(SessionID sessionID);
-}
--- a/src/net/java/otr4j/OtrException.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-package net.java.otr4j;
-
-
-public class OtrException extends Exception {
- private static final long serialVersionUID = 1L;
-
- public OtrException(Exception e){
- super(e);
- }
-}
--- a/src/net/java/otr4j/OtrKeyManager.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-package net.java.otr4j;
-
-import java.security.KeyPair;
-import java.security.PublicKey;
-
-import net.java.otr4j.session.SessionID;
-
-public abstract interface OtrKeyManager {
-
- public abstract void addListener(OtrKeyManagerListener l);
-
- public abstract void removeListener(OtrKeyManagerListener l);
-
- public abstract void verify(SessionID sessionID);
-
- public abstract void unverify(SessionID sessionID);
-
- public abstract boolean isVerified(SessionID sessionID);
-
- public abstract String getRemoteFingerprint(SessionID sessionID);
-
- public abstract String getLocalFingerprint(SessionID sessionID);
-
- public abstract void savePublicKey(SessionID sessionID, PublicKey pubKey);
-
- public abstract PublicKey loadRemotePublicKey(SessionID sessionID);
-
- public abstract KeyPair loadLocalKeyPair(SessionID sessionID);
-
- public abstract void generateLocalKeyPair(SessionID sessionID);
-}
--- a/src/net/java/otr4j/OtrKeyManagerImpl.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +0,0 @@
-package net.java.otr4j;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.KeyFactory;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.List;
-import java.util.Properties;
-import java.util.Vector;
-
-import org.bouncycastle2.util.encoders.Base64;
-
-import net.java.otr4j.crypto.OtrCryptoEngineImpl;
-import net.java.otr4j.crypto.OtrCryptoException;
-import net.java.otr4j.session.SessionID;
-
-public class OtrKeyManagerImpl implements OtrKeyManager {
-
- private OtrKeyManagerStore store;
-
- public OtrKeyManagerImpl(OtrKeyManagerStore store) {
- this.store = store;
- }
-
- class DefaultPropertiesStore implements OtrKeyManagerStore {
- private final Properties properties = new Properties();
- private String filepath;
-
- public DefaultPropertiesStore(String filepath) throws IOException {
- if (filepath == null || filepath.length() < 1)
- throw new IllegalArgumentException();
- this.filepath = filepath;
- properties.clear();
-
- InputStream in = new BufferedInputStream(new FileInputStream(
- getConfigurationFile()));
- try {
- properties.load(in);
- } finally {
- in.close();
- }
- }
-
- private File getConfigurationFile() throws IOException {
- File configFile = new File(filepath);
- if (!configFile.exists())
- configFile.createNewFile();
- return configFile;
- }
-
- public void setProperty(String id, boolean value) {
- properties.setProperty(id, "true");
- try {
- this.store();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void store() throws FileNotFoundException, IOException {
- OutputStream out = new FileOutputStream(getConfigurationFile());
- properties.store(out, null);
- out.close();
- }
-
- public void setProperty(String id, byte[] value) {
- properties.setProperty(id, new String(Base64.encode(value)));
- try {
- this.store();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void removeProperty(String id) {
- properties.remove(id);
-
- }
-
- public byte[] getPropertyBytes(String id) {
- String value = properties.getProperty(id);
- if (value == null)
- return null;
- return Base64.decode(value);
- }
-
- public boolean getPropertyBoolean(String id, boolean defaultValue) {
- try {
- return Boolean.valueOf(properties.get(id).toString());
- } catch (Exception e) {
- return defaultValue;
- }
- }
- }
-
- public OtrKeyManagerImpl(String filepath) throws IOException {
- this.store = new DefaultPropertiesStore(filepath);
- }
-
- private List<OtrKeyManagerListener> listeners = new Vector<OtrKeyManagerListener>();
-
- public void addListener(OtrKeyManagerListener l) {
- synchronized (listeners) {
- if (!listeners.contains(l))
- listeners.add(l);
- }
- }
-
- public void removeListener(OtrKeyManagerListener l) {
- synchronized (listeners) {
- listeners.remove(l);
- }
- }
-
- public void generateLocalKeyPair(SessionID sessionID) {
- if (sessionID == null)
- return;
-
- String accountID = sessionID.getAccountID();
- KeyPair keyPair;
- try {
- keyPair = KeyPairGenerator.getInstance("DSA").genKeyPair();
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- return;
- }
-
- // Store Public Key.
- PublicKey pubKey = keyPair.getPublic();
- X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(pubKey
- .getEncoded());
-
- this.store.setProperty(accountID + ".publicKey", x509EncodedKeySpec
- .getEncoded());
-
- // Store Private Key.
- PrivateKey privKey = keyPair.getPrivate();
- PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(
- privKey.getEncoded());
-
- this.store.setProperty(accountID + ".privateKey", pkcs8EncodedKeySpec
- .getEncoded());
- }
-
- public String getLocalFingerprint(SessionID sessionID) {
- KeyPair keyPair = loadLocalKeyPair(sessionID);
-
- if (keyPair == null)
- return null;
-
- PublicKey pubKey = keyPair.getPublic();
-
- try {
- return new OtrCryptoEngineImpl().getFingerprint(pubKey);
- } catch (OtrCryptoException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public String getRemoteFingerprint(SessionID sessionID) {
- PublicKey remotePublicKey = loadRemotePublicKey(sessionID);
- if (remotePublicKey == null)
- return null;
- try {
- return new OtrCryptoEngineImpl().getFingerprint(remotePublicKey);
- } catch (OtrCryptoException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public boolean isVerified(SessionID sessionID) {
- if (sessionID == null)
- return false;
-
- return this.store.getPropertyBoolean(sessionID.getUserID()
- + ".publicKey.verified", false);
- }
-
- public KeyPair loadLocalKeyPair(SessionID sessionID) {
- if (sessionID == null)
- return null;
-
- String accountID = sessionID.getAccountID();
- // Load Private Key.
- byte[] b64PrivKey = this.store.getPropertyBytes(accountID
- + ".privateKey");
- if (b64PrivKey == null)
- return null;
-
- PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(b64PrivKey);
-
- // Load Public Key.
- byte[] b64PubKey = this.store
- .getPropertyBytes(accountID + ".publicKey");
- if (b64PubKey == null)
- return null;
-
- X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(b64PubKey);
-
- PublicKey publicKey;
- PrivateKey privateKey;
-
- // Generate KeyPair.
- KeyFactory keyFactory;
- try {
- keyFactory = KeyFactory.getInstance("DSA");
- publicKey = keyFactory.generatePublic(publicKeySpec);
- privateKey = keyFactory.generatePrivate(privateKeySpec);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- return null;
- } catch (InvalidKeySpecException e) {
- e.printStackTrace();
- return null;
- }
-
- return new KeyPair(publicKey, privateKey);
- }
-
- public PublicKey loadRemotePublicKey(SessionID sessionID) {
- if (sessionID == null)
- return null;
-
- String userID = sessionID.getUserID();
-
- byte[] b64PubKey = this.store.getPropertyBytes(userID + ".publicKey");
- if (b64PubKey == null)
- return null;
-
- X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(b64PubKey);
-
- // Generate KeyPair.
- KeyFactory keyFactory;
- try {
- keyFactory = KeyFactory.getInstance("DSA");
- return keyFactory.generatePublic(publicKeySpec);
- } catch (NoSuchAlgorithmException e) {
- e.printStackTrace();
- return null;
- } catch (InvalidKeySpecException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public void savePublicKey(SessionID sessionID, PublicKey pubKey) {
- if (sessionID == null)
- return;
-
- X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(pubKey
- .getEncoded());
-
- String userID = sessionID.getUserID();
- this.store.setProperty(userID + ".publicKey", x509EncodedKeySpec
- .getEncoded());
-
- this.store.removeProperty(userID + ".publicKey.verified");
- }
-
- public void unverify(SessionID sessionID) {
- if (sessionID == null)
- return;
-
- if (!isVerified(sessionID))
- return;
-
- this.store
- .removeProperty(sessionID.getUserID() + ".publicKey.verified");
-
- for (OtrKeyManagerListener l : listeners)
- l.verificationStatusChanged(sessionID);
-
- }
-
- public void verify(SessionID sessionID) {
- if (sessionID == null)
- return;
-
- if (this.isVerified(sessionID))
- return;
-
- this.store.setProperty(sessionID.getUserID() + ".publicKey.verified",
- true);
-
- for (OtrKeyManagerListener l : listeners)
- l.verificationStatusChanged(sessionID);
- }
-
-}
--- a/src/net/java/otr4j/OtrKeyManagerListener.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-package net.java.otr4j;
-
-import net.java.otr4j.session.SessionID;
-
-public interface OtrKeyManagerListener {
- public abstract void verificationStatusChanged(SessionID session);
-}
--- a/src/net/java/otr4j/OtrKeyManagerStore.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-package net.java.otr4j;
-
-public interface OtrKeyManagerStore {
- public abstract byte[] getPropertyBytes(String id);
-
- public abstract boolean getPropertyBoolean(String id, boolean defaultValue);
-
- public abstract void setProperty(String id, byte[] value);
-
- public abstract void setProperty(String id, boolean value);
-
- public abstract void removeProperty(String id);
-}
--- a/src/net/java/otr4j/OtrPolicy.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j;
-
-/**
- *
- * @author George Politis
- *
- */
-public interface OtrPolicy {
-
- public static final int ALLOW_V1 = 0x01;
- public static final int ALLOW_V2 = 0x02;
- public static final int REQUIRE_ENCRYPTION = 0x04;
- public static final int SEND_WHITESPACE_TAG = 0x08;
- public static final int WHITESPACE_START_AKE = 0x10;
- public static final int ERROR_START_AKE = 0x20;
- public static final int VERSION_MASK = (ALLOW_V1 | ALLOW_V2);
-
- // The four old version 1 policies correspond to the following combinations
- // of flags (adding an allowance for version 2 of the protocol):
-
- public static final int NEVER = 0x00;
- public static final int OPPORTUNISTIC = (ALLOW_V1 | ALLOW_V2
- | SEND_WHITESPACE_TAG | WHITESPACE_START_AKE | ERROR_START_AKE);
- public static final int OTRL_POLICY_MANUAL = (ALLOW_V1 | ALLOW_V2);
- public static final int OTRL_POLICY_ALWAYS = (ALLOW_V1 | ALLOW_V2
- | REQUIRE_ENCRYPTION | WHITESPACE_START_AKE | ERROR_START_AKE);
- public static final int OTRL_POLICY_DEFAULT = OPPORTUNISTIC;
-
- public abstract boolean getAllowV1();
-
- public abstract boolean getAllowV2();
-
- public abstract boolean getRequireEncryption();
-
- public abstract boolean getSendWhitespaceTag();
-
- public abstract boolean getWhitespaceStartAKE();
-
- public abstract boolean getErrorStartAKE();
-
- public abstract int getPolicy();
-
- public abstract void setAllowV1(boolean value);
-
- public abstract void setAllowV2(boolean value);
-
- public abstract void setRequireEncryption(boolean value);
-
- public abstract void setSendWhitespaceTag(boolean value);
-
- public abstract void setWhitespaceStartAKE(boolean value);
-
- public abstract void setErrorStartAKE(boolean value);
-
- public abstract void setEnableAlways(boolean value);
-
- public abstract boolean getEnableAlways();
-
- public abstract void setEnableManual(boolean value);
-
- public abstract boolean getEnableManual();
-}
--- a/src/net/java/otr4j/OtrPolicyImpl.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-package net.java.otr4j;
-
-public class OtrPolicyImpl implements OtrPolicy {
-
- public OtrPolicyImpl() {
- this.setPolicy(NEVER);
- }
-
- public OtrPolicyImpl(int policy) {
- this.setPolicy(policy);
- }
-
- private int policy;
-
- public int getPolicy() {
- return policy;
- }
-
- private void setPolicy(int policy) {
- this.policy = policy;
- }
-
- public boolean getAllowV1() {
- return (policy & OtrPolicy.ALLOW_V1) != 0;
- }
-
- public boolean getAllowV2() {
- return (policy & OtrPolicy.ALLOW_V2) != 0;
- }
-
- public boolean getErrorStartAKE() {
- return (policy & OtrPolicy.ERROR_START_AKE) != 0;
- }
-
- public boolean getRequireEncryption() {
- return getEnableManual()
- && (policy & OtrPolicy.REQUIRE_ENCRYPTION) != 0;
- }
-
- public boolean getSendWhitespaceTag() {
- return (policy & OtrPolicy.SEND_WHITESPACE_TAG) != 0;
- }
-
- public boolean getWhitespaceStartAKE() {
- return (policy & OtrPolicy.WHITESPACE_START_AKE) != 0;
- }
-
- public void setAllowV1(boolean value) {
- if (value)
- policy |= ALLOW_V1;
- else
- policy &= ~ALLOW_V1;
- }
-
- public void setAllowV2(boolean value) {
- if (value)
- policy |= ALLOW_V2;
- else
- policy &= ~ALLOW_V2;
- }
-
- public void setErrorStartAKE(boolean value) {
- if (value)
- policy |= ERROR_START_AKE;
- else
- policy &= ~ERROR_START_AKE;
- }
-
- public void setRequireEncryption(boolean value) {
- if (value)
- policy |= REQUIRE_ENCRYPTION;
- else
- policy &= ~REQUIRE_ENCRYPTION;
- }
-
- public void setSendWhitespaceTag(boolean value) {
- if (value)
- policy |= SEND_WHITESPACE_TAG;
- else
- policy &= ~SEND_WHITESPACE_TAG;
- }
-
- public void setWhitespaceStartAKE(boolean value) {
- if (value)
- policy |= WHITESPACE_START_AKE;
- else
- policy &= ~WHITESPACE_START_AKE;
- }
-
- public boolean getEnableAlways() {
- return getEnableManual() && getErrorStartAKE()
- && getSendWhitespaceTag() && getWhitespaceStartAKE();
- }
-
- public void setEnableAlways(boolean value) {
- if (value)
- setEnableManual(true);
-
- setErrorStartAKE(value);
- setSendWhitespaceTag(value);
- setWhitespaceStartAKE(value);
-
- }
-
- public boolean getEnableManual() {
- return getAllowV1() && getAllowV2();
- }
-
- public void setEnableManual(boolean value) {
- setAllowV1(value);
- setAllowV2(value);
- }
-
- public boolean equals(Object obj) {
- if (obj == this)
- return true;
- if (obj == null || obj.getClass() != this.getClass())
- return false;
-
- OtrPolicy policy = (OtrPolicy) obj;
-
- return policy.getPolicy() == this.getPolicy();
- }
-
- public int hashCode() {
- return this.getPolicy();
- }
-}
--- a/src/net/java/otr4j/crypto/OtrCryptoEngine.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package net.java.otr4j.crypto;
-
-import java.math.BigInteger;
-import java.security.KeyPair;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-/**
- *
- * @author George Politis
- *
- */
-public interface OtrCryptoEngine {
-
- public static final String MODULUS_TEXT = "00FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF";
- public static final BigInteger MODULUS = new BigInteger(MODULUS_TEXT, 16);
- public static final BigInteger BIGINTEGER_TWO = BigInteger.valueOf(2);
- public static final BigInteger MODULUS_MINUS_TWO = MODULUS
- .subtract(BIGINTEGER_TWO);
-
- public static String GENERATOR_TEXT = "2";
- public static BigInteger GENERATOR = new BigInteger(GENERATOR_TEXT, 10);
-
- public static final int AES_KEY_BYTE_LENGTH = 16;
- public static final int SHA256_HMAC_KEY_BYTE_LENGTH = 32;
- public static final int DH_PRIVATE_KEY_MINIMUM_BIT_LENGTH = 320;
- public static final byte[] ZERO_CTR = new byte[] { 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00 };
-
- public static final int DSA_PUB_TYPE = 0;
-
- public abstract KeyPair generateDHKeyPair() throws OtrCryptoException;
-
- public abstract DHPublicKey getDHPublicKey(byte[] mpiBytes)
- throws OtrCryptoException;
-
- public abstract DHPublicKey getDHPublicKey(BigInteger mpi)
- throws OtrCryptoException;
-
- public abstract byte[] sha256Hmac(byte[] b, byte[] key)
- throws OtrCryptoException;
-
- public abstract byte[] sha256Hmac(byte[] b, byte[] key, int length)
- throws OtrCryptoException;
-
- public abstract byte[] sha1Hmac(byte[] b, byte[] key, int length)
- throws OtrCryptoException;
-
- public abstract byte[] sha256Hmac160(byte[] b, byte[] key)
- throws OtrCryptoException;
-
- public abstract byte[] sha256Hash(byte[] b) throws OtrCryptoException;
-
- public abstract byte[] sha1Hash(byte[] b) throws OtrCryptoException;
-
- public abstract byte[] aesDecrypt(byte[] key, byte[] ctr, byte[] b)
- throws OtrCryptoException;
-
- public abstract byte[] aesEncrypt(byte[] key, byte[] ctr, byte[] b)
- throws OtrCryptoException;
-
- public abstract BigInteger generateSecret(PrivateKey privKey,
- PublicKey pubKey) throws OtrCryptoException;
-
- public abstract byte[] sign(byte[] b, PrivateKey privatekey)
- throws OtrCryptoException;
-
- public abstract boolean verify(byte[] b, PublicKey pubKey, byte[] rs)
- throws OtrCryptoException;
-
- public abstract String getFingerprint(PublicKey pubKey)
- throws OtrCryptoException;
-}
--- a/src/net/java/otr4j/crypto/OtrCryptoEngineImpl.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,393 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.crypto;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-import java.security.InvalidKeyException;
-import java.security.KeyFactory;
-import java.security.KeyPair;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.interfaces.DSAParams;
-import java.security.interfaces.DSAPrivateKey;
-import java.security.interfaces.DSAPublicKey;
-
-import javax.crypto.KeyAgreement;
-import javax.crypto.interfaces.DHPrivateKey;
-import javax.crypto.interfaces.DHPublicKey;
-import javax.crypto.spec.DHPrivateKeySpec;
-import javax.crypto.spec.DHPublicKeySpec;
-import javax.crypto.spec.SecretKeySpec;
-
-import net.java.otr4j.io.SerializationUtils;
-
-import org.bouncycastle2.crypto.AsymmetricCipherKeyPair;
-import org.bouncycastle2.crypto.BufferedBlockCipher;
-import org.bouncycastle2.crypto.engines.AESFastEngine;
-import org.bouncycastle2.crypto.generators.DHKeyPairGenerator;
-import org.bouncycastle2.crypto.modes.SICBlockCipher;
-import org.bouncycastle2.crypto.params.DHKeyGenerationParameters;
-import org.bouncycastle2.crypto.params.DHParameters;
-import org.bouncycastle2.crypto.params.DHPrivateKeyParameters;
-import org.bouncycastle2.crypto.params.DHPublicKeyParameters;
-import org.bouncycastle2.crypto.params.DSAParameters;
-import org.bouncycastle2.crypto.params.DSAPrivateKeyParameters;
-import org.bouncycastle2.crypto.params.DSAPublicKeyParameters;
-import org.bouncycastle2.crypto.params.KeyParameter;
-import org.bouncycastle2.crypto.params.ParametersWithIV;
-import org.bouncycastle2.crypto.signers.DSASigner;
-import org.bouncycastle2.util.BigIntegers;
-
-/**
- *
- * @author George Politis
- *
- */
-public class OtrCryptoEngineImpl implements OtrCryptoEngine {
-
- public KeyPair generateDHKeyPair() throws OtrCryptoException {
-
- // Generate a AsymmetricCipherKeyPair using BC.
- DHParameters dhParams = new DHParameters(MODULUS, GENERATOR, null,
- DH_PRIVATE_KEY_MINIMUM_BIT_LENGTH);
- DHKeyGenerationParameters params = new DHKeyGenerationParameters(
- new SecureRandom(), dhParams);
- DHKeyPairGenerator kpGen = new DHKeyPairGenerator();
-
- kpGen.init(params);
- AsymmetricCipherKeyPair pair = kpGen.generateKeyPair();
-
- // Convert this AsymmetricCipherKeyPair to a standard JCE KeyPair.
- DHPublicKeyParameters pub = (DHPublicKeyParameters) pair.getPublic();
- DHPrivateKeyParameters priv = (DHPrivateKeyParameters) pair
- .getPrivate();
-
- try {
- KeyFactory keyFac = KeyFactory.getInstance("DH");
-
- DHPublicKeySpec pubKeySpecs = new DHPublicKeySpec(pub.getY(),
- MODULUS, GENERATOR);
- DHPublicKey pubKey = (DHPublicKey) keyFac
- .generatePublic(pubKeySpecs);
-
- DHParameters dhParameters = priv.getParameters();
- DHPrivateKeySpec privKeySpecs = new DHPrivateKeySpec(priv.getX(),
- dhParameters.getP(), dhParameters.getG());
- DHPrivateKey privKey = (DHPrivateKey) keyFac
- .generatePrivate(privKeySpecs);
-
- return new KeyPair(pubKey, privKey);
- } catch (Exception e) {
- throw new OtrCryptoException(e);
- }
- }
-
- public DHPublicKey getDHPublicKey(byte[] mpiBytes)
- throws OtrCryptoException {
- return getDHPublicKey(new BigInteger(mpiBytes));
- }
-
- public DHPublicKey getDHPublicKey(BigInteger mpi) throws OtrCryptoException {
- DHPublicKeySpec pubKeySpecs = new DHPublicKeySpec(mpi, MODULUS,
- GENERATOR);
- try {
- KeyFactory keyFac = KeyFactory.getInstance("DH");
- return (DHPublicKey) keyFac.generatePublic(pubKeySpecs);
- } catch (Exception e) {
- throw new OtrCryptoException(e);
- }
- }
-
- public byte[] sha256Hmac(byte[] b, byte[] key) throws OtrCryptoException {
- return this.sha256Hmac(b, key, 0);
- }
-
- public byte[] sha256Hmac(byte[] b, byte[] key, int length)
- throws OtrCryptoException {
-
- SecretKeySpec keyspec = new SecretKeySpec(key, "HmacSHA256");
- javax.crypto.Mac mac;
- try {
- mac = javax.crypto.Mac.getInstance("HmacSHA256");
- } catch (NoSuchAlgorithmException e) {
- throw new OtrCryptoException(e);
- }
- try {
- mac.init(keyspec);
- } catch (InvalidKeyException e) {
- throw new OtrCryptoException(e);
- }
-
- byte[] macBytes = mac.doFinal(b);
-
- if (length > 0) {
- byte[] bytes = new byte[length];
- ByteBuffer buff = ByteBuffer.wrap(macBytes);
- buff.get(bytes);
- return bytes;
- } else {
- return macBytes;
- }
- }
-
- public byte[] sha1Hmac(byte[] b, byte[] key, int length)
- throws OtrCryptoException {
-
- try {
- SecretKeySpec keyspec = new SecretKeySpec(key, "HmacSHA1");
- javax.crypto.Mac mac = javax.crypto.Mac.getInstance("HmacSHA1");
- mac.init(keyspec);
-
- byte[] macBytes = mac.doFinal(b);
-
- if (length > 0) {
- byte[] bytes = new byte[length];
- ByteBuffer buff = ByteBuffer.wrap(macBytes);
- buff.get(bytes);
- return bytes;
- } else {
- return macBytes;
- }
- } catch (Exception e) {
- throw new OtrCryptoException(e);
- }
- }
-
- public byte[] sha256Hmac160(byte[] b, byte[] key) throws OtrCryptoException {
- return sha256Hmac(b, key, 20);
- }
-
- public byte[] sha256Hash(byte[] b) throws OtrCryptoException {
- try {
- MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
- sha256.update(b, 0, b.length);
- return sha256.digest();
- } catch (Exception e) {
- throw new OtrCryptoException(e);
- }
- }
-
- public byte[] sha1Hash(byte[] b) throws OtrCryptoException {
- try {
- MessageDigest sha256 = MessageDigest.getInstance("SHA-1");
- sha256.update(b, 0, b.length);
- return sha256.digest();
- } catch (Exception e) {
- throw new OtrCryptoException(e);
- }
- }
-
- public byte[] aesDecrypt(byte[] key, byte[] ctr, byte[] b)
- throws OtrCryptoException {
-
- AESFastEngine aesDec = new AESFastEngine();
- SICBlockCipher sicAesDec = new SICBlockCipher(aesDec);
- BufferedBlockCipher bufSicAesDec = new BufferedBlockCipher(sicAesDec);
-
- // Create initial counter value 0.
- if (ctr == null)
- ctr = ZERO_CTR;
- bufSicAesDec.init(false, new ParametersWithIV(new KeyParameter(key),
- ctr));
- byte[] aesOutLwDec = new byte[b.length];
- int done = bufSicAesDec.processBytes(b, 0, b.length, aesOutLwDec, 0);
- try {
- bufSicAesDec.doFinal(aesOutLwDec, done);
- } catch (Exception e) {
- throw new OtrCryptoException(e);
- }
-
- return aesOutLwDec;
- }
-
- public byte[] aesEncrypt(byte[] key, byte[] ctr, byte[] b)
- throws OtrCryptoException {
-
- AESFastEngine aesEnc = new AESFastEngine();
- SICBlockCipher sicAesEnc = new SICBlockCipher(aesEnc);
- BufferedBlockCipher bufSicAesEnc = new BufferedBlockCipher(sicAesEnc);
-
- // Create initial counter value 0.
- if (ctr == null)
- ctr = ZERO_CTR;
- bufSicAesEnc.init(true,
- new ParametersWithIV(new KeyParameter(key), ctr));
- byte[] aesOutLwEnc = new byte[b.length];
- int done = bufSicAesEnc.processBytes(b, 0, b.length, aesOutLwEnc, 0);
- try {
- bufSicAesEnc.doFinal(aesOutLwEnc, done);
- } catch (Exception e) {
- throw new OtrCryptoException(e);
- }
- return aesOutLwEnc;
- }
-
- public BigInteger generateSecret(PrivateKey privKey, PublicKey pubKey)
- throws OtrCryptoException {
- try {
- KeyAgreement ka = KeyAgreement.getInstance("DH");
- ka.init(privKey);
- ka.doPhase(pubKey, true);
- byte[] sb = ka.generateSecret();
- BigInteger s = new BigInteger(1, sb);
- return s;
-
- } catch (Exception e) {
- throw new OtrCryptoException(e);
- }
- }
-
- public byte[] sign(byte[] b, PrivateKey privatekey)
- throws OtrCryptoException {
-
- if (!(privatekey instanceof DSAPrivateKey))
- throw new IllegalArgumentException();
-
- DSAParams dsaParams = ((DSAPrivateKey) privatekey).getParams();
- DSAParameters bcDSAParameters = new DSAParameters(dsaParams.getP(),
- dsaParams.getQ(), dsaParams.getG());
-
- DSAPrivateKey dsaPrivateKey = (DSAPrivateKey) privatekey;
- DSAPrivateKeyParameters bcDSAPrivateKeyParms = new DSAPrivateKeyParameters(
- dsaPrivateKey.getX(), bcDSAParameters);
-
- DSASigner dsaSigner = new DSASigner();
- dsaSigner.init(true, bcDSAPrivateKeyParms);
-
- BigInteger q = dsaParams.getQ();
-
- // Ian: Note that if you can get the standard DSA implementation you're
- // using to not hash its input, you should be able to pass it ((256-bit
- // value) mod q), (rather than truncating the 256-bit value) and all
- // should be well.
- // ref: Interop problems with libotr - DSA signature
- BigInteger bmpi = new BigInteger(1, b);
- BigInteger[] rs = dsaSigner.generateSignature(BigIntegers
- .asUnsignedByteArray(bmpi.mod(q)));
-
- int siglen = q.bitLength() / 4;
- int rslen = siglen / 2;
- byte[] rb = BigIntegers.asUnsignedByteArray(rs[0]);
- byte[] sb = BigIntegers.asUnsignedByteArray(rs[1]);
-
- // Create the final signature array, padded with zeros if necessary.
- byte[] sig = new byte[siglen];
- Boolean writeR = false;
- Boolean writeS = false;
- for (int i = 0; i < siglen; i++) {
- if (i < rslen) {
- if (!writeR)
- writeR = rb.length >= rslen - i;
- sig[i] = (writeR) ? rb[i] : (byte) 0x0;
- } else {
- int j = i - rslen; // Rebase.
- if (!writeS)
- writeS = sb.length >= rslen - j;
- sig[i] = (writeS) ? sb[j] : (byte) 0x0;
- }
- }
- return sig;
- }
-
- public boolean verify(byte[] b, PublicKey pubKey, byte[] rs)
- throws OtrCryptoException {
-
- if (!(pubKey instanceof DSAPublicKey))
- throw new IllegalArgumentException();
-
- DSAParams dsaParams = ((DSAPublicKey) pubKey).getParams();
- int qlen = dsaParams.getQ().bitLength() / 8;
- ByteBuffer buff = ByteBuffer.wrap(rs);
- byte[] r = new byte[qlen];
- buff.get(r);
- byte[] s = new byte[qlen];
- buff.get(s);
- return verify(b, pubKey, r, s);
- }
-
- private Boolean verify(byte[] b, PublicKey pubKey, byte[] r, byte[] s)
- throws OtrCryptoException {
- Boolean result = verify(b, pubKey, new BigInteger(1, r),
- new BigInteger(1, s));
- return result;
- }
-
- private Boolean verify(byte[] b, PublicKey pubKey, BigInteger r,
- BigInteger s) throws OtrCryptoException {
-
- if (!(pubKey instanceof DSAPublicKey))
- throw new IllegalArgumentException();
-
- DSAParams dsaParams = ((DSAPublicKey) pubKey).getParams();
-
- BigInteger q = dsaParams.getQ();
- DSAParameters bcDSAParams = new DSAParameters(dsaParams.getP(), q,
- dsaParams.getG());
-
- DSAPublicKey dsaPrivateKey = (DSAPublicKey) pubKey;
- DSAPublicKeyParameters dsaPrivParms = new DSAPublicKeyParameters(
- dsaPrivateKey.getY(), bcDSAParams);
-
- // Ian: Note that if you can get the standard DSA implementation you're
- // using to not hash its input, you should be able to pass it ((256-bit
- // value) mod q), (rather than truncating the 256-bit value) and all
- // should be well.
- // ref: Interop problems with libotr - DSA signature
- DSASigner dsaSigner = new DSASigner();
- dsaSigner.init(false, dsaPrivParms);
-
- BigInteger bmpi = new BigInteger(1, b);
- Boolean result = dsaSigner.verifySignature(BigIntegers
- .asUnsignedByteArray(bmpi.mod(q)), r, s);
- return result;
- }
-
- public String getFingerprint(PublicKey pubKey) throws OtrCryptoException {
- byte[] b;
- try {
- byte[] bRemotePubKey = SerializationUtils.writePublicKey(pubKey);
-
- if (pubKey.getAlgorithm().equals("DSA")) {
- byte[] trimmed = new byte[bRemotePubKey.length - 2];
- System.arraycopy(bRemotePubKey, 2, trimmed, 0, trimmed.length);
- b = new OtrCryptoEngineImpl().sha1Hash(trimmed);
- } else
- b = new OtrCryptoEngineImpl().sha1Hash(bRemotePubKey);
- } catch (IOException e) {
- throw new OtrCryptoException(e);
- }
- return this.byteArrayToHexString(b);
- }
-
- private String byteArrayToHexString(byte in[]) {
- byte ch = 0x00;
- int i = 0;
- if (in == null || in.length <= 0)
- return null;
- String pseudo[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
- "A", "B", "C", "D", "E", "F" };
- StringBuffer out = new StringBuffer(in.length * 2);
- while (i < in.length) {
- ch = (byte) (in[i] & 0xF0);
- ch = (byte) (ch >>> 4);
- ch = (byte) (ch & 0x0F);
- out.append(pseudo[(int) ch]);
- ch = (byte) (in[i] & 0x0F);
- out.append(pseudo[(int) ch]);
- i++;
- }
-
- String rslt = new String(out);
- return rslt;
-
- }
-}
--- a/src/net/java/otr4j/crypto/OtrCryptoException.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-package net.java.otr4j.crypto;
-
-import net.java.otr4j.OtrException;
-
-@SuppressWarnings("serial")
-public class OtrCryptoException extends OtrException {
-
- public OtrCryptoException(Exception e) {
- super(e);
- }
-
-}
--- a/src/net/java/otr4j/io/OtrInputStream.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-package net.java.otr4j.io;
-
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
-import java.security.PublicKey;
-import java.security.interfaces.DSAParams;
-import java.security.interfaces.DSAPublicKey;
-import java.security.spec.DSAPublicKeySpec;
-import java.security.spec.InvalidKeySpecException;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-import net.java.otr4j.crypto.OtrCryptoEngineImpl;
-import net.java.otr4j.io.messages.SignatureX;
-
-public class OtrInputStream extends FilterInputStream implements
- SerializationConstants {
-
- public OtrInputStream(InputStream in) {
- super(in);
- }
-
- private int readNumber(int length) throws IOException {
- byte[] b = new byte[length];
- read(b);
-
- int value = 0;
- for (int i = 0; i < b.length; i++) {
- int shift = (b.length - 1 - i) * 8;
- value += (b[i] & 0x000000FF) << shift;
- }
-
- return value;
- }
-
- public int readByte() throws IOException {
- return readNumber(TYPE_LEN_BYTE);
- }
-
- public int readInt() throws IOException {
- return readNumber(TYPE_LEN_INT);
- }
-
- public int readShort() throws IOException {
- return readNumber(TYPE_LEN_SHORT);
- }
-
- public byte[] readCtr() throws IOException {
- byte[] b = new byte[TYPE_LEN_CTR];
- read(b);
- return b;
- }
-
- public byte[] readMac() throws IOException {
- byte[] b = new byte[TYPE_LEN_MAC];
- read(b);
- return b;
- }
-
- public BigInteger readBigInt() throws IOException {
- byte[] b = readData();
- return new BigInteger(1, b);
- }
-
- public byte[] readData() throws IOException {
- int dataLen = readNumber(DATA_LEN);
- byte[] b = new byte[dataLen];
- read(b);
- return b;
- }
-
- public PublicKey readPublicKey() throws IOException {
- int type = readShort();
- switch (type) {
- case 0:
- BigInteger p = readBigInt();
- BigInteger q = readBigInt();
- BigInteger g = readBigInt();
- BigInteger y = readBigInt();
- DSAPublicKeySpec keySpec = new DSAPublicKeySpec(y, p, q, g);
- KeyFactory keyFactory;
- try {
- keyFactory = KeyFactory.getInstance("DSA");
- } catch (NoSuchAlgorithmException e) {
- throw new IOException();
- }
- try {
- return keyFactory.generatePublic(keySpec);
- } catch (InvalidKeySpecException e) {
- throw new IOException();
- }
- default:
- throw new UnsupportedOperationException();
- }
- }
-
- public DHPublicKey readDHPublicKey() throws IOException {
- BigInteger gyMpi = readBigInt();
- try {
- return new OtrCryptoEngineImpl().getDHPublicKey(gyMpi);
- } catch (Exception ex) {
- throw new IOException();
- }
- }
-
- public byte[] readTlvData() throws IOException {
- int len = readNumber(TYPE_LEN_BYTE);
-
- byte[] b = new byte[len];
- in.read(b);
- return b;
- }
-
- public byte[] readSignature(PublicKey pubKey) throws IOException {
- if (!pubKey.getAlgorithm().equals("DSA"))
- throw new UnsupportedOperationException();
-
- DSAPublicKey dsaPubKey = (DSAPublicKey) pubKey;
- DSAParams dsaParams = dsaPubKey.getParams();
- byte[] sig = new byte[dsaParams.getQ().bitLength() / 4];
- read(sig);
- return sig;
- }
-
- public SignatureX readMysteriousX() throws IOException {
- PublicKey pubKey = readPublicKey();
- int dhKeyID = readInt();
- byte[] sig = readSignature(pubKey);
- return new SignatureX(pubKey, dhKeyID, sig);
- }
-}
--- a/src/net/java/otr4j/io/OtrOutputStream.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-package net.java.otr4j.io;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.math.BigInteger;
-import java.security.PublicKey;
-import java.security.interfaces.DSAParams;
-import java.security.interfaces.DSAPublicKey;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-import net.java.otr4j.io.messages.SignatureM;
-import net.java.otr4j.io.messages.MysteriousT;
-import net.java.otr4j.io.messages.SignatureX;
-
-import org.bouncycastle2.util.BigIntegers;
-
-public class OtrOutputStream extends FilterOutputStream implements
- SerializationConstants {
-
- public OtrOutputStream(OutputStream out) {
- super(out);
- }
-
- private void writeNumber(int value, int length) throws IOException {
- byte[] b = new byte[length];
- for (int i = 0; i < length; i++) {
- int offset = (b.length - 1 - i) * 8;
- b[i] = (byte) ((value >>> offset) & 0xFF);
- }
- write(b);
- }
-
- public void writeBigInt(BigInteger bi) throws IOException {
- byte[] b = BigIntegers.asUnsignedByteArray(bi);
- writeData(b);
- }
-
- public void writeByte(int b) throws IOException {
- writeNumber(b, TYPE_LEN_BYTE);
- }
-
- public void writeData(byte[] b) throws IOException {
- int len = (b == null || b.length < 0) ? 0 : b.length;
- writeNumber(len, DATA_LEN);
- if (len > 0)
- write(b);
- }
-
- public void writeInt(int i) throws IOException {
- writeNumber(i, TYPE_LEN_INT);
-
- }
-
- public void writeShort(int s) throws IOException {
- writeNumber(s, TYPE_LEN_SHORT);
-
- }
-
- public void writeMac(byte[] mac) throws IOException {
- if (mac == null || mac.length != TYPE_LEN_MAC)
- throw new IllegalArgumentException();
-
- write(mac);
- }
-
- public void writeCtr(byte[] ctr) throws IOException {
- if (ctr == null || ctr.length < 1)
- return;
-
- int i = 0;
- while (i < TYPE_LEN_CTR && i < ctr.length) {
- write(ctr[i]);
- i++;
- }
- }
-
- public void writeDHPublicKey(DHPublicKey dhPublicKey) throws IOException {
- byte[] b = BigIntegers.asUnsignedByteArray(dhPublicKey.getY());
- writeData(b);
- }
-
- public void writePublicKey(PublicKey pubKey) throws IOException {
- if (!(pubKey instanceof DSAPublicKey))
- throw new UnsupportedOperationException(
- "Key types other than DSA are not supported at the moment.");
-
- DSAPublicKey dsaKey = (DSAPublicKey) pubKey;
-
- writeShort(0);
-
- DSAParams dsaParams = dsaKey.getParams();
- writeBigInt(dsaParams.getP());
- writeBigInt(dsaParams.getQ());
- writeBigInt(dsaParams.getG());
- writeBigInt(dsaKey.getY());
-
- }
-
- public void writeTlvData(byte[] b) throws IOException {
- int len = (b == null || b.length < 0) ? 0 : b.length;
- writeNumber(len, TLV_LEN);
- if (len > 0)
- write(b);
- }
-
- public void writeSignature(byte[] signature, PublicKey pubKey)
- throws IOException {
- if (!pubKey.getAlgorithm().equals("DSA"))
- throw new UnsupportedOperationException();
- out.write(signature);
- }
-
- public void writeMysteriousX(SignatureX x) throws IOException {
- writePublicKey(x.longTermPublicKey);
- writeInt(x.dhKeyID);
- writeSignature(x.signature, x.longTermPublicKey);
- }
-
- public void writeMysteriousX(SignatureM m) throws IOException {
- writeBigInt(m.localPubKey.getY());
- writeBigInt(m.remotePubKey.getY());
- writePublicKey(m.localLongTermPubKey);
- writeInt(m.keyPairID);
- }
-
- public void writeMysteriousT(MysteriousT t) throws IOException {
- writeShort(t.protocolVersion);
- writeByte(t.messageType);
- writeByte(t.flags);
-
- writeInt(t.senderKeyID);
- writeInt(t.recipientKeyID);
- writeDHPublicKey(t.nextDH);
- writeCtr(t.ctr);
- writeData(t.encryptedMessage);
-
- }
-}
--- a/src/net/java/otr4j/io/SerializationConstants.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io;
-
-/**
- *
- * @author George Politis
- */
-public interface SerializationConstants {
-
- public static final String HEAD = "?OTR";
- public static final char HEAD_ENCODED = ':';
- public static final char HEAD_ERROR = ' ';
- public static final char HEAD_QUERY_Q = '?';
- public static final char HEAD_QUERY_V = 'v';
-
- public static final int TYPE_LEN_BYTE = 1;
- public static final int TYPE_LEN_SHORT = 2;
- public static final int TYPE_LEN_INT = 4;
- public static final int TYPE_LEN_MAC = 20;
- public static final int TYPE_LEN_CTR = 8;
-
- public static final int DATA_LEN = TYPE_LEN_INT;
- public static final int TLV_LEN = TYPE_LEN_SHORT;
-}
--- a/src/net/java/otr4j/io/SerializationUtils.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,341 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.math.BigInteger;
-import java.security.PublicKey;
-import java.util.List;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-import org.bouncycastle2.util.encoders.Base64;
-
-import net.java.otr4j.io.messages.AbstractEncodedMessage;
-import net.java.otr4j.io.messages.AbstractMessage;
-import net.java.otr4j.io.messages.DHCommitMessage;
-import net.java.otr4j.io.messages.DHKeyMessage;
-import net.java.otr4j.io.messages.DataMessage;
-import net.java.otr4j.io.messages.ErrorMessage;
-import net.java.otr4j.io.messages.MysteriousT;
-import net.java.otr4j.io.messages.PlainTextMessage;
-import net.java.otr4j.io.messages.QueryMessage;
-import net.java.otr4j.io.messages.RevealSignatureMessage;
-import net.java.otr4j.io.messages.SignatureM;
-import net.java.otr4j.io.messages.SignatureMessage;
-import net.java.otr4j.io.messages.SignatureX;
-
-/**
- *
- * @author George Politis
- */
-public class SerializationUtils {
- // Mysterious X IO.
- public static SignatureX toMysteriousX(byte[] b) throws IOException {
- ByteArrayInputStream in = new ByteArrayInputStream(b);
- OtrInputStream ois = new OtrInputStream(in);
- SignatureX x = ois.readMysteriousX();
- ois.close();
- return x;
- }
-
- public static byte[] toByteArray(SignatureX x) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- OtrOutputStream oos = new OtrOutputStream(out);
- oos.writeMysteriousX(x);
- byte[] b = out.toByteArray();
- oos.close();
- return b;
- }
-
- // Mysterious M IO.
- public static byte[] toByteArray(SignatureM m) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- OtrOutputStream oos = new OtrOutputStream(out);
- oos.writeMysteriousX(m);
- byte[] b = out.toByteArray();
- oos.close();
- return b;
- }
-
- // Mysterious T IO.
- public static byte[] toByteArray(MysteriousT t) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- OtrOutputStream oos = new OtrOutputStream(out);
- oos.writeMysteriousT(t);
- byte[] b = out.toByteArray();
- oos.close();
- return b;
- }
-
- // Basic IO.
- public static byte[] writeData(byte[] b) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- OtrOutputStream oos = new OtrOutputStream(out);
- oos.writeData(b);
- byte[] otrb = out.toByteArray();
- oos.close();
- return otrb;
- }
-
- // BigInteger IO.
- public static byte[] writeMpi(BigInteger bigInt) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- OtrOutputStream oos = new OtrOutputStream(out);
- oos.writeBigInt(bigInt);
- byte[] b = out.toByteArray();
- oos.close();
- return b;
- }
-
- public static BigInteger readMpi(byte[] b) throws IOException {
- ByteArrayInputStream in = new ByteArrayInputStream(b);
- OtrInputStream ois = new OtrInputStream(in);
- BigInteger bigint = ois.readBigInt();
- ois.close();
- return bigint;
- }
-
- // Public Key IO.
- public static byte[] writePublicKey(PublicKey pubKey) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- OtrOutputStream oos = new OtrOutputStream(out);
- oos.writePublicKey(pubKey);
- byte[] b = out.toByteArray();
- oos.close();
- return b;
- }
-
- // Message IO.
- public static String toString(AbstractMessage m) throws IOException {
- StringWriter writer = new StringWriter();
- writer.write(SerializationConstants.HEAD);
-
- switch (m.messageType) {
- case AbstractMessage.MESSAGE_ERROR:
- ErrorMessage error = (ErrorMessage) m;
- writer.write(SerializationConstants.HEAD_ERROR);
- writer.write(error.error);
- break;
- case AbstractMessage.MESSAGE_PLAINTEXT:
- PlainTextMessage plaintxt = (PlainTextMessage) m;
- writer.write(plaintxt.cleanText);
- if (plaintxt.versions != null && plaintxt.versions.size() > 0) {
- writer.write(" \\t \\t\\t\\t\\t \\t \\t \\t ");
- for (int version : plaintxt.versions) {
- if (version == 1)
- writer.write(" \\t\\t \\t ");
-
- if (version == 2)
- writer.write(" \\t \\t \\t ");
- }
- }
- break;
- case AbstractMessage.MESSAGE_QUERY:
- QueryMessage query = (QueryMessage) m;
- if (query.versions.size() == 1 && query.versions.get(0) == 1) {
- writer.write(SerializationConstants.HEAD_QUERY_Q);
- } else {
- writer.write(SerializationConstants.HEAD_QUERY_V);
- for (int version : query.versions)
- writer.write(String.valueOf(version));
-
- writer.write(SerializationConstants.HEAD_QUERY_Q);
- }
- break;
- case AbstractEncodedMessage.MESSAGE_DHKEY:
- case AbstractEncodedMessage.MESSAGE_REVEALSIG:
- case AbstractEncodedMessage.MESSAGE_SIGNATURE:
- case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
- case AbstractEncodedMessage.MESSAGE_DATA:
- ByteArrayOutputStream o = new ByteArrayOutputStream();
- OtrOutputStream s = new OtrOutputStream(o);
-
- switch (m.messageType) {
- case AbstractEncodedMessage.MESSAGE_DHKEY:
- DHKeyMessage dhkey = (DHKeyMessage) m;
- s.writeShort(dhkey.protocolVersion);
- s.writeByte(dhkey.messageType);
- s.writeDHPublicKey(dhkey.dhPublicKey);
- break;
- case AbstractEncodedMessage.MESSAGE_REVEALSIG:
- RevealSignatureMessage revealsig = (RevealSignatureMessage) m;
- s.writeShort(revealsig.protocolVersion);
- s.writeByte(revealsig.messageType);
- s.writeData(revealsig.revealedKey);
- s.writeData(revealsig.xEncrypted);
- s.writeMac(revealsig.xEncryptedMAC);
- break;
- case AbstractEncodedMessage.MESSAGE_SIGNATURE:
- SignatureMessage sig = (SignatureMessage) m;
- s.writeShort(sig.protocolVersion);
- s.writeByte(sig.messageType);
- s.writeData(sig.xEncrypted);
- s.writeMac(sig.xEncryptedMAC);
- break;
- case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
- DHCommitMessage dhcommit = (DHCommitMessage) m;
- s.writeShort(dhcommit.protocolVersion);
- s.writeByte(dhcommit.messageType);
- s.writeData(dhcommit.dhPublicKeyEncrypted);
- s.writeData(dhcommit.dhPublicKeyHash);
- break;
- case AbstractEncodedMessage.MESSAGE_DATA:
- DataMessage data = (DataMessage) m;
- s.writeShort(data.protocolVersion);
- s.writeByte(data.messageType);
- s.writeByte(data.flags);
- s.writeInt(data.senderKeyID);
- s.writeInt(data.recipientKeyID);
- s.writeDHPublicKey(data.nextDH);
- s.writeCtr(data.ctr);
- s.writeData(data.encryptedMessage);
- s.writeMac(data.mac);
- s.writeData(data.oldMACKeys);
- break;
- }
-
- writer.write(SerializationConstants.HEAD_ENCODED);
- writer.write(new String(Base64.encode(o.toByteArray())));
- writer.write(".");
- break;
- default:
- throw new IOException("Illegal message type.");
- }
-
- return writer.toString();
- }
-
- static final Pattern patternWhitespace = Pattern
- .compile("( \\t \\t\\t\\t\\t \\t \\t \\t )( \\t\\t \\t )?( \\t \\t \\t )?");
-
- public static AbstractMessage toMessage(String s) throws IOException {
- if (s == null || s.length() <= 1)
- return null;
-
- if (s.indexOf(SerializationConstants.HEAD) != 0
- || s.length() <= SerializationConstants.HEAD.length()) {
- // Try to detect whitespace tag.
- final Matcher matcher = patternWhitespace.matcher(s);
-
- boolean v1 = false;
- boolean v2 = false;
- while (matcher.find()) {
- if (!v1 && matcher.start(2) > -1)
- v1 = true;
-
- if (!v2 && matcher.start(3) > -1)
- v2 = true;
-
- if (v1 && v2)
- break;
- }
-
- String cleanText = matcher.replaceAll("");
- List<Integer> versions;
- if (v1 && v2) {
- versions = new Vector<Integer>(2);
- versions.add(0, 1);
- versions.add(0, 2);
- } else if (v1) {
- versions = new Vector<Integer>(1);
- versions.add(0, 1);
- } else if (v2) {
- versions = new Vector<Integer>(1);
- versions.add(2);
- } else
- versions = null;
-
- return new PlainTextMessage(versions, cleanText);
- } else {
- char contentType = s.charAt(SerializationConstants.HEAD.length());
- String content = s
- .substring(SerializationConstants.HEAD.length() + 1);
- switch (contentType) {
- case SerializationConstants.HEAD_ENCODED:
- ByteArrayInputStream bin = new ByteArrayInputStream(Base64
- .decode(content.getBytes()));
- OtrInputStream otr = new OtrInputStream(bin);
- // We have an encoded message.
- int protocolVersion = otr.readShort();
- int messageType = otr.readByte();
- switch (messageType) {
- case AbstractEncodedMessage.MESSAGE_DATA:
- int flags = otr.readByte();
- int senderKeyID = otr.readInt();
- int recipientKeyID = otr.readInt();
- DHPublicKey nextDH = otr.readDHPublicKey();
- byte[] ctr = otr.readCtr();
- byte[] encryptedMessage = otr.readData();
- byte[] mac = otr.readMac();
- byte[] oldMacKeys = otr.readMac();
- return new DataMessage(protocolVersion, flags, senderKeyID,
- recipientKeyID, nextDH, ctr, encryptedMessage, mac,
- oldMacKeys);
- case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
- byte[] dhPublicKeyEncrypted = otr.readData();
- byte[] dhPublicKeyHash = otr.readData();
- return new DHCommitMessage(protocolVersion,
- dhPublicKeyHash, dhPublicKeyEncrypted);
- case AbstractEncodedMessage.MESSAGE_DHKEY:
- DHPublicKey dhPublicKey = otr.readDHPublicKey();
- return new DHKeyMessage(protocolVersion, dhPublicKey);
- case AbstractEncodedMessage.MESSAGE_REVEALSIG: {
- byte[] revealedKey = otr.readData();
- byte[] xEncrypted = otr.readData();
- byte[] xEncryptedMac = otr.readMac();
- return new RevealSignatureMessage(protocolVersion,
- xEncrypted, xEncryptedMac, revealedKey);
- }
- case AbstractEncodedMessage.MESSAGE_SIGNATURE: {
- byte[] xEncryted = otr.readData();
- byte[] xEncryptedMac = otr.readMac();
- return new SignatureMessage(protocolVersion, xEncryted,
- xEncryptedMac);
- }
- default:
- throw new IOException("Illegal message type.");
- }
- case SerializationConstants.HEAD_ERROR:
- return new ErrorMessage(AbstractMessage.MESSAGE_ERROR, content);
- case SerializationConstants.HEAD_QUERY_V:
- case SerializationConstants.HEAD_QUERY_Q:
- List<Integer> versions = new Vector<Integer>();
- String versionString = null;
- if (SerializationConstants.HEAD_QUERY_Q == contentType) {
- versions.add(1);
- if (content.charAt(0) == 'v') {
- versionString = content.substring(1, content
- .indexOf('?'));
- }
- } else if (SerializationConstants.HEAD_QUERY_V == contentType) {
- versionString = content.substring(0, content.indexOf('?'));
- }
-
- if (versionString != null) {
- StringReader sr = new StringReader(versionString);
- int c;
- while ((c = sr.read()) != -1)
- if (!versions.contains(c))
- versions.add(Integer.parseInt(String
- .valueOf((char) c)));
- }
- QueryMessage query = new QueryMessage(versions);
- return query;
- default:
- throw new IOException("Uknown message type.");
- }
- }
- }
-}
--- a/src/net/java/otr4j/io/messages/AbstractEncodedMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-/**
- *
- * @author George Politis
- */
-public abstract class AbstractEncodedMessage extends AbstractMessage {
- // Fields.
- public int protocolVersion;
-
- // Ctor.
- public AbstractEncodedMessage(int messageType, int protocolVersion) {
- super(messageType);
- this.protocolVersion = protocolVersion;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + protocolVersion;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- AbstractEncodedMessage other = (AbstractEncodedMessage) obj;
- if (protocolVersion != other.protocolVersion)
- return false;
- return true;
- }
-
- // Encoded Message Types
- public static final int MESSAGE_DH_COMMIT = 0x02;
- public static final int MESSAGE_DATA = 0x03;
- public static final int MESSAGE_DHKEY = 0x0a;
- public static final int MESSAGE_REVEALSIG = 0x11;
- public static final int MESSAGE_SIGNATURE = 0x12;
-}
--- a/src/net/java/otr4j/io/messages/AbstractMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-/**
- *
- * @author George Politis
- */
-public abstract class AbstractMessage {
- // Fields.
- public int messageType;
-
- // Ctor.
- public AbstractMessage(int messageType) {
- this.messageType = messageType;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + messageType;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- AbstractMessage other = (AbstractMessage) obj;
- if (messageType != other.messageType)
- return false;
- return true;
- }
-
- // Unencoded
- public static final int MESSAGE_ERROR = 0xff;
- public static final int MESSAGE_QUERY = 0x100;
- public static final int MESSAGE_PLAINTEXT = 0x102;
-}
--- a/src/net/java/otr4j/io/messages/DHCommitMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import java.util.Arrays;
-
-/**
- *
- * @author George Politis
- */
-public class DHCommitMessage extends AbstractEncodedMessage {
-
- // Fields.
- public byte[] dhPublicKeyEncrypted;
- public byte[] dhPublicKeyHash;
-
- // Ctor.
- public DHCommitMessage(int protocolVersion, byte[] dhPublicKeyHash,
- byte[] dhPublicKeyEncrypted) {
- super(MESSAGE_DH_COMMIT, protocolVersion);
- this.dhPublicKeyEncrypted = dhPublicKeyEncrypted;
- this.dhPublicKeyHash = dhPublicKeyHash;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + Arrays.hashCode(dhPublicKeyEncrypted);
- result = prime * result + Arrays.hashCode(dhPublicKeyHash);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- DHCommitMessage other = (DHCommitMessage) obj;
- if (!Arrays.equals(dhPublicKeyEncrypted, other.dhPublicKeyEncrypted))
- return false;
- if (!Arrays.equals(dhPublicKeyHash, other.dhPublicKeyHash))
- return false;
- return true;
- }
-
-}
--- a/src/net/java/otr4j/io/messages/DHKeyMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-/**
- *
- * @author George Politis
- */
-public class DHKeyMessage extends AbstractEncodedMessage {
-
- // Fields.
- public DHPublicKey dhPublicKey;
-
- // Ctor.
- public DHKeyMessage(int protocolVersion, DHPublicKey dhPublicKey) {
- super(MESSAGE_DHKEY, protocolVersion);
- this.dhPublicKey = dhPublicKey;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- // TODO: Needs work.
- result = prime * result
- + ((dhPublicKey == null) ? 0 : dhPublicKey.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- DHKeyMessage other = (DHKeyMessage) obj;
- if (dhPublicKey == null) {
- if (other.dhPublicKey != null)
- return false;
- } else if (dhPublicKey.getY().compareTo(other.dhPublicKey.getY()) != 0)
- return false;
- return true;
- }
-}
--- a/src/net/java/otr4j/io/messages/DataMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import java.util.Arrays;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-/**
- *
- * @author George Politis
- */
-public class DataMessage extends AbstractEncodedMessage {
-
- // Fields.
- public byte[] mac;
- public byte[] oldMACKeys;
-
- public int flags;
- public int senderKeyID;
- public int recipientKeyID;
- public DHPublicKey nextDH;
- public byte[] ctr;
- public byte[] encryptedMessage;
-
- // Ctor.
- public DataMessage(int protocolVersion, int flags, int senderKeyID,
- int recipientKeyID, DHPublicKey nextDH, byte[] ctr,
- byte[] encryptedMessage, byte[] mac, byte[] oldMacKeys) {
- super(MESSAGE_DATA, protocolVersion);
-
- this.flags = flags;
- this.senderKeyID = senderKeyID;
- this.recipientKeyID = recipientKeyID;
- this.nextDH = nextDH;
- this.ctr = ctr;
- this.encryptedMessage = encryptedMessage;
- this.mac = mac;
- this.oldMACKeys = oldMacKeys;
- }
-
- public DataMessage(MysteriousT t, byte[] mac, byte[] oldMacKeys) {
- this(t.protocolVersion, t.flags, t.senderKeyID, t.recipientKeyID,
- t.nextDH, t.ctr, t.encryptedMessage, mac, oldMacKeys);
- }
-
- // Methods.
- public MysteriousT getT() {
- return new MysteriousT(protocolVersion, flags, senderKeyID,
- recipientKeyID, nextDH, ctr, encryptedMessage);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + Arrays.hashCode(ctr);
- result = prime * result + Arrays.hashCode(encryptedMessage);
- result = prime * result + flags;
- result = prime * result + Arrays.hashCode(mac);
- // TODO: Needs work.
- result = prime * result + ((nextDH == null) ? 0 : nextDH.hashCode());
- result = prime * result + Arrays.hashCode(oldMACKeys);
- result = prime * result + recipientKeyID;
- result = prime * result + senderKeyID;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- DataMessage other = (DataMessage) obj;
- if (!Arrays.equals(ctr, other.ctr))
- return false;
- if (!Arrays.equals(encryptedMessage, other.encryptedMessage))
- return false;
- if (flags != other.flags)
- return false;
- if (!Arrays.equals(mac, other.mac))
- return false;
- if (nextDH == null) {
- if (other.nextDH != null)
- return false;
- } else if (!nextDH.equals(other.nextDH))
- return false;
- if (!Arrays.equals(oldMACKeys, other.oldMACKeys))
- return false;
- if (recipientKeyID != other.recipientKeyID)
- return false;
- if (senderKeyID != other.senderKeyID)
- return false;
- return true;
- }
-}
--- a/src/net/java/otr4j/io/messages/ErrorMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-/**
- *
- * @author George Politis
- */
-public class ErrorMessage extends AbstractMessage {
- // Fields.
- public String error;
-
- // Ctor.
- public ErrorMessage(int messageType, String error) {
- super(messageType);
- this.error = error;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((error == null) ? 0 : error.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- ErrorMessage other = (ErrorMessage) obj;
- if (error == null) {
- if (other.error != null)
- return false;
- } else if (!error.equals(other.error))
- return false;
- return true;
- }
-}
--- a/src/net/java/otr4j/io/messages/MysteriousT.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-package net.java.otr4j.io.messages;
-
-import java.util.Arrays;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-public class MysteriousT {
- // Fields.
- public int protocolVersion;
- public int messageType;
- public int flags;
- public int senderKeyID;
- public int recipientKeyID;
- public DHPublicKey nextDH;
- public byte[] ctr;
- public byte[] encryptedMessage;
-
- // Ctor.
- public MysteriousT(int protocolVersion, int flags, int senderKeyID,
- int recipientKeyID, DHPublicKey nextDH, byte[] ctr,
- byte[] encryptedMessage) {
-
- this.protocolVersion = protocolVersion;
- this.messageType = AbstractEncodedMessage.MESSAGE_DATA;
- this.flags = flags;
- this.senderKeyID = senderKeyID;
- this.recipientKeyID = recipientKeyID;
- this.nextDH = nextDH;
- this.ctr = ctr;
- this.encryptedMessage = encryptedMessage;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- // TODO: Needs work.
- final int prime = 31;
- int result = 1;
- result = prime * result + Arrays.hashCode(ctr);
- result = prime * result + Arrays.hashCode(encryptedMessage);
- result = prime * result + flags;
- result = prime * result + messageType;
- result = prime * result + ((nextDH == null) ? 0 : nextDH.hashCode());
- result = prime * result + protocolVersion;
- result = prime * result + recipientKeyID;
- result = prime * result + senderKeyID;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- // TODO: Needs work.
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- MysteriousT other = (MysteriousT) obj;
- if (!Arrays.equals(ctr, other.ctr))
- return false;
- if (!Arrays.equals(encryptedMessage, other.encryptedMessage))
- return false;
- if (flags != other.flags)
- return false;
- if (messageType != other.messageType)
- return false;
- if (nextDH == null) {
- if (other.nextDH != null)
- return false;
- } else if (!nextDH.equals(other.nextDH))
- return false;
- if (protocolVersion != other.protocolVersion)
- return false;
- if (recipientKeyID != other.recipientKeyID)
- return false;
- if (senderKeyID != other.senderKeyID)
- return false;
- return true;
- }
-
-}
--- a/src/net/java/otr4j/io/messages/PlainTextMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import java.util.List;
-
-/**
- *
- * @author George Politis
- */
-public class PlainTextMessage extends QueryMessage {
- // Fields.
- public String cleanText;
-
- // Ctor.
- public PlainTextMessage(List<Integer> versions, String cleanText) {
- super(MESSAGE_PLAINTEXT, versions);
- this.cleanText = cleanText;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result
- + ((cleanText == null) ? 0 : cleanText.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- PlainTextMessage other = (PlainTextMessage) obj;
- if (cleanText == null) {
- if (other.cleanText != null)
- return false;
- } else if (!cleanText.equals(other.cleanText))
- return false;
- return true;
- }
-
-}
--- a/src/net/java/otr4j/io/messages/QueryMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import java.util.List;
-
-/**
- *
- * @author George Politis
- */
-public class QueryMessage extends AbstractMessage {
- // Fields.
- public List<Integer> versions;
-
- // Ctor.
- protected QueryMessage(int messageType, List<Integer> versions) {
- super(messageType);
- this.versions = versions;
- }
-
- public QueryMessage(List<Integer> versions) {
- this(MESSAGE_QUERY, versions);
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result
- + ((versions == null) ? 0 : versions.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- QueryMessage other = (QueryMessage) obj;
- if (versions == null) {
- if (other.versions != null)
- return false;
- } else if (!versions.equals(other.versions))
- return false;
- return true;
- }
-
-}
--- a/src/net/java/otr4j/io/messages/RevealSignatureMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import java.util.Arrays;
-
-/**
- *
- * @author George Politis
- */
-public class RevealSignatureMessage extends SignatureMessage {
- // Fields.
- public byte[] revealedKey;
-
- // Ctor.
- public RevealSignatureMessage(int protocolVersion, byte[] xEncrypted,
- byte[] xEncryptedMAC, byte[] revealedKey) {
- super(MESSAGE_REVEALSIG, protocolVersion, xEncrypted, xEncryptedMAC);
-
- this.revealedKey = revealedKey;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + Arrays.hashCode(revealedKey);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- RevealSignatureMessage other = (RevealSignatureMessage) obj;
- if (!Arrays.equals(revealedKey, other.revealedKey))
- return false;
- return true;
- }
-}
--- a/src/net/java/otr4j/io/messages/SignatureM.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import java.security.PublicKey;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-/**
- *
- * @author George Politis
- */
-public class SignatureM {
- // Fields.
- public DHPublicKey localPubKey;
- public DHPublicKey remotePubKey;
- public PublicKey localLongTermPubKey;
- public int keyPairID;
-
- // Ctor.
- public SignatureM(DHPublicKey localPubKey, DHPublicKey remotePublicKey,
- PublicKey localLongTermPublicKey, int keyPairID) {
-
- this.localPubKey = localPubKey;
- this.remotePubKey = remotePublicKey;
- this.localLongTermPubKey = localLongTermPublicKey;
- this.keyPairID = keyPairID;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + keyPairID;
- // TODO: Needs work.
- result = prime
- * result
- + ((localLongTermPubKey == null) ? 0 : localLongTermPubKey
- .hashCode());
- result = prime * result
- + ((localPubKey == null) ? 0 : localPubKey.hashCode());
- result = prime * result
- + ((remotePubKey == null) ? 0 : remotePubKey.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- // TODO: Needs work.
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- SignatureM other = (SignatureM) obj;
- if (keyPairID != other.keyPairID)
- return false;
- if (localLongTermPubKey == null) {
- if (other.localLongTermPubKey != null)
- return false;
- } else if (!localLongTermPubKey.equals(other.localLongTermPubKey))
- return false;
- if (localPubKey == null) {
- if (other.localPubKey != null)
- return false;
- } else if (!localPubKey.equals(other.localPubKey))
- return false;
- if (remotePubKey == null) {
- if (other.remotePubKey != null)
- return false;
- } else if (!remotePubKey.equals(other.remotePubKey))
- return false;
- return true;
- }
-
-}
--- a/src/net/java/otr4j/io/messages/SignatureMessage.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-import net.java.otr4j.OtrException;
-import net.java.otr4j.crypto.OtrCryptoEngineImpl;
-import net.java.otr4j.io.SerializationUtils;
-
-/**
- *
- * @author George Politis
- */
-public class SignatureMessage extends AbstractEncodedMessage {
- // Fields.
- public byte[] xEncrypted;
- public byte[] xEncryptedMAC;
-
- // Ctor.
- protected SignatureMessage(int messageType, int protocolVersion,
- byte[] xEncrypted, byte[] xEncryptedMAC) {
- super(messageType, protocolVersion);
- this.xEncrypted = xEncrypted;
- this.xEncryptedMAC = xEncryptedMAC;
- }
-
- public SignatureMessage(int protocolVersion, byte[] xEncrypted,
- byte[] xEncryptedMAC) {
- this(MESSAGE_SIGNATURE, protocolVersion, xEncrypted, xEncryptedMAC);
- }
-
- // Memthods.
- public byte[] decrypt(byte[] key) throws OtrException {
- return new OtrCryptoEngineImpl().aesDecrypt(key, null, xEncrypted);
- }
-
- public boolean verify(byte[] key) throws OtrException {
- // Hash the key.
- byte[] xbEncrypted;
- try {
- xbEncrypted = SerializationUtils.writeData(xEncrypted);
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- byte[] xEncryptedMAC = new OtrCryptoEngineImpl().sha256Hmac160(
- xbEncrypted, key);
- // Verify signature.
- return Arrays.equals(xEncryptedMAC, xEncryptedMAC);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + Arrays.hashCode(xEncrypted);
- result = prime * result + Arrays.hashCode(xEncryptedMAC);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- SignatureMessage other = (SignatureMessage) obj;
- if (!Arrays.equals(xEncrypted, other.xEncrypted))
- return false;
- if (!Arrays.equals(xEncryptedMAC, other.xEncryptedMAC))
- return false;
- return true;
- }
-}
--- a/src/net/java/otr4j/io/messages/SignatureX.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.io.messages;
-
-import java.security.PublicKey;
-import java.util.Arrays;
-
-/**
- *
- * @author George Politis
- */
-public class SignatureX {
- // Fields.
- public PublicKey longTermPublicKey;
- public int dhKeyID;
- public byte[] signature;
-
- // Ctor.
- public SignatureX(PublicKey ourLongTermPublicKey, int ourKeyID,
- byte[] signature) {
- this.longTermPublicKey = ourLongTermPublicKey;
- this.dhKeyID = ourKeyID;
- this.signature = signature;
- }
-
- // Methods.
- @Override
- public int hashCode() {
- // TODO: Needs work.
- final int prime = 31;
- int result = 1;
- result = prime * result + dhKeyID;
- result = prime
- * result
- + ((longTermPublicKey == null) ? 0 : longTermPublicKey
- .hashCode());
- result = prime * result + Arrays.hashCode(signature);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- // TODO: Needs work.
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- SignatureX other = (SignatureX) obj;
- if (dhKeyID != other.dhKeyID)
- return false;
- if (longTermPublicKey == null) {
- if (other.longTermPublicKey != null)
- return false;
- } else if (!longTermPublicKey.equals(other.longTermPublicKey))
- return false;
- if (!Arrays.equals(signature, other.signature))
- return false;
- return true;
- }
-
-}
--- a/src/net/java/otr4j/session/AuthContext.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.session;
-
-import java.math.BigInteger;
-import java.security.KeyPair;
-import java.security.PublicKey;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-import net.java.otr4j.OtrException;
-import net.java.otr4j.io.messages.AbstractMessage;
-
-/**
- *
- * @author George Politis
- */
-interface AuthContext {
-
- public static final int NONE = 0;
- public static final int AWAITING_DHKEY = 1;
- public static final int AWAITING_REVEALSIG = 2;
- public static final int AWAITING_SIG = 3;
- public static final int V1_SETUP = 4;
- public static final byte C_START = (byte) 0x01;
- public static final byte M1_START = (byte) 0x02;
- public static final byte M2_START = (byte) 0x03;
- public static final byte M1p_START = (byte) 0x04;
- public static final byte M2p_START = (byte) 0x05;
-
- public abstract void reset();
-
- public abstract boolean getIsSecure();
-
- public abstract DHPublicKey getRemoteDHPublicKey();
-
- public abstract KeyPair getLocalDHKeyPair() throws OtrException;
-
- public abstract BigInteger getS() throws OtrException;
-
- public abstract void handleReceivingMessage(AbstractMessage m)
- throws OtrException;
-
- public abstract void startV2Auth() throws OtrException;
-
- public abstract void respondV2Auth() throws OtrException;
-
- public abstract PublicKey getRemoteLongTermPublicKey();
-
- public abstract KeyPair getLocalLongTermKeyPair();
-}
\ No newline at end of file
--- a/src/net/java/otr4j/session/AuthContextImpl.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,766 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.session;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-import java.security.KeyPair;
-import java.security.PublicKey;
-import java.util.Arrays;
-import java.util.Random;
-import java.util.Vector;
-import java.util.logging.Logger;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-import net.java.otr4j.OtrException;
-import net.java.otr4j.crypto.OtrCryptoEngine;
-import net.java.otr4j.crypto.OtrCryptoEngineImpl;
-import net.java.otr4j.io.SerializationUtils;
-import net.java.otr4j.io.messages.DHCommitMessage;
-import net.java.otr4j.io.messages.DHKeyMessage;
-import net.java.otr4j.io.messages.AbstractEncodedMessage;
-import net.java.otr4j.io.messages.AbstractMessage;
-import net.java.otr4j.io.messages.SignatureM;
-import net.java.otr4j.io.messages.SignatureX;
-import net.java.otr4j.io.messages.QueryMessage;
-import net.java.otr4j.io.messages.RevealSignatureMessage;
-import net.java.otr4j.io.messages.SignatureMessage;
-
-/**
- *
- * @author George Politis
- */
-class AuthContextImpl implements AuthContext {
-
- public AuthContextImpl(Session session) {
- this.setSession(session);
- this.reset();
- }
-
- private Session session;
-
- private int authenticationState;
- private byte[] r;
-
- private DHPublicKey remoteDHPublicKey;
- private byte[] remoteDHPublicKeyEncrypted;
- private byte[] remoteDHPublicKeyHash;
-
- private KeyPair localDHKeyPair;
- private int localDHPrivateKeyID;
- private byte[] localDHPublicKeyBytes;
- private byte[] localDHPublicKeyHash;
- private byte[] localDHPublicKeyEncrypted;
-
- private BigInteger s;
- private byte[] c;
- private byte[] m1;
- private byte[] m2;
- private byte[] cp;
- private byte[] m1p;
- private byte[] m2p;
-
- private KeyPair localLongTermKeyPair;
- private Boolean isSecure = false;
- private int protocolVersion;
-
- private int getProtocolVersion() {
- return this.protocolVersion;
- }
-
- private void setProtocolVersion(int protoVersion) {
- this.protocolVersion = protoVersion;
- }
-
- private static Logger logger = Logger.getLogger(AuthContextImpl.class
- .getName());
-
- class MessageFactory {
-
- private QueryMessage getQueryMessage() {
- Vector<Integer> versions = new Vector<Integer>();
- versions.add(2);
- return new QueryMessage(versions);
- }
-
- private DHCommitMessage getDHCommitMessage() throws OtrException {
- return new DHCommitMessage(getProtocolVersion(),
- getLocalDHPublicKeyHash(), getLocalDHPublicKeyEncrypted());
- }
-
- private DHKeyMessage getDHKeyMessage() throws OtrException {
- return new DHKeyMessage(getProtocolVersion(),
- (DHPublicKey) getLocalDHKeyPair().getPublic());
- }
-
- private RevealSignatureMessage getRevealSignatureMessage()
- throws OtrException {
- try {
- SignatureM m = new SignatureM((DHPublicKey) getLocalDHKeyPair()
- .getPublic(), getRemoteDHPublicKey(),
- getLocalLongTermKeyPair().getPublic(),
- getLocalDHKeyPairID());
-
- OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
- byte[] mhash = otrCryptoEngine.sha256Hmac(SerializationUtils
- .toByteArray(m), getM1());
- byte[] signature = otrCryptoEngine.sign(mhash,
- getLocalLongTermKeyPair().getPrivate());
-
- SignatureX mysteriousX = new SignatureX(
- getLocalLongTermKeyPair().getPublic(),
- getLocalDHKeyPairID(), signature);
- byte[] xEncrypted = otrCryptoEngine.aesEncrypt(getC(), null,
- SerializationUtils.toByteArray(mysteriousX));
-
- byte[] tmp = SerializationUtils.writeData(xEncrypted);
-
- byte[] xEncryptedHash = otrCryptoEngine.sha256Hmac160(tmp,
- getM2());
- return new RevealSignatureMessage(getProtocolVersion(),
- xEncrypted, xEncryptedHash, getR());
- } catch (IOException e) {
- throw new OtrException(e);
- }
- }
-
- private SignatureMessage getSignatureMessage() throws OtrException {
- SignatureM m = new SignatureM((DHPublicKey) getLocalDHKeyPair()
- .getPublic(), getRemoteDHPublicKey(),
- getLocalLongTermKeyPair().getPublic(),
- getLocalDHKeyPairID());
-
- OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
- byte[] mhash;
- try {
- mhash = otrCryptoEngine.sha256Hmac(SerializationUtils
- .toByteArray(m), getM1p());
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- byte[] signature = otrCryptoEngine.sign(mhash,
- getLocalLongTermKeyPair().getPrivate());
-
- SignatureX mysteriousX = new SignatureX(getLocalLongTermKeyPair()
- .getPublic(), getLocalDHKeyPairID(), signature);
-
- byte[] xEncrypted;
- try {
- xEncrypted = otrCryptoEngine.aesEncrypt(getCp(), null,
- SerializationUtils.toByteArray(mysteriousX));
- byte[] tmp = SerializationUtils.writeData(xEncrypted);
- byte[] xEncryptedHash = otrCryptoEngine.sha256Hmac160(tmp,
- getM2p());
- return new SignatureMessage(getProtocolVersion(), xEncrypted,
- xEncryptedHash);
- } catch (IOException e) {
- throw new OtrException(e);
- }
- }
- }
-
- private MessageFactory messageFactory = new MessageFactory();
-
- public void reset() {
- logger.finest("Resetting authentication state.");
- authenticationState = AuthContext.NONE;
- r = null;
-
- remoteDHPublicKey = null;
- remoteDHPublicKeyEncrypted = null;
- remoteDHPublicKeyHash = null;
-
- localDHKeyPair = null;
- localDHPrivateKeyID = 1;
- localDHPublicKeyBytes = null;
- localDHPublicKeyHash = null;
- localDHPublicKeyEncrypted = null;
-
- s = null;
- c = m1 = m2 = cp = m1p = m2p = null;
-
- localLongTermKeyPair = null;
- protocolVersion = 0;
- setIsSecure(false);
- }
-
- private void setIsSecure(Boolean isSecure) {
- this.isSecure = isSecure;
- }
-
- public boolean getIsSecure() {
- return isSecure;
- }
-
- private void setAuthenticationState(int authenticationState) {
- this.authenticationState = authenticationState;
- }
-
- private int getAuthenticationState() {
- return authenticationState;
- }
-
- private byte[] getR() {
- if (r == null) {
- logger.finest("Picking random key r.");
- r = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
- new Random().nextBytes(r);
- }
- return r;
- }
-
- private void setRemoteDHPublicKey(DHPublicKey dhPublicKey) {
- // Verifies that Alice's gy is a legal value (2 <= gy <= modulus-2)
- if (dhPublicKey.getY().compareTo(OtrCryptoEngine.MODULUS_MINUS_TWO) > 0) {
- throw new IllegalArgumentException(
- "Illegal D-H Public Key value, Ignoring message.");
- } else if (dhPublicKey.getY().compareTo(OtrCryptoEngine.BIGINTEGER_TWO) < 0) {
- throw new IllegalArgumentException(
- "Illegal D-H Public Key value, Ignoring message.");
- }
- logger.finest("Received D-H Public Key is a legal value.");
-
- this.remoteDHPublicKey = dhPublicKey;
- }
-
- public DHPublicKey getRemoteDHPublicKey() {
- return remoteDHPublicKey;
- }
-
- private void setRemoteDHPublicKeyEncrypted(byte[] remoteDHPublicKeyEncrypted) {
- logger.finest("Storing encrypted remote public key.");
- this.remoteDHPublicKeyEncrypted = remoteDHPublicKeyEncrypted;
- }
-
- private byte[] getRemoteDHPublicKeyEncrypted() {
- return remoteDHPublicKeyEncrypted;
- }
-
- private void setRemoteDHPublicKeyHash(byte[] remoteDHPublicKeyHash) {
- logger.finest("Storing encrypted remote public key hash.");
- this.remoteDHPublicKeyHash = remoteDHPublicKeyHash;
- }
-
- private byte[] getRemoteDHPublicKeyHash() {
- return remoteDHPublicKeyHash;
- }
-
- public KeyPair getLocalDHKeyPair() throws OtrException {
- if (localDHKeyPair == null) {
- localDHKeyPair = new OtrCryptoEngineImpl().generateDHKeyPair();
- logger.finest("Generated local D-H key pair.");
- }
- return localDHKeyPair;
- }
-
- private int getLocalDHKeyPairID() {
- return localDHPrivateKeyID;
- }
-
- private byte[] getLocalDHPublicKeyHash() throws OtrException {
- if (localDHPublicKeyHash == null) {
- localDHPublicKeyHash = new OtrCryptoEngineImpl()
- .sha256Hash(getLocalDHPublicKeyBytes());
- logger.finest("Hashed local D-H public key.");
- }
- return localDHPublicKeyHash;
- }
-
- private byte[] getLocalDHPublicKeyEncrypted() throws OtrException {
- if (localDHPublicKeyEncrypted == null) {
- localDHPublicKeyEncrypted = new OtrCryptoEngineImpl().aesEncrypt(
- getR(), null, getLocalDHPublicKeyBytes());
- logger.finest("Encrypted our D-H public key.");
- }
- return localDHPublicKeyEncrypted;
- }
-
- public BigInteger getS() throws OtrException {
- if (s == null) {
- s = new OtrCryptoEngineImpl().generateSecret(this
- .getLocalDHKeyPair().getPrivate(), this
- .getRemoteDHPublicKey());
- logger.finest("Generated shared secret.");
- }
- return s;
- }
-
- private byte[] getC() throws OtrException {
- if (c != null)
- return c;
-
- byte[] h2 = h2(C_START);
- ByteBuffer buff = ByteBuffer.wrap(h2);
- this.c = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
- buff.get(this.c);
- logger.finest("Computed c.");
- return c;
-
- }
-
- private byte[] getM1() throws OtrException {
- if (m1 != null)
- return m1;
-
- byte[] h2 = h2(M1_START);
- ByteBuffer buff = ByteBuffer.wrap(h2);
- byte[] m1 = new byte[OtrCryptoEngine.SHA256_HMAC_KEY_BYTE_LENGTH];
- buff.get(m1);
- logger.finest("Computed m1.");
- this.m1 = m1;
- return m1;
- }
-
- private byte[] getM2() throws OtrException {
- if (m2 != null)
- return m2;
-
- byte[] h2 = h2(M2_START);
- ByteBuffer buff = ByteBuffer.wrap(h2);
- byte[] m2 = new byte[OtrCryptoEngine.SHA256_HMAC_KEY_BYTE_LENGTH];
- buff.get(m2);
- logger.finest("Computed m2.");
- this.m2 = m2;
- return m2;
- }
-
- private byte[] getCp() throws OtrException {
- if (cp != null)
- return cp;
-
- byte[] h2 = h2(C_START);
- ByteBuffer buff = ByteBuffer.wrap(h2);
- byte[] cp = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
- buff.position(OtrCryptoEngine.AES_KEY_BYTE_LENGTH);
- buff.get(cp);
- logger.finest("Computed c'.");
- this.cp = cp;
- return cp;
- }
-
- private byte[] getM1p() throws OtrException {
- if (m1p != null)
- return m1p;
-
- byte[] h2 = h2(M1p_START);
- ByteBuffer buff = ByteBuffer.wrap(h2);
- byte[] m1p = new byte[OtrCryptoEngine.SHA256_HMAC_KEY_BYTE_LENGTH];
- buff.get(m1p);
- this.m1p = m1p;
- logger.finest("Computed m1'.");
- return m1p;
- }
-
- private byte[] getM2p() throws OtrException {
- if (m2p != null)
- return m2p;
-
- byte[] h2 = h2(M2p_START);
- ByteBuffer buff = ByteBuffer.wrap(h2);
- byte[] m2p = new byte[OtrCryptoEngine.SHA256_HMAC_KEY_BYTE_LENGTH];
- buff.get(m2p);
- this.m2p = m2p;
- logger.finest("Computed m2'.");
- return m2p;
- }
-
- public KeyPair getLocalLongTermKeyPair() {
- if (localLongTermKeyPair == null) {
- localLongTermKeyPair = getSession().getLocalKeyPair();
- }
- return localLongTermKeyPair;
- }
-
- private byte[] h2(byte b) throws OtrException {
- byte[] secbytes;
- try {
- secbytes = SerializationUtils.writeMpi(getS());
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- int len = secbytes.length + 1;
- ByteBuffer buff = ByteBuffer.allocate(len);
- buff.put(b);
- buff.put(secbytes);
- byte[] sdata = buff.array();
- return new OtrCryptoEngineImpl().sha256Hash(sdata);
- }
-
- private byte[] getLocalDHPublicKeyBytes() throws OtrException {
- if (localDHPublicKeyBytes == null) {
- try {
- this.localDHPublicKeyBytes = SerializationUtils
- .writeMpi(((DHPublicKey) getLocalDHKeyPair()
- .getPublic()).getY());
-
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- }
- return localDHPublicKeyBytes;
- }
-
- public void handleReceivingMessage(AbstractMessage m) throws OtrException {
-
- switch (m.messageType) {
- case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
- handleDHCommitMessage((DHCommitMessage) m);
- break;
- case AbstractEncodedMessage.MESSAGE_DHKEY:
- handleDHKeyMessage((DHKeyMessage) m);
- break;
- case AbstractEncodedMessage.MESSAGE_REVEALSIG:
- handleRevealSignatureMessage((RevealSignatureMessage) m);
- break;
- case AbstractEncodedMessage.MESSAGE_SIGNATURE:
- handleSignatureMessage((SignatureMessage) m);
- break;
- default:
- throw new UnsupportedOperationException();
- }
- }
-
- private void handleSignatureMessage(SignatureMessage m) throws OtrException {
- Session session = getSession();
- SessionID sessionID = session.getSessionID();
- logger.finest(sessionID.getAccountID()
- + " received a signature message from " + sessionID.getUserID()
- + " throught " + sessionID.getProtocolName() + ".");
- if (!session.getSessionPolicy().getAllowV2()) {
- logger.finest("Policy does not allow OTRv2, ignoring message.");
- return;
- }
-
- switch (this.getAuthenticationState()) {
- case AWAITING_SIG:
- // Verify MAC.
- if (!m.verify(this.getM2p())) {
- logger
- .finest("Signature MACs are not equal, ignoring message.");
- return;
- }
-
- // Decrypt X.
- byte[] remoteXDecrypted = m.decrypt(this.getCp());
- SignatureX remoteX;
- try {
- remoteX = SerializationUtils.toMysteriousX(remoteXDecrypted);
- } catch (IOException e) {
- throw new OtrException(e);
- }
- // Compute signature.
- PublicKey remoteLongTermPublicKey = remoteX.longTermPublicKey;
- SignatureM remoteM = new SignatureM(this.getRemoteDHPublicKey(),
- (DHPublicKey) this.getLocalDHKeyPair().getPublic(),
- remoteLongTermPublicKey, remoteX.dhKeyID);
- OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
- // Verify signature.
- byte[] signature;
- try {
- signature = otrCryptoEngine.sha256Hmac(SerializationUtils
- .toByteArray(remoteM), this.getM1p());
- } catch (IOException e) {
- throw new OtrException(e);
- }
- if (!otrCryptoEngine.verify(signature, remoteLongTermPublicKey,
- remoteX.signature)) {
- logger.finest("Signature verification failed.");
- return;
- }
-
- this.setIsSecure(true);
- this.setRemoteLongTermPublicKey(remoteLongTermPublicKey);
- break;
- default:
- logger
- .finest("We were not expecting a signature, ignoring message.");
- return;
- }
- }
-
- private void handleRevealSignatureMessage(RevealSignatureMessage m)
- throws OtrException {
- Session session = getSession();
- SessionID sessionID = session.getSessionID();
- logger.finest(sessionID.getAccountID()
- + " received a reveal signature message from "
- + sessionID.getUserID() + " throught "
- + sessionID.getProtocolName() + ".");
-
- if (!session.getSessionPolicy().getAllowV2()) {
- logger.finest("Policy does not allow OTRv2, ignoring message.");
- return;
- }
-
- switch (this.getAuthenticationState()) {
- case AWAITING_REVEALSIG:
- // Use the received value of r to decrypt the value of gx
- // received
- // in the D-H Commit Message, and verify the hash therein.
- // Decrypt
- // the encrypted signature, and verify the signature and the
- // MACs.
- // If everything checks out:
-
- // * Reply with a Signature Message.
- // * Transition authstate to AUTHSTATE_NONE.
- // * Transition msgstate to MSGSTATE_ENCRYPTED.
- // * TODO If there is a recent stored message, encrypt it and
- // send
- // it as a Data Message.
-
- OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
- // Uses r to decrypt the value of gx sent earlier
- byte[] remoteDHPublicKeyDecrypted = otrCryptoEngine.aesDecrypt(
- m.revealedKey, null, this.getRemoteDHPublicKeyEncrypted());
-
- // Verifies that HASH(gx) matches the value sent earlier
- byte[] remoteDHPublicKeyHash = otrCryptoEngine
- .sha256Hash(remoteDHPublicKeyDecrypted);
- if (!Arrays.equals(remoteDHPublicKeyHash, this
- .getRemoteDHPublicKeyHash())) {
- logger.finest("Hashes don't match, ignoring message.");
- return;
- }
-
- // Verifies that Bob's gx is a legal value (2 <= gx <=
- // modulus-2)
- BigInteger remoteDHPublicKeyMpi;
- try {
- remoteDHPublicKeyMpi = SerializationUtils
- .readMpi(remoteDHPublicKeyDecrypted);
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- this.setRemoteDHPublicKey(otrCryptoEngine
- .getDHPublicKey(remoteDHPublicKeyMpi));
-
- // Verify received Data.
- if (!m.verify(this.getM2())) {
- logger
- .finest("Signature MACs are not equal, ignoring message.");
- return;
- }
-
- // Decrypt X.
- byte[] remoteXDecrypted = m.decrypt(this.getC());
- SignatureX remoteX;
- try {
- remoteX = SerializationUtils.toMysteriousX(remoteXDecrypted);
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- // Compute signature.
- PublicKey remoteLongTermPublicKey = remoteX.longTermPublicKey;
- SignatureM remoteM = new SignatureM(this.getRemoteDHPublicKey(),
- (DHPublicKey) this.getLocalDHKeyPair().getPublic(),
- remoteLongTermPublicKey, remoteX.dhKeyID);
-
- // Verify signature.
- byte[] signature;
- try {
- signature = otrCryptoEngine.sha256Hmac(SerializationUtils
- .toByteArray(remoteM), this.getM1());
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- if (!otrCryptoEngine.verify(signature, remoteLongTermPublicKey,
- remoteX.signature)) {
- logger.finest("Signature verification failed.");
- return;
- }
-
- logger.finest("Signature verification succeeded.");
-
- this.setAuthenticationState(AuthContext.NONE);
- this.setIsSecure(true);
- this.setRemoteLongTermPublicKey(remoteLongTermPublicKey);
- getSession().injectMessage(messageFactory.getSignatureMessage());
- break;
- default:
- logger.finest("Ignoring message.");
- break;
- }
- }
-
- private void handleDHKeyMessage(DHKeyMessage m) throws OtrException {
- Session session = getSession();
- SessionID sessionID = session.getSessionID();
- logger.finest(sessionID.getAccountID()
- + " received a D-H key message from " + sessionID.getUserID()
- + " throught " + sessionID.getProtocolName() + ".");
-
- if (!session.getSessionPolicy().getAllowV2()) {
- logger.finest("If ALLOW_V2 is not set, ignore this message.");
- return;
- }
-
- switch (this.getAuthenticationState()) {
- case AWAITING_DHKEY:
- // Reply with a Reveal Signature Message and transition
- // authstate to
- // AUTHSTATE_AWAITING_SIG
- this.setRemoteDHPublicKey(m.dhPublicKey);
- this.setAuthenticationState(AuthContext.AWAITING_SIG);
- getSession().injectMessage(
- messageFactory.getRevealSignatureMessage());
- logger.finest("Sent Reveal Signature.");
- break;
- case AWAITING_SIG:
-
- if (m.dhPublicKey.getY().equals(this.getRemoteDHPublicKey().getY())) {
- // If this D-H Key message is the same the one you received
- // earlier (when you entered AUTHSTATE_AWAITING_SIG):
- // Retransmit
- // your Reveal Signature Message.
- getSession().injectMessage(
- messageFactory.getRevealSignatureMessage());
- logger.finest("Resent Reveal Signature.");
- } else {
- // Otherwise: Ignore the message.
- logger.finest("Ignoring message.");
- }
- break;
- default:
- // Ignore the message
- break;
- }
- }
-
- private void handleDHCommitMessage(DHCommitMessage m) throws OtrException {
- Session session = getSession();
- SessionID sessionID = session.getSessionID();
- logger.finest(sessionID.getAccountID()
- + " received a D-H commit message from "
- + sessionID.getUserID() + " throught "
- + sessionID.getProtocolName() + ".");
-
- if (!session.getSessionPolicy().getAllowV2()) {
- logger.finest("ALLOW_V2 is not set, ignore this message.");
- return;
- }
-
- switch (this.getAuthenticationState()) {
- case NONE:
- // Reply with a D-H Key Message, and transition authstate to
- // AUTHSTATE_AWAITING_REVEALSIG.
- this.reset();
- this.setProtocolVersion(2);
- this.setRemoteDHPublicKeyEncrypted(m.dhPublicKeyEncrypted);
- this.setRemoteDHPublicKeyHash(m.dhPublicKeyHash);
- this.setAuthenticationState(AuthContext.AWAITING_REVEALSIG);
- getSession().injectMessage(messageFactory.getDHKeyMessage());
- logger.finest("Sent D-H key.");
- break;
-
- case AWAITING_DHKEY:
- // This is the trickiest transition in the whole protocol. It
- // indicates that you have already sent a D-H Commit message to
- // your
- // correspondent, but that he either didn't receive it, or just
- // didn't receive it yet, and has sent you one as well. The
- // symmetry
- // will be broken by comparing the hashed gx you sent in your
- // D-H
- // Commit Message with the one you received, considered as
- // 32-byte
- // unsigned big-endian values.
- BigInteger ourHash = new BigInteger(1, this
- .getLocalDHPublicKeyHash());
- BigInteger theirHash = new BigInteger(1, m.dhPublicKeyHash);
-
- if (theirHash.compareTo(ourHash) == -1) {
- // Ignore the incoming D-H Commit message, but resend your
- // D-H
- // Commit message.
- getSession().injectMessage(messageFactory.getDHCommitMessage());
- logger
- .finest("Ignored the incoming D-H Commit message, but resent our D-H Commit message.");
- } else {
- // *Forget* your old gx value that you sent (encrypted)
- // earlier,
- // and pretend you're in AUTHSTATE_NONE; i.e. reply with a
- // D-H
- // Key Message, and transition authstate to
- // AUTHSTATE_AWAITING_REVEALSIG.
- this.reset();
- this.setProtocolVersion(2);
- this.setRemoteDHPublicKeyEncrypted(m.dhPublicKeyEncrypted);
- this.setRemoteDHPublicKeyHash(m.dhPublicKeyHash);
- this.setAuthenticationState(AuthContext.AWAITING_REVEALSIG);
- getSession().injectMessage(messageFactory.getDHKeyMessage());
- logger
- .finest("Forgot our old gx value that we sent (encrypted) earlier, and pretended we're in AUTHSTATE_NONE -> Sent D-H key.");
- }
- break;
-
- case AWAITING_REVEALSIG:
- // Retransmit your D-H Key Message (the same one as you sent
- // when
- // you entered AUTHSTATE_AWAITING_REVEALSIG). Forget the old D-H
- // Commit message, and use this new one instead.
- this.setRemoteDHPublicKeyEncrypted(m.dhPublicKeyEncrypted);
- this.setRemoteDHPublicKeyHash(m.dhPublicKeyHash);
- getSession().injectMessage(messageFactory.getDHKeyMessage());
- logger.finest("Sent D-H key.");
- break;
- case AWAITING_SIG:
- // Reply with a new D-H Key message, and transition authstate to
- // AUTHSTATE_AWAITING_REVEALSIG
- this.reset();
- this.setRemoteDHPublicKeyEncrypted(m.dhPublicKeyEncrypted);
- this.setRemoteDHPublicKeyHash(m.dhPublicKeyHash);
- this.setAuthenticationState(AuthContext.AWAITING_REVEALSIG);
- getSession().injectMessage(messageFactory.getDHKeyMessage());
- logger.finest("Sent D-H key.");
- break;
- case V1_SETUP:
- throw new UnsupportedOperationException();
- }
- }
-
- public void startV2Auth() throws OtrException {
- logger
- .finest("Starting Authenticated Key Exchange, sending query message");
- getSession().injectMessage(messageFactory.getQueryMessage());
- }
-
- public void respondV2Auth() throws OtrException {
- logger.finest("Responding to Query Message");
- this.reset();
- this.setProtocolVersion(2);
- this.setAuthenticationState(AuthContext.AWAITING_DHKEY);
- logger.finest("Sending D-H Commit.");
- getSession().injectMessage(messageFactory.getDHCommitMessage());
- }
-
- private void setSession(Session session) {
- this.session = session;
- }
-
- private Session getSession() {
- return session;
- }
-
- private PublicKey remoteLongTermPublicKey;
-
- public PublicKey getRemoteLongTermPublicKey() {
- return remoteLongTermPublicKey;
- }
-
- private void setRemoteLongTermPublicKey(PublicKey pubKey) {
- this.remoteLongTermPublicKey = pubKey;
- }
-}
--- a/src/net/java/otr4j/session/Session.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-package net.java.otr4j.session;
-
-import java.security.KeyPair;
-import java.security.PublicKey;
-import java.util.List;
-
-import net.java.otr4j.OtrEngineListener;
-import net.java.otr4j.OtrException;
-import net.java.otr4j.OtrPolicy;
-import net.java.otr4j.io.messages.AbstractMessage;
-import net.java.otr4j.session.SessionImpl.TLV;
-
-public interface Session {
-
- public abstract SessionStatus getSessionStatus();
-
- public abstract SessionID getSessionID();
-
- public abstract void injectMessage(AbstractMessage m) throws OtrException;
-
- public abstract KeyPair getLocalKeyPair();
-
- public abstract OtrPolicy getSessionPolicy();
-
- public abstract String transformReceiving(String content)
- throws OtrException;
-
- public abstract String transformSending(String content, List<TLV> tlvs)
- throws OtrException;
-
- public abstract void startSession() throws OtrException;
-
- public abstract void endSession() throws OtrException;
-
- public abstract void refreshSession() throws OtrException;
-
- public abstract PublicKey getRemotePublicKey();
-
- public abstract void addOtrEngineListener(OtrEngineListener l);
-
- public abstract void removeOtrEngineListener(OtrEngineListener l);
-}
\ No newline at end of file
--- a/src/net/java/otr4j/session/SessionID.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.session;
-
-/**
- *
- * @author George Politis
- *
- */
-public final class SessionID {
-
- public SessionID(String accountID, String userID, String protocolName) {
- this.setAccountID(accountID);
- this.setUserID(userID);
- this.setProtocolName(protocolName);
- }
-
- private String accountID;
- private String userID;
- private String protocolName;
- public static final SessionID Empty = new SessionID(null, null, null);
-
- public void setAccountID(String accountID) {
- this.accountID = accountID;
- }
-
- public String getAccountID() {
- return accountID;
- }
-
- private void setUserID(String userID) {
- this.userID = userID;
- }
-
- public String getUserID() {
- return userID;
- }
-
- private void setProtocolName(String protocolName) {
- this.protocolName = protocolName;
- }
-
- public String getProtocolName() {
- return protocolName;
- }
-
- public String toString() {
- return this.getAccountID() + "_" + this.getProtocolName() + "_"
- + this.getUserID();
- }
-
- public boolean equals(Object obj) {
- if (obj == this)
- return true;
- if (obj == null || obj.getClass() != this.getClass())
- return false;
-
- SessionID sessionID = (SessionID) obj;
-
- return this.toString().equals(sessionID.toString());
- }
-
- public int hashCode() {
- return this.toString().hashCode();
- }
-}
--- a/src/net/java/otr4j/session/SessionImpl.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,792 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-
-package net.java.otr4j.session;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.security.KeyPair;
-import java.security.PublicKey;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Vector;
-import java.util.logging.Logger;
-import javax.crypto.interfaces.DHPublicKey;
-
-import net.java.otr4j.OtrEngineHost;
-import net.java.otr4j.OtrEngineListener;
-import net.java.otr4j.OtrException;
-import net.java.otr4j.OtrPolicy;
-import net.java.otr4j.crypto.OtrCryptoEngine;
-import net.java.otr4j.crypto.OtrCryptoEngineImpl;
-import net.java.otr4j.io.OtrInputStream;
-import net.java.otr4j.io.OtrOutputStream;
-import net.java.otr4j.io.SerializationConstants;
-import net.java.otr4j.io.SerializationUtils;
-import net.java.otr4j.io.messages.DataMessage;
-import net.java.otr4j.io.messages.AbstractEncodedMessage;
-import net.java.otr4j.io.messages.ErrorMessage;
-import net.java.otr4j.io.messages.AbstractMessage;
-import net.java.otr4j.io.messages.MysteriousT;
-import net.java.otr4j.io.messages.PlainTextMessage;
-import net.java.otr4j.io.messages.QueryMessage;
-
-/**
- *
- * @author George Politis
- */
-public class SessionImpl implements Session {
-
- class TLV {
- public TLV(int type, byte[] value) {
- this.setType(type);
- this.setValue(value);
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public int getType() {
- return type;
- }
-
- public void setValue(byte[] value) {
- this.value = value;
- }
-
- public byte[] getValue() {
- return value;
- }
-
- private int type;
- private byte[] value;
- }
-
- private SessionID sessionID;
- private OtrEngineHost host;
- private SessionStatus sessionStatus;
- private AuthContext authContext;
- private SessionKeys[][] sessionKeys;
- private Vector<byte[]> oldMacKeys;
- private static Logger logger = Logger
- .getLogger(SessionImpl.class.getName());
-
- public SessionImpl(SessionID sessionID, OtrEngineHost listener) {
-
- this.setSessionID(sessionID);
- this.setHost(listener);
-
- // client application calls OtrEngine.getSessionStatus()
- // -> create new session if it does not exist, end up here
- // -> setSessionStatus() fires statusChangedEvent
- // -> client application calls OtrEngine.getSessionStatus()
- this.sessionStatus = SessionStatus.PLAINTEXT;
- }
-
- private SessionKeys getEncryptionSessionKeys() {
- logger.finest("Getting encryption keys");
- return getSessionKeysByIndex(SessionKeys.Previous, SessionKeys.Current);
- }
-
- private SessionKeys getMostRecentSessionKeys() {
- logger.finest("Getting most recent keys.");
- return getSessionKeysByIndex(SessionKeys.Current, SessionKeys.Current);
- }
-
- private SessionKeys getSessionKeysByID(int localKeyID, int remoteKeyID) {
- logger
- .finest("Searching for session keys with (localKeyID, remoteKeyID) = ("
- + localKeyID + "," + remoteKeyID + ")");
-
- for (int i = 0; i < getSessionKeys().length; i++) {
- for (int j = 0; j < getSessionKeys()[i].length; j++) {
- SessionKeys current = getSessionKeysByIndex(i, j);
- if (current.getLocalKeyID() == localKeyID
- && current.getRemoteKeyID() == remoteKeyID) {
- logger.finest("Matching keys found.");
- return current;
- }
- }
- }
-
- return null;
- }
-
- private SessionKeys getSessionKeysByIndex(int localKeyIndex,
- int remoteKeyIndex) {
- if (getSessionKeys()[localKeyIndex][remoteKeyIndex] == null)
- getSessionKeys()[localKeyIndex][remoteKeyIndex] = new SessionKeysImpl(
- localKeyIndex, remoteKeyIndex);
-
- return getSessionKeys()[localKeyIndex][remoteKeyIndex];
- }
-
- private void rotateRemoteSessionKeys(DHPublicKey pubKey)
- throws OtrException {
-
- logger.finest("Rotating remote keys.");
- SessionKeys sess1 = getSessionKeysByIndex(SessionKeys.Current,
- SessionKeys.Previous);
- if (sess1.getIsUsedReceivingMACKey()) {
- logger
- .finest("Detected used Receiving MAC key. Adding to old MAC keys to reveal it.");
- getOldMacKeys().add(sess1.getReceivingMACKey());
- }
-
- SessionKeys sess2 = getSessionKeysByIndex(SessionKeys.Previous,
- SessionKeys.Previous);
- if (sess2.getIsUsedReceivingMACKey()) {
- logger
- .finest("Detected used Receiving MAC key. Adding to old MAC keys to reveal it.");
- getOldMacKeys().add(sess2.getReceivingMACKey());
- }
-
- SessionKeys sess3 = getSessionKeysByIndex(SessionKeys.Current,
- SessionKeys.Current);
- sess1
- .setRemoteDHPublicKey(sess3.getRemoteKey(), sess3
- .getRemoteKeyID());
-
- SessionKeys sess4 = getSessionKeysByIndex(SessionKeys.Previous,
- SessionKeys.Current);
- sess2
- .setRemoteDHPublicKey(sess4.getRemoteKey(), sess4
- .getRemoteKeyID());
-
- sess3.setRemoteDHPublicKey(pubKey, sess3.getRemoteKeyID() + 1);
- sess4.setRemoteDHPublicKey(pubKey, sess4.getRemoteKeyID() + 1);
- }
-
- private void rotateLocalSessionKeys() throws OtrException {
-
- logger.finest("Rotating local keys.");
- SessionKeys sess1 = getSessionKeysByIndex(SessionKeys.Previous,
- SessionKeys.Current);
- if (sess1.getIsUsedReceivingMACKey()) {
- logger
- .finest("Detected used Receiving MAC key. Adding to old MAC keys to reveal it.");
- getOldMacKeys().add(sess1.getReceivingMACKey());
- }
-
- SessionKeys sess2 = getSessionKeysByIndex(SessionKeys.Previous,
- SessionKeys.Previous);
- if (sess2.getIsUsedReceivingMACKey()) {
- logger
- .finest("Detected used Receiving MAC key. Adding to old MAC keys to reveal it.");
- getOldMacKeys().add(sess2.getReceivingMACKey());
- }
-
- SessionKeys sess3 = getSessionKeysByIndex(SessionKeys.Current,
- SessionKeys.Current);
- sess1.setLocalPair(sess3.getLocalPair(), sess3.getLocalKeyID());
- SessionKeys sess4 = getSessionKeysByIndex(SessionKeys.Current,
- SessionKeys.Previous);
- sess2.setLocalPair(sess4.getLocalPair(), sess4.getLocalKeyID());
-
- KeyPair newPair = new OtrCryptoEngineImpl().generateDHKeyPair();
- sess3.setLocalPair(newPair, sess3.getLocalKeyID() + 1);
- sess4.setLocalPair(newPair, sess4.getLocalKeyID() + 1);
- }
-
- private byte[] collectOldMacKeys() {
- logger.finest("Collecting old MAC keys to be revealed.");
- int len = 0;
- for (int i = 0; i < getOldMacKeys().size(); i++)
- len += getOldMacKeys().get(i).length;
-
- ByteBuffer buff = ByteBuffer.allocate(len);
- for (int i = 0; i < getOldMacKeys().size(); i++)
- buff.put(getOldMacKeys().get(i));
-
- getOldMacKeys().clear();
- return buff.array();
- }
-
- private void setSessionStatus(SessionStatus sessionStatus)
- throws OtrException {
-
- if (sessionStatus == this.sessionStatus)
- return;
-
- switch (sessionStatus) {
- case ENCRYPTED:
- AuthContext auth = this.getAuthContext();
- logger.finest("Setting most recent session keys from auth.");
- for (int i = 0; i < this.getSessionKeys()[0].length; i++) {
- SessionKeys current = getSessionKeysByIndex(0, i);
- current.setLocalPair(auth.getLocalDHKeyPair(), 1);
- current.setRemoteDHPublicKey(auth.getRemoteDHPublicKey(), 1);
- current.setS(auth.getS());
- }
-
- KeyPair nextDH = new OtrCryptoEngineImpl().generateDHKeyPair();
- for (int i = 0; i < this.getSessionKeys()[1].length; i++) {
- SessionKeys current = getSessionKeysByIndex(1, i);
- current.setRemoteDHPublicKey(auth.getRemoteDHPublicKey(), 1);
- current.setLocalPair(nextDH, 2);
- }
-
- this.setRemotePublicKey(auth.getRemoteLongTermPublicKey());
-
- auth.reset();
- break;
- }
-
- this.sessionStatus = sessionStatus;
-
- for (OtrEngineListener l : this.listeners)
- l.sessionStatusChanged(getSessionID());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.java.otr4j.session.ISession#getSessionStatus()
- */
-
- public SessionStatus getSessionStatus() {
- return sessionStatus;
- }
-
- private void setSessionID(SessionID sessionID) {
- this.sessionID = sessionID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.java.otr4j.session.ISession#getSessionID()
- */
- public SessionID getSessionID() {
- return sessionID;
- }
-
- private void setHost(OtrEngineHost host) {
- this.host = host;
- }
-
- private OtrEngineHost getHost() {
- return host;
- }
-
- private SessionKeys[][] getSessionKeys() {
- if (sessionKeys == null)
- sessionKeys = new SessionKeys[2][2];
- return sessionKeys;
- }
-
- private AuthContext getAuthContext() {
- if (authContext == null)
- authContext = new AuthContextImpl(this);
- return authContext;
- }
-
- private Vector<byte[]> getOldMacKeys() {
- if (oldMacKeys == null)
- oldMacKeys = new Vector<byte[]>();
- return oldMacKeys;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.java.otr4j.session.ISession#handleReceivingMessage(java.lang.String)
- */
- public String transformReceiving(String msgText) throws OtrException {
- OtrPolicy policy = getSessionPolicy();
- if (!policy.getAllowV1() && !policy.getAllowV2()) {
- logger
- .finest("Policy does not allow neither V1 not V2, ignoring message.");
- return msgText;
- }
-
- AbstractMessage m;
- try {
- m = SerializationUtils.toMessage(msgText);
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- if (m == null)
- return msgText; // Propably null or empty.
-
- switch (m.messageType) {
- case AbstractEncodedMessage.MESSAGE_DATA:
- return handleDataMessage((DataMessage) m);
- case AbstractMessage.MESSAGE_ERROR:
- handleErrorMessage((ErrorMessage) m);
- return null;
- case AbstractMessage.MESSAGE_PLAINTEXT:
- return handlePlainTextMessage((PlainTextMessage) m);
- case AbstractMessage.MESSAGE_QUERY:
- handleQueryMessage((QueryMessage) m);
- return null;
- case AbstractEncodedMessage.MESSAGE_DH_COMMIT:
- case AbstractEncodedMessage.MESSAGE_DHKEY:
- case AbstractEncodedMessage.MESSAGE_REVEALSIG:
- case AbstractEncodedMessage.MESSAGE_SIGNATURE:
- AuthContext auth = this.getAuthContext();
- auth.handleReceivingMessage(m);
-
- if (auth.getIsSecure()) {
- this.setSessionStatus(SessionStatus.ENCRYPTED);
- logger.finest("Gone Secure.");
- }
- return null;
- default:
- throw new UnsupportedOperationException(
- "Received an uknown message type.");
- }
- }
-
- private void handleQueryMessage(QueryMessage queryMessage)
- throws OtrException {
- logger.finest(getSessionID().getAccountID()
- + " received a query message from "
- + getSessionID().getUserID() + " throught "
- + getSessionID().getProtocolName() + ".");
-
- setSessionStatus(SessionStatus.PLAINTEXT);
-
- OtrPolicy policy = getSessionPolicy();
- if (queryMessage.versions.contains(2) && policy.getAllowV2()) {
- logger.finest("Query message with V2 support found.");
- getAuthContext().respondV2Auth();
- } else if (queryMessage.versions.contains(1) && policy.getAllowV1()) {
- throw new UnsupportedOperationException();
- }
- }
-
- private void handleErrorMessage(ErrorMessage errorMessage)
- throws OtrException {
- logger.finest(getSessionID().getAccountID()
- + " received an error message from "
- + getSessionID().getUserID() + " throught "
- + getSessionID().getUserID() + ".");
-
- getHost().showError(this.getSessionID(), errorMessage.error);
-
- OtrPolicy policy = getSessionPolicy();
- if (policy.getErrorStartAKE()) {
- logger.finest("Error message starts AKE.");
- Vector<Integer> versions = new Vector<Integer>();
- if (policy.getAllowV1())
- versions.add(1);
-
- if (policy.getAllowV2())
- versions.add(2);
-
- logger.finest("Sending Query");
- injectMessage(new QueryMessage(versions));
- }
- }
-
- private String handleDataMessage(DataMessage data) throws OtrException {
- logger.finest(getSessionID().getAccountID()
- + " received a data message from " + getSessionID().getUserID()
- + ".");
-
- switch (this.getSessionStatus()) {
- case ENCRYPTED:
- logger
- .finest("Message state is ENCRYPTED. Trying to decrypt message.");
-
- // Find matching session keys.
- int senderKeyID = data.senderKeyID;
- int receipientKeyID = data.recipientKeyID;
- SessionKeys matchingKeys = this.getSessionKeysByID(receipientKeyID,
- senderKeyID);
-
- if (matchingKeys == null) {
- logger.finest("No matching keys found.");
- return null;
- }
-
- // Verify received MAC with a locally calculated MAC.
- logger
- .finest("Transforming T to byte[] to calculate it's HmacSHA1.");
-
- byte[] serializedT;
- try {
- serializedT = SerializationUtils.toByteArray(data.getT());
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
-
- byte[] computedMAC = otrCryptoEngine.sha1Hmac(serializedT,
- matchingKeys.getReceivingMACKey(),
- SerializationConstants.TYPE_LEN_MAC);
-
- if (!Arrays.equals(computedMAC, data.mac)) {
- logger.finest("MAC verification failed, ignoring message");
- return null;
- }
-
- logger.finest("Computed HmacSHA1 value matches sent one.");
-
- // Mark this MAC key as old to be revealed.
- matchingKeys.setIsUsedReceivingMACKey(true);
-
- matchingKeys.setReceivingCtr(data.ctr);
-
- byte[] dmc = otrCryptoEngine.aesDecrypt(matchingKeys
- .getReceivingAESKey(), matchingKeys.getReceivingCtr(),
- data.encryptedMessage);
- String decryptedMsgContent;
- try {
- // Expect bytes to be text encoded in UTF-8.
- decryptedMsgContent = new String(dmc, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new OtrException(e);
- }
-
- logger.finest("Decrypted message: \"" + decryptedMsgContent + "\"");
-
- // Rotate keys if necessary.
- SessionKeys mostRecent = this.getMostRecentSessionKeys();
- if (mostRecent.getLocalKeyID() == receipientKeyID)
- this.rotateLocalSessionKeys();
-
- if (mostRecent.getRemoteKeyID() == senderKeyID)
- this.rotateRemoteSessionKeys(data.nextDH);
-
- // Handle TLVs
- List<TLV> tlvs = null;
- int tlvIndex = decryptedMsgContent.indexOf((char) 0x0);
- if (tlvIndex > -1) {
- decryptedMsgContent = decryptedMsgContent
- .substring(0, tlvIndex);
- tlvIndex++;
- byte[] tlvsb = new byte[dmc.length - tlvIndex];
- System.arraycopy(dmc, tlvIndex, tlvsb, 0, tlvsb.length);
-
- tlvs = new Vector<TLV>();
- ByteArrayInputStream tin = new ByteArrayInputStream(tlvsb);
- while (tin.available() > 0) {
- int type;
- byte[] tdata;
- OtrInputStream eois = new OtrInputStream(tin);
- try {
- type = eois.readShort();
- tdata = eois.readTlvData();
- eois.close();
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- tlvs.add(new TLV(type, tdata));
- }
- }
- if (tlvs != null && tlvs.size() > 0) {
- for (TLV tlv : tlvs) {
- switch (tlv.getType()) {
- case 1:
- this.setSessionStatus(SessionStatus.FINISHED);
- return null;
- default:
- return decryptedMsgContent;
- }
- }
- }
-
- return decryptedMsgContent;
-
- case FINISHED:
- case PLAINTEXT:
- getHost().showWarning(this.getSessionID(),
- "Unreadable encrypted message was received.");
-
- injectMessage(new ErrorMessage(AbstractMessage.MESSAGE_ERROR,
- "You sent me an unreadable encrypted message.."));
- break;
- }
-
- return null;
- }
-
- public void injectMessage(AbstractMessage m) throws OtrException {
- String msg;
- try {
- msg = SerializationUtils.toString(m);
- } catch (IOException e) {
- throw new OtrException(e);
- }
- getHost().injectMessage(getSessionID(), msg);
- }
-
- private String handlePlainTextMessage(PlainTextMessage plainTextMessage)
- throws OtrException {
- logger.finest(getSessionID().getAccountID()
- + " received a plaintext message from "
- + getSessionID().getUserID() + " throught "
- + getSessionID().getProtocolName() + ".");
-
- OtrPolicy policy = getSessionPolicy();
- List<Integer> versions = plainTextMessage.versions;
- if (versions == null || versions.size() < 1) {
- logger
- .finest("Received plaintext message without the whitespace tag.");
- switch (this.getSessionStatus()) {
- case ENCRYPTED:
- case FINISHED:
- // Display the message to the user, but warn him that the
- // message was received unencrypted.
- getHost().showWarning(this.getSessionID(),
- "The message was received unencrypted.");
- return plainTextMessage.cleanText;
- case PLAINTEXT:
- // Simply display the message to the user. If
- // REQUIRE_ENCRYPTION
- // is set, warn him that the message was received
- // unencrypted.
- if (policy.getRequireEncryption()) {
- getHost().showWarning(this.getSessionID(),
- "The message was received unencrypted.");
- }
- return plainTextMessage.cleanText;
- }
- } else {
- logger
- .finest("Received plaintext message with the whitespace tag.");
- switch (this.getSessionStatus()) {
- case ENCRYPTED:
- case FINISHED:
- // Remove the whitespace tag and display the message to the
- // user, but warn him that the message was received
- // unencrypted.
- getHost().showWarning(this.getSessionID(),
- "The message was received unencrypted.");
- case PLAINTEXT:
- // Remove the whitespace tag and display the message to the
- // user. If REQUIRE_ENCRYPTION is set, warn him that the
- // message
- // was received unencrypted.
- if (policy.getRequireEncryption())
- getHost().showWarning(this.getSessionID(),
- "The message was received unencrypted.");
- }
-
- if (policy.getWhitespaceStartAKE()) {
- logger.finest("WHITESPACE_START_AKE is set");
-
- if (plainTextMessage.versions.contains(2)
- && policy.getAllowV2()) {
- logger.finest("V2 tag found.");
- getAuthContext().respondV2Auth();
- } else if (plainTextMessage.versions.contains(1)
- && policy.getAllowV1()) {
- throw new UnsupportedOperationException();
- }
- }
- }
-
- return plainTextMessage.cleanText;
- }
-
- // Retransmit last sent message. Spec document does not mention where or
- // when that should happen, must check libotr code.
- private String lastSentMessage;
-
- public String transformSending(String msgText, List<TLV> tlvs)
- throws OtrException {
-
- switch (this.getSessionStatus()) {
- case PLAINTEXT:
- if (getSessionPolicy().getRequireEncryption()) {
- this.lastSentMessage = msgText;
- this.startSession();
- } else
- // TODO this does not precisly behave according to
- // specification.
- return msgText;
- case ENCRYPTED:
- this.lastSentMessage = msgText;
- logger.finest(getSessionID().getAccountID()
- + " sends an encrypted message to "
- + getSessionID().getUserID() + " throught "
- + getSessionID().getProtocolName() + ".");
-
- // Get encryption keys.
- SessionKeys encryptionKeys = this.getEncryptionSessionKeys();
- int senderKeyID = encryptionKeys.getLocalKeyID();
- int receipientKeyID = encryptionKeys.getRemoteKeyID();
-
- // Increment CTR.
- encryptionKeys.incrementSendingCtr();
- byte[] ctr = encryptionKeys.getSendingCtr();
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- if (msgText != null && msgText.length() > 0)
- try {
- out.write(msgText.getBytes("UTF8"));
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- // Append tlvs
- if (tlvs != null && tlvs.size() > 0) {
- out.write((byte) 0x00);
-
- OtrOutputStream eoos = new OtrOutputStream(out);
- for (TLV tlv : tlvs) {
- try {
- eoos.writeShort(tlv.type);
- eoos.writeTlvData(tlv.value);
- } catch (IOException e) {
- throw new OtrException(e);
- }
- }
- }
-
- OtrCryptoEngine otrCryptoEngine = new OtrCryptoEngineImpl();
-
- byte[] data = out.toByteArray();
- // Encrypt message.
- logger
- .finest("Encrypting message with keyids (localKeyID, remoteKeyID) = ("
- + senderKeyID + ", " + receipientKeyID + ")");
- byte[] encryptedMsg = otrCryptoEngine.aesEncrypt(encryptionKeys
- .getSendingAESKey(), ctr, data);
-
- // Get most recent keys to get the next D-H public key.
- SessionKeys mostRecentKeys = this.getMostRecentSessionKeys();
- DHPublicKey nextDH = (DHPublicKey) mostRecentKeys.getLocalPair()
- .getPublic();
-
- // Calculate T.
- MysteriousT t = new MysteriousT(2, 0, senderKeyID, receipientKeyID,
- nextDH, ctr, encryptedMsg);
-
- // Calculate T hash.
- byte[] sendingMACKey = encryptionKeys.getSendingMACKey();
-
- logger
- .finest("Transforming T to byte[] to calculate it's HmacSHA1.");
- byte[] serializedT;
- try {
- serializedT = SerializationUtils.toByteArray(t);
- } catch (IOException e) {
- throw new OtrException(e);
- }
-
- byte[] mac = otrCryptoEngine.sha1Hmac(serializedT, sendingMACKey,
- SerializationConstants.TYPE_LEN_MAC);
-
- // Get old MAC keys to be revealed.
- byte[] oldKeys = this.collectOldMacKeys();
- DataMessage m = new DataMessage(t, mac, oldKeys);
-
- try {
- return SerializationUtils.toString(m);
- } catch (IOException e) {
- throw new OtrException(e);
- }
- case FINISHED:
- this.lastSentMessage = msgText;
- getHost()
- .showError(
- sessionID,
- "Your message to "
- + sessionID.getUserID()
- + " was not sent. Either end your private conversation, or restart it.");
- return null;
- default:
- logger.finest("Uknown message state, not processing.");
- return msgText;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.java.otr4j.session.ISession#startSession()
- */
- public void startSession() throws OtrException {
- if (this.getSessionStatus() == SessionStatus.ENCRYPTED)
- return;
-
- if (!getSessionPolicy().getAllowV2())
- throw new UnsupportedOperationException();
-
- this.getAuthContext().startV2Auth();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.java.otr4j.session.ISession#endSession()
- */
- public void endSession() throws OtrException {
- SessionStatus status = this.getSessionStatus();
- switch (status) {
- case ENCRYPTED:
- Vector<TLV> tlvs = new Vector<TLV>();
- tlvs.add(new TLV(1, null));
-
- String msg = this.transformSending(null, tlvs);
- getHost().injectMessage(getSessionID(), msg);
- this.setSessionStatus(SessionStatus.PLAINTEXT);
- break;
- case FINISHED:
- this.setSessionStatus(SessionStatus.PLAINTEXT);
- break;
- case PLAINTEXT:
- return;
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.java.otr4j.session.ISession#refreshSession()
- */
- public void refreshSession() throws OtrException {
- this.endSession();
- this.startSession();
- }
-
- private PublicKey remotePublicKey;
-
- private void setRemotePublicKey(PublicKey pubKey) {
- this.remotePublicKey = pubKey;
- }
-
- public PublicKey getRemotePublicKey() {
- return remotePublicKey;
- }
-
- private List<OtrEngineListener> listeners = new Vector<OtrEngineListener>();
-
- public void addOtrEngineListener(OtrEngineListener l) {
- synchronized (listeners) {
- if (!listeners.contains(l))
- listeners.add(l);
- }
- }
-
- public void removeOtrEngineListener(OtrEngineListener l) {
- synchronized (listeners) {
- listeners.remove(l);
- }
- }
-
- public OtrPolicy getSessionPolicy() {
- return getHost().getSessionPolicy(getSessionID());
- }
-
- public KeyPair getLocalKeyPair() {
- return getHost().getKeyPair(this.getSessionID());
- }
-}
--- a/src/net/java/otr4j/session/SessionKeys.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-package net.java.otr4j.session;
-
-import java.math.BigInteger;
-import java.security.KeyPair;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-import net.java.otr4j.OtrException;
-
-interface SessionKeys {
-
- public static final int Previous = 0;
- public static final int Current = 1;
- public static final byte HIGH_SEND_BYTE = (byte) 0x01;
- public static final byte HIGH_RECEIVE_BYTE = (byte) 0x02;
- public static final byte LOW_SEND_BYTE = (byte) 0x02;
- public static final byte LOW_RECEIVE_BYTE = (byte) 0x01;
-
- public abstract void setLocalPair(KeyPair keyPair, int localPairKeyID);
-
- public abstract void setRemoteDHPublicKey(DHPublicKey pubKey,
- int remoteKeyID);
-
- public abstract void incrementSendingCtr();
-
- public abstract byte[] getSendingCtr();
-
- public abstract byte[] getReceivingCtr();
-
- public abstract void setReceivingCtr(byte[] ctr);
-
- public abstract byte[] getSendingAESKey() throws OtrException;
-
- public abstract byte[] getReceivingAESKey() throws OtrException;
-
- public abstract byte[] getSendingMACKey() throws OtrException;
-
- public abstract byte[] getReceivingMACKey() throws OtrException;
-
- public abstract void setS(BigInteger s);
-
- public abstract void setIsUsedReceivingMACKey(Boolean isUsedReceivingMACKey);
-
- public abstract Boolean getIsUsedReceivingMACKey();
-
- public abstract int getLocalKeyID();
-
- public abstract int getRemoteKeyID();
-
- public abstract DHPublicKey getRemoteKey();
-
- public abstract KeyPair getLocalPair();
-
-}
\ No newline at end of file
--- a/src/net/java/otr4j/session/SessionKeysImpl.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.session;
-
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-import java.security.KeyPair;
-import java.util.Arrays;
-import java.util.logging.Logger;
-
-import javax.crypto.interfaces.DHPublicKey;
-
-import net.java.otr4j.OtrException;
-import net.java.otr4j.crypto.OtrCryptoEngine;
-import net.java.otr4j.crypto.OtrCryptoEngineImpl;
-import net.java.otr4j.io.SerializationUtils;
-
-/**
- *
- * @author George Politis
- */
-class SessionKeysImpl implements SessionKeys {
-
- private static Logger logger = Logger.getLogger(SessionKeysImpl.class
- .getName());
- private String keyDescription;
-
- public SessionKeysImpl(int localKeyIndex, int remoteKeyIndex) {
- if (localKeyIndex == 0)
- keyDescription = "(Previous local, ";
- else
- keyDescription = "(Most recent local, ";
-
- if (remoteKeyIndex == 0)
- keyDescription += "Previous remote)";
- else
- keyDescription += "Most recent remote)";
-
- }
-
- public void setLocalPair(KeyPair keyPair, int localPairKeyID) {
- this.localPair = keyPair;
- this.setLocalKeyID(localPairKeyID);
- logger.finest(keyDescription + " current local key ID: "
- + this.getLocalKeyID());
- this.reset();
- }
-
- public void setRemoteDHPublicKey(DHPublicKey pubKey, int remoteKeyID) {
- this.setRemoteKey(pubKey);
- this.setRemoteKeyID(remoteKeyID);
- logger.finest(keyDescription + " current remote key ID: "
- + this.getRemoteKeyID());
- this.reset();
- }
-
- private byte[] sendingCtr = new byte[16];
- private byte[] receivingCtr = new byte[16];
-
- public void incrementSendingCtr() {
- logger.finest("Incrementing counter for (localkeyID, remoteKeyID) = ("
- + getLocalKeyID() + "," + getRemoteKeyID() + ")");
- // logger.debug("Counter prior increament: " +
- // Utils.dump(sendingCtr,
- // true, 16));
- for (int i = 7; i >= 0; i--)
- if (++sendingCtr[i] != 0)
- break;
- // logger.debug("Counter after increament: " +
- // Utils.dump(sendingCtr,
- // true, 16));
- }
-
- public byte[] getSendingCtr() {
- return sendingCtr;
- }
-
- public byte[] getReceivingCtr() {
- return receivingCtr;
- }
-
- public void setReceivingCtr(byte[] ctr) {
- for (int i = 0; i < ctr.length; i++)
- receivingCtr[i] = ctr[i];
- }
-
- private void reset() {
- logger.finest("Resetting " + keyDescription + " session keys.");
- Arrays.fill(this.sendingCtr, (byte) 0x00);
- Arrays.fill(this.receivingCtr, (byte) 0x00);
- this.sendingAESKey = null;
- this.receivingAESKey = null;
- this.sendingMACKey = null;
- this.receivingMACKey = null;
- this.setIsUsedReceivingMACKey(false);
- this.s = null;
- if (getLocalPair() != null && getRemoteKey() != null) {
- this.isHigh = ((DHPublicKey) getLocalPair().getPublic()).getY()
- .abs().compareTo(getRemoteKey().getY().abs()) == 1;
- }
-
- }
-
- private byte[] h1(byte b) throws OtrException {
-
- try {
- byte[] secbytes = SerializationUtils.writeMpi(getS());
-
- int len = secbytes.length + 1;
- ByteBuffer buff = ByteBuffer.allocate(len);
- buff.put(b);
- buff.put(secbytes);
- byte[] result = new OtrCryptoEngineImpl().sha1Hash(buff.array());
- return result;
- } catch (Exception e) {
- throw new OtrException(e);
- }
- }
-
- public byte[] getSendingAESKey() throws OtrException {
- if (sendingAESKey != null)
- return sendingAESKey;
-
- byte sendbyte = LOW_SEND_BYTE;
- if (this.isHigh)
- sendbyte = HIGH_SEND_BYTE;
-
- byte[] h1 = h1(sendbyte);
-
- byte[] key = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
- ByteBuffer buff = ByteBuffer.wrap(h1);
- buff.get(key);
- logger.finest("Calculated sending AES key.");
- this.sendingAESKey = key;
- return sendingAESKey;
- }
-
- public byte[] getReceivingAESKey() throws OtrException {
- if (receivingAESKey != null)
- return receivingAESKey;
-
- byte receivebyte = LOW_RECEIVE_BYTE;
- if (this.isHigh)
- receivebyte = HIGH_RECEIVE_BYTE;
-
- byte[] h1 = h1(receivebyte);
-
- byte[] key = new byte[OtrCryptoEngine.AES_KEY_BYTE_LENGTH];
- ByteBuffer buff = ByteBuffer.wrap(h1);
- buff.get(key);
- logger.finest("Calculated receiving AES key.");
- this.receivingAESKey = key;
-
- return receivingAESKey;
- }
-
- public byte[] getSendingMACKey() throws OtrException {
- if (sendingMACKey != null)
- return sendingMACKey;
-
- sendingMACKey = new OtrCryptoEngineImpl().sha1Hash(getSendingAESKey());
- logger.finest("Calculated sending MAC key.");
- return sendingMACKey;
- }
-
- public byte[] getReceivingMACKey() throws OtrException {
- if (receivingMACKey == null) {
- receivingMACKey = new OtrCryptoEngineImpl()
- .sha1Hash(getReceivingAESKey());
- logger.finest("Calculated receiving AES key.");
- }
- return receivingMACKey;
- }
-
- private BigInteger getS() throws OtrException {
- if (s == null) {
- s = new OtrCryptoEngineImpl().generateSecret(getLocalPair()
- .getPrivate(), getRemoteKey());
- logger.finest("Calculating shared secret S.");
- }
- return s;
- }
-
- public void setS(BigInteger s) {
- this.s = s;
- }
-
- public void setIsUsedReceivingMACKey(Boolean isUsedReceivingMACKey) {
- this.isUsedReceivingMACKey = isUsedReceivingMACKey;
- }
-
- public Boolean getIsUsedReceivingMACKey() {
- return isUsedReceivingMACKey;
- }
-
- private void setLocalKeyID(int localKeyID) {
- this.localKeyID = localKeyID;
- }
-
- public int getLocalKeyID() {
- return localKeyID;
- }
-
- private void setRemoteKeyID(int remoteKeyID) {
- this.remoteKeyID = remoteKeyID;
- }
-
- public int getRemoteKeyID() {
- return remoteKeyID;
- }
-
- private void setRemoteKey(DHPublicKey remoteKey) {
- this.remoteKey = remoteKey;
- }
-
- public DHPublicKey getRemoteKey() {
- return remoteKey;
- }
-
- public KeyPair getLocalPair() {
- return localPair;
- }
-
- private int localKeyID;
- private int remoteKeyID;
- private DHPublicKey remoteKey;
- private KeyPair localPair;
-
- private byte[] sendingAESKey;
- private byte[] receivingAESKey;
- private byte[] sendingMACKey;
- private byte[] receivingMACKey;
- private Boolean isUsedReceivingMACKey;
- private BigInteger s;
- private Boolean isHigh;
-}
--- a/src/net/java/otr4j/session/SessionStatus.java Sun Mar 15 17:28:04 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*
- * otr4j, the open source java otr library.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.otr4j.session;
-
-/**
- *
- * @author George Politis
- */
-public enum SessionStatus {
- PLAINTEXT,
- ENCRYPTED,
- FINISHED
-}