From 42199f23dce91ca774a67ccf31d1924dc792275f Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 22 May 2014 11:24:18 +0200 Subject: [PATCH] Fix image sending, there is still an issue with the message state. Not sure why. --- Classes/ChatRoomTableViewController.m | 7 ++++--- Classes/ChatRoomViewController.m | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Classes/ChatRoomTableViewController.m b/Classes/ChatRoomTableViewController.m index 3969d097f..322506f6a 100644 --- a/Classes/ChatRoomTableViewController.m +++ b/Classes/ChatRoomTableViewController.m @@ -43,8 +43,6 @@ - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [TUNinePatchCache flushCache]; // Clear cache - [self clearMessageList]; - chatRoom = NULL; } - (void)viewWillAppear:(BOOL)animated { [self reloadData]; @@ -110,7 +108,10 @@ int count = 0; while (item) { LinphoneChatMessage* msg = (LinphoneChatMessage*)item->data; - NSLog(@"Message %d: %s", count++, linphone_chat_message_get_text(msg)); + const char* text = linphone_chat_message_get_text(msg); + const char* url = linphone_chat_message_get_external_body_url(msg); + const char* state = linphone_chat_message_state_to_string(linphone_chat_message_get_state(msg)); + NSLog(@"Message %d type %s (%s): %s", count++, text?"TEXT":"IMG", state,text?text:url); item = item->next; } } diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index d9d514358..d579b6e16 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -197,7 +197,7 @@ static UICompositeViewDescription *compositeDescription = nil; [messageField resignFirstResponder]; - chatRoom = NULL; + //chatRoom = NULL; [self setComposingVisible:FALSE withDelay:0]; // will hide the "user is composing.." message @@ -250,7 +250,6 @@ static UICompositeViewDescription *compositeDescription = nil; [self update]; linphone_chat_room_mark_as_read(chatRoom); [self setComposingVisible:linphone_chat_room_is_remote_composing(chatRoom) withDelay:0]; - [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneTextReceived object:self]; } - (void)applicationWillEnterForeground:(NSNotification*)notif { @@ -307,8 +306,9 @@ static UICompositeViewDescription *compositeDescription = nil; static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud) { ChatRoomViewController* thiz = (ChatRoomViewController*)ud; const char*text = linphone_chat_message_get_text(msg); + const char*url = linphone_chat_message_get_external_body_url(msg); [LinphoneLogger log:LinphoneLoggerLog - format:@"Delivery status for [%s] is [%s]",text,linphone_chat_message_state_to_string(state)]; + format:@"Delivery status for %p [%s] is [%s]",msg, text?text:url,linphone_chat_message_state_to_string(state)]; [thiz.tableController updateChatEntry:msg]; }