-
Notifications
You must be signed in to change notification settings - Fork 25
mam in progress #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mam in progress #59
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
3efa970
mam in progress
liuch e1244cb
replaced QLatin1String with QStringLiteral
liuch cf06ec0
replaced QString::null with QString()
liuch f191ef8
a few minor changes
liuch 036ced4
merged from master branch
liuch 3b63df3
added comments
liuch e1c64f9
some refactoring and optimization
liuch eb0d699
Merge branch 'master' into mam
Ri0n 2535f55
Resolve some pointer magic conflicts
Ri0n 57f1a35
Added forgotten moc include
Ri0n ff171f7
Return potentionally uninitialized Forwarding instead of static magic.
Ri0n be8ba7f
some fixes. Thanks to @pasnox
liuch 74961f9
Small code enhancements
pasnox debfd4b
Merge remote-tracking branch 'origin/master' into mam
Ri0n 635c56b
Build fixes after master merging
Ri0n 6d76ccd
Remove not needed header
Ri0n b667bca
Merge branch 'master' into mam
Ri0n f57dd87
Fix lambda capture deprecation warning
Ri0n 5ab9c31
MAM: rough draft (#73)
mcneb10 35cd90c
compilation fixes
Ri0n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,6 @@ object_script.* | |
/bin | ||
/lib | ||
/plugins | ||
*.user* | ||
build-* | ||
*.pro.user* | ||
3rdparty/qca |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "../../src/xmpp/xmpp-im/xmpp_carbons.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "../../src/xmpp/xmpp-im/xmpp_forwarding.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "xmpp/xmpp-im/xmpp_mammanager.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "xmpp/xmpp-im/xmpp_mamtask.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,9 @@ | |
#include "xmpp/xmpp-core/protocol.h" | ||
#include "xmpp_bitsofbinary.h" | ||
#include "xmpp_captcha.h" | ||
#include "xmpp_carbons.h" | ||
#include "xmpp_features.h" | ||
#include "xmpp_forwarding.h" | ||
#include "xmpp_ibb.h" | ||
#include "xmpp_reference.h" | ||
#include "xmpp_xmlcommon.h" | ||
|
@@ -732,7 +734,6 @@ class Message::Private : public QSharedData { | |
QMap<QString, HTMLElement> htmlElements; | ||
QDomElement sxe; | ||
QList<BoBData> bobDataList; | ||
Jid forwardedFrom; | ||
|
||
QList<int> mucStatuses; | ||
QList<MUCInvite> mucInvites; | ||
|
@@ -743,14 +744,14 @@ class Message::Private : public QSharedData { | |
bool spooled = false, wasEncrypted = false; | ||
|
||
// XEP-0280 Message Carbons | ||
bool isDisabledCarbons = false; | ||
Message::CarbonDir carbonDir = Message::NoCarbon; // it's a forwarded message | ||
bool carbonsPrivate = false; | ||
Message::ProcessingHints processingHints; | ||
QString replaceId; | ||
QString originId; // XEP-0359 | ||
QString encryptionProtocol; // XEP-0380 | ||
Message::StanzaId stanzaId; // XEP-0359 | ||
QList<Reference> references; // XEP-0385 and XEP-0372 | ||
Forwarding forwarding; // XEP-0297 | ||
Message::Reactions reactions; // XEP-0444 | ||
QString retraction; // XEP-0424 | ||
}; | ||
|
@@ -1134,17 +1135,44 @@ QList<BoBData> Message::bobDataList() const { return d ? d->bobDataList : QList< | |
|
||
IBBData Message::ibbData() const { return d ? d->ibbData : IBBData(); } | ||
|
||
void Message::setDisabledCarbons(bool disabled) { MessageD()->isDisabledCarbons = disabled; } | ||
//! \brief Returns Jid of the remote contact | ||
//! | ||
//! Returns Jid of the remote contact for the original message | ||
//! which may be wrapped using carbons. It is useful when a client | ||
//! needs to know in which window it should display the message. | ||
//! So it is not always just from(). | ||
Jid Message::displayJid() const | ||
{ | ||
if (!d) | ||
return Jid(); | ||
|
||
switch (d->forwarding.type()) { | ||
case Forwarding::ForwardedCarbonsSent: | ||
return d->forwarding.message().to(); | ||
case Forwarding::ForwardedCarbonsReceived: | ||
return d->forwarding.message().from(); | ||
default: | ||
break; | ||
} | ||
return from(); | ||
} | ||
|
||
//! \brief Returns either the message inside the carbons or itself. | ||
Message Message::displayMessage() const | ||
{ | ||
if (d && d->forwarding.isCarbons()) | ||
return d->forwarding.message(); | ||
|
||
bool Message::isDisabledCarbons() const { return d && d->isDisabledCarbons; } | ||
return *this; | ||
} | ||
|
||
void Message::setCarbonDirection(Message::CarbonDir cd) { MessageD()->carbonDir = cd; } | ||
void Message::setCarbonsPrivate(bool enable) { MessageD()->carbonsPrivate = enable; } | ||
|
||
Message::CarbonDir Message::carbonDirection() const { return d ? d->carbonDir : NoCarbon; } | ||
bool Message::carbonsPrivate() const { return (d && d->carbonsPrivate); } | ||
|
||
void Message::setForwardedFrom(const Jid &jid) { MessageD()->forwardedFrom = jid; } | ||
void Message::setForwarded(const Forwarding &frw) { MessageD()->forwarding = frw; } | ||
|
||
Jid Message::forwardedFrom() const { return d ? d->forwardedFrom : Jid(); } | ||
const Forwarding &Message::forwarded() const { return d->forwarding; } | ||
|
||
bool Message::spooled() const { return d && d->spooled; } | ||
|
||
|
@@ -1400,10 +1428,10 @@ Stanza Message::toStanza(Stream *stream) const | |
} | ||
|
||
// Avoiding Carbons | ||
if (isDisabledCarbons()) { | ||
QDomElement e = s.createElement("urn:xmpp:carbons:2", "private"); | ||
s.appendChild(e); | ||
if (d->carbonsPrivate) { | ||
s.appendChild(CarbonsManager::privateElement(stream->doc())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to xep 280, a private stanza also need a |
||
} | ||
|
||
if (!d->replaceId.isEmpty()) { | ||
QDomElement e = s.createElement("urn:xmpp:message-correct:0", "replace"); | ||
e.setAttribute("id", d->replaceId); | ||
|
@@ -1440,6 +1468,10 @@ Stanza Message::toStanza(Stream *stream) const | |
s.appendChild(e); | ||
} | ||
|
||
// XEP-0297: Stanza Forwarding | ||
if (d->forwarding.type() != Forwarding::ForwardedNone) | ||
s.appendChild(d->forwarding.toXml(stream)); | ||
|
||
// XEP-0372 and XEP-0385 | ||
for (auto const &r : std::as_const(d->references)) { | ||
s.appendChild(r.toXml(&s.doc())); | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.