qxmpp-project / qxmpp

Cross-platform C++ XMPP client and server library
401 stars 197 forks source link

Implement history settings from XEP-0045 #574

Closed mazhe closed 4 months ago

mazhe commented 1 year ago

PR check list:

Hi, first thanks for your work on the QXmpp project. I am noticing that there is actually no way ton control how much history is send when joining a MUC room. Some clients might want to even disable it to use MAM instead.

I have put together some code to have this ability, basically it add a QXmppMucHistory (not fond of the name, but that's the node name in the spec) element to be used in QXmppPresence and an overloaded version of QXmppMucRoom::join() so that history can, for example, be disabled doing:

QXmppMucRoom *room = manager->addRoom("room@conference.example.com");
room->setNickName("mynick");
QXmppMucHistory history;
history.setMaxchars(0);
room->join(history);

I realize this is not really ideal, this is a bit of a request for comments, I could change it to be stored in QXmppMucRoom if you think this is better.

Also, I don't think there is a MUC testsuite to add some testing? Should I add something in the QXmppPresence testing?