On Sun, Feb 28, 2021 at 11:07:31PM +0100, Bernhard Schmidt wrote:
> an updated liblinphone has been uploaded to sid yesterday. Could you
> please try liblinphone10 and liblinphone++10 from sid (4.4.21-2) and
> report back? If it does not work you might need libsoci-core4.0 and
> libsoci-sqlite3-4.0 from unstable as well (4.0.1-4).

I installed the packages and they work the same as mine.  Also I
managed to get asterisk running for chat and I do see now chat
messages are added to the DB linphone.db and the UI as they are
sent/received.  I also see at certain points signs that some form of
history is being reconstructed due to lines like

[07:20:39:145][0x56499abd2e10][Warning]qrc:/ui/modules/Linphone/Chat/Chat.qml:184:14:
 qrc:/ui/modules/Linphone/Chat/Chat.qml:184:14: QML Chat: Implicitly defined 
onFoo properties in Connections are deprecated. Use this syntax instead: 
function onFoo(<arguments>) { ... }

being written to stdout, one for every event, i.e. the output gets
longer for every message added to the DB.  The code apparently
reconstructs the history by just playing back the events from the DB.
However, I still don't see any history of past messages in the UI
after starting /usr/bin/linphone anew, and I don't fully understand
why.  Apparently there exist two different history concepts:

* global call log: holds call entries from all encountered contacts in
  chronological order with chat messages omitted for brevity

* peer-specific call log: the same, but only for the currently shown
  contact.

* peer-specific chat log: the chat history with the currently shown
  contact.

* peer-specific call+chat log: a combination of the two previous log

* something called a "conversation" which might be the name for the
  peer-specific call+chat log UI.

I think the chat history is read back in
linphone-desktop/linphone-app/src/components/chat/ChatModel.cpp in
ChatModel::setSipAddress() with a call to ChatRoom::getHistory(0)
which should fetch the entire history for the ChatRoom participants
(peerAddres, localAddress) and insert them into the UI:

...
 for (auto &message : mChatRoom->getHistory(0))
    mEntries << qMakePair(
      QVariantMap{
        { "type", EntryType::MessageEntry },
        { "timestamp", QDateTime::fromMSecsSinceEpoch(message->getTime() * 
1000) }
      },
      static_pointer_cast<void>(message)
    );

  // Get calls.
  for (auto &callLog : core->getCallHistory(mChatRoom->getPeerAddress(), 
mChatRoom->getLocalAddress()))
    insertCall(callLog);
...

Notice that call history entries are inserted with insertCall(),
whereas the code for chat history entries duplicates what
ChatModel::insertMessageAtEnd() does, but apparently without updating
the UI with endInsertRows():

...
void ChatModel::insertMessageAtEnd (const shared_ptr<linphone::ChatMessage> 
&message) {
  int row = mEntries.count();

  beginInsertRows(QModelIndex(), row, row);

  QVariantMap map{
    { "type", EntryType::MessageEntry },
    { "timestamp", QDateTime::fromMSecsSinceEpoch(message->getTime() * 1000) }
  };
  fillMessageEntry(map, message);
  mEntries << qMakePair(map, static_pointer_cast<void>(message));

  endInsertRows();
}
...

I have no idea if this is intentional or what will happen if I change
that code to call insertMessageAtEnd() instead.  Commit 4ece007e[1]
also updated insertMessageAtEnd(), but the corresponding code in
setSipAddress() wasn't touched.  I will try to work on this and report
back when I know more.

Regards,
Dennis.

1: 
https://gitlab.linphone.org/BC/public/linphone-desktop/-/commit/4ece007eb322cceddb9d572c688c3c553f66ee85

Reply via email to