diff --git a/build/android/Android.mk b/build/android/Android.mk index e9c9fa1f6..9263f748f 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -60,7 +60,8 @@ LOCAL_SRC_FILES := \ linphone_tunnel_config.c \ message_storage.c \ info.c \ - event.c + event.c \ + xml.c ifndef LINPHONE_VERSION LINPHONE_VERSION = "Devel" diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 4dc3b6d04..a1f428b4a 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -170,6 +170,7 @@ public: vTable.call_encryption_changed = callEncryptionChange; vTable.text_received = text_received; vTable.message_received = message_received; + vTable.is_composing_received = is_composing_received; vTable.dtmf_received = dtmf_received; vTable.new_subscription_requested = new_subscription_requested; vTable.notify_presence_received = notify_presence_received; @@ -225,6 +226,7 @@ public: /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/ textReceivedId = env->GetMethodID(listenerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V"); messageReceivedId = env->GetMethodID(listenerClass,"messageReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneChatMessage;)V"); + isComposingReceivedId = env->GetMethodID(listenerClass,"isComposingReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;)V"); dtmfReceivedId = env->GetMethodID(listenerClass,"dtmfReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;I)V"); infoReceivedId = env->GetMethodID(listenerClass,"infoReceived", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneInfoMessage;)V"); @@ -307,6 +309,7 @@ public: jmethodID notifyPresenceReceivedId; jmethodID textReceivedId; jmethodID messageReceivedId; + jmethodID isComposingReceivedId; jmethodID dtmfReceivedId; jmethodID callStatsUpdatedId; jmethodID transferStateId; @@ -550,6 +553,19 @@ public: ,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room) ,env->NewObject(lcData->chatMessageClass,lcData->chatMessageCtrId,(jlong)msg)); } + static void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) { + JNIEnv *env = 0; + jint result = jvm->AttachCurrentThread(&env,NULL); + if (result != 0) { + ms_error("cannot attach VM"); + return; + } + LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc); + env->CallVoidMethod(lcData->listener + ,lcData->isComposingReceivedId + ,lcData->core + ,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room)); + } static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) { JNIEnv *env = 0; jint result = jvm->AttachCurrentThread(&env,NULL); @@ -2311,6 +2327,12 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_deleteHistory(JNIEnv ,jlong ptr) { linphone_chat_room_delete_history((LinphoneChatRoom*)ptr); } +JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneChatRoomImpl_compose(JNIEnv *env, jobject thiz, jlong ptr) { + linphone_chat_room_compose((LinphoneChatRoom *)ptr); +} +JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneChatRoomImpl_isRemoteComposing(JNIEnv *env, jobject thiz, jlong ptr) { + return (jboolean)linphone_chat_room_is_remote_composing((LinphoneChatRoom *)ptr); +} extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_deleteMessage(JNIEnv* env ,jobject thiz ,jlong room diff --git a/java/common/org/linphone/core/LinphoneChatRoom.java b/java/common/org/linphone/core/LinphoneChatRoom.java index 5c87f5647..e84538269 100644 --- a/java/common/org/linphone/core/LinphoneChatRoom.java +++ b/java/common/org/linphone/core/LinphoneChatRoom.java @@ -80,6 +80,17 @@ public interface LinphoneChatRoom { * Deletes all the messages associated with the peer of this chat room */ void deleteHistory(); + + /** + * Notify the destination of the chat message being composed that the user is typing a new message. + */ + void compose(); + + /** + * Tells whether the remote is currently composing a message. + * @return true if the remote is currently composing a message, false otherwise. + */ + boolean isRemoteComposing(); /** * Marks all the messages in this conversation as read diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index 60e9e3d59..d01fa01a7 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -91,6 +91,13 @@ public interface LinphoneCoreListener { */ void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message); + /** + * invoked when a composing notification is received + * @param lc LinphoneCore + * @param room LinphoneChatRoom involved in the conversation. + */ + void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr); + /** * invoked when a new dtmf is received * @param lc LinphoneCore diff --git a/java/impl/org/linphone/core/LinphoneChatRoomImpl.java b/java/impl/org/linphone/core/LinphoneChatRoomImpl.java index 7f4d684ee..c2021e379 100644 --- a/java/impl/org/linphone/core/LinphoneChatRoomImpl.java +++ b/java/impl/org/linphone/core/LinphoneChatRoomImpl.java @@ -31,6 +31,8 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { private native void destroy(long ptr); private native int getUnreadMessagesCount(long ptr); private native void deleteHistory(long ptr); + private native void compose(long ptr); + private native boolean isRemoteComposing(long ptr); private native void markAsRead(long ptr); private native void deleteMessage(long room, long message); private native void updateUrl(long room, long message); @@ -87,6 +89,14 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom { public void deleteHistory() { deleteHistory(nativePtr); } + + public void compose() { + compose(nativePtr); + } + + public boolean isRemoteComposing() { + return isRemoteComposing(nativePtr); + } public void markAsRead() { markAsRead(nativePtr);