diff --git a/Classes/ChatTableViewController.m b/Classes/ChatTableViewController.m index d0f5e94c9..ef7b180c2 100644 --- a/Classes/ChatTableViewController.m +++ b/Classes/ChatTableViewController.m @@ -75,8 +75,8 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo - (MSList *)sortChatRooms { MSList *sorted = nil; - MSList *unsorted = linphone_core_get_chat_rooms([LinphoneManager getLc]); - MSList *iter = unsorted; + const MSList *unsorted = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *iter = unsorted; while (iter) { // store last message in user data @@ -176,8 +176,7 @@ static void chatTable_free_chatrooms(void *data) { [ftd cancel]; } } - linphone_chat_room_delete_history(chatRoom); - linphone_chat_room_unref(chatRoom); + linphone_core_delete_chat_room(linphone_chat_room_get_lc(chatRoom), chatRoom); data = ms_list_remove(data, chatRoom); // will force a call to [self loadData] diff --git a/Classes/ChatViewController.m b/Classes/ChatViewController.m index 15c346ce9..e17b80c1b 100644 --- a/Classes/ChatViewController.m +++ b/Classes/ChatViewController.m @@ -98,14 +98,12 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)startChatRoom { // Push ChatRoom LinphoneChatRoom *room = - linphone_core_get_or_create_chat_room([LinphoneManager getLc], [addressField.text UTF8String]); + linphone_core_get_chat_room_from_uri([LinphoneManager getLc], [addressField.text UTF8String]); if (room != nil) { ChatRoomViewController *controller = DYNAMIC_CAST( [[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription] push:TRUE], ChatRoomViewController); if (controller != nil) { - LinphoneChatRoom *room = - linphone_core_get_or_create_chat_room([LinphoneManager getLc], [addressField.text UTF8String]); [controller setChatRoom:room]; } } else { diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index 82f709fe6..f17f43a1f 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -644,7 +644,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe ChatRoomViewController); if (controller != nil) { LinphoneChatRoom *room = - linphone_core_get_or_create_chat_room([LinphoneManager getLc], [dest UTF8String]); + linphone_core_get_chat_room_from_uri([LinphoneManager getLc], [dest UTF8String]); [controller setChatRoom:room]; } } diff --git a/Classes/HistoryDetailsViewController.m b/Classes/HistoryDetailsViewController.m index bc1ea227e..7da06d8ab 100644 --- a/Classes/HistoryDetailsViewController.m +++ b/Classes/HistoryDetailsViewController.m @@ -358,11 +358,8 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onMessageClick:(id)event { - LinphoneAddress *addr; - addr = linphone_call_log_get_remote_address(callLog); - - char *lAddress = linphone_address_as_string_uri_only(addr); - if (lAddress == NULL) + const LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog); + if (addr == NULL) return; // Go to ChatRoom view [[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]]; @@ -370,10 +367,9 @@ static UICompositeViewDescription *compositeDescription = nil; [[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription] push:TRUE], ChatRoomViewController); if (controller != nil) { - LinphoneChatRoom *room = linphone_core_get_or_create_chat_room([LinphoneManager getLc], lAddress); + LinphoneChatRoom *room = linphone_core_get_chat_room([LinphoneManager getLc], addr); [controller setChatRoom:room]; } - ms_free(lAddress); } @end diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 947f6c4fc..60ce84ba9 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -317,7 +317,7 @@ } - (LinphoneChatRoom *)findChatRoomForContact:(NSString *)contact { - MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); const char *from = [contact UTF8String]; while (rooms) { const LinphoneAddress *room_from_address = linphone_chat_room_get_peer_address((LinphoneChatRoom *)rooms->data); @@ -445,7 +445,7 @@ [self application:application didReceiveLocalNotification:notification]; } else if ([identifier isEqualToString:@"mark_read"]) { NSString *from = [notification.userInfo objectForKey:@"from_addr"]; - LinphoneChatRoom *room = linphone_core_get_or_create_chat_room(lc, [from UTF8String]); + LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(lc, [from UTF8String]); if (room) { linphone_chat_room_mark_as_read(room); [[PhoneMainView instance] updateApplicationBadgeNumber]; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 6bdbb167e..813283f4d 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2048,8 +2048,8 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1 + (int)unreadMessageCount { int count = 0; - MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); - MSList *item = rooms; + const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + const MSList *item = rooms; while (item) { LinphoneChatRoom *room = (LinphoneChatRoom *)item->data; if (room) { diff --git a/submodules/linphone b/submodules/linphone index 9f2b9df16..44327da3e 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 9f2b9df16a2f6537196a7f2ec8db792d63287a9d +Subproject commit 44327da3ec399aa4eb29a4fb93a585bd99c47af5