merge
authornikita@nikita-laptop
Fri, 19 Feb 2010 00:31:43 +0100
changeset 681 9ca0e29b386f
parent 680 803a4f1dc590 (current diff)
parent 677 b8d5e0378bcb (diff)
child 682 9a7a89e5e966
merge
beem_key
--- a/INSTALL	Fri Feb 19 00:31:05 2010 +0100
+++ b/INSTALL	Fri Feb 19 00:31:43 2010 +0100
@@ -1,13 +1,26 @@
-Howto Install Beem ?
+Android Market
+--------------
+
+First of all, BEEM is available on the Android market. Just search for 'BEEM'.
+
+Development version
+-------------------
 
 1. Dependencies
-   First you will need the Android SDK-1.5.
+   First you will need the latest Android SDK. You can download it at http://d.android.com. 
+   You will also need the Apache Ant tool to build the project. You can get it at http://ant.apache.org
 
 2. Android project
-   Use the script provides by the SDK to set the Android platform directory.
-   > $SDK_DIR/tools/android update project -t 2 -p $BEEM_DIRECTORY
+   Use the android program provides by the SDK to set the Android platform directory.
+   First get the Target id of the platform you want to build BEEM for.
+   > $SDK_DIR/tools/android list targets
+
+   Then use this id to set up the BEEM project.
+   > $SDK_DIR/tools/android update project -t $TARGET_ID -p $BEEM_DIRECTORY
 
 3. Compile and install
-   Use ant to compile and install the application on the Android emulator
+   Use ant to compile and install the application on the Android device
    > ant install
 
+The development version use a private certificate to sign the package. You will need to uninstall it before installing or upgrading a version of BEEM from the Android market.
+
--- a/README	Fri Feb 19 00:31:05 2010 +0100
+++ b/README	Fri Feb 19 00:31:43 2010 +0100
@@ -1,3 +1,52 @@
+BEEM : Boost Your Eyes, Ears, and Mouth
+---------------------------------------
+
+BEEM is a full featured and easy to use XMPP (formerly named Jabber) client on the Android Platform.
+
+Beem is under constant development. Releases are usually frequent and driven by user contributions, such as bug reports and patches.
+
+Beem is free and contains no ads. All our code is open source and licensed under the GNU General Public License 3 and any later version. This means you can get Beem's code and modify it to suit your needs, as long as you publish the changes you make for everyone to benefit from as well.
+
+
+Features
+--------
+
+- Compatible with any standard XMPP server
+- SASL support
+- Proxy support (SOCKS4 SOCKS5 HTTP)
+- Support of DNS SERV
+
+New in 0.1.2:
+- DNS SERV
+- New options
+- Bug fix
+
+Futur:
+- Geolocation
+- Voip
+- MUC
+- Phone contact list
+
+
+Support & getting help
+----------------------
+
+For getting help or discussing about BEEM, you can join #beem on the freenode IRC network or on XMPP Multi User Chat : beem@conference.elyzion.net.
+We have a mailing list, feel free to subscribe here : http://list.beem-project.com/listinfo/beem-dev
+You can also contact the BEEM Team at beem-dev@list.beem-project.com.
+
+Before submitting a bug report, a patch or a feature request here, please read the Submission guidelines.
+
+
+Contributing and helping out
+----------------------------
+
+Beem is built and maintained by community volunteers. If you enjoy using it and would like to give back to the community, feel free to contact us.
+
+
+
+
 Thanks you for downloading BEEM
 
 http://www.beem-project.com
+
Binary file beem_key has changed
--- a/build.xml	Fri Feb 19 00:31:05 2010 +0100
+++ b/build.xml	Fri Feb 19 00:31:43 2010 +0100
@@ -70,6 +70,7 @@
     <target name="clean"
 	description="Delete old build and dist directories">
 	<delete verbose="false" dir="${out.dir}"/>
+	<delete verbose="false" dir="gen"/>
     </target>
 
     <target name="javadoc">
--- a/src/com/beem/project/beem/service/BeemChatManager.java	Fri Feb 19 00:31:05 2010 +0100
+++ b/src/com/beem/project/beem/service/BeemChatManager.java	Fri Feb 19 00:31:43 2010 +0100
@@ -236,6 +236,8 @@
     public void destroyChat(IChat chat) throws RemoteException {
 	// Can't remove it. otherwise we will lose all futur message in this chat
 	// chat.removeMessageListener(mChatListener);
+	if (chat == null)
+	    return;
 	deleteChatNotification(chat);
 	mChats.remove(chat.getParticipant().getJID());
     }
@@ -267,6 +269,12 @@
 	return res;
     }
 
+    @Override
+    public ChatAdapter getChat(Contact contact) {
+	String key = StringUtils.parseBareAddress(contact.getJID());
+	return mChats.get(key);
+    }
+
     /**
      * This methods permits to retrieve the list of contacts who have an opened chat session with us.
      * @return An List containing Contact instances.
--- a/src/com/beem/project/beem/service/aidl/IChatManager.aidl	Fri Feb 19 00:31:05 2010 +0100
+++ b/src/com/beem/project/beem/service/aidl/IChatManager.aidl	Fri Feb 19 00:31:43 2010 +0100
@@ -63,6 +63,12 @@
 	IChat createChat(in Contact contact, in IMessageListener listener);
 
 	/**
+	 * Get an existing Chat session with a contact.
+	 * @return null if the chat session does not exist.
+	 */
+	IChat getChat(in Contact contact);
+
+	/**
     	 * Destroy a chat session with a contact.
     	 * @param chat	the chat session
     	 */
@@ -85,5 +91,9 @@
 	 */
 	void removeChatCreationListener(in IChatManagerListener listener);
 
+	/**
+	 * Get a list of contact which we are currently chatting.
+	 * @return list of contact.
+	 */
 	List<Contact> getOpenedChatList();
 }
--- a/src/com/beem/project/beem/ui/Chat.java	Fri Feb 19 00:31:05 2010 +0100
+++ b/src/com/beem/project/beem/ui/Chat.java	Fri Feb 19 00:31:43 2010 +0100
@@ -90,6 +90,7 @@
 import com.beem.project.beem.service.aidl.IChat;
 import com.beem.project.beem.service.aidl.IChatManager;
 import com.beem.project.beem.service.aidl.IMessageListener;
+import com.beem.project.beem.service.aidl.IChatManagerListener;
 import com.beem.project.beem.service.aidl.IRoster;
 import com.beem.project.beem.service.aidl.IXmppFacade;
 import com.beem.project.beem.utils.BeemBroadcastReceiver;
@@ -124,6 +125,7 @@
     private IChat mChat;
     private IChatManager mChatManager;
     private final IMessageListener mMessageListener = new OnMessageListener();
+    private final IChatManagerListener mChatManagerListener = new ChatManagerListener();
     private MessagesListAdapter mMessagesListAdapter = new MessagesListAdapter();
 
     private final ServiceConnection mConn = new BeemServiceConnection();
@@ -169,6 +171,7 @@
     @Override
     protected void onResume() {
 	super.onResume();
+	mContact = new Contact(getIntent().getData());
 	if (mXmppFacade == null)
 	    bindService(SERVICE_INTENT, mConn, BIND_AUTO_CREATE);
     }
@@ -195,6 +198,8 @@
 	    }
 	    if (mRoster != null)
 		mRoster.removeRosterListener(mBeemRosterListener);
+	    if (mChatManager != null)
+		mChatManager.removeChatCreationListener(mChatManagerListener);
 	} catch (RemoteException e) {
 	    Log.e(TAG, e.getMessage());
 	}
@@ -324,10 +329,12 @@
 	    mChat.setOpen(false);
 	    mChat.removeMessageListener(mMessageListener);
 	}
-	mChat = mChatManager.createChat(contact, mMessageListener);
-	mChat.setOpen(true);
-	mChatManager.deleteChatNotification(mChat);
-
+	mChat = mChatManager.getChat(contact);
+	if (mChat != null) {
+	    mChat.setOpen(true);
+	    mChat.addMessageListener(mMessageListener);
+	    mChatManager.deleteChatNotification(mChat);
+	}
 	mContact = mRoster.getContact(contact.getJID());
 	if (mContact == null)
 	    mContact = contact;
@@ -343,9 +350,11 @@
      */
     private void playRegisteredTranscript() throws RemoteException {
 	mListMessages.clear();
-	List<MessageText> msgList = convertMessagesList(mChat.getMessages());
-	mListMessages.addAll(msgList);
-	mMessagesListAdapter.notifyDataSetChanged();
+	if (mChat != null) {
+	    List<MessageText> msgList = convertMessagesList(mChat.getMessages());
+	    mListMessages.addAll(msgList);
+	    mMessagesListAdapter.notifyDataSetChanged();
+	}
     }
 
     /**
@@ -373,7 +382,7 @@
 		}
 
 		if (m.getBody() != null) {
-		    if (lastMessage == null || ! fromBareJid.equals(lastMessage.getBareJid())) {
+		    if (lastMessage == null || !fromBareJid.equals(lastMessage.getBareJid())) {
 			lastMessage = new MessageText(fromBareJid, name, m.getBody());
 			result.add(lastMessage);
 		    } else {
@@ -404,9 +413,10 @@
 	    try {
 		if ((mRoster = mXmppFacade.getRoster()) != null)
 		    mRoster.addRosterListener(mBeemRosterListener);
-		mContact = new Contact(getIntent().getData());
-		if ((mChatManager = mXmppFacade.getChatManager()) != null)
+		if ((mChatManager = mXmppFacade.getChatManager()) != null) {
+		    mChatManager.addChatCreationListener(mChatManagerListener);
 		    changeCurrentChat(mContact);
+		}
 	    } catch (RemoteException e) {
 		Log.e(TAG, e.getMessage());
 	    }
@@ -420,6 +430,7 @@
 	    mXmppFacade = null;
 	    try {
 		mRoster.removeRosterListener(mBeemRosterListener);
+		mChatManager.removeChatCreationListener(mChatManagerListener);
 	    } catch (RemoteException e) {
 		Log.e(TAG, e.getMessage());
 	    }
@@ -503,7 +514,7 @@
 			if (msg.getType() == Message.MSG_TYPE_ERROR) {
 			    mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(), true));
 			    mMessagesListAdapter.notifyDataSetChanged();
-			} else if (msg.getBody() != null ) {
+			} else if (msg.getBody() != null) {
 			    MessageText lastMessage = mListMessages.size() != 0 ? mListMessages.get(mListMessages
 				.size() - 1) : null;
 
@@ -764,6 +775,10 @@
 	    msgToSend.setBody(inputContent);
 
 	    try {
+		if (mChat == null) {
+		    mChat = mChatManager.createChat(mContact, mMessageListener);
+		    mChat.setOpen(true);
+		}
 		mChat.sendMessage(msgToSend);
 	    } catch (RemoteException e) {
 		Log.e(TAG, e.getMessage());
@@ -780,4 +795,39 @@
 	    mInputField.setText(null);
 	}
     }
+
+    /**
+     * This class is in charge of getting the new chat in the activity if someone talk to you.
+     */
+    private class ChatManagerListener extends IChatManagerListener.Stub {
+
+	/**
+	 * Constructor.
+	 */
+	public ChatManagerListener() {
+	}
+
+	@Override
+	public void chatCreated(IChat chat, boolean locally) {
+	    if (locally)
+		return;
+	    try {
+		String contactJid = StringUtils.parseBareAddress(mContact.getJID());
+		String chatJid = StringUtils.parseBareAddress(chat.getParticipant().getJID());
+		if (chatJid.equals(contactJid)) {
+		    // This should not be happened but to be sure
+		    if (mChat != null) {
+			mChat.setOpen(false);
+			mChat.removeMessageListener(mMessageListener);
+		    }
+		    mChat = chat;
+		    mChat.setOpen(true);
+		    mChat.addMessageListener(mMessageListener);
+		    mChatManager.deleteChatNotification(mChat);
+		}
+	    } catch (RemoteException ex) {
+		Log.e(TAG, "A remote exception occurs during the creation of a chat", ex);
+	    }
+	}
+    }
 }
--- a/tools/checkstyle.xml	Fri Feb 19 00:31:05 2010 +0100
+++ b/tools/checkstyle.xml	Fri Feb 19 00:31:43 2010 +0100
@@ -171,18 +171,34 @@
 	<!-- Checks for whitespace                               -->
 	<!-- See http://checkstyle.sf.net/config_whitespace.html -->
 	<module name="EmptyForIteratorPad"/>
-	<module name="GenericWhitespace"/>
-	<module name="MethodParamPad"/>
-	<module name="NoWhitespaceAfter"/>
-	<module name="NoWhitespaceBefore"/>
+	<module name="GenericWhitespace">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="MethodParamPad">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="NoWhitespaceAfter">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="NoWhitespaceBefore">
+	    <property name="severity" value="error"/>
+	</module>
 	<module name="OperatorWrap"/>
-	<module name="ParenPad"/>
-	<module name="TypecastParenPad"/>
+	<module name="ParenPad">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="TypecastParenPad">
+	    <property name="severity" value="error"/>
+	</module>
 	<!-- We want mixed tabulation
 	  <module name="TabCharacter"/> 
 	  -->
-	<module name="WhitespaceAfter"/>
-	<module name="WhitespaceAround"/>
+	<module name="WhitespaceAfter">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="WhitespaceAround">
+	    <property name="severity" value="error"/>
+	</module>
 
 
 	<!-- Modifier Checks                                    -->