--- a/res/menu/chat.xml Mon Aug 22 22:35:31 2011 +0200
+++ b/res/menu/chat.xml Tue Aug 23 01:12:26 2011 +0200
@@ -14,10 +14,8 @@
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_local_key" android:visible="true"
- android:title="@string/chat_menu_otr_local_key" />
- <item android:id="@+id/chat_menu_otr_remote_key"
- android:visible="true" android:title="@string/chat_menu_otr_remote_key" />
+ <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/values/strings.xml Mon Aug 22 22:35:31 2011 +0200
+++ b/res/values/strings.xml Tue Aug 23 01:12:26 2011 +0200
@@ -272,10 +272,8 @@
<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_listen_otr_session">Listen for OTR session</string>
<string name="chat_menu_stop_otr_session">Stop OTR session</string>
- <string name="chat_menu_otr_local_key">OTR local key</string>
- <string name="chat_menu_otr_remote_key">OTR remote key</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>
@@ -287,8 +285,12 @@
<string name="chat_otrstate_plaintext">PLAINTEXT</string>
<string name="chat_otrstate_encrypted">ENCRYPTED</string>
<string name="chat_otrstate_finished">FINISHED</string>
- <string name="chat_otr_verify_key">Verify remote fingerprint %s ?</string>
- <string name="chat_otr_local_key">Local fingerprint %s </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>
--- a/src/com/beem/project/beem/BeemApplication.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem;
@@ -49,15 +49,14 @@
import android.preference.PreferenceManager;
/**
- * This class contains informations that needs to be global in the application.
- * Theses informations must be necessary for the activities and the service.
+ * 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"
+ /*
+ * 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";
@@ -160,7 +159,6 @@
/**
* Enable Pep in the application context.
- *
* @param enabled true to enable pep
*/
public void setPepEnabled(boolean enabled) {
@@ -169,7 +167,6 @@
/**
* Check if Pep is enabled.
- *
* @return true if enabled
*/
public boolean isPepEnabled() {
@@ -188,7 +185,7 @@
}
@Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (BeemApplication.ACCOUNT_USERNAME_KEY.equals(key) || BeemApplication.ACCOUNT_PASSWORD_KEY.equals(key)) {
String login = mSettings.getString(BeemApplication.ACCOUNT_USERNAME_KEY, "");
String password = mSettings.getString(BeemApplication.ACCOUNT_PASSWORD_KEY, "");
--- a/src/com/beem/project/beem/BeemService.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/BeemService.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem;
import org.jivesoftware.smack.ConnectionConfiguration;
@@ -89,10 +89,8 @@
import com.beem.project.beem.smack.caps.CapsProvider;
/**
- * 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.
+ * 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 {
@@ -134,7 +132,7 @@
*/
private void initConnectionConfig() {
// TODO add an option for this ?
-// SmackConfiguration.setPacketReplyTimeout(30000);
+ // SmackConfiguration.setPacketReplyTimeout(30000);
mUseProxy = mSettings.getBoolean(BeemApplication.PROXY_USE_KEY, false);
if (mUseProxy) {
String stype = mSettings.getString(BeemApplication.PROXY_TYPE_KEY, "HTTP");
@@ -182,7 +180,6 @@
return true;
}
-
/**
* {@inheritDoc}
*/
@@ -212,8 +209,8 @@
if (!"".equals(tmpPort))
mPort = Integer.parseInt(tmpPort);
}
- if (mSettings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false) ||
- "gmail.com".equals(mService) || "googlemail.com".equals(mService)) {
+ if (mSettings.getBoolean(BeemApplication.FULL_JID_LOGIN_KEY, false) || "gmail.com".equals(mService)
+ || "googlemail.com".equals(mService)) {
mLogin = tmpJid;
}
@@ -267,7 +264,8 @@
if (mSettings.getBoolean(BeemApplication.NOTIFICATION_VIBRATE_KEY, true))
notif.defaults |= Notification.DEFAULT_VIBRATE;
notif.defaults |= Notification.DEFAULT_LIGHTS;
- String ringtoneStr = mSettings.getString(BeemApplication.NOTIFICATION_SOUND_KEY, Settings.System.DEFAULT_NOTIFICATION_URI.toString());
+ String ringtoneStr = mSettings.getString(BeemApplication.NOTIFICATION_SOUND_KEY,
+ Settings.System.DEFAULT_NOTIFICATION_URI.toString());
notif.sound = Uri.parse(ringtoneStr);
mNotificationManager.notify(id, notif);
}
@@ -314,7 +312,6 @@
/**
* Get the notification manager system service.
- *
* @return the notification manager service.
*/
public NotificationManager getNotificationManager() {
@@ -346,8 +343,7 @@
// 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("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);
@@ -364,81 +360,51 @@
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);
+ // 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);
/*
- // 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());
+ * // 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());
*/
}
@@ -490,7 +456,7 @@
mOldStatus = mConnection.getPreviousStatus();
if (mConnection.isAuthentificated())
mConnection.changeStatus(Status.CONTACT_STATUS_AWAY,
- mSettings.getString(BeemApplication.AUTO_AWAY_MSG_KEY, "Away"));
+ mSettings.getString(BeemApplication.AUTO_AWAY_MSG_KEY, "Away"));
} else if (intentAction.equals(Intent.ACTION_SCREEN_ON)) {
if (mConnection.isAuthentificated())
mConnection.changeStatus(mOldMode, mOldStatus);
@@ -498,4 +464,3 @@
}
}
}
-
--- a/src/com/beem/project/beem/otr/BeemOtrManager.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/otr/BeemOtrManager.java Tue Aug 23 01:12:26 2011 +0200
@@ -44,6 +44,7 @@
import android.util.Log;
import com.beem.project.beem.service.ChatAdapter;
+
/**
* BeemOtrManager.
*/
@@ -54,7 +55,6 @@
//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;
@@ -82,7 +82,6 @@
return mOtrEngine;
}
-
/**
* BeemOtrManager.getInstance.
* @return BeemOtrManager
@@ -94,7 +93,8 @@
}
/**
- * We must call addChat before stating a new otr session because we will need the chat instance for message injection.
+ * 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.
*/
@@ -115,6 +115,14 @@
return mOtrKeyManager.getRemoteFingerprint(sessionID);
}
+ public void verifyRemoteFingerprint(final SessionID sessionId) {
+ mOtrKeyManager.verify(sessionId);
+ }
+
+ public void unverifyRemoteFingerprint(final SessionID sessionId) {
+ mOtrKeyManager.unverify(sessionId);
+ }
+
public String getLocalFingerprint(final SessionID sessionID) {
return mOtrKeyManager.getLocalFingerprint(sessionID);
}
@@ -141,13 +149,13 @@
}
@Override
- public KeyPair getKeyPair(SessionID sessionID) {
+ public KeyPair getKeyPair(SessionID sessionID) {
KeyPair kp = mOtrKeyManager.loadLocalKeyPair(sessionID);
- if(kp != null)
+ if (kp != null)
return kp;
-
- mOtrKeyManager.generateLocalKeyPair(sessionID);
+
+ mOtrKeyManager.generateLocalKeyPair(sessionID);
return mOtrKeyManager.loadLocalKeyPair(sessionID);
}
@@ -162,8 +170,16 @@
if (mOtrKeyManager.loadRemotePublicKey(sessionID) == null) {
mOtrKeyManager.savePublicKey(sessionID, mOtrEngine.getRemotePublicKey(sessionID));
}
- mChats.get(sessionID).otrStateChanged(mOtrEngine.getSessionStatus(sessionID).toString());
- if(mOtrEngine.getSessionStatus(sessionID) == SessionStatus.FINISHED) {
+
+ SessionStatus status = mOtrEngine.getSessionStatus(sessionID);
+
+ if (status.equals(SessionStatus.ENCRYPTED)) {
+ if (mOtrKeyManager.isVerified(sessionID)) {
+ mChats.get(sessionID).otrStateChanged("AUTHENTICATED");
+ } else
+ mChats.get(sessionID).otrStateChanged(status.toString());
+ }
+ if (mOtrEngine.getSessionStatus(sessionID) == SessionStatus.FINISHED) {
try {
mChats.get(sessionID).localEndOtrSession();
} catch (OtrException e) {
--- a/src/com/beem/project/beem/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
/**
* This package contains BEEM's entry points.
--- a/src/com/beem/project/beem/providers/AvatarProvider.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/providers/AvatarProvider.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.providers;
import android.content.ContentProvider;
@@ -58,13 +58,11 @@
/**
* 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");
+ public static final Uri CONTENT_URI = Uri.parse("content://com.beem.project.beem.providers.avatarprovider");
private static final String TAG = AvatarProvider.class.getSimpleName();
private static final String AUTHORITY = "com.beem.project.beem.providers.avatarprovider";
@@ -78,17 +76,16 @@
String ID = "_id";
}
- private static String[] columnNames = new String[] {Columns.ID };
+ private static String[] columnNames = new String[] { Columns.ID };
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);
+ 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);
+ URIMATCHER.addURI(AUTHORITY, null, AVATAR);
}
private String mDataPath;
@@ -101,7 +98,6 @@
/**
* Translate the mode passed to {@link #openFile} into mode passed to {@link ParcelFileDescriptor#open}.
- *
* @param uri the uri to open
* @param mode the mode
* @return the mode
@@ -112,23 +108,18 @@
if ("r".equals(mode)) {
modeBits = ParcelFileDescriptor.MODE_READ_ONLY;
} else if ("w".equals(mode) || "wt".equals(mode)) {
- modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY
- | ParcelFileDescriptor.MODE_CREATE
+ modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY | ParcelFileDescriptor.MODE_CREATE
| ParcelFileDescriptor.MODE_TRUNCATE;
} else if ("wa".equals(mode)) {
- modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY
- | ParcelFileDescriptor.MODE_CREATE
+ modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY | ParcelFileDescriptor.MODE_CREATE
| ParcelFileDescriptor.MODE_APPEND;
} else if ("rw".equals(mode)) {
- modeBits = ParcelFileDescriptor.MODE_READ_WRITE
- | ParcelFileDescriptor.MODE_CREATE;
+ modeBits = ParcelFileDescriptor.MODE_READ_WRITE | ParcelFileDescriptor.MODE_CREATE;
} else if ("rwt".equals(mode)) {
- modeBits = ParcelFileDescriptor.MODE_READ_WRITE
- | ParcelFileDescriptor.MODE_CREATE
+ modeBits = ParcelFileDescriptor.MODE_READ_WRITE | ParcelFileDescriptor.MODE_CREATE
| ParcelFileDescriptor.MODE_TRUNCATE;
} else {
- throw new FileNotFoundException("Bad mode for " + uri + ": "
- + mode);
+ throw new FileNotFoundException("Bad mode for " + uri + ": " + mode);
}
return modeBits;
}
@@ -143,8 +134,7 @@
}
@Override
- public ParcelFileDescriptor openFile(Uri uri, String mode)
- throws FileNotFoundException {
+ public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
String id = uri.getPath();
File data = new File(mDataPath, id);
int modeBits = AvatarProvider.modeToMode(uri, mode);
@@ -168,7 +158,7 @@
String id = uri.getPathSegments().get(0);
File f = new File(mDataPath, id);
if (f.exists())
- c.newRow().add(f.getName());
+ c.newRow().add(f.getName());
break;
default:
Log.w(TAG, "Unsupported uri for query match = " + match);
--- a/src/com/beem/project/beem/providers/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/providers/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,10 +40,10 @@
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 Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/BeemAvatarCache.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import android.content.ContentResolver;
@@ -72,7 +72,6 @@
/**
* Create a BeemAvatarCache.
- *
* @param ctx The android context of the cache.
*/
public BeemAvatarCache(final Context ctx) {
@@ -80,7 +79,6 @@
mContentResolver = mContext.getContentResolver();
}
-
@Override
public void put(String key, byte[] data) throws IOException {
Uri uri = AvatarProvider.CONTENT_URI.buildUpon().appendPath(key).build();
@@ -100,7 +98,7 @@
byte[] data = new byte[1024];
int nbread;
while ((nbread = in.read(data)) != -1)
- os.write(data, 0, nbread);
+ os.write(data, 0, nbread);
} finally {
in.close();
os.close();
--- a/src/com/beem/project/beem/service/BeemAvatarManager.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/BeemAvatarManager.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
@@ -61,8 +61,7 @@
import org.jivesoftware.smack.Connection;
/**
- * An AvatarManager for Beem.
- * It allows to publish avatar on the Android platform.
+ * 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();
@@ -72,7 +71,6 @@
/**
* Create a BeemAvatarManager.
- *
* @param ctx the Android context
* @param con the connection
* @param pepMgr the PepSubManager of the connection
@@ -80,14 +78,13 @@
* @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) {
+ 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
*/
@@ -102,9 +99,7 @@
}
/**
- * Publish an avatar.
- * This will send the XMPP stanza to enable the publication of an avatar.
- *
+ * 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
*/
@@ -127,7 +122,6 @@
/**
* 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
@@ -153,7 +147,6 @@
/**
* 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
--- a/src/com/beem/project/beem/service/BeemCapsManager.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/BeemCapsManager.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import org.jivesoftware.smack.Connection;
@@ -79,7 +79,6 @@
/**
* Create a BeemCapsManager.
- *
* @param sdm the ServiceDiscoveryManager to use
* @param conn the connection to use
* @param context the Android context to use to store data
@@ -90,7 +89,6 @@
initCacheDirectory();
}
-
@Override
protected DiscoverInfo load(String ver) {
File fver = new File(mCacheDir, ver);
@@ -101,7 +99,7 @@
mParser = makeParser();
mParser.setInput(fr);
return (DiscoverInfo) PacketParserUtils.parsePacketExtension("query",
- "http://jabber.org/protocol/disco#info", mParser);
+ "http://jabber.org/protocol/disco#info", mParser);
} finally {
fr.close();
@@ -119,7 +117,7 @@
try {
Writer fw = new BufferedWriter(new FileWriter(fver));
try {
- String data = info.toXML();
+ String data = info.toXML();
fw.write(data, 0, data.length());
} finally {
fw.close();
@@ -150,7 +148,6 @@
/**
* Make an Xml parser.
- *
* @return the created xml parser.
* @throws XmlPullParserException if an error occurs while creating the parser.
*/
--- a/src/com/beem/project/beem/service/BeemChatManager.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import java.io.File;
@@ -81,8 +81,7 @@
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 RemoteCallbackList<IChatManagerListener> mRemoteChatCreationListeners = new RemoteCallbackList<IChatManagerListener>();
private final BeemService mService;
/**
@@ -178,7 +177,8 @@
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/";
+ if ("".equals(historyPath))
+ historyPath = "/Android/data/com.beem.project.beem/chat/";
res.setHistory(history);
res.setAccountUser(accountUser);
res.listenOtrSession();
@@ -287,8 +287,8 @@
try {
CharSequence tickerText = mService.getBind().getRoster().getContact(chat.getParticipant().getJID())
.getName();
- Notification notification = new Notification(android.R.drawable.stat_notify_chat, tickerText, System
- .currentTimeMillis());
+ Notification notification = new Notification(android.R.drawable.stat_notify_chat, tickerText,
+ System.currentTimeMillis());
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(mService, tickerText, msgBody, makeChatIntent(chat));
mService.sendNotification(chat.getParticipant().getJID().hashCode(), notification);
@@ -316,11 +316,12 @@
}
@Override
- public void stateChanged(final IChat chat) { }
+ public void stateChanged(final IChat chat) {
+ }
@Override
public void otrStateChanged(String otrState) throws RemoteException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
}
--- a/src/com/beem/project/beem/service/ChatAdapter.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/ChatAdapter.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import java.io.File;
@@ -141,7 +141,6 @@
otrBody = msgBody;
}
-
send.setThread(message.getThread());
send.setSubject(message.getSubject());
send.setType(org.jivesoftware.smack.packet.Message.Type.chat);
@@ -188,7 +187,6 @@
}
}
-
/**
* {@inheritDoc}
*/
@@ -268,7 +266,7 @@
try {
FileWriter file = new FileWriter(filepath, true);
String log = msg.getTimestamp() + " " + contactName + " " + msg.getBody()
- + System.getProperty("line.separator");
+ + System.getProperty("line.separator");
file.write(log);
file.close();
} catch (IOException e) {
@@ -331,18 +329,20 @@
/**
* Constructor.
*/
- public MsgListener() { }
+ public MsgListener() {
+ }
@Override
public void processMessage(Chat chat, org.jivesoftware.smack.packet.Message message) {
- Message msg = new 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());
+ body = BeemOtrManager.getInstance().getOtrManager()
+ .transformReceiving(mOtrSessionId, msg.getBody());
msg.setBody(body);
} catch (OtrException e) {
e.printStackTrace();
@@ -383,8 +383,8 @@
mRemoteListeners.finishBroadcast();
}
+ }
- }
/**
* This method is executed when the otr session status change.
* @param otrState the new state of otr session.
@@ -403,14 +403,13 @@
mRemoteListeners.finishBroadcast();
}
-
@Override
public void startOtrSession() throws RemoteException {
if (mOtrSessionId == null) {
- mOtrSessionId = new SessionID(mAccountUser, mParticipant.getJIDWithRes(), PROTOCOL);
- BeemOtrManager.getInstance().addChat(mOtrSessionId, this);
+ mOtrSessionId = new SessionID(mAccountUser, mParticipant.getJIDWithRes(), PROTOCOL);
+ BeemOtrManager.getInstance().addChat(mOtrSessionId, this);
}
-
+
try {
BeemOtrManager.getInstance().getOtrManager().startSession(mOtrSessionId);
} catch (OtrException e) {
@@ -423,7 +422,7 @@
@Override
public void endOtrSession() throws RemoteException {
try {
- localEndOtrSession();
+ localEndOtrSession();
} catch (OtrException e) {
e.printStackTrace();
throw new RemoteException();
@@ -441,10 +440,11 @@
BeemOtrManager.getInstance().getOtrManager().endSession(mOtrSessionId);
BeemOtrManager.getInstance().removeChat(mOtrSessionId);
mOtrSessionId = null;
+ listenOtrSession();
return true;
}
- public void listenOtrSession(){
+ public void listenOtrSession() {
if (mOtrSessionId != null)
return;
@@ -470,11 +470,22 @@
return BeemOtrManager.getInstance().getRemoteFingerprint(mOtrSessionId);
}
- @Override
- public String getOtrStatus() throws RemoteException {
- if (mOtrSessionId == null)
- return null;
- return BeemOtrManager.getInstance().getOtrManager().getSessionStatus(mOtrSessionId).toString();
+ @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();
+ }
}
-
--- a/src/com/beem/project/beem/service/Contact.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/Contact.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import java.util.ArrayList;
@@ -141,7 +141,6 @@
/**
* Make an xmpp uri for a spcific jid.
- *
* @param jid the jid to represent as an uri
* @return an uri representing this jid.
*/
@@ -285,7 +284,6 @@
/**
* Get the avatar id of the contact.
- *
* @return the avatar id or null if there is not
*/
public String getAvatarId() {
@@ -322,7 +320,6 @@
/**
* Set the avatar id of the contact.
- *
* @param avatarId the avatar id
*/
public void setAvatarId(String avatarId) {
--- a/src/com/beem/project/beem/service/LoginAsyncTask.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/LoginAsyncTask.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import android.os.AsyncTask;
--- a/src/com/beem/project/beem/service/Message.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/Message.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import org.jivesoftware.smack.packet.XMPPError;
@@ -291,7 +291,6 @@
/**
* Set the Date of the message.
- *
* @param date date of the message.
*/
public void setTimestamp(Date date) {
@@ -300,7 +299,6 @@
/**
* Get the Date of the message.
- *
* @return if it is a delayed message get the date the message was sended.
*/
public Date getTimestamp() {
--- a/src/com/beem/project/beem/service/PresenceAdapter.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/PresenceAdapter.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import org.jivesoftware.smack.packet.Presence;
@@ -101,7 +101,8 @@
mStatusText = presence.getStatus();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.os.Parcelable#describeContents()
*/
@Override
@@ -190,7 +191,8 @@
this.mType = type;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
*/
@Override
--- a/src/com/beem/project/beem/service/PrivacyListItem.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/PrivacyListItem.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import android.os.Parcel;
--- a/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/PrivacyListManagerAdapter.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import java.util.ArrayList;
@@ -71,8 +71,7 @@
private final PrivacyListManager mPrivacyListManager;
- private final RemoteCallbackList<IPrivacyListListener> mPrivacyListListeners =
- new RemoteCallbackList<IPrivacyListListener>();
+ private final RemoteCallbackList<IPrivacyListListener> mPrivacyListListeners = new RemoteCallbackList<IPrivacyListListener>();
private final PrivacyListListenerAdapter mPrivacyListListener = new PrivacyListListenerAdapter();
/**
@@ -84,14 +83,16 @@
mPrivacyListManager.addListener(mPrivacyListListener);
}
- /* (non-Javadoc)
+ /*
+ * (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)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#createPrivacyList(java.lang.String, java.util.List)
*/
@Override
@@ -111,7 +112,8 @@
Log.d(TAG, "END createPrivacyList.");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#declineActivePrivacyList()
*/
@Override
@@ -123,7 +125,8 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#declineDefaultPrivacyList()
*/
@Override
@@ -135,7 +138,8 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#editPrivacyList(java.lang.String, java.util.List)
*/
@Override
@@ -149,7 +153,8 @@
Log.d(TAG, "END editPrivacyList.");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#getActivePrivacyList()
*/
@Override
@@ -163,7 +168,8 @@
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#getBlockedGroupsByList(java.lang.String)
*/
@Override
@@ -181,7 +187,8 @@
return blockedGroups;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#getBlockedUsersByList(java.lang.String)
*/
@Override
@@ -199,7 +206,8 @@
return blockedUsers;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#getDefaultPrivacyList()
*/
@Override
@@ -213,7 +221,8 @@
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#removePrivacyList(java.lang.String)
*/
@Override
@@ -225,7 +234,8 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#setActivePrivacyList(java.lang.String)
*/
@Override
@@ -237,7 +247,8 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#setDefaultPrivacyList(java.lang.String)
*/
@Override
@@ -287,7 +298,8 @@
/**
* Constructor.
*/
- public PrivacyListListenerAdapter() { }
+ public PrivacyListListenerAdapter() {
+ }
@Override
public void setPrivacyList(final String listName, final List<PrivacyItem> listItem) {
@@ -333,7 +345,8 @@
mPrivacyListListeners.unregister(listener);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IPrivacyListManager#getPrivacyLists()
*/
@Override
--- a/src/com/beem/project/beem/service/RosterAdapter.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import java.util.ArrayList;
@@ -77,8 +77,7 @@
private static final String TAG = "RosterAdapter";
private final Roster mAdaptee;
- private final RemoteCallbackList<IBeemRosterListener> mRemoteRosListeners =
- new RemoteCallbackList<IBeemRosterListener>();
+ 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>();
@@ -110,7 +109,6 @@
mAvatarManager.addAvatarListener(new AvatarEventListener());
}
-
/**
* {@inheritDoc}
*/
@@ -212,7 +210,8 @@
mAdaptee.getEntry(jid).setName(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IRoster#getPresence(java.lang.String)
*/
@Override
@@ -220,7 +219,8 @@
return new PresenceAdapter(mAdaptee.getPresence(jid));
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IRoster#addContactToGroup(java.lang.String, java.lang.String)
*/
@Override
@@ -234,7 +234,8 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IRoster#removeContactFromGroup(java.lang.String, java.lang.String)
*/
@Override
@@ -283,14 +284,14 @@
*/
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_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_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;
@@ -393,14 +394,14 @@
/**
* Listener on avatar metadata event.
- *
*/
private class AvatarEventListener implements AvatarListener {
/**
* Constructor.
*/
- public AvatarEventListener() { }
+ public AvatarEventListener() {
+ }
@Override
public void onAvatarChange(String from, String avatarId, List<Info> avatarInfos) {
--- a/src/com/beem/project/beem/service/UserInfo.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/UserInfo.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,16 +40,14 @@
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.
- *
+ * This class contains information about the user of the connection. These informations are sent by the connection.
*/
public class UserInfo implements Parcelable {
@@ -101,7 +99,6 @@
/**
* Get the avatar id of the user.
- *
* @return the avatar id
*/
public String getAvatarId() {
@@ -110,7 +107,6 @@
/**
* Set the avater id of the user.
- *
* @param avatarId the avatar id
*/
public void setAvatarId(String avatarId) {
@@ -119,7 +115,6 @@
/**
* Get the full jid of the user.
- *
* @return the jid
*/
public String getJid() {
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import org.jivesoftware.smack.ConnectionConfiguration;
@@ -116,8 +116,7 @@
private BeemAvatarManager mAvatarManager;
private PepSubManager mPepManager;
private SharedPreferences mPref;
- private final RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners =
- new RemoteCallbackList<IBeemConnectionListener>();
+ private final RemoteCallbackList<IBeemConnectionListener> mRemoteConnListeners = new RemoteCallbackList<IBeemConnectionListener>();
private final SubscribePacketListener mSubscribePacketListener = new SubscribePacketListener();
private final ConnexionListenerAdapter mConListener = new ConnexionListenerAdapter();
@@ -132,8 +131,8 @@
* @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) {
+ public XmppConnectionAdapter(final ConnectionConfiguration config, final String login, final String password,
+ final BeemService service) {
this(new XMPPConnection(config), login, password, service);
}
@@ -144,8 +143,8 @@
* @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) {
+ public XmppConnectionAdapter(final String serviceName, final String login, final String password,
+ final BeemService service) {
this(new XMPPConnection(serviceName), login, password, service);
}
@@ -156,8 +155,8 @@
* @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) {
+ public XmppConnectionAdapter(final XMPPConnection con, final String login, final String password,
+ final BeemService service) {
mAdaptee = con;
PrivacyListManager.getInstanceFor(mAdaptee);
mLogin = login;
@@ -199,8 +198,8 @@
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"));
+ mService.getResources().getIdentifier(e.getXMPPError().getCondition().replace("-", "_"),
+ "string", "com.beem.project.beem"));
mErrorMsg = str;
} catch (NullPointerException e2) {
if (!"".equals(e.getMessage()))
@@ -334,7 +333,6 @@
/**
* Get the AvatarManager of this connection.
- *
* @return the AvatarManager or null if there is not
*/
public BeemAvatarManager getAvatarManager() {
@@ -363,13 +361,13 @@
*/
private void updateNotification(String text) {
Notification mStatusNotification;
- mStatusNotification = new Notification(com.beem.project.beem.R.drawable.beem_status_icon, text, System
- .currentTimeMillis());
+ mStatusNotification = new Notification(com.beem.project.beem.R.drawable.beem_status_icon, 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));
+ 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);
}
@@ -416,7 +414,6 @@
/**
* Get the user informations.
- *
* @return the user infos
*/
public UserInfo getUserInfo() {
@@ -670,11 +667,10 @@
R.string.AcceptContactRequest, from), System.currentTimeMillis());
notif.flags = Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(mService, Subscription.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
- .putExtra("from", from);
- notif.setLatestEventInfo(mService, from, mService
- .getString(R.string.AcceptContactRequestFrom, from), PendingIntent.getActivity(mService, 0,
- intent, PendingIntent.FLAG_ONE_SHOT));
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("from", from);
+ notif.setLatestEventInfo(mService, from,
+ mService.getString(R.string.AcceptContactRequestFrom, from),
+ PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
int id = packet.hashCode();
mService.sendNotification(id, notif);
}
@@ -722,9 +718,9 @@
notification.flags = Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(mService, Subscription.class);
intent.setData(Contact.makeXmppUri(from));
- notification.setLatestEventInfo(mService, from, mService
- .getString(R.string.AcceptContactRequestFrom, from), PendingIntent.getActivity(mService, 0,
- intent, PendingIntent.FLAG_ONE_SHOT));
+ notification.setLatestEventInfo(mService, from,
+ mService.getString(R.string.AcceptContactRequestFrom, from),
+ PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
int id = p.hashCode();
mService.sendNotification(id, notification);
}
--- a/src/com/beem/project/beem/service/XmppFacade.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/XmppFacade.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.service;
import org.jivesoftware.smack.packet.Presence;
@@ -142,7 +142,8 @@
mConnexion.getAdaptee().sendPacket(presence2);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see com.beem.project.beem.service.aidl.IXmppFacade#call(java.lang.String)
*/
@Override
--- a/src/com/beem/project/beem/service/aidl/IChat.aidl Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/aidl/IChat.aidl Tue Aug 23 01:12:26 2011 +0200
@@ -107,6 +107,9 @@
*/
String getRemoteOtrFingerprint();
+ void verifyRemoteFingerprint(in boolean ok);
+
+
/**
* get current OTR status.
*/
--- a/src/com/beem/project/beem/service/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/service/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -39,7 +39,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
/**
* This package contains all the class use by the service.
*/
--- a/src/com/beem/project/beem/smack/avatar/AvatarCache.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarCache.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,22 +40,19 @@
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.
- *
+ * 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 datato cache
* @throws IOException if an IO error occurs while caching the data
@@ -64,7 +61,6 @@
/**
* 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
@@ -73,16 +69,14 @@
/**
* 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
+ * @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
*/
--- a/src/com/beem/project/beem/smack/avatar/AvatarExtension.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarExtension.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,16 +40,14 @@
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
- *
+ * PacketExtension to represent the Avatar data. XML namespace urn:xmpp:avatar:data
*/
public class AvatarExtension implements PacketExtension {
@@ -73,7 +71,6 @@
/**
* Get the avatar data as a Base64 string.
- *
* @return a base64 string.
*/
public String getBase64() {
@@ -82,7 +79,6 @@
/**
* Get the avatar data.
- *
* @return the decoded data
*/
public byte[] getData() {
--- a/src/com/beem/project/beem/smack/avatar/AvatarListener.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarListener.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import java.util.List;
@@ -48,13 +48,11 @@
/**
* 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
--- a/src/com/beem/project/beem/smack/avatar/AvatarManager.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarManager.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
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;
@@ -62,15 +62,13 @@
import org.jivesoftware.smack.util.StringUtils;
/**
- * This class deals with the avatar data.
- * It can be configured to auto retrieve the avatar and put it in cache.
- *
+ * 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. */
+ /** The pubsub node for avatar data. */
public static final String AVATARDATA_NODE = "urn:xmpp:avatar:data";
- /** The pubsub node for avatar metadata. */
+ /** The pubsub node for avatar metadata. */
public static final String AVATARMETADATA_NODE = "urn:xmpp:avatar:metadata";
private PepSubManager mPep;
@@ -81,14 +79,13 @@
/**
* 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) {
+ public AvatarManager(final Connection con, final PepSubManager pepMgr, final AvatarCache cache,
+ final boolean autoDownload) {
mCon = con;
mPep = pepMgr;
mAutoDownload = autoDownload;
@@ -98,7 +95,6 @@
/**
* Create an AvatarManager.
- *
* @param con the connection
* @param pepMgr the PepSubManager of the Connection
* @param autoDownload true to enable auto download of avatars
@@ -113,7 +109,6 @@
/**
* 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
*/
@@ -129,7 +124,6 @@
/**
* Add an AvatarListener.
- *
* @param listener the AvatarListener to add
*/
public void addAvatarListener(AvatarListener listener) {
@@ -139,7 +133,6 @@
/**
* Remove an AvatarListener.
- *
* @param listener the AvatarListener to remove
*/
public void removeAvatarListener(AvatarListener listener) {
@@ -148,7 +141,6 @@
/**
* 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
@@ -158,7 +150,7 @@
try {
AvatarRetriever retriever = AvatarRetrieverFactory.getRetriever(mCon, from, info);
byte[] avatar = retriever.getAvatar();
- // TODO check the hash before store
+ // TODO check the hash before store
mCache.put(avatarId, avatar);
return true;
} catch (IOException e) {
@@ -178,7 +170,6 @@
/**
* Send an avatar image to the pep server.
- *
* @param data the image data.
* @return true if the image where successfully sent. false otherwise
*/
@@ -194,9 +185,7 @@
}
/**
- * Send the metadata of the avatar you want to publish.
- * By sending this metadata, you publish an avatar.
- *
+ * 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
*/
@@ -207,10 +196,8 @@
}
/**
- * Select the avatar to download.
- * Subclass should override this method to take control over the selection process.
+ * 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
*/
@@ -218,10 +205,8 @@
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
@@ -234,7 +219,6 @@
/**
* Publish an avatar data.
- *
* @param id the id of the avatar data
* @param data the data of the avatar
*/
@@ -247,7 +231,6 @@
/**
* 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
@@ -257,7 +240,6 @@
l.onAvatarChange(from, avatarId, avatarInfos);
}
-
/**
* A listener to PEPEevent.
*/
--- a/src/com/beem/project/beem/smack/avatar/AvatarMetadataExtension.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarMetadataExtension.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import java.util.LinkedList;
@@ -49,9 +49,7 @@
import org.jivesoftware.smack.packet.PacketExtension;
/**
- * PacketExtension to represent the Avatar metadata.
- * XML namespace urn:xmpp:avatar:metadata
- *
+ * PacketExtension to represent the Avatar metadata. XML namespace urn:xmpp:avatar:metadata
*/
public class AvatarMetadataExtension implements PacketExtension {
private List<Info> mInfos = new LinkedList<Info>();
@@ -64,7 +62,6 @@
/**
* Get the metadata informations.
- *
* @return a list of informations
*/
public List<Info> getInfos() {
@@ -73,7 +70,6 @@
/**
* Add a metadate information.
- *
* @param info the metadata information to add
*/
public void addInfo(Info info) {
@@ -114,7 +110,6 @@
/**
* 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
@@ -127,7 +122,6 @@
/**
* Set the size of the avatar in bytes.
- *
* @param bytes the size
*/
public void setBytes(int bytes) {
@@ -136,7 +130,6 @@
/**
* Set the size of the avatar in bytes.
- *
* @return the size
*/
public int getBytes() {
@@ -145,7 +138,6 @@
/**
* Set the height.
- *
* @param height the height
*/
public void setHeight(int height) {
@@ -154,7 +146,6 @@
/**
* Get the height.
- *
* @return the height
*/
public int getHeight() {
@@ -163,7 +154,6 @@
/**
* Set the width.
- *
* @param width the width
*/
public void setWidth(int width) {
@@ -172,7 +162,6 @@
/**
* Get the width.
- *
* @return the width
*/
public int getWidth() {
@@ -181,7 +170,6 @@
/**
* Set the url.
- *
* @param url the url
*/
public void setUrl(String url) {
@@ -190,7 +178,6 @@
/**
* Get the url.
- *
* @return the url, null if no url is present
*/
public String getUrl() {
@@ -199,7 +186,6 @@
/**
* Get the id.
- *
* @return the id
*/
public String getId() {
@@ -208,7 +194,6 @@
/**
* Set the id.
- *
* @param id the id
*/
public void setId(String id) {
@@ -217,7 +202,6 @@
/**
* Set the MIME type of the avatar.
- *
* @param type the type
*/
public void setType(String type) {
@@ -226,7 +210,6 @@
/**
* Get the MIME type of the avatar.
- *
* @return the type, null if no type is present
*/
public String getType() {
@@ -235,7 +218,6 @@
/**
* Return this information as an xml element.
- *
* @return an xml element representing this information
*/
public String toXML() {
--- a/src/com/beem/project/beem/smack/avatar/AvatarMetadataProvider.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarMetadataProvider.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import org.jivesoftware.smack.packet.PacketExtension;
@@ -48,21 +48,19 @@
import org.xmlpull.v1.XmlPullParser;
/**
- * A PacketExtensionProvider to parse the Avatar metadata.
- * XML namespace urn:xmpp:avatar:metadata
+ * 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
+ * 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 {
+ public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
AvatarMetadataExtension metadata = new AvatarMetadataExtension();
boolean done = false;
StringBuilder buffer = new StringBuilder();
@@ -80,10 +78,12 @@
try {
if (sbytes != null)
bytes = Integer.parseInt(sbytes);
- } catch (NumberFormatException e) { }
+ } catch (NumberFormatException e) {
+ }
if (bytes != 0 && id != null && type != null)
info = new AvatarMetadataExtension.Info(id, type, bytes);
- else // invalid info
+ else
+ // invalid info
continue;
String url = parser.getAttributeValue(null, "url");
@@ -97,7 +97,8 @@
width = Integer.parseInt(parser.getAttributeValue(null, "width"));
info.setHeight(height);
info.setWidth(width);
- } catch (NumberFormatException e) { }
+ } catch (NumberFormatException e) {
+ }
metadata.addInfo(info);
}
} else if (eventType == XmlPullParser.END_TAG) {
--- a/src/com/beem/project/beem/smack/avatar/AvatarProvider.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarProvider.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import org.jivesoftware.smack.packet.PacketExtension;
@@ -48,21 +48,19 @@
import org.xmlpull.v1.XmlPullParser;
/**
- * A PacketExtensionProvider to parse the Avatar data.
- * XML namespace urn:xmpp:avatar:data
+ * 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
+ * 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 {
+ public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
AvatarMetadataExtension metadata = new AvatarMetadataExtension();
boolean done = false;
StringBuilder buffer = new StringBuilder();
--- a/src/com/beem/project/beem/smack/avatar/AvatarRetriever.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarRetriever.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import java.io.IOException;
@@ -52,7 +52,6 @@
/**
* Retrieve the avatar.
- *
* @return the avatar
* @throws IOException if an IO error occurs while retrieving the avatar
*/
--- a/src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/AvatarRetrieverFactory.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
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;
@@ -62,7 +62,6 @@
/**
* 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
--- a/src/com/beem/project/beem/smack/avatar/FileAvatarCache.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/FileAvatarCache.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import java.io.BufferedInputStream;
@@ -62,7 +62,6 @@
/**
* Create a FileAvatarCache.
- *
* @param storedir The directory used to store the data.
*/
public FileAvatarCache(final File storedir) {
@@ -91,7 +90,7 @@
byte[] data = new byte[1024];
int nbread;
while ((nbread = in.read(data)) != -1)
- os.write(data, 0, nbread);
+ os.write(data, 0, nbread);
} finally {
in.close();
os.close();
--- a/src/com/beem/project/beem/smack/avatar/HttpAvatarRetriever.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/HttpAvatarRetriever.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import java.io.InputStream;
@@ -51,14 +51,13 @@
/**
* An AvatarRetriever which retrieve the avatar over HTTP.
*/
-public class HttpAvatarRetriever implements AvatarRetriever {
+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) {
@@ -67,7 +66,6 @@
/**
* Create a HttpAvatarRetriever.
- *
* @param url the url of the avatar to download.
*/
public HttpAvatarRetriever(final String url) {
--- a/src/com/beem/project/beem/smack/avatar/HttpClientAvatarRetriever.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/HttpClientAvatarRetriever.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import java.io.InputStream;
@@ -56,14 +56,13 @@
/**
* An AvatarRetriever which retrieve the avatar over HTTP using the Apache HttpClient.
*/
-public class HttpClientAvatarRetriever implements AvatarRetriever {
+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.
*/
@@ -74,7 +73,6 @@
/**
* Create a HttpAvatarRetriever.
- *
* @param url the url of the avatar to download.
*/
public HttpClientAvatarRetriever(final String url) {
--- a/src/com/beem/project/beem/smack/avatar/XmppAvatarRetriever.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/XmppAvatarRetriever.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.avatar;
import java.util.List;
@@ -65,7 +65,6 @@
/**
* 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
--- a/src/com/beem/project/beem/smack/avatar/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/avatar/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,9 +40,10 @@
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/caps/CapsExtension.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/caps/CapsExtension.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.caps;
@@ -48,7 +48,6 @@
/**
* This extension represents a capability of XEP-0115.
- *
*/
public class CapsExtension implements PacketExtension {
@@ -57,10 +56,8 @@
private String mNode;
private String mExt;
-
/**
* Create a CapsExtension.
- *
* @param hash The value of the hash attribute.
* @param node the value of the node attribute
* @param ver the value of the ver attribute.
@@ -73,7 +70,6 @@
/**
* Get the ver attribute value.
- *
* @return the value of the ver attribute.
*/
public String getVer() {
@@ -82,7 +78,6 @@
/**
* Get the hash attribute value.
- *
* @return the value of the hash attribute.
*/
public String getHash() {
@@ -91,7 +86,6 @@
/**
* Get the node attribute value.
- *
* @return the value of the node attribute.
*/
public String getNode() {
@@ -100,7 +94,6 @@
/**
* Get the ext attribute value.
- *
* @return the value of the ext attribute.
*/
public String getExt() {
@@ -109,7 +102,6 @@
/**
* Set the hash attribute.
- *
* @param hash the value of hash
*/
public void setHash(String hash) {
@@ -118,7 +110,6 @@
/**
* Set the ver attribute.
- *
* @param ver the value of ver
*/
public void setVer(String ver) {
@@ -127,7 +118,6 @@
/**
* Set the node attribute.
- *
* @param node the value of node
*/
public void setNode(String node) {
@@ -136,7 +126,6 @@
/**
* Set the ext attribute.
- *
* @param ext the value of ext
*/
public void setExt(String ext) {
--- a/src/com/beem/project/beem/smack/caps/CapsManager.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/caps/CapsManager.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.caps;
import org.jivesoftware.smack.Connection;
@@ -69,9 +69,7 @@
import org.jivesoftware.smack.util.StringUtils;
/**
- * Capabilities manager to implements XEP-0115.
- * The DiscoverInfo are cached in memory.
- *
+ * Capabilities manager to implements XEP-0115. The DiscoverInfo are cached in memory.
*/
public class CapsManager {
// the verCache should be stored on disk
@@ -85,7 +83,6 @@
/**
* Create a CapsManager.
- *
* @param sdm The service discovery manager to use.
* @param conn The connection to manage.
*/
@@ -97,7 +94,6 @@
/**
* Get the discover info associated with a ver attribute.
- *
* @param ver the ver attribute.
* @return the discover info or null if it was not cached.
*/
@@ -107,7 +103,6 @@
/**
* Get the discover info of a contact.
- *
* @param jid the jid of the contact.
* @param ver the ver attribute of the contact capability.
* @return The info of the client null if the info was not cached.
@@ -123,9 +118,7 @@
}
/**
- * Set the node attribute to send in your capability.
- * This is usually an uri to identify the client.
- *
+ * Set the node attribute to send in your capability. This is usually an uri to identify the client.
* @param node the node attribute to set.
*/
public void setNode(String node) {
@@ -133,9 +126,7 @@
}
/**
- * Load a persistent DiscoverInfo.
- * The default implementation does nothing and always return null.
- *
+ * Load a persistent DiscoverInfo. The default implementation does nothing and always return null.
* @param ver the ver hash of the discoverInfo.
* @return The discover info or null if not present.
*/
@@ -144,9 +135,7 @@
}
/**
- * Store a DiscoverInfo for persistence.
- * The default implementation does nothing.
- *
+ * Store a DiscoverInfo for persistence. The default implementation does nothing.
* @param ver the ver hash of the DiscoverInfo
* @param info the DiscoverInfo to store
*/
@@ -154,10 +143,8 @@
}
/**
- * Check if the discover info correspondig to the ver hash is in cache.
- * This implementation checks the memory cache.
+ * Check if the discover info correspondig to the ver hash is in cache. This implementation checks the memory cache.
* If the info is not in cache it is necessary to request it from the network.
- *
* @param ver the ver hash
* @return true if it is in cache false otherwise
*/
@@ -202,7 +189,6 @@
/**
* Validate the ver attribute of a received capability.
- *
* @param jid the jid of the sender of the capability.
* @param node the node attribute of the capability.
* @param ver the ver attribute of the capability.
@@ -233,7 +219,6 @@
/**
* Calculate the ver attribute.
- *
* @param info The discover info to calculate the ver.
* @param hashMethod the hash algorithm to use.
* @return the value of the ver attribute
@@ -251,9 +236,9 @@
s.append(c);
s.append('/');
// Should add lang but it is not available
-// c = identity.getType();
-// if (c != null)
-// S.append(c);
+ // c = identity.getType();
+ // if (c != null)
+ // S.append(c);
s.append('/');
c = identity.getName();
if (c != null)
@@ -271,7 +256,6 @@
/**
* Get the identities sorted correctly to calculate the ver attribute.
- *
* @param info the DiscoverInfo containing the identities
* @return the sorted list of identities.
*/
@@ -286,16 +270,20 @@
public int compare(DiscoverInfo.Identity o1, DiscoverInfo.Identity o2) {
String cat1 = o1.getCategory();
- if (cat1 == null) cat1 = "";
+ if (cat1 == null)
+ cat1 = "";
String cat2 = o2.getCategory();
- if (cat2 == null) cat2 = "";
+ if (cat2 == null)
+ cat2 = "";
int res = cat1.compareTo(cat2);
if (res != 0)
return res;
String type1 = o1.getType();
- if (type1 == null) type1 = "";
+ if (type1 == null)
+ type1 = "";
String type2 = o2.getCategory();
- if (type2 == null) type2 = "";
+ if (type2 == null)
+ type2 = "";
res = type1.compareTo(type2);
if (res != 0)
return res;
@@ -308,7 +296,6 @@
/**
* Get the features sorted correctly to calculate the ver attribute.
- *
* @param info the DiscoverInfo containing the features
* @return the sorted list of features.
*/
@@ -325,7 +312,6 @@
/**
* Get the Discover Information send by your own connection.
- *
* @return your own DiscoverInfo
*/
private DiscoverInfo getOwnInformation() {
@@ -342,7 +328,6 @@
/**
* Calculate a Hash (digest).
- *
* @param algo the algorithm to use
* @param data the data to compute
* @return the resulting hash
@@ -358,7 +343,7 @@
*/
private void initSupportedAlgorithm() {
// sort by ""preference"
- String[] algo = new String[] {"sha-1", "md2", "md5", "sha-224", "sha-256", "sha-384", "sha-512" };
+ String[] algo = new String[] { "sha-1", "md2", "md5", "sha-224", "sha-256", "sha-384", "sha-512" };
for (String a : algo) {
try {
MessageDigest md = MessageDigest.getInstance(a);
--- a/src/com/beem/project/beem/smack/caps/CapsProvider.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/caps/CapsProvider.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.caps;
import org.xmlpull.v1.XmlPullParser;
@@ -48,17 +48,16 @@
import org.jivesoftware.smack.packet.PacketExtension;
/**
- * PacketExtensionProvider for XEP-0115.
- * This provider parse c element of namespace
- * http://jabber.org/protocol/caps which represents a capability of XEP-0115
- *
+ * PacketExtensionProvider for XEP-0115. This provider parse c element of namespace http://jabber.org/protocol/caps
+ * which represents a capability of XEP-0115
*/
public class CapsProvider implements PacketExtensionProvider {
/**
* Constructor.
*/
- public CapsProvider() { }
+ public CapsProvider() {
+ }
@Override
public PacketExtension parseExtension(XmlPullParser parser) {
--- a/src/com/beem/project/beem/smack/caps/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/caps/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,9 +40,10 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
/**
* This package contains implementation of XEP-0115.
*/
package com.beem.project.beem.smack.caps;
+
--- a/src/com/beem/project/beem/smack/pep/PEPListener.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/pep/PEPListener.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.pep;
import org.jivesoftware.smackx.pubsub.Item;
@@ -52,8 +52,7 @@
public interface PEPListener {
/**
- * Called when PEP events are received.
- *
+ * 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
--- a/src/com/beem/project/beem/smack/pep/PepSubManager.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/pep/PepSubManager.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.smack.pep;
import java.util.ArrayList;
@@ -60,7 +60,6 @@
/**
* Little extension of {@link PubSubManager} which allows to add {@link PEPListener}.
- *
*/
public class PepSubManager extends PubSubManager {
private List<PEPListener> mPepListeners = new ArrayList<PEPListener>();
@@ -68,7 +67,6 @@
/**
* Create a PepSubManager.
- *
* @param connection the connection
*/
public PepSubManager(final Connection connection) {
@@ -77,9 +75,8 @@
}
/**
- * Create a PepSubManager associated to the specified connection where the pubsub
- * requests require a specific to address for packets.
- *
+ * 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)
*/
@@ -90,7 +87,6 @@
/**
* Add a listener to PEP event.
- *
* @param listener the listener
*/
public void addPEPListener(PEPListener listener) {
@@ -100,7 +96,6 @@
/**
* Remove a listener to PEP event.
- *
* @param listener the listener
*/
public void removePEPListener(PEPListener listener) {
@@ -108,9 +103,7 @@
}
/**
- * Get a PepNode.
- * This node is obtain without checking its existence as PEP should auto create it.
- *
+ * 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
*/
@@ -122,7 +115,6 @@
/**
* Initialize the PepSubManager.
- *
* @param con the connection
*/
private void init(Connection con) {
@@ -145,7 +137,6 @@
/**
* 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
--- a/src/com/beem/project/beem/smack/pep/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/smack/pep/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
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.
--- a/src/com/beem/project/beem/ui/AddContact.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/AddContact.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import java.util.ArrayList;
@@ -103,7 +103,8 @@
this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onStart()
*/
@Override
@@ -129,7 +130,8 @@
unbindService(mServConn);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onDestroy()
*/
@Override
@@ -178,7 +180,8 @@
/**
* Constructor.
*/
- public OkListener() { }
+ public OkListener() {
+ }
@Override
public void onClick(View v) {
--- a/src/com/beem/project/beem/ui/ChangeStatus.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
@@ -115,8 +115,7 @@
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 File PHOTO_DIR = new File(Environment.getExternalStorageDirectory() + "/DCIM/Camera");
private static final String KEY_CURRENT_PHOTO_FILE = "currentphotofile";
@@ -174,7 +173,6 @@
avatarPanel.setVisibility(View.GONE);
}
-
mSettings = PreferenceManager.getDefaultSharedPreferences(this);
mStatusMessageEditText = (EditText) findViewById(R.id.ChangeStatusMessage);
mStatusMessageEditText.setText(mSettings.getString(BeemApplication.STATUS_TEXT_KEY, ""));
@@ -213,7 +211,8 @@
unbindService(mServConn);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onDestroy()
*/
@Override
@@ -227,23 +226,21 @@
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
- if (mCurrentPhotoFile != null) {
- outState.putString(KEY_CURRENT_PHOTO_FILE, mCurrentPhotoFile.toString());
- }
- super.onSaveInstanceState(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);
+ 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)
@@ -253,11 +250,12 @@
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- // Ignore failed requests
- if (resultCode != RESULT_OK) return;
+ // Ignore failed requests
+ if (resultCode != RESULT_OK)
+ return;
- switch (requestCode) {
- case PHOTO_PICKED_WITH_DATA:
+ switch (requestCode) {
+ case PHOTO_PICKED_WITH_DATA:
mAvatarUri = Uri.parse(data.getAction());
Log.d(TAG, "selected avatar uri " + mAvatarUri);
if (mAvatarUri != null) {
@@ -265,15 +263,15 @@
mDisableAvatar = false;
mShowCurrentAvatar = false;
}
- break;
+ break;
- case CAMERA_WITH_DATA:
- doCropPhoto(mCurrentPhotoFile);
- break;
+ case CAMERA_WITH_DATA:
+ doCropPhoto(mCurrentPhotoFile);
+ break;
default:
Log.w(TAG, "onActivityResult : invalid request code");
- }
+ }
}
/**
@@ -328,7 +326,6 @@
/**
* ClickListener for the avatarButton.
- *
* @param button the avatar button
*/
private void onAvatarButton(View button) {
@@ -368,8 +365,7 @@
}
/*
- * Some codes from AOSP (platform/packages/apps/Contacts)
- * to select and crop an image.
+ * Some codes from AOSP (platform/packages/apps/Contacts) to select and crop an image.
*/
/**
@@ -377,36 +373,34 @@
* @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);
+ // 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 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:
+ 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();
+ }
+ }
+ });
+ return builder.create();
}
/**
@@ -414,24 +408,24 @@
* @return the filename
*/
private String getPhotoFileName() {
- Date date = new Date(System.currentTimeMillis());
- SimpleDateFormat dateFormat = new SimpleDateFormat("'IMG'_yyyyMMdd_HHmmss");
- return dateFormat.format(date) + ".jpg";
+ 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();
- }
+ 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();
+ }
}
/**
@@ -440,9 +434,9 @@
* @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;
+ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
+ return intent;
}
/**
@@ -450,25 +444,22 @@
* @param f the image file to crop
*/
protected void doCropPhoto(final File f) {
- try {
+ try {
- // Add the image to the media store
+ // Add the image to the media store
// level 8
/*
- MediaScannerConnection.scanFile(
- this,
- new String[] { f.getAbsolutePath() },
- new String[] { null },
- null);
- */
+ * 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();
- }
+ // 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();
+ }
}
/**
@@ -477,28 +468,28 @@
* @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 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;
+ 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();
- }
+ 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();
+ }
}
/**
@@ -506,21 +497,19 @@
* @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 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;
+ // intent.putExtra("return-data", true);
+ return intent;
}
-
-
/**
* connection to service.
* @author nikita
--- a/src/com/beem/project/beem/ui/Chat.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/Chat.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import java.io.IOException;
@@ -176,7 +176,7 @@
mContactChatState = (TextView) findViewById(R.id.chat_contact_chat_state);
mContactStatusIcon = (ImageView) findViewById(R.id.chat_contact_status_icon);
mAvatarStatusDrawable = (LayerDrawable) mContactStatusIcon.getDrawable();
- mContactOtrState = (TextView) findViewById(R.id.chat_contact_otr_state);
+ mContactOtrState = (TextView) findViewById(R.id.chat_contact_otr_state);
mAvatarStatusDrawable.setLayerInset(1, 36, 36, 0, 0);
} else {
setContentView(R.layout.chat_compact);
@@ -318,7 +318,7 @@
}
mChat.startOtrSession();
} catch (RemoteException e) {
- Log.e(TAG, "start otr chats failed " + mChat , e);
+ Log.e(TAG, "start otr chats failed " + mChat, e);
}
break;
case R.id.chat_menu_stop_otr_session:
@@ -331,10 +331,10 @@
}
mChat.endOtrSession();
} catch (RemoteException e) {
- Log.e(TAG, "close otr chats failed " + mChat , e);
+ Log.e(TAG, "close otr chats failed " + mChat, e);
}
break;
- case R.id.chat_menu_otr_local_key:
+ case R.id.chat_menu_otr_verify_key:
try {
if (mChat == null) {
mChat = mChatManager.createChat(mContact, mMessageListener);
@@ -342,26 +342,10 @@
mChat.setOpen(true);
}
}
- String fk = mChat.getLocalOtrFingerprint();
- Dialog otrDialog = new DisplayOtrFingerprint(this, fk, true).create();
+ Dialog otrDialog = new DisplayOtrFingerprint(this, mChat).create();
otrDialog.show();
} catch (RemoteException e) {
- Log.e(TAG, "getting local otr key failed " + mChat , e);
- }
- break;
- case R.id.chat_menu_otr_remote_key:
- try {
- if (mChat == null) {
- mChat = mChatManager.createChat(mContact, mMessageListener);
- if (mChat != null) {
- mChat.setOpen(true);
- }
- }
- String fk = mChat.getRemoteOtrFingerprint();
- Dialog otrDialog = new DisplayOtrFingerprint(this, fk, false).create();
- otrDialog.show();
- } catch (RemoteException e) {
- Log.e(TAG, "getting remote otr key failed " + mChat , e);
+ Log.e(TAG, "getting local otr key failed " + mChat, e);
}
break;
default:
@@ -570,8 +554,8 @@
@Override
public void run() {
if (msg.getType() == Message.MSG_TYPE_ERROR) {
- mListMessages.add(new MessageText(fromBareJid, mContact.getName(),
- msg.getBody(), true, msg.getTimestamp()));
+ mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(), true, msg
+ .getTimestamp()));
mMessagesListAdapter.notifyDataSetChanged();
} else if (msg.getBody() != null) {
MessageText lastMessage = null;
@@ -583,8 +567,8 @@
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()));
+ mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(),
+ false, msg.getTimestamp()));
mMessagesListAdapter.notifyDataSetChanged();
}
}
@@ -625,7 +609,7 @@
mHandler.post(new Runnable() {
@Override
public void run() {
- updateOtrInformations(otrState);
+ updateOtrInformations(otrState);
}
});
@@ -652,31 +636,30 @@
} else {
Mode m = Status.getPresenceModeFromStatus(mContact.getStatus());
if (m == null)
- setTitle(getString(R.string.chat_name) + " " + name
- + " (" + getString(R.string.contact_status_msg_offline) + ")");
+ 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.
*/
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 {
- text = Chat.this.getString(R.string.chat_otrstate_plaintext);
- }
- mContactOtrState.setText(text);
+ 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);
+ }
+ mContactOtrState.setText(text);
}
-
-
-
/**
* Update the contact status icon.
*/
@@ -697,7 +680,6 @@
/**
* Get a Drawable containing the avatar icon.
- *
* @param avatarId the avatar id to retrieve or null to get default
* @return a Drawable
*/
@@ -727,18 +709,18 @@
* 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));
+ 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));
}
/**
@@ -849,8 +831,7 @@
* @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) {
+ public MessageText(final String bareJid, final String name, final String message, final boolean isError) {
mBareJid = bareJid;
mName = name;
mMessage = message;
@@ -865,8 +846,8 @@
* @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) {
+ public MessageText(final String bareJid, final String name, final String message, final boolean isError,
+ final Date date) {
mBareJid = bareJid;
mName = name;
mMessage = message;
--- a/src/com/beem/project/beem/ui/ContactList.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Tue Aug 23 01:12:26 2011 +0200
@@ -39,7 +39,7 @@
Flavien Astraud, November 26, 2009
-*/
+ */
package com.beem.project.beem.ui;
import java.util.ArrayList;
@@ -121,16 +121,16 @@
private final BeemContactList mAdapterContactList = new BeemContactList();
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.
- * */
+ /**
+ * 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 BeemContactListOnClick mOnContactClick = new BeemContactListOnClick();
private final Handler mHandler = new Handler();
private final ServiceConnection mServConn = new BeemServiceConnection();
private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
- private final ComparatorContactListByStatusAndName<Contact> mComparator =
- new ComparatorContactListByStatusAndName<Contact>();
+ private final ComparatorContactListByStatusAndName<Contact> mComparator = new ComparatorContactListByStatusAndName<Contact>();
private final BeemRosterListener mBeemRosterListener = new BeemRosterListener();
private List<Contact> mListContact;
private String mSelectedGroup;
@@ -253,8 +253,8 @@
result = true;
break;
case R.id.contact_list_context_menu_userinfo_subscription:
- Dialog subscription = new ResendSubscription(ContactList.this,
- mXmppFacade, mSelectedContact).create();
+ Dialog subscription = new ResendSubscription(ContactList.this, mXmppFacade, mSelectedContact)
+ .create();
subscription.show();
result = true;
break;
@@ -377,12 +377,10 @@
}
/**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesAdded event.
- * if contact has to be shown :
+ * {@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</>
+ * <li>add him to his groups</li>
+ * <li>add him to the specials groups</>
* </ul>
*/
@Override
@@ -414,10 +412,9 @@
}
/**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesDeleted event.
+ * {@inheritDoc} Simple stategy to handle the onEntriesDeleted event.
* <ul>
- * <li> Remove the contact from all groups</li>
+ * <li>Remove the contact from all groups</li>
* </ul>
*/
@Override
@@ -448,12 +445,11 @@
}
/**
- * {@inheritDoc}
- * Simple stategy to handle the onEntriesUpdated event.
+ * {@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>
+ * <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
@@ -474,8 +470,7 @@
for (String group : groups) {
if (!mListGroup.contains(group)) {
mListGroup.add(mListGroup.size() - 1, group);
- List<Contact> tmplist = new SortedList<Contact>(
- new LinkedList<Contact>(), mComparator);
+ List<Contact> tmplist = new SortedList<Contact>(new LinkedList<Contact>(), mComparator);
mContactOnGroup.put(group, tmplist);
}
mContactOnGroup.get(group).remove(contact);
@@ -493,12 +488,11 @@
}
/**
- * {@inheritDoc}
- * Simple stategy to handle the onPresenceChanged event.
+ * {@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>
+ * <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
@@ -527,10 +521,8 @@
}
/**
- * 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.
- *
+ * 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) {
@@ -547,7 +539,6 @@
/**
* Update the current list with the status of contact.
- *
* @param listName name of the current list
* @param contact contact to update
*/
@@ -556,12 +547,11 @@
final List<String> groups = contact.getGroups();
String noGroup = getString(R.string.contact_list_no_group);
String allGroup = getString(R.string.contact_list_all_contact);
- final boolean add = ((!hideDisconnected || Status.statusOnline(contact.getStatus())) && // must show and
- (
- (listName.equals(noGroup) && groups.isEmpty()) || // in no group
- groups.contains(listName) || // or in current
- listName.equals(allGroup) // or in all
- ));
+ final boolean add = ((!hideDisconnected || Status.statusOnline(contact.getStatus())) && // must show and
+ ((listName.equals(noGroup) && groups.isEmpty()) || // in no group
+ groups.contains(listName) || // or in current
+ listName.equals(allGroup) // or in all
+ ));
mHandler.post(new Runnable() {
public void run() {
mListContact.remove(contact);
@@ -624,7 +614,6 @@
return mListContact.get(position).hashCode();
}
-
/**
* {@inheritDoc}
*/
@@ -672,8 +661,8 @@
}
/**
- * Get a LayerDrawable containing the avatar and the status icon.
- * The status icon will change with the level of the drawable.
+ * 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
*/
@@ -710,7 +699,8 @@
/**
* Create a ContactFilter.
*/
- public ContactFilter() { }
+ public ContactFilter() {
+ }
@Override
protected Filter.FilterResults performFiltering(CharSequence constraint) {
@@ -730,7 +720,7 @@
}
@Override
- protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
+ protected void publishResults(CharSequence constraint, Filter.FilterResults results) {
Log.d(TAG, "publishResults");
List<Contact> contacts = (List<Contact>) results.values;
mListContact = contacts;
@@ -839,9 +829,7 @@
}
/**
- * Assign the differents contact to their groups.
- * This methods will fill the mContactOnGroup map.
- *
+ * 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
*/
@@ -874,7 +862,6 @@
/**
* Make the List of the map became Insertion sorted list.
- *
* @param map the map to convert.
*/
private void makeSortedList(Map<String, List<Contact>> map) {
@@ -885,9 +872,6 @@
}
}
-
-
-
/**
* Comparator Contact by status and name.
*/
--- a/src/com/beem/project/beem/ui/CreateAccount.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/CreateAccount.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import java.util.regex.Pattern;
@@ -122,8 +122,8 @@
xmppConnection.connect();
AccountManager accountManager = new AccountManager(xmppConnection);
accountManager.createAccount(username, password);
- Toast toast = Toast.makeText(getApplicationContext(), String.format(
- getString(R.string.create_account_successfull_after), username), NOTIFICATION_DURATION);
+ Toast toast = Toast.makeText(getApplicationContext(),
+ String.format(getString(R.string.create_account_successfull_after), username), NOTIFICATION_DURATION);
toast.show();
} catch (XMPPException e) {
createErrorDialog(e.getMessage());
@@ -139,9 +139,7 @@
*/
private void createErrorDialog(String errMsg) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.create_account_err_dialog_title)
- .setMessage(errMsg)
- .setCancelable(false)
+ builder.setTitle(R.string.create_account_err_dialog_title).setMessage(errMsg).setCancelable(false)
.setIcon(android.R.drawable.ic_dialog_alert);
builder.setNeutralButton(R.string.create_account_close_dialog_button, new DialogInterface.OnClickListener() {
--- a/src/com/beem/project/beem/ui/GroupList.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/GroupList.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import java.util.ArrayList;
@@ -80,7 +80,7 @@
private static final Intent SERVICE_INTENT = new Intent();
private final ServiceConnection mServConn = new BeemServiceConnection();
- private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
+ private final BeemBroadcastReceiver mReceiver = new BeemBroadcastReceiver();
private IXmppFacade mXmppFacade;
private IRoster mRoster;
private String mJID;
@@ -99,7 +99,8 @@
public GroupList() {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
@@ -137,7 +138,8 @@
unbindService(mServConn);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onDestroy()
*/
@Override
--- a/src/com/beem/project/beem/ui/Login.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/Login.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import android.app.Activity;
--- a/src/com/beem/project/beem/ui/LoginAnim.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/LoginAnim.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import android.app.Activity;
@@ -90,7 +90,8 @@
public LoginAnim() {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
@@ -104,7 +105,8 @@
mCancelBt.setOnClickListener(new ClickListener());
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onStart()
*/
@Override
@@ -117,7 +119,8 @@
mBinded = bindService(LoginAnim.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onPause()
*/
@Override
@@ -129,7 +132,8 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onKeyDown(int, android.view.KeyEvent)
*/
@Override
@@ -178,7 +182,8 @@
LoginTask() {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.os.AsyncTask#onPostExecute(java.lang.Object)
*/
@Override
@@ -201,11 +206,12 @@
}
@Override
- protected void onProgressUpdate(Integer ... values) {
+ protected void onProgressUpdate(Integer... values) {
mLoginState.setText(getResources().getStringArray(R.array.loganim_state)[values[0]]);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.os.AsyncTask#onCancelled()
*/
@Override
--- a/src/com/beem/project/beem/ui/PrivacyList.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/PrivacyList.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import java.util.ArrayList;
--- a/src/com/beem/project/beem/ui/Settings.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/Settings.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import android.content.ComponentName;
--- a/src/com/beem/project/beem/ui/Subscription.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/Subscription.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui;
import org.jivesoftware.smack.packet.Presence;
@@ -91,7 +91,8 @@
public Subscription() {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
@@ -108,7 +109,8 @@
this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onResume()
*/
@Override
@@ -117,7 +119,8 @@
bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onPause()
*/
@Override
@@ -126,7 +129,8 @@
unbindService(mServConn);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see android.app.Activity#onDestroy()
*/
@Override
@@ -137,7 +141,6 @@
/**
* Send the presence stanza.
- *
* @param p presence stanza
*/
private void sendPresence(Presence p) {
@@ -166,8 +169,7 @@
switch (v.getId()) {
case R.id.SubscriptionAccept:
presence = new Presence(Type.subscribed);
- Toast.makeText(Subscription.this, getString(R.string.SubscriptAccept), Toast.LENGTH_SHORT)
- .show();
+ Toast.makeText(Subscription.this, getString(R.string.SubscriptAccept), Toast.LENGTH_SHORT).show();
break;
case R.id.SubscriptionRefuse:
presence = new Presence(Type.unsubscribed);
--- a/src/com/beem/project/beem/ui/dialogs/builders/Alias.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/dialogs/builders/Alias.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui.dialogs.builders;
import android.app.AlertDialog;
@@ -80,12 +80,10 @@
mContact = contact;
LayoutInflater factory = LayoutInflater.from(context);
- final View textEntryView = factory.inflate(
- R.layout.contactdialogaliasdialog, null);
+ final View textEntryView = factory.inflate(R.layout.contactdialogaliasdialog, null);
setTitle(mContact.getJID());
setView(textEntryView);
- mEditTextAlias = (EditText) textEntryView.findViewById(
- R.id.CDAliasDialogName);
+ mEditTextAlias = (EditText) textEntryView.findViewById(R.id.CDAliasDialogName);
mEditTextAlias.setText(mContact.getName());
setPositiveButton(R.string.OkButton, new DialogClickListener());
setNegativeButton(R.string.CancelButton, new DialogClickListener());
@@ -102,7 +100,6 @@
public DialogClickListener() {
}
-
@Override
public void onClick(final DialogInterface dialog, final int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
--- a/src/com/beem/project/beem/ui/dialogs/builders/ChatList.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/dialogs/builders/ChatList.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui.dialogs.builders;
import java.util.List;
--- a/src/com/beem/project/beem/ui/dialogs/builders/CreatePrivacyList.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/dialogs/builders/CreatePrivacyList.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui.dialogs.builders;
import java.util.ArrayList;
--- a/src/com/beem/project/beem/ui/dialogs/builders/DeleteContact.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/dialogs/builders/DeleteContact.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui.dialogs.builders;
import android.app.AlertDialog;
--- a/src/com/beem/project/beem/ui/dialogs/builders/DeletePrivacyList.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/dialogs/builders/DeletePrivacyList.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui.dialogs.builders;
import android.app.AlertDialog;
--- a/src/com/beem/project/beem/ui/dialogs/builders/DisplayOtrFingerprint.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/dialogs/builders/DisplayOtrFingerprint.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,14 +40,16 @@
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;
/**
*
@@ -55,6 +57,7 @@
public class DisplayOtrFingerprint extends AlertDialog.Builder {
private static final String TAG = "DisplayOtrFingerprint";
+ private IChat mChat;
/**
* Constructor.
@@ -62,17 +65,19 @@
* @param roster the roster which has the contact you want to delete.
* @param contact the contact to delete.
*/
- public DisplayOtrFingerprint(final Context context, final String otrFingerprint, final boolean local) {
+ public DisplayOtrFingerprint(final Context context, final IChat chat) {
super(context);
- if (local) {
- setMessage(context.getString(R.string.chat_otr_local_key, otrFingerprint));
- } else {
- setMessage(context.getString(R.string.chat_otr_verify_key, otrFingerprint));
- DialogClickListener dl = new DialogClickListener();
- setPositiveButton(R.string.userinfo_yes, dl);
- setNegativeButton(R.string.userinfo_no, dl);
+ 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);
}
/**
@@ -89,7 +94,17 @@
@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 Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/dialogs/builders/ResendSubscription.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui.dialogs.builders;
import org.jivesoftware.smack.packet.Presence;
--- a/src/com/beem/project/beem/ui/dialogs/builders/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/dialogs/builders/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
/**
* This package contains Beem dialog builder's.
*/
--- a/src/com/beem/project/beem/ui/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -39,7 +39,7 @@
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.
*/
--- a/src/com/beem/project/beem/ui/wizard/Account.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/wizard/Account.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui.wizard;
import android.app.Activity;
@@ -56,7 +56,6 @@
/**
* The first activity of an user friendly wizard to configure a XMPP account.
- *
* @author Da Risk <darisk972@gmail.com>
*/
public class Account extends Activity implements OnClickListener, RadioGroup.OnCheckedChangeListener {
@@ -98,7 +97,7 @@
}
@Override
- public void onCheckedChanged(RadioGroup group, int checkedId) {
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == -1)
mNextButton.setEnabled(false);
else
--- a/src/com/beem/project/beem/ui/wizard/AccountConfigure.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/wizard/AccountConfigure.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.ui.wizard;
import android.app.Activity;
@@ -67,7 +67,6 @@
/**
* Activity to enter the information required in order to configure a XMPP account.
- *
* @author Da Risk <darisk972@gmail.com>
*/
public class AccountConfigure extends Activity implements OnClickListener {
@@ -99,7 +98,6 @@
mAccountJID = (EditText) findViewById(R.id.account_username);
mAccountPassword = (EditText) findViewById(R.id.account_password);
-
InputFilter[] orgFilters = mAccountJID.getFilters();
InputFilter[] newFilters = new InputFilter[orgFilters.length + 1];
int i;
@@ -195,11 +193,11 @@
}
@Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
}
}
@@ -221,11 +219,11 @@
}
@Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
}
}
}
--- a/src/com/beem/project/beem/ui/wizard/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/ui/wizard/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
/**
* This package contains some configuration wizards.
--- a/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.utils;
import android.app.Activity;
@@ -84,8 +84,9 @@
}
} 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();
+ 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 Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/utils/BeemConnectivity.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.utils;
import android.content.Context;
@@ -59,7 +59,8 @@
/**
* Private constructor to forbid instantiation.
*/
- private BeemConnectivity() { }
+ private BeemConnectivity() {
+ }
/**
* Checks if is connected.
@@ -67,8 +68,7 @@
* @return true, if is connected
*/
public static boolean isConnected(final Context ctx) {
- ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(
- Context.CONNECTIVITY_SERVICE);
+ ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();
return ni != null && ni.isConnected();
}
@@ -79,14 +79,11 @@
* @return true, if is wifi
*/
public static boolean isWifi(final Context ctx) {
- WifiManager wm = (WifiManager) ctx.getSystemService(
- Context.WIFI_SERVICE);
+ 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)) {
+ && (WifiInfo.getDetailedStateOf(wi.getSupplicantState()) == DetailedState.OBTAINING_IPADDR || WifiInfo
+ .getDetailedStateOf(wi.getSupplicantState()) == DetailedState.CONNECTED)) {
return false;
}
return false;
@@ -98,8 +95,7 @@
* @return true, if is umts
*/
public static boolean isUmts(final Context ctx) {
- TelephonyManager tm = (TelephonyManager) ctx.getSystemService(
- Context.TELEPHONY_SERVICE);
+ TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UMTS;
}
@@ -109,8 +105,7 @@
* @return true, if is edge
*/
public static boolean isEdge(final Context ctx) {
- TelephonyManager tm = (TelephonyManager) ctx.getSystemService(
- Context.TELEPHONY_SERVICE);
+ TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_EDGE;
}
--- a/src/com/beem/project/beem/utils/FreePort.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/utils/FreePort.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.utils;
import java.io.IOException;
--- a/src/com/beem/project/beem/utils/PresenceType.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/utils/PresenceType.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.utils;
import org.jivesoftware.smack.packet.Presence;
--- a/src/com/beem/project/beem/utils/SortedList.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/utils/SortedList.java Tue Aug 23 01:12:26 2011 +0200
@@ -26,7 +26,7 @@
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;
@@ -37,10 +37,8 @@
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
+ * 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
*/
@@ -51,7 +49,6 @@
/**
* Create a SortedList. The existing elements will be sorted.
- *
* @param list list to sort
* @param mComparator mComparator to use.
*/
@@ -129,9 +126,7 @@
}
/**
- * Add all the elements in the specified collection.
- * The index param is ignored.
- *
+ * 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
@@ -142,9 +137,7 @@
}
/**
- * Add all the elements in the specified collection.
- * The index param is ignored.
- *
+ * 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)
@@ -248,8 +241,7 @@
}
/**
- * A SortedList.iterator don't allow list modification.
- * It use the mBackend iterator for the other operations.
+ * A SortedList.iterator don't allow list modification. It use the mBackend iterator for the other operations.
*/
private class SortedListIterator<E> implements ListIterator<E> {
@@ -257,7 +249,6 @@
/**
* Construct SortedList.Iterator.
- *
* @param iterator the iterator of the backend list
*/
SortedListIterator(final ListIterator<E> iterator) {
--- a/src/com/beem/project/beem/utils/Status.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/utils/Status.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
package com.beem.project.beem.utils;
import org.jivesoftware.smack.packet.Presence;
--- a/src/com/beem/project/beem/utils/package-info.java Mon Aug 22 22:35:31 2011 +0200
+++ b/src/com/beem/project/beem/utils/package-info.java Tue Aug 23 01:12:26 2011 +0200
@@ -40,7 +40,7 @@
Flavien Astraud, November 26, 2009
Head of the EIP Laboratory.
-*/
+ */
/**
* This package contains utility class to deal with various aspect of BEEM.
*/