Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Mam improvements #134

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Mam improvements #134

wants to merge 17 commits into from

Conversation

ron282
Copy link
Contributor

@ron282 ron282 commented May 27, 2022

No description provided.

@codecov
Copy link

codecov bot commented May 27, 2022

Codecov Report

Merging #134 (edd533b) into master (862d56d) will decrease coverage by 2.05%.
The diff coverage is 35.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #134      +/-   ##
==========================================
- Coverage   27.96%   25.91%   -2.06%     
==========================================
  Files          71       73       +2     
  Lines        4051     4063      +12     
==========================================
- Hits         1133     1053      -80     
- Misses       2918     3010      +92     
Impacted Files Coverage Δ
source/base/MessageHandler.h 0.00% <ø> (ø)
source/base/Settings.cpp 28.43% <0.00%> (-0.84%) ⬇️
source/base/Settings.h 100.00% <ø> (ø)
source/contacts/RosterController.cpp 44.39% <0.00%> (-6.67%) ⬇️
source/room/MucCollection.cpp 0.00% <0.00%> (-75.00%) ⬇️
source/xep/mam/MamManager.cpp 10.93% <0.00%> (-9.24%) ⬇️
source/xep/mam/MamRequest.h 0.00% <0.00%> (ø)
source/xep/omemo/lurch/lurch.c 0.00% <0.00%> (ø)
source/room/MucManager.cpp 27.35% <34.61%> (-36.78%) ⬇️
source/base/MessageHandler.cpp 52.97% <56.14%> (+2.24%) ⬆️
... and 9 more

@lgtm-com
Copy link

lgtm-com bot commented May 27, 2022

This pull request introduces 1 alert and fixes 2 when merging 31ec272 into 50ef274 - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@ron282 ron282 marked this pull request as ready for review May 27, 2022 17:25
@ron282
Copy link
Contributor Author

ron282 commented Jun 11, 2022

Hi @geobra . Did you have the opportunity to look at my pull requests? I have another one after these ones related to ui improvements and ability to choose attachments to download

@geobra
Copy link
Owner

geobra commented Jun 22, 2022

Hi @ron282. Sorry, was in Holiday. Will try to do the review at the weekend.

@geobra
Copy link
Owner

geobra commented Jun 25, 2022

I have to dig more into your code.

From a functional point of view, the 'hard' stuff of requesting the MaM messages and to catch them inside the MessageHandler seems to work good. But I only get the MaM messages in the debug xml window. It did not get passed to the database.

On my side, if I send a message to a group and go online 2 minutes later with shmoose, this line always discards the message:
if(timestamp > 0 && timestamp <= start)

timestamp is always bigger then start. And start is set to -14 days.
I have to recalculate this values to get a clue what went wrong here.

Does it work on your side?

@geobra
Copy link
Owner

geobra commented Jun 26, 2022

Okay, 'start' is always 'now' on my system, instead of -14 days.
'delay' is a diff, but should be an absolute time value. I use this code to get the 'timestamp':

    auto stamp = delay->getStamp();
    std::tm time_tm = to_tm(stamp);
    timestamp = mktime(&time_tm);

With this changes
persistence_->addMessage(...)
is called.

But the message still did not show up in the gui. Need to digg more...

@ron282
Copy link
Contributor Author

ron282 commented Jun 26, 2022

Thanks for your feedback. I had a look. I don't have the issue. I'm testing directly on a phone (Xperia 10)

QDateTime returnValue = QDateTime::currentDateTimeUtc().addDays(-15);
QSettings settings;
QString jid=getJid();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be the jid of the other message partner or the group jid. As a result, there will be one entry in the settings file for each contact.

setLatestMamSyncDate is called after a Mam IQ Fin message is received. On the next request of the next group to catch MaM messages, the start-time is 'now'. If there are multiple groups, only the first group is requested with the correct last date. The next groups are requested with a start date of 'now'.

Swift::Forwarded::ref forwarded = nullptr;
Swift::Message::ref forwardedMessage = nullptr;
qint64 timestamp = 0;
QString partyJid = QString::fromStdString(message->getFrom().toBare().toString());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partyJid is now set several times. And on my MaM messages, it get reset in different locations. Finally, the message is pushed into the db as a 1to1 messages with the group member, instead of a group messages. I will have a look at it and will make a proposal for a handleMessageReceived method. Please give me some time.

@geobra
Copy link
Owner

geobra commented Jun 30, 2022

Have something working with some cheating. Had to clean it up now again... ;-).

@ron282
Copy link
Contributor Author

ron282 commented Jul 2, 2022

The muc archived msg must have a stanza-id with a by attribute which gives the bare JID of the account. Could it be a solution?

@ron282
Copy link
Contributor Author

ron282 commented Jul 3, 2022

I don't see the include-groupchat parameter in the archive request. This could be also an explanation why you don't see them.

@geobra
Copy link
Owner

geobra commented Jul 3, 2022

There is an include-groupchat parameter in the MaM request? Interesting. The current implementation works without that. Do you have a link to read about that?

@ron282
Copy link
Contributor Author

ron282 commented Jul 3, 2022

https://xmpp.org/extensions/xep-0313.html. Example 12

@geobra
Copy link
Owner

geobra commented Jul 5, 2022

Ok, I see. Thank you for the link.

The implementation get's to complex to test all cases manually. I started to setup a unit-test for the handleMessageReceived method. I will share all the code as soon as the first test succeeds.

@geobra
Copy link
Owner

geobra commented Jul 5, 2022

First simple test is running. Have a look at mam_improvments branch at my git repo. Basic stuff and mam handling is working here. Test must be filled with all different kinds of msg'es which gets handled. Needs some time ;-).

@geobra
Copy link
Owner

geobra commented Jul 5, 2022

You are welcome to add more tests or cherry-pick some changes and add to your branch for testing.

@ron282
Copy link
Contributor Author

ron282 commented Jul 5, 2022

I don't think the inlcude-groupchat has anything to do with your issue. I will have a look at your implementation. Are you testing with private groups or public ones?

@ron282
Copy link
Contributor Author

ron282 commented Jul 5, 2022

I have also a couple of additionnal improvements waiting for pull requests: omemo and muc, ui improvements for contact view and for message view.

@geobra
Copy link
Owner

geobra commented Jul 6, 2022

Currently the test is just set up and test plain 1to1 msg. Group message test will be implemented next. And it should not matter if it is a private or a public group chat.

Are your other improvements independent from MaM? You are welcome to make another PR for other stuff.

@lgtm-com
Copy link

lgtm-com bot commented Jul 10, 2022

This pull request introduces 1 alert and fixes 2 when merging 9fd8b71 into 50ef274 - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jul 10, 2022

This pull request introduces 1 alert and fixes 2 when merging 0b9eaaa into 50ef274 - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jul 15, 2022

This pull request introduces 1 alert and fixes 2 when merging 0d67de0 into ebfc82c - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@ron282
Copy link
Contributor Author

ron282 commented Jul 15, 2022

This is a proposal to only sync mam with messages inserted since the last sync based on msgId and not based on date. There is one entry in the conf file per mam storage.

@lgtm-com
Copy link

lgtm-com bot commented Jul 15, 2022

This pull request introduces 1 alert and fixes 2 when merging cf67e61 into ebfc82c - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@ron282
Copy link
Contributor Author

ron282 commented Jul 15, 2022

I have some problems with the change in MessageHandler.cpp line 68 to convert delay into timestamp. mktime is using local time instead of utc time leading to incorrect time.

@lgtm-com
Copy link

lgtm-com bot commented Jul 15, 2022

This pull request introduces 1 alert and fixes 2 when merging 002c69e into ebfc82c - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jul 16, 2022

This pull request introduces 1 alert and fixes 2 when merging b2ae907 into ebfc82c - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@geobra
Copy link
Owner

geobra commented Jul 16, 2022

You are right. I did no had the UTC issue in mind. Let's revert it to your implementation.

@lgtm-com
Copy link

lgtm-com bot commented Jul 17, 2022

This pull request introduces 1 alert and fixes 2 when merging 01710e3 into ebfc82c - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jul 18, 2022

This pull request introduces 1 alert and fixes 2 when merging bef0a71 into ebfc82c - view on LGTM.com

new alerts:

  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jul 19, 2022

This pull request introduces 2 alerts and fixes 2 when merging 92b0716 into ebfc82c - view on LGTM.com

new alerts:

  • 1 for Resource not released in destructor
  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jul 20, 2022

This pull request introduces 2 alerts and fixes 2 when merging a924fcf into ebfc82c - view on LGTM.com

new alerts:

  • 1 for Resource not released in destructor
  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Aug 7, 2022

This pull request introduces 2 alerts and fixes 2 when merging edd533b into 862d56d - view on LGTM.com

new alerts:

  • 1 for Resource not released in destructor
  • 1 for FIXME comment

fixed alerts:

  • 2 for FIXME comment

@geobra
Copy link
Owner

geobra commented Sep 3, 2022

Short update. I wrote more tests. Only a few tests are missing now and one critical FIXME. If these are resolved, we can resume discussions about a merge :-).

@ron282
Copy link
Contributor Author

ron282 commented Sep 6, 2022

Thanks. I will have a look at your tests. I'm ok to write some. I just need to get some examples.

@carlosgonz0
Copy link
Contributor

Hi friends, any nighly version to testing the new improvements?? i still can not using Shmoose because not compat with Conversations when using omemo.

Thank of advance.

@geobra
Copy link
Owner

geobra commented Sep 12, 2022

Really, you have issues with omemo and Conversations? That works without any issues for me.
What is the problem at your side?

@geobra
Copy link
Owner

geobra commented Sep 12, 2022

BTW, we did not make many changes on the omemo implementation. I do not expect that a nightly build will solve your issues.

@geobra
Copy link
Owner

geobra commented Sep 22, 2022

@ron282 is it ok for you to postpone this until we have the qxmpp prove of concept?

@ron282
Copy link
Contributor Author

ron282 commented Sep 22, 2022

@geobra yes no pb to postpone

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants