Commit b3c08e5d authored by Sylvain Berfini's avatar Sylvain Berfini
Browse files

Added method to update message's url field in database in case of changes

parent d16f15f1
......@@ -860,6 +860,7 @@ LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_room_create_message(LinphoneC
LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr);
LINPHONE_PUBLIC void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
LINPHONE_PUBLIC void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangeCb status_cb,void* ud);
LINPHONE_PUBLIC void linphone_chat_room_update_url(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
LINPHONE_PUBLIC MSList *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message);
LINPHONE_PUBLIC void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr);
LINPHONE_PUBLIC void linphone_chat_room_delete_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
......
......@@ -2100,6 +2100,13 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_markAsRead(JNIEnv*
linphone_chat_room_mark_as_read((LinphoneChatRoom*)ptr);
}
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_updateUrl(JNIEnv* env
,jobject thiz
,jlong room
,jlong msg) {
linphone_chat_room_update_url((LinphoneChatRoom*)room, (LinphoneChatMessage*)msg);
}
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_destroy(JNIEnv* env
,jobject thiz
,jlong ptr) {
......
......@@ -165,6 +165,16 @@ void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr){
ms_free(peer);
}
void linphone_chat_room_update_url(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
LinphoneCore *lc=linphone_chat_room_get_lc(cr);
if (lc->db==NULL) return ;
char *buf=sqlite3_mprintf("update history set url=%Q where id=%i;",msg->external_body_url,msg->storage_id);
linphone_sql_request(lc->db,buf);
sqlite3_free(buf);
}
int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr){
LinphoneCore *lc=linphone_chat_room_get_lc(cr);
int numrows=0;
......@@ -320,6 +330,9 @@ void linphone_core_message_storage_init(LinphoneCore *lc){
void linphone_core_message_storage_close(LinphoneCore *lc){
}
void linphone_chat_room_update_url(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
}
int linphone_chat_room_get_unread_messages_count(LinphoneChatRoom *cr){
return 0;
}
......
......@@ -81,4 +81,10 @@ public interface LinphoneChatRoom {
* @param message the message to delete
*/
void deleteMessage(LinphoneChatMessage message);
/**
* Update the value stored in the database for the external_body_url field
* @param message to update
*/
void updateUrl(LinphoneChatMessage message);
}
......@@ -32,6 +32,7 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
private native void deleteHistory(long ptr);
private native void markAsRead(long ptr);
private native void deleteMessage(long room, long message);
private native void updateUrl(long room, long message);
protected LinphoneChatRoomImpl(long aNativePtr) {
nativePtr = aNativePtr;
......@@ -88,4 +89,9 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
if (message != null)
deleteMessage(nativePtr, message.getNativePtr());
}
public void updateUrl(LinphoneChatMessage message) {
if (message != null)
updateUrl(nativePtr, message.getNativePtr());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment