# HG changeset patch
# User nikita@nikita-laptop
# Date 1266370151 -3600
# Node ID d1a599ccf87925374a532a8b9a2702ef3ee54969
# Parent 5884f3bd703a9dc5d1477abc79d9fb75634e7b8b
Adding of an 'Auto-Away' option, there is still some more work/translation to do
diff -r 5884f3bd703a -r d1a599ccf879 .classpath
--- a/.classpath Mon Feb 15 23:37:25 2010 +0100
+++ b/.classpath Wed Feb 17 02:29:11 2010 +0100
@@ -1,9 +1,8 @@
-
-
-
+
+
diff -r 5884f3bd703a -r d1a599ccf879 AndroidManifest.xml
--- a/AndroidManifest.xml Mon Feb 15 23:37:25 2010 +0100
+++ b/AndroidManifest.xml Wed Feb 17 02:29:11 2010 +0100
@@ -76,6 +76,8 @@
android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE">
+
+
diff -r 5884f3bd703a -r d1a599ccf879 res/layout/preferences.xml
--- a/res/layout/preferences.xml Mon Feb 15 23:37:25 2010 +0100
+++ b/res/layout/preferences.xml Wed Feb 17 02:29:11 2010 +0100
@@ -10,6 +10,13 @@
+
+
diff -r 5884f3bd703a -r d1a599ccf879 res/values-fr/strings.xml
--- a/res/values-fr/strings.xml Mon Feb 15 23:37:25 2010 +0100
+++ b/res/values-fr/strings.xml Wed Feb 17 02:29:11 2010 +0100
@@ -83,8 +83,6 @@
Saisissez votre identifiant de connexion
Saisissez votre mot de passe
- Utilisation de Gmail
- Cochez cette option si vous souhaitez utiliser votre compte Gmail
Proxy
Utiliser un proxy
Connectez vous à travers un serveur proxy
@@ -104,6 +102,39 @@
Priorité
Saisissez la resource à partir de laquelle vous vous connectez
Saisissez la priorité de votre client
+ Liste d\'ami(e)s
+ Une série d\'options d\'affichage de votre liste
+ d\'ami(e)s
+ Cachez les groupes
+ Cochez cette option pour cacher les groupes
+ Cachez les contacts
+ Cochez cette option pour cacher les contacts déconnectés
+ Nom d\'utilisateur
+ beem@beem-project.com
+ Mot de passe
+ Serveur
+ Port
+ Comportement du service
+ Une série d\'options pour les utilisateurs avertis
+ Serveur
+ example.com
+ Port
+ Default: 5222
+ SSL/TLS obligatoire
+ Délai de reconnexion
+ Paramètrez un serveur proxy
+ Utiliser un proxy
+ Choisir un type de proxy
+ Serveur
+ Port
+ Default: 1080
+ Nom d\'utilisateur
+ Mot de passe
+ away_chk_title
+ away_chk_sum
+ away_message_title
+ away_message_sum
+ away_message_hint
Inscription acceptée
@@ -199,44 +230,6 @@
edit_settings_tab_proxy
Proxy
-
- Liste d\'ami(e)s
- Une série d\'options d\'affichage de votre liste
- d\'ami(e)s
-
- Cachez les groupes
- Cochez cette option pour cacher les groupes
- Cachez les contacts
- Cochez cette option pour cacher les contacts déconnectés
-
-
- Nom d\'utilisateur
- beem@beem-project.com
- Mot de passe
- Serveur
- Port
-
-
- Comportement du service
- Une série d\'options pour les utilisateurs avertis
- Serveur
- example.com
- Port
- Default: 5222
- SSL/TLS obligatoire
- Délai de reconnexion
-
-
-
- Paramètrez un serveur proxy
- Utiliser un proxy
- Choisir un type de proxy
- Serveur
- Port
- Default: 1080
- Nom d\'utilisateur
- Mot de passe
-
diff -r 5884f3bd703a -r d1a599ccf879 res/values/strings.xml
--- a/res/values/strings.xml Mon Feb 15 23:37:25 2010 +0100
+++ b/res/values/strings.xml Wed Feb 17 02:29:11 2010 +0100
@@ -71,7 +71,6 @@
My status
My personal message
Open contact list
-
Add new contact
Beem Project
@@ -83,8 +82,6 @@
Edit your username
Edit your password
- Using Gmail
- Use my Gmail account
Proxy
Use a proxy server
Login through a proxy server
@@ -104,6 +101,40 @@
Priority
Set the XMPP resource of your client
Set the priority of your client
+ Buddy list
+ A set of display options for your buddy list
+
+ Hide groups
+ Check this option to hide groups
+ Hide buddies
+ Check this option to hide unconnected buddies
+
+ Username
+ beem@beem-project.com
+ Password
+ Server
+ Port
+ Service behaviour
+ A set of options for advanced users
+ Address
+ example.com
+ Port
+ Require SSL/TLS
+ Reconnection delay
+ Default: 5222
+ Settings for proxy usage
+ Connect using a proxy
+ Choose a type of proxy
+ Server
+ Port
+ Default: 1080
+ Username
+ Password
+ away_chk_title
+ away_chk_sum
+ away_message_title
+ away_message_sum
+ away_message_hint
Subscription accepted
@@ -190,42 +221,10 @@
Proxy
- Buddy list
- A set of display options for your buddy list
-
-
- Hide groups
- Check this option to hide groups
- Hide buddies
- Check this option to hide unconnected buddies
-
-
-
- Username
- beem@beem-project.com
- Password
- Server
- Port
-
- Service behaviour
- A set of options for advanced users
- Address
- example.com
- Port
- Require SSL/TLS
- Reconnection delay
- Default: 5222
+
-
- Settings for proxy usage
- Connect using a proxy
- Choose a type of proxy
- Server
- Port
- Default: 1080
- Username
- Password
+
Create an account - Instructions
diff -r 5884f3bd703a -r d1a599ccf879 src/com/beem/project/beem/BeemService.java
--- a/src/com/beem/project/beem/BeemService.java Mon Feb 15 23:37:25 2010 +0100
+++ b/src/com/beem/project/beem/BeemService.java Wed Feb 17 02:29:11 2010 +0100
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem;
import org.jivesoftware.smack.ConnectionConfiguration;
@@ -57,6 +57,7 @@
import android.app.Notification;
import android.app.NotificationManager;
import android.app.Service;
+import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
@@ -72,6 +73,7 @@
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 class is for the Beem service. The connection to the xmpp server will be made asynchronously when the service
@@ -85,7 +87,7 @@
private static final String TAG = "BeemService";
private static final int DEFAULT_XMPP_PORT = 5222;
- private static final String COMMAND_NAMESPACE = "http://jabber.org/protocol/commands";
+ //private static final String COMMAND_NAMESPACE = "http://jabber.org/protocol/commands";
private NotificationManager mNotificationManager;
private XmppConnectionAdapter mConnection;
@@ -100,7 +102,7 @@
private boolean mUseProxy;
private IXmppFacade.Stub mBind;
- private BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
+ private BeemServiceBroadcastReceiver mReceiver = new BeemServiceBroadcastReceiver();
/**
* Constructor.
@@ -112,7 +114,6 @@
* Initialise la configuration de la connexion.
*/
private void initConnectionConfig() {
- //java.security.Security.addProvider(new com.sun.security.sasl.Provider());
mUseProxy = mSettings.getBoolean("settings_key_proxy_use", false);
if (mUseProxy) {
String stype = mSettings.getString("settings_key_proxy_type", "HTTP");
@@ -167,6 +168,9 @@
public void onCreate() {
super.onCreate();
registerReceiver(mReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
+ registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
+ registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_SCREEN_ON));
+
mSettings = PreferenceManager.getDefaultSharedPreferences(this);
String tmpJid = mSettings.getString("settings_key_account_username", "");
mLogin = StringUtils.parseName(tmpJid);
@@ -364,5 +368,27 @@
new AdHocCommandDataProvider.SessionExpiredError());
*/
}
+
+ private class BeemServiceBroadcastReceiver extends BeemBroadcastReceiver {
+
+ private String mOldStatus;
+ private int mOldMode;
+
+ public BeemServiceBroadcastReceiver() {
+ }
+
+ @Override
+ public void onReceive(final Context context, final Intent intent) {
+ super.onReceive(context, intent);
+ String intentAction = intent.getAction();
+ if (intentAction.equals(Intent.ACTION_SCREEN_OFF)) {
+ mOldMode = mConnection.getPreviousMode();
+ mOldStatus = mConnection.getPreviousStatus();
+ mConnection.changeStatus(Status.CONTACT_STATUS_AWAY, mSettings.getString("settings_away_message", "Away"));
+ } else if (intentAction.equals(Intent.ACTION_SCREEN_ON)) {
+ mConnection.changeStatus(mOldMode, mOldStatus);
+ }
+ }
+ }
}
diff -r 5884f3bd703a -r d1a599ccf879 src/com/beem/project/beem/service/XmppConnectionAdapter.java
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Mon Feb 15 23:37:25 2010 +0100
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Wed Feb 17 02:29:11 2010 +0100
@@ -97,12 +97,16 @@
private String mErrorMsg;
private RosterAdapter mRoster;
private int mPreviousPriority;
+ private int mPreviousMode;
+ private String mPreviousStatus;
private PrivacyListManagerAdapter mPrivacyListManager;
private final BeemService mService;
private final RemoteCallbackList mRemoteConnListeners = new RemoteCallbackList();
private final SubscribePacketListener mSubscribePacketListener = new SubscribePacketListener();
private final ConnexionListenerAdapter mConListener = new ConnexionListenerAdapter();
+
+
/**
* Constructor.
@@ -270,11 +274,16 @@
if (msg != null)
m = msg;
else
- m = "";
+ m = mPreviousStatus;
pres.setStatus(m);
+ mPreviousStatus = m;
Presence.Mode mode = Status.getPresenceModeFromStatus(status);
- if (mode != null)
+ 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;
@@ -285,25 +294,21 @@
mAdaptee.sendPacket(pres);
updateNotification(m);
}
-
+
/**
* {@inheritDoc}
*/
@Override
public void changeStatus(int status, String msg) {
- Presence pres = new Presence(Presence.Type.available);
- String m;
- if (msg != null)
- m = msg;
- else
- m = "";
- pres.setStatus(m);
- Presence.Mode mode = Status.getPresenceModeFromStatus(status);
- if (mode != null)
- pres.setMode(mode);
- pres.setPriority(mPreviousPriority);
- mAdaptee.sendPacket(pres);
- updateNotification(msg);
+ changeStatusAndPriority(status, msg, mPreviousPriority);
+ }
+
+ public String getPreviousStatus() {
+ return mPreviousStatus;
+ }
+
+ public int getPreviousMode() {
+ return mPreviousMode;
}
/**
@@ -349,14 +354,6 @@
}
/**
- * Get the context of the adapter.
- * @return The context of the adapter
- */
- public BeemService getContext() {
- return mService;
- }
-
- /**
* {@inheritDoc}
*/
@Override
diff -r 5884f3bd703a -r d1a599ccf879 src/com/beem/project/beem/utils/BeemBroadcastReceiver.java
--- a/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java Mon Feb 15 23:37:25 2010 +0100
+++ b/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java Wed Feb 17 02:29:11 2010 +0100
@@ -51,6 +51,7 @@
import android.widget.Toast;
import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
/**
* Manage broadcast disconnect intent.
@@ -83,6 +84,7 @@
}
} 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));
}
}