Related to FS#134: Set Message flags according to httpupload hint
This commit is contained in:
parent
ee0264d98c
commit
4db32cdc8f
3 changed files with 9 additions and 0 deletions
|
@ -537,6 +537,10 @@ public class Message extends AbstractEntity {
|
||||||
mTreatAsDownloadAble = Decision.NEVER;
|
mTreatAsDownloadAble = Decision.NEVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTreatAsDownloadable(Decision downloadable) {
|
||||||
|
this.mTreatAsDownloadAble = downloadable;
|
||||||
|
}
|
||||||
|
|
||||||
public Decision treatAsDownloadable() {
|
public Decision treatAsDownloadable() {
|
||||||
// only test this ones, body will not change
|
// only test this ones, body will not change
|
||||||
if (mTreatAsDownloadAble != Decision.NOT_DECIDED) {
|
if (mTreatAsDownloadAble != Decision.NOT_DECIDED) {
|
||||||
|
|
|
@ -97,6 +97,8 @@ public class HttpUploadConnection implements Transferable {
|
||||||
|
|
||||||
public void init(Message message, boolean delay) {
|
public void init(Message message, boolean delay) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
this.message.setHttpUploaded(true);
|
||||||
|
this.message.setNoDownloadable();
|
||||||
this.account = message.getConversation().getAccount();
|
this.account = message.getConversation().getAccount();
|
||||||
this.file = FileBackend.getFile(message, false);
|
this.file = FileBackend.getFile(message, false);
|
||||||
this.mime = this.file.getMimeType();
|
this.mime = this.file.getMimeType();
|
||||||
|
|
|
@ -392,6 +392,9 @@ public class MessageParser extends AbstractParser implements
|
||||||
serverMsgId = extractStanzaId(packet, isTypeGroupChat ? conversation.getJid().toBareJid() : account.getServer());
|
serverMsgId = extractStanzaId(packet, isTypeGroupChat ? conversation.getJid().toBareJid() : account.getServer());
|
||||||
}
|
}
|
||||||
message.setHttpUploaded(packet.hasChild(HttpUploadHint.ELEMENT_NAME, HttpUploadHint.NAMESPACE));
|
message.setHttpUploaded(packet.hasChild(HttpUploadHint.ELEMENT_NAME, HttpUploadHint.NAMESPACE));
|
||||||
|
if (message.isHttpUploaded()) {
|
||||||
|
message.setTreatAsDownloadable(Message.Decision.MUST);
|
||||||
|
}
|
||||||
|
|
||||||
message.setCounterpart(counterpart);
|
message.setCounterpart(counterpart);
|
||||||
message.setRemoteMsgId(remoteMsgId);
|
message.setRemoteMsgId(remoteMsgId);
|
||||||
|
|
Loading…
Reference in a new issue