use linphone_chat_room_get_history_events instead of linphone_chat_room_get_history

This commit is contained in:
Benjamin Reis 2017-11-07 15:08:06 +01:00
parent 11512b1abc
commit 45b1b60ac1
3 changed files with 23 additions and 11 deletions

View file

@ -96,11 +96,17 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo
while (iter) {
// store last message in user data
LinphoneChatRoom *chat_room = iter->data;
bctbx_list_t *history = linphone_chat_room_get_history(iter->data, 1);
bctbx_list_t *history = linphone_chat_room_get_history_events(iter->data, 1);
LinphoneChatMessage *last_msg = NULL;
if (history) {
last_msg = linphone_chat_message_ref(history->data);
while (history) {
LinphoneEventLog *event = history->data;
if (linphone_event_log_get_type(event) != LinphoneEventLogTypeConferenceChatMessage) {
history = history->next;
continue;
}
last_msg = linphone_chat_message_ref(linphone_event_log_get_chat_message(event));
bctbx_list_free(history);
break;
}
linphone_chat_room_set_user_data(chat_room, last_msg);
sorted = bctbx_list_insert_sorted(sorted, linphone_chat_room_ref(chat_room),

View file

@ -760,14 +760,20 @@ void update_hash_cbs(LinphoneAccountCreator *creator, LinphoneAccountCreatorStat
} else if ([key isEqual:@"flush_images_button"]) {
const MSList *rooms = linphone_core_get_chat_rooms(LC);
while (rooms) {
const MSList *messages = linphone_chat_room_get_history(rooms->data, 0);
while (messages) {
LinphoneChatMessage *msg = messages->data;
if (!linphone_chat_message_is_outgoing(msg)) {
[LinphoneManager setValueInMessageAppData:nil forKey:@"localimage" inMessage:messages->data];
[LinphoneManager setValueInMessageAppData:nil forKey:@"uploadQuality" inMessage:messages->data];
const MSList *events = linphone_chat_room_get_history_events(rooms->data, 0);
while (events) {
LinphoneEventLog *event = events->data;
if (linphone_event_log_get_type(event) != LinphoneEventLogTypeConferenceChatMessage) {
events = events->next;
continue;
}
messages = messages->next;
LinphoneChatMessage *msg = linphone_event_log_get_chat_message(event);
if (!linphone_chat_message_is_outgoing(msg)) {
[LinphoneManager setValueInMessageAppData:nil forKey:@"localimage" inMessage:events->data];
[LinphoneManager setValueInMessageAppData:nil forKey:@"uploadQuality" inMessage:events->data];
}
events = events->next;
}
rooms = rooms->next;
}

View file

@ -194,7 +194,7 @@
for (int i = 0; i < 50; i++) {
[tester waitForTimeInterval:.5f];
if (bctbx_list_size(linphone_chat_room_get_history(room, 0)) == count) {
if (bctbx_list_size(linphone_chat_room_get_history_events(room, 0)) == count) {
break;
}
}