mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
fix auto-download
This commit is contained in:
parent
895d50adb4
commit
67a3899ffb
2 changed files with 11 additions and 22 deletions
|
|
@ -67,26 +67,22 @@
|
|||
size_t listSize = bctbx_list_size(chatRoomEvents);
|
||||
totalEventList = [[NSMutableArray alloc] initWithCapacity:listSize];
|
||||
eventList = [[NSMutableArray alloc] initWithCapacity:MIN(listSize, BASIC_EVENT_LIST)];
|
||||
BOOL autoDownload = (linphone_core_get_max_size_for_auto_download_incoming_files(LC) > -1);
|
||||
while (chatRoomEvents) {
|
||||
LinphoneEventLog *event = (LinphoneEventLog *)chatRoomEvents->data;
|
||||
[totalEventList addObject:[NSValue valueWithPointer:linphone_event_log_ref(event)]];
|
||||
if (listSize <= BASIC_EVENT_LIST) {
|
||||
[eventList addObject:[NSValue valueWithPointer:linphone_event_log_ref(event)]];
|
||||
}
|
||||
LinphoneChatMessage *chat = linphone_event_log_get_chat_message(event);
|
||||
// if auto_download is available and file transfer in progress, not add event now
|
||||
if (!(autoDownload && chat && linphone_chat_message_is_file_transfer_in_progress(chat))) {
|
||||
[totalEventList addObject:[NSValue valueWithPointer:linphone_event_log_ref(event)]];
|
||||
if (listSize <= BASIC_EVENT_LIST) {
|
||||
[eventList addObject:[NSValue valueWithPointer:linphone_event_log_ref(event)]];
|
||||
}
|
||||
}
|
||||
|
||||
chatRoomEvents = chatRoomEvents->next;
|
||||
listSize -= 1;
|
||||
}
|
||||
bctbx_list_free_with_data(head, (bctbx_list_free_func)linphone_event_log_unref);
|
||||
|
||||
/*for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) {
|
||||
const LinphoneAddress *ftd_peer =
|
||||
linphone_chat_room_get_peer_address(linphone_chat_message_get_chat_room(ftd.message));
|
||||
const LinphoneAddress *peer = linphone_chat_room_get_peer_address(_chatRoom);
|
||||
if (linphone_address_equal(ftd_peer, peer) && linphone_chat_message_is_outgoing(ftd.message)) {
|
||||
LOGI(@"Appending transient upload message %p", ftd.message);
|
||||
//TODO : eventList = bctbx_list_append(eventList, linphone_chat_message_ref(ftd.event));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
- (void)refreshData {
|
||||
|
|
|
|||
|
|
@ -1100,23 +1100,16 @@ void on_chat_room_chat_message_received(LinphoneChatRoom *cr, const LinphoneEven
|
|||
|
||||
if (!linphone_chat_message_is_file_transfer(chat) && !linphone_chat_message_is_text(chat) && !hasFile) /*probably an imdn*/
|
||||
return;
|
||||
|
||||
|
||||
const LinphoneAddress *from = linphone_chat_message_get_from_address(chat);
|
||||
if (!from)
|
||||
return;
|
||||
|
||||
if (hasFile) {
|
||||
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
|
||||
return;
|
||||
}
|
||||
|
||||
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:view];
|
||||
[view.tableController scrollToLastUnread:TRUE];
|
||||
}
|
||||
|
||||
|
||||
|
||||
void on_chat_room_chat_message_sent(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
|
||||
ChatConversationView *view = (__bridge ChatConversationView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_current_callbacks(cr));
|
||||
[view.tableController addEventEntry:(LinphoneEventLog *)event_log];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue